blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
d39d312f8b76cd76272826daf07b6a240f374d89
[ "user = UserDBModel.query.get(user_id)\nif not user:\n ns.abort(404, status=USER_NOT_FOUND_ERROR)\nprojects = FavoritesProjectDBModel.get_favorites_of_user_id(user_id)\nresponse_object = {'user_id': user_id, 'projects_id': projects}\nreturn (response_object, 200)", "try:\n data = request.get_json()\n tok...
<|body_start_0|> user = UserDBModel.query.get(user_id) if not user: ns.abort(404, status=USER_NOT_FOUND_ERROR) projects = FavoritesProjectDBModel.get_favorites_of_user_id(user_id) response_object = {'user_id': user_id, 'projects_id': projects} return (response_object,...
UserFavoriteProjectsListResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserFavoriteProjectsListResource: def get(self, user_id): """Get User's favorite projects""" <|body_0|> def post(self, user_id): """Add project to user favorites""" <|body_1|> def delete(self, user_id): """Remove project to user favorites""" ...
stack_v2_sparse_classes_75kplus_train_001900
4,477
no_license
[ { "docstring": "Get User's favorite projects", "name": "get", "signature": "def get(self, user_id)" }, { "docstring": "Add project to user favorites", "name": "post", "signature": "def post(self, user_id)" }, { "docstring": "Remove project to user favorites", "name": "delete"...
3
stack_v2_sparse_classes_30k_train_015634
Implement the Python class `UserFavoriteProjectsListResource` described below. Class description: Implement the UserFavoriteProjectsListResource class. Method signatures and docstrings: - def get(self, user_id): Get User's favorite projects - def post(self, user_id): Add project to user favorites - def delete(self, u...
Implement the Python class `UserFavoriteProjectsListResource` described below. Class description: Implement the UserFavoriteProjectsListResource class. Method signatures and docstrings: - def get(self, user_id): Get User's favorite projects - def post(self, user_id): Add project to user favorites - def delete(self, u...
e4f2f6ec8ddde4d2af1a14ad89df8e01acf8d9db
<|skeleton|> class UserFavoriteProjectsListResource: def get(self, user_id): """Get User's favorite projects""" <|body_0|> def post(self, user_id): """Add project to user favorites""" <|body_1|> def delete(self, user_id): """Remove project to user favorites""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserFavoriteProjectsListResource: def get(self, user_id): """Get User's favorite projects""" user = UserDBModel.query.get(user_id) if not user: ns.abort(404, status=USER_NOT_FOUND_ERROR) projects = FavoritesProjectDBModel.get_favorites_of_user_id(user_id) re...
the_stack_v2_python_sparse
backend_users/prod/api/one_user_favorite_projects_api.py
Seedy-Fiuba-Grupo-5/Backend-users
train
0
d0c34a3185e2333a46fa0f7369266aa4e10b1685
[ "resblk_cls = ConditionalResidualBlock\nnorm_layer = lambda num_features: ConditionalBatchNorm2d(num_features, num_classes)\nsuper(ConditionalGenerator, self).__init__(conv_channels, conv_upsample, resblk_cls=resblk_cls, norm_layer=norm_layer, dim_z=dim_z, im_channels=im_channels)", "c = c.view(-1)\nx = self.line...
<|body_start_0|> resblk_cls = ConditionalResidualBlock norm_layer = lambda num_features: ConditionalBatchNorm2d(num_features, num_classes) super(ConditionalGenerator, self).__init__(conv_channels, conv_upsample, resblk_cls=resblk_cls, norm_layer=norm_layer, dim_z=dim_z, im_channels=im_channels) ...
ConditionalGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConditionalGenerator: def __init__(self, conv_channels, conv_upsample, num_classes, dim_z=128, im_channels=3): """norm_layer = lambda num_features: ConditionalBatchNorm2d(num_features, num_classes)""" <|body_0|> def forward(self, x, c): """x batch_size x im_channels ...
stack_v2_sparse_classes_75kplus_train_001901
18,748
no_license
[ { "docstring": "norm_layer = lambda num_features: ConditionalBatchNorm2d(num_features, num_classes)", "name": "__init__", "signature": "def __init__(self, conv_channels, conv_upsample, num_classes, dim_z=128, im_channels=3)" }, { "docstring": "x batch_size x im_channels x h x w c batch_size", ...
2
stack_v2_sparse_classes_30k_train_018505
Implement the Python class `ConditionalGenerator` described below. Class description: Implement the ConditionalGenerator class. Method signatures and docstrings: - def __init__(self, conv_channels, conv_upsample, num_classes, dim_z=128, im_channels=3): norm_layer = lambda num_features: ConditionalBatchNorm2d(num_feat...
Implement the Python class `ConditionalGenerator` described below. Class description: Implement the ConditionalGenerator class. Method signatures and docstrings: - def __init__(self, conv_channels, conv_upsample, num_classes, dim_z=128, im_channels=3): norm_layer = lambda num_features: ConditionalBatchNorm2d(num_feat...
0a6653a66f1fb2590df9d6697e4cd69d32a2baaa
<|skeleton|> class ConditionalGenerator: def __init__(self, conv_channels, conv_upsample, num_classes, dim_z=128, im_channels=3): """norm_layer = lambda num_features: ConditionalBatchNorm2d(num_features, num_classes)""" <|body_0|> def forward(self, x, c): """x batch_size x im_channels ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConditionalGenerator: def __init__(self, conv_channels, conv_upsample, num_classes, dim_z=128, im_channels=3): """norm_layer = lambda num_features: ConditionalBatchNorm2d(num_features, num_classes)""" resblk_cls = ConditionalResidualBlock norm_layer = lambda num_features: ConditionalBa...
the_stack_v2_python_sparse
pe/models_cgan.py
tt6746690/misc_impl
train
0
0b4356b0175a7e926165e032baa3cdb4df7a8d7c
[ "ret = 0\nbuy = sys.maxint\nfor i, e in enumerate(prices):\n if e > buy:\n if e - buy > 0:\n ret += e - buy\n buy = e\n else:\n buy = e\nreturn ret", "if not prices:\n return 0\nres = 0\nfor i in range(1, len(prices)):\n if prices[i] > prices[i - 1]:\n res +=...
<|body_start_0|> ret = 0 buy = sys.maxint for i, e in enumerate(prices): if e > buy: if e - buy > 0: ret += e - buy buy = e else: buy = e return ret <|end_body_0|> <|body_start_1|> if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices): """贪婪法 :type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = 0 buy = sys.maxint ...
stack_v2_sparse_classes_75kplus_train_001902
1,130
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit1", "signature": "def maxProfit1(self, prices)" }, { "docstring": "贪婪法 :type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" } ]
2
stack_v2_sparse_classes_30k_train_002906
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit1(self, prices): :type prices: List[int] :rtype: int - def maxProfit(self, prices): 贪婪法 :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit1(self, prices): :type prices: List[int] :rtype: int - def maxProfit(self, prices): 贪婪法 :type prices: List[int] :rtype: int <|skeleton|> class Solution: def ma...
fabe435f366477ec3526add84accec0b4ac38919
<|skeleton|> class Solution: def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices): """贪婪法 :type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxProfit1(self, prices): """:type prices: List[int] :rtype: int""" ret = 0 buy = sys.maxint for i, e in enumerate(prices): if e > buy: if e - buy > 0: ret += e - buy buy = e else: ...
the_stack_v2_python_sparse
algorithm/leetcode/122_best-time-to-buy-and-sell-stock-ii.py
icejoywoo/toys
train
1
661f125bb46859dfd6afb06dec9ac6d2c6968f81
[ "self.ser = serial.Serial(port, baud, timeout=timeout)\ntime.sleep(5)\nself.filename = filename\nwith open(filename, 'r') as f:\n self.lines = [line.rstrip('\\n') for line in f]\n for item in self.lines:\n if item in 'ABCDEFGHIJKLMNOPQRSTUVXYZ':\n self.lines.remove(item)\nself.step = 0\nself...
<|body_start_0|> self.ser = serial.Serial(port, baud, timeout=timeout) time.sleep(5) self.filename = filename with open(filename, 'r') as f: self.lines = [line.rstrip('\n') for line in f] for item in self.lines: if item in 'ABCDEFGHIJKLMNOPQRSTUVXY...
.
Writer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Writer: """.""" def __init__(self, filename, port, timeout, baud=9600): """Constructor.""" <|body_0|> def refresh(self): """Read in new data from the file and split it.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.ser = serial.Serial(por...
stack_v2_sparse_classes_75kplus_train_001903
1,258
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, filename, port, timeout, baud=9600)" }, { "docstring": "Read in new data from the file and split it.", "name": "refresh", "signature": "def refresh(self)" } ]
2
stack_v2_sparse_classes_30k_train_048403
Implement the Python class `Writer` described below. Class description: . Method signatures and docstrings: - def __init__(self, filename, port, timeout, baud=9600): Constructor. - def refresh(self): Read in new data from the file and split it.
Implement the Python class `Writer` described below. Class description: . Method signatures and docstrings: - def __init__(self, filename, port, timeout, baud=9600): Constructor. - def refresh(self): Read in new data from the file and split it. <|skeleton|> class Writer: """.""" def __init__(self, filename,...
480d96309746be125c28f3795d78c84931181c00
<|skeleton|> class Writer: """.""" def __init__(self, filename, port, timeout, baud=9600): """Constructor.""" <|body_0|> def refresh(self): """Read in new data from the file and split it.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Writer: """.""" def __init__(self, filename, port, timeout, baud=9600): """Constructor.""" self.ser = serial.Serial(port, baud, timeout=timeout) time.sleep(5) self.filename = filename with open(filename, 'r') as f: self.lines = [line.rstrip('\n') for li...
the_stack_v2_python_sparse
New TRTL Prototype/boardless/serial_writer.py
mkpjnx/MEO_Sat_Tracking
train
0
2928e56aae6f9ca817f0eb4d3a935621131b33d4
[ "super(Classifier, self).__init__()\nself.drop = nn.Dropout(dropout)\nself.lin = nn.Linear(in_features=in_size, out_features=out_size, bias=True)", "if self.drop.p > 0:\n xs = self.drop(xs)\nxs = self.lin(xs)\nreturn xs" ]
<|body_start_0|> super(Classifier, self).__init__() self.drop = nn.Dropout(dropout) self.lin = nn.Linear(in_features=in_size, out_features=out_size, bias=True) <|end_body_0|> <|body_start_1|> if self.drop.p > 0: xs = self.drop(xs) xs = self.lin(xs) return xs ...
Classifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Classifier: def __init__(self, in_size, out_size, dropout): """Args: in_size: input tensor dimensionality out_size: outpout tensor dimensionality dropout: dropout rate""" <|body_0|> def forward(self, xs): """Args: xs: (tensor) batchsize x * x features Returns: (tenso...
stack_v2_sparse_classes_75kplus_train_001904
14,124
no_license
[ { "docstring": "Args: in_size: input tensor dimensionality out_size: outpout tensor dimensionality dropout: dropout rate", "name": "__init__", "signature": "def __init__(self, in_size, out_size, dropout)" }, { "docstring": "Args: xs: (tensor) batchsize x * x features Returns: (tensor) batchsize ...
2
stack_v2_sparse_classes_30k_train_029395
Implement the Python class `Classifier` described below. Class description: Implement the Classifier class. Method signatures and docstrings: - def __init__(self, in_size, out_size, dropout): Args: in_size: input tensor dimensionality out_size: outpout tensor dimensionality dropout: dropout rate - def forward(self, x...
Implement the Python class `Classifier` described below. Class description: Implement the Classifier class. Method signatures and docstrings: - def __init__(self, in_size, out_size, dropout): Args: in_size: input tensor dimensionality out_size: outpout tensor dimensionality dropout: dropout rate - def forward(self, x...
61d8a82a83b92ed12a278f9df58aab28e379a7f6
<|skeleton|> class Classifier: def __init__(self, in_size, out_size, dropout): """Args: in_size: input tensor dimensionality out_size: outpout tensor dimensionality dropout: dropout rate""" <|body_0|> def forward(self, xs): """Args: xs: (tensor) batchsize x * x features Returns: (tenso...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Classifier: def __init__(self, in_size, out_size, dropout): """Args: in_size: input tensor dimensionality out_size: outpout tensor dimensionality dropout: dropout rate""" super(Classifier, self).__init__() self.drop = nn.Dropout(dropout) self.lin = nn.Linear(in_features=in_size...
the_stack_v2_python_sparse
PRE_GCN/src/nnet/modules.py
baozi-lala/Character_Realation_Extraction
train
0
b6d76fbdcd95bebcb97142acdab8c99be67022da
[ "if hasattr(self, 'fac2cli'):\n set_cov = set()\n for i in range(len(self.fac2cli)):\n set_cov |= set(self.fac2cli[i])\n self.n_cli_uncov = self.aij.shape[0] - len(set_cov)\nelse:\n raise AttributeError('The attribute `fac2cli` is not set. See `facility_client_array` method to set the attribute.'...
<|body_start_0|> if hasattr(self, 'fac2cli'): set_cov = set() for i in range(len(self.fac2cli)): set_cov |= set(self.fac2cli[i]) self.n_cli_uncov = self.aij.shape[0] - len(set_cov) else: raise AttributeError('The attribute `fac2cli` is not ...
Mixin to calculate the percentage of area covered. Notes ----- This Mixin requires the ``n_cli_uncov`` attribute. This attribute is set using the ``uncovered_clients`` method which is located inside the model classes. When the ``solve`` method is called with ``results=True`` it will already set automatically, if not, y...
CoveragePercentageMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoveragePercentageMixin: """Mixin to calculate the percentage of area covered. Notes ----- This Mixin requires the ``n_cli_uncov`` attribute. This attribute is set using the ``uncovered_clients`` method which is located inside the model classes. When the ``solve`` method is called with ``results=...
stack_v2_sparse_classes_75kplus_train_001905
24,966
permissive
[ { "docstring": "Calculate how many clients points are not covered. Notes ----- This method requires ``fac2cli`` attribute to work properly. This attribute is set using ``facility_client_array`` method which is located inside the model classes. When the ``solve`` method is called with ``results=True`` it will be...
2
stack_v2_sparse_classes_30k_train_011240
Implement the Python class `CoveragePercentageMixin` described below. Class description: Mixin to calculate the percentage of area covered. Notes ----- This Mixin requires the ``n_cli_uncov`` attribute. This attribute is set using the ``uncovered_clients`` method which is located inside the model classes. When the ``s...
Implement the Python class `CoveragePercentageMixin` described below. Class description: Mixin to calculate the percentage of area covered. Notes ----- This Mixin requires the ``n_cli_uncov`` attribute. This attribute is set using the ``uncovered_clients`` method which is located inside the model classes. When the ``s...
8cbce133f44f39a56de5a85bdbcedbd66d115af0
<|skeleton|> class CoveragePercentageMixin: """Mixin to calculate the percentage of area covered. Notes ----- This Mixin requires the ``n_cli_uncov`` attribute. This attribute is set using the ``uncovered_clients`` method which is located inside the model classes. When the ``solve`` method is called with ``results=...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CoveragePercentageMixin: """Mixin to calculate the percentage of area covered. Notes ----- This Mixin requires the ``n_cli_uncov`` attribute. This attribute is set using the ``uncovered_clients`` method which is located inside the model classes. When the ``solve`` method is called with ``results=True`` it wil...
the_stack_v2_python_sparse
spopt/locate/base.py
jGaboardi/spopt
train
1
880caa3ab2a971b9a8fc58a5ea2ea7558bafeb06
[ "colors = labels[:, None] * cls.palette\ncolors = (colors % 255).astype('uint8')\nreturn colors", "labels = np.array(predictions['label_ids'])\nboxes = predictions['boxes']\ncolors = cls.compute_colors_for_labels(labels).tolist()\nfor box, color in zip(boxes, colors):\n top_left, bottom_right = (box[:2], box[2...
<|body_start_0|> colors = labels[:, None] * cls.palette colors = (colors % 255).astype('uint8') return colors <|end_body_0|> <|body_start_1|> labels = np.array(predictions['label_ids']) boxes = predictions['boxes'] colors = cls.compute_colors_for_labels(labels).tolist() ...
Draw bbox from predictions. Adapted from https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/demo/predictor.py. Under MIT licence.
COCODemoHelper
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class COCODemoHelper: """Draw bbox from predictions. Adapted from https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/demo/predictor.py. Under MIT licence.""" def compute_colors_for_labels(cls, labels): """Simple function that adds fixed colors depending on the class""" ...
stack_v2_sparse_classes_75kplus_train_001906
3,892
permissive
[ { "docstring": "Simple function that adds fixed colors depending on the class", "name": "compute_colors_for_labels", "signature": "def compute_colors_for_labels(cls, labels)" }, { "docstring": "Adds the predicted boxes on top of the image Arguments: image (np.ndarray): an image as returned by Op...
4
stack_v2_sparse_classes_30k_test_000444
Implement the Python class `COCODemoHelper` described below. Class description: Draw bbox from predictions. Adapted from https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/demo/predictor.py. Under MIT licence. Method signatures and docstrings: - def compute_colors_for_labels(cls, labels): Simple funct...
Implement the Python class `COCODemoHelper` described below. Class description: Draw bbox from predictions. Adapted from https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/demo/predictor.py. Under MIT licence. Method signatures and docstrings: - def compute_colors_for_labels(cls, labels): Simple funct...
757c68d9de0778e3da8bbfa678d89251a6955573
<|skeleton|> class COCODemoHelper: """Draw bbox from predictions. Adapted from https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/demo/predictor.py. Under MIT licence.""" def compute_colors_for_labels(cls, labels): """Simple function that adds fixed colors depending on the class""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class COCODemoHelper: """Draw bbox from predictions. Adapted from https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/demo/predictor.py. Under MIT licence.""" def compute_colors_for_labels(cls, labels): """Simple function that adds fixed colors depending on the class""" colors = ...
the_stack_v2_python_sparse
server/restapi/v2/coco_demo.py
cap-ntu/Video-to-Retail-Platform
train
63
df4d3c58825ba83a47f08c1c2dac58d23b94e7aa
[ "n = len(nums)\n\n@lru_cache(None)\ndef dfs(total):\n if total > target:\n return 0\n if total == target:\n return 1\n result = 0\n for num in nums:\n result += dfs(total + num)\n return result\nreturn dfs(0)", "dp = [0] * (target + 1)\ndp[0] = 1\nfor i in range(1, target + 1):...
<|body_start_0|> n = len(nums) @lru_cache(None) def dfs(total): if total > target: return 0 if total == target: return 1 result = 0 for num in nums: result += dfs(total + num) return resu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum4(self, nums: List[int], target: int) -> int: """DFS""" <|body_0|> def combinationSum4(self, nums: List[int], target: int) -> int: """DP, Time: O(n*target), Space: O(target)""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_001907
980
no_license
[ { "docstring": "DFS", "name": "combinationSum4", "signature": "def combinationSum4(self, nums: List[int], target: int) -> int" }, { "docstring": "DP, Time: O(n*target), Space: O(target)", "name": "combinationSum4", "signature": "def combinationSum4(self, nums: List[int], target: int) -> ...
2
stack_v2_sparse_classes_30k_train_024314
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4(self, nums: List[int], target: int) -> int: DFS - def combinationSum4(self, nums: List[int], target: int) -> int: DP, Time: O(n*target), Space: O(target)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4(self, nums: List[int], target: int) -> int: DFS - def combinationSum4(self, nums: List[int], target: int) -> int: DP, Time: O(n*target), Space: O(target) <|s...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def combinationSum4(self, nums: List[int], target: int) -> int: """DFS""" <|body_0|> def combinationSum4(self, nums: List[int], target: int) -> int: """DP, Time: O(n*target), Space: O(target)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def combinationSum4(self, nums: List[int], target: int) -> int: """DFS""" n = len(nums) @lru_cache(None) def dfs(total): if total > target: return 0 if total == target: return 1 result = 0 ...
the_stack_v2_python_sparse
python/377-Combination Sum IV.py
cwza/leetcode
train
0
f9505cb6e584b53da247837e9d22c998696971b5
[ "if tree:\n print(tree.get_root_val())\n Orders.preorder(tree.get_left_child())\n Orders.preorder(tree.get_right_child())", "if tree != None:\n Orders.inorder(tree.get_left_child())\n print(tree.get_root_val())\n Orders.inorder(tree.get_right_child())", "if tree != None:\n Orders.postorder(...
<|body_start_0|> if tree: print(tree.get_root_val()) Orders.preorder(tree.get_left_child()) Orders.preorder(tree.get_right_child()) <|end_body_0|> <|body_start_1|> if tree != None: Orders.inorder(tree.get_left_child()) print(tree.get_root_val(...
Стат методы для обхода дерева
Orders
[ "WTFPL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Orders: """Стат методы для обхода дерева""" def preorder(tree): """Прямой обход дерева""" <|body_0|> def inorder(tree): """Симметричный обход дерева""" <|body_1|> def postorder(tree): """Обратный обход""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_001908
2,441
permissive
[ { "docstring": "Прямой обход дерева", "name": "preorder", "signature": "def preorder(tree)" }, { "docstring": "Симметричный обход дерева", "name": "inorder", "signature": "def inorder(tree)" }, { "docstring": "Обратный обход", "name": "postorder", "signature": "def postor...
3
stack_v2_sparse_classes_30k_train_036948
Implement the Python class `Orders` described below. Class description: Стат методы для обхода дерева Method signatures and docstrings: - def preorder(tree): Прямой обход дерева - def inorder(tree): Симметричный обход дерева - def postorder(tree): Обратный обход
Implement the Python class `Orders` described below. Class description: Стат методы для обхода дерева Method signatures and docstrings: - def preorder(tree): Прямой обход дерева - def inorder(tree): Симметричный обход дерева - def postorder(tree): Обратный обход <|skeleton|> class Orders: """Стат методы для обхо...
9575c43fa01c261ea1ed573df9b5686b5a6f4211
<|skeleton|> class Orders: """Стат методы для обхода дерева""" def preorder(tree): """Прямой обход дерева""" <|body_0|> def inorder(tree): """Симметричный обход дерева""" <|body_1|> def postorder(tree): """Обратный обход""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Orders: """Стат методы для обхода дерева""" def preorder(tree): """Прямой обход дерева""" if tree: print(tree.get_root_val()) Orders.preorder(tree.get_left_child()) Orders.preorder(tree.get_right_child()) def inorder(tree): """Симметричный ...
the_stack_v2_python_sparse
Course_I/Алгоритмы Python/Part2/семинары/pract6/task3/task.py
GeorgiyDemo/FA
train
46
1a5b18a9d8518fce73b3dcacc0e3f01e85f1b0d7
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.security.ediscoveryCase'.casefold():\n f...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') try: mapping_value = parse_node.get_child_node('@odata.type').get_str_value() except AttributeError: mapping_value = None if mapping_value and mapping_value.casefold() ==...
Case
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Case: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Case: """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: Case""" ...
stack_v2_sparse_classes_75kplus_train_001909
4,007
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: Case", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(parse_no...
3
stack_v2_sparse_classes_30k_train_046213
Implement the Python class `Case` described below. Class description: Implement the Case class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Case: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
Implement the Python class `Case` described below. Class description: Implement the Case class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Case: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The pars...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Case: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Case: """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: Case""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Case: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Case: """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: Case""" if not parse_n...
the_stack_v2_python_sparse
msgraph/generated/models/security/case.py
microsoftgraph/msgraph-sdk-python
train
135
0c4639094b8a36755da8e49221d6534073a69560
[ "self.config = config\nself.name = name\nif len(rules_or_filters) == 0:\n raise ValueError('concept has one rule or filter at least', name)\nself.rules_or_filters = rules_or_filters\nself.concept_filters = concept_filters", "results = Results()\nfor rule_or_filter in self.rules_or_filters:\n results.add(rul...
<|body_start_0|> self.config = config self.name = name if len(rules_or_filters) == 0: raise ValueError('concept has one rule or filter at least', name) self.rules_or_filters = rules_or_filters self.concept_filters = concept_filters <|end_body_0|> <|body_start_1|> ...
概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ]
Concept
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Concept: """概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ]""" def __init__(self, config, name, rules_or_filters, conce...
stack_v2_sparse_classes_75kplus_train_001910
2,530
no_license
[ { "docstring": "初始化一个 Concept 对象 :param config: 包含配置信息的对象 :param name: 概念名称 :param rules_or_filters: 概念的匹配规则或规则过滤器, 规则与规则之间是 \"逻辑或\" 的操作, 即所有规则命中结果的集合 :param concept_filters: 概念过滤器, 用在所有的结果上进行过滤, 默认不存在", "name": "__init__", "signature": "def __init__(self, config, name, rules_or_filters, concept_filters...
2
stack_v2_sparse_classes_30k_train_043989
Implement the Python class `Concept` described below. Class description: 概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ] Method signatures and do...
Implement the Python class `Concept` described below. Class description: 概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ] Method signatures and do...
0d587707b0ecae5a321e8a394cc0cf96fcf58235
<|skeleton|> class Concept: """概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ]""" def __init__(self, config, name, rules_or_filters, conce...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Concept: """概念对象是规则的集合, 可以一定程度标定客观物理世界的一些通用规范. 例如, 我们规则中会大量使用到 "手机" 这个概念, 我们可以建立一个 "Phone" 的概念, 对应给它赋予一些规则来表征. concept_name = Phone rules = [ $kw("mobilephone"), $kw("phone"), $seq("mobile", "phone"), $ord(@d5, "my", "phone"), ... ]""" def __init__(self, config, name, rules_or_filters, concept_filters=[]...
the_stack_v2_python_sparse
report_code/code/kme/concept/concept.py
Mi524/tools_copy
train
0
bf6f28549df628e48491abe0e634fc59acc3dda4
[ "self.__cell_matrix = []\ncells = []\nfor col in self.columns:\n cells.append(self._MakeCell(col.name, alignment=col.alignment))\nself.__cell_matrix.append(tuple(cells))\nfor row in self.rows:\n cells = []\n for cell, col in zip(row, self.columns):\n cell = self._MakeCell(cell, alignment=col.alignme...
<|body_start_0|> self.__cell_matrix = [] cells = [] for col in self.columns: cells.append(self._MakeCell(col.name, alignment=col.alignment)) self.__cell_matrix.append(tuple(cells)) for row in self.rows: cells = [] for cell, col in zip(row, self...
A class that can be used for displaying tabular data. This class can produce tables like the following: +------+-------------+--------------+------------+------+ | Rank | Country | Capital City | Population | Year | +------+-------------+--------------+------------+------+ | 1 | Japan | Tokyo | 13,189,000 | 2011 | +---...
Table
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Table: """A class that can be used for displaying tabular data. This class can produce tables like the following: +------+-------------+--------------+------------+------+ | Rank | Country | Capital City | Population | Year | +------+-------------+--------------+------------+------+ | 1 | Japan |...
stack_v2_sparse_classes_75kplus_train_001911
32,076
permissive
[ { "docstring": "Creates a matrix containing the column headers and rows as _Cells. The result is placed in the property __cell_matrix.", "name": "_MakeCellMatrix", "signature": "def _MakeCellMatrix(self)" }, { "docstring": "Writes the table to out. Assumes SetColumns() has been called. Args: out...
2
stack_v2_sparse_classes_30k_test_000479
Implement the Python class `Table` described below. Class description: A class that can be used for displaying tabular data. This class can produce tables like the following: +------+-------------+--------------+------------+------+ | Rank | Country | Capital City | Population | Year | +------+-------------+----------...
Implement the Python class `Table` described below. Class description: A class that can be used for displaying tabular data. This class can produce tables like the following: +------+-------------+--------------+------------+------+ | Rank | Country | Capital City | Population | Year | +------+-------------+----------...
d379afa2db3582d5c3be652165f0e9e2e0c154c6
<|skeleton|> class Table: """A class that can be used for displaying tabular data. This class can produce tables like the following: +------+-------------+--------------+------------+------+ | Rank | Country | Capital City | Population | Year | +------+-------------+--------------+------------+------+ | 1 | Japan |...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Table: """A class that can be used for displaying tabular data. This class can produce tables like the following: +------+-------------+--------------+------------+------+ | Rank | Country | Capital City | Population | Year | +------+-------------+--------------+------------+------+ | 1 | Japan | Tokyo | 13,1...
the_stack_v2_python_sparse
y/google-cloud-sdk/.install/.backup/platform/gcutil/lib/google_compute_engine/gcutil_lib/table/table.py
ychen820/microblog
train
0
092a8400c20111edbdb5d2985d4d796256b5eb6a
[ "self.use_variance = args['use_variance'] if args is not None and 'use_variance' in args.keys() else False\nself.alpha = args['alpha'] if args is not None and 'alpha' in args.keys() else 1\nself.beta = args['beta'] if args is not None and 'beta' in args.keys() else 1\nself.name = 'mtp_loss'", "traj = predictions[...
<|body_start_0|> self.use_variance = args['use_variance'] if args is not None and 'use_variance' in args.keys() else False self.alpha = args['alpha'] if args is not None and 'alpha' in args.keys() else 1 self.beta = args['beta'] if args is not None and 'beta' in args.keys() else 1 self.n...
MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors.
MTPLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MTPLoss: """MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors.""" def __init__(self, args: Dict=None): """Initialize MTP loss :param args: Dictionary with the following (optional) keys use_var...
stack_v2_sparse_classes_75kplus_train_001912
2,750
permissive
[ { "docstring": "Initialize MTP loss :param args: Dictionary with the following (optional) keys use_variance: bool, whether or not to use variances for computing regression component of loss, default: False alpha: float, relative weight assigned to classification component, compared to regression component of lo...
2
null
Implement the Python class `MTPLoss` described below. Class description: MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors. Method signatures and docstrings: - def __init__(self, args: Dict=None): Initialize MTP loss :param ar...
Implement the Python class `MTPLoss` described below. Class description: MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors. Method signatures and docstrings: - def __init__(self, args: Dict=None): Initialize MTP loss :param ar...
6419894aa040adb9570b14493952a98c0a52f803
<|skeleton|> class MTPLoss: """MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors.""" def __init__(self, args: Dict=None): """Initialize MTP loss :param args: Dictionary with the following (optional) keys use_var...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MTPLoss: """MTP loss modified to include variances. Uses MSE for mode selection. Can also be used with Multipath outputs, with residuals added to anchors.""" def __init__(self, args: Dict=None): """Initialize MTP loss :param args: Dictionary with the following (optional) keys use_variance: bool, ...
the_stack_v2_python_sparse
metrics/mtp_loss.py
sancarlim/Explainable-MP
train
17
428246de0349700a0d35e6466b53e334806dfe82
[ "super(DlgHistory, self).__init__(parent)\nself.ui = Ui_DlgHistory()\nself.ui.setupUi(self)\ntry:\n self._task = task\n self.logManager = LogManager()\n self.taskViewModel = QStandardItemModel(self)\n self.ui.tableView.setModel(self.taskViewModel)\n self.ui.tableView.doubleClicked.connect(self.On_Vie...
<|body_start_0|> super(DlgHistory, self).__init__(parent) self.ui = Ui_DlgHistory() self.ui.setupUi(self) try: self._task = task self.logManager = LogManager() self.taskViewModel = QStandardItemModel(self) self.ui.tableView.setModel(self.ta...
Class for History Dialog Attributes: ----------- _task : MirrorTask task to see history _logManager : LogManager taskViewMode : QStandardItemModel log_data : list the list of logs in the history Methods: ----------- On_View(mi) opens the detail log window LoadTable(): loads the history table Slots: ----------- On_View(...
DlgHistory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DlgHistory: """Class for History Dialog Attributes: ----------- _task : MirrorTask task to see history _logManager : LogManager taskViewMode : QStandardItemModel log_data : list the list of logs in the history Methods: ----------- On_View(mi) opens the detail log window LoadTable(): loads the his...
stack_v2_sparse_classes_75kplus_train_001913
4,016
no_license
[ { "docstring": "Params: ------- parent : FormMainWindow task : MirrorTask", "name": "__init__", "signature": "def __init__(self, parent, task)" }, { "docstring": "check if log file exist, and pop ups the DlgLog dialog Params : -------- mi : ModelIndex selected TableView cell", "name": "On_Vi...
3
stack_v2_sparse_classes_30k_train_040721
Implement the Python class `DlgHistory` described below. Class description: Class for History Dialog Attributes: ----------- _task : MirrorTask task to see history _logManager : LogManager taskViewMode : QStandardItemModel log_data : list the list of logs in the history Methods: ----------- On_View(mi) opens the detai...
Implement the Python class `DlgHistory` described below. Class description: Class for History Dialog Attributes: ----------- _task : MirrorTask task to see history _logManager : LogManager taskViewMode : QStandardItemModel log_data : list the list of logs in the history Methods: ----------- On_View(mi) opens the detai...
7385b19fcafc7bc4fdace566961afc79e6945558
<|skeleton|> class DlgHistory: """Class for History Dialog Attributes: ----------- _task : MirrorTask task to see history _logManager : LogManager taskViewMode : QStandardItemModel log_data : list the list of logs in the history Methods: ----------- On_View(mi) opens the detail log window LoadTable(): loads the his...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DlgHistory: """Class for History Dialog Attributes: ----------- _task : MirrorTask task to see history _logManager : LogManager taskViewMode : QStandardItemModel log_data : list the list of logs in the history Methods: ----------- On_View(mi) opens the detail log window LoadTable(): loads the history table Sl...
the_stack_v2_python_sparse
Core/dlgHistory.py
paul-wang0226/RoboCopy_GUI
train
0
cc7378b9e7a93f244314eb9205d2b3c9155edc93
[ "if skip_deleted:\n query = User.query.filter_by(username=username, is_deleted=False)\nelse:\n query = User.query.filter_by(username=username)\nreturn query.first()", "if skip_deleted:\n query = User.query.filter_by(email=email, is_deleted=False)\nelse:\n query = User.query.filter_by(email=email)\nret...
<|body_start_0|> if skip_deleted: query = User.query.filter_by(username=username, is_deleted=False) else: query = User.query.filter_by(username=username) return query.first() <|end_body_0|> <|body_start_1|> if skip_deleted: query = User.query.filter_b...
Platform users. Attributes: id (int): ID of the user record. username (str): Unique username. name (str): (Optional) Real name of the user. email (str): Unique email used for communication and password reset. password (str): Encrypted password. pasword_reset_token (str): Unique token for restoring password. token_expir...
User
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: """Platform users. Attributes: id (int): ID of the user record. username (str): Unique username. name (str): (Optional) Real name of the user. email (str): Unique email used for communication and password reset. password (str): Encrypted password. pasword_reset_token (str): Unique token for...
stack_v2_sparse_classes_75kplus_train_001914
12,551
permissive
[ { "docstring": "Obtain a user by username. Args: username (str): Username to find. skip_deleted (bool): Whether to skip deleted users.", "name": "_by_username", "signature": "def _by_username(username, skip_deleted=True)" }, { "docstring": "Obtain a user by email. Args: email (str): Email to fin...
2
stack_v2_sparse_classes_30k_train_046745
Implement the Python class `User` described below. Class description: Platform users. Attributes: id (int): ID of the user record. username (str): Unique username. name (str): (Optional) Real name of the user. email (str): Unique email used for communication and password reset. password (str): Encrypted password. pasw...
Implement the Python class `User` described below. Class description: Platform users. Attributes: id (int): ID of the user record. username (str): Unique username. name (str): (Optional) Real name of the user. email (str): Unique email used for communication and password reset. password (str): Encrypted password. pasw...
b25b6b2deec5d27c840d60f33e5aa33bd56ba08a
<|skeleton|> class User: """Platform users. Attributes: id (int): ID of the user record. username (str): Unique username. name (str): (Optional) Real name of the user. email (str): Unique email used for communication and password reset. password (str): Encrypted password. pasword_reset_token (str): Unique token for...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class User: """Platform users. Attributes: id (int): ID of the user record. username (str): Unique username. name (str): (Optional) Real name of the user. email (str): Unique email used for communication and password reset. password (str): Encrypted password. pasword_reset_token (str): Unique token for restoring pa...
the_stack_v2_python_sparse
loc/models.py
guluc3m/loc-server
train
0
c4443b2460dcb2578b5e233e05dfa1b2e5e713ae
[ "pattern = '(?i)[aoeiu]'\nvowelList = re.findall(pattern, s)\nreturn re.sub(pattern, lambda m: vowelList.pop(), s)", "vowelsList = ['a', 'o', 'e', 'i', 'u', 'A', 'O', 'E', 'I', 'U']\ni = 0\nj = len(s) - 1\ns = list(s)\nwhile i < j:\n while i < j and (not s[i] in vowelsList):\n i = i + 1\n while j > i...
<|body_start_0|> pattern = '(?i)[aoeiu]' vowelList = re.findall(pattern, s) return re.sub(pattern, lambda m: vowelList.pop(), s) <|end_body_0|> <|body_start_1|> vowelsList = ['a', 'o', 'e', 'i', 'u', 'A', 'O', 'E', 'I', 'U'] i = 0 j = len(s) - 1 s = list(s) ...
leetCode 345. Reverse Vowels of a String https://leetcode.com/problems/reverse-vowels-of-a-string/
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """leetCode 345. Reverse Vowels of a String https://leetcode.com/problems/reverse-vowels-of-a-string/""" def reverseVowels(self, s): """:type s: str :rtype: str""" <|body_0|> def reverseVowelsOne(self, s): """:type s: str :rtype: str""" <|body_1...
stack_v2_sparse_classes_75kplus_train_001915
1,190
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "reverseVowels", "signature": "def reverseVowels(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "reverseVowelsOne", "signature": "def reverseVowelsOne(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_027154
Implement the Python class `Solution` described below. Class description: leetCode 345. Reverse Vowels of a String https://leetcode.com/problems/reverse-vowels-of-a-string/ Method signatures and docstrings: - def reverseVowels(self, s): :type s: str :rtype: str - def reverseVowelsOne(self, s): :type s: str :rtype: st...
Implement the Python class `Solution` described below. Class description: leetCode 345. Reverse Vowels of a String https://leetcode.com/problems/reverse-vowels-of-a-string/ Method signatures and docstrings: - def reverseVowels(self, s): :type s: str :rtype: str - def reverseVowelsOne(self, s): :type s: str :rtype: st...
9d5206b594416444dda4745d466e06ccc6acbe11
<|skeleton|> class Solution: """leetCode 345. Reverse Vowels of a String https://leetcode.com/problems/reverse-vowels-of-a-string/""" def reverseVowels(self, s): """:type s: str :rtype: str""" <|body_0|> def reverseVowelsOne(self, s): """:type s: str :rtype: str""" <|body_1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """leetCode 345. Reverse Vowels of a String https://leetcode.com/problems/reverse-vowels-of-a-string/""" def reverseVowels(self, s): """:type s: str :rtype: str""" pattern = '(?i)[aoeiu]' vowelList = re.findall(pattern, s) return re.sub(pattern, lambda m: vowelLi...
the_stack_v2_python_sparse
python/reverseVowels.py
yoyo76ke/algorithm
train
0
6b295af00154b0a8f1dfa5080f3ccf0b0328bebe
[ "super(Swagger, self).__init__(**extra)\nself.swagger = '2.0'\nself.info = info\nself.info.version = _version or info._default_version\nif _url:\n url = urlparse.urlparse(_url)\n assert url.netloc and url.scheme, 'if given, url must have both schema and netloc'\n self.host = url.netloc\n self.schemes = ...
<|body_start_0|> super(Swagger, self).__init__(**extra) self.swagger = '2.0' self.info = info self.info.version = _version or info._default_version if _url: url = urlparse.urlparse(_url) assert url.netloc and url.scheme, 'if given, url must have both schem...
Swagger
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Swagger: def __init__(self, info=None, _url=None, _prefix=None, _version=None, consumes=None, produces=None, security_definitions=None, security=None, paths=None, definitions=None, **extra): """Root Swagger object. :param Info info: info object :param str _url: URL used for setting the A...
stack_v2_sparse_classes_75kplus_train_001916
31,035
permissive
[ { "docstring": "Root Swagger object. :param Info info: info object :param str _url: URL used for setting the API host and scheme :param str _prefix: api path prefix to use in setting basePath; this will be appended to the wsgi SCRIPT_NAME prefix or Django's FORCE_SCRIPT_NAME if applicable :param str _version: v...
2
stack_v2_sparse_classes_30k_train_038563
Implement the Python class `Swagger` described below. Class description: Implement the Swagger class. Method signatures and docstrings: - def __init__(self, info=None, _url=None, _prefix=None, _version=None, consumes=None, produces=None, security_definitions=None, security=None, paths=None, definitions=None, **extra)...
Implement the Python class `Swagger` described below. Class description: Implement the Swagger class. Method signatures and docstrings: - def __init__(self, info=None, _url=None, _prefix=None, _version=None, consumes=None, produces=None, security_definitions=None, security=None, paths=None, definitions=None, **extra)...
78031f0c189585c30fccb5005a6899f2d34289a9
<|skeleton|> class Swagger: def __init__(self, info=None, _url=None, _prefix=None, _version=None, consumes=None, produces=None, security_definitions=None, security=None, paths=None, definitions=None, **extra): """Root Swagger object. :param Info info: info object :param str _url: URL used for setting the A...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Swagger: def __init__(self, info=None, _url=None, _prefix=None, _version=None, consumes=None, produces=None, security_definitions=None, security=None, paths=None, definitions=None, **extra): """Root Swagger object. :param Info info: info object :param str _url: URL used for setting the API host and sc...
the_stack_v2_python_sparse
src/drf_yasg/openapi.py
axnsan12/drf-yasg
train
3,320
4b5138967c1399153a6017b312fffa391e733bdc
[ "self.dt_in = datetime(2017, 2, 17, 6, 0)\nself.cftime_in = cftime.DatetimeGregorian(2017, 2, 17, hour=6, minute=0)\nself.expected = 1487311200.0", "result = datetime_to_iris_time(self.dt_in)\nself.assertIsInstance(result, np.int64)\nself.assertEqual(result, self.expected)", "result = datetime_to_iris_time(self...
<|body_start_0|> self.dt_in = datetime(2017, 2, 17, 6, 0) self.cftime_in = cftime.DatetimeGregorian(2017, 2, 17, hour=6, minute=0) self.expected = 1487311200.0 <|end_body_0|> <|body_start_1|> result = datetime_to_iris_time(self.dt_in) self.assertIsInstance(result, np.int64) ...
Test the datetime_to_iris_time function.
Test_datetime_to_iris_time
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_datetime_to_iris_time: """Test the datetime_to_iris_time function.""" def setUp(self): """Define datetime for use in tests.""" <|body_0|> def test_seconds(self): """Test datetime_to_iris_time returns float with expected value in seconds""" <|body_1|>...
stack_v2_sparse_classes_75kplus_train_001917
19,622
permissive
[ { "docstring": "Define datetime for use in tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test datetime_to_iris_time returns float with expected value in seconds", "name": "test_seconds", "signature": "def test_seconds(self)" }, { "docstring": "Test d...
3
stack_v2_sparse_classes_30k_train_038445
Implement the Python class `Test_datetime_to_iris_time` described below. Class description: Test the datetime_to_iris_time function. Method signatures and docstrings: - def setUp(self): Define datetime for use in tests. - def test_seconds(self): Test datetime_to_iris_time returns float with expected value in seconds ...
Implement the Python class `Test_datetime_to_iris_time` described below. Class description: Test the datetime_to_iris_time function. Method signatures and docstrings: - def setUp(self): Define datetime for use in tests. - def test_seconds(self): Test datetime_to_iris_time returns float with expected value in seconds ...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_datetime_to_iris_time: """Test the datetime_to_iris_time function.""" def setUp(self): """Define datetime for use in tests.""" <|body_0|> def test_seconds(self): """Test datetime_to_iris_time returns float with expected value in seconds""" <|body_1|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_datetime_to_iris_time: """Test the datetime_to_iris_time function.""" def setUp(self): """Define datetime for use in tests.""" self.dt_in = datetime(2017, 2, 17, 6, 0) self.cftime_in = cftime.DatetimeGregorian(2017, 2, 17, hour=6, minute=0) self.expected = 1487311200....
the_stack_v2_python_sparse
improver_tests/utilities/temporal/test_temporal.py
metoppv/improver
train
101
ba28ecd2c4f99542cfa2330745801482f67ad76f
[ "item = Inventory('1234', 'Book', '$100', '$75')\nself.assertEqual('1234', item.product_code)\nself.assertEqual('Book', item.description)\nself.assertEqual('$100', item.market_price)\nself.assertEqual('$75', item.rental_price)", "item = Inventory('1234', 'Book', '$100', '$75')\nitem_info = item.return_as_dictiona...
<|body_start_0|> item = Inventory('1234', 'Book', '$100', '$75') self.assertEqual('1234', item.product_code) self.assertEqual('Book', item.description) self.assertEqual('$100', item.market_price) self.assertEqual('$75', item.rental_price) <|end_body_0|> <|body_start_1|> ...
Unit tests the Inventory class
InventoryTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InventoryTest: """Unit tests the Inventory class""" def test_add_item(self): """creates an object of the inventory class""" <|body_0|> def test_return_dict(self): """calls the return_as_dictionary function on the inventory class""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_001918
10,292
no_license
[ { "docstring": "creates an object of the inventory class", "name": "test_add_item", "signature": "def test_add_item(self)" }, { "docstring": "calls the return_as_dictionary function on the inventory class", "name": "test_return_dict", "signature": "def test_return_dict(self)" } ]
2
stack_v2_sparse_classes_30k_train_014039
Implement the Python class `InventoryTest` described below. Class description: Unit tests the Inventory class Method signatures and docstrings: - def test_add_item(self): creates an object of the inventory class - def test_return_dict(self): calls the return_as_dictionary function on the inventory class
Implement the Python class `InventoryTest` described below. Class description: Unit tests the Inventory class Method signatures and docstrings: - def test_add_item(self): creates an object of the inventory class - def test_return_dict(self): calls the return_as_dictionary function on the inventory class <|skeleton|>...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class InventoryTest: """Unit tests the Inventory class""" def test_add_item(self): """creates an object of the inventory class""" <|body_0|> def test_return_dict(self): """calls the return_as_dictionary function on the inventory class""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InventoryTest: """Unit tests the Inventory class""" def test_add_item(self): """creates an object of the inventory class""" item = Inventory('1234', 'Book', '$100', '$75') self.assertEqual('1234', item.product_code) self.assertEqual('Book', item.description) self.a...
the_stack_v2_python_sparse
students/David_Baylor/lesson01/Assignment/test_unit.py
JavaRod/SP_Python220B_2019
train
1
f626518698d28db912ab31462e56eb87fe8c1caa
[ "super(Policy, self).__init__()\nself.action_bound = action_bound\nself.detector = detector\nself.lut_thetas = lut_info['thetas']\nself.lut_phis = lut_info['phis']\nself.lut_mask = lut_info['mask']\nself.p = local_p\nself.thresh = thresh\nself.phi_thresh = phi_thresh\nself.name = 'random + in-bounds 2'\nself.im_ctr...
<|body_start_0|> super(Policy, self).__init__() self.action_bound = action_bound self.detector = detector self.lut_thetas = lut_info['thetas'] self.lut_phis = lut_info['phis'] self.lut_mask = lut_info['mask'] self.p = local_p self.thresh = thresh s...
This custom policy combines 'downward' heuristic location info.
CustomPolicy7
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomPolicy7: """This custom policy combines 'downward' heuristic location info.""" def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5, phi_thresh=np.pi / 4): """Initialize custom policy.""" <|body_0|> def best_bb(self, bbs): """Returns...
stack_v2_sparse_classes_75kplus_train_001919
45,503
permissive
[ { "docstring": "Initialize custom policy.", "name": "__init__", "signature": "def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5, phi_thresh=np.pi / 4)" }, { "docstring": "Returns predicted bounding box for ripe strawberry with highest confidence value.", "name": "b...
4
stack_v2_sparse_classes_30k_train_049059
Implement the Python class `CustomPolicy7` described below. Class description: This custom policy combines 'downward' heuristic location info. Method signatures and docstrings: - def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5, phi_thresh=np.pi / 4): Initialize custom policy. - def best_b...
Implement the Python class `CustomPolicy7` described below. Class description: This custom policy combines 'downward' heuristic location info. Method signatures and docstrings: - def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5, phi_thresh=np.pi / 4): Initialize custom policy. - def best_b...
c28840e254cdd2a4f3d16fffa6391748f94b7d8c
<|skeleton|> class CustomPolicy7: """This custom policy combines 'downward' heuristic location info.""" def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5, phi_thresh=np.pi / 4): """Initialize custom policy.""" <|body_0|> def best_bb(self, bbs): """Returns...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomPolicy7: """This custom policy combines 'downward' heuristic location info.""" def __init__(self, action_bound, detector, lut_info, local_p=1.0, thresh=0.5, phi_thresh=np.pi / 4): """Initialize custom policy.""" super(Policy, self).__init__() self.action_bound = action_bound...
the_stack_v2_python_sparse
ddpg/policy.py
jsather/harvester-python
train
3
86682c43e17a65395a60fd4e3a8d1da80c616f6b
[ "user = users.get_current_user()\nif user:\n if users.is_current_user_admin():\n owner_json = self._GetAllOwnerDataJson()\n else:\n owner_json = self._GetOwnerDataForUserJson(user)\nelse:\n self.RenderHtml('result.html', {'errors': ['Log in to edit test owners.']})\n return\nself.RenderHtm...
<|body_start_0|> user = users.get_current_user() if user: if users.is_current_user_admin(): owner_json = self._GetAllOwnerDataJson() else: owner_json = self._GetOwnerDataForUserJson(user) else: self.RenderHtml('result.html', {'e...
Handles rendering and editing test owners.
EditTestOwnersHandler
[ "BSD-3-Clause", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditTestOwnersHandler: """Handles rendering and editing test owners.""" def get(self): """Renders the UI for editing owners. If user is an admin, renders UI with all test suite path and its owners, otherwise renders UI with a list test suite path for the logged in user.""" <|...
stack_v2_sparse_classes_75kplus_train_001920
3,041
permissive
[ { "docstring": "Renders the UI for editing owners. If user is an admin, renders UI with all test suite path and its owners, otherwise renders UI with a list test suite path for the logged in user.", "name": "get", "signature": "def get(self)" }, { "docstring": "Handles updates of test owners.", ...
4
stack_v2_sparse_classes_30k_train_051301
Implement the Python class `EditTestOwnersHandler` described below. Class description: Handles rendering and editing test owners. Method signatures and docstrings: - def get(self): Renders the UI for editing owners. If user is an admin, renders UI with all test suite path and its owners, otherwise renders UI with a l...
Implement the Python class `EditTestOwnersHandler` described below. Class description: Handles rendering and editing test owners. Method signatures and docstrings: - def get(self): Renders the UI for editing owners. If user is an admin, renders UI with all test suite path and its owners, otherwise renders UI with a l...
e71f21b9b4b9b839f5093301974a45545dad2691
<|skeleton|> class EditTestOwnersHandler: """Handles rendering and editing test owners.""" def get(self): """Renders the UI for editing owners. If user is an admin, renders UI with all test suite path and its owners, otherwise renders UI with a list test suite path for the logged in user.""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EditTestOwnersHandler: """Handles rendering and editing test owners.""" def get(self): """Renders the UI for editing owners. If user is an admin, renders UI with all test suite path and its owners, otherwise renders UI with a list test suite path for the logged in user.""" user = users.ge...
the_stack_v2_python_sparse
third_party/catapult/dashboard/dashboard/edit_test_owners.py
zenoalbisser/chromium
train
0
061f2259706d1d83f505c6bf28fa276351e1fc0a
[ "v = APIValidator()\ndraft_id = draft_id or deposition.get_default_draft_id()\nmetadata_schema = deposition.type.api_metadata_schema(draft_id)\nif metadata_schema:\n schema = self.input_schema.copy()\n schema['metadata'] = metadata_schema\nelse:\n schema = self.input_schema\nif not v.validate(request.json,...
<|body_start_0|> v = APIValidator() draft_id = draft_id or deposition.get_default_draft_id() metadata_schema = deposition.type.api_metadata_schema(draft_id) if metadata_schema: schema = self.input_schema.copy() schema['metadata'] = metadata_schema else: ...
Mix-in class for validating and processing deposition input data.
InputProcessorMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputProcessorMixin: """Mix-in class for validating and processing deposition input data.""" def validate_input(self, deposition, draft_id=None): """Validate input data for creating and update a deposition.""" <|body_0|> def process_input(self, deposition, draft_id=None)...
stack_v2_sparse_classes_75kplus_train_001921
19,789
no_license
[ { "docstring": "Validate input data for creating and update a deposition.", "name": "validate_input", "signature": "def validate_input(self, deposition, draft_id=None)" }, { "docstring": "Process input data.", "name": "process_input", "signature": "def process_input(self, deposition, dra...
2
stack_v2_sparse_classes_30k_val_002393
Implement the Python class `InputProcessorMixin` described below. Class description: Mix-in class for validating and processing deposition input data. Method signatures and docstrings: - def validate_input(self, deposition, draft_id=None): Validate input data for creating and update a deposition. - def process_input(...
Implement the Python class `InputProcessorMixin` described below. Class description: Mix-in class for validating and processing deposition input data. Method signatures and docstrings: - def validate_input(self, deposition, draft_id=None): Validate input data for creating and update a deposition. - def process_input(...
e84cb33310506fcdab1dcdb1e8bd425d44435fbe
<|skeleton|> class InputProcessorMixin: """Mix-in class for validating and processing deposition input data.""" def validate_input(self, deposition, draft_id=None): """Validate input data for creating and update a deposition.""" <|body_0|> def process_input(self, deposition, draft_id=None)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InputProcessorMixin: """Mix-in class for validating and processing deposition input data.""" def validate_input(self, deposition, draft_id=None): """Validate input data for creating and update a deposition.""" v = APIValidator() draft_id = draft_id or deposition.get_default_draft_...
the_stack_v2_python_sparse
lw_daap/modules/invenio_deposit/restful.py
groundnuty/lw-daap
train
0
5e5338d13a364cd1139af8ee85eae1d4a5dfde68
[ "if k == len(nums):\n self.all.append(nums)\n return\nself._dfs(k + 1, list(nums))\nfor i in xrange(k + 1, len(nums)):\n if nums[k] != nums[i]:\n nums[k], nums[i] = (nums[i], nums[k])\n self._dfs(k + 1, list(nums))", "if not nums:\n return []\nself.all = []\nself._dfs(0, sorted(nums))\nr...
<|body_start_0|> if k == len(nums): self.all.append(nums) return self._dfs(k + 1, list(nums)) for i in xrange(k + 1, len(nums)): if nums[k] != nums[i]: nums[k], nums[i] = (nums[i], nums[k]) self._dfs(k + 1, list(nums)) <|end_bod...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _dfs(self, k, nums): """Swap k with something after. Don't swap the same numbers. Copy on recursion. :param k: :return:""" <|body_0|> def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>...
stack_v2_sparse_classes_75kplus_train_001922
881
no_license
[ { "docstring": "Swap k with something after. Don't swap the same numbers. Copy on recursion. :param k: :return:", "name": "_dfs", "signature": "def _dfs(self, k, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permuteUnique", "signature": "def permuteUn...
2
stack_v2_sparse_classes_30k_train_033820
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _dfs(self, k, nums): Swap k with something after. Don't swap the same numbers. Copy on recursion. :param k: :return: - def permuteUnique(self, nums): :type nums: List[int] :r...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _dfs(self, k, nums): Swap k with something after. Don't swap the same numbers. Copy on recursion. :param k: :return: - def permuteUnique(self, nums): :type nums: List[int] :r...
20580185c6f72f3c09a725168af48893156161f5
<|skeleton|> class Solution: def _dfs(self, k, nums): """Swap k with something after. Don't swap the same numbers. Copy on recursion. :param k: :return:""" <|body_0|> def permuteUnique(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def _dfs(self, k, nums): """Swap k with something after. Don't swap the same numbers. Copy on recursion. :param k: :return:""" if k == len(nums): self.all.append(nums) return self._dfs(k + 1, list(nums)) for i in xrange(k + 1, len(nums)): ...
the_stack_v2_python_sparse
coding/00047-permutations-2/solution.py
misaka-10032/leetcode
train
3
afbbf63c70a588a0cf443d790ccecc8ec336f9a6
[ "self.language = language\nsuper().__init__(language=self.language)\nif sent_tokenizer:\n self.sent_tokenizer = sent_tokenizer()\nelse:\n punkt_param = PunktParameters()\n self.sent_tokenizer = PunktSentenceTokenizer(punkt_param)", "sents = self.sent_tokenizer.tokenize(text)\ntokenizer = TreebankWordToke...
<|body_start_0|> self.language = language super().__init__(language=self.language) if sent_tokenizer: self.sent_tokenizer = sent_tokenizer() else: punkt_param = PunktParameters() self.sent_tokenizer = PunktSentenceTokenizer(punkt_param) <|end_body_0|> ...
Base class for punkt word tokenization
BasePunktWordTokenizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasePunktWordTokenizer: """Base class for punkt word tokenization""" def __init__(self, language: str=None, sent_tokenizer: object=None): """:param language : language for sentence tokenization :type language: str""" <|body_0|> def tokenize(self, text: str): """:...
stack_v2_sparse_classes_75kplus_train_001923
7,425
permissive
[ { "docstring": ":param language : language for sentence tokenization :type language: str", "name": "__init__", "signature": "def __init__(self, language: str=None, sent_tokenizer: object=None)" }, { "docstring": ":rtype: list :param text: text to be tokenized into sentences :type text: str", ...
2
null
Implement the Python class `BasePunktWordTokenizer` described below. Class description: Base class for punkt word tokenization Method signatures and docstrings: - def __init__(self, language: str=None, sent_tokenizer: object=None): :param language : language for sentence tokenization :type language: str - def tokeniz...
Implement the Python class `BasePunktWordTokenizer` described below. Class description: Base class for punkt word tokenization Method signatures and docstrings: - def __init__(self, language: str=None, sent_tokenizer: object=None): :param language : language for sentence tokenization :type language: str - def tokeniz...
90c3daaafda242a1982b38c2b11c52aedab7ddf8
<|skeleton|> class BasePunktWordTokenizer: """Base class for punkt word tokenization""" def __init__(self, language: str=None, sent_tokenizer: object=None): """:param language : language for sentence tokenization :type language: str""" <|body_0|> def tokenize(self, text: str): """:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasePunktWordTokenizer: """Base class for punkt word tokenization""" def __init__(self, language: str=None, sent_tokenizer: object=None): """:param language : language for sentence tokenization :type language: str""" self.language = language super().__init__(language=self.language...
the_stack_v2_python_sparse
src/cltkv1/tokenize/word.py
todd-cook/cltkv1
train
0
15f62127c94e47f0bdbe1cf1a55ce670c94c6fee
[ "MaxPooling2D.build(self, input_shape)\nself.init_neurons(input_shape.as_list())\nif self.mem_input is None:\n self.mem_input = tf.Variable(tf.zeros(input_shape), name='mem_input', trainable=False)", "self.mem_input.assign_add(x)\n_, max_idxs = tf.nn.max_pool_with_argmax(self.mem_input, self.pool_size, self.st...
<|body_start_0|> MaxPooling2D.build(self, input_shape) self.init_neurons(input_shape.as_list()) if self.mem_input is None: self.mem_input = tf.Variable(tf.zeros(input_shape), name='mem_input', trainable=False) <|end_body_0|> <|body_start_1|> self.mem_input.assign_add(x) ...
Spike Max Pooling.
SpikeMaxPooling2D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpikeMaxPooling2D: """Spike Max Pooling.""" def build(self, input_shape): """Creates the layer neurons and connections.. Parameters ---------- input_shape: Union[list, tuple, Any] Keras tensor (future input to layer) or list/tuple of Keras tensors to reference for weight shape comput...
stack_v2_sparse_classes_75kplus_train_001924
28,900
permissive
[ { "docstring": "Creates the layer neurons and connections.. Parameters ---------- input_shape: Union[list, tuple, Any] Keras tensor (future input to layer) or list/tuple of Keras tensors to reference for weight shape computations.", "name": "build", "signature": "def build(self, input_shape)" }, { ...
2
stack_v2_sparse_classes_30k_train_025299
Implement the Python class `SpikeMaxPooling2D` described below. Class description: Spike Max Pooling. Method signatures and docstrings: - def build(self, input_shape): Creates the layer neurons and connections.. Parameters ---------- input_shape: Union[list, tuple, Any] Keras tensor (future input to layer) or list/tu...
Implement the Python class `SpikeMaxPooling2D` described below. Class description: Spike Max Pooling. Method signatures and docstrings: - def build(self, input_shape): Creates the layer neurons and connections.. Parameters ---------- input_shape: Union[list, tuple, Any] Keras tensor (future input to layer) or list/tu...
0255f753efa32f69593ac6bc25a95d5b09f8f1cb
<|skeleton|> class SpikeMaxPooling2D: """Spike Max Pooling.""" def build(self, input_shape): """Creates the layer neurons and connections.. Parameters ---------- input_shape: Union[list, tuple, Any] Keras tensor (future input to layer) or list/tuple of Keras tensors to reference for weight shape comput...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpikeMaxPooling2D: """Spike Max Pooling.""" def build(self, input_shape): """Creates the layer neurons and connections.. Parameters ---------- input_shape: Union[list, tuple, Any] Keras tensor (future input to layer) or list/tuple of Keras tensors to reference for weight shape computations.""" ...
the_stack_v2_python_sparse
snntoolbox/simulation/backends/inisim/temporal_mean_rate_tensorflow.py
NeuromorphicProcessorProject/snn_toolbox
train
351
8a18c4168b78391b56a128ccb155fd20cb6c1ab5
[ "if metadata:\n msg.update(metadata)\nreturn OrderBookMessage(OrderBookMessageType.SNAPSHOT, {'trading_pair': msg['marketId'], 'snapshotId': msg['snapshotId'], 'update_id': msg['snapshotId'], 'bids': msg['bids'], 'asks': msg['asks']}, timestamp=timestamp)", "if metadata:\n msg.update(metadata)\nreturn Order...
<|body_start_0|> if metadata: msg.update(metadata) return OrderBookMessage(OrderBookMessageType.SNAPSHOT, {'trading_pair': msg['marketId'], 'snapshotId': msg['snapshotId'], 'update_id': msg['snapshotId'], 'bids': msg['bids'], 'asks': msg['asks']}, timestamp=timestamp) <|end_body_0|> <|body_...
BtcMarketsOrderBook
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BtcMarketsOrderBook: def snapshot_message_from_exchange_websocket(cls, msg: Dict[str, any], timestamp: float, metadata: Optional[Dict]=None) -> OrderBookMessage: """Creates a snapshot message with the order book snapshot message :param msg: the response from the exchange when requesting ...
stack_v2_sparse_classes_75kplus_train_001925
4,545
permissive
[ { "docstring": "Creates a snapshot message with the order book snapshot message :param msg: the response from the exchange when requesting the order book snapshot :param timestamp: the snapshot timestamp :param metadata: a dictionary with extra information to add to the snapshot data :return: a snapshot message...
4
stack_v2_sparse_classes_30k_train_000300
Implement the Python class `BtcMarketsOrderBook` described below. Class description: Implement the BtcMarketsOrderBook class. Method signatures and docstrings: - def snapshot_message_from_exchange_websocket(cls, msg: Dict[str, any], timestamp: float, metadata: Optional[Dict]=None) -> OrderBookMessage: Creates a snaps...
Implement the Python class `BtcMarketsOrderBook` described below. Class description: Implement the BtcMarketsOrderBook class. Method signatures and docstrings: - def snapshot_message_from_exchange_websocket(cls, msg: Dict[str, any], timestamp: float, metadata: Optional[Dict]=None) -> OrderBookMessage: Creates a snaps...
c3f101759ab7e7a2165cd23a3a3e94c90c642a9b
<|skeleton|> class BtcMarketsOrderBook: def snapshot_message_from_exchange_websocket(cls, msg: Dict[str, any], timestamp: float, metadata: Optional[Dict]=None) -> OrderBookMessage: """Creates a snapshot message with the order book snapshot message :param msg: the response from the exchange when requesting ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BtcMarketsOrderBook: def snapshot_message_from_exchange_websocket(cls, msg: Dict[str, any], timestamp: float, metadata: Optional[Dict]=None) -> OrderBookMessage: """Creates a snapshot message with the order book snapshot message :param msg: the response from the exchange when requesting the order book...
the_stack_v2_python_sparse
hummingbot/connector/exchange/btc_markets/btc_markets_order_book.py
CoinAlpha/hummingbot
train
135
3adc22db8cc2dee05c186f9f5fef8a8715eb90fa
[ "self.add_digital_out(6, True)\nself.add_digital_out(7, False)\nself.add_line('\\tsleep({})'.format(sleep))", "self.add_digital_out(6, False)\nself.add_digital_out(7, True)\nself.add_line('\\tsleep({})'.format(sleep))" ]
<|body_start_0|> self.add_digital_out(6, True) self.add_digital_out(7, False) self.add_line('\tsleep({})'.format(sleep)) <|end_body_0|> <|body_start_1|> self.add_digital_out(6, False) self.add_digital_out(7, True) self.add_line('\tsleep({})'.format(sleep)) <|end_body_1|>...
ParallelGripMixins
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParallelGripMixins: def parallelgrip_open(self, sleep=1.0): """Open the parallel gripper.""" <|body_0|> def parallelgrip_close(self, sleep=1.0): """Close the parallel gripper.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.add_digital_out(6, T...
stack_v2_sparse_classes_75kplus_train_001926
1,040
permissive
[ { "docstring": "Open the parallel gripper.", "name": "parallelgrip_open", "signature": "def parallelgrip_open(self, sleep=1.0)" }, { "docstring": "Close the parallel gripper.", "name": "parallelgrip_close", "signature": "def parallelgrip_close(self, sleep=1.0)" } ]
2
stack_v2_sparse_classes_30k_val_001466
Implement the Python class `ParallelGripMixins` described below. Class description: Implement the ParallelGripMixins class. Method signatures and docstrings: - def parallelgrip_open(self, sleep=1.0): Open the parallel gripper. - def parallelgrip_close(self, sleep=1.0): Close the parallel gripper.
Implement the Python class `ParallelGripMixins` described below. Class description: Implement the ParallelGripMixins class. Method signatures and docstrings: - def parallelgrip_open(self, sleep=1.0): Open the parallel gripper. - def parallelgrip_close(self, sleep=1.0): Close the parallel gripper. <|skeleton|> class ...
8184fd12180e949383bdf8dde3060338d9564252
<|skeleton|> class ParallelGripMixins: def parallelgrip_open(self, sleep=1.0): """Open the parallel gripper.""" <|body_0|> def parallelgrip_close(self, sleep=1.0): """Close the parallel gripper.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ParallelGripMixins: def parallelgrip_open(self, sleep=1.0): """Open the parallel gripper.""" self.add_digital_out(6, True) self.add_digital_out(7, False) self.add_line('\tsleep({})'.format(sleep)) def parallelgrip_close(self, sleep=1.0): """Close the parallel gripp...
the_stack_v2_python_sparse
src/ur_fabrication_control/direct_control/mixins/parallelgrip_mixins.py
augmentedfabricationlab/ur_fabrication_control
train
6
e973f52c8190ceb9b938c37138849bfce97d9aa6
[ "passengers = 0\nevents = self._get_events(trips)\nfor net_change in events:\n passengers += net_change\n if passengers > capacity:\n return False\nreturn True", "events = collections.defaultdict(int)\nfor num_passengers, start, end in trips:\n events[start] += num_passengers\n events[end] -= n...
<|body_start_0|> passengers = 0 events = self._get_events(trips) for net_change in events: passengers += net_change if passengers > capacity: return False return True <|end_body_0|> <|body_start_1|> events = collections.defaultdict(int) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def carPooling(self, trips, capacity): """@description Returns if we take all passengers on the trip @param1 trips : arr[arr[int]] @param2 capacity : int @return answer : bool [num passengers, start, end] 0 1 trips = [[2,1,5],[3,3,7]] ^ events : time event 1 : += 2 3 : += 3 5 :...
stack_v2_sparse_classes_75kplus_train_001927
3,172
no_license
[ { "docstring": "@description Returns if we take all passengers on the trip @param1 trips : arr[arr[int]] @param2 capacity : int @return answer : bool [num passengers, start, end] 0 1 trips = [[2,1,5],[3,3,7]] ^ events : time event 1 : += 2 3 : += 3 5 : -= 2, += 3 7 : curr_capacity = 2 road start end 1 7 curr_ca...
2
stack_v2_sparse_classes_30k_train_012857
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def carPooling(self, trips, capacity): @description Returns if we take all passengers on the trip @param1 trips : arr[arr[int]] @param2 capacity : int @return answer : bool [num ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def carPooling(self, trips, capacity): @description Returns if we take all passengers on the trip @param1 trips : arr[arr[int]] @param2 capacity : int @return answer : bool [num ...
bbfee57ae89d23cd4f4132fbb62d8931ea654a0e
<|skeleton|> class Solution: def carPooling(self, trips, capacity): """@description Returns if we take all passengers on the trip @param1 trips : arr[arr[int]] @param2 capacity : int @return answer : bool [num passengers, start, end] 0 1 trips = [[2,1,5],[3,3,7]] ^ events : time event 1 : += 2 3 : += 3 5 :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def carPooling(self, trips, capacity): """@description Returns if we take all passengers on the trip @param1 trips : arr[arr[int]] @param2 capacity : int @return answer : bool [num passengers, start, end] 0 1 trips = [[2,1,5],[3,3,7]] ^ events : time event 1 : += 2 3 : += 3 5 : -= 2, += 3 7 ...
the_stack_v2_python_sparse
Algorithms/Leetcode/1094 - Car Pooling.py
timpark0807/self-taught-swe
train
1
ce2a39d95e8144d3d1b71b130174b320fdf977e7
[ "isLeafNode = lambda node: not node.left and (not node.right)\n\ndef dfs(node):\n ans = 0\n if node.left:\n ans += node.left.val if isLeafNode(node.left) else dfs(node.left)\n if node.right and (not isLeafNode(node.right)):\n ans += dfs(node.right)\n return ans\nreturn dfs(root) if root el...
<|body_start_0|> isLeafNode = lambda node: not node.left and (not node.right) def dfs(node): ans = 0 if node.left: ans += node.left.val if isLeafNode(node.left) else dfs(node.left) if node.right and (not isLeafNode(node.right)): ans +=...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sumOfLeftLeaves(self, root): """time O(n) space O(n) :type root: TreeNode :rtype: int""" <|body_0|> def sumOfLeftLeaves_BFS(self, root): """time O(n) space O(n) :param root: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> isLe...
stack_v2_sparse_classes_75kplus_train_001928
1,247
no_license
[ { "docstring": "time O(n) space O(n) :type root: TreeNode :rtype: int", "name": "sumOfLeftLeaves", "signature": "def sumOfLeftLeaves(self, root)" }, { "docstring": "time O(n) space O(n) :param root: :return:", "name": "sumOfLeftLeaves_BFS", "signature": "def sumOfLeftLeaves_BFS(self, roo...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumOfLeftLeaves(self, root): time O(n) space O(n) :type root: TreeNode :rtype: int - def sumOfLeftLeaves_BFS(self, root): time O(n) space O(n) :param root: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumOfLeftLeaves(self, root): time O(n) space O(n) :type root: TreeNode :rtype: int - def sumOfLeftLeaves_BFS(self, root): time O(n) space O(n) :param root: :return: <|skelet...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def sumOfLeftLeaves(self, root): """time O(n) space O(n) :type root: TreeNode :rtype: int""" <|body_0|> def sumOfLeftLeaves_BFS(self, root): """time O(n) space O(n) :param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def sumOfLeftLeaves(self, root): """time O(n) space O(n) :type root: TreeNode :rtype: int""" isLeafNode = lambda node: not node.left and (not node.right) def dfs(node): ans = 0 if node.left: ans += node.left.val if isLeafNode(node.left...
the_stack_v2_python_sparse
LeetCode/Tree/404_sum_of_left_leaves.py
XyK0907/for_work
train
0
288aad003bd52a1c2b24548482ecb527143a5822
[ "super().__init__()\ndropout_prob = 0.2\nself.wn1 = nn.utils.weight_norm(nn.Linear(latent_size + 3, 512))\nself.wn2 = nn.utils.weight_norm(nn.Linear(512, 512))\nself.wn3 = nn.utils.weight_norm(nn.Linear(512, 512))\nself.wn4 = nn.utils.weight_norm(nn.Linear(512, 512 - latent_size - 3))\nself.wn5 = nn.utils.weight_no...
<|body_start_0|> super().__init__() dropout_prob = 0.2 self.wn1 = nn.utils.weight_norm(nn.Linear(latent_size + 3, 512)) self.wn2 = nn.utils.weight_norm(nn.Linear(512, 512)) self.wn3 = nn.utils.weight_norm(nn.Linear(512, 512)) self.wn4 = nn.utils.weight_norm(nn.Linear(512,...
DeepSDFDecoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepSDFDecoder: def __init__(self, latent_size): """:param latent_size: latent code vector length""" <|body_0|> def forward(self, x_in): """:param x_in: B x (latent_size + 3) tensor :return: B x 1 tensor""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_001929
1,554
no_license
[ { "docstring": ":param latent_size: latent code vector length", "name": "__init__", "signature": "def __init__(self, latent_size)" }, { "docstring": ":param x_in: B x (latent_size + 3) tensor :return: B x 1 tensor", "name": "forward", "signature": "def forward(self, x_in)" } ]
2
null
Implement the Python class `DeepSDFDecoder` described below. Class description: Implement the DeepSDFDecoder class. Method signatures and docstrings: - def __init__(self, latent_size): :param latent_size: latent code vector length - def forward(self, x_in): :param x_in: B x (latent_size + 3) tensor :return: B x 1 ten...
Implement the Python class `DeepSDFDecoder` described below. Class description: Implement the DeepSDFDecoder class. Method signatures and docstrings: - def __init__(self, latent_size): :param latent_size: latent code vector length - def forward(self, x_in): :param x_in: B x (latent_size + 3) tensor :return: B x 1 ten...
a98d61403017317eb2b5da9760f78a19c76622e4
<|skeleton|> class DeepSDFDecoder: def __init__(self, latent_size): """:param latent_size: latent code vector length""" <|body_0|> def forward(self, x_in): """:param x_in: B x (latent_size + 3) tensor :return: B x 1 tensor""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeepSDFDecoder: def __init__(self, latent_size): """:param latent_size: latent code vector length""" super().__init__() dropout_prob = 0.2 self.wn1 = nn.utils.weight_norm(nn.Linear(latent_size + 3, 512)) self.wn2 = nn.utils.weight_norm(nn.Linear(512, 512)) self....
the_stack_v2_python_sparse
E3/exercise_3/model/deepsdf.py
nazmicancalik/ml3d
train
7
7d37d5a6af269483d014f0d8198febdf1e2cc4c5
[ "parser = argparse.ArgumentParser(description='Easy Infer for model benchmark')\ncls.base_arg_parse(parser)\ncls.model_arg_parse(parser)\ncls.task_arg_parse(parser)\nargs = parser.parse_args()\nreturn args", "parser.add_argument('--task_type', type=int, default=0, help='benchmark task type:0 for framework accurac...
<|body_start_0|> parser = argparse.ArgumentParser(description='Easy Infer for model benchmark') cls.base_arg_parse(parser) cls.model_arg_parse(parser) cls.task_arg_parse(parser) args = parser.parse_args() return args <|end_body_0|> <|body_start_1|> parser.add_arg...
input argument parser functions
ArgParser
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license", "MPL-1.0", "OpenSSL", "LGPL-3.0-only", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause-Open-MPI", "MIT", "MPL-2.0-no-copyleft-exception", "NTP", "BSD-3-Clause", "GPL-1.0-or-later", "0BSD", "MPL-2.0", "LicenseRef-scancode-f...
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArgParser: """input argument parser functions""" def parse_arguments(cls): """parse input arguments for mslite bench""" <|body_0|> def task_arg_parse(cls, parser): """parse task related arguments""" <|body_1|> def model_arg_parse(cls, parser): ...
stack_v2_sparse_classes_75kplus_train_001930
8,814
permissive
[ { "docstring": "parse input arguments for mslite bench", "name": "parse_arguments", "signature": "def parse_arguments(cls)" }, { "docstring": "parse task related arguments", "name": "task_arg_parse", "signature": "def task_arg_parse(cls, parser)" }, { "docstring": "parse model an...
4
stack_v2_sparse_classes_30k_train_013920
Implement the Python class `ArgParser` described below. Class description: input argument parser functions Method signatures and docstrings: - def parse_arguments(cls): parse input arguments for mslite bench - def task_arg_parse(cls, parser): parse task related arguments - def model_arg_parse(cls, parser): parse mode...
Implement the Python class `ArgParser` described below. Class description: input argument parser functions Method signatures and docstrings: - def parse_arguments(cls): parse input arguments for mslite bench - def task_arg_parse(cls, parser): parse task related arguments - def model_arg_parse(cls, parser): parse mode...
54acb15d435533c815ee1bd9f6dc0b56b4d4cf83
<|skeleton|> class ArgParser: """input argument parser functions""" def parse_arguments(cls): """parse input arguments for mslite bench""" <|body_0|> def task_arg_parse(cls, parser): """parse task related arguments""" <|body_1|> def model_arg_parse(cls, parser): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArgParser: """input argument parser functions""" def parse_arguments(cls): """parse input arguments for mslite bench""" parser = argparse.ArgumentParser(description='Easy Infer for model benchmark') cls.base_arg_parse(parser) cls.model_arg_parse(parser) cls.task_ar...
the_stack_v2_python_sparse
mindspore/lite/tools/mslite_bench/mslite_bench/utils/arg_parser.py
mindspore-ai/mindspore
train
4,178
e47390b4c02c00dc7074c8d805098b046d2977f9
[ "if self.kwargs['collect'].ona_scan_form_pk:\n delete_form(self.kwargs['collect'].ona_scan_form_pk)\nself.kwargs['collect'].ona_scan_form_pk = None\nself.kwargs['collect'].save()", "if not self.kwargs.get('collect'):\n logger.error('Collect not in kwargs')\n return\nresp = upload_xlsform(self.kwargs.get(...
<|body_start_0|> if self.kwargs['collect'].ona_scan_form_pk: delete_form(self.kwargs['collect'].ona_scan_form_pk) self.kwargs['collect'].ona_scan_form_pk = None self.kwargs['collect'].save() <|end_body_0|> <|body_start_1|> if not self.kwargs.get('collect'): logge...
DeleteONAScanXLSForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeleteONAScanXLSForm: def _process(self): """remove form on ONA and remove form ID in Collect""" <|body_0|> def _revert(self): """upload scan xlsform to ONA""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self.kwargs['collect'].ona_scan_form_pk: ...
stack_v2_sparse_classes_75kplus_train_001931
6,768
no_license
[ { "docstring": "remove form on ONA and remove form ID in Collect", "name": "_process", "signature": "def _process(self)" }, { "docstring": "upload scan xlsform to ONA", "name": "_revert", "signature": "def _revert(self)" } ]
2
null
Implement the Python class `DeleteONAScanXLSForm` described below. Class description: Implement the DeleteONAScanXLSForm class. Method signatures and docstrings: - def _process(self): remove form on ONA and remove form ID in Collect - def _revert(self): upload scan xlsform to ONA
Implement the Python class `DeleteONAScanXLSForm` described below. Class description: Implement the DeleteONAScanXLSForm class. Method signatures and docstrings: - def _process(self): remove form on ONA and remove form ID in Collect - def _revert(self): upload scan xlsform to ONA <|skeleton|> class DeleteONAScanXLSF...
f8e0b9d6d4c1e34fc8d67f9b86515ad81aeefdd7
<|skeleton|> class DeleteONAScanXLSForm: def _process(self): """remove form on ONA and remove form ID in Collect""" <|body_0|> def _revert(self): """upload scan xlsform to ONA""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeleteONAScanXLSForm: def _process(self): """remove form on ONA and remove form ID in Collect""" if self.kwargs['collect'].ona_scan_form_pk: delete_form(self.kwargs['collect'].ona_scan_form_pk) self.kwargs['collect'].ona_scan_form_pk = None self.kwargs['collect'].sa...
the_stack_v2_python_sparse
hamed/steps/reopen_collect.py
yeleman/hamed
train
0
13dbe85bca9a41c88a0d923f77251f10fc056fbc
[ "if len(nums) <= 1:\n return nums\ntemp = -1\nfor i in range(len(nums) - 2, -1, -1):\n if nums[i] < nums[i + 1]:\n temp = i\n break\nif temp == -1:\n return nums[::-1]\nfor i in range(len(nums) - 1, temp, -1):\n if nums[i] > nums[temp]:\n nums[i], nums[temp] = (nums[temp], nums[i])\...
<|body_start_0|> if len(nums) <= 1: return nums temp = -1 for i in range(len(nums) - 2, -1, -1): if nums[i] < nums[i + 1]: temp = i break if temp == -1: return nums[::-1] for i in range(len(nums) - 1, temp, -1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation1(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place i...
stack_v2_sparse_classes_75kplus_train_001932
1,932
no_license
[ { "docstring": ":type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.", "name": "nextPermutation", "signature": "def nextPermutation(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.", "...
2
stack_v2_sparse_classes_30k_train_035816
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def nextPermutation1(self, nums): :type nums: List[int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextPermutation(self, nums): :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def nextPermutation1(self, nums): :type nums: List[int...
276bfed83139bd843a9b459e73b926348f6faa62
<|skeleton|> class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation1(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" if len(nums) <= 1: return nums temp = -1 for i in range(len(nums) - 2, -1, -1): if nums[i] < nums[i + 1]: ...
the_stack_v2_python_sparse
leetcode/_31_Next_Permutation.py
wangJI1127/learnPython
train
0
fb5d3353bbc3df7534800947bcff139bf66de563
[ "self.table = table\nself.engine = sqlalchemy.create_engine(f'postgresql+psycopg2://{user}:{pswd}@{host}:{port}/{dbname}')\nself.conn = None\nself.schema = schema", "try:\n self.conn = self.engine.connect()\nexcept:\n return False\nelse:\n self.metadata = sqlalchemy.MetaData(bind=self.engine)\n self.m...
<|body_start_0|> self.table = table self.engine = sqlalchemy.create_engine(f'postgresql+psycopg2://{user}:{pswd}@{host}:{port}/{dbname}') self.conn = None self.schema = schema <|end_body_0|> <|body_start_1|> try: self.conn = self.engine.connect() except: ...
PostgreSQL Class to validate DB and get table schema
Postgres
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Postgres: """PostgreSQL Class to validate DB and get table schema""" def __init__(self, host, dbname, port, table, user, pswd, schema={}): """Initialize connection to Postgres DB :param host: DB Host :param dbname: DB Name :param port: DB Port :param table: DB Table :param user: DB U...
stack_v2_sparse_classes_75kplus_train_001933
1,779
no_license
[ { "docstring": "Initialize connection to Postgres DB :param host: DB Host :param dbname: DB Name :param port: DB Port :param table: DB Table :param user: DB User :param pswd: DB Password", "name": "__init__", "signature": "def __init__(self, host, dbname, port, table, user, pswd, schema={})" }, { ...
4
stack_v2_sparse_classes_30k_train_026004
Implement the Python class `Postgres` described below. Class description: PostgreSQL Class to validate DB and get table schema Method signatures and docstrings: - def __init__(self, host, dbname, port, table, user, pswd, schema={}): Initialize connection to Postgres DB :param host: DB Host :param dbname: DB Name :par...
Implement the Python class `Postgres` described below. Class description: PostgreSQL Class to validate DB and get table schema Method signatures and docstrings: - def __init__(self, host, dbname, port, table, user, pswd, schema={}): Initialize connection to Postgres DB :param host: DB Host :param dbname: DB Name :par...
bebb158d1905f8b0c0f76322c5747a13dc5fd108
<|skeleton|> class Postgres: """PostgreSQL Class to validate DB and get table schema""" def __init__(self, host, dbname, port, table, user, pswd, schema={}): """Initialize connection to Postgres DB :param host: DB Host :param dbname: DB Name :param port: DB Port :param table: DB Table :param user: DB U...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Postgres: """PostgreSQL Class to validate DB and get table schema""" def __init__(self, host, dbname, port, table, user, pswd, schema={}): """Initialize connection to Postgres DB :param host: DB Host :param dbname: DB Name :param port: DB Port :param table: DB Table :param user: DB User :param ps...
the_stack_v2_python_sparse
inDataGen-main/inDataGen/apps/etl/bonobo_utils/utils/postgres.py
gramatas/TestDataGenerator
train
0
163469a07c686fb8a6d640adc9eac66c65f69567
[ "reservation_id = self.request.query_params.get('reservation_id')\nreservation = Reservation.objects.get(id=reservation_id)\nreservation_serializer = ReservationSerializer(reservation)\ntickets = reservation.tickets.all()\ntickets_serializer = OrderedTicketSerializer(tickets, many=True)\nevent = reservation.event\n...
<|body_start_0|> reservation_id = self.request.query_params.get('reservation_id') reservation = Reservation.objects.get(id=reservation_id) reservation_serializer = ReservationSerializer(reservation) tickets = reservation.tickets.all() tickets_serializer = OrderedTicketSerializer(...
ReservationViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReservationViewSet: def list(self, request): """Endpoint returns detailed info about the reservation. Required payload: - reservation_id: string :param request: :return: Reservation data and ticket data""" <|body_0|> def create(self, request): """Endpoint handles cre...
stack_v2_sparse_classes_75kplus_train_001934
12,892
no_license
[ { "docstring": "Endpoint returns detailed info about the reservation. Required payload: - reservation_id: string :param request: :return: Reservation data and ticket data", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Endpoint handles creating a reservation of N tick...
4
stack_v2_sparse_classes_30k_train_035470
Implement the Python class `ReservationViewSet` described below. Class description: Implement the ReservationViewSet class. Method signatures and docstrings: - def list(self, request): Endpoint returns detailed info about the reservation. Required payload: - reservation_id: string :param request: :return: Reservation...
Implement the Python class `ReservationViewSet` described below. Class description: Implement the ReservationViewSet class. Method signatures and docstrings: - def list(self, request): Endpoint returns detailed info about the reservation. Required payload: - reservation_id: string :param request: :return: Reservation...
519535a65cfc83b4c1b20b3ea8ceb359848d58ad
<|skeleton|> class ReservationViewSet: def list(self, request): """Endpoint returns detailed info about the reservation. Required payload: - reservation_id: string :param request: :return: Reservation data and ticket data""" <|body_0|> def create(self, request): """Endpoint handles cre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReservationViewSet: def list(self, request): """Endpoint returns detailed info about the reservation. Required payload: - reservation_id: string :param request: :return: Reservation data and ticket data""" reservation_id = self.request.query_params.get('reservation_id') reservation = R...
the_stack_v2_python_sparse
ticketonline/apps/events/views.py
Mat2314/ticketonline
train
0
268519c40c5ddca2f9bd17416f6b86f28316806a
[ "self.name = name\nself.env = None\nself.reward_fn = get_reward_fn(task_name=task_name, layout_id=layout_id, is_planning=is_planning)\nself.history = []", "assert self.env.prev_obs_data is not None\nassert self.env.obs_data is not None\nreward, termination = self.reward_fn(self.env.prev_obs_data, self.env.obs_dat...
<|body_start_0|> self.name = name self.env = None self.reward_fn = get_reward_fn(task_name=task_name, layout_id=layout_id, is_planning=is_planning) self.history = [] <|end_body_0|> <|body_start_1|> assert self.env.prev_obs_data is not None assert self.env.obs_data is not...
Reward function of the pushing tasks.
PushReward
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PushReward: """Reward function of the pushing tasks.""" def __init__(self, name, task_name, layout_id, is_planning=False): """Initialize.""" <|body_0|> def get_reward(self): """Returns the reward value of the current step.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_001935
13,137
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, name, task_name, layout_id, is_planning=False)" }, { "docstring": "Returns the reward value of the current step.", "name": "get_reward", "signature": "def get_reward(self)" } ]
2
stack_v2_sparse_classes_30k_train_038906
Implement the Python class `PushReward` described below. Class description: Reward function of the pushing tasks. Method signatures and docstrings: - def __init__(self, name, task_name, layout_id, is_planning=False): Initialize. - def get_reward(self): Returns the reward value of the current step.
Implement the Python class `PushReward` described below. Class description: Reward function of the pushing tasks. Method signatures and docstrings: - def __init__(self, name, task_name, layout_id, is_planning=False): Initialize. - def get_reward(self): Returns the reward value of the current step. <|skeleton|> class...
c333ce7f1d7b156bedf28c3b09793f5487b6690a
<|skeleton|> class PushReward: """Reward function of the pushing tasks.""" def __init__(self, name, task_name, layout_id, is_planning=False): """Initialize.""" <|body_0|> def get_reward(self): """Returns the reward value of the current step.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PushReward: """Reward function of the pushing tasks.""" def __init__(self, name, task_name, layout_id, is_planning=False): """Initialize.""" self.name = name self.env = None self.reward_fn = get_reward_fn(task_name=task_name, layout_id=layout_id, is_planning=is_planning) ...
the_stack_v2_python_sparse
robovat/reward_fns/push_reward.py
UT-Austin-RPL/robovat
train
7
247dfcbcea9b7bdea3da61529d5527edab36f40f
[ "super().__init__()\nself.deterministic = deterministic\nlayers = []\nfor i in range(nb_layers):\n input_dim = hidden_dim if i > 0 else input_dim\n layers += [nn.Linear(input_dim, hidden_dim * 2), nn.GLU(dim=1), nn.Dropout(dropout_p)]\nself.layers = nn.Sequential(*layers)\noutput_dim = latent_dim\nif not dete...
<|body_start_0|> super().__init__() self.deterministic = deterministic layers = [] for i in range(nb_layers): input_dim = hidden_dim if i > 0 else input_dim layers += [nn.Linear(input_dim, hidden_dim * 2), nn.GLU(dim=1), nn.Dropout(dropout_p)] self.layers ...
MLP_Encoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLP_Encoder: def __init__(self, input_dim=784, hidden_dim=256, latent_dim=32, nb_layers=2, deterministic=False, dropout_p=0.0): """A simple MLP encoder with gated activations. :param input_dim: input features :param hidden_dim: hidden features :param latent_dim: latent feature size OR nu...
stack_v2_sparse_classes_75kplus_train_001936
2,119
permissive
[ { "docstring": "A simple MLP encoder with gated activations. :param input_dim: input features :param hidden_dim: hidden features :param latent_dim: latent feature size OR number of parameters for the posterior_flow distribution :param nb_layers: excluding the output projection :param deterministic: True: return...
2
stack_v2_sparse_classes_30k_val_000189
Implement the Python class `MLP_Encoder` described below. Class description: Implement the MLP_Encoder class. Method signatures and docstrings: - def __init__(self, input_dim=784, hidden_dim=256, latent_dim=32, nb_layers=2, deterministic=False, dropout_p=0.0): A simple MLP encoder with gated activations. :param input...
Implement the Python class `MLP_Encoder` described below. Class description: Implement the MLP_Encoder class. Method signatures and docstrings: - def __init__(self, input_dim=784, hidden_dim=256, latent_dim=32, nb_layers=2, deterministic=False, dropout_p=0.0): A simple MLP encoder with gated activations. :param input...
f4162ef0284960f6a1d599904171383efd9ee232
<|skeleton|> class MLP_Encoder: def __init__(self, input_dim=784, hidden_dim=256, latent_dim=32, nb_layers=2, deterministic=False, dropout_p=0.0): """A simple MLP encoder with gated activations. :param input_dim: input features :param hidden_dim: hidden features :param latent_dim: latent feature size OR nu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MLP_Encoder: def __init__(self, input_dim=784, hidden_dim=256, latent_dim=32, nb_layers=2, deterministic=False, dropout_p=0.0): """A simple MLP encoder with gated activations. :param input_dim: input features :param hidden_dim: hidden features :param latent_dim: latent feature size OR number of parame...
the_stack_v2_python_sparse
popgen/nn/mlp/mlp_encoder.py
Popgun-Labs/PopGen
train
61
7a13fcdd4b91b16898a62ddbc8bb01e0ca4f84d8
[ "self._monitor = monitor\nself._attr_available = False\nself._attr_name = f'{self._monitor.name} Status'", "if not (state := self._monitor.function):\n self._attr_native_value = None\nelse:\n self._attr_native_value = state.value\nself._attr_available = self._monitor.is_available" ]
<|body_start_0|> self._monitor = monitor self._attr_available = False self._attr_name = f'{self._monitor.name} Status' <|end_body_0|> <|body_start_1|> if not (state := self._monitor.function): self._attr_native_value = None else: self._attr_native_value =...
Get the status of each ZoneMinder monitor.
ZMSensorMonitors
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZMSensorMonitors: """Get the status of each ZoneMinder monitor.""" def __init__(self, monitor: Monitor) -> None: """Initialize monitor sensor.""" <|body_0|> def update(self) -> None: """Update the sensor.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_001937
4,501
permissive
[ { "docstring": "Initialize monitor sensor.", "name": "__init__", "signature": "def __init__(self, monitor: Monitor) -> None" }, { "docstring": "Update the sensor.", "name": "update", "signature": "def update(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_000246
Implement the Python class `ZMSensorMonitors` described below. Class description: Get the status of each ZoneMinder monitor. Method signatures and docstrings: - def __init__(self, monitor: Monitor) -> None: Initialize monitor sensor. - def update(self) -> None: Update the sensor.
Implement the Python class `ZMSensorMonitors` described below. Class description: Get the status of each ZoneMinder monitor. Method signatures and docstrings: - def __init__(self, monitor: Monitor) -> None: Initialize monitor sensor. - def update(self) -> None: Update the sensor. <|skeleton|> class ZMSensorMonitors:...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ZMSensorMonitors: """Get the status of each ZoneMinder monitor.""" def __init__(self, monitor: Monitor) -> None: """Initialize monitor sensor.""" <|body_0|> def update(self) -> None: """Update the sensor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZMSensorMonitors: """Get the status of each ZoneMinder monitor.""" def __init__(self, monitor: Monitor) -> None: """Initialize monitor sensor.""" self._monitor = monitor self._attr_available = False self._attr_name = f'{self._monitor.name} Status' def update(self) -> ...
the_stack_v2_python_sparse
homeassistant/components/zoneminder/sensor.py
home-assistant/core
train
35,501
c7417b0148aacbc657475cd4b7ec83102412a4b4
[ "self.master = master\nself.queue = queue.Queue()\nself.model = model.Model()\nself.view = view.View(master, self.queue, self.event_handler)\nself.running = True\nself.periodic_call()", "if event.widget.widgetName == 'submit button':\n events.submit_select_event(self.model, self.view, self.queue)\nelif event.w...
<|body_start_0|> self.master = master self.queue = queue.Queue() self.model = model.Model() self.view = view.View(master, self.queue, self.event_handler) self.running = True self.periodic_call() <|end_body_0|> <|body_start_1|> if event.widget.widgetName == 'submi...
MainController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainController: def __init__(self, master): """Initialisation of the controller as a whole; handles the thread queue, view and model :param master: :return:""" <|body_0|> def event_handler(self, event): """Takes an event and assigns a task depending on what event too...
stack_v2_sparse_classes_75kplus_train_001938
1,964
no_license
[ { "docstring": "Initialisation of the controller as a whole; handles the thread queue, view and model :param master: :return:", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "Takes an event and assigns a task depending on what event took place :param event: :ret...
3
stack_v2_sparse_classes_30k_train_005500
Implement the Python class `MainController` described below. Class description: Implement the MainController class. Method signatures and docstrings: - def __init__(self, master): Initialisation of the controller as a whole; handles the thread queue, view and model :param master: :return: - def event_handler(self, ev...
Implement the Python class `MainController` described below. Class description: Implement the MainController class. Method signatures and docstrings: - def __init__(self, master): Initialisation of the controller as a whole; handles the thread queue, view and model :param master: :return: - def event_handler(self, ev...
a485ea99cf65ea33f45bbd46b516cc00555b745f
<|skeleton|> class MainController: def __init__(self, master): """Initialisation of the controller as a whole; handles the thread queue, view and model :param master: :return:""" <|body_0|> def event_handler(self, event): """Takes an event and assigns a task depending on what event too...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MainController: def __init__(self, master): """Initialisation of the controller as a whole; handles the thread queue, view and model :param master: :return:""" self.master = master self.queue = queue.Queue() self.model = model.Model() self.view = view.View(master, self....
the_stack_v2_python_sparse
main.py
andydolan94/zealot
train
0
8419234d1107ae6537262d8fe935fbc3bd5222a2
[ "M = max(arr)\nresult = [-1 for i in range(M + 1)]\nfor x in arr:\n if x >= 0:\n result[x] = x\nreturn result", "start = 0\nend = len(arr)\nwhile start < end:\n if arr[start] < 0:\n start += 1\n continue\n if arr[start] == start:\n start += 1\n continue\n arr[arr[sta...
<|body_start_0|> M = max(arr) result = [-1 for i in range(M + 1)] for x in arr: if x >= 0: result[x] = x return result <|end_body_0|> <|body_start_1|> start = 0 end = len(arr) while start < end: if arr[start] < 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rearrange_using_hashmap(arr): """Time Complexity: O(n) Space Complexity: O(max(arr))""" <|body_0|> def rearrange_inplace(arr): """Time Complexity: O(n) Space Complexity: O(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|> M = max(arr)...
stack_v2_sparse_classes_75kplus_train_001939
1,437
no_license
[ { "docstring": "Time Complexity: O(n) Space Complexity: O(max(arr))", "name": "rearrange_using_hashmap", "signature": "def rearrange_using_hashmap(arr)" }, { "docstring": "Time Complexity: O(n) Space Complexity: O(1)", "name": "rearrange_inplace", "signature": "def rearrange_inplace(arr)...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rearrange_using_hashmap(arr): Time Complexity: O(n) Space Complexity: O(max(arr)) - def rearrange_inplace(arr): Time Complexity: O(n) Space Complexity: O(1)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rearrange_using_hashmap(arr): Time Complexity: O(n) Space Complexity: O(max(arr)) - def rearrange_inplace(arr): Time Complexity: O(n) Space Complexity: O(1) <|skeleton|> cla...
61e58676747018c3e73bad649761d9dab792128a
<|skeleton|> class Solution: def rearrange_using_hashmap(arr): """Time Complexity: O(n) Space Complexity: O(max(arr))""" <|body_0|> def rearrange_inplace(arr): """Time Complexity: O(n) Space Complexity: O(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rearrange_using_hashmap(arr): """Time Complexity: O(n) Space Complexity: O(max(arr))""" M = max(arr) result = [-1 for i in range(M + 1)] for x in arr: if x >= 0: result[x] = x return result def rearrange_inplace(arr): ...
the_stack_v2_python_sparse
Arrays/02. Rearrangement/01. RearrangeArrayAiAti.py
manasacharyya25/DSA
train
0
33b0dc647ee0dafd60d5d082eb7bb2ebdfc057a6
[ "if not isinstance(spec, dict):\n raise AssertionError('Expected a dict at: {} {}'.format(path, spec))\nfor element, value in spec.items():\n if element.startswith('__'):\n spec[element] = value\n elif isinstance(value, str):\n if value == 'ignore':\n spec[element] = value\n ...
<|body_start_0|> if not isinstance(spec, dict): raise AssertionError('Expected a dict at: {} {}'.format(path, spec)) for element, value in spec.items(): if element.startswith('__'): spec[element] = value elif isinstance(value, str): if ...
Config spec loader.
ConfigSpecLoader
[ "MIT", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigSpecLoader: """Config spec loader.""" def process_config_spec(cls, spec, path): """Process a config spec dictionary.""" <|body_0|> def load_external_platform_config_specs(config): """Load config spec for external platforms.""" <|body_1|> def lo...
stack_v2_sparse_classes_75kplus_train_001940
2,333
permissive
[ { "docstring": "Process a config spec dictionary.", "name": "process_config_spec", "signature": "def process_config_spec(cls, spec, path)" }, { "docstring": "Load config spec for external platforms.", "name": "load_external_platform_config_specs", "signature": "def load_external_platform...
3
stack_v2_sparse_classes_30k_train_013799
Implement the Python class `ConfigSpecLoader` described below. Class description: Config spec loader. Method signatures and docstrings: - def process_config_spec(cls, spec, path): Process a config spec dictionary. - def load_external_platform_config_specs(config): Load config spec for external platforms. - def load_d...
Implement the Python class `ConfigSpecLoader` described below. Class description: Config spec loader. Method signatures and docstrings: - def process_config_spec(cls, spec, path): Process a config spec dictionary. - def load_external_platform_config_specs(config): Load config spec for external platforms. - def load_d...
9f90c8b1586363b65340017bfa3af5d56d32c6d9
<|skeleton|> class ConfigSpecLoader: """Config spec loader.""" def process_config_spec(cls, spec, path): """Process a config spec dictionary.""" <|body_0|> def load_external_platform_config_specs(config): """Load config spec for external platforms.""" <|body_1|> def lo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigSpecLoader: """Config spec loader.""" def process_config_spec(cls, spec, path): """Process a config spec dictionary.""" if not isinstance(spec, dict): raise AssertionError('Expected a dict at: {} {}'.format(path, spec)) for element, value in spec.items(): ...
the_stack_v2_python_sparse
mpf/core/config_spec_loader.py
missionpinball/mpf
train
191
21b694021ad835a80a34431596ddf46414075fe5
[ "self.master = master\ntk.Label(master, text='Insert Record').grid(row=0, column=0)\ntk.Label(master, text='ID no. :').grid(row=1, column=0)\ntk.Label(master, text='Name: ').grid(row=2, column=0)\ntk.Label(master, text='Marks: ').grid(row=3, column=0)\nself.id_input = tk.Entry(master)\nself.name_input = tk.Entry(ma...
<|body_start_0|> self.master = master tk.Label(master, text='Insert Record').grid(row=0, column=0) tk.Label(master, text='ID no. :').grid(row=1, column=0) tk.Label(master, text='Name: ').grid(row=2, column=0) tk.Label(master, text='Marks: ').grid(row=3, column=0) self.id_...
AddWindow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddWindow: def __init__(self, master): """new window fixed stuff""" <|body_0|> def save_record(self, _event=None): """close new window""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.master = master tk.Label(master, text='Insert Record'...
stack_v2_sparse_classes_75kplus_train_001941
4,713
no_license
[ { "docstring": "new window fixed stuff", "name": "__init__", "signature": "def __init__(self, master)" }, { "docstring": "close new window", "name": "save_record", "signature": "def save_record(self, _event=None)" } ]
2
stack_v2_sparse_classes_30k_train_008490
Implement the Python class `AddWindow` described below. Class description: Implement the AddWindow class. Method signatures and docstrings: - def __init__(self, master): new window fixed stuff - def save_record(self, _event=None): close new window
Implement the Python class `AddWindow` described below. Class description: Implement the AddWindow class. Method signatures and docstrings: - def __init__(self, master): new window fixed stuff - def save_record(self, _event=None): close new window <|skeleton|> class AddWindow: def __init__(self, master): ...
791c9fdc6253317baff9d35417ae1610ab70bf85
<|skeleton|> class AddWindow: def __init__(self, master): """new window fixed stuff""" <|body_0|> def save_record(self, _event=None): """close new window""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AddWindow: def __init__(self, master): """new window fixed stuff""" self.master = master tk.Label(master, text='Insert Record').grid(row=0, column=0) tk.Label(master, text='ID no. :').grid(row=1, column=0) tk.Label(master, text='Name: ').grid(row=2, column=0) tk...
the_stack_v2_python_sparse
gui/gui2.py
gayatri-p/python-stuff
train
0
19006c460fc13833a621926ef9d7ec09fce3793a
[ "super(MapReplyMessage, self).__init__()\nself.probe = probe\nself.enlra_enabled = enlra_enabled\nself.security = security\nself.nonce = nonce\nself.records = records or []\nself._reserved1 = BitArray(17)", "super(MapReplyMessage, self).sanitize()\nif not isinstance(self.probe, bool):\n raise ValueError('Probe...
<|body_start_0|> super(MapReplyMessage, self).__init__() self.probe = probe self.enlra_enabled = enlra_enabled self.security = security self.nonce = nonce self.records = records or [] self._reserved1 = BitArray(17) <|end_body_0|> <|body_start_1|> super(Ma...
MapReplyMessage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapReplyMessage: def __init__(self, probe=False, enlra_enabled=False, security=False, nonce='\x00\x00\x00\x00\x00\x00\x00\x00', records=None): """Constructor""" <|body_0|> def sanitize(self): """Check if the current settings conform to the LISP specifications and fix...
stack_v2_sparse_classes_75kplus_train_001942
6,345
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, probe=False, enlra_enabled=False, security=False, nonce='\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00', records=None)" }, { "docstring": "Check if the current settings conform to the LISP specifications and fix them w...
4
stack_v2_sparse_classes_30k_train_039355
Implement the Python class `MapReplyMessage` described below. Class description: Implement the MapReplyMessage class. Method signatures and docstrings: - def __init__(self, probe=False, enlra_enabled=False, security=False, nonce='\x00\x00\x00\x00\x00\x00\x00\x00', records=None): Constructor - def sanitize(self): Chec...
Implement the Python class `MapReplyMessage` described below. Class description: Implement the MapReplyMessage class. Method signatures and docstrings: - def __init__(self, probe=False, enlra_enabled=False, security=False, nonce='\x00\x00\x00\x00\x00\x00\x00\x00', records=None): Constructor - def sanitize(self): Chec...
84d084b03dfb408d439ffa2b4b60495e8ca78b5e
<|skeleton|> class MapReplyMessage: def __init__(self, probe=False, enlra_enabled=False, security=False, nonce='\x00\x00\x00\x00\x00\x00\x00\x00', records=None): """Constructor""" <|body_0|> def sanitize(self): """Check if the current settings conform to the LISP specifications and fix...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MapReplyMessage: def __init__(self, probe=False, enlra_enabled=False, security=False, nonce='\x00\x00\x00\x00\x00\x00\x00\x00', records=None): """Constructor""" super(MapReplyMessage, self).__init__() self.probe = probe self.enlra_enabled = enlra_enabled self.security =...
the_stack_v2_python_sparse
pylisp/packet/lisp/control/map_reply.py
steffann/pylisp
train
3
a63d3728fdaa2cbdf96e6a4fbb7197237db32968
[ "context = {}\navailable_fields = ['dataset_type_ref', 'longitude_min', 'longitude_max', 'latitude_min', 'latitude_max', 'start_date', 'end_date']\nexisting_data = {key: request.GET.get(key, None) for key in available_fields if request.GET.get(key, None) is not None}\ningestion_storage_defaults = None\nif 'dataset_...
<|body_start_0|> context = {} available_fields = ['dataset_type_ref', 'longitude_min', 'longitude_max', 'latitude_min', 'latitude_max', 'start_date', 'end_date'] existing_data = {key: request.GET.get(key, None) for key in available_fields if request.GET.get(key, None) is not None} ingest...
Submit an ingestion form to create a sample Data Cube for user download
CreateDataCubeSubset
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateDataCubeSubset: """Submit an ingestion form to create a sample Data Cube for user download""" def get(self, request): """Return a rendered html page that contains the metadata form and ability to add or delete measurements. This can be built upon an existing dataset type (datas...
stack_v2_sparse_classes_75kplus_train_001943
19,958
permissive
[ { "docstring": "Return a rendered html page that contains the metadata form and ability to add or delete measurements. This can be built upon an existing dataset type (dataset_type_id) or a blank form. Args: dataset_type_id: optional id to an existing dataset Returns: Rendered HTML for a page that will allow us...
2
stack_v2_sparse_classes_30k_train_000934
Implement the Python class `CreateDataCubeSubset` described below. Class description: Submit an ingestion form to create a sample Data Cube for user download Method signatures and docstrings: - def get(self, request): Return a rendered html page that contains the metadata form and ability to add or delete measurement...
Implement the Python class `CreateDataCubeSubset` described below. Class description: Submit an ingestion form to create a sample Data Cube for user download Method signatures and docstrings: - def get(self, request): Return a rendered html page that contains the metadata form and ability to add or delete measurement...
ef50e918df89313f130d735e7cb7c0a069da410e
<|skeleton|> class CreateDataCubeSubset: """Submit an ingestion form to create a sample Data Cube for user download""" def get(self, request): """Return a rendered html page that contains the metadata form and ability to add or delete measurements. This can be built upon an existing dataset type (datas...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateDataCubeSubset: """Submit an ingestion form to create a sample Data Cube for user download""" def get(self, request): """Return a rendered html page that contains the metadata form and ability to add or delete measurements. This can be built upon an existing dataset type (dataset_type_id) o...
the_stack_v2_python_sparse
apps/data_cube_manager/views/ingestion.py
ceos-seo/data_cube_ui
train
47
2bc1e52a0543e09f2422b3f89afcd1d1660d033d
[ "try:\n list = db.get_list_by_id(list_id=list_id, session=session)\nexcept NoResultFound:\n raise NotFoundError('list_id %d does not exist' % list_id)\nreturn jsonify(list.to_dict())", "try:\n db.delete_list_by_id(list_id=list_id, session=session)\nexcept NoResultFound:\n raise NotFoundError('list_id ...
<|body_start_0|> try: list = db.get_list_by_id(list_id=list_id, session=session) except NoResultFound: raise NotFoundError('list_id %d does not exist' % list_id) return jsonify(list.to_dict()) <|end_body_0|> <|body_start_1|> try: db.delete_list_by_id(...
PendingListListAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PendingListListAPI: def get(self, list_id, session=None): """Get pending list by ID""" <|body_0|> def delete(self, list_id, session=None): """Delete pending list by ID""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: list = db.get_li...
stack_v2_sparse_classes_75kplus_train_001944
13,354
permissive
[ { "docstring": "Get pending list by ID", "name": "get", "signature": "def get(self, list_id, session=None)" }, { "docstring": "Delete pending list by ID", "name": "delete", "signature": "def delete(self, list_id, session=None)" } ]
2
null
Implement the Python class `PendingListListAPI` described below. Class description: Implement the PendingListListAPI class. Method signatures and docstrings: - def get(self, list_id, session=None): Get pending list by ID - def delete(self, list_id, session=None): Delete pending list by ID
Implement the Python class `PendingListListAPI` described below. Class description: Implement the PendingListListAPI class. Method signatures and docstrings: - def get(self, list_id, session=None): Get pending list by ID - def delete(self, list_id, session=None): Delete pending list by ID <|skeleton|> class PendingL...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class PendingListListAPI: def get(self, list_id, session=None): """Get pending list by ID""" <|body_0|> def delete(self, list_id, session=None): """Delete pending list by ID""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PendingListListAPI: def get(self, list_id, session=None): """Get pending list by ID""" try: list = db.get_list_by_id(list_id=list_id, session=session) except NoResultFound: raise NotFoundError('list_id %d does not exist' % list_id) return jsonify(list.to...
the_stack_v2_python_sparse
flexget/components/managed_lists/lists/pending_list/api.py
BrutuZ/Flexget
train
1
173e9d8cae073385f01b8bff0009bfa1780ee922
[ "df = pd.DataFrame({'A': [1.0, 2, 3], 'Class': ['A', 'B', 'C']})\nclass_col_name = 'Class'\nrules = extract_initial_rules(df, class_col_name)\ncorrect = pd.DataFrame({'A': [(1.0, 1.0), (2, 2), (3, 3)], 'Class': ['A', 'B', 'C']})\nself.assertTrue(df.shape == (3, 2) and rules.shape == (3, 2))\nself.assertTrue(rules.e...
<|body_start_0|> df = pd.DataFrame({'A': [1.0, 2, 3], 'Class': ['A', 'B', 'C']}) class_col_name = 'Class' rules = extract_initial_rules(df, class_col_name) correct = pd.DataFrame({'A': [(1.0, 1.0), (2, 2), (3, 3)], 'Class': ['A', 'B', 'C']}) self.assertTrue(df.shape == (3, 2) and...
Tests test_extract_initial_rules() from utils
TestExtractInitialRules
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestExtractInitialRules: """Tests test_extract_initial_rules() from utils""" def test_extract_initial_rules_numeric(self): """Test that rules are extracted correctly with a single numeric features""" <|body_0|> def test_extract_initial_rules_nominal(self): """Tes...
stack_v2_sparse_classes_75kplus_train_001945
2,560
permissive
[ { "docstring": "Test that rules are extracted correctly with a single numeric features", "name": "test_extract_initial_rules_numeric", "signature": "def test_extract_initial_rules_numeric(self)" }, { "docstring": "Test that rules are extracted correctly with a single nominal features", "name...
4
null
Implement the Python class `TestExtractInitialRules` described below. Class description: Tests test_extract_initial_rules() from utils Method signatures and docstrings: - def test_extract_initial_rules_numeric(self): Test that rules are extracted correctly with a single numeric features - def test_extract_initial_rul...
Implement the Python class `TestExtractInitialRules` described below. Class description: Tests test_extract_initial_rules() from utils Method signatures and docstrings: - def test_extract_initial_rules_numeric(self): Test that rules are extracted correctly with a single numeric features - def test_extract_initial_rul...
ad9bf0b4e44c19f66c1597e857ef6cf70f56a646
<|skeleton|> class TestExtractInitialRules: """Tests test_extract_initial_rules() from utils""" def test_extract_initial_rules_numeric(self): """Test that rules are extracted correctly with a single numeric features""" <|body_0|> def test_extract_initial_rules_nominal(self): """Tes...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestExtractInitialRules: """Tests test_extract_initial_rules() from utils""" def test_extract_initial_rules_numeric(self): """Test that rules are extracted correctly with a single numeric features""" df = pd.DataFrame({'A': [1.0, 2, 3], 'Class': ['A', 'B', 'C']}) class_col_name = ...
the_stack_v2_python_sparse
unit_tests/test_extract_initial_rules.py
fensta/bracid2019
train
0
8d8c5828dbf530119b1122589d61d16372848947
[ "low, high, max_val = (1, len(nums) - 1, len(nums) - 1)\nwhile low < high:\n pivot = low + (high - low) / 2\n small_count, large_count = (0, 0)\n for n in nums:\n if n < pivot:\n small_count += 1\n elif n > pivot:\n large_count += 1\n if small_count > pivot - 1:\n ...
<|body_start_0|> low, high, max_val = (1, len(nums) - 1, len(nums) - 1) while low < high: pivot = low + (high - low) / 2 small_count, large_count = (0, 0) for n in nums: if n < pivot: small_count += 1 elif n > pivot:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def find_duplicate_bs(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def find_duplicate_bs_nice(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def find_duplicate_two_pointers(self, nums): """:type nums:...
stack_v2_sparse_classes_75kplus_train_001946
2,372
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "find_duplicate_bs", "signature": "def find_duplicate_bs(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "find_duplicate_bs_nice", "signature": "def find_duplicate_bs_nice(self, nums)" }, { "d...
3
stack_v2_sparse_classes_30k_train_013769
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_duplicate_bs(self, nums): :type nums: List[int] :rtype: int - def find_duplicate_bs_nice(self, nums): :type nums: List[int] :rtype: int - def find_duplicate_two_pointers...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_duplicate_bs(self, nums): :type nums: List[int] :rtype: int - def find_duplicate_bs_nice(self, nums): :type nums: List[int] :rtype: int - def find_duplicate_two_pointers...
e41f4ac9e99b9272ed4718680f4d12fd7443db03
<|skeleton|> class Solution: def find_duplicate_bs(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def find_duplicate_bs_nice(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> def find_duplicate_two_pointers(self, nums): """:type nums:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def find_duplicate_bs(self, nums): """:type nums: List[int] :rtype: int""" low, high, max_val = (1, len(nums) - 1, len(nums) - 1) while low < high: pivot = low + (high - low) / 2 small_count, large_count = (0, 0) for n in nums: ...
the_stack_v2_python_sparse
1-Python/Hard/find_the_duplicate_number.py
jied314/IQs
train
0
8ff5131a1be07db4082a59c62aca99a1669760f9
[ "super().__init__()\nself.drop_path_rate = drop_path\nembed_dim = dim\nself.F = AttentionSubBlock(dim=embed_dim, input_size=input_size, num_heads=num_heads, cfg=cfg, dim_out=dim_out, kernel_q=kernel_q, kernel_kv=kernel_kv, stride_q=stride_q, stride_kv=stride_kv, norm_layer=norm_layer)\nself.G = MLPSubblock(dim=dim_...
<|body_start_0|> super().__init__() self.drop_path_rate = drop_path embed_dim = dim self.F = AttentionSubBlock(dim=embed_dim, input_size=input_size, num_heads=num_heads, cfg=cfg, dim_out=dim_out, kernel_q=kernel_q, kernel_kv=kernel_kv, stride_q=stride_q, stride_kv=stride_kv, norm_layer=n...
Blocks for changing the feature dimensions in MViT (using Q-pooling). See Section 3.3.1 in paper for details.
StageTransitionBlock
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StageTransitionBlock: """Blocks for changing the feature dimensions in MViT (using Q-pooling). See Section 3.3.1 in paper for details.""" def __init__(self, dim, input_size, dim_out, num_heads, mlp_ratio, qkv_bias, drop_path, kernel_q, kernel_kv, stride_q, stride_kv, cfg, norm_layer=nn.Layer...
stack_v2_sparse_classes_75kplus_train_001947
20,584
permissive
[ { "docstring": "Uses the same structure of F and G functions as Reversible Block except without using reversible forward (and backward) pass.", "name": "__init__", "signature": "def __init__(self, dim, input_size, dim_out, num_heads, mlp_ratio, qkv_bias, drop_path, kernel_q, kernel_kv, stride_q, stride_...
2
stack_v2_sparse_classes_30k_train_010226
Implement the Python class `StageTransitionBlock` described below. Class description: Blocks for changing the feature dimensions in MViT (using Q-pooling). See Section 3.3.1 in paper for details. Method signatures and docstrings: - def __init__(self, dim, input_size, dim_out, num_heads, mlp_ratio, qkv_bias, drop_path...
Implement the Python class `StageTransitionBlock` described below. Class description: Blocks for changing the feature dimensions in MViT (using Q-pooling). See Section 3.3.1 in paper for details. Method signatures and docstrings: - def __init__(self, dim, input_size, dim_out, num_heads, mlp_ratio, qkv_bias, drop_path...
6092dad7be32bb1d6b71fe1bade258dc8b492fe3
<|skeleton|> class StageTransitionBlock: """Blocks for changing the feature dimensions in MViT (using Q-pooling). See Section 3.3.1 in paper for details.""" def __init__(self, dim, input_size, dim_out, num_heads, mlp_ratio, qkv_bias, drop_path, kernel_q, kernel_kv, stride_q, stride_kv, cfg, norm_layer=nn.Layer...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StageTransitionBlock: """Blocks for changing the feature dimensions in MViT (using Q-pooling). See Section 3.3.1 in paper for details.""" def __init__(self, dim, input_size, dim_out, num_heads, mlp_ratio, qkv_bias, drop_path, kernel_q, kernel_kv, stride_q, stride_kv, cfg, norm_layer=nn.LayerNorm, pre_q_f...
the_stack_v2_python_sparse
slowfast/models/reversible_mvit.py
facebookresearch/SlowFast
train
6,221
236a368e7134bd6b4bbe643076ef60f205b6ac36
[ "self.instance = instance\nsuper(AbstractModelInstanceUpdateForm, self).__init__(*args, instance=instance, **kwargs)\nself._set_save_fields(*args)\nsave_fields_dict = dict(zip(self.save_fields, [True] * len(self.save_fields)))\nif args or kwargs:\n for name, field in self.fields.items():\n if name not in ...
<|body_start_0|> self.instance = instance super(AbstractModelInstanceUpdateForm, self).__init__(*args, instance=instance, **kwargs) self._set_save_fields(*args) save_fields_dict = dict(zip(self.save_fields, [True] * len(self.save_fields))) if args or kwargs: for name,...
An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only limited fields are saved This is limited-update mechanism is useful for API endpoints that only updat...
AbstractModelInstanceUpdateForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractModelInstanceUpdateForm: """An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only limited fields are saved This is limited-u...
stack_v2_sparse_classes_75kplus_train_001948
3,013
permissive
[ { "docstring": "Overrides forms.ModelForm.__init__() Unlike forms.ModelForm, instance is required", "name": "__init__", "signature": "def __init__(self, instance, *args, **kwargs)" }, { "docstring": "Determine the subset of fields that we want to save Called by self.__init__()", "name": "_se...
3
stack_v2_sparse_classes_30k_train_025383
Implement the Python class `AbstractModelInstanceUpdateForm` described below. Class description: An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only lim...
Implement the Python class `AbstractModelInstanceUpdateForm` described below. Class description: An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only lim...
fcb39285be552629a09aa3bee03d08da4016809b
<|skeleton|> class AbstractModelInstanceUpdateForm: """An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only limited fields are saved This is limited-u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AbstractModelInstanceUpdateForm: """An abstract class for manipulating Model instances Since this is an abstract class, it is meant to be extended Features: All fields that aren't passed in request.POST or request.FILES are optional (required=False) Only limited fields are saved This is limited-update mechani...
the_stack_v2_python_sparse
forms/classes.py
davidvtran/django-htk
train
0
d7c22627072b87b0c11aa00645f403cc5adbc16f
[ "def pre_order_traversal(node):\n if node is not None:\n tree.append(str(node.val))\n pre_order_traversal(node.left)\n pre_order_traversal(node.right)\n else:\n tree.append('X')\ntree = []\npre_order_traversal(root)\nreturn ' '.join(tree)", "def decode():\n val = next(values)\...
<|body_start_0|> def pre_order_traversal(node): if node is not None: tree.append(str(node.val)) pre_order_traversal(node.left) pre_order_traversal(node.right) else: tree.append('X') tree = [] pre_order_traver...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_001949
1,340
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:...
31b7f78da404ba5535d70fc53121828ec57c0706
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def pre_order_traversal(node): if node is not None: tree.append(str(node.val)) pre_order_traversal(node.left) pre_order_traver...
the_stack_v2_python_sparse
leet150/leet297.py
riehseun/riehseun.github.io
train
1
81a9aaa7e895b7392578d1482bbb04eb88afae05
[ "users = User.objects.filter(username__iexact=self.cleaned_data['username'])\nif not users:\n return self.cleaned_data['username']\nraise forms.ValidationError(_(u'该用户名已经注册'))", "emails = User.objects.filter(email__iexact=self.cleaned_data['email'])\nif not emails:\n return self.cleaned_data['email']\nraise...
<|body_start_0|> users = User.objects.filter(username__iexact=self.cleaned_data['username']) if not users: return self.cleaned_data['username'] raise forms.ValidationError(_(u'该用户名已经注册')) <|end_body_0|> <|body_start_1|> emails = User.objects.filter(email__iexact=self.cleaned...
RegisterForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterForm: def clean_username(self): """验证重复昵称""" <|body_0|> def clean_email(self): """验证重复email""" <|body_1|> <|end_skeleton|> <|body_start_0|> users = User.objects.filter(username__iexact=self.cleaned_data['username']) if not users: ...
stack_v2_sparse_classes_75kplus_train_001950
5,159
no_license
[ { "docstring": "验证重复昵称", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "验证重复email", "name": "clean_email", "signature": "def clean_email(self)" } ]
2
stack_v2_sparse_classes_30k_train_036366
Implement the Python class `RegisterForm` described below. Class description: Implement the RegisterForm class. Method signatures and docstrings: - def clean_username(self): 验证重复昵称 - def clean_email(self): 验证重复email
Implement the Python class `RegisterForm` described below. Class description: Implement the RegisterForm class. Method signatures and docstrings: - def clean_username(self): 验证重复昵称 - def clean_email(self): 验证重复email <|skeleton|> class RegisterForm: def clean_username(self): """验证重复昵称""" <|body_0...
f5877567b6d7a0e3ab9895416ea95d02f3b572a4
<|skeleton|> class RegisterForm: def clean_username(self): """验证重复昵称""" <|body_0|> def clean_email(self): """验证重复email""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegisterForm: def clean_username(self): """验证重复昵称""" users = User.objects.filter(username__iexact=self.cleaned_data['username']) if not users: return self.cleaned_data['username'] raise forms.ValidationError(_(u'该用户名已经注册')) def clean_email(self): """验证重...
the_stack_v2_python_sparse
accounts/forms.py
sj741231/stockstar-vsa
train
0
4466336ade31863df97c6abec9e3c2a2f0a10fca
[ "pkgs_changed = []\nif not action.keys():\n log.debug('No gems specified')\n return pkgs_changed\nfor pkg in action:\n installed = False\n if not action[pkg]:\n installed = self._install_gem(pkg)\n elif isinstance(action[pkg], basestring):\n installed = self._install_gem(pkg, action[pkg...
<|body_start_0|> pkgs_changed = [] if not action.keys(): log.debug('No gems specified') return pkgs_changed for pkg in action: installed = False if not action[pkg]: installed = self._install_gem(pkg) elif isinstance(acti...
Installs packages via rubygems
GemTool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GemTool: """Installs packages via rubygems""" def apply(self, action, auth_config=None): """Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package name to version; version can be empty, a single string or a...
stack_v2_sparse_classes_75kplus_train_001951
5,320
no_license
[ { "docstring": "Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package name to version; version can be empty, a single string or a list of strings Exceptions: ToolError -- on expected failures (such as a non-zero exit code)", "nam...
3
stack_v2_sparse_classes_30k_train_019226
Implement the Python class `GemTool` described below. Class description: Installs packages via rubygems Method signatures and docstrings: - def apply(self, action, auth_config=None): Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package na...
Implement the Python class `GemTool` described below. Class description: Installs packages via rubygems Method signatures and docstrings: - def apply(self, action, auth_config=None): Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package na...
a473d0d389612e53a2ad6fe8a18d984474c44623
<|skeleton|> class GemTool: """Installs packages via rubygems""" def apply(self, action, auth_config=None): """Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package name to version; version can be empty, a single string or a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GemTool: """Installs packages via rubygems""" def apply(self, action, auth_config=None): """Install a set of packages via rubygems, returning the packages actually installed or updated. Arguments: action -- a dict of package name to version; version can be empty, a single string or a list of stri...
the_stack_v2_python_sparse
p/dist-packages/cfnbootstrap/lang_package_tools.py
joshg111/craigslist_kbb
train
7
9996591799edd24e8b51773c0c8d8345e7891da7
[ "agent = request.user.userinfo.agent\ncompany = request.user.userinfo.company\ndata = models.SSARuleManage.tree(agent, company)\nreturn Response({'data': data, 'status': 200, 'msg': '获取成功'})", "obj_serializer = serializers.RuleManageSerializers(data=request.data, context={'request': request})\nif obj_serializer.i...
<|body_start_0|> agent = request.user.userinfo.agent company = request.user.userinfo.company data = models.SSARuleManage.tree(agent, company) return Response({'data': data, 'status': 200, 'msg': '获取成功'}) <|end_body_0|> <|body_start_1|> obj_serializer = serializers.RuleManageSeri...
专家分析系统
RuleManageList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RuleManageList: """专家分析系统""" def get(self, request): """获取规则目录树""" <|body_0|> def post(self, request): """添加规则""" <|body_1|> <|end_skeleton|> <|body_start_0|> agent = request.user.userinfo.agent company = request.user.userinfo.company ...
stack_v2_sparse_classes_75kplus_train_001952
4,124
no_license
[ { "docstring": "获取规则目录树", "name": "get", "signature": "def get(self, request)" }, { "docstring": "添加规则", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_005201
Implement the Python class `RuleManageList` described below. Class description: 专家分析系统 Method signatures and docstrings: - def get(self, request): 获取规则目录树 - def post(self, request): 添加规则
Implement the Python class `RuleManageList` described below. Class description: 专家分析系统 Method signatures and docstrings: - def get(self, request): 获取规则目录树 - def post(self, request): 添加规则 <|skeleton|> class RuleManageList: """专家分析系统""" def get(self, request): """获取规则目录树""" <|body_0|> def...
d6e025d7e9d9e3aecfd399c77f376130edd8a2df
<|skeleton|> class RuleManageList: """专家分析系统""" def get(self, request): """获取规则目录树""" <|body_0|> def post(self, request): """添加规则""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RuleManageList: """专家分析系统""" def get(self, request): """获取规则目录树""" agent = request.user.userinfo.agent company = request.user.userinfo.company data = models.SSARuleManage.tree(agent, company) return Response({'data': data, 'status': 200, 'msg': '获取成功'}) def po...
the_stack_v2_python_sparse
soc_ssa/views/experts_analysis.py
sundw2015/841
train
4
c8baed2e52695479c623c7928cb3e45963f32c9a
[ "message, error_code, http_code = cls.parse_error(response)\nklass = cls.ERRORS.get(http_code, SynapsePayError)\nreturn klass(message=message, code=error_code, response=response)", "body = response.json()\nif type(body) is dict and type(body['error']) is dict:\n return [body['error']['en'], body['error_code'],...
<|body_start_0|> message, error_code, http_code = cls.parse_error(response) klass = cls.ERRORS.get(http_code, SynapsePayError) return klass(message=message, code=error_code, response=response) <|end_body_0|> <|body_start_1|> body = response.json() if type(body) is dict and type(...
Determines which error to raise based on status code.
ErrorFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ErrorFactory: """Determines which error to raise based on status code.""" def from_response(cls, response): """Return the corresponding error from a response.""" <|body_0|> def parse_error(cls, response): """Determine error message and code from response body."""...
stack_v2_sparse_classes_75kplus_train_001953
3,291
permissive
[ { "docstring": "Return the corresponding error from a response.", "name": "from_response", "signature": "def from_response(cls, response)" }, { "docstring": "Determine error message and code from response body.", "name": "parse_error", "signature": "def parse_error(cls, response)" } ]
2
null
Implement the Python class `ErrorFactory` described below. Class description: Determines which error to raise based on status code. Method signatures and docstrings: - def from_response(cls, response): Return the corresponding error from a response. - def parse_error(cls, response): Determine error message and code f...
Implement the Python class `ErrorFactory` described below. Class description: Determines which error to raise based on status code. Method signatures and docstrings: - def from_response(cls, response): Return the corresponding error from a response. - def parse_error(cls, response): Determine error message and code f...
e7647191b386bdda84c0f2f1eb097569e36c27ae
<|skeleton|> class ErrorFactory: """Determines which error to raise based on status code.""" def from_response(cls, response): """Return the corresponding error from a response.""" <|body_0|> def parse_error(cls, response): """Determine error message and code from response body."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ErrorFactory: """Determines which error to raise based on status code.""" def from_response(cls, response): """Return the corresponding error from a response.""" message, error_code, http_code = cls.parse_error(response) klass = cls.ERRORS.get(http_code, SynapsePayError) r...
the_stack_v2_python_sparse
synapse_pay_rest/errors.py
SynapseFI/SynapseFI-Python
train
4
1b1e97d048e226d43a7e6560604440242e14651b
[ "if self.request.validated['tender_status'] not in ['active.qualification', 'active.awarded']:\n raise_operation_error(self.request, \"Can't {} document in current ({}) tender status\".format(operation, self.request.validated['tender_status']))\nif any([i.status != 'active' for i in self.request.validated['tende...
<|body_start_0|> if self.request.validated['tender_status'] not in ['active.qualification', 'active.awarded']: raise_operation_error(self.request, "Can't {} document in current ({}) tender status".format(operation, self.request.validated['tender_status'])) if any([i.status != 'active' for i ...
Tender Award Agreement Document
TenderAwardContractDocumentResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenderAwardContractDocumentResource: """Tender Award Agreement Document""" def validate_agreement_document(self, operation): """TODO move validators This class is inherited from below package, but validate_agreement_document function has different validators. For now, we have no way ...
stack_v2_sparse_classes_75kplus_train_001954
5,175
permissive
[ { "docstring": "TODO move validators This class is inherited from below package, but validate_agreement_document function has different validators. For now, we have no way to use different validators on methods according to procedure type.", "name": "validate_agreement_document", "signature": "def valid...
4
stack_v2_sparse_classes_30k_test_002422
Implement the Python class `TenderAwardContractDocumentResource` described below. Class description: Tender Award Agreement Document Method signatures and docstrings: - def validate_agreement_document(self, operation): TODO move validators This class is inherited from below package, but validate_agreement_document fu...
Implement the Python class `TenderAwardContractDocumentResource` described below. Class description: Tender Award Agreement Document Method signatures and docstrings: - def validate_agreement_document(self, operation): TODO move validators This class is inherited from below package, but validate_agreement_document fu...
7b2d0f514be6dca090ea96b83df8ce01bdc7dc0d
<|skeleton|> class TenderAwardContractDocumentResource: """Tender Award Agreement Document""" def validate_agreement_document(self, operation): """TODO move validators This class is inherited from below package, but validate_agreement_document function has different validators. For now, we have no way ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TenderAwardContractDocumentResource: """Tender Award Agreement Document""" def validate_agreement_document(self, operation): """TODO move validators This class is inherited from below package, but validate_agreement_document function has different validators. For now, we have no way to use differ...
the_stack_v2_python_sparse
openprocurement/tender/cfaua/views/agreement_document.py
ProzorroUKR/openprocurement.tender.cfaua
train
0
efe07249cb12578db74937b05e27f5beaada33a8
[ "self._mutation_rate = mutation_rate\nself._mutation_rand = random.Random()\nself._switch_rand = random.Random()", "mutated_org = organism.copy()\ngene_choices = mutated_org.genome.alphabet.letters\nfor gene_index in range(len(mutated_org.genome)):\n mutation_chance = self._mutation_rand.random()\n if mutat...
<|body_start_0|> self._mutation_rate = mutation_rate self._mutation_rand = random.Random() self._switch_rand = random.Random() <|end_body_0|> <|body_start_1|> mutated_org = organism.copy() gene_choices = mutated_org.genome.alphabet.letters for gene_index in range(len(mut...
Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the alphabet item it is equally likely to switch to any other letter in the alphabet.
ConversionMutation
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConversionMutation: """Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the alphabet item it is equally likely to swi...
stack_v2_sparse_classes_75kplus_train_001955
3,166
permissive
[ { "docstring": "Inititialize a mutator. Arguments: o mutation_rate -- The chance of a mutation happening at any position in the genome.", "name": "__init__", "signature": "def __init__(self, mutation_rate=0.001)" }, { "docstring": "Mutate the organisms genome.", "name": "mutate", "signat...
2
stack_v2_sparse_classes_30k_train_048658
Implement the Python class `ConversionMutation` described below. Class description: Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the al...
Implement the Python class `ConversionMutation` described below. Class description: Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the al...
1d9a8e84a8572809ee3260ede44290e14de3bdd1
<|skeleton|> class ConversionMutation: """Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the alphabet item it is equally likely to swi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConversionMutation: """Potentially mutate any item to another in the alphabet. This just performs switching mutation -- changing one gene of a genome to any other potential gene, at some defined frequency. If the organism is determined to mutate, then the alphabet item it is equally likely to switch to any ot...
the_stack_v2_python_sparse
bin/last_wrapper/Bio/GA/Mutation/Simple.py
LyonsLab/coge
train
41
2eeadeedb1f4545810bb4e9bbc02586e4e3df09e
[ "self.from_stop_geo = kwargs['from_stop_geo']\nself.to_stop_geo = kwargs['to_stop_geo']\nself.from_city = kwargs['from_city']\nself.from_stop = kwargs['from_stop'] if kwargs['from_stop'] not in ['__ANY__', 'none'] else None\nself.to_city = kwargs['to_city']\nself.to_stop = kwargs['to_stop'] if kwargs['to_stop'] not...
<|body_start_0|> self.from_stop_geo = kwargs['from_stop_geo'] self.to_stop_geo = kwargs['to_stop_geo'] self.from_city = kwargs['from_city'] self.from_stop = kwargs['from_stop'] if kwargs['from_stop'] not in ['__ANY__', 'none'] else None self.to_city = kwargs['to_city'] se...
Holder for starting and ending point (and other parameters) of travel.
Travel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Travel: """Holder for starting and ending point (and other parameters) of travel.""" def __init__(self, **kwargs): """Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.""" <|body_0|> def get_minimal_info(se...
stack_v2_sparse_classes_75kplus_train_001956
14,137
permissive
[ { "docstring": "Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Return minimal waypoints information in the form of a stringified inform() dial...
2
stack_v2_sparse_classes_30k_train_018269
Implement the Python class `Travel` described below. Class description: Holder for starting and ending point (and other parameters) of travel. Method signatures and docstrings: - def __init__(self, **kwargs): Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_tran...
Implement the Python class `Travel` described below. Class description: Holder for starting and ending point (and other parameters) of travel. Method signatures and docstrings: - def __init__(self, **kwargs): Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_tran...
73af644ec35c8a1cd0c37cd478c2afc1db717e0b
<|skeleton|> class Travel: """Holder for starting and ending point (and other parameters) of travel.""" def __init__(self, **kwargs): """Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.""" <|body_0|> def get_minimal_info(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Travel: """Holder for starting and ending point (and other parameters) of travel.""" def __init__(self, **kwargs): """Initializing (just filling in data). Accepted keys: from_city, from_stop, to_city, to_stop, vehicle, max_transfers.""" self.from_stop_geo = kwargs['from_stop_geo'] ...
the_stack_v2_python_sparse
alex/applications/PublicTransportInfoEN/directions.py
oplatek/alex
train
0
6cbe661344667bb9da2f9af6092b7e7c7c042951
[ "data_in = {'indent': 0, 'body': '', 'filename': '', 'line': 0}\nres = ForToken.make(data_in)\nself.assertFalse(res)", "data_in = {'indent': 0, 'body': 'for x in range(1): x', 'filename': '', 'line': 0}\ntoken = ForToken.make(data_in)\nself.assertTrue(token)\n_globals = {}\n_locals = {}\nitervalue = eval(token.it...
<|body_start_0|> data_in = {'indent': 0, 'body': '', 'filename': '', 'line': 0} res = ForToken.make(data_in) self.assertFalse(res) <|end_body_0|> <|body_start_1|> data_in = {'indent': 0, 'body': 'for x in range(1): x', 'filename': '', 'line': 0} token = ForToken.make(data_in) ...
ForToken tests
ForTokenTestCase
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForTokenTestCase: """ForToken tests""" def testMakeNoMatch(self): """no match - no token""" <|body_0|> def testMakeMatchSingleVar(self): """match - single variable""" <|body_1|> def testMakeMatchMultiVar(self): """simple list of parameters"""...
stack_v2_sparse_classes_75kplus_train_001957
39,836
permissive
[ { "docstring": "no match - no token", "name": "testMakeNoMatch", "signature": "def testMakeNoMatch(self)" }, { "docstring": "match - single variable", "name": "testMakeMatchSingleVar", "signature": "def testMakeMatchSingleVar(self)" }, { "docstring": "simple list of parameters", ...
4
stack_v2_sparse_classes_30k_train_035648
Implement the Python class `ForTokenTestCase` described below. Class description: ForToken tests Method signatures and docstrings: - def testMakeNoMatch(self): no match - no token - def testMakeMatchSingleVar(self): match - single variable - def testMakeMatchMultiVar(self): simple list of parameters - def testMakeMat...
Implement the Python class `ForTokenTestCase` described below. Class description: ForToken tests Method signatures and docstrings: - def testMakeNoMatch(self): no match - no token - def testMakeMatchSingleVar(self): match - single variable - def testMakeMatchMultiVar(self): simple list of parameters - def testMakeMat...
430d6dfd719f8c88a4c3de2b735f8736187ff19b
<|skeleton|> class ForTokenTestCase: """ForToken tests""" def testMakeNoMatch(self): """no match - no token""" <|body_0|> def testMakeMatchSingleVar(self): """match - single variable""" <|body_1|> def testMakeMatchMultiVar(self): """simple list of parameters"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ForTokenTestCase: """ForToken tests""" def testMakeNoMatch(self): """no match - no token""" data_in = {'indent': 0, 'body': '', 'filename': '', 'line': 0} res = ForToken.make(data_in) self.assertFalse(res) def testMakeMatchSingleVar(self): """match - single va...
the_stack_v2_python_sparse
evoke/nevo/test.py
howiemac/evoke
train
0
5622e491fc9a9ebd1c6c658ea1e1e6d97b634291
[ "extension = extension or ''\nif extension and (not extension.startswith('.')):\n extension = '.' + extension\nstamp = stamp or to_timestamp(self.uploaded_on)\nreturn f'{self.file_depository.pk}/depositedfile/{self.pk}/{stamp}{extension}'", "if 'extension' in extra_parameters:\n self.extension = extra_param...
<|body_start_0|> extension = extension or '' if extension and (not extension.startswith('.')): extension = '.' + extension stamp = stamp or to_timestamp(self.uploaded_on) return f'{self.file_depository.pk}/depositedfile/{self.pk}/{stamp}{extension}' <|end_body_0|> <|body_sta...
Model representing a file in a file depository.
DepositedFile
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DepositedFile: """Model representing a file in a file depository.""" def get_source_s3_key(self, stamp=None, extension=None): """Compute the S3 key in the source bucket. It is built from the file deposit ID + ID of the deposited file + version stamp. Parameters ---------- stamp: Type...
stack_v2_sparse_classes_75kplus_train_001958
7,033
permissive
[ { "docstring": "Compute the S3 key in the source bucket. It is built from the file deposit ID + ID of the deposited file + version stamp. Parameters ---------- stamp: Type[string] Passing a value for this argument will return the source S3 key for the deposited file assuming its active stamp is set to this valu...
2
stack_v2_sparse_classes_30k_test_001994
Implement the Python class `DepositedFile` described below. Class description: Model representing a file in a file depository. Method signatures and docstrings: - def get_source_s3_key(self, stamp=None, extension=None): Compute the S3 key in the source bucket. It is built from the file deposit ID + ID of the deposite...
Implement the Python class `DepositedFile` described below. Class description: Model representing a file in a file depository. Method signatures and docstrings: - def get_source_s3_key(self, stamp=None, extension=None): Compute the S3 key in the source bucket. It is built from the file deposit ID + ID of the deposite...
f767f1bdc12c9712f26ea17cb8b19f536389f0ed
<|skeleton|> class DepositedFile: """Model representing a file in a file depository.""" def get_source_s3_key(self, stamp=None, extension=None): """Compute the S3 key in the source bucket. It is built from the file deposit ID + ID of the deposited file + version stamp. Parameters ---------- stamp: Type...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DepositedFile: """Model representing a file in a file depository.""" def get_source_s3_key(self, stamp=None, extension=None): """Compute the S3 key in the source bucket. It is built from the file deposit ID + ID of the deposited file + version stamp. Parameters ---------- stamp: Type[string] Pass...
the_stack_v2_python_sparse
src/backend/marsha/deposit/models.py
openfun/marsha
train
92
f15caaa4b00e272889713c8a34a576fc1ddcbd62
[ "scraper = request.user.scraper\nparams = GetScrapesRequestSerializer(data=request.data)\nif not params.is_valid():\n return Response(HttpBadRequestSerializer(get_error_desc(params)), status=HTTP_400_BAD_REQUEST)\nlimit = params.data['limit']\nscrapes = list(scraper.get_scrapes().order_by('-upload_date')[:limit]...
<|body_start_0|> scraper = request.user.scraper params = GetScrapesRequestSerializer(data=request.data) if not params.is_valid(): return Response(HttpBadRequestSerializer(get_error_desc(params)), status=HTTP_400_BAD_REQUEST) limit = params.data['limit'] scrapes = list...
ScrapesView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScrapesView: def get(self, request): """API call to get recents scrapes""" <|body_0|> def delete(self, request): """API call to delete all scrapes""" <|body_1|> <|end_skeleton|> <|body_start_0|> scraper = request.user.scraper params = GetScr...
stack_v2_sparse_classes_75kplus_train_001959
2,115
no_license
[ { "docstring": "API call to get recents scrapes", "name": "get", "signature": "def get(self, request)" }, { "docstring": "API call to delete all scrapes", "name": "delete", "signature": "def delete(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_028445
Implement the Python class `ScrapesView` described below. Class description: Implement the ScrapesView class. Method signatures and docstrings: - def get(self, request): API call to get recents scrapes - def delete(self, request): API call to delete all scrapes
Implement the Python class `ScrapesView` described below. Class description: Implement the ScrapesView class. Method signatures and docstrings: - def get(self, request): API call to get recents scrapes - def delete(self, request): API call to delete all scrapes <|skeleton|> class ScrapesView: def get(self, requ...
d5171c5b3b54265cecbc3dfab2731729b66e6e70
<|skeleton|> class ScrapesView: def get(self, request): """API call to get recents scrapes""" <|body_0|> def delete(self, request): """API call to delete all scrapes""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScrapesView: def get(self, request): """API call to get recents scrapes""" scraper = request.user.scraper params = GetScrapesRequestSerializer(data=request.data) if not params.is_valid(): return Response(HttpBadRequestSerializer(get_error_desc(params)), status=HTTP_...
the_stack_v2_python_sparse
api/views/ScrapesView.py
Scraper-Club/Server
train
1
d0788e66609b31520373327e4d4f639105076486
[ "super().__init__()\nself.num_classes = num_classes\nself.num_features = self.embed_dim = embed_dim\nself.num_tokens = 2 if distilled else 1\nnorm_layer = norm_layer or partial(ops.LayerNorm, eps=1e-06)\nact_layer = act_layer or ops.gelu\nself.patch_embed = embed_layer(img_size=img_size, patch_size=patch_size, in_c...
<|body_start_0|> super().__init__() self.num_classes = num_classes self.num_features = self.embed_dim = embed_dim self.num_tokens = 2 if distilled else 1 norm_layer = norm_layer or partial(ops.LayerNorm, eps=1e-06) act_layer = act_layer or ops.gelu self.patch_embe...
Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: number of input channels :type in_chans: int :param num_classes: number of class for cla...
VisionTransformer
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VisionTransformer: """Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: number of input channels :type in_chans: in...
stack_v2_sparse_classes_75kplus_train_001960
9,257
permissive
[ { "docstring": "Construct the VisionTransformer class.", "name": "__init__", "signature": "def __init__(self, img_size=224, patch_size=16, in_chans=3, num_classes=1000, embed_dim=768, depth=12, num_heads=12, mlp_ratio=4.0, qkv_bias=True, qk_scale=None, representation_size=None, distilled=False, drop_rat...
2
null
Implement the Python class `VisionTransformer` described below. Class description: Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: numb...
Implement the Python class `VisionTransformer` described below. Class description: Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: numb...
12e37a1991eb6771a2999fe0a46ddda920c47948
<|skeleton|> class VisionTransformer: """Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: number of input channels :type in_chans: in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VisionTransformer: """Vision Transformer:`An Image is Worth 16x16 Words: Transformers for Image Recognition atScale. :param img_size: input image size :type img_size: int, tuple :param patch_size: patch_size :type patch_size: int, tuple :param in_chans: number of input channels :type in_chans: int :param num_...
the_stack_v2_python_sparse
vega/networks/vit.py
huawei-noah/vega
train
850
ef27b7d49f4c8b5b914221dd043914159b7dbd79
[ "if root is None:\n return ''\noutput = []\n\ndef helper(node):\n if node is None:\n output.append('')\n else:\n output.append(str(node.val))\n helper(node.left)\n helper(node.right)\nhelper(root)\nreturn ','.join(output)", "if data == '':\n return None\nnodes = data.split(...
<|body_start_0|> if root is None: return '' output = [] def helper(node): if node is None: output.append('') else: output.append(str(node.val)) helper(node.left) helper(node.right) helper...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_001961
4,194
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_036971
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:...
1abc28919abb55b93d3879860ac9c1297d493d09
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root is None: return '' output = [] def helper(node): if node is None: output.append('') else: out...
the_stack_v2_python_sparse
lc/297.SerializeAndDeserializeBinary.py
akimi-yano/algorithm-practice
train
0
bfd35649383c8ea6c76d8b70a23bf505d0f18165
[ "super().__init__()\nself.desc = copy.deepcopy(net_desc)\nself.linear = LinearLayer(net_desc['input_dim'])\nself.embedding = EmbeddingLayer(net_desc['input_dim'], net_desc['embed_dim'])\nself.fm = FactorizationMachineLayer()\nself.mlp_input_dim = net_desc['input_dim4lookup'] * net_desc['embed_dim']\nself.mlp = Mult...
<|body_start_0|> super().__init__() self.desc = copy.deepcopy(net_desc) self.linear = LinearLayer(net_desc['input_dim']) self.embedding = EmbeddingLayer(net_desc['input_dim'], net_desc['embed_dim']) self.fm = FactorizationMachineLayer() self.mlp_input_dim = net_desc['inpu...
DeepFM: A Factorization-Machine based Neural Network for CTR Prediction. https://arxiv.org/abs/1703.04247. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zero features :type input_dim4lookup: int :param embed_dim: ...
DeepFactorizationMachineModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeepFactorizationMachineModel: """DeepFM: A Factorization-Machine based Neural Network for CTR Prediction. https://arxiv.org/abs/1703.04247. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zer...
stack_v2_sparse_classes_75kplus_train_001962
3,255
permissive
[ { "docstring": "Construct the DeepFactorizationMachineModel class. :param net_desc: config of the structure", "name": "__init__", "signature": "def __init__(self, net_desc)" }, { "docstring": "Calculate logits of pctr for given batch of samples. :param feature_id: a batch of feature id, tensor o...
2
stack_v2_sparse_classes_30k_train_019929
Implement the Python class `DeepFactorizationMachineModel` described below. Class description: DeepFM: A Factorization-Machine based Neural Network for CTR Prediction. https://arxiv.org/abs/1703.04247. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_i...
Implement the Python class `DeepFactorizationMachineModel` described below. Class description: DeepFM: A Factorization-Machine based Neural Network for CTR Prediction. https://arxiv.org/abs/1703.04247. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_i...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class DeepFactorizationMachineModel: """DeepFM: A Factorization-Machine based Neural Network for CTR Prediction. https://arxiv.org/abs/1703.04247. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zer...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeepFactorizationMachineModel: """DeepFM: A Factorization-Machine based Neural Network for CTR Prediction. https://arxiv.org/abs/1703.04247. :param input_dim: feature space of dataset :type input_dim: int :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zero features :t...
the_stack_v2_python_sparse
zeus/networks/pytorch/customs/deepfm.py
huawei-noah/xingtian
train
308
6e532125862cd9e82d1d5445c6922daabdf05da2
[ "try:\n payload = jwt.decode(data, settings.SECRET_KEY, algorithms=['HS256'])\nexcept jwt.ExpiredSignatureError:\n raise serializers.ValidationError('Verification link has expired')\nexcept jwt.PyJWTError:\n raise serializers.ValidationError('Invalid token')\nif payload['type'] != 'change_email':\n rais...
<|body_start_0|> try: payload = jwt.decode(data, settings.SECRET_KEY, algorithms=['HS256']) except jwt.ExpiredSignatureError: raise serializers.ValidationError('Verification link has expired') except jwt.PyJWTError: raise serializers.ValidationError('Invalid t...
Acount verification serializer.
ValidateChangeEmail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValidateChangeEmail: """Acount verification serializer.""" def validate_token(self, data): """Verifiy token is valid.""" <|body_0|> def save(self): """Update user's verified status.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_75kplus_train_001963
38,101
no_license
[ { "docstring": "Verifiy token is valid.", "name": "validate_token", "signature": "def validate_token(self, data)" }, { "docstring": "Update user's verified status.", "name": "save", "signature": "def save(self)" } ]
2
null
Implement the Python class `ValidateChangeEmail` described below. Class description: Acount verification serializer. Method signatures and docstrings: - def validate_token(self, data): Verifiy token is valid. - def save(self): Update user's verified status.
Implement the Python class `ValidateChangeEmail` described below. Class description: Acount verification serializer. Method signatures and docstrings: - def validate_token(self, data): Verifiy token is valid. - def save(self): Update user's verified status. <|skeleton|> class ValidateChangeEmail: """Acount verif...
64aa08425b76847ef2b0fa1f7f6c4e8de350e7ff
<|skeleton|> class ValidateChangeEmail: """Acount verification serializer.""" def validate_token(self, data): """Verifiy token is valid.""" <|body_0|> def save(self): """Update user's verified status.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ValidateChangeEmail: """Acount verification serializer.""" def validate_token(self, data): """Verifiy token is valid.""" try: payload = jwt.decode(data, settings.SECRET_KEY, algorithms=['HS256']) except jwt.ExpiredSignatureError: raise serializers.Validatio...
the_stack_v2_python_sparse
api/users/serializers/users.py
alexhernandez-git/talendy-backend
train
0
fccf0a093fabd4960d36d194df00087e15c6b8d7
[ "self.layer_configs = OrderedDict()\nself.supported_layers = supported_layers\nself.layer_counter = 0", "with open(cfg_file_path) as cfg_file:\n remainder = cfg_file.read()\n while remainder is not None:\n layer_dict, layer_name, remainder = self._next_layer(remainder)\n if layer_dict is not N...
<|body_start_0|> self.layer_configs = OrderedDict() self.supported_layers = supported_layers self.layer_counter = 0 <|end_body_0|> <|body_start_1|> with open(cfg_file_path) as cfg_file: remainder = cfg_file.read() while remainder is not None: laye...
Definition of a parser for DarkNet-based YOLOv3-608 (only tested for this topology).
DarkNetParser
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause", "MIT", "ISC", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DarkNetParser: """Definition of a parser for DarkNet-based YOLOv3-608 (only tested for this topology).""" def __init__(self, supported_layers): """Initializes a DarkNetParser object. Keyword argument: supported_layers -- a string list of supported layers in DarkNet naming convention,...
stack_v2_sparse_classes_75kplus_train_001964
29,876
permissive
[ { "docstring": "Initializes a DarkNetParser object. Keyword argument: supported_layers -- a string list of supported layers in DarkNet naming convention, parameters are only added to the class dictionary if a parsed layer is included.", "name": "__init__", "signature": "def __init__(self, supported_laye...
4
stack_v2_sparse_classes_30k_train_000357
Implement the Python class `DarkNetParser` described below. Class description: Definition of a parser for DarkNet-based YOLOv3-608 (only tested for this topology). Method signatures and docstrings: - def __init__(self, supported_layers): Initializes a DarkNetParser object. Keyword argument: supported_layers -- a stri...
Implement the Python class `DarkNetParser` described below. Class description: Definition of a parser for DarkNet-based YOLOv3-608 (only tested for this topology). Method signatures and docstrings: - def __init__(self, supported_layers): Initializes a DarkNetParser object. Keyword argument: supported_layers -- a stri...
a167852705d74bcc619d8fad0af4b9e4d84472fc
<|skeleton|> class DarkNetParser: """Definition of a parser for DarkNet-based YOLOv3-608 (only tested for this topology).""" def __init__(self, supported_layers): """Initializes a DarkNetParser object. Keyword argument: supported_layers -- a string list of supported layers in DarkNet naming convention,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DarkNetParser: """Definition of a parser for DarkNet-based YOLOv3-608 (only tested for this topology).""" def __init__(self, supported_layers): """Initializes a DarkNetParser object. Keyword argument: supported_layers -- a string list of supported layers in DarkNet naming convention, parameters a...
the_stack_v2_python_sparse
samples/python/yolov3_onnx/yolov3_to_onnx.py
NVIDIA/TensorRT
train
8,026
b3d91d707ce94a045011e46d5bd9b7fdce880855
[ "if root is None:\n return '[]'\nserialize_array = []\nmy_queue = deque([root])\nwhile len(my_queue) > 0:\n element = my_queue.pop()\n if element is None:\n serialize_array.append('null')\n else:\n serialize_array.append(element.val)\n my_queue.appendleft(element.left)\n my_q...
<|body_start_0|> if root is None: return '[]' serialize_array = [] my_queue = deque([root]) while len(my_queue) > 0: element = my_queue.pop() if element is None: serialize_array.append('null') else: serialize...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_001965
1,610
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_048436
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:...
0b208516a6ae3e72bc7b79ef0ac83dcbfa100496
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root is None: return '[]' serialize_array = [] my_queue = deque([root]) while len(my_queue) > 0: element = my_queue.pop() i...
the_stack_v2_python_sparse
leetcode/medium/serialize-and-deserialize-binary-tree.py
gsantam/competitive-programming
train
0
6dffeb2d034b8c080098284c41b424d8ea3e226d
[ "if not any((key.startswith('cat_') for key in kwargs.keys())):\n kwargs['cat_pattern'] = CAT_PATTERN\nCategorizedCorpusReader.__init__(self, kwargs)\nCorpusReader.__init__(self, root, fileids, encoding)\nself.tags = tags", "if fileids is not None and categories is not None:\n raise ValueError('Specify file...
<|body_start_0|> if not any((key.startswith('cat_') for key in kwargs.keys())): kwargs['cat_pattern'] = CAT_PATTERN CategorizedCorpusReader.__init__(self, kwargs) CorpusReader.__init__(self, root, fileids, encoding) self.tags = tags <|end_body_0|> <|body_start_1|> if...
Корпус чтения HTML-документов для доп. предварительной обработки
HTMLCorpusReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTMLCorpusReader: """Корпус чтения HTML-документов для доп. предварительной обработки""" def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs): """Инициализация объектов чтения корпуса. Аргументы, управляющие классификацией ("cat_pattern", "cat_map", "ca...
stack_v2_sparse_classes_75kplus_train_001966
2,960
no_license
[ { "docstring": "Инициализация объектов чтения корпуса. Аргументы, управляющие классификацией (\"cat_pattern\", \"cat_map\", \"cat_file\"), передаются в конструктор CategorizedCorpusReader. Остальные аргументы передаются в CorpusReader.", "name": "__init__", "signature": "def __init__(self, root, fileids...
4
stack_v2_sparse_classes_30k_train_014424
Implement the Python class `HTMLCorpusReader` described below. Class description: Корпус чтения HTML-документов для доп. предварительной обработки Method signatures and docstrings: - def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs): Инициализация объектов чтения корпуса. Аргументы, ...
Implement the Python class `HTMLCorpusReader` described below. Class description: Корпус чтения HTML-документов для доп. предварительной обработки Method signatures and docstrings: - def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs): Инициализация объектов чтения корпуса. Аргументы, ...
7e665c4f55fba513c3dd7bada820097953450102
<|skeleton|> class HTMLCorpusReader: """Корпус чтения HTML-документов для доп. предварительной обработки""" def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs): """Инициализация объектов чтения корпуса. Аргументы, управляющие классификацией ("cat_pattern", "cat_map", "ca...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HTMLCorpusReader: """Корпус чтения HTML-документов для доп. предварительной обработки""" def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs): """Инициализация объектов чтения корпуса. Аргументы, управляющие классификацией ("cat_pattern", "cat_map", "cat_file"), пер...
the_stack_v2_python_sparse
Corpus/corpus.py
rw404/analysis_of_text_data
train
0
41d5b3e3ceb030f2491accf2529803b1451bf040
[ "super(AddClausalExpletives, self).__init__(scenario, args)\nif self.language is None:\n raise LoadingException('Language must be defined!')\nself.lexicon = Lexicon()", "if tnode.formeme != 'v:že+fin':\n return None\nexpletive = self.lexicon.has_expletive(tnode.parent.t_lemma)\nif not expletive:\n return...
<|body_start_0|> super(AddClausalExpletives, self).__init__(scenario, args) if self.language is None: raise LoadingException('Language must be defined!') self.lexicon = Lexicon() <|end_body_0|> <|body_start_1|> if tnode.formeme != 'v:že+fin': return None ...
Add clausal expletive pronoun 'to' (+preposition) to subordinate clauses with 'že', if the parent verb requires it. Arguments: language: the language of the target tree selector: the selector of the target tree
AddClausalExpletives
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddClausalExpletives: """Add clausal expletive pronoun 'to' (+preposition) to subordinate clauses with 'že', if the parent verb requires it. Arguments: language: the language of the target tree selector: the selector of the target tree""" def __init__(self, scenario, args): """Constr...
stack_v2_sparse_classes_75kplus_train_001967
3,487
permissive
[ { "docstring": "Constructor, just checking the argument values", "name": "__init__", "signature": "def __init__(self, scenario, args)" }, { "docstring": "Return the clausal expletive to be added, if supposed to.", "name": "get_aux_forms", "signature": "def get_aux_forms(self, tnode)" }...
5
stack_v2_sparse_classes_30k_train_011049
Implement the Python class `AddClausalExpletives` described below. Class description: Add clausal expletive pronoun 'to' (+preposition) to subordinate clauses with 'že', if the parent verb requires it. Arguments: language: the language of the target tree selector: the selector of the target tree Method signatures and...
Implement the Python class `AddClausalExpletives` described below. Class description: Add clausal expletive pronoun 'to' (+preposition) to subordinate clauses with 'že', if the parent verb requires it. Arguments: language: the language of the target tree selector: the selector of the target tree Method signatures and...
73af644ec35c8a1cd0c37cd478c2afc1db717e0b
<|skeleton|> class AddClausalExpletives: """Add clausal expletive pronoun 'to' (+preposition) to subordinate clauses with 'že', if the parent verb requires it. Arguments: language: the language of the target tree selector: the selector of the target tree""" def __init__(self, scenario, args): """Constr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AddClausalExpletives: """Add clausal expletive pronoun 'to' (+preposition) to subordinate clauses with 'že', if the parent verb requires it. Arguments: language: the language of the target tree selector: the selector of the target tree""" def __init__(self, scenario, args): """Constructor, just c...
the_stack_v2_python_sparse
alex/components/nlg/tectotpl/block/t2a/cs/addclausalexpletives.py
oplatek/alex
train
0
6a44062e9e243b27ac25e4b7ddf2992b092695d4
[ "self.kernel_size = kernel_size\nself.pad = pad\nself.trainable = False", "self.input = Input\ninput_after_pad = np.pad(Input, ((0,), (0,), (self.pad,), (self.pad,)), mode='constant', constant_values=0)\nnum_image, C, input_height, input_width = self.input.shape\nself.stride = 2\nH_new = int((input_height - self....
<|body_start_0|> self.kernel_size = kernel_size self.pad = pad self.trainable = False <|end_body_0|> <|body_start_1|> self.input = Input input_after_pad = np.pad(Input, ((0,), (0,), (self.pad,), (self.pad,)), mode='constant', constant_values=0) num_image, C, input_height...
MaxPoolingLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaxPoolingLayer: def __init__(self, kernel_size, pad): """This class performs max pooling operation on the input. Args: kernel_size: The height/width of the pooling kernel. pad: The width of the pad zone.""" <|body_0|> def forward(self, Input, **kwargs): """This meth...
stack_v2_sparse_classes_75kplus_train_001968
2,558
no_license
[ { "docstring": "This class performs max pooling operation on the input. Args: kernel_size: The height/width of the pooling kernel. pad: The width of the pad zone.", "name": "__init__", "signature": "def __init__(self, kernel_size, pad)" }, { "docstring": "This method performs max pooling operati...
3
stack_v2_sparse_classes_30k_train_005061
Implement the Python class `MaxPoolingLayer` described below. Class description: Implement the MaxPoolingLayer class. Method signatures and docstrings: - def __init__(self, kernel_size, pad): This class performs max pooling operation on the input. Args: kernel_size: The height/width of the pooling kernel. pad: The wi...
Implement the Python class `MaxPoolingLayer` described below. Class description: Implement the MaxPoolingLayer class. Method signatures and docstrings: - def __init__(self, kernel_size, pad): This class performs max pooling operation on the input. Args: kernel_size: The height/width of the pooling kernel. pad: The wi...
15d90434387f3e9eeb1cca0b2a024dc3ba9861f2
<|skeleton|> class MaxPoolingLayer: def __init__(self, kernel_size, pad): """This class performs max pooling operation on the input. Args: kernel_size: The height/width of the pooling kernel. pad: The width of the pad zone.""" <|body_0|> def forward(self, Input, **kwargs): """This meth...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MaxPoolingLayer: def __init__(self, kernel_size, pad): """This class performs max pooling operation on the input. Args: kernel_size: The height/width of the pooling kernel. pad: The width of the pad zone.""" self.kernel_size = kernel_size self.pad = pad self.trainable = False ...
the_stack_v2_python_sparse
homework3-CNN/layers/pooling_layer.py
KHTee/THU_deep_learning_2021
train
0
76f47b5efd4d570376b2b11e8b8e43e198e0bcbe
[ "msg = Message()\nmsg.msgType = msgTypes.COMMAND\nmsg.dest = self._commID\nmsg.content = {'user': self._userID, 'cmd': interface}\nself._commManager.sendMessage(msg)", "msg = Message()\nmsg.msgType = msgTypes.TAG\nmsg.dest = self._commID\nmsg.content = {'user': self._userID, 'type': types.RM_INTERFACE, 'tag': tag...
<|body_start_0|> msg = Message() msg.msgType = msgTypes.COMMAND msg.dest = self._commID msg.content = {'user': self._userID, 'cmd': interface} self._commManager.sendMessage(msg) <|end_body_0|> <|body_start_1|> msg = Message() msg.msgType = msgTypes.TAG ms...
Class which provides a remote control object for an arbitrary endpoint.
RemoteEndpointControl
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteEndpointControl: """Class which provides a remote control object for an arbitrary endpoint.""" def addInterface(self, interface): """Add an interface to the endpoint. @param interface: Interface description which should be added. @type interface: core.command._EndpointInterface...
stack_v2_sparse_classes_75kplus_train_001969
10,878
permissive
[ { "docstring": "Add an interface to the endpoint. @param interface: Interface description which should be added. @type interface: core.command._EndpointInterfaceCommand", "name": "addInterface", "signature": "def addInterface(self, interface)" }, { "docstring": "Remove an interface from the endp...
4
stack_v2_sparse_classes_30k_train_002231
Implement the Python class `RemoteEndpointControl` described below. Class description: Class which provides a remote control object for an arbitrary endpoint. Method signatures and docstrings: - def addInterface(self, interface): Add an interface to the endpoint. @param interface: Interface description which should b...
Implement the Python class `RemoteEndpointControl` described below. Class description: Class which provides a remote control object for an arbitrary endpoint. Method signatures and docstrings: - def addInterface(self, interface): Add an interface to the endpoint. @param interface: Interface description which should b...
c277efd809fce8f0f18b009fb3b9c7f785cc3739
<|skeleton|> class RemoteEndpointControl: """Class which provides a remote control object for an arbitrary endpoint.""" def addInterface(self, interface): """Add an interface to the endpoint. @param interface: Interface description which should be added. @type interface: core.command._EndpointInterface...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RemoteEndpointControl: """Class which provides a remote control object for an arbitrary endpoint.""" def addInterface(self, interface): """Add an interface to the endpoint. @param interface: Interface description which should be added. @type interface: core.command._EndpointInterfaceCommand""" ...
the_stack_v2_python_sparse
framework/remote/control.py
LCROBOT/rce
train
0
8ee14debbabd9656f3ab95b007cf7d6895f284ca
[ "super().__init__()\nif num_layers not in (20, 26, 32, 44, 56, 110):\n raise ValueError('num_layers must be one of 20, 32, 44, 56 or 110.')\nself._num_layers = num_layers\nself._num_initial_filters = num_initial_filters\nself._shortcut_connection = shortcut_connection\nself._weight_decay = weight_decay\nself._ba...
<|body_start_0|> super().__init__() if num_layers not in (20, 26, 32, 44, 56, 110): raise ValueError('num_layers must be one of 20, 32, 44, 56 or 110.') self._num_layers = num_layers self._num_initial_filters = num_initial_filters self._shortcut_connection = shortcut_...
ResNet for CIFAR10 dataset.
Architecture
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Architecture: """ResNet for CIFAR10 dataset.""" def __init__(self, n_classes, num_layers=20, num_initial_filters=16, shortcut_connection=True, weight_decay=0.0002, batch_norm_momentum=0.99, batch_norm_epsilon=0.001, pre_hidden_size=256, batch_norm_center=True, batch_norm_scale=True, group_no...
stack_v2_sparse_classes_75kplus_train_001970
9,693
permissive
[ { "docstring": "Constructor. Args: num_layers: int scalar, num of layers. shortcut_connection: bool scalar, whether to add shortcut connection in each Resnet unit. If False, degenerates to a 'Plain network'. weight_decay: float scalar, weight for l2 regularization. batch_norm_momentum: float scalar, the moving ...
2
null
Implement the Python class `Architecture` described below. Class description: ResNet for CIFAR10 dataset. Method signatures and docstrings: - def __init__(self, n_classes, num_layers=20, num_initial_filters=16, shortcut_connection=True, weight_decay=0.0002, batch_norm_momentum=0.99, batch_norm_epsilon=0.001, pre_hidd...
Implement the Python class `Architecture` described below. Class description: ResNet for CIFAR10 dataset. Method signatures and docstrings: - def __init__(self, n_classes, num_layers=20, num_initial_filters=16, shortcut_connection=True, weight_decay=0.0002, batch_norm_momentum=0.99, batch_norm_epsilon=0.001, pre_hidd...
eaed5e56169d3f7add643a8ddc44fc063d5bcebf
<|skeleton|> class Architecture: """ResNet for CIFAR10 dataset.""" def __init__(self, n_classes, num_layers=20, num_initial_filters=16, shortcut_connection=True, weight_decay=0.0002, batch_norm_momentum=0.99, batch_norm_epsilon=0.001, pre_hidden_size=256, batch_norm_center=True, batch_norm_scale=True, group_no...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Architecture: """ResNet for CIFAR10 dataset.""" def __init__(self, n_classes, num_layers=20, num_initial_filters=16, shortcut_connection=True, weight_decay=0.0002, batch_norm_momentum=0.99, batch_norm_epsilon=0.001, pre_hidden_size=256, batch_norm_center=True, batch_norm_scale=True, group_norm_groups=16)...
the_stack_v2_python_sparse
model/architectures/ResnetCifar10v2.py
AI678/MT3
train
0
3b8b31f981facaefcbe1ffaca91fe24c237b9706
[ "if is_input_encoding_active:\n if encoding_viewdir_fn is None:\n encoding_viewdir_fn = PositionalEncoding(input_dimensions=input_channel_view_dirs, num_frequency=4, max_frequency=3)\n check_callable(encoding_viewdir_fn, 'get_dimensions', 'encoding_viewdir_fn')\n input_channel_view_dirs = encoding_v...
<|body_start_0|> if is_input_encoding_active: if encoding_viewdir_fn is None: encoding_viewdir_fn = PositionalEncoding(input_dimensions=input_channel_view_dirs, num_frequency=4, max_frequency=3) check_callable(encoding_viewdir_fn, 'get_dimensions', 'encoding_viewdir_fn') ...
The multi-layer MLP model for IDR rendering. If provided, it applies positional encoding to the view directions and overrides the input channel information accordingly. .. note:: Please check the paper for more information: https://arxiv.org/abs/2003.09852 Usage: .. code-block:: python model = IDRRenderingModel() rgb_v...
IDRRenderingModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IDRRenderingModel: """The multi-layer MLP model for IDR rendering. If provided, it applies positional encoding to the view directions and overrides the input channel information accordingly. .. note:: Please check the paper for more information: https://arxiv.org/abs/2003.09852 Usage: .. code-blo...
stack_v2_sparse_classes_75kplus_train_001971
6,577
permissive
[ { "docstring": "Args: input_channels (int): The input channel dimension to the model. If positional encoding is used, this value will be overridden. Default is 3 (XYZ). input_channel_view_dirs (int): The input channel dimension for viewing directions. If positional encoding is used, this value will be overridde...
2
stack_v2_sparse_classes_30k_train_014074
Implement the Python class `IDRRenderingModel` described below. Class description: The multi-layer MLP model for IDR rendering. If provided, it applies positional encoding to the view directions and overrides the input channel information accordingly. .. note:: Please check the paper for more information: https://arxi...
Implement the Python class `IDRRenderingModel` described below. Class description: The multi-layer MLP model for IDR rendering. If provided, it applies positional encoding to the view directions and overrides the input channel information accordingly. .. note:: Please check the paper for more information: https://arxi...
da3680cce7e8fc4c194f13a1528cddbad9a18ab0
<|skeleton|> class IDRRenderingModel: """The multi-layer MLP model for IDR rendering. If provided, it applies positional encoding to the view directions and overrides the input channel information accordingly. .. note:: Please check the paper for more information: https://arxiv.org/abs/2003.09852 Usage: .. code-blo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IDRRenderingModel: """The multi-layer MLP model for IDR rendering. If provided, it applies positional encoding to the view directions and overrides the input channel information accordingly. .. note:: Please check the paper for more information: https://arxiv.org/abs/2003.09852 Usage: .. code-block:: python m...
the_stack_v2_python_sparse
pynif3d/models/idr/rendering_model.py
pfnet/pynif3d
train
72
cb6f3da2f7cb83f8ab52ee54c9479923a60a8bb7
[ "dic = {*wordDict}\nn = len(s)\ndp = [0] * (n + 1)\ndp[0] = 1\nfor i in range(1, n + 1):\n for j in wordDict:\n if s[i - len(j):i] in dic and dp[i - len(j)] == 1:\n dp[i] = 1\n break\nreturn True if dp[-1] == 1 else False", "@lru_cache()\ndef dfs(l):\n if l == len(s):\n s...
<|body_start_0|> dic = {*wordDict} n = len(s) dp = [0] * (n + 1) dp[0] = 1 for i in range(1, n + 1): for j in wordDict: if s[i - len(j):i] in dic and dp[i - len(j)] == 1: dp[i] = 1 break return True if dp...
题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次""" def wordBreak1(self, s: str, wordDict: List[str]) -> bool: """思路:动态规划法 1. 判断s中每个位置前面是否有""" <|body_0|> def wordBreak2(self, s: str, wordDict: List[str]) -> bool: """思路:dfs 1. 用字符串s去wordDict中匹配,匹配到就从s剩下的字符串中匹...
stack_v2_sparse_classes_75kplus_train_001972
2,350
no_license
[ { "docstring": "思路:动态规划法 1. 判断s中每个位置前面是否有", "name": "wordBreak1", "signature": "def wordBreak1(self, s: str, wordDict: List[str]) -> bool" }, { "docstring": "思路:dfs 1. 用字符串s去wordDict中匹配,匹配到就从s剩下的字符串中匹配wordDict,直到正好匹配完s 2.", "name": "wordBreak2", "signature": "def wordBreak2(self, s: str,...
2
stack_v2_sparse_classes_30k_train_045921
Implement the Python class `Solution` described below. Class description: 题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次 Method signatures and docstrings: - def wordBreak1(self, s: str, wordDict: List[str]) -> bool: 思路:动态规划法 1. 判断s中每个位置前面是否有 - def wordBreak2(self, s: str, wordDict: List[str]) -> bool: 思路:dfs 1. 用字符串s去wordD...
Implement the Python class `Solution` described below. Class description: 题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次 Method signatures and docstrings: - def wordBreak1(self, s: str, wordDict: List[str]) -> bool: 思路:动态规划法 1. 判断s中每个位置前面是否有 - def wordBreak2(self, s: str, wordDict: List[str]) -> bool: 思路:dfs 1. 用字符串s去wordD...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: """题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次""" def wordBreak1(self, s: str, wordDict: List[str]) -> bool: """思路:动态规划法 1. 判断s中每个位置前面是否有""" <|body_0|> def wordBreak2(self, s: str, wordDict: List[str]) -> bool: """思路:dfs 1. 用字符串s去wordDict中匹配,匹配到就从s剩下的字符串中匹...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """题意:判断给定的s能否由wordDict中的word连起来,word可以使用多次""" def wordBreak1(self, s: str, wordDict: List[str]) -> bool: """思路:动态规划法 1. 判断s中每个位置前面是否有""" dic = {*wordDict} n = len(s) dp = [0] * (n + 1) dp[0] = 1 for i in range(1, n + 1): for j in word...
the_stack_v2_python_sparse
LeetCode/动态规划法(dp)/139. 单词拆分.py
yiming1012/MyLeetCode
train
2
bccfe4ae034ae6553e56cf939a16ff87565aaf84
[ "if 'Could not attack sample:' in sample:\n return AttackResult.FAILED\n_, dest = map_string.split(' --> ')\nif 'FAILED' in dest:\n return AttackResult.FAILED\nelif 'SKIPPED' in dest:\n return AttackResult.SKIPPED\nelse:\n return AttackResult.SUCCESS", "if textattack_cls == 'ErrorAttackResult':\n r...
<|body_start_0|> if 'Could not attack sample:' in sample: return AttackResult.FAILED _, dest = map_string.split(' --> ') if 'FAILED' in dest: return AttackResult.FAILED elif 'SKIPPED' in dest: return AttackResult.SKIPPED else: retur...
AttackResult
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttackResult: def from_mapping_string(cls, map_string, sample): """Computes the attack result from a string in the formats LABEL, ..., LABEL --> LABEL, ..., LABEL LABEL, ..., LABEL --> [SKIPPED/FAILED]""" <|body_0|> def from_textattack_class(cls, textattack_cls): """...
stack_v2_sparse_classes_75kplus_train_001973
1,407
no_license
[ { "docstring": "Computes the attack result from a string in the formats LABEL, ..., LABEL --> LABEL, ..., LABEL LABEL, ..., LABEL --> [SKIPPED/FAILED]", "name": "from_mapping_string", "signature": "def from_mapping_string(cls, map_string, sample)" }, { "docstring": "Computes the attack result fr...
2
stack_v2_sparse_classes_30k_train_011958
Implement the Python class `AttackResult` described below. Class description: Implement the AttackResult class. Method signatures and docstrings: - def from_mapping_string(cls, map_string, sample): Computes the attack result from a string in the formats LABEL, ..., LABEL --> LABEL, ..., LABEL LABEL, ..., LABEL --> [S...
Implement the Python class `AttackResult` described below. Class description: Implement the AttackResult class. Method signatures and docstrings: - def from_mapping_string(cls, map_string, sample): Computes the attack result from a string in the formats LABEL, ..., LABEL --> LABEL, ..., LABEL LABEL, ..., LABEL --> [S...
a0673613f489f355ddef37c89f0a635c89a500e9
<|skeleton|> class AttackResult: def from_mapping_string(cls, map_string, sample): """Computes the attack result from a string in the formats LABEL, ..., LABEL --> LABEL, ..., LABEL LABEL, ..., LABEL --> [SKIPPED/FAILED]""" <|body_0|> def from_textattack_class(cls, textattack_cls): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AttackResult: def from_mapping_string(cls, map_string, sample): """Computes the attack result from a string in the formats LABEL, ..., LABEL --> LABEL, ..., LABEL LABEL, ..., LABEL --> [SKIPPED/FAILED]""" if 'Could not attack sample:' in sample: return AttackResult.FAILED _...
the_stack_v2_python_sparse
experiments/attack_result.py
dumpmemory/SeqAttack
train
0
8af64c7a5e772afb56c87543ead9735d8fff32fd
[ "super(_D2DefaultTrainer, self).__init__()\nlogger = logging.getLogger('detectron2')\nif not logger.isEnabledFor(logging.INFO):\n setup_logger()\ncfg = DefaultTrainer.auto_scale_workers(cfg, comm.get_world_size())\nmodel = self.build_model(cfg)\noptimizer = self.build_optimizer(cfg, model)\ndata_loader = self.bu...
<|body_start_0|> super(_D2DefaultTrainer, self).__init__() logger = logging.getLogger('detectron2') if not logger.isEnabledFor(logging.INFO): setup_logger() cfg = DefaultTrainer.auto_scale_workers(cfg, comm.get_world_size()) model = self.build_model(cfg) optim...
DefaultTrainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultTrainer: def __init__(self, cfg, find_unused_parameters=False): """Args: cfg (CfgNode): The training configuration. find_unused_parameters (bool): whether or not to enable the `find_unused_parameters` option in DDP. Required for certain kinds of models.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_001974
3,769
no_license
[ { "docstring": "Args: cfg (CfgNode): The training configuration. find_unused_parameters (bool): whether or not to enable the `find_unused_parameters` option in DDP. Required for certain kinds of models.", "name": "__init__", "signature": "def __init__(self, cfg, find_unused_parameters=False)" }, { ...
3
null
Implement the Python class `DefaultTrainer` described below. Class description: Implement the DefaultTrainer class. Method signatures and docstrings: - def __init__(self, cfg, find_unused_parameters=False): Args: cfg (CfgNode): The training configuration. find_unused_parameters (bool): whether or not to enable the `f...
Implement the Python class `DefaultTrainer` described below. Class description: Implement the DefaultTrainer class. Method signatures and docstrings: - def __init__(self, cfg, find_unused_parameters=False): Args: cfg (CfgNode): The training configuration. find_unused_parameters (bool): whether or not to enable the `f...
6cf1b0232c081e1e8e02073402cd4f6910100255
<|skeleton|> class DefaultTrainer: def __init__(self, cfg, find_unused_parameters=False): """Args: cfg (CfgNode): The training configuration. find_unused_parameters (bool): whether or not to enable the `find_unused_parameters` option in DDP. Required for certain kinds of models.""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DefaultTrainer: def __init__(self, cfg, find_unused_parameters=False): """Args: cfg (CfgNode): The training configuration. find_unused_parameters (bool): whether or not to enable the `find_unused_parameters` option in DDP. Required for certain kinds of models.""" super(_D2DefaultTrainer, self)...
the_stack_v2_python_sparse
srnet/engine/defaults.py
sean-rice/srnet
train
0
de2913f45155421ccf79d40cad515bb8388592fa
[ "if not os.path.exists(self.repo_path):\n os.makedirs(self.repo_path)\n logger.info('Cloning repository %s to %s', self.clone_path, self.repo_path)\n execute(['git', 'clone', '--bare', self.clone_path, self.repo_path])\nelse:\n logger.info('Fetching into existing repository %s', self.repo_path)\n exe...
<|body_start_0|> if not os.path.exists(self.repo_path): os.makedirs(self.repo_path) logger.info('Cloning repository %s to %s', self.clone_path, self.repo_path) execute(['git', 'clone', '--bare', self.clone_path, self.repo_path]) else: logger.info('Fetching...
A git repository.
GitRepository
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GitRepository: """A git repository.""" def sync(self): """Sync the latest state of the repository.""" <|body_0|> def checkout(self, commit_id): """Check out the given commit. Args: commit_id (unicode): The ID of the commit to check out. Returns: unicode: The name...
stack_v2_sparse_classes_75kplus_train_001975
10,044
permissive
[ { "docstring": "Sync the latest state of the repository.", "name": "sync", "signature": "def sync(self)" }, { "docstring": "Check out the given commit. Args: commit_id (unicode): The ID of the commit to check out. Returns: unicode: The name of a directory with the given checkout.", "name": "...
2
stack_v2_sparse_classes_30k_train_045844
Implement the Python class `GitRepository` described below. Class description: A git repository. Method signatures and docstrings: - def sync(self): Sync the latest state of the repository. - def checkout(self, commit_id): Check out the given commit. Args: commit_id (unicode): The ID of the commit to check out. Retur...
Implement the Python class `GitRepository` described below. Class description: A git repository. Method signatures and docstrings: - def sync(self): Sync the latest state of the repository. - def checkout(self, commit_id): Check out the given commit. Args: commit_id (unicode): The ID of the commit to check out. Retur...
b59b566e127b5ef1b08f3189f1aa0194b7437d94
<|skeleton|> class GitRepository: """A git repository.""" def sync(self): """Sync the latest state of the repository.""" <|body_0|> def checkout(self, commit_id): """Check out the given commit. Args: commit_id (unicode): The ID of the commit to check out. Returns: unicode: The name...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GitRepository: """A git repository.""" def sync(self): """Sync the latest state of the repository.""" if not os.path.exists(self.repo_path): os.makedirs(self.repo_path) logger.info('Cloning repository %s to %s', self.clone_path, self.repo_path) execute(...
the_stack_v2_python_sparse
bot/reviewbot/repositories.py
reviewboard/ReviewBot
train
110
768a429bcd25155fe687dee0a7abeb666e8b01eb
[ "self.kwargs = kwargs\nself.survey_content = self.kwargs.pop('survey_content', None)\nself.survey_logic = self.kwargs.pop('survey_logic', None)\nsuper(SurveyEditForm, self).__init__(*args, **self.kwargs)", "if not self.survey_content:\n return\nself.survey_fields = {}\nschema = SurveyContentSchema(self.survey_...
<|body_start_0|> self.kwargs = kwargs self.survey_content = self.kwargs.pop('survey_content', None) self.survey_logic = self.kwargs.pop('survey_logic', None) super(SurveyEditForm, self).__init__(*args, **self.kwargs) <|end_body_0|> <|body_start_1|> if not self.survey_content: ...
SurveyContent form for editing a survey. This class is used to produce survey forms for several circumstances: - Admin creating survey from scratch - Admin updating existing survey Using dynamic properties of the survey model (if passed as an arg) the survey form is dynamically formed.
SurveyEditForm
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SurveyEditForm: """SurveyContent form for editing a survey. This class is used to produce survey forms for several circumstances: - Admin creating survey from scratch - Admin updating existing survey Using dynamic properties of the survey model (if passed as an arg) the survey form is dynamically...
stack_v2_sparse_classes_75kplus_train_001976
33,896
permissive
[ { "docstring": "Store special kwargs as attributes. params: survey_content: a SurveyContent entity. survey_logic: an instance of SurveyLogic.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Build the SurveyContent (questions) form fields. params: post_...
3
stack_v2_sparse_classes_30k_train_036975
Implement the Python class `SurveyEditForm` described below. Class description: SurveyContent form for editing a survey. This class is used to produce survey forms for several circumstances: - Admin creating survey from scratch - Admin updating existing survey Using dynamic properties of the survey model (if passed as...
Implement the Python class `SurveyEditForm` described below. Class description: SurveyContent form for editing a survey. This class is used to produce survey forms for several circumstances: - Admin creating survey from scratch - Admin updating existing survey Using dynamic properties of the survey model (if passed as...
9bd45c168f8ddb5c0e6c04eacdcaeafd61908be7
<|skeleton|> class SurveyEditForm: """SurveyContent form for editing a survey. This class is used to produce survey forms for several circumstances: - Admin creating survey from scratch - Admin updating existing survey Using dynamic properties of the survey model (if passed as an arg) the survey form is dynamically...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SurveyEditForm: """SurveyContent form for editing a survey. This class is used to produce survey forms for several circumstances: - Admin creating survey from scratch - Admin updating existing survey Using dynamic properties of the survey model (if passed as an arg) the survey form is dynamically formed.""" ...
the_stack_v2_python_sparse
app/soc/views/helper/surveys.py
pombredanne/Melange-1
train
0
c8bb57cd34536140fe1efaf8da4db26b04ebba8e
[ "super().__init__(**kwargs)\nself._pd_maxdata = tf.constant(pd_maxdata, dtype=tf.float32)\nself._ed_maxdata = tf.constant(ed_maxdata, dtype=tf.float32)", "pd = inputs[0]\ned = inputs[1]\npd_maxdata = tf.where(self._pd_maxdata == 0.0, 1.0, self._pd_maxdata)\ned_maxdata = tf.where(self._ed_maxdata == 0.0, 1.0, self...
<|body_start_0|> super().__init__(**kwargs) self._pd_maxdata = tf.constant(pd_maxdata, dtype=tf.float32) self._ed_maxdata = tf.constant(ed_maxdata, dtype=tf.float32) <|end_body_0|> <|body_start_1|> pd = inputs[0] ed = inputs[1] pd_maxdata = tf.where(self._pd_maxdata == 0...
DataDenormalizer restores the input/output profiles to their original range. Multiplication by zero is replaced by passing the input without denormalization. This class implements the tf.keras.layers.Layer interface.
DataDenormalizer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataDenormalizer: """DataDenormalizer restores the input/output profiles to their original range. Multiplication by zero is replaced by passing the input without denormalization. This class implements the tf.keras.layers.Layer interface.""" def __init__(self, pd_maxdata, ed_maxdata, **kwargs...
stack_v2_sparse_classes_75kplus_train_001977
3,988
permissive
[ { "docstring": "Construct a DataDenormalizer instance. Paramters --------- pd_maxdata : list List of normalization constants for the particle distribution channels. Length should be 8. ed_maxdata : list List of normalization constants for the energy deposit channels. Length should be 9. **kwargs Additional keyw...
2
null
Implement the Python class `DataDenormalizer` described below. Class description: DataDenormalizer restores the input/output profiles to their original range. Multiplication by zero is replaced by passing the input without denormalization. This class implements the tf.keras.layers.Layer interface. Method signatures a...
Implement the Python class `DataDenormalizer` described below. Class description: DataDenormalizer restores the input/output profiles to their original range. Multiplication by zero is replaced by passing the input without denormalization. This class implements the tf.keras.layers.Layer interface. Method signatures a...
7f0086d2cdec23b49958c5afc0e6d12a08598465
<|skeleton|> class DataDenormalizer: """DataDenormalizer restores the input/output profiles to their original range. Multiplication by zero is replaced by passing the input without denormalization. This class implements the tf.keras.layers.Layer interface.""" def __init__(self, pd_maxdata, ed_maxdata, **kwargs...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataDenormalizer: """DataDenormalizer restores the input/output profiles to their original range. Multiplication by zero is replaced by passing the input without denormalization. This class implements the tf.keras.layers.Layer interface.""" def __init__(self, pd_maxdata, ed_maxdata, **kwargs): ""...
the_stack_v2_python_sparse
src/models/gan/utils/datanormalizer.py
image357/conex-generator
train
0
606538c813ed3dfe3ca6e3f8429d798e41cfe229
[ "data: StrDict = dict(type='SetFreeCamera')\ndata['pos'] = pos\ndata['dir'] = direction\nself._send(data).ack('FreeCameraSet')", "data: StrDict = dict(type='SetRelativeCam')\ndata['pos'] = pos\nif rot_quat:\n data['rot'] = rot_quat\nself._send(data).ack('RelativeCamSet')", "data: StrDict = dict(type='SetPlay...
<|body_start_0|> data: StrDict = dict(type='SetFreeCamera') data['pos'] = pos data['dir'] = direction self._send(data).ack('FreeCameraSet') <|end_body_0|> <|body_start_1|> data: StrDict = dict(type='SetRelativeCam') data['pos'] = pos if rot_quat: data...
An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator.
CameraApi
[ "MIT", "LicenseRef-scancode-proprietary-license", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CameraApi: """An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator.""" def set_free(self, pos: Float3, direction: Float3) -> None: """Sets the position and direction of ...
stack_v2_sparse_classes_75kplus_train_001978
5,399
permissive
[ { "docstring": "Sets the position and direction of the free camera. The free camera is one that does not follow any particular vehicle, but can instead be put at any spot and any position on the map. Args: pos: The position of the camera as a (x, y, z) triplet. direction: The directional vector of the camera as...
6
stack_v2_sparse_classes_30k_val_001277
Implement the Python class `CameraApi` described below. Class description: An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator. Method signatures and docstrings: - def set_free(self, pos: Float3, direct...
Implement the Python class `CameraApi` described below. Class description: An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator. Method signatures and docstrings: - def set_free(self, pos: Float3, direct...
656b09c8b08e0a46a84561f52a6cc54b88710948
<|skeleton|> class CameraApi: """An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator.""" def set_free(self, pos: Float3, direction: Float3) -> None: """Sets the position and direction of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CameraApi: """An API class which allows control of the in-game camera and also provides information about the semantic annotation classes. Args: beamng: An instance of the simulator.""" def set_free(self, pos: Float3, direction: Float3) -> None: """Sets the position and direction of the free came...
the_stack_v2_python_sparse
src/beamngpy/api/beamng/camera.py
BeamNG/BeamNGpy
train
235
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace
[ "super(InTimeToArrivalToVehicle, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._other_actor = other_actor\nself._actor = actor\nself._time = time", "new_status = py_trees.common.Status.RUNNING\ncurrent_location = CarlaDataProvider.get_location(self._actor)\ntarget_locati...
<|body_start_0|> super(InTimeToArrivalToVehicle, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._other_actor = other_actor self._actor = actor self._time = time <|end_body_0|> <|body_start_1|> new_status = py_trees.common.Status.RU...
This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - other_actor: Reference actor used in this behavior The conditi...
InTimeToArrivalToVehicle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTimeToArrivalToVehicle: """This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - other_acto...
stack_v2_sparse_classes_75kplus_train_001979
18,494
permissive
[ { "docstring": "Setup parameters", "name": "__init__", "signature": "def __init__(self, other_actor, actor, time, name='TimeToArrival')" }, { "docstring": "Check if the ego vehicle can arrive at other actor within time", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_003742
Implement the Python class `InTimeToArrivalToVehicle` described below. Class description: This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is l...
Implement the Python class `InTimeToArrivalToVehicle` described below. Class description: This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is l...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class InTimeToArrivalToVehicle: """This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - other_acto...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InTimeToArrivalToVehicle: """This class contains a check if a actor arrives within a given time at another actor. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - other_actor: Reference ...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py
TinaMenke/Deep-Reinforcement-Learning
train
9
b56a033581dd529f285a21ea85b11b295499f7c2
[ "context = {'page_title': 'Forgot Password', 'email_form': EmailForm(auto_id=True)}\ncontext.update(csrf(request))\nreturn render(request, 'authentication/forgot_password.html', context)", "email_form = EmailForm(request.POST, auto_id=True)\nif email_form.is_valid():\n try:\n input_email = email_form.cl...
<|body_start_0|> context = {'page_title': 'Forgot Password', 'email_form': EmailForm(auto_id=True)} context.update(csrf(request)) return render(request, 'authentication/forgot_password.html', context) <|end_body_0|> <|body_start_1|> email_form = EmailForm(request.POST, auto_id=True) ...
This class allows user to send account recovery email.
ForgotPasswordView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForgotPasswordView: """This class allows user to send account recovery email.""" def get(self, request, *args, **kwargs): """Handles GET requests to the 'account_forgot_password' named route. Returns: A forgot-password template rendered to a HttpResponse.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus_train_001980
17,941
permissive
[ { "docstring": "Handles GET requests to the 'account_forgot_password' named route. Returns: A forgot-password template rendered to a HttpResponse.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Handles the POST request to the 'account_forgot_password' ...
2
stack_v2_sparse_classes_30k_train_009426
Implement the Python class `ForgotPasswordView` described below. Class description: This class allows user to send account recovery email. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Handles GET requests to the 'account_forgot_password' named route. Returns: A forgot-password template...
Implement the Python class `ForgotPasswordView` described below. Class description: This class allows user to send account recovery email. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Handles GET requests to the 'account_forgot_password' named route. Returns: A forgot-password template...
3704cbe6e69ba3e4c53401d3bbc339208e9ebccd
<|skeleton|> class ForgotPasswordView: """This class allows user to send account recovery email.""" def get(self, request, *args, **kwargs): """Handles GET requests to the 'account_forgot_password' named route. Returns: A forgot-password template rendered to a HttpResponse.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ForgotPasswordView: """This class allows user to send account recovery email.""" def get(self, request, *args, **kwargs): """Handles GET requests to the 'account_forgot_password' named route. Returns: A forgot-password template rendered to a HttpResponse.""" context = {'page_title': 'Forg...
the_stack_v2_python_sparse
troupon/authentication/views.py
morristech/troupon
train
0
e5c7f081789f989ae365be70693996f5519fb91d
[ "settlement = None\nif mbfMessage:\n mbfSettlement = None\n o = mbfMessage.mbf_find_object('TYPE', 'MBFE_BEGINNING')\n if o:\n if o.mbf_get_value() == 'INSERT_SETTLEMENT':\n mbfSettlement = mbfMessage.mbf_find_object('+SETTLEMENT', 'MBFE_BEGINNING')\n elif o.mbf_get_value() == 'UPD...
<|body_start_0|> settlement = None if mbfMessage: mbfSettlement = None o = mbfMessage.mbf_find_object('TYPE', 'MBFE_BEGINNING') if o: if o.mbf_get_value() == 'INSERT_SETTLEMENT': mbfSettlement = mbfMessage.mbf_find_object('+SETTLEME...
Class for describing how the XML for settlement swift should be created.
SettlementSwiftXMLSpecifier
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SettlementSwiftXMLSpecifier: """Class for describing how the XML for settlement swift should be created.""" def __GetAelSettlementFromMbf(self, mbfMessage): """Helpfunction for getting the ael settlement out of the mbf-message.""" <|body_0|> def __init__(self, mbfMessage...
stack_v2_sparse_classes_75kplus_train_001981
3,976
no_license
[ { "docstring": "Helpfunction for getting the ael settlement out of the mbf-message.", "name": "__GetAelSettlementFromMbf", "signature": "def __GetAelSettlementFromMbf(self, mbfMessage)" }, { "docstring": "Confstructor for this class. Takes a mbf-message (the amba message).", "name": "__init_...
4
stack_v2_sparse_classes_30k_train_004686
Implement the Python class `SettlementSwiftXMLSpecifier` described below. Class description: Class for describing how the XML for settlement swift should be created. Method signatures and docstrings: - def __GetAelSettlementFromMbf(self, mbfMessage): Helpfunction for getting the ael settlement out of the mbf-message....
Implement the Python class `SettlementSwiftXMLSpecifier` described below. Class description: Class for describing how the XML for settlement swift should be created. Method signatures and docstrings: - def __GetAelSettlementFromMbf(self, mbfMessage): Helpfunction for getting the ael settlement out of the mbf-message....
5e7cc7de3495145501ca53deb9efee2233ab7e1c
<|skeleton|> class SettlementSwiftXMLSpecifier: """Class for describing how the XML for settlement swift should be created.""" def __GetAelSettlementFromMbf(self, mbfMessage): """Helpfunction for getting the ael settlement out of the mbf-message.""" <|body_0|> def __init__(self, mbfMessage...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SettlementSwiftXMLSpecifier: """Class for describing how the XML for settlement swift should be created.""" def __GetAelSettlementFromMbf(self, mbfMessage): """Helpfunction for getting the ael settlement out of the mbf-message.""" settlement = None if mbfMessage: mbfSe...
the_stack_v2_python_sparse
Extensions/Default/FPythonCode/FSettlementSwiftXMLSpecifier.py
webclinic017/fa-absa-py3
train
0
b8066e3fb1e3ec7236a3cb3027cd872401134acc
[ "self.gateway_url = 'https://api.telerivet.com/v1/projects/%s/messages/send' % config.get('project_id')\nself.api_key = config.get('api_key')\nself.route_id = config.get('route_id')\nself.priority = config.get('priority')", "gateway_params = {'to_number': recipient, 'content': text}\ngateway_params.update(dict([(...
<|body_start_0|> self.gateway_url = 'https://api.telerivet.com/v1/projects/%s/messages/send' % config.get('project_id') self.api_key = config.get('api_key') self.route_id = config.get('route_id') self.priority = config.get('priority') <|end_body_0|> <|body_start_1|> gateway_para...
Telerivet Gateway class
TelerivetGateway
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TelerivetGateway: """Telerivet Gateway class""" def __init__(self, config): """initializes the kannel gateway object :param config: The configuration object obtained from the app settings""" <|body_0|> def send(self, text, recipient, sender=''): """Sends the mess...
stack_v2_sparse_classes_75kplus_train_001982
3,492
no_license
[ { "docstring": "initializes the kannel gateway object :param config: The configuration object obtained from the app settings", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Sends the message to the specified recipients using this gateway :param text: Contents o...
2
stack_v2_sparse_classes_30k_train_029471
Implement the Python class `TelerivetGateway` described below. Class description: Telerivet Gateway class Method signatures and docstrings: - def __init__(self, config): initializes the kannel gateway object :param config: The configuration object obtained from the app settings - def send(self, text, recipient, sende...
Implement the Python class `TelerivetGateway` described below. Class description: Telerivet Gateway class Method signatures and docstrings: - def __init__(self, config): initializes the kannel gateway object :param config: The configuration object obtained from the app settings - def send(self, text, recipient, sende...
e071b05b6122a756313c561643d343fa4d23b097
<|skeleton|> class TelerivetGateway: """Telerivet Gateway class""" def __init__(self, config): """initializes the kannel gateway object :param config: The configuration object obtained from the app settings""" <|body_0|> def send(self, text, recipient, sender=''): """Sends the mess...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TelerivetGateway: """Telerivet Gateway class""" def __init__(self, config): """initializes the kannel gateway object :param config: The configuration object obtained from the app settings""" self.gateway_url = 'https://api.telerivet.com/v1/projects/%s/messages/send' % config.get('project_...
the_stack_v2_python_sparse
apollo/messaging/outgoing.py
Ismail774403783/apollo
train
0
4d79518c6c3ac7168d7359e3997eb58d11992aa6
[ "data = copy.deepcopy(ipif_data)\ndata['id'] = data.pop('@id') if '@id' in data else cls.make_id(data)\ndata['person'] = Person.get(id=data['person']['@id']) or Person.create_from_ipif(data['person'])\ndata['source'] = Source.get(id=data['source']['@id']) or Source.create_from_ipif(data['source'])\ndata['statements...
<|body_start_0|> data = copy.deepcopy(ipif_data) data['id'] = data.pop('@id') if '@id' in data else cls.make_id(data) data['person'] = Person.get(id=data['person']['@id']) or Person.create_from_ipif(data['person']) data['source'] = Source.get(id=data['source']['@id']) or Source.create_fr...
A Factoid ORM entitiy.
Factoid
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Factoid: """A Factoid ORM entitiy.""" def create_from_ipif(cls, ipif_data): """Create a factoid from a IPIF conform dictionary.""" <|body_0|> def update_from_ipif(self, ipifdata): """Update Factoid from IPIF conform json-like dict.""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus_train_001983
23,399
permissive
[ { "docstring": "Create a factoid from a IPIF conform dictionary.", "name": "create_from_ipif", "signature": "def create_from_ipif(cls, ipif_data)" }, { "docstring": "Update Factoid from IPIF conform json-like dict.", "name": "update_from_ipif", "signature": "def update_from_ipif(self, ip...
5
stack_v2_sparse_classes_30k_train_019309
Implement the Python class `Factoid` described below. Class description: A Factoid ORM entitiy. Method signatures and docstrings: - def create_from_ipif(cls, ipif_data): Create a factoid from a IPIF conform dictionary. - def update_from_ipif(self, ipifdata): Update Factoid from IPIF conform json-like dict. - def to_i...
Implement the Python class `Factoid` described below. Class description: A Factoid ORM entitiy. Method signatures and docstrings: - def create_from_ipif(cls, ipif_data): Create a factoid from a IPIF conform dictionary. - def update_from_ipif(self, ipifdata): Update Factoid from IPIF conform json-like dict. - def to_i...
7683da0a56daf77450f962caaf58b7cfe3acf408
<|skeleton|> class Factoid: """A Factoid ORM entitiy.""" def create_from_ipif(cls, ipif_data): """Create a factoid from a IPIF conform dictionary.""" <|body_0|> def update_from_ipif(self, ipifdata): """Update Factoid from IPIF conform json-like dict.""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Factoid: """A Factoid ORM entitiy.""" def create_from_ipif(cls, ipif_data): """Create a factoid from a IPIF conform dictionary.""" data = copy.deepcopy(ipif_data) data['id'] = data.pop('@id') if '@id' in data else cls.make_id(data) data['person'] = Person.get(id=data['pers...
the_stack_v2_python_sparse
src/papilotte/connectors/pony/database.py
gvasold/papilotte
train
4
78f609509a50fe84e10921f90175b36d77b47991
[ "if 'stock.xueqiu.com/v5/stock/batch/quote.json?_t=' in flow.request.pretty_url and '_s=' in flow.request.pretty_url:\n ctx.log.info('抓到了request')\n with open('./quote.json', encoding='UTF-8') as f:\n flow.response = http.HTTPResponse.make(200, f.read())", "if 'stock.xueqiu.com/v5/stock/batch/quote.j...
<|body_start_0|> if 'stock.xueqiu.com/v5/stock/batch/quote.json?_t=' in flow.request.pretty_url and '_s=' in flow.request.pretty_url: ctx.log.info('抓到了request') with open('./quote.json', encoding='UTF-8') as f: flow.response = http.HTTPResponse.make(200, f.read()) <|end_b...
HW
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HW: def request(self, flow: mitmproxy.http.HTTPFlow): """The full HTTP request has been read.""" <|body_0|> def response(self, flow: mitmproxy.http.HTTPFlow): """The full HTTP response has been read.""" <|body_1|> <|end_skeleton|> <|body_start_0|> i...
stack_v2_sparse_classes_75kplus_train_001984
1,296
no_license
[ { "docstring": "The full HTTP request has been read.", "name": "request", "signature": "def request(self, flow: mitmproxy.http.HTTPFlow)" }, { "docstring": "The full HTTP response has been read.", "name": "response", "signature": "def response(self, flow: mitmproxy.http.HTTPFlow)" } ]
2
stack_v2_sparse_classes_30k_train_026959
Implement the Python class `HW` described below. Class description: Implement the HW class. Method signatures and docstrings: - def request(self, flow: mitmproxy.http.HTTPFlow): The full HTTP request has been read. - def response(self, flow: mitmproxy.http.HTTPFlow): The full HTTP response has been read.
Implement the Python class `HW` described below. Class description: Implement the HW class. Method signatures and docstrings: - def request(self, flow: mitmproxy.http.HTTPFlow): The full HTTP request has been read. - def response(self, flow: mitmproxy.http.HTTPFlow): The full HTTP response has been read. <|skeleton|...
0e166efde786a3aebf39b5183b2abcd9328b975f
<|skeleton|> class HW: def request(self, flow: mitmproxy.http.HTTPFlow): """The full HTTP request has been read.""" <|body_0|> def response(self, flow: mitmproxy.http.HTTPFlow): """The full HTTP response has been read.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HW: def request(self, flow: mitmproxy.http.HTTPFlow): """The full HTTP request has been read.""" if 'stock.xueqiu.com/v5/stock/batch/quote.json?_t=' in flow.request.pretty_url and '_s=' in flow.request.pretty_url: ctx.log.info('抓到了request') with open('./quote.json', enc...
the_stack_v2_python_sparse
HomeWork/Mock_Hw_19/Mock_Hw_19_7_11/Mock_HomeWork.py
ALekevin/train_pytest
train
0
c762bfff5189176d65c3fbff3ce653647fc98a63
[ "self._data_context = data_context\nself._sequence_length = sequence_length\nself._num_outer_dims = num_outer_dims", "if isinstance(value, trajectory.Trajectory):\n pass\nelif isinstance(value, trajectory.Transition):\n value = trajectory.Trajectory(step_type=value.time_step.step_type, observation=value.tim...
<|body_start_0|> self._data_context = data_context self._sequence_length = sequence_length self._num_outer_dims = num_outer_dims <|end_body_0|> <|body_start_1|> if isinstance(value, trajectory.Trajectory): pass elif isinstance(value, trajectory.Transition): ...
Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observations are ignored and dropped during conversion. This non-strict checking allows...
AsTrajectory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsTrajectory: """Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observations are ignored and dropped during con...
stack_v2_sparse_classes_75kplus_train_001985
24,336
permissive
[ { "docstring": "Create the AsTrajectory converter. Args: data_context: An instance of `DataContext`, typically accessed from the `TFAgent.data_context` property. sequence_length: The required time dimension value (if any), typically determined by the subclass of `TFAgent`. num_outer_dims: Expected number of out...
2
stack_v2_sparse_classes_30k_train_019587
Implement the Python class `AsTrajectory` described below. Class description: Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observat...
Implement the Python class `AsTrajectory` described below. Class description: Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observat...
eca1093d3a047e538f17f6ab92ab4d8144284f23
<|skeleton|> class AsTrajectory: """Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observations are ignored and dropped during con...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AsTrajectory: """Class that validates and converts other data types to Trajectory. Note that validation and conversion allows values to contain dictionaries with extra keys as compared to the the specs in the data context. These additional entries / observations are ignored and dropped during conversion. This...
the_stack_v2_python_sparse
tf_agents/agents/data_converter.py
tensorflow/agents
train
2,755
dba4b6386680fd1a6827e97d1680475c6be4da78
[ "self.aurora_params = aurora_params\nself.custom_tag_vec = custom_tag_vec\nself.instance_type = instance_type\nself.key_pair_name = key_pair_name\nself.network_security_groups = network_security_groups\nself.proxy_vm_subnet = proxy_vm_subnet\nself.proxy_vm_vpc = proxy_vm_vpc\nself.rds_params = rds_params\nself.regi...
<|body_start_0|> self.aurora_params = aurora_params self.custom_tag_vec = custom_tag_vec self.instance_type = instance_type self.key_pair_name = key_pair_name self.network_security_groups = network_security_groups self.proxy_vm_subnet = proxy_vm_subnet self.proxy_...
Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This field will be populated for Aurora restores. Proto containing the parameters required for r...
DeployVMsToAWSParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeployVMsToAWSParams: """Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This field will be populated for Aurora restores...
stack_v2_sparse_classes_75kplus_train_001986
6,685
permissive
[ { "docstring": "Constructor for the DeployVMsToAWSParams class", "name": "__init__", "signature": "def __init__(self, aurora_params=None, custom_tag_vec=None, instance_type=None, key_pair_name=None, network_security_groups=None, proxy_vm_subnet=None, proxy_vm_vpc=None, rds_params=None, region=None, subn...
2
stack_v2_sparse_classes_30k_train_011179
Implement the Python class `DeployVMsToAWSParams` described below. Class description: Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This fiel...
Implement the Python class `DeployVMsToAWSParams` described below. Class description: Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This fiel...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DeployVMsToAWSParams: """Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This field will be populated for Aurora restores...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeployVMsToAWSParams: """Implementation of the 'DeployVMsToAWSParams' model. Contains AWS specific information needed to identify various resources when converting and deploying a VM to AWS. Attributes: aurora_params (DeployDBInstancesToRDSParams): This field will be populated for Aurora restores. Proto conta...
the_stack_v2_python_sparse
cohesity_management_sdk/models/deploy_vms_to_aws_params.py
cohesity/management-sdk-python
train
24
6ad64fc2d17225d944cf6a9469a42d19b12161b0
[ "dummy = ListNode(-1)\ndummy.next = head\nnext = dummy\nwhile next != None and next.next != None:\n if next.next.val == val:\n next.next = next.next.next\n else:\n next = next.next\nreturn dummy.next", "out = prev = ListNode(-1)\nprev.next = head\ncurr = head\nwhile curr:\n if curr.val == v...
<|body_start_0|> dummy = ListNode(-1) dummy.next = head next = dummy while next != None and next.next != None: if next.next.val == val: next.next = next.next.next else: next = next.next return dummy.next <|end_body_0|> <|bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_0|> def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_75kplus_train_001987
865
no_license
[ { "docstring": ":type head: ListNode :type val: int :rtype: ListNode", "name": "removeElements", "signature": "def removeElements(self, head, val)" }, { "docstring": ":type head: ListNode :type val: int :rtype: ListNode", "name": "removeElements", "signature": "def removeElements(self, h...
2
stack_v2_sparse_classes_30k_val_001243
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements(self, head, val): :type head: ListNode :type val: int :rtype: ListNode - def removeElements(self, head, val): :type head: ListNode :type val: int :rtype: ListN...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements(self, head, val): :type head: ListNode :type val: int :rtype: ListNode - def removeElements(self, head, val): :type head: ListNode :type val: int :rtype: ListN...
16e8a7935811fa71ce71998da8549e29ba68f847
<|skeleton|> class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_0|> def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" dummy = ListNode(-1) dummy.next = head next = dummy while next != None and next.next != None: if next.next.val == val: next.next = next....
the_stack_v2_python_sparse
leetcode3/removeElements.py
lizyang95/leetcode
train
0
093e6a8d18b3a5579cb3c1a529c907b033812bf9
[ "self.threshold = threshold\nself.past = DateTime.getNowUTC()\nself.past.setHHMMSS(0, 0, 0)\nself.past.offsetDay(-past)\nself.now = DateTime.getNowUTC()\nself.now.setHHMMSS(0, 0, 0)\nself.now.offsetDay(-1)", "fullyInFuture = False\nnow = self.now.duplicate()\nnow.offsetDay(1)\nif not ical.isRecurring():\n try:...
<|body_start_0|> self.threshold = threshold self.past = DateTime.getNowUTC() self.past.setHHMMSS(0, 0, 0) self.past.offsetDay(-past) self.now = DateTime.getNowUTC() self.now.setHHMMSS(0, 0, 0) self.now.offsetDay(-1) <|end_body_0|> <|body_start_1|> fullyIn...
Class that manages the "splitting" of large iCalendar objects into two pieces so that we can keep the overall size of individual calendar objects to a reasonable limit. This should only be used on Organizer events.
iCalSplitter
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iCalSplitter: """Class that manages the "splitting" of large iCalendar objects into two pieces so that we can keep the overall size of individual calendar objects to a reasonable limit. This should only be used on Organizer events.""" def __init__(self, threshold=-1, past=1): """@par...
stack_v2_sparse_classes_75kplus_train_001988
7,362
permissive
[ { "docstring": "@param threshold: the size in bytes that will trigger a split @type threshold: C{int} @param past: number of days in the past where the split will occur @type past: C{int}", "name": "__init__", "signature": "def __init__(self, threshold=-1, past=1)" }, { "docstring": "Determine i...
4
stack_v2_sparse_classes_30k_train_054490
Implement the Python class `iCalSplitter` described below. Class description: Class that manages the "splitting" of large iCalendar objects into two pieces so that we can keep the overall size of individual calendar objects to a reasonable limit. This should only be used on Organizer events. Method signatures and doc...
Implement the Python class `iCalSplitter` described below. Class description: Class that manages the "splitting" of large iCalendar objects into two pieces so that we can keep the overall size of individual calendar objects to a reasonable limit. This should only be used on Organizer events. Method signatures and doc...
cb2962f1f1927f1e52ea405094fa3e7e180f23cb
<|skeleton|> class iCalSplitter: """Class that manages the "splitting" of large iCalendar objects into two pieces so that we can keep the overall size of individual calendar objects to a reasonable limit. This should only be used on Organizer events.""" def __init__(self, threshold=-1, past=1): """@par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class iCalSplitter: """Class that manages the "splitting" of large iCalendar objects into two pieces so that we can keep the overall size of individual calendar objects to a reasonable limit. This should only be used on Organizer events.""" def __init__(self, threshold=-1, past=1): """@param threshold:...
the_stack_v2_python_sparse
txdav/caldav/datastore/scheduling/icalsplitter.py
ass-a2s/ccs-calendarserver
train
2
6e067121fd6ab843090e64335eca4a7984db275c
[ "super().__init__(*args, category=CATEGORY_OUTLET)\nstate = self.hass.states.get(self.entity_id)\nserv_outlet = self.add_preload_service(SERV_OUTLET)\nself.char_on = serv_outlet.configure_char(CHAR_ON, value=False, setter_callback=self.set_state)\nself.char_outlet_in_use = serv_outlet.configure_char(CHAR_OUTLET_IN_...
<|body_start_0|> super().__init__(*args, category=CATEGORY_OUTLET) state = self.hass.states.get(self.entity_id) serv_outlet = self.add_preload_service(SERV_OUTLET) self.char_on = serv_outlet.configure_char(CHAR_ON, value=False, setter_callback=self.set_state) self.char_outlet_in_...
Generate an Outlet accessory.
Outlet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Outlet: """Generate an Outlet accessory.""" def __init__(self, *args): """Initialize an Outlet accessory object.""" <|body_0|> def set_state(self, value): """Move switch state to value if call came from HomeKit.""" <|body_1|> def async_update_state(s...
stack_v2_sparse_classes_75kplus_train_001989
10,454
permissive
[ { "docstring": "Initialize an Outlet accessory object.", "name": "__init__", "signature": "def __init__(self, *args)" }, { "docstring": "Move switch state to value if call came from HomeKit.", "name": "set_state", "signature": "def set_state(self, value)" }, { "docstring": "Updat...
3
stack_v2_sparse_classes_30k_train_034631
Implement the Python class `Outlet` described below. Class description: Generate an Outlet accessory. Method signatures and docstrings: - def __init__(self, *args): Initialize an Outlet accessory object. - def set_state(self, value): Move switch state to value if call came from HomeKit. - def async_update_state(self,...
Implement the Python class `Outlet` described below. Class description: Generate an Outlet accessory. Method signatures and docstrings: - def __init__(self, *args): Initialize an Outlet accessory object. - def set_state(self, value): Move switch state to value if call came from HomeKit. - def async_update_state(self,...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class Outlet: """Generate an Outlet accessory.""" def __init__(self, *args): """Initialize an Outlet accessory object.""" <|body_0|> def set_state(self, value): """Move switch state to value if call came from HomeKit.""" <|body_1|> def async_update_state(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Outlet: """Generate an Outlet accessory.""" def __init__(self, *args): """Initialize an Outlet accessory object.""" super().__init__(*args, category=CATEGORY_OUTLET) state = self.hass.states.get(self.entity_id) serv_outlet = self.add_preload_service(SERV_OUTLET) se...
the_stack_v2_python_sparse
homeassistant/components/homekit/type_switches.py
home-assistant/core
train
35,501
01429cf2f85a8c1b0b70cc09bc86cecabd6fb5c8
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties.
RPCApiServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RPCApiServicer: """RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties.""" def Logs(self, request, context): """Get a list of all logs published/subscribed by this node""" <|body_0|> def Decide(self, request, context): ...
stack_v2_sparse_classes_75kplus_train_001990
12,917
no_license
[ { "docstring": "Get a list of all logs published/subscribed by this node", "name": "Logs", "signature": "def Logs(self, request, context)" }, { "docstring": "Decide on an output for key based on the configured decision method", "name": "Decide", "signature": "def Decide(self, request, co...
3
stack_v2_sparse_classes_30k_train_052399
Implement the Python class `RPCApiServicer` described below. Class description: RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties. Method signatures and docstrings: - def Logs(self, request, context): Get a list of all logs published/subscribed by this node - def Decid...
Implement the Python class `RPCApiServicer` described below. Class description: RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties. Method signatures and docstrings: - def Logs(self, request, context): Get a list of all logs published/subscribed by this node - def Decid...
9bf6f32ab9b28c49fdc12c6e7a847a2b6dc1aa00
<|skeleton|> class RPCApiServicer: """RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties.""" def Logs(self, request, context): """Get a list of all logs published/subscribed by this node""" <|body_0|> def Decide(self, request, context): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RPCApiServicer: """RPCApi are "private" rpc methods for an instance. This should only be available to trusted parties.""" def Logs(self, request, context): """Get a list of all logs published/subscribed by this node""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_de...
the_stack_v2_python_sparse
packages/trustix-python/trustix_python/rpc/rpc_pb2_grpc.py
daotlresearch/trustix
train
0
9f90abb3bdcaf58118bf3455587e27a8fccc0069
[ "super(EncoderImageFull, self).__init__()\nself.embed_size = embed_size\nself.no_imgnorm = no_imgnorm\nself.use_abs = use_abs\nmodel = get_model(name=cnn_type, num_classes=5607)\nmodel = torch.nn.DataParallel(model)\nmodel.to('cuda')\ncheckpoint = torch.load('/mnt/data2/betty/webvision_train/results/resnet50/5000cl...
<|body_start_0|> super(EncoderImageFull, self).__init__() self.embed_size = embed_size self.no_imgnorm = no_imgnorm self.use_abs = use_abs model = get_model(name=cnn_type, num_classes=5607) model = torch.nn.DataParallel(model) model.to('cuda') checkpoint =...
EncoderImageFull
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderImageFull: def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False): """Load pretrained VGG19 and replace top fc layer.""" <|body_0|> def load_state_dict(self, load_path): """Handle the models saved before commit...
stack_v2_sparse_classes_75kplus_train_001991
22,197
no_license
[ { "docstring": "Load pretrained VGG19 and replace top fc layer.", "name": "__init__", "signature": "def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False)" }, { "docstring": "Handle the models saved before commit pytorch/vision@989d52a", "nam...
4
stack_v2_sparse_classes_30k_train_008307
Implement the Python class `EncoderImageFull` described below. Class description: Implement the EncoderImageFull class. Method signatures and docstrings: - def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False): Load pretrained VGG19 and replace top fc layer. - def lo...
Implement the Python class `EncoderImageFull` described below. Class description: Implement the EncoderImageFull class. Method signatures and docstrings: - def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False): Load pretrained VGG19 and replace top fc layer. - def lo...
4779d33a921be0c0adaf5971ec853317eb072af1
<|skeleton|> class EncoderImageFull: def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False): """Load pretrained VGG19 and replace top fc layer.""" <|body_0|> def load_state_dict(self, load_path): """Handle the models saved before commit...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EncoderImageFull: def __init__(self, embed_size=256, finetune=False, cnn_type='resnet50', use_abs=False, no_imgnorm=False): """Load pretrained VGG19 and replace top fc layer.""" super(EncoderImageFull, self).__init__() self.embed_size = embed_size self.no_imgnorm = no_imgnorm ...
the_stack_v2_python_sparse
cnn/encoder.py
bledem/webvision
train
0
72aaa2cbf69d59a6829ef1e7c90c8ce4559e81f2
[ "self.log = gLogger.getSubLogger('Test Successfull')\nself.log.info('CALL')\nself.log.info(typeName)\nreturn S_OK('Return value')", "self.log = gLogger.getSubLogger('')\nself.log.info('Result ' + result + ' for ' + str(result_id) + ' has been received')\nresult = gSAMDB.setResult(result, result_id, description)\n...
<|body_start_0|> self.log = gLogger.getSubLogger('Test Successfull') self.log.info('CALL') self.log.info(typeName) return S_OK('Return value') <|end_body_0|> <|body_start_1|> self.log = gLogger.getSubLogger('') self.log.info('Result ' + result + ' for ' + str(result_id) ...
SAMHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SAMHandler: def export_doTest(self, typeName): """Add a record for a type""" <|body_0|> def export_setResult(self, result, result_id, description=''): """Set result for a particular result_id""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.log ...
stack_v2_sparse_classes_75kplus_train_001992
1,132
no_license
[ { "docstring": "Add a record for a type", "name": "export_doTest", "signature": "def export_doTest(self, typeName)" }, { "docstring": "Set result for a particular result_id", "name": "export_setResult", "signature": "def export_setResult(self, result, result_id, description='')" } ]
2
stack_v2_sparse_classes_30k_train_026666
Implement the Python class `SAMHandler` described below. Class description: Implement the SAMHandler class. Method signatures and docstrings: - def export_doTest(self, typeName): Add a record for a type - def export_setResult(self, result, result_id, description=''): Set result for a particular result_id
Implement the Python class `SAMHandler` described below. Class description: Implement the SAMHandler class. Method signatures and docstrings: - def export_doTest(self, typeName): Add a record for a type - def export_setResult(self, result, result_id, description=''): Set result for a particular result_id <|skeleton|...
fdfd852c92a56192b8ee9970b66f0136e6e0afff
<|skeleton|> class SAMHandler: def export_doTest(self, typeName): """Add a record for a type""" <|body_0|> def export_setResult(self, result, result_id, description=''): """Set result for a particular result_id""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SAMHandler: def export_doTest(self, typeName): """Add a record for a type""" self.log = gLogger.getSubLogger('Test Successfull') self.log.info('CALL') self.log.info(typeName) return S_OK('Return value') def export_setResult(self, result, result_id, description=''):...
the_stack_v2_python_sparse
src/DIRAC/FrameworkSystem/Service/SAMHandler.py
bopopescu/bes3-jinr
train
0
ed6dc05fd44a399dc0ff73af930657fc5ba3783d
[ "self.in_channels = in_channels\nself.out_channels = 2\nself.height = height\nself.width = width\nself.frequencies = frequencies\nself.bundle_size = bundle_size\nself.base_dir = Path(data_dir)\nself.train_dir = self.base_dir / 'training'\nself.val_dir = self.base_dir / 'validation'\nself.x_n_pfx = x_n_pfx\nself.y_n...
<|body_start_0|> self.in_channels = in_channels self.out_channels = 2 self.height = height self.width = width self.frequencies = frequencies self.bundle_size = bundle_size self.base_dir = Path(data_dir) self.train_dir = self.base_dir / 'training' s...
Adapter for Pancreas Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command
MedSegAdapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedSegAdapter: """Adapter for Pancreas Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command""" def __init__(self, data_dir, height, width, frequencies, bundle_size, x...
stack_v2_sparse_classes_75kplus_train_001993
4,864
no_license
[ { "docstring": "Constructor for the PSD Adapter object Takes root psd directory on this machine and optionally a limit on how many bundles to use", "name": "__init__", "signature": "def __init__(self, data_dir, height, width, frequencies, bundle_size, x_n_pfx, y_n_pfx, l_n_pfx, x_t_pfx, y_t_pfx, l_t_pfx...
4
null
Implement the Python class `MedSegAdapter` described below. Class description: Adapter for Pancreas Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command Method signatures and docstrings: - def...
Implement the Python class `MedSegAdapter` described below. Class description: Adapter for Pancreas Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command Method signatures and docstrings: - def...
4a74a86740196f927ee3f6519983393a083c3083
<|skeleton|> class MedSegAdapter: """Adapter for Pancreas Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command""" def __init__(self, data_dir, height, width, frequencies, bundle_size, x...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MedSegAdapter: """Adapter for Pancreas Segmentation Data-set (ignoring tumors for now) Keeps track of number of bundles stored on disk, and frequencies of the classes. Returns a bundle of the requested type on command""" def __init__(self, data_dir, height, width, frequencies, bundle_size, x_n_pfx, y_n_p...
the_stack_v2_python_sparse
learning/adapters/medsegadapter.py
neheller/eus18
train
0
52102028f9d7e53f6f41be7dcc7b2aa4cdb8850c
[ "allure.description('Testing drs creating device')\ndevicetype = 'ovibovi'\nmodel = 'OVI-BOVI'\nhubId = 0\ndevice2 = DRS.create_device(deviceType=devicetype, model=model, hubId=hubId, sensorId=random.randint(1, 100000))", "allure.description('Testing drs creating and delete device')\ndeviceType = 'ovibovi'\nmodel...
<|body_start_0|> allure.description('Testing drs creating device') devicetype = 'ovibovi' model = 'OVI-BOVI' hubId = 0 device2 = DRS.create_device(deviceType=devicetype, model=model, hubId=hubId, sensorId=random.randint(1, 100000)) <|end_body_0|> <|body_start_1|> allure....
Test_DRS_Basic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_DRS_Basic: def test_create_device(self, DRS): """Create device test Send http request to create device""" <|body_0|> def test_create_and_delete_device(self, DRS): """Create and delete device test Send http request to create and then delete device""" <|bo...
stack_v2_sparse_classes_75kplus_train_001994
6,212
no_license
[ { "docstring": "Create device test Send http request to create device", "name": "test_create_device", "signature": "def test_create_device(self, DRS)" }, { "docstring": "Create and delete device test Send http request to create and then delete device", "name": "test_create_and_delete_device"...
6
stack_v2_sparse_classes_30k_train_011402
Implement the Python class `Test_DRS_Basic` described below. Class description: Implement the Test_DRS_Basic class. Method signatures and docstrings: - def test_create_device(self, DRS): Create device test Send http request to create device - def test_create_and_delete_device(self, DRS): Create and delete device test...
Implement the Python class `Test_DRS_Basic` described below. Class description: Implement the Test_DRS_Basic class. Method signatures and docstrings: - def test_create_device(self, DRS): Create device test Send http request to create device - def test_create_and_delete_device(self, DRS): Create and delete device test...
2b08d3cc153f0ebdd6272a17962e1601390391c5
<|skeleton|> class Test_DRS_Basic: def test_create_device(self, DRS): """Create device test Send http request to create device""" <|body_0|> def test_create_and_delete_device(self, DRS): """Create and delete device test Send http request to create and then delete device""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_DRS_Basic: def test_create_device(self, DRS): """Create device test Send http request to create device""" allure.description('Testing drs creating device') devicetype = 'ovibovi' model = 'OVI-BOVI' hubId = 0 device2 = DRS.create_device(deviceType=devicetype...
the_stack_v2_python_sparse
test_framework_pytest/pytests/farming/cases/test_sf_drs_operations.py
jinnymus/Python
train
0
aa376be5c59a5bf5dbbf01a669a920eb6a701316
[ "OpenMaya.MUserData.__init__(self, False)\nself.manager = None\nself.pixelResolutionScale = 1.0\nself.pixelScale = 1.0\nself.camera = ''\nself.cameraFocalLenght = 0\nself.cameraFocusDistance = 0\nself.resolutionWidth = 0.0\nself.resolutionHeight = 0.0\nself.height = 0.0\nself.fit = OpenMaya.MFnCamera.kHorizontalFil...
<|body_start_0|> OpenMaya.MUserData.__init__(self, False) self.manager = None self.pixelResolutionScale = 1.0 self.pixelScale = 1.0 self.camera = '' self.cameraFocalLenght = 0 self.cameraFocusDistance = 0 self.resolutionWidth = 0.0 self.resolutionH...
PluginData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PluginData: def __init__(self): """initialize maya display draw data""" <|body_0|> def gate(self, key): """get resolution gate at given key""" <|body_1|> <|end_skeleton|> <|body_start_0|> OpenMaya.MUserData.__init__(self, False) self.manager...
stack_v2_sparse_classes_75kplus_train_001995
1,934
no_license
[ { "docstring": "initialize maya display draw data", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "get resolution gate at given key", "name": "gate", "signature": "def gate(self, key)" } ]
2
stack_v2_sparse_classes_30k_train_021583
Implement the Python class `PluginData` described below. Class description: Implement the PluginData class. Method signatures and docstrings: - def __init__(self): initialize maya display draw data - def gate(self, key): get resolution gate at given key
Implement the Python class `PluginData` described below. Class description: Implement the PluginData class. Method signatures and docstrings: - def __init__(self): initialize maya display draw data - def gate(self, key): get resolution gate at given key <|skeleton|> class PluginData: def __init__(self): ...
223608371a29a787ce85f0cdaadf8298326085e5
<|skeleton|> class PluginData: def __init__(self): """initialize maya display draw data""" <|body_0|> def gate(self, key): """get resolution gate at given key""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PluginData: def __init__(self): """initialize maya display draw data""" OpenMaya.MUserData.__init__(self, False) self.manager = None self.pixelResolutionScale = 1.0 self.pixelScale = 1.0 self.camera = '' self.cameraFocalLenght = 0 self.cameraFocu...
the_stack_v2_python_sparse
camerahudlib/private/plugin_data.py
dardnoob/CameraHUD
train
3
7353c6d9d00e879cdbfdee5e340d9f3b6c4bacda
[ "if self.power == 1 and (not self.is_conjugated()) and self.is_transposed():\n return PowerMatrixGate.T(self, inplace=inplace)\nelse:\n return PowerMatrixGate.conj(self, inplace=inplace)", "if self.power == 1 and self.is_conjugated() and (not self.is_transposed()):\n return PowerMatrixGate.conj(self, inp...
<|body_start_0|> if self.power == 1 and (not self.is_conjugated()) and self.is_transposed(): return PowerMatrixGate.T(self, inplace=inplace) else: return PowerMatrixGate.conj(self, inplace=inplace) <|end_body_0|> <|body_start_1|> if self.power == 1 and self.is_conjugated...
SelfAdjointUnitaryGate
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAdjointUnitaryGate: def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: """Apply conjugation to self.matrix().""" <|body_0|> def T(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: """Apply transposition to self.matrix().""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_001996
31,759
permissive
[ { "docstring": "Apply conjugation to self.matrix().", "name": "conj", "signature": "def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate" }, { "docstring": "Apply transposition to self.matrix().", "name": "T", "signature": "def T(self, *, inplace: bool=False) -> SelfAdjointUn...
3
stack_v2_sparse_classes_30k_train_048534
Implement the Python class `SelfAdjointUnitaryGate` described below. Class description: Implement the SelfAdjointUnitaryGate class. Method signatures and docstrings: - def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: Apply conjugation to self.matrix(). - def T(self, *, inplace: bool=False) -> SelfAdj...
Implement the Python class `SelfAdjointUnitaryGate` described below. Class description: Implement the SelfAdjointUnitaryGate class. Method signatures and docstrings: - def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: Apply conjugation to self.matrix(). - def T(self, *, inplace: bool=False) -> SelfAdj...
42f2998a059e5615dce6ccdbf7ae6dc4954bbce9
<|skeleton|> class SelfAdjointUnitaryGate: def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: """Apply conjugation to self.matrix().""" <|body_0|> def T(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: """Apply transposition to self.matrix().""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SelfAdjointUnitaryGate: def conj(self, *, inplace: bool=False) -> SelfAdjointUnitaryGate: """Apply conjugation to self.matrix().""" if self.power == 1 and (not self.is_conjugated()) and self.is_transposed(): return PowerMatrixGate.T(self, inplace=inplace) else: ...
the_stack_v2_python_sparse
hybridq/gate/property.py
jsmarsha11/hybridq-nasa
train
0
fa05c2777fdeb923d1d7313f4961efc8086c499d
[ "self.unit = unit\nself.origin = origin\nself.start = start\nself.end = end\nself.cs = ClimateState(unit=unit, origin=origin, start=start, end=end)\nself._depature = None\nself._nino = None", "a = array_check(a, 3)\nlon = array_check(lon, 1)\nlat = array_check(lat, 1)\nself.cs(a, t, axis)\nacreage = self._nino_ar...
<|body_start_0|> self.unit = unit self.origin = origin self.start = start self.end = end self.cs = ClimateState(unit=unit, origin=origin, start=start, end=end) self._depature = None self._nino = None <|end_body_0|> <|body_start_1|> a = array_check(a, 3) ...
Calculate nino index.
Nino
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Nino: """Calculate nino index.""" def __init__(self, *, unit: Optional[str]='D', origin: Optional[str]='1800-01-01 00:00:00', start: Optional[str]=None, end: Optional[str]=None) -> None: """:param unit: str time sequence unit, default is hour. :param origin: str time sequence origin ...
stack_v2_sparse_classes_75kplus_train_001997
7,225
no_license
[ { "docstring": ":param unit: str time sequence unit, default is hour. :param origin: str time sequence origin :param start: str time range start :param end: str time range end", "name": "__init__", "signature": "def __init__(self, *, unit: Optional[str]='D', origin: Optional[str]='1800-01-01 00:00:00', ...
6
stack_v2_sparse_classes_30k_train_024823
Implement the Python class `Nino` described below. Class description: Calculate nino index. Method signatures and docstrings: - def __init__(self, *, unit: Optional[str]='D', origin: Optional[str]='1800-01-01 00:00:00', start: Optional[str]=None, end: Optional[str]=None) -> None: :param unit: str time sequence unit, ...
Implement the Python class `Nino` described below. Class description: Calculate nino index. Method signatures and docstrings: - def __init__(self, *, unit: Optional[str]='D', origin: Optional[str]='1800-01-01 00:00:00', start: Optional[str]=None, end: Optional[str]=None) -> None: :param unit: str time sequence unit, ...
1c8d5fbf3676dc81e9f143e93ee2564359519b11
<|skeleton|> class Nino: """Calculate nino index.""" def __init__(self, *, unit: Optional[str]='D', origin: Optional[str]='1800-01-01 00:00:00', start: Optional[str]=None, end: Optional[str]=None) -> None: """:param unit: str time sequence unit, default is hour. :param origin: str time sequence origin ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Nino: """Calculate nino index.""" def __init__(self, *, unit: Optional[str]='D', origin: Optional[str]='1800-01-01 00:00:00', start: Optional[str]=None, end: Optional[str]=None) -> None: """:param unit: str time sequence unit, default is hour. :param origin: str time sequence origin :param start:...
the_stack_v2_python_sparse
statistics/average.py
qliu0/PythonInAirSeaScience
train
0
5543d2c343399f9adcc2994a5b1a11493f4506e7
[ "def dfs(s, stack_left, left, right, star):\n if not s:\n return not stack_left\n if left + star < right or right + star < left:\n return False\n for i, c in enumerate(s):\n if c == '(':\n stack_left += 1\n elif c == ')':\n if not stack_left:\n ...
<|body_start_0|> def dfs(s, stack_left, left, right, star): if not s: return not stack_left if left + star < right or right + star < left: return False for i, c in enumerate(s): if c == '(': stack_left += 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkValidString(self, s): """:type s: str :rtype: bool""" <|body_0|> def checkValidString_good(self, s): """代码来自于:https://leetcode.com/problems/valid-parenthesis-string/discuss/107570/Python-easy-understand-solution The number of open parenthesis is in...
stack_v2_sparse_classes_75kplus_train_001998
3,505
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "checkValidString", "signature": "def checkValidString(self, s)" }, { "docstring": "代码来自于:https://leetcode.com/problems/valid-parenthesis-string/discuss/107570/Python-easy-understand-solution The number of open parenthesis is in a range [cmin, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkValidString(self, s): :type s: str :rtype: bool - def checkValidString_good(self, s): 代码来自于:https://leetcode.com/problems/valid-parenthesis-string/discuss/107570/Python-...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkValidString(self, s): :type s: str :rtype: bool - def checkValidString_good(self, s): 代码来自于:https://leetcode.com/problems/valid-parenthesis-string/discuss/107570/Python-...
6c640581a642fc1a1c43e4b9f9f397b4d67bb67b
<|skeleton|> class Solution: def checkValidString(self, s): """:type s: str :rtype: bool""" <|body_0|> def checkValidString_good(self, s): """代码来自于:https://leetcode.com/problems/valid-parenthesis-string/discuss/107570/Python-easy-understand-solution The number of open parenthesis is in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def checkValidString(self, s): """:type s: str :rtype: bool""" def dfs(s, stack_left, left, right, star): if not s: return not stack_left if left + star < right or right + star < left: return False for i, c in enumer...
the_stack_v2_python_sparse
python/678-valid-parenthesis-string.py
whiledoing/leetcode
train
0
826c37533075b3232193cbaf45b4a9e6b85745a5
[ "super(ProductNeuralNetworkModel, self).__init__()\nif prod_method == 'inner':\n self.pnn = InnerProductNetworkLayer(num_fields=num_fields)\nelif prod_method == 'outer':\n self.pnn = OuterProductNetworkLayer(embed_size=embed_size, num_fields=num_fields, kernel_type=kwargs.get('kernel_type', 'mat'))\nelse:\n ...
<|body_start_0|> super(ProductNeuralNetworkModel, self).__init__() if prod_method == 'inner': self.pnn = InnerProductNetworkLayer(num_fields=num_fields) elif prod_method == 'outer': self.pnn = OuterProductNetworkLayer(embed_size=embed_size, num_fields=num_fields, kernel_t...
ProductNeuralNetworkModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductNeuralNetworkModel: def __init__(self, embed_size: int, num_fields: int, output_size: int, prod_method: str, deep_layer_sizes: List[int], deep_dropout_p: List[float]=None, deep_activation: Callable[[torch.Tensor], torch.Tensor]=nn.ReLU(), **kwargs): """Initialize ProductNeuralNetw...
stack_v2_sparse_classes_75kplus_train_001999
3,707
permissive
[ { "docstring": "Initialize ProductNeuralNetworkModel Args: embed_size (int): Size of embedding tensor num_fields (int): Number of inputs' fields output_size (int): Output size of model prod_method (str): Method of product neural network. Allow: [inner, outer]. deep_layer_sizes (List[int]): Layer sizes of DNN de...
2
stack_v2_sparse_classes_30k_train_015701
Implement the Python class `ProductNeuralNetworkModel` described below. Class description: Implement the ProductNeuralNetworkModel class. Method signatures and docstrings: - def __init__(self, embed_size: int, num_fields: int, output_size: int, prod_method: str, deep_layer_sizes: List[int], deep_dropout_p: List[float...
Implement the Python class `ProductNeuralNetworkModel` described below. Class description: Implement the ProductNeuralNetworkModel class. Method signatures and docstrings: - def __init__(self, embed_size: int, num_fields: int, output_size: int, prod_method: str, deep_layer_sizes: List[int], deep_dropout_p: List[float...
8b4cdbd5ed126a86da3bd9ef1665a6985dedc07c
<|skeleton|> class ProductNeuralNetworkModel: def __init__(self, embed_size: int, num_fields: int, output_size: int, prod_method: str, deep_layer_sizes: List[int], deep_dropout_p: List[float]=None, deep_activation: Callable[[torch.Tensor], torch.Tensor]=nn.ReLU(), **kwargs): """Initialize ProductNeuralNetw...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProductNeuralNetworkModel: def __init__(self, embed_size: int, num_fields: int, output_size: int, prod_method: str, deep_layer_sizes: List[int], deep_dropout_p: List[float]=None, deep_activation: Callable[[torch.Tensor], torch.Tensor]=nn.ReLU(), **kwargs): """Initialize ProductNeuralNetworkModel Args:...
the_stack_v2_python_sparse
torecsys/models/ctr/product_neural_network.py
codeants2012/torecsys
train
0