blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
ab54a6d51ed2c4c363e2c616800a29e2acd4ee9d
[ "dev_type_electric_train = self.env.ref('metro_park_base.dev_type_electric_train').id\ndevs = self.env['metro_park_maintenance.train_dev'].search([('dev_type', '=', dev_type_electric_train)])\ndev_ids = devs.ids\nrecords = self.search([('year', '=', year)])\nold_ids = records.mapped('train_dev.id')\ndifference = se...
<|body_start_0|> dev_type_electric_train = self.env.ref('metro_park_base.dev_type_electric_train').id devs = self.env['metro_park_maintenance.train_dev'].search([('dev_type', '=', dev_type_electric_train)]) dev_ids = devs.ids records = self.search([('year', '=', year)]) old_ids =...
年计划月份汇总
YearPlanSummary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YearPlanSummary: """年计划月份汇总""" def check_records(self, year): """创建年份数据 :return:""" <|body_0|> def view_detail(self): """查看详情 :return:""" <|body_1|> def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None): """重写,搜索出要...
stack_v2_sparse_classes_36k_train_009600
8,907
no_license
[ { "docstring": "创建年份数据 :return:", "name": "check_records", "signature": "def check_records(self, year)" }, { "docstring": "查看详情 :return:", "name": "view_detail", "signature": "def view_detail(self)" }, { "docstring": "重写,搜索出要的结果 :param domain: :param fields: :param offset: :param...
3
null
Implement the Python class `YearPlanSummary` described below. Class description: 年计划月份汇总 Method signatures and docstrings: - def check_records(self, year): 创建年份数据 :return: - def view_detail(self): 查看详情 :return: - def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None): 重写,搜索出要的结果 :param doma...
Implement the Python class `YearPlanSummary` described below. Class description: 年计划月份汇总 Method signatures and docstrings: - def check_records(self, year): 创建年份数据 :return: - def view_detail(self): 查看详情 :return: - def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None): 重写,搜索出要的结果 :param doma...
13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9
<|skeleton|> class YearPlanSummary: """年计划月份汇总""" def check_records(self, year): """创建年份数据 :return:""" <|body_0|> def view_detail(self): """查看详情 :return:""" <|body_1|> def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None): """重写,搜索出要...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class YearPlanSummary: """年计划月份汇总""" def check_records(self, year): """创建年份数据 :return:""" dev_type_electric_train = self.env.ref('metro_park_base.dev_type_electric_train').id devs = self.env['metro_park_maintenance.train_dev'].search([('dev_type', '=', dev_type_electric_train)]) ...
the_stack_v2_python_sparse
mdias_addons/metro_park_maintenance/models/year_plan_summary.py
rezaghanimi/main_mdias
train
0
e64d0d4e9e87e5d2df9a2fa7566610d35c0ea8a9
[ "password = attrs[source]\nif len(password) < PASSWORD_MIN_LENGTH:\n raise serializers.ValidationError(code['E_INVALID_PASSWORD'])\nreturn attrs", "username = attrs[source].lower()\nif User.objects.filter(username=username).count() > 0:\n raise serializers.ValidationError(code['E_DUPLICATE_USERNAME'])\nretu...
<|body_start_0|> password = attrs[source] if len(password) < PASSWORD_MIN_LENGTH: raise serializers.ValidationError(code['E_INVALID_PASSWORD']) return attrs <|end_body_0|> <|body_start_1|> username = attrs[source].lower() if User.objects.filter(username=username).cou...
RegisterSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterSerializer: def validate_password(attrs, source): """Check valid password""" <|body_0|> def validate_username(attrs, source): """Check duplicated username""" <|body_1|> def validate_password_confirmation(attrs, source): """Password confir...
stack_v2_sparse_classes_36k_train_009601
4,776
no_license
[ { "docstring": "Check valid password", "name": "validate_password", "signature": "def validate_password(attrs, source)" }, { "docstring": "Check duplicated username", "name": "validate_username", "signature": "def validate_username(attrs, source)" }, { "docstring": "Password conf...
4
null
Implement the Python class `RegisterSerializer` described below. Class description: Implement the RegisterSerializer class. Method signatures and docstrings: - def validate_password(attrs, source): Check valid password - def validate_username(attrs, source): Check duplicated username - def validate_password_confirmat...
Implement the Python class `RegisterSerializer` described below. Class description: Implement the RegisterSerializer class. Method signatures and docstrings: - def validate_password(attrs, source): Check valid password - def validate_username(attrs, source): Check duplicated username - def validate_password_confirmat...
28d5f3fd0b4deb6909aeda97f17f2994eaffd48a
<|skeleton|> class RegisterSerializer: def validate_password(attrs, source): """Check valid password""" <|body_0|> def validate_username(attrs, source): """Check duplicated username""" <|body_1|> def validate_password_confirmation(attrs, source): """Password confir...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterSerializer: def validate_password(attrs, source): """Check valid password""" password = attrs[source] if len(password) < PASSWORD_MIN_LENGTH: raise serializers.ValidationError(code['E_INVALID_PASSWORD']) return attrs def validate_username(attrs, source)...
the_stack_v2_python_sparse
api/authMana/serializers.py
minhdo6487/api-proto
train
0
40f09033bb6759e5f7e09a8301c9b8cdb7040ae2
[ "def preorder(root):\n serialization = []\n stack = [root]\n node = None\n while stack:\n node = stack.pop()\n serialization.append(str(node.val))\n node.right and stack.append(node.right)\n node.left and stack.append(node.left)\n return serialization\n\ndef inorder(root):...
<|body_start_0|> def preorder(root): serialization = [] stack = [root] node = None while stack: node = stack.pop() serialization.append(str(node.val)) node.right and stack.append(node.right) node.left...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_009602
2,065
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:...
97533d53c8892b6519e99f344489fa4fd4c9ab93
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def preorder(root): serialization = [] stack = [root] node = None while stack: node = stack.pop() serializ...
the_stack_v2_python_sparse
8. Tree/449.py
proTao/leetcode
train
0
21e392a4eca73a9eac62e0fa3663b3b3b8a0b1eb
[ "super(PostProcessor, self).__init__()\nself.score_thresh = score_thresh\nself.nms = nms\nself.detections_per_img = detections_per_img\nself.box_coder = box_coder", "assert len(boxes) == 1, 'Only single feature'\nboxes = boxes[0]\nclass_logits, box_regression = x\nclass_prob = F.softmax(class_logits, -1)\nimage_s...
<|body_start_0|> super(PostProcessor, self).__init__() self.score_thresh = score_thresh self.nms = nms self.detections_per_img = detections_per_img self.box_coder = box_coder <|end_body_0|> <|body_start_1|> assert len(boxes) == 1, 'Only single feature' boxes = bo...
From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results
PostProcessor
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostProcessor: """From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results""" def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=BoxCoder(weights=(10.0, 10.0, 5.0, 5.0))): ...
stack_v2_sparse_classes_36k_train_009603
8,271
permissive
[ { "docstring": "Arguments: score_thresh (float) nms (float) detections_per_img (int) box_coder (BoxCoder)", "name": "__init__", "signature": "def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=BoxCoder(weights=(10.0, 10.0, 5.0, 5.0)))" }, { "docstring": "Arguments: ...
2
stack_v2_sparse_classes_30k_train_007611
Implement the Python class `PostProcessor` described below. Class description: From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results Method signatures and docstrings: - def __init__(self, score_thresh=0.05, nms=0.5, detections...
Implement the Python class `PostProcessor` described below. Class description: From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results Method signatures and docstrings: - def __init__(self, score_thresh=0.05, nms=0.5, detections...
11c38436a158c453e3011f8684570f7a55c03330
<|skeleton|> class PostProcessor: """From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results""" def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=BoxCoder(weights=(10.0, 10.0, 5.0, 5.0))): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostProcessor: """From a set of classification scores, box regression and proposals, computes the post-processed boxes, and applies NMS to obtain the final results""" def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=BoxCoder(weights=(10.0, 10.0, 5.0, 5.0))): """Arg...
the_stack_v2_python_sparse
v0.5.0/nvidia/submission/code/object_detection/pytorch/maskrcnn_benchmark/modeling/post_processors/fast_rcnn.py
myelintek/results
train
0
e20af4a1135d7f0f69e40b251ba1bbc63aec51af
[ "super().__init__()\nself.conv_1 = nn.Conv3d(1, 16, kernel_size=(3, 3, 3))\nself.pool_1 = nn.MaxPool3d((2, 2, 2))\nself.batch_1 = nn.BatchNorm3d(16)\nself.conv_2 = nn.Conv3d(16, 32, kernel_size=(3, 3, 3))\nself.pool_2 = nn.MaxPool3d((2, 2, 2))\nself.batch_2 = nn.BatchNorm3d(32)\nself.conv_3 = nn.Conv3d(32, 64, kern...
<|body_start_0|> super().__init__() self.conv_1 = nn.Conv3d(1, 16, kernel_size=(3, 3, 3)) self.pool_1 = nn.MaxPool3d((2, 2, 2)) self.batch_1 = nn.BatchNorm3d(16) self.conv_2 = nn.Conv3d(16, 32, kernel_size=(3, 3, 3)) self.pool_2 = nn.MaxPool3d((2, 2, 2)) self.batc...
customCNN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class customCNN: def __init__(self, **kwargs): """Parameters ---------- **kwargs : Returns -------""" <|body_0|> def forward(self, x): """Args: x: Returns: Raises:""" <|body_1|> def num_flat_features(self, x): """Args: x: Returns: Raises:""" <|...
stack_v2_sparse_classes_36k_train_009604
2,034
permissive
[ { "docstring": "Parameters ---------- **kwargs : Returns -------", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Args: x: Returns: Raises:", "name": "forward", "signature": "def forward(self, x)" }, { "docstring": "Args: x: Returns: Raises:", ...
3
stack_v2_sparse_classes_30k_train_015120
Implement the Python class `customCNN` described below. Class description: Implement the customCNN class. Method signatures and docstrings: - def __init__(self, **kwargs): Parameters ---------- **kwargs : Returns ------- - def forward(self, x): Args: x: Returns: Raises: - def num_flat_features(self, x): Args: x: Retu...
Implement the Python class `customCNN` described below. Class description: Implement the customCNN class. Method signatures and docstrings: - def __init__(self, **kwargs): Parameters ---------- **kwargs : Returns ------- - def forward(self, x): Args: x: Returns: Raises: - def num_flat_features(self, x): Args: x: Retu...
54246341460c04caeced2ef6dcab984f6c260c9d
<|skeleton|> class customCNN: def __init__(self, **kwargs): """Parameters ---------- **kwargs : Returns -------""" <|body_0|> def forward(self, x): """Args: x: Returns: Raises:""" <|body_1|> def num_flat_features(self, x): """Args: x: Returns: Raises:""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class customCNN: def __init__(self, **kwargs): """Parameters ---------- **kwargs : Returns -------""" super().__init__() self.conv_1 = nn.Conv3d(1, 16, kernel_size=(3, 3, 3)) self.pool_1 = nn.MaxPool3d((2, 2, 2)) self.batch_1 = nn.BatchNorm3d(16) self.conv_2 = nn.Conv...
the_stack_v2_python_sparse
src/models/customCNN.py
FredrikM97/Medical-ROI
train
0
e3f492243204bd0eb640795f1e12a36b45dd228f
[ "if not root:\n return '[]'\nres = []\ndeque = [root]\nwhile deque:\n curr = deque.pop(0)\n if curr:\n res.append(str(curr.val))\n deque.append(curr.left)\n deque.append(curr.right)\n else:\n res.append('null')\nwhile res[-1] == 'null':\n res.pop()\nreturn '[' + ','.join(r...
<|body_start_0|> if not root: return '[]' res = [] deque = [root] while deque: curr = deque.pop(0) if curr: res.append(str(curr.val)) deque.append(curr.left) deque.append(curr.right) else: ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_009605
2,065
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:...
8987859c4c3faedf7159b5a6ec3155609689760e
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '[]' res = [] deque = [root] while deque: curr = deque.pop(0) if curr: res.append(str(curr...
the_stack_v2_python_sparse
Python/Leetcodes/binary_tree/jianzhi_offer_37_serialize.py
ccc013/DataStructe-Algorithms_Study
train
15
3f960fe2a344613289f1446834292f255a190827
[ "if specprod_dir is None:\n specprod_dir = specprod_root()\nself.specprod_dir = specprod_dir\nQA_MultiExp.__init__(self, specprod_dir=specprod_dir, **kwargs)\nnights = get_nights(specprod_dir=self.specprod_dir)\nfor night in nights:\n self.mexp_dict[night] = {}\n for exposure in get_exposures(night, specpr...
<|body_start_0|> if specprod_dir is None: specprod_dir = specprod_root() self.specprod_dir = specprod_dir QA_MultiExp.__init__(self, specprod_dir=specprod_dir, **kwargs) nights = get_nights(specprod_dir=self.specprod_dir) for night in nights: self.mexp_dic...
QA_Prod
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QA_Prod: def __init__(self, specprod_dir=None, **kwargs): """Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: ...
stack_v2_sparse_classes_36k_train_009606
4,122
permissive
[ { "docstring": "Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: qa_exps : list List of QA_Exposure classes, one per exposure in produ...
4
stack_v2_sparse_classes_30k_train_013121
Implement the Python class `QA_Prod` described below. Class description: Implement the QA_Prod class. Method signatures and docstrings: - def __init__(self, specprod_dir=None, **kwargs): Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If...
Implement the Python class `QA_Prod` described below. Class description: Implement the QA_Prod class. Method signatures and docstrings: - def __init__(self, specprod_dir=None, **kwargs): Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If...
d75d0540cd07df1bf46130338a33c2ced51fbead
<|skeleton|> class QA_Prod: def __init__(self, specprod_dir=None, **kwargs): """Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QA_Prod: def __init__(self, specprod_dir=None, **kwargs): """Class to organize and execute QA for a DESI production Args: specprod_dir(str): Path containing the exposures/ directory to use. If the value is None, then the value of :func:`specprod_root` is used instead. Notes: Attributes: qa_exps : list...
the_stack_v2_python_sparse
py/desispec/qa/qa_prod.py
desihub/desispec
train
33
ee310356b759caa9cd866ebc52212b8533a0dc33
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Reminder()", "from .date_time_time_zone import DateTimeTimeZone\nfrom .location import Location\nfrom .date_time_time_zone import DateTimeTimeZone\nfrom .location import Location\nfields: Dict[str, Callable[[Any], None]] = {'changeKey'...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Reminder() <|end_body_0|> <|body_start_1|> from .date_time_time_zone import DateTimeTimeZone from .location import Location from .date_time_time_zone import DateTimeTimeZone ...
Reminder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reminder: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: """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: Reminder...
stack_v2_sparse_classes_36k_train_009607
4,994
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: Reminder", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(pars...
3
stack_v2_sparse_classes_30k_train_008951
Implement the Python class `Reminder` described below. Class description: Implement the Reminder class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: Creates a new instance of the appropriate class based on discriminator value Args: parse_no...
Implement the Python class `Reminder` described below. Class description: Implement the Reminder class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: Creates a new instance of the appropriate class based on discriminator value Args: parse_no...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Reminder: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: """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: Reminder...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Reminder: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: """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: Reminder""" if...
the_stack_v2_python_sparse
msgraph/generated/models/reminder.py
microsoftgraph/msgraph-sdk-python
train
135
078054ea8dfff7f4f7c5215f4990ff59e8fdcb94
[ "if not hasattr(self, 'profile'):\n '将这行这整行数据挂到self身上,这行数据成了self的属性,例:self.profile.dating_gender'\n self.profile, _ = Profile.objects.get_or_create(id=self.id)\nreturn self.profile", "\"\"\"检查当前会员是否过期\"\"\"\nnow = datetime.datetime.now()\nif now > self.vip_end:\n self.set_vip(1)\nif not hasattr(self, '_v...
<|body_start_0|> if not hasattr(self, 'profile'): '将这行这整行数据挂到self身上,这行数据成了self的属性,例:self.profile.dating_gender' self.profile, _ = Profile.objects.get_or_create(id=self.id) return self.profile <|end_body_0|> <|body_start_1|> """检查当前会员是否过期""" now = datetime.datetim...
User
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: def get_profile(self): """判断self身上是否有这个属性,如果没有说明是第一次,正常查询数据库,如果有就不必再次查询数据库,直接在属性例获取""" <|body_0|> def vip(self): """找到当前用户对应的VIP""" <|body_1|> def set_vip(self, vip_id): """设置当前用户的vip""" <|body_2|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_009608
3,441
permissive
[ { "docstring": "判断self身上是否有这个属性,如果没有说明是第一次,正常查询数据库,如果有就不必再次查询数据库,直接在属性例获取", "name": "get_profile", "signature": "def get_profile(self)" }, { "docstring": "找到当前用户对应的VIP", "name": "vip", "signature": "def vip(self)" }, { "docstring": "设置当前用户的vip", "name": "set_vip", "signat...
3
stack_v2_sparse_classes_30k_train_006919
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def get_profile(self): 判断self身上是否有这个属性,如果没有说明是第一次,正常查询数据库,如果有就不必再次查询数据库,直接在属性例获取 - def vip(self): 找到当前用户对应的VIP - def set_vip(self, vip_id): 设置当前用户的vip
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def get_profile(self): 判断self身上是否有这个属性,如果没有说明是第一次,正常查询数据库,如果有就不必再次查询数据库,直接在属性例获取 - def vip(self): 找到当前用户对应的VIP - def set_vip(self, vip_id): 设置当前用户的vip <|skeleton|> class User: def ...
9d6653f07be0f6d1d8726cce15789e4fae729725
<|skeleton|> class User: def get_profile(self): """判断self身上是否有这个属性,如果没有说明是第一次,正常查询数据库,如果有就不必再次查询数据库,直接在属性例获取""" <|body_0|> def vip(self): """找到当前用户对应的VIP""" <|body_1|> def set_vip(self, vip_id): """设置当前用户的vip""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class User: def get_profile(self): """判断self身上是否有这个属性,如果没有说明是第一次,正常查询数据库,如果有就不必再次查询数据库,直接在属性例获取""" if not hasattr(self, 'profile'): '将这行这整行数据挂到self身上,这行数据成了self的属性,例:self.profile.dating_gender' self.profile, _ = Profile.objects.get_or_create(id=self.id) return self.pr...
the_stack_v2_python_sparse
my_tt/UserApp/models.py
tanproject/tantan
train
0
0f3e18a6db60a54ee705e25d88090299b13cadc2
[ "tok = line.strip().split()\nassert len(tok) == 10\nassert tok[0] == 'sugar:'\nself.uid = uid\nself.qid = tok[1]\nself.qstart = int(tok[2])\nself.qend = int(tok[3])\nself.qstrand = tok[4]\nself.sid = tok[5]\nself.sstart = int(tok[6])\nself.send = int(tok[7])\nself.sstrand = tok[8]\nself.score = int(tok[9])\nself.li...
<|body_start_0|> tok = line.strip().split() assert len(tok) == 10 assert tok[0] == 'sugar:' self.uid = uid self.qid = tok[1] self.qstart = int(tok[2]) self.qend = int(tok[3]) self.qstrand = tok[4] self.sid = tok[5] self.sstart = int(tok[6])...
exoneratehit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class exoneratehit: def __init__(self, line, uid): """parse SUGAR hit from a line""" <|body_0|> def append(self, line, uid): """append a gff line to the result""" <|body_1|> <|end_skeleton|> <|body_start_0|> tok = line.strip().split() assert len(t...
stack_v2_sparse_classes_36k_train_009609
11,936
no_license
[ { "docstring": "parse SUGAR hit from a line", "name": "__init__", "signature": "def __init__(self, line, uid)" }, { "docstring": "append a gff line to the result", "name": "append", "signature": "def append(self, line, uid)" } ]
2
stack_v2_sparse_classes_30k_train_000992
Implement the Python class `exoneratehit` described below. Class description: Implement the exoneratehit class. Method signatures and docstrings: - def __init__(self, line, uid): parse SUGAR hit from a line - def append(self, line, uid): append a gff line to the result
Implement the Python class `exoneratehit` described below. Class description: Implement the exoneratehit class. Method signatures and docstrings: - def __init__(self, line, uid): parse SUGAR hit from a line - def append(self, line, uid): append a gff line to the result <|skeleton|> class exoneratehit: def __ini...
e006354ce41e6db029fb8cda02efaae60afc5327
<|skeleton|> class exoneratehit: def __init__(self, line, uid): """parse SUGAR hit from a line""" <|body_0|> def append(self, line, uid): """append a gff line to the result""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class exoneratehit: def __init__(self, line, uid): """parse SUGAR hit from a line""" tok = line.strip().split() assert len(tok) == 10 assert tok[0] == 'sugar:' self.uid = uid self.qid = tok[1] self.qstart = int(tok[2]) self.qend = int(tok[3]) s...
the_stack_v2_python_sparse
seq.py
robertvi/rjvbio
train
0
59059ee5f557c6a34c3a77a3af483ebae3bd0b85
[ "self.click(self.xzl_doctor)\nself.click(self.xzl_add)\ntime.sleep(1)\nself.sendKeys(self.xzl_jigouname, text=jigouname)\nself.sendKeys(self.xzl_jigouuname, text=jigouuname)\ntime.sleep(1)\nself.click(self.xzl_jigouadd)\ntime.sleep(1)", "self.click(self.xzl_usertouxiang)\ntime.sleep(1)\nself.click(self.xzl_userlo...
<|body_start_0|> self.click(self.xzl_doctor) self.click(self.xzl_add) time.sleep(1) self.sendKeys(self.xzl_jigouname, text=jigouname) self.sendKeys(self.xzl_jigouuname, text=jigouuname) time.sleep(1) self.click(self.xzl_jigouadd) time.sleep(1) <|end_body_0...
心之力系统主页面相关元素
MainPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainPage: """心之力系统主页面相关元素""" def xinzhili_main(self, jigouname=0, jigouuname=0): """登录进入主页面,添加机构""" <|body_0|> def xinzhili_logout(self): """退出登录""" <|body_1|> def xinzhili_shezhi(self): """首次登录后设置新密码""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_009610
1,938
no_license
[ { "docstring": "登录进入主页面,添加机构", "name": "xinzhili_main", "signature": "def xinzhili_main(self, jigouname=0, jigouuname=0)" }, { "docstring": "退出登录", "name": "xinzhili_logout", "signature": "def xinzhili_logout(self)" }, { "docstring": "首次登录后设置新密码", "name": "xinzhili_shezhi", ...
3
stack_v2_sparse_classes_30k_train_021422
Implement the Python class `MainPage` described below. Class description: 心之力系统主页面相关元素 Method signatures and docstrings: - def xinzhili_main(self, jigouname=0, jigouuname=0): 登录进入主页面,添加机构 - def xinzhili_logout(self): 退出登录 - def xinzhili_shezhi(self): 首次登录后设置新密码
Implement the Python class `MainPage` described below. Class description: 心之力系统主页面相关元素 Method signatures and docstrings: - def xinzhili_main(self, jigouname=0, jigouuname=0): 登录进入主页面,添加机构 - def xinzhili_logout(self): 退出登录 - def xinzhili_shezhi(self): 首次登录后设置新密码 <|skeleton|> class MainPage: """心之力系统主页面相关元素""" ...
97b7ea508146cf293d90756e80161eeb4b91b4b6
<|skeleton|> class MainPage: """心之力系统主页面相关元素""" def xinzhili_main(self, jigouname=0, jigouuname=0): """登录进入主页面,添加机构""" <|body_0|> def xinzhili_logout(self): """退出登录""" <|body_1|> def xinzhili_shezhi(self): """首次登录后设置新密码""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainPage: """心之力系统主页面相关元素""" def xinzhili_main(self, jigouname=0, jigouuname=0): """登录进入主页面,添加机构""" self.click(self.xzl_doctor) self.click(self.xzl_add) time.sleep(1) self.sendKeys(self.xzl_jigouname, text=jigouname) self.sendKeys(self.xzl_jigouuname, text=...
the_stack_v2_python_sparse
pages/index/MainPage.py
duanbibo/UIAUTO
train
1
c294e0044ac84844dba7527a7987e70f1f9ac732
[ "event = execution_context.event\ndata_file = event.get('data_file', 'default')\ninput_text = event.get('input')\noutput_type = event.get('output_type')\noutput_args = event.get('output_args')\nself.validate(input_text, output_type, output_args)\ndocument = {'input': input_text, 'output_type': output_type, 'output_...
<|body_start_0|> event = execution_context.event data_file = event.get('data_file', 'default') input_text = event.get('input') output_type = event.get('output_type') output_args = event.get('output_args') self.validate(input_text, output_type, output_args) documen...
Trigger to learn new sample
Learn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Learn: """Trigger to learn new sample""" def run(self, execution_context, _): """run the action""" <|body_0|> def validate(self, input_text, output_type, output_args): """validate input and output""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_009611
1,041
no_license
[ { "docstring": "run the action", "name": "run", "signature": "def run(self, execution_context, _)" }, { "docstring": "validate input and output", "name": "validate", "signature": "def validate(self, input_text, output_type, output_args)" } ]
2
stack_v2_sparse_classes_30k_train_008117
Implement the Python class `Learn` described below. Class description: Trigger to learn new sample Method signatures and docstrings: - def run(self, execution_context, _): run the action - def validate(self, input_text, output_type, output_args): validate input and output
Implement the Python class `Learn` described below. Class description: Trigger to learn new sample Method signatures and docstrings: - def run(self, execution_context, _): run the action - def validate(self, input_text, output_type, output_args): validate input and output <|skeleton|> class Learn: """Trigger to ...
31a4b8815db98efcde8b78d936a6b2fdaae71324
<|skeleton|> class Learn: """Trigger to learn new sample""" def run(self, execution_context, _): """run the action""" <|body_0|> def validate(self, input_text, output_type, output_args): """validate input and output""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Learn: """Trigger to learn new sample""" def run(self, execution_context, _): """run the action""" event = execution_context.event data_file = event.get('data_file', 'default') input_text = event.get('input') output_type = event.get('output_type') output_ar...
the_stack_v2_python_sparse
server/triggers/learn.py
dungba88/jenova
train
0
e8e01381ed9170fd94813a30e2021291ce052ed9
[ "query = self._query\nif self._api_version == 2:\n query['size'] = self._size\n query['page'] = self._page_num\nelse:\n query['limit'] = self._limit\n query['offset'] = self._offset\nif self._method == 'GET':\n resp = self._api.get(self._path, params=query).json()\nelif self._method == 'POST':\n s...
<|body_start_0|> query = self._query if self._api_version == 2: query['size'] = self._size query['page'] = self._page_num else: query['limit'] = self._limit query['offset'] = self._offset if self._method == 'GET': resp = self._a...
The following methods allows us to iterate through pages and get data
TIOIterator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TIOIterator: """The following methods allows us to iterate through pages and get data""" def _get_data(self): """Request the next page of data""" <|body_0|> def _get_page(self): """Get the next page of records""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_009612
7,766
permissive
[ { "docstring": "Request the next page of data", "name": "_get_data", "signature": "def _get_data(self)" }, { "docstring": "Get the next page of records", "name": "_get_page", "signature": "def _get_page(self)" } ]
2
null
Implement the Python class `TIOIterator` described below. Class description: The following methods allows us to iterate through pages and get data Method signatures and docstrings: - def _get_data(self): Request the next page of data - def _get_page(self): Get the next page of records
Implement the Python class `TIOIterator` described below. Class description: The following methods allows us to iterate through pages and get data Method signatures and docstrings: - def _get_data(self): Request the next page of data - def _get_page(self): Get the next page of records <|skeleton|> class TIOIterator:...
4e31049891f55016168b14ae30d332a965523640
<|skeleton|> class TIOIterator: """The following methods allows us to iterate through pages and get data""" def _get_data(self): """Request the next page of data""" <|body_0|> def _get_page(self): """Get the next page of records""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TIOIterator: """The following methods allows us to iterate through pages and get data""" def _get_data(self): """Request the next page of data""" query = self._query if self._api_version == 2: query['size'] = self._size query['page'] = self._page_num ...
the_stack_v2_python_sparse
tenable/io/base/v1.py
tenable/pyTenable
train
300
c665e4f14b6863663ebea61d63fb3a3aadf76a52
[ "self.sums = [0] * len(nums)\ntotal = 0\nfor x, num in enumerate(nums):\n total += num\n self.sums[x] = total", "if i == 0:\n return self.sums[j]\nif i > 0:\n return self.sums[j] - self.sums[i - 1]" ]
<|body_start_0|> self.sums = [0] * len(nums) total = 0 for x, num in enumerate(nums): total += num self.sums[x] = total <|end_body_0|> <|body_start_1|> if i == 0: return self.sums[j] if i > 0: return self.sums[j] - self.sums[i - 1]...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sums = [0] * len(nums) total = 0 for x...
stack_v2_sparse_classes_36k_train_009613
814
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type j: int :rtype: int", "name": "sumRange", "signature": "def sumRange(self, i, j)" } ]
2
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def sumRange(self, i, j): :type i: int :type j: int :rtype: int <|skeleton|> class NumArray: def __init__(self, nums): ...
372adcee7fc804062b13b9ed432407f04777adab
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.sums = [0] * len(nums) total = 0 for x, num in enumerate(nums): total += num self.sums[x] = total def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" ...
the_stack_v2_python_sparse
303_Range Sum Query Immutable.py
vincent-kangzhou/Leetcode_Easy
train
1
1bfadf42bf9e505926daf7448069c3f8083a688b
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('alanbur_jcaluag', 'alanbur_jcaluag')\nurl = 'http://bostonopendata-boston.opendata.arcgis.com/datasets/de08c6fe69c942509089e6db98c716a3_0.geojson'\nresponse = urllib.request.urlopen(url).read().decode('u...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('alanbur_jcaluag', 'alanbur_jcaluag') url = 'http://bostonopendata-boston.opendata.arcgis.com/datasets/de08c6fe69c942509089e6db98c716a3_0.geojson' ...
extract traffic signal data from url
trafficSignal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class trafficSignal: """extract traffic signal data from url""" def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Creat...
stack_v2_sparse_classes_36k_train_009614
3,554
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_003020
Implement the Python class `trafficSignal` described below. Class description: extract traffic signal data from url Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None,...
Implement the Python class `trafficSignal` described below. Class description: extract traffic signal data from url Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=None,...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class trafficSignal: """extract traffic signal data from url""" def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Creat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class trafficSignal: """extract traffic signal data from url""" def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.aut...
the_stack_v2_python_sparse
alanbur_jcaluag/trafficSignal.py
ROODAY/course-2017-fal-proj
train
3
2aedc91471a6a83ed9ded18e3bb939363b892580
[ "self.pair = PairOfDice()\nself.point = None\nself.origin_point = None", "input('Please enter to roll the dice...\\n')\nself.pair.roll_dice()\nself.point = self.pair.current_value()", "WIN_POINTS = [7, 11]\nLOSE_POINTS = [2, 3, 12]\nif self.point in LOSE_POINTS:\n print('You rolled {}. You lose.'.format(self...
<|body_start_0|> self.pair = PairOfDice() self.point = None self.origin_point = None <|end_body_0|> <|body_start_1|> input('Please enter to roll the dice...\n') self.pair.roll_dice() self.point = self.pair.current_value() <|end_body_1|> <|body_start_2|> WIN_POIN...
GameController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameController: def __init__(self): """creat a PairOfDice() object, initialize the point and score value""" <|body_0|> def start_play(self): """Start to play the game, roll the dice and get current value""" <|body_1|> def show_result(self): """ge...
stack_v2_sparse_classes_36k_train_009615
1,536
no_license
[ { "docstring": "creat a PairOfDice() object, initialize the point and score value", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Start to play the game, roll the dice and get current value", "name": "start_play", "signature": "def start_play(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_015722
Implement the Python class `GameController` described below. Class description: Implement the GameController class. Method signatures and docstrings: - def __init__(self): creat a PairOfDice() object, initialize the point and score value - def start_play(self): Start to play the game, roll the dice and get current va...
Implement the Python class `GameController` described below. Class description: Implement the GameController class. Method signatures and docstrings: - def __init__(self): creat a PairOfDice() object, initialize the point and score value - def start_play(self): Start to play the game, roll the dice and get current va...
346b4637a162eba17f2ab8e4d95b23b615300c4b
<|skeleton|> class GameController: def __init__(self): """creat a PairOfDice() object, initialize the point and score value""" <|body_0|> def start_play(self): """Start to play the game, roll the dice and get current value""" <|body_1|> def show_result(self): """ge...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameController: def __init__(self): """creat a PairOfDice() object, initialize the point and score value""" self.pair = PairOfDice() self.point = None self.origin_point = None def start_play(self): """Start to play the game, roll the dice and get current value""" ...
the_stack_v2_python_sparse
lab07/game_controller.py
jingjingliao/PythonCourse_5001
train
0
6a391cec1aac701d6e31fae0a775b111c47bfcfa
[ "if head is None or head.next is None:\n return head\ndummy = ListNode(0)\ndummy.next = head\nhead = dummy\nitr = head.next\nwhile itr.next:\n if head.next.val == itr.next.val:\n head.next, itr = (itr.next, itr.next)\n else:\n head, itr = (head.next, itr.next)\nreturn dummy.next", "if len(d...
<|body_start_0|> if head is None or head.next is None: return head dummy = ListNode(0) dummy.next = head head = dummy itr = head.next while itr.next: if head.next.val == itr.next.val: head.next, itr = (itr.next, itr.next) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def createList(self, data): """:param data: a list :return: a head node to a linked list""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head is No...
stack_v2_sparse_classes_36k_train_009616
1,717
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates", "signature": "def deleteDuplicates(self, head)" }, { "docstring": ":param data: a list :return: a head node to a linked list", "name": "createList", "signature": "def createList(self, data)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def createList(self, data): :param data: a list :return: a head node to a linked list
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def createList(self, data): :param data: a list :return: a head node to a linked list <|skeleton|> clas...
a5b02044ef39154b6a8d32eb57682f447e1632ba
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def createList(self, data): """:param data: a list :return: a head node to a linked list""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" if head is None or head.next is None: return head dummy = ListNode(0) dummy.next = head head = dummy itr = head.next while itr.next: if head.n...
the_stack_v2_python_sparse
algo/list/remove_duplicates_from_sorted_list.py
xys234/coding-problems
train
0
79c6fd96ee3fa40e17e393494783294e2869252f
[ "for name, working_partitions in cls.data_source.working_partitions.items():\n try:\n partition = partitions[name]\n except KeyError:\n raise ValueError(f\"{cls.__name__} is missing required '{name}' field.\")\n if not partitions[name]:\n partition = working_partitions\n partitions_...
<|body_start_0|> for name, working_partitions in cls.data_source.working_partitions.items(): try: partition = partitions[name] except KeyError: raise ValueError(f"{cls.__name__} is missing required '{name}' field.") if not partitions[name]: ...
An abstract pydantic model for generic datasets. Each dataset must specify working partitions. A dataset can have an arbitrary number of partitions. Args: disabled: if true, skip processing this dataset.
GenericDatasetSettings
[ "CC-BY-4.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenericDatasetSettings: """An abstract pydantic model for generic datasets. Each dataset must specify working partitions. A dataset can have an arbitrary number of partitions. Args: disabled: if true, skip processing this dataset.""" def validate_partitions(cls, partitions): """Valid...
stack_v2_sparse_classes_36k_train_009617
24,804
permissive
[ { "docstring": "Validate the requested data partitions. Check that all the partitions defined in the ``working_partitions`` of the associated ``data_source`` (e.g. years or states) have been assigned in the definition of the class, and that the requested values are a subset of the allowable values defined by th...
2
stack_v2_sparse_classes_30k_val_000001
Implement the Python class `GenericDatasetSettings` described below. Class description: An abstract pydantic model for generic datasets. Each dataset must specify working partitions. A dataset can have an arbitrary number of partitions. Args: disabled: if true, skip processing this dataset. Method signatures and docs...
Implement the Python class `GenericDatasetSettings` described below. Class description: An abstract pydantic model for generic datasets. Each dataset must specify working partitions. A dataset can have an arbitrary number of partitions. Args: disabled: if true, skip processing this dataset. Method signatures and docs...
6afae8aade053408f23ac4332d5cbb438ab72dc6
<|skeleton|> class GenericDatasetSettings: """An abstract pydantic model for generic datasets. Each dataset must specify working partitions. A dataset can have an arbitrary number of partitions. Args: disabled: if true, skip processing this dataset.""" def validate_partitions(cls, partitions): """Valid...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenericDatasetSettings: """An abstract pydantic model for generic datasets. Each dataset must specify working partitions. A dataset can have an arbitrary number of partitions. Args: disabled: if true, skip processing this dataset.""" def validate_partitions(cls, partitions): """Validate the reque...
the_stack_v2_python_sparse
src/pudl/settings.py
catalyst-cooperative/pudl
train
382
8d13e9e9517feb63f9e3f69015eab608b2de472c
[ "try:\n if self.id is None:\n return self.query.all()\n if self.id is not None and type(self.id) is int and (self.id >= 0):\n return self.query.get(self.id)\nexcept Exception as e:\n return e.__cause__.args[1]", "try:\n db.session.add(self)\n return db.session.commit()\nexcept Excepti...
<|body_start_0|> try: if self.id is None: return self.query.all() if self.id is not None and type(self.id) is int and (self.id >= 0): return self.query.get(self.id) except Exception as e: return e.__cause__.args[1] <|end_body_0|> <|bod...
Using to create a component group [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [description] name {[type]} -- [Name of the component group] order {[type]} -- [Order of the component group] collapsed {[type]} -- [Collapse the group? 0 = No. 1 = Yes. 2 = If a co...
ComponentGroup
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComponentGroup: """Using to create a component group [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [description] name {[type]} -- [Name of the component group] order {[type]} -- [Order of the component group] collapsed {[type]} -- [Collap...
stack_v2_sparse_classes_36k_train_009618
10,042
no_license
[ { "docstring": "Using get all component groups or get a single component group. [description] Keyword Arguments: id {[int]} -- [Component group ID] (default: {None}) Returns: [Information about component(s)] -- [When successed] [Message] -- [When failed]", "name": "get", "signature": "def get(self)" }...
4
stack_v2_sparse_classes_30k_test_000403
Implement the Python class `ComponentGroup` described below. Class description: Using to create a component group [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [description] name {[type]} -- [Name of the component group] order {[type]} -- [Order of the compone...
Implement the Python class `ComponentGroup` described below. Class description: Using to create a component group [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [description] name {[type]} -- [Name of the component group] order {[type]} -- [Order of the compone...
052956e5006f7d274d19a43b061c2fe4a6456cc0
<|skeleton|> class ComponentGroup: """Using to create a component group [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [description] name {[type]} -- [Name of the component group] order {[type]} -- [Order of the component group] collapsed {[type]} -- [Collap...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComponentGroup: """Using to create a component group [description] Extends: db.Model Variables: __tablename__ {str} -- [table name in database] id {[int]} -- [description] name {[type]} -- [Name of the component group] order {[type]} -- [Order of the component group] collapsed {[type]} -- [Collapse the group?...
the_stack_v2_python_sparse
models/components.py
BoTranVan/statuspage
train
0
2e04aaffcde30da03f3a82872653c079825cd4bc
[ "if not sonority_hierarchy and lang == 'en':\n sonority_hierarchy = ['aeiouy', 'lmnrw', 'zvsf', 'bcdgtkpqxhj']\nself.vowels = sonority_hierarchy[0]\nself.phoneme_map = {}\nfor i, level in enumerate(sonority_hierarchy):\n for c in level:\n sonority_level = len(sonority_hierarchy) - i\n self.phone...
<|body_start_0|> if not sonority_hierarchy and lang == 'en': sonority_hierarchy = ['aeiouy', 'lmnrw', 'zvsf', 'bcdgtkpqxhj'] self.vowels = sonority_hierarchy[0] self.phoneme_map = {} for i, level in enumerate(sonority_hierarchy): for c in level: so...
Syllabifies words based on the Sonority Sequencing Principle (SSP). >>> from nltk.tokenize import SyllableTokenizer >>> from nltk import word_tokenize >>> SSP = SyllableTokenizer() >>> SSP.tokenize('justification') ['jus', 'ti', 'fi', 'ca', 'tion'] >>> text = "This is a foobar-like sentence." >>> [SSP.tokenize(token) f...
SyllableTokenizer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "CC-BY-NC-ND-3.0", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyllableTokenizer: """Syllabifies words based on the Sonority Sequencing Principle (SSP). >>> from nltk.tokenize import SyllableTokenizer >>> from nltk import word_tokenize >>> SSP = SyllableTokenizer() >>> SSP.tokenize('justification') ['jus', 'ti', 'fi', 'ca', 'tion'] >>> text = "This is a foob...
stack_v2_sparse_classes_36k_train_009619
7,545
permissive
[ { "docstring": ":param lang: Language parameter, default is English, 'en' :type lang: str :param sonority_hierarchy: Sonority hierarchy according to the Sonority Sequencing Principle. :type sonority_hierarchy: list(str)", "name": "__init__", "signature": "def __init__(self, lang='en', sonority_hierarchy...
4
stack_v2_sparse_classes_30k_train_009316
Implement the Python class `SyllableTokenizer` described below. Class description: Syllabifies words based on the Sonority Sequencing Principle (SSP). >>> from nltk.tokenize import SyllableTokenizer >>> from nltk import word_tokenize >>> SSP = SyllableTokenizer() >>> SSP.tokenize('justification') ['jus', 'ti', 'fi', '...
Implement the Python class `SyllableTokenizer` described below. Class description: Syllabifies words based on the Sonority Sequencing Principle (SSP). >>> from nltk.tokenize import SyllableTokenizer >>> from nltk import word_tokenize >>> SSP = SyllableTokenizer() >>> SSP.tokenize('justification') ['jus', 'ti', 'fi', '...
582e6e35f0e6c984b44ec49dcb8846d9c011d0a8
<|skeleton|> class SyllableTokenizer: """Syllabifies words based on the Sonority Sequencing Principle (SSP). >>> from nltk.tokenize import SyllableTokenizer >>> from nltk import word_tokenize >>> SSP = SyllableTokenizer() >>> SSP.tokenize('justification') ['jus', 'ti', 'fi', 'ca', 'tion'] >>> text = "This is a foob...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SyllableTokenizer: """Syllabifies words based on the Sonority Sequencing Principle (SSP). >>> from nltk.tokenize import SyllableTokenizer >>> from nltk import word_tokenize >>> SSP = SyllableTokenizer() >>> SSP.tokenize('justification') ['jus', 'ti', 'fi', 'ca', 'tion'] >>> text = "This is a foobar-like sente...
the_stack_v2_python_sparse
nltk/tokenize/sonority_sequencing.py
nltk/nltk
train
11,860
b0e8a1584a33bc58489da5e7ee9654aa1857f427
[ "dist_array = np.zeros(basis + 1)\nfor i in range(1, basis + 1):\n dist_array[i] = dist_array[i - 1] + 1.0 / np.power(i + improve_rank, power)\nfor i in range(1, basis + 1):\n dist_array[i] = dist_array[i] / dist_array[basis]\nreturn dist_array", "next_index = 1\np_sum = 0\nif seed is not None:\n random....
<|body_start_0|> dist_array = np.zeros(basis + 1) for i in range(1, basis + 1): dist_array[i] = dist_array[i - 1] + 1.0 / np.power(i + improve_rank, power) for i in range(1, basis + 1): dist_array[i] = dist_array[i] / dist_array[basis] return dist_array <|end_body...
implements functions to get random numbers according to a ZipfMandelbrot distribution
ZipfMandelbrotDistribution
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZipfMandelbrotDistribution: """implements functions to get random numbers according to a ZipfMandelbrot distribution""" def create_zipf_mandelbrot_distribution(basis: int, improve_rank: float, power: float): """Creates a distribution array incl. values following a zipfmandelbrot like...
stack_v2_sparse_classes_36k_train_009620
2,481
permissive
[ { "docstring": "Creates a distribution array incl. values following a zipfmandelbrot like distribution :param basis the number of function names to create :param improve_rank the parameter of the improve rank (also expressed as q) :param power the parameter of the power (also expressed as s)", "name": "crea...
2
null
Implement the Python class `ZipfMandelbrotDistribution` described below. Class description: implements functions to get random numbers according to a ZipfMandelbrot distribution Method signatures and docstrings: - def create_zipf_mandelbrot_distribution(basis: int, improve_rank: float, power: float): Creates a distri...
Implement the Python class `ZipfMandelbrotDistribution` described below. Class description: implements functions to get random numbers according to a ZipfMandelbrot distribution Method signatures and docstrings: - def create_zipf_mandelbrot_distribution(basis: int, improve_rank: float, power: float): Creates a distri...
64ed40242657238e9f1d522d5873173f0b93a30e
<|skeleton|> class ZipfMandelbrotDistribution: """implements functions to get random numbers according to a ZipfMandelbrot distribution""" def create_zipf_mandelbrot_distribution(basis: int, improve_rank: float, power: float): """Creates a distribution array incl. values following a zipfmandelbrot like...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZipfMandelbrotDistribution: """implements functions to get random numbers according to a ZipfMandelbrot distribution""" def create_zipf_mandelbrot_distribution(basis: int, improve_rank: float, power: float): """Creates a distribution array incl. values following a zipfmandelbrot like distribution...
the_stack_v2_python_sparse
PiCN/Simulations/MobilitySimulations/Helper/ConsumerDistributionHelper.py
cn-uofbasel/PiCN
train
19
c896618aad651d6ffb8ebff247c3d45e5b85bffe
[ "result_flag = self.check_element_displayed(self.home_footer_div)\nif result_flag == True:\n self.switch_page('dunzo main page')\nreturn result_flag", "result_flag = self.check_element_displayed(self.redirect_footer_div)\nif result_flag == True:\n self.switch_page('dunzo main page')\nreturn result_flag" ]
<|body_start_0|> result_flag = self.check_element_displayed(self.home_footer_div) if result_flag == True: self.switch_page('dunzo main page') return result_flag <|end_body_0|> <|body_start_1|> result_flag = self.check_element_displayed(self.redirect_footer_div) if re...
Page Object for the header class
Dunzo_Footer_Object
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dunzo_Footer_Object: """Page Object for the header class""" def check_home_page_footer_div(self): """Check whether proceed button is present""" <|body_0|> def check_redirect_page_footer_div(self): """Check whether proceed button is present""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_009621
1,048
permissive
[ { "docstring": "Check whether proceed button is present", "name": "check_home_page_footer_div", "signature": "def check_home_page_footer_div(self)" }, { "docstring": "Check whether proceed button is present", "name": "check_redirect_page_footer_div", "signature": "def check_redirect_page...
2
stack_v2_sparse_classes_30k_train_002952
Implement the Python class `Dunzo_Footer_Object` described below. Class description: Page Object for the header class Method signatures and docstrings: - def check_home_page_footer_div(self): Check whether proceed button is present - def check_redirect_page_footer_div(self): Check whether proceed button is present
Implement the Python class `Dunzo_Footer_Object` described below. Class description: Page Object for the header class Method signatures and docstrings: - def check_home_page_footer_div(self): Check whether proceed button is present - def check_redirect_page_footer_div(self): Check whether proceed button is present <...
b905baaad68982230f8f5f6bfbd41043e6cade26
<|skeleton|> class Dunzo_Footer_Object: """Page Object for the header class""" def check_home_page_footer_div(self): """Check whether proceed button is present""" <|body_0|> def check_redirect_page_footer_div(self): """Check whether proceed button is present""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dunzo_Footer_Object: """Page Object for the header class""" def check_home_page_footer_div(self): """Check whether proceed button is present""" result_flag = self.check_element_displayed(self.home_footer_div) if result_flag == True: self.switch_page('dunzo main page') ...
the_stack_v2_python_sparse
page_objects/dunzo_footer_object.py
Rajkumar-94/DunzoTest
train
0
ceca416be9714fd67227db40d9b7c4ea2b18ac6e
[ "super().__init__(*args, **kwargs)\ninput_size = sum((x.output_size for x in self._input_layers))\noutput_size = self.output_size\nself.hidden_state_index = self._network.add_recurrent_state(output_size)\nnum_gates = 2\nself._init_weight('layer_input/W', (input_size, output_size), scale=0.01, count=num_gates + 1)\n...
<|body_start_0|> super().__init__(*args, **kwargs) input_size = sum((x.output_size for x in self._input_layers)) output_size = self.output_size self.hidden_state_index = self._network.add_recurrent_state(output_size) num_gates = 2 self._init_weight('layer_input/W', (input...
Gated Recurrent Unit Layer K. Cho et al. (2014) Learning Phrase Representations Using RNN Encoder-Decoder for Statistical Machine Translation Proc. 2014 Conference on Empiricial Methods in Natural Language Processing
GRULayer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRULayer: """Gated Recurrent Unit Layer K. Cho et al. (2014) Learning Phrase Representations Using RNN Encoder-Decoder for Statistical Machine Translation Proc. 2014 Conference on Empiricial Methods in Natural Language Processing""" def __init__(self, *args, **kwargs): """Initializes...
stack_v2_sparse_classes_36k_train_009622
8,227
permissive
[ { "docstring": "Initializes the parameters used by this layer. The weight matrices are concatenated so that they can be applied in a single parallel matrix operation. The same thing for bias vectors.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Crea...
3
stack_v2_sparse_classes_30k_train_000484
Implement the Python class `GRULayer` described below. Class description: Gated Recurrent Unit Layer K. Cho et al. (2014) Learning Phrase Representations Using RNN Encoder-Decoder for Statistical Machine Translation Proc. 2014 Conference on Empiricial Methods in Natural Language Processing Method signatures and docst...
Implement the Python class `GRULayer` described below. Class description: Gated Recurrent Unit Layer K. Cho et al. (2014) Learning Phrase Representations Using RNN Encoder-Decoder for Statistical Machine Translation Proc. 2014 Conference on Empiricial Methods in Natural Language Processing Method signatures and docst...
9904faec19ad5718470f21927229aad2656e5686
<|skeleton|> class GRULayer: """Gated Recurrent Unit Layer K. Cho et al. (2014) Learning Phrase Representations Using RNN Encoder-Decoder for Statistical Machine Translation Proc. 2014 Conference on Empiricial Methods in Natural Language Processing""" def __init__(self, *args, **kwargs): """Initializes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GRULayer: """Gated Recurrent Unit Layer K. Cho et al. (2014) Learning Phrase Representations Using RNN Encoder-Decoder for Statistical Machine Translation Proc. 2014 Conference on Empiricial Methods in Natural Language Processing""" def __init__(self, *args, **kwargs): """Initializes the paramete...
the_stack_v2_python_sparse
theanolm/network/grulayer.py
senarvi/theanolm
train
95
5ba3a40d6245f60dcfc77b134f8d642455f5019b
[ "with h5py.File(image_file, swmr=True) as handle:\n name = nxmx.h5str(FormatNXmx.get_instrument_name(handle))\nif name and 'I19-2' in name:\n return True\nreturn False", "dynamic_shadowing = kwargs.get('dynamic_shadowing', False)\nif dynamic_shadowing in (Auto, 'Auto'):\n return False\nreturn dynamic_sha...
<|body_start_0|> with h5py.File(image_file, swmr=True) as handle: name = nxmx.h5str(FormatNXmx.get_instrument_name(handle)) if name and 'I19-2' in name: return True return False <|end_body_0|> <|body_start_1|> dynamic_shadowing = kwargs.get('dynamic_shadowing', F...
Read NXmx-flavour data from beamline I19-2 at Diamond Light Source. Include the option of dynamic shadowing of the standard I19-2 diamond anvil pressure cell with a 76° conical aperture.
FormatNXmxDLSI19_2
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormatNXmxDLSI19_2: """Read NXmx-flavour data from beamline I19-2 at Diamond Light Source. Include the option of dynamic shadowing of the standard I19-2 diamond anvil pressure cell with a 76° conical aperture.""" def understand(image_file): """This format class applies if the instrum...
stack_v2_sparse_classes_36k_train_009623
1,932
permissive
[ { "docstring": "This format class applies if the instrument name contains 'I19-2'.", "name": "understand", "signature": "def understand(image_file)" }, { "docstring": "Check if dynamic shadowing should be applied for a diamond anvil cell.", "name": "has_dynamic_shadowing", "signature": "...
4
null
Implement the Python class `FormatNXmxDLSI19_2` described below. Class description: Read NXmx-flavour data from beamline I19-2 at Diamond Light Source. Include the option of dynamic shadowing of the standard I19-2 diamond anvil pressure cell with a 76° conical aperture. Method signatures and docstrings: - def underst...
Implement the Python class `FormatNXmxDLSI19_2` described below. Class description: Read NXmx-flavour data from beamline I19-2 at Diamond Light Source. Include the option of dynamic shadowing of the standard I19-2 diamond anvil pressure cell with a 76° conical aperture. Method signatures and docstrings: - def underst...
2fc8ffadbf67d0611e2d7affcf50d0f23abfc16f
<|skeleton|> class FormatNXmxDLSI19_2: """Read NXmx-flavour data from beamline I19-2 at Diamond Light Source. Include the option of dynamic shadowing of the standard I19-2 diamond anvil pressure cell with a 76° conical aperture.""" def understand(image_file): """This format class applies if the instrum...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormatNXmxDLSI19_2: """Read NXmx-flavour data from beamline I19-2 at Diamond Light Source. Include the option of dynamic shadowing of the standard I19-2 diamond anvil pressure cell with a 76° conical aperture.""" def understand(image_file): """This format class applies if the instrument name cont...
the_stack_v2_python_sparse
src/dxtbx/format/FormatNXmxDLSI19_2.py
cctbx/dxtbx
train
2
1d146e3999b4b737aa0b6d1404cbbc092ba0a4d5
[ "result = set()\nfor this in cls.__mro__:\n result |= set(getattr(this, name, []))\nreturn result", "include = cls._Collect('_CV_INCLUDE')\nexclude = cls._Collect('_CV_EXCLUDE')\nresult = {}\nfor name in dir(cls):\n if name in include:\n result[name] = getattr(cls, name)\n continue\n if nam...
<|body_start_0|> result = set() for this in cls.__mro__: result |= set(getattr(this, name, [])) return result <|end_body_0|> <|body_start_1|> include = cls._Collect('_CV_INCLUDE') exclude = cls._Collect('_CV_EXCLUDE') result = {} for name in dir(cls):...
Base class for all objects, providing methods for debugging.
Debuggable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Debuggable: """Base class for all objects, providing methods for debugging.""" def _Collect(cls, name): """Merge sets from the specified variable across the MRO chain.""" <|body_0|> def CV(cls): """Get dict of class variables (for debugging).""" <|body_1|...
stack_v2_sparse_classes_36k_train_009624
2,997
no_license
[ { "docstring": "Merge sets from the specified variable across the MRO chain.", "name": "_Collect", "signature": "def _Collect(cls, name)" }, { "docstring": "Get dict of class variables (for debugging).", "name": "CV", "signature": "def CV(cls)" }, { "docstring": "Get dict of inst...
3
stack_v2_sparse_classes_30k_train_011153
Implement the Python class `Debuggable` described below. Class description: Base class for all objects, providing methods for debugging. Method signatures and docstrings: - def _Collect(cls, name): Merge sets from the specified variable across the MRO chain. - def CV(cls): Get dict of class variables (for debugging)....
Implement the Python class `Debuggable` described below. Class description: Base class for all objects, providing methods for debugging. Method signatures and docstrings: - def _Collect(cls, name): Merge sets from the specified variable across the MRO chain. - def CV(cls): Get dict of class variables (for debugging)....
1a6471dfbd7ec27f3d9f42b49173d18761a8f5aa
<|skeleton|> class Debuggable: """Base class for all objects, providing methods for debugging.""" def _Collect(cls, name): """Merge sets from the specified variable across the MRO chain.""" <|body_0|> def CV(cls): """Get dict of class variables (for debugging).""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Debuggable: """Base class for all objects, providing methods for debugging.""" def _Collect(cls, name): """Merge sets from the specified variable across the MRO chain.""" result = set() for this in cls.__mro__: result |= set(getattr(this, name, [])) return resu...
the_stack_v2_python_sparse
fwgnss/debuggable.py
fhgwright/fwgnss
train
2
2d1d7c49f1125fc47c1b6192eaaa7a29beb93adc
[ "self.df = df\nself.informative_columns = config.informative_column\nself.ignore_regexes = config.clusterer.tokenizer.preprocessor.ignore_line_regex_matcher\nself.search_regexes = config.clusterer.tokenizer.preprocessor.search_line_regex_matcher\nself.ignore_word_regexes = config.clusterer.tokenizer.preprocessor.ig...
<|body_start_0|> self.df = df self.informative_columns = config.informative_column self.ignore_regexes = config.clusterer.tokenizer.preprocessor.ignore_line_regex_matcher self.search_regexes = config.clusterer.tokenizer.preprocessor.search_line_regex_matcher self.ignore_word_rege...
Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer.
Preprocessor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Preprocessor: """Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer.""" def __init__(self, df, config, output_column_name): """Initializes necessary information for preprocessor. Preconditions: config contains a not None field cl...
stack_v2_sparse_classes_36k_train_009625
4,562
no_license
[ { "docstring": "Initializes necessary information for preprocessor. Preconditions: config contains a not None field clusterer, tokenizer and preprocessor Args: df: pandas dataframe consisting of the exception column, a name column, an errorMessage column and optionally a remoteException column config: config_pb...
5
stack_v2_sparse_classes_30k_train_011050
Implement the Python class `Preprocessor` described below. Class description: Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer. Method signatures and docstrings: - def __init__(self, df, config, output_column_name): Initializes necessary information for preproc...
Implement the Python class `Preprocessor` described below. Class description: Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer. Method signatures and docstrings: - def __init__(self, df, config, output_column_name): Initializes necessary information for preproc...
538bd1d109a8f53f2a756ebb65ba2f20703e5d32
<|skeleton|> class Preprocessor: """Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer.""" def __init__(self, df, config, output_column_name): """Initializes necessary information for preprocessor. Preconditions: config contains a not None field cl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Preprocessor: """Class for preprocessing input data. This data will then be used in the future by tokenizer, and clusterer.""" def __init__(self, df, config, output_column_name): """Initializes necessary information for preprocessor. Preconditions: config contains a not None field clusterer, toke...
the_stack_v2_python_sparse
python/preprocessor.py
googleinterns/stack-trace-classifier
train
0
0c7c692536dc5e58d65661314e16b826ad56779f
[ "kw = super(AssignmentCreateView, self).get_form_kwargs()\nkw.update({'organization': self.request.user.organization})\nreturn kw", "self.object = assignment = form.save(commit=False)\nassignment.editor = self.request.user.talenteditorprofile\nassignment.organization = self.request.user.organization\nassignment.s...
<|body_start_0|> kw = super(AssignmentCreateView, self).get_form_kwargs() kw.update({'organization': self.request.user.organization}) return kw <|end_body_0|> <|body_start_1|> self.object = assignment = form.save(commit=False) assignment.editor = self.request.user.talenteditorpr...
Create a new assignment.
AssignmentCreateView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssignmentCreateView: """Create a new assignment.""" def get_form_kwargs(self): """Pass current user organization to the form.""" <|body_0|> def form_valid(self, form): """Save -- but first same some details.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_009626
28,644
permissive
[ { "docstring": "Pass current user organization to the form.", "name": "get_form_kwargs", "signature": "def get_form_kwargs(self)" }, { "docstring": "Save -- but first same some details.", "name": "form_valid", "signature": "def form_valid(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_003396
Implement the Python class `AssignmentCreateView` described below. Class description: Create a new assignment. Method signatures and docstrings: - def get_form_kwargs(self): Pass current user organization to the form. - def form_valid(self, form): Save -- but first same some details.
Implement the Python class `AssignmentCreateView` described below. Class description: Create a new assignment. Method signatures and docstrings: - def get_form_kwargs(self): Pass current user organization to the form. - def form_valid(self, form): Save -- but first same some details. <|skeleton|> class AssignmentCre...
dc6bc79d450f7e2bdf59cfbcd306d05a736e4db9
<|skeleton|> class AssignmentCreateView: """Create a new assignment.""" def get_form_kwargs(self): """Pass current user organization to the form.""" <|body_0|> def form_valid(self, form): """Save -- but first same some details.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssignmentCreateView: """Create a new assignment.""" def get_form_kwargs(self): """Pass current user organization to the form.""" kw = super(AssignmentCreateView, self).get_form_kwargs() kw.update({'organization': self.request.user.organization}) return kw def form_va...
the_stack_v2_python_sparse
project/editorial/views/contractors.py
ProjectFacet/facet
train
25
30cc8da777a83a5cf7ad3ae3568251cea9ad4b3a
[ "with tables(db.engine, 'bams') as (con, bams):\n q = select(bams.c).order_by(desc(bams.c.id))\n return [dict(r) for r in con.execute(q).fetchall()]", "try:\n expect_one_of(request.validated_body, 'project_name', 'project_id')\nexcept voluptuous.MultipleInvalid as e:\n errors = [str(err) for err in e....
<|body_start_0|> with tables(db.engine, 'bams') as (con, bams): q = select(bams.c).order_by(desc(bams.c.id)) return [dict(r) for r in con.execute(q).fetchall()] <|end_body_0|> <|body_start_1|> try: expect_one_of(request.validated_body, 'project_name', 'project_id') ...
BamList
[ "Apache-2.0", "CC-BY-3.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BamList: def get(self): """Get list of all BAMs.""" <|body_0|> def post(self): """Create a new BAM.""" <|body_1|> <|end_skeleton|> <|body_start_0|> with tables(db.engine, 'bams') as (con, bams): q = select(bams.c).order_by(desc(bams.c.id...
stack_v2_sparse_classes_36k_train_009627
4,466
permissive
[ { "docstring": "Get list of all BAMs.", "name": "get", "signature": "def get(self)" }, { "docstring": "Create a new BAM.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_000128
Implement the Python class `BamList` described below. Class description: Implement the BamList class. Method signatures and docstrings: - def get(self): Get list of all BAMs. - def post(self): Create a new BAM.
Implement the Python class `BamList` described below. Class description: Implement the BamList class. Method signatures and docstrings: - def get(self): Get list of all BAMs. - def post(self): Create a new BAM. <|skeleton|> class BamList: def get(self): """Get list of all BAMs.""" <|body_0|> ...
a436c4fc212e4429fb5196a9a4d36c37bd050c52
<|skeleton|> class BamList: def get(self): """Get list of all BAMs.""" <|body_0|> def post(self): """Create a new BAM.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BamList: def get(self): """Get list of all BAMs.""" with tables(db.engine, 'bams') as (con, bams): q = select(bams.c).order_by(desc(bams.c.id)) return [dict(r) for r in con.execute(q).fetchall()] def post(self): """Create a new BAM.""" try: ...
the_stack_v2_python_sparse
cycledash/api/bams.py
haoziyeung/cycledash
train
0
8c56b367b61a20a8d53d5602010377710436d5a1
[ "super(FixupConv2D, self).__init__()\nif initialW is None:\n initialW = I.Zero()\nwith self.init_scope():\n self.conv = L.Convolution2D(in_channels, out_channels, ksize=ksize, stride=stride, pad=pad, nobias=nobias, initialW=initialW, initial_bias=initial_bias, dilate=dilate, groups=groups)\n self.bias_in =...
<|body_start_0|> super(FixupConv2D, self).__init__() if initialW is None: initialW = I.Zero() with self.init_scope(): self.conv = L.Convolution2D(in_channels, out_channels, ksize=ksize, stride=stride, pad=pad, nobias=nobias, initialW=initialW, initial_bias=initial_bias, d...
Wraps Convolution2D by Fixup. Fixup works by adding a scalar bias to the input of convolution, optionally multiplying its output by another scalar multiplier, and then adding another bias scalar term. The final result might be passed through an activation func.
FixupConv2D
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FixupConv2D: """Wraps Convolution2D by Fixup. Fixup works by adding a scalar bias to the input of convolution, optionally multiplying its output by another scalar multiplier, and then adding another bias scalar term. The final result might be passed through an activation func.""" def __init_...
stack_v2_sparse_classes_36k_train_009628
2,394
permissive
[ { "docstring": "CTOR.", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, ksize=None, stride=1, pad=0, dilate=1, groups=1, nobias=True, initialW=None, initial_bias=None, use_scale=True, activ=F.relu)" }, { "docstring": "forward", "name": "forward", "signatur...
2
stack_v2_sparse_classes_30k_train_015534
Implement the Python class `FixupConv2D` described below. Class description: Wraps Convolution2D by Fixup. Fixup works by adding a scalar bias to the input of convolution, optionally multiplying its output by another scalar multiplier, and then adding another bias scalar term. The final result might be passed through ...
Implement the Python class `FixupConv2D` described below. Class description: Wraps Convolution2D by Fixup. Fixup works by adding a scalar bias to the input of convolution, optionally multiplying its output by another scalar multiplier, and then adding another bias scalar term. The final result might be passed through ...
0ca435433b9953e33656173c4d60ebd61c5c5e87
<|skeleton|> class FixupConv2D: """Wraps Convolution2D by Fixup. Fixup works by adding a scalar bias to the input of convolution, optionally multiplying its output by another scalar multiplier, and then adding another bias scalar term. The final result might be passed through an activation func.""" def __init_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FixupConv2D: """Wraps Convolution2D by Fixup. Fixup works by adding a scalar bias to the input of convolution, optionally multiplying its output by another scalar multiplier, and then adding another bias scalar term. The final result might be passed through an activation func.""" def __init__(self, in_ch...
the_stack_v2_python_sparse
chainerlp/links/connection/fixup_conv2d.py
MetaVai/gradient-scaling
train
0
e3d7b45929ca8c2259b96d2232cb33720c432919
[ "if os.path.isfile(filename):\n logger.info('Loading configuration from %s.', filename)\n with open(filename, 'r') as f:\n y = load(f)\n if not isinstance(y, dict):\n logger.warning('Improperly formatted configuration file.')\n else:\n return cls(**y)\nelse:\n log...
<|body_start_0|> if os.path.isfile(filename): logger.info('Loading configuration from %s.', filename) with open(filename, 'r') as f: y = load(f) if not isinstance(y, dict): logger.warning('Improperly formatted configuration file.') ...
Main server configuration.
Config
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Config: """Main server configuration.""" def load(cls, filename): """Return a fully-loaded Config instance.""" <|body_0|> def dump(self, filename): """Dump configuration to disk.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if os.path.isfile(...
stack_v2_sparse_classes_36k_train_009629
1,617
no_license
[ { "docstring": "Return a fully-loaded Config instance.", "name": "load", "signature": "def load(cls, filename)" }, { "docstring": "Dump configuration to disk.", "name": "dump", "signature": "def dump(self, filename)" } ]
2
stack_v2_sparse_classes_30k_val_000512
Implement the Python class `Config` described below. Class description: Main server configuration. Method signatures and docstrings: - def load(cls, filename): Return a fully-loaded Config instance. - def dump(self, filename): Dump configuration to disk.
Implement the Python class `Config` described below. Class description: Main server configuration. Method signatures and docstrings: - def load(cls, filename): Return a fully-loaded Config instance. - def dump(self, filename): Dump configuration to disk. <|skeleton|> class Config: """Main server configuration.""...
53ed7ba0cb9153ef7e4d340bb38f7bf9a3b73975
<|skeleton|> class Config: """Main server configuration.""" def load(cls, filename): """Return a fully-loaded Config instance.""" <|body_0|> def dump(self, filename): """Dump configuration to disk.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Config: """Main server configuration.""" def load(cls, filename): """Return a fully-loaded Config instance.""" if os.path.isfile(filename): logger.info('Loading configuration from %s.', filename) with open(filename, 'r') as f: y = load(f) ...
the_stack_v2_python_sparse
config.py
chrisnorman7/mwm
train
0
c085289f31151cb3b8ae782250141b9d4c00732e
[ "context = super().get_context_data(**kwargs)\ncontext['n_responses'] = len(context['study'].responses.all())\nreturn context", "output, writer = self.csv_output_and_writer()\nwriter.writerow(self.get_csv_headers())\nfor resp in responses:\n writer.writerow(self.csv_row_data(resp))\nreturn output.getvalue()" ]
<|body_start_0|> context = super().get_context_data(**kwargs) context['n_responses'] = len(context['study'].responses.all()) return context <|end_body_0|> <|body_start_1|> output, writer = self.csv_output_and_writer() writer.writerow(self.get_csv_headers()) for resp in r...
StudyResponsesAll shows all study responses in JSON and CSV format. Either format can be downloaded
StudyResponsesAll
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudyResponsesAll: """StudyResponsesAll shows all study responses in JSON and CSV format. Either format can be downloaded""" def get_context_data(self, **kwargs): """In addition to the study, adds several items to the context dictionary. Study results are paginated.""" <|body...
stack_v2_sparse_classes_36k_train_009630
34,217
permissive
[ { "docstring": "In addition to the study, adds several items to the context dictionary. Study results are paginated.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Builds CSV file contents for all responses", "name": "build_all_csv", ...
2
stack_v2_sparse_classes_30k_train_018375
Implement the Python class `StudyResponsesAll` described below. Class description: StudyResponsesAll shows all study responses in JSON and CSV format. Either format can be downloaded Method signatures and docstrings: - def get_context_data(self, **kwargs): In addition to the study, adds several items to the context d...
Implement the Python class `StudyResponsesAll` described below. Class description: StudyResponsesAll shows all study responses in JSON and CSV format. Either format can be downloaded Method signatures and docstrings: - def get_context_data(self, **kwargs): In addition to the study, adds several items to the context d...
621fbb8b25100a21fd94721d39003b5d4f651dc5
<|skeleton|> class StudyResponsesAll: """StudyResponsesAll shows all study responses in JSON and CSV format. Either format can be downloaded""" def get_context_data(self, **kwargs): """In addition to the study, adds several items to the context dictionary. Study results are paginated.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StudyResponsesAll: """StudyResponsesAll shows all study responses in JSON and CSV format. Either format can be downloaded""" def get_context_data(self, **kwargs): """In addition to the study, adds several items to the context dictionary. Study results are paginated.""" context = super().g...
the_stack_v2_python_sparse
exp/views/study.py
enrobyn/lookit-api
train
0
39ec904b209ac1263abcd6a99fb489bc874cdea1
[ "if handler_config is None:\n raise CSVFileToSQLHandlerError('None passed as handler config.')\nself.name = handler_config[CONFIG_NAME]\nself.source = handler_config[CONFIG_SOURCE]\nself.exitonfailure = handler_config[CONFIG_EXITONFAILURE]\nself.recursive = handler_config[CONFIG_RECURSIVE]\nself.delete_source = ...
<|body_start_0|> if handler_config is None: raise CSVFileToSQLHandlerError('None passed as handler config.') self.name = handler_config[CONFIG_NAME] self.source = handler_config[CONFIG_SOURCE] self.exitonfailure = handler_config[CONFIG_EXITONFAILURE] self.recursive = ...
Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object source: Directory to watch for files recursive: Boolean == true perform recursive file ...
CSVFileToSQLHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSVFileToSQLHandler: """Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object source: Directory to watch for files rec...
stack_v2_sparse_classes_36k_train_009631
5,607
permissive
[ { "docstring": "Initialise handler attributes. Args: handler_config (ConfigDict): Handler configuration. Raises: CSVFileToSQLHandlerError: None passed as handler configuration.", "name": "__init__", "signature": "def __init__(self, handler_config: ConfigDict) -> None" }, { "docstring": "Import C...
2
stack_v2_sparse_classes_30k_train_010263
Implement the Python class `CSVFileToSQLHandler` described below. Class description: Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object s...
Implement the Python class `CSVFileToSQLHandler` described below. Class description: Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object s...
abbd95b0ddd9da577b6cad69708f2e31db694d94
<|skeleton|> class CSVFileToSQLHandler: """Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object source: Directory to watch for files rec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSVFileToSQLHandler: """Import CSV file to MySQL database. Read in CSV file and insert/update rows within a given MySQL database/table. If no key attribute is specified then the rows are inserted otherwise updated. Attributes: name : Name of handler object source: Directory to watch for files recursive: Boole...
the_stack_v2_python_sparse
FPE/builtin/csvfile_to_sql_handler.py
clockworkengineer/Constrictor
train
1
d2760002797f79222adf421db8c20444626ffd7a
[ "if len(s) < 2:\n return len(s)\nrecond = dict()\nleft, right = (-1, 0)\nres = 0\nfor right in range(len(s)):\n left = max(left, recond.setdefault(s[right], -1))\n recond[s[right]] = right\n res = max(res, right - left)\nreturn res", "l = len(s)\nif l < 2:\n return l\ndp = [1 for _ in range(l)]\nma...
<|body_start_0|> if len(s) < 2: return len(s) recond = dict() left, right = (-1, 0) res = 0 for right in range(len(s)): left = max(left, recond.setdefault(s[right], -1)) recond[s[right]] = right res = max(res, right - left) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:param s: :return:""" <|body_0|> def lengthOfLongestSubstring1(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) < 2: return len(s) ...
stack_v2_sparse_classes_36k_train_009632
1,657
no_license
[ { "docstring": ":param s: :return:", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring1", "signature": "def lengthOfLongestSubstring1(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :param s: :return: - def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :param s: :return: - def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def lengthOfLonges...
70b7a0f031ef4bc1b04ae787ac1fd78f2f25a04d
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:param s: :return:""" <|body_0|> def lengthOfLongestSubstring1(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLongestSubstring(self, s): """:param s: :return:""" if len(s) < 2: return len(s) recond = dict() left, right = (-1, 0) res = 0 for right in range(len(s)): left = max(left, recond.setdefault(s[right], -1)) ...
the_stack_v2_python_sparse
1--20/03lengthOfLongestSubstring.py
tzhou2018/LeetCode
train
6
ff5b2f99ecc05cc92fd9076a0e778347c379d6ff
[ "if context is None:\n context = {}\nres = super(stock_picking_merge, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)\nif context.get('active_model', '') == 'stock.picking' and len(context['active_ids']) < 2:\n raise osv.except_osv(_('Warni...
<|body_start_0|> if context is None: context = {} res = super(stock_picking_merge, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) if context.get('active_model', '') == 'stock.picking' and len(context['active_ids']...
stock_picking_merge
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class stock_picking_merge: def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context...
stack_v2_sparse_classes_36k_train_009633
2,342
no_license
[ { "docstring": "Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard dictionary @return: New arch of view.", "name": "fields_view_get", "signature": "def fields_view_get(self, cr, uid, view_id...
2
null
Implement the Python class `stock_picking_merge` described below. Class description: Implement the stock_picking_merge class. Method signatures and docstrings: - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): Changes the view dynamically @param self: Th...
Implement the Python class `stock_picking_merge` described below. Class description: Implement the stock_picking_merge class. Method signatures and docstrings: - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): Changes the view dynamically @param self: Th...
af1bcf7b77a3212bc8a8a0e41e6042a134587ed4
<|skeleton|> class stock_picking_merge: def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class stock_picking_merge: def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): """Changes the view dynamically @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param context: A standard d...
the_stack_v2_python_sparse
dym_stock/wizard/dym_stock_picking_merge.py
Rizalimami/dym
train
0
19254201cbd0e978e06f94ee7994df89238e69f3
[ "index_m = m - 1\nindex_n = n - 1\nwhile index_m >= 0 and index_n >= 0:\n if nums1[index_m] >= nums2[index_n]:\n nums1[index_m + index_n + 1] = nums1[index_m]\n index_m -= 1\n else:\n nums1[index_m + index_n + 1] = nums2[index_n]\n index_n -= 1\nwhile index_n >= 0:\n nums1[index...
<|body_start_0|> index_m = m - 1 index_n = n - 1 while index_m >= 0 and index_n >= 0: if nums1[index_m] >= nums2[index_n]: nums1[index_m + index_n + 1] = nums1[index_m] index_m -= 1 else: nums1[index_m + index_n + 1] = nums2...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge(self, nums1, m, nums2, n): """:type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge_v2(self, nums1, m, nums2, n): """:type nums1: List[in...
stack_v2_sparse_classes_36k_train_009634
2,568
no_license
[ { "docstring": ":type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.", "name": "merge", "signature": "def merge(self, nums1, m, nums2, n)" }, { "docstring": ":type nums1: List[int] :type m: int :type nums2: Li...
2
stack_v2_sparse_classes_30k_test_000758
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, nums1, m, nums2, n): :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead. -...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge(self, nums1, m, nums2, n): :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead. -...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def merge(self, nums1, m, nums2, n): """:type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.""" <|body_0|> def merge_v2(self, nums1, m, nums2, n): """:type nums1: List[in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def merge(self, nums1, m, nums2, n): """:type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do not return anything, modify nums1 in-place instead.""" index_m = m - 1 index_n = n - 1 while index_m >= 0 and index_n >= 0: if n...
the_stack_v2_python_sparse
src/lt_88.py
oxhead/CodingYourWay
train
0
c5c47cab7df8d58eb8cd6c128e2fed1b6a804f68
[ "if self.state_model.op_state in [DevState.FAULT, DevState.UNKNOWN]:\n tango.Except.throw_exception(f'Command TelescopeOn is not allowed in current state {self.state_model.op_state}.', 'Failed to invoke On command on CspMasterLeafNode.', 'SdpMasterLeafNode.TelescopeOn()', tango.ErrSeverity.ERR)\nreturn True", ...
<|body_start_0|> if self.state_model.op_state in [DevState.FAULT, DevState.UNKNOWN]: tango.Except.throw_exception(f'Command TelescopeOn is not allowed in current state {self.state_model.op_state}.', 'Failed to invoke On command on CspMasterLeafNode.', 'SdpMasterLeafNode.TelescopeOn()', tango.ErrSeve...
A class for TelescopeOn() command of SDP Master Leaf Node. TelescopeOn command is inherited from BaseCommand. Informs the SDP that it can start executing Processing Blocks. Sets the State to ON.
TelescopeOn
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TelescopeOn: """A class for TelescopeOn() command of SDP Master Leaf Node. TelescopeOn command is inherited from BaseCommand. Informs the SDP that it can start executing Processing Blocks. Sets the State to ON.""" def check_allowed(self): """Checks whether this command is allowed to ...
stack_v2_sparse_classes_36k_train_009635
3,987
permissive
[ { "docstring": "Checks whether this command is allowed to be run in current device state :return: True if this command is allowed to be run in current device state :rtype: boolean :raises: DevFailed if this command is not allowed to be run in current device state", "name": "check_allowed", "signature": ...
3
stack_v2_sparse_classes_30k_train_009067
Implement the Python class `TelescopeOn` described below. Class description: A class for TelescopeOn() command of SDP Master Leaf Node. TelescopeOn command is inherited from BaseCommand. Informs the SDP that it can start executing Processing Blocks. Sets the State to ON. Method signatures and docstrings: - def check_...
Implement the Python class `TelescopeOn` described below. Class description: A class for TelescopeOn() command of SDP Master Leaf Node. TelescopeOn command is inherited from BaseCommand. Informs the SDP that it can start executing Processing Blocks. Sets the State to ON. Method signatures and docstrings: - def check_...
7ee65a9c8dada9b28893144b372a398bd0646195
<|skeleton|> class TelescopeOn: """A class for TelescopeOn() command of SDP Master Leaf Node. TelescopeOn command is inherited from BaseCommand. Informs the SDP that it can start executing Processing Blocks. Sets the State to ON.""" def check_allowed(self): """Checks whether this command is allowed to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TelescopeOn: """A class for TelescopeOn() command of SDP Master Leaf Node. TelescopeOn command is inherited from BaseCommand. Informs the SDP that it can start executing Processing Blocks. Sets the State to ON.""" def check_allowed(self): """Checks whether this command is allowed to be run in cur...
the_stack_v2_python_sparse
temp_src/ska_tmc_sdpmasterleafnode_mid/telescope_on_command.py
ska-telescope/tmc-prototype
train
4
2bf90557332ae5377ada7992d99bf609718b6fc6
[ "request_data = request.GET\nraid = request_data.get('raid', '')\nwcl_code = request_data.get('code', '')\npage = request_data.get('page', 1)\nper_page = request_data.get('per_page', 5)\nwcl_log_restful_list, msg = BaseService.get_log_list(raid=raid, code=wcl_code, page=page, per_page=per_page)\nif wcl_log_restful_...
<|body_start_0|> request_data = request.GET raid = request_data.get('raid', '') wcl_code = request_data.get('code', '') page = request_data.get('page', 1) per_page = request_data.get('per_page', 5) wcl_log_restful_list, msg = BaseService.get_log_list(raid=raid, code=wcl_c...
LogListView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogListView: def get(self, request, *args, **kwargs): """获取日志列表 :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """新增日志 :param request: :param args: :param kwargs: :return:""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_009636
3,235
permissive
[ { "docstring": "获取日志列表 :param request: :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "新增日志 :param request: :param args: :param kwargs: :return:", "name": "post", "signature": "def post(self, request, *args, ...
2
stack_v2_sparse_classes_30k_train_011082
Implement the Python class `LogListView` described below. Class description: Implement the LogListView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取日志列表 :param request: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): 新增日志 :param request: :param...
Implement the Python class `LogListView` described below. Class description: Implement the LogListView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): 获取日志列表 :param request: :param args: :param kwargs: :return: - def post(self, request, *args, **kwargs): 新增日志 :param request: :param...
9a014512831e978f7904dd71de3aa1c27b5b7f7a
<|skeleton|> class LogListView: def get(self, request, *args, **kwargs): """获取日志列表 :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """新增日志 :param request: :param args: :param kwargs: :return:""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogListView: def get(self, request, *args, **kwargs): """获取日志列表 :param request: :param args: :param kwargs: :return:""" request_data = request.GET raid = request_data.get('raid', '') wcl_code = request_data.get('code', '') page = request_data.get('page', 1) per_...
the_stack_v2_python_sparse
api/views.py
zhoufan170/wcl_analysis
train
3
c934d4dab89d877b173c1f1e222ddf0aaccaa7c9
[ "members = obj.get_members()\nserializer = MemberSerializer(members, many=True)\nreturn serializer.data", "if 'start_time' in data and 'end_time' in data:\n if data['start_time'] >= data['end_time']:\n raise serializers.ValidationError(gs.START_AFTER_END_TIME)\nreturn super(CourseSerializer, self).valid...
<|body_start_0|> members = obj.get_members() serializer = MemberSerializer(members, many=True) return serializer.data <|end_body_0|> <|body_start_1|> if 'start_time' in data and 'end_time' in data: if data['start_time'] >= data['end_time']: raise serializers....
CourseSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseSerializer: def get_members(self, obj): """Returns current members of this course by querying active subscriptions and returning the related members :param obj: the instance of this Course model :return: serialized data for the field members""" <|body_0|> def validate(...
stack_v2_sparse_classes_36k_train_009637
18,716
no_license
[ { "docstring": "Returns current members of this course by querying active subscriptions and returning the related members :param obj: the instance of this Course model :return: serialized data for the field members", "name": "get_members", "signature": "def get_members(self, obj)" }, { "docstrin...
2
stack_v2_sparse_classes_30k_train_020799
Implement the Python class `CourseSerializer` described below. Class description: Implement the CourseSerializer class. Method signatures and docstrings: - def get_members(self, obj): Returns current members of this course by querying active subscriptions and returning the related members :param obj: the instance of ...
Implement the Python class `CourseSerializer` described below. Class description: Implement the CourseSerializer class. Method signatures and docstrings: - def get_members(self, obj): Returns current members of this course by querying active subscriptions and returning the related members :param obj: the instance of ...
88c51e6216fadcb8369170dca4450563333e4b31
<|skeleton|> class CourseSerializer: def get_members(self, obj): """Returns current members of this course by querying active subscriptions and returning the related members :param obj: the instance of this Course model :return: serialized data for the field members""" <|body_0|> def validate(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CourseSerializer: def get_members(self, obj): """Returns current members of this course by querying active subscriptions and returning the related members :param obj: the instance of this Course model :return: serialized data for the field members""" members = obj.get_members() seriali...
the_stack_v2_python_sparse
restapi/serializer.py
MaximilianFranz/temas-db
train
0
63dcf0216c338d0e247df16e4d3f5ee0f3ddac8a
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the CampaignFeed service. Service to manage campaign feeds.
CampaignFeedServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CampaignFeedServiceServicer: """Proto file describing the CampaignFeed service. Service to manage campaign feeds.""" def GetCampaignFeed(self, request, context): """Returns the requested campaign feed in full detail.""" <|body_0|> def MutateCampaignFeeds(self, request, c...
stack_v2_sparse_classes_36k_train_009638
3,410
permissive
[ { "docstring": "Returns the requested campaign feed in full detail.", "name": "GetCampaignFeed", "signature": "def GetCampaignFeed(self, request, context)" }, { "docstring": "Creates, updates, or removes campaign feeds. Operation statuses are returned.", "name": "MutateCampaignFeeds", "s...
2
stack_v2_sparse_classes_30k_train_014779
Implement the Python class `CampaignFeedServiceServicer` described below. Class description: Proto file describing the CampaignFeed service. Service to manage campaign feeds. Method signatures and docstrings: - def GetCampaignFeed(self, request, context): Returns the requested campaign feed in full detail. - def Muta...
Implement the Python class `CampaignFeedServiceServicer` described below. Class description: Proto file describing the CampaignFeed service. Service to manage campaign feeds. Method signatures and docstrings: - def GetCampaignFeed(self, request, context): Returns the requested campaign feed in full detail. - def Muta...
a5b6cede64f4d9912ae6ad26927a54e40448c9fe
<|skeleton|> class CampaignFeedServiceServicer: """Proto file describing the CampaignFeed service. Service to manage campaign feeds.""" def GetCampaignFeed(self, request, context): """Returns the requested campaign feed in full detail.""" <|body_0|> def MutateCampaignFeeds(self, request, c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CampaignFeedServiceServicer: """Proto file describing the CampaignFeed service. Service to manage campaign feeds.""" def GetCampaignFeed(self, request, context): """Returns the requested campaign feed in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_d...
the_stack_v2_python_sparse
google/ads/google_ads/v4/proto/services/campaign_feed_service_pb2_grpc.py
fiboknacky/google-ads-python
train
0
161dccc492b6da747c3a26392360b25c06096edf
[ "def new_buffer():\n return SegmentationBuffer(capacity, max_seq_len, max_ep_len)\nself.buffers = defaultdict(new_buffer)", "batch = batch.copy()\nbatch = batch.as_multi_agent()\nfor policy_id, sample_batch in batch.policy_batches.items():\n self.buffers[policy_id].add(sample_batch)", "samples = {}\nfor p...
<|body_start_0|> def new_buffer(): return SegmentationBuffer(capacity, max_seq_len, max_ep_len) self.buffers = defaultdict(new_buffer) <|end_body_0|> <|body_start_1|> batch = batch.copy() batch = batch.as_multi_agent() for policy_id, sample_batch in batch.policy_batc...
A minimal replay buffer used by Decision Transformer (DT) to process episodes into max_seq_len length segments and do shuffling. Stores MultiAgentSample.
MultiAgentSegmentationBuffer
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiAgentSegmentationBuffer: """A minimal replay buffer used by Decision Transformer (DT) to process episodes into max_seq_len length segments and do shuffling. Stores MultiAgentSample.""" def __init__(self, capacity: int=20, max_seq_len: int=20, max_ep_len: int=1000): """Args: capa...
stack_v2_sparse_classes_36k_train_009639
7,703
permissive
[ { "docstring": "Args: capacity: Maximum number of episodes the buffer can store. max_seq_len: Length of segments that are sampled. max_ep_len: Maximum length of episodes added.", "name": "__init__", "signature": "def __init__(self, capacity: int=20, max_seq_len: int=20, max_ep_len: int=1000)" }, { ...
3
stack_v2_sparse_classes_30k_train_004394
Implement the Python class `MultiAgentSegmentationBuffer` described below. Class description: A minimal replay buffer used by Decision Transformer (DT) to process episodes into max_seq_len length segments and do shuffling. Stores MultiAgentSample. Method signatures and docstrings: - def __init__(self, capacity: int=2...
Implement the Python class `MultiAgentSegmentationBuffer` described below. Class description: A minimal replay buffer used by Decision Transformer (DT) to process episodes into max_seq_len length segments and do shuffling. Stores MultiAgentSample. Method signatures and docstrings: - def __init__(self, capacity: int=2...
edba68c3e7cf255d1d6479329f305adb7fa4c3ed
<|skeleton|> class MultiAgentSegmentationBuffer: """A minimal replay buffer used by Decision Transformer (DT) to process episodes into max_seq_len length segments and do shuffling. Stores MultiAgentSample.""" def __init__(self, capacity: int=20, max_seq_len: int=20, max_ep_len: int=1000): """Args: capa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiAgentSegmentationBuffer: """A minimal replay buffer used by Decision Transformer (DT) to process episodes into max_seq_len length segments and do shuffling. Stores MultiAgentSample.""" def __init__(self, capacity: int=20, max_seq_len: int=20, max_ep_len: int=1000): """Args: capacity: Maximum...
the_stack_v2_python_sparse
rllib/algorithms/dt/segmentation_buffer.py
ray-project/ray
train
29,482
b2949d5231c56a45587b301ce96e405745632199
[ "obj = self.get_object_or_404(self.single, obj_id)\ndata = self.checked_data(self.validator.validate_update, instance=obj)\ntry:\n self.single.update(obj, data)\nexcept errors.NetworkTemplateCannotBeApplied as exc:\n raise self.http(400, exc.message)\nreturn self.single.to_dict(obj)", "cluster = self.get_ob...
<|body_start_0|> obj = self.get_object_or_404(self.single, obj_id) data = self.checked_data(self.validator.validate_update, instance=obj) try: self.single.update(obj, data) except errors.NetworkTemplateCannotBeApplied as exc: raise self.http(400, exc.message) ...
Cluster single handler
ClusterHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterHandler: """Cluster single handler""" def PUT(self, obj_id): """:returns: JSONized Cluster object. :http: * 200 (OK) * 400 (error occured while processing of data) * 404 (cluster not found in db)""" <|body_0|> def DELETE(self, obj_id): """:returns: {} :htt...
stack_v2_sparse_classes_36k_train_009640
16,652
permissive
[ { "docstring": ":returns: JSONized Cluster object. :http: * 200 (OK) * 400 (error occured while processing of data) * 404 (cluster not found in db)", "name": "PUT", "signature": "def PUT(self, obj_id)" }, { "docstring": ":returns: {} :http: * 202 (cluster deletion process launched) * 400 (failed...
2
stack_v2_sparse_classes_30k_train_021086
Implement the Python class `ClusterHandler` described below. Class description: Cluster single handler Method signatures and docstrings: - def PUT(self, obj_id): :returns: JSONized Cluster object. :http: * 200 (OK) * 400 (error occured while processing of data) * 404 (cluster not found in db) - def DELETE(self, obj_i...
Implement the Python class `ClusterHandler` described below. Class description: Cluster single handler Method signatures and docstrings: - def PUT(self, obj_id): :returns: JSONized Cluster object. :http: * 200 (OK) * 400 (error occured while processing of data) * 404 (cluster not found in db) - def DELETE(self, obj_i...
768ac74a420f822261c4eb8da72f1d8af3c6bbff
<|skeleton|> class ClusterHandler: """Cluster single handler""" def PUT(self, obj_id): """:returns: JSONized Cluster object. :http: * 200 (OK) * 400 (error occured while processing of data) * 404 (cluster not found in db)""" <|body_0|> def DELETE(self, obj_id): """:returns: {} :htt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClusterHandler: """Cluster single handler""" def PUT(self, obj_id): """:returns: JSONized Cluster object. :http: * 200 (OK) * 400 (error occured while processing of data) * 404 (cluster not found in db)""" obj = self.get_object_or_404(self.single, obj_id) data = self.checked_data(...
the_stack_v2_python_sparse
nailgun/nailgun/api/v1/handlers/cluster.py
dis-xcom/fuel-web
train
0
a67e5fde5bf0a4e1aded27b3a2f3c77ad60a7419
[ "if isinstance(gis, GIS):\n self._url = url\n self._gis = gis\n self._portal = gis._portal\n self._con = gis._con\nelse:\n raise ValueError('gis object must be of type GIS')", "url = '%s/clean' % self._url\nparams = {'f': 'json'}\nres = self._con.post(path=url, postdata=params)\nif isinstance(res, ...
<|body_start_0|> if isinstance(gis, GIS): self._url = url self._gis = gis self._portal = gis._portal self._con = gis._con else: raise ValueError('gis object must be of type GIS') <|end_body_0|> <|body_start_1|> url = '%s/clean' % self....
Logs are records written by various components of the portal. You can query the logs, clean the logs, and edit log settings. ================ =============================================================== **Argument** **Description** ---------------- --------------------------------------------------------------- gis ...
Logs
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Logs: """Logs are records written by various components of the portal. You can query the logs, clean the logs, and edit log settings. ================ =============================================================== **Argument** **Description** ---------------- ------------------------------------...
stack_v2_sparse_classes_36k_train_009641
10,658
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, url, gis)" }, { "docstring": "Deletes all the log files on the machine hosting Portal for ArcGIS. This operation allows you to free up disk space. The logs cannot be recovered after executing this operation. .. co...
5
stack_v2_sparse_classes_30k_train_014001
Implement the Python class `Logs` described below. Class description: Logs are records written by various components of the portal. You can query the logs, clean the logs, and edit log settings. ================ =============================================================== **Argument** **Description** --------------...
Implement the Python class `Logs` described below. Class description: Logs are records written by various components of the portal. You can query the logs, clean the logs, and edit log settings. ================ =============================================================== **Argument** **Description** --------------...
a874fe7e5c95196e4de68db2da0e2a05eb70e5d8
<|skeleton|> class Logs: """Logs are records written by various components of the portal. You can query the logs, clean the logs, and edit log settings. ================ =============================================================== **Argument** **Description** ---------------- ------------------------------------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Logs: """Logs are records written by various components of the portal. You can query the logs, clean the logs, and edit log settings. ================ =============================================================== **Argument** **Description** ---------------- -------------------------------------------------...
the_stack_v2_python_sparse
arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/gis/admin/_logs.py
SherbazHashmi/HackathonServer
train
3
7127f8e56a9f4060613a116eaeec1a16e84b20c4
[ "if x < 0 or (x is not 0 and x % 10 is 0):\n return False\nr = 0\nwhile x > r:\n r = r * 10 + x % 10\n x //= 10\nreturn x == r or x == r // 10", "if x < 0:\n return False\nreturn x == int(str(x)[::-1])" ]
<|body_start_0|> if x < 0 or (x is not 0 and x % 10 is 0): return False r = 0 while x > r: r = r * 10 + x % 10 x //= 10 return x == r or x == r // 10 <|end_body_0|> <|body_start_1|> if x < 0: return False return x == int(st...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome2(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0 or (x is not 0 and x % 10 is 0): return Fal...
stack_v2_sparse_classes_36k_train_009642
643
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome2", "signature": "def isPalindrome2(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_015995
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome2(self, x): :type x: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome2(self, x): :type x: int :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, x): ...
3ac66a1bf85a344234c746ebf3de30e643838e5f
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome2(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" if x < 0 or (x is not 0 and x % 10 is 0): return False r = 0 while x > r: r = r * 10 + x % 10 x //= 10 return x == r or x == r // 10 def isPalindrome2(self, x):...
the_stack_v2_python_sparse
9. Palindrome Number/9.py
JohnHuiWB/leetcode
train
0
571307be1e1d20222afe3cbe4527af5fcb38f445
[ "try:\n return Member.objects.get(pk=pk)\nexcept Member.DoesNotExist:\n raise Http404", "if pk is not None:\n member = self.get_member(int(pk))\nelse:\n member = None\nself.check_object_permissions(request, member)\nloans = Loan.get_members_loans(member)\nserializer = LoanSerializer(loans, many=True)\...
<|body_start_0|> try: return Member.objects.get(pk=pk) except Member.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> if pk is not None: member = self.get_member(int(pk)) else: member = None self.check_object_permissions...
LoansView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoansView: def get_member(self, pk): """Get a member.""" <|body_0|> def get(self, request, pk, format=None): """List all of a Member's Loans""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: return Member.objects.get(pk=pk) ex...
stack_v2_sparse_classes_36k_train_009643
13,511
no_license
[ { "docstring": "Get a member.", "name": "get_member", "signature": "def get_member(self, pk)" }, { "docstring": "List all of a Member's Loans", "name": "get", "signature": "def get(self, request, pk, format=None)" } ]
2
stack_v2_sparse_classes_30k_train_008899
Implement the Python class `LoansView` described below. Class description: Implement the LoansView class. Method signatures and docstrings: - def get_member(self, pk): Get a member. - def get(self, request, pk, format=None): List all of a Member's Loans
Implement the Python class `LoansView` described below. Class description: Implement the LoansView class. Method signatures and docstrings: - def get_member(self, pk): Get a member. - def get(self, request, pk, format=None): List all of a Member's Loans <|skeleton|> class LoansView: def get_member(self, pk): ...
c5ac11e40a628c93c3865363e97b4f255a104ca8
<|skeleton|> class LoansView: def get_member(self, pk): """Get a member.""" <|body_0|> def get(self, request, pk, format=None): """List all of a Member's Loans""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoansView: def get_member(self, pk): """Get a member.""" try: return Member.objects.get(pk=pk) except Member.DoesNotExist: raise Http404 def get(self, request, pk, format=None): """List all of a Member's Loans""" if pk is not None: ...
the_stack_v2_python_sparse
loans/views.py
lubegamark/gosacco
train
2
451a1a199b2308ee8cbb82c3d62745e1c1504f0a
[ "rob_record = {}\n\ndef rob_tree(root):\n if not root:\n return 0\n if root in rob_record:\n return rob_record[root]\n result = max(rob_child(root), root.val + rob_child(root.left) + rob_child(root.right))\n rob_record[root] = result\n return result\n\ndef rob_child(node):\n if not n...
<|body_start_0|> rob_record = {} def rob_tree(root): if not root: return 0 if root in rob_record: return rob_record[root] result = max(rob_child(root), root.val + rob_child(root.left) + rob_child(root.right)) rob_record[roo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def rob(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> rob_record = {} def rob_tree(root): if not...
stack_v2_sparse_classes_36k_train_009644
1,727
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "rob", "signature": "def rob(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "rob", "signature": "def rob(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, root): :type root: TreeNode :rtype: int - def rob(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, root): :type root: TreeNode :rtype: int - def rob(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def rob(self, root): """:...
6475851d21ef5312727f93b9f4e85a3ca1e79bb8
<|skeleton|> class Solution: def rob(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def rob(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, root): """:type root: TreeNode :rtype: int""" rob_record = {} def rob_tree(root): if not root: return 0 if root in rob_record: return rob_record[root] result = max(rob_child(root), root.val + r...
the_stack_v2_python_sparse
src/0337-house-robber-iii.py
chaneyzorn/LeetCode-Python
train
0
e4635f7aac269eb4568e437f0a7e0c4c03714325
[ "if not self._canvas_account_id:\n raise MissingAccountID()\nparams = {'workflow_state': 'all', 'per_page': 500}\nurl = ACCOUNTS_API.format(self._canvas_account_id) + '/terms'\ndata_key = 'enrollment_terms'\nterms = []\nresponse = self._get_paged_resource(url, params, data_key)\nfor data in response[data_key]:\n...
<|body_start_0|> if not self._canvas_account_id: raise MissingAccountID() params = {'workflow_state': 'all', 'per_page': 500} url = ACCOUNTS_API.format(self._canvas_account_id) + '/terms' data_key = 'enrollment_terms' terms = [] response = self._get_paged_reso...
Terms
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Terms: def get_all_terms(self): """Return all of the terms in the account. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index""" <|body_0|> def get_term_by_sis_id(self, sis_term_id): """Return a term resource for the passed SIS ID."""...
stack_v2_sparse_classes_36k_train_009645
1,723
permissive
[ { "docstring": "Return all of the terms in the account. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index", "name": "get_all_terms", "signature": "def get_all_terms(self)" }, { "docstring": "Return a term resource for the passed SIS ID.", "name": "get_term_b...
3
stack_v2_sparse_classes_30k_train_013619
Implement the Python class `Terms` described below. Class description: Implement the Terms class. Method signatures and docstrings: - def get_all_terms(self): Return all of the terms in the account. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index - def get_term_by_sis_id(self, sis_...
Implement the Python class `Terms` described below. Class description: Implement the Terms class. Method signatures and docstrings: - def get_all_terms(self): Return all of the terms in the account. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index - def get_term_by_sis_id(self, sis_...
5da7260b2fd8f22f311dcbadc5e6906323eadff4
<|skeleton|> class Terms: def get_all_terms(self): """Return all of the terms in the account. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index""" <|body_0|> def get_term_by_sis_id(self, sis_term_id): """Return a term resource for the passed SIS ID."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Terms: def get_all_terms(self): """Return all of the terms in the account. https://canvas.instructure.com/doc/api/enrollment_terms.html#method.terms_api.index""" if not self._canvas_account_id: raise MissingAccountID() params = {'workflow_state': 'all', 'per_page': 500} ...
the_stack_v2_python_sparse
uw_canvas/terms.py
uw-it-aca/uw-restclients-canvas
train
2
5a467c98604adea269491366bc99eb4cdf316c88
[ "for extension_id, extension in sorted(settings_dict.items()):\n try:\n install_time = int(extension.get(u'install_time', u'0'), 10)\n except ValueError as exception:\n logging.warning(u'Extension ID {0:s} is missing timestamp: {1:s}'.format(extension_id, exception))\n continue\n manif...
<|body_start_0|> for extension_id, extension in sorted(settings_dict.items()): try: install_time = int(extension.get(u'install_time', u'0'), 10) except ValueError as exception: logging.warning(u'Extension ID {0:s} is missing timestamp: {1:s}'.format(extens...
Parses Chrome Preferences files.
ChromePreferencesParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChromePreferencesParser: """Parses Chrome Preferences files.""" def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): """Extract extension installation events. Args: settings_dict: A dictionary of settings data from Preferences file. parser_mediator: A parser medi...
stack_v2_sparse_classes_36k_train_009646
4,285
permissive
[ { "docstring": "Extract extension installation events. Args: settings_dict: A dictionary of settings data from Preferences file. parser_mediator: A parser mediator object (instance of ParserMediator).", "name": "_ExtractExtensionInstallEvents", "signature": "def _ExtractExtensionInstallEvents(self, sett...
2
stack_v2_sparse_classes_30k_train_000937
Implement the Python class `ChromePreferencesParser` described below. Class description: Parses Chrome Preferences files. Method signatures and docstrings: - def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): Extract extension installation events. Args: settings_dict: A dictionary of settings d...
Implement the Python class `ChromePreferencesParser` described below. Class description: Parses Chrome Preferences files. Method signatures and docstrings: - def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): Extract extension installation events. Args: settings_dict: A dictionary of settings d...
0ee446ebf03d17c515f76a666bd3795e91a2dd17
<|skeleton|> class ChromePreferencesParser: """Parses Chrome Preferences files.""" def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): """Extract extension installation events. Args: settings_dict: A dictionary of settings data from Preferences file. parser_mediator: A parser medi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChromePreferencesParser: """Parses Chrome Preferences files.""" def _ExtractExtensionInstallEvents(self, settings_dict, parser_mediator): """Extract extension installation events. Args: settings_dict: A dictionary of settings data from Preferences file. parser_mediator: A parser mediator object (...
the_stack_v2_python_sparse
plaso/parsers/chrome_preferences.py
aarontp/plaso
train
1
0b49ec26d43f81a9a95b7e9ad0475d7eeb4a31a3
[ "kwargs['ok_codes'] = (200, 201, 204)\nkwargs['error_handler'] = self.exception_handler\nkwargs['resp_type'] = 'response'\nreturn super()._http_request(*args, **kwargs)", "err_msg = ''\nif response.status_code in HTTP_ERROR:\n err_msg = HTTP_ERROR[response.status_code]\nelif response.status_code > 500:\n er...
<|body_start_0|> kwargs['ok_codes'] = (200, 201, 204) kwargs['error_handler'] = self.exception_handler kwargs['resp_type'] = 'response' return super()._http_request(*args, **kwargs) <|end_body_0|> <|body_start_1|> err_msg = '' if response.status_code in HTTP_ERROR: ...
Client class to interact with the service API This Client implements API calls, and does not contain any XSOAR logic. Should only do requests and return data. It inherits from BaseClient defined in CommonServer Python. Most calls use _http_request() that handles proxy, SSL verification, etc. For this implementation, no...
Client
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Client: """Client class to interact with the service API This Client implements API calls, and does not contain any XSOAR logic. Should only do requests and return data. It inherits from BaseClient defined in CommonServer Python. Most calls use _http_request() that handles proxy, SSL verification...
stack_v2_sparse_classes_36k_train_009647
48,894
permissive
[ { "docstring": "Function to make http requests using inbuilt _http_request() method.", "name": "http_request", "signature": "def http_request(self, *args, **kwargs) -> requests.Response" }, { "docstring": "Handle error in the response and display error message based on status code. :type respons...
2
null
Implement the Python class `Client` described below. Class description: Client class to interact with the service API This Client implements API calls, and does not contain any XSOAR logic. Should only do requests and return data. It inherits from BaseClient defined in CommonServer Python. Most calls use _http_request...
Implement the Python class `Client` described below. Class description: Client class to interact with the service API This Client implements API calls, and does not contain any XSOAR logic. Should only do requests and return data. It inherits from BaseClient defined in CommonServer Python. Most calls use _http_request...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class Client: """Client class to interact with the service API This Client implements API calls, and does not contain any XSOAR logic. Should only do requests and return data. It inherits from BaseClient defined in CommonServer Python. Most calls use _http_request() that handles proxy, SSL verification...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Client: """Client class to interact with the service API This Client implements API calls, and does not contain any XSOAR logic. Should only do requests and return data. It inherits from BaseClient defined in CommonServer Python. Most calls use _http_request() that handles proxy, SSL verification, etc. For th...
the_stack_v2_python_sparse
Packs/AtlassianConfluenceCloud/Integrations/AtlassianConfluenceCloud/AtlassianConfluenceCloud.py
demisto/content
train
1,023
cf6b43212b731529295b4767487d7f0896ce99fa
[ "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...
Proto file describing the keyword plan service. Service to manage keyword plans.
KeywordPlanServiceServicer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeywordPlanServiceServicer: """Proto file describing the keyword plan service. Service to manage keyword plans.""" def GetKeywordPlan(self, request, context): """Returns the requested plan in full detail.""" <|body_0|> def MutateKeywordPlans(self, request, context): ...
stack_v2_sparse_classes_36k_train_009648
5,813
permissive
[ { "docstring": "Returns the requested plan in full detail.", "name": "GetKeywordPlan", "signature": "def GetKeywordPlan(self, request, context)" }, { "docstring": "Creates, updates, or removes keyword plans. Operation statuses are returned.", "name": "MutateKeywordPlans", "signature": "d...
4
stack_v2_sparse_classes_30k_train_012562
Implement the Python class `KeywordPlanServiceServicer` described below. Class description: Proto file describing the keyword plan service. Service to manage keyword plans. Method signatures and docstrings: - def GetKeywordPlan(self, request, context): Returns the requested plan in full detail. - def MutateKeywordPla...
Implement the Python class `KeywordPlanServiceServicer` described below. Class description: Proto file describing the keyword plan service. Service to manage keyword plans. Method signatures and docstrings: - def GetKeywordPlan(self, request, context): Returns the requested plan in full detail. - def MutateKeywordPla...
0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a
<|skeleton|> class KeywordPlanServiceServicer: """Proto file describing the keyword plan service. Service to manage keyword plans.""" def GetKeywordPlan(self, request, context): """Returns the requested plan in full detail.""" <|body_0|> def MutateKeywordPlans(self, request, context): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeywordPlanServiceServicer: """Proto file describing the keyword plan service. Service to manage keyword plans.""" def GetKeywordPlan(self, request, context): """Returns the requested plan in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Meth...
the_stack_v2_python_sparse
google/ads/google_ads/v2/proto/services/keyword_plan_service_pb2_grpc.py
juanmacugat/google-ads-python
train
1
503c625d928300f6b87b6e30cd2505528049d477
[ "self._name = name\nself._dir_name = dir_name\ncreate_folder(self._dir_name)\nself._model = None\nself._config = None\nself._logger = None\nself._train_statistics = None\nself._data_iterator = None\nself._agent = None\nself._environment = None", "self._model = model\nself._config = config\nself._logger = logger\n...
<|body_start_0|> self._name = name self._dir_name = dir_name create_folder(self._dir_name) self._model = None self._config = None self._logger = None self._train_statistics = None self._data_iterator = None self._agent = None self._environm...
Implementation of a simple experiment class.
Experiment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Experiment: """Implementation of a simple experiment class.""" def __init__(self, name, dir_name): """Initializes an experiment object. Args: name: str, name of the experiment. dir_name: str, absolute path to the directory to save/load the experiment.""" <|body_0|> def r...
stack_v2_sparse_classes_36k_train_009649
5,194
no_license
[ { "docstring": "Initializes an experiment object. Args: name: str, name of the experiment. dir_name: str, absolute path to the directory to save/load the experiment.", "name": "__init__", "signature": "def __init__(self, name, dir_name)" }, { "docstring": "Registers all the components of an expe...
6
null
Implement the Python class `Experiment` described below. Class description: Implementation of a simple experiment class. Method signatures and docstrings: - def __init__(self, name, dir_name): Initializes an experiment object. Args: name: str, name of the experiment. dir_name: str, absolute path to the directory to s...
Implement the Python class `Experiment` described below. Class description: Implementation of a simple experiment class. Method signatures and docstrings: - def __init__(self, name, dir_name): Initializes an experiment object. Args: name: str, name of the experiment. dir_name: str, absolute path to the directory to s...
cfbb1ec62ddbda639ab4f21f47d35c6d06e2d55d
<|skeleton|> class Experiment: """Implementation of a simple experiment class.""" def __init__(self, name, dir_name): """Initializes an experiment object. Args: name: str, name of the experiment. dir_name: str, absolute path to the directory to save/load the experiment.""" <|body_0|> def r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Experiment: """Implementation of a simple experiment class.""" def __init__(self, name, dir_name): """Initializes an experiment object. Args: name: str, name of the experiment. dir_name: str, absolute path to the directory to save/load the experiment.""" self._name = name self._di...
the_stack_v2_python_sparse
myTorch/utils/experiment.py
apsarath/myTorch
train
0
caeaf1d808ac9917645b985392db23e63befdf42
[ "url = reverse('user-account-detail', args=[self.username])\nself.token_login()\nrequest = self.c.get(path=url, content_type='application/json', **self.client_header)\nself.assertEqual(request.status_code, status.HTTP_200_OK)", "url = reverse('user-account-detail', args=['hededsfd'])\nself.token_login()\nrequest ...
<|body_start_0|> url = reverse('user-account-detail', args=[self.username]) self.token_login() request = self.c.get(path=url, content_type='application/json', **self.client_header) self.assertEqual(request.status_code, status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> url = re...
UserAccountTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAccountTestCase: def test_account_detail(self): """User Account Detail""" <|body_0|> def test_invalid_account_detail(self): """Username invalid""" <|body_1|> def test_account_delete(self): """User Account Delete""" <|body_2|> def...
stack_v2_sparse_classes_36k_train_009650
10,007
no_license
[ { "docstring": "User Account Detail", "name": "test_account_detail", "signature": "def test_account_detail(self)" }, { "docstring": "Username invalid", "name": "test_invalid_account_detail", "signature": "def test_invalid_account_detail(self)" }, { "docstring": "User Account Dele...
6
stack_v2_sparse_classes_30k_train_010221
Implement the Python class `UserAccountTestCase` described below. Class description: Implement the UserAccountTestCase class. Method signatures and docstrings: - def test_account_detail(self): User Account Detail - def test_invalid_account_detail(self): Username invalid - def test_account_delete(self): User Account D...
Implement the Python class `UserAccountTestCase` described below. Class description: Implement the UserAccountTestCase class. Method signatures and docstrings: - def test_account_detail(self): User Account Detail - def test_invalid_account_detail(self): Username invalid - def test_account_delete(self): User Account D...
b8ba25fdde5d4ee92a3f73cb42ff892ed436d3f2
<|skeleton|> class UserAccountTestCase: def test_account_detail(self): """User Account Detail""" <|body_0|> def test_invalid_account_detail(self): """Username invalid""" <|body_1|> def test_account_delete(self): """User Account Delete""" <|body_2|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserAccountTestCase: def test_account_detail(self): """User Account Detail""" url = reverse('user-account-detail', args=[self.username]) self.token_login() request = self.c.get(path=url, content_type='application/json', **self.client_header) self.assertEqual(request.sta...
the_stack_v2_python_sparse
chatproject/apps/account/tests.py
QilinGu/chat-project
train
0
fdf52c53e8c01d13ae12d342deb658977903b435
[ "self.host = host\nself.port = port\nself.sock = None\nself._sensor = sensor\nself.stopped = threading.Event()", "_LOGGER.debug('Setting up socket...')\nself.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself.sock.settimeout(10)\nself.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)\ntry:\n ...
<|body_start_0|> self.host = host self.port = port self.sock = None self._sensor = sensor self.stopped = threading.Event() <|end_body_0|> <|body_start_1|> _LOGGER.debug('Setting up socket...') self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
Event listener to monitor calls on the Fritz!Box.
FritzBoxCallMonitor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FritzBoxCallMonitor: """Event listener to monitor calls on the Fritz!Box.""" def __init__(self, host, port, sensor): """Initialize Fritz!Box monitor instance.""" <|body_0|> def connect(self): """Connect to the Fritz!Box.""" <|body_1|> def _listen(sel...
stack_v2_sparse_classes_36k_train_009651
9,842
permissive
[ { "docstring": "Initialize Fritz!Box monitor instance.", "name": "__init__", "signature": "def __init__(self, host, port, sensor)" }, { "docstring": "Connect to the Fritz!Box.", "name": "connect", "signature": "def connect(self)" }, { "docstring": "Listen to incoming or outgoing ...
4
stack_v2_sparse_classes_30k_train_001977
Implement the Python class `FritzBoxCallMonitor` described below. Class description: Event listener to monitor calls on the Fritz!Box. Method signatures and docstrings: - def __init__(self, host, port, sensor): Initialize Fritz!Box monitor instance. - def connect(self): Connect to the Fritz!Box. - def _listen(self): ...
Implement the Python class `FritzBoxCallMonitor` described below. Class description: Event listener to monitor calls on the Fritz!Box. Method signatures and docstrings: - def __init__(self, host, port, sensor): Initialize Fritz!Box monitor instance. - def connect(self): Connect to the Fritz!Box. - def _listen(self): ...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class FritzBoxCallMonitor: """Event listener to monitor calls on the Fritz!Box.""" def __init__(self, host, port, sensor): """Initialize Fritz!Box monitor instance.""" <|body_0|> def connect(self): """Connect to the Fritz!Box.""" <|body_1|> def _listen(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FritzBoxCallMonitor: """Event listener to monitor calls on the Fritz!Box.""" def __init__(self, host, port, sensor): """Initialize Fritz!Box monitor instance.""" self.host = host self.port = port self.sock = None self._sensor = sensor self.stopped = threadi...
the_stack_v2_python_sparse
homeassistant/components/fritzbox_callmonitor/sensor.py
tchellomello/home-assistant
train
8
4211e47e5d84f2f86018686a325dc62e4fb52e08
[ "rule = RULE_SEPARATOR.split(iline)\nif len(rule) != 2:\n raise RuleFormatError('Missing rule separator in line: ' + iline)\nself.condition = Condition(rule[0], flags)\nself.replacement = Replacement(rule[1])\nself.__check_consistency(iline)", "lcond = self.condition.groups\nlrepl = len(self.replacement.groups...
<|body_start_0|> rule = RULE_SEPARATOR.split(iline) if len(rule) != 2: raise RuleFormatError('Missing rule separator in line: ' + iline) self.condition = Condition(rule[0], flags) self.replacement = Replacement(rule[1]) self.__check_consistency(iline) <|end_body_0|> ...
Class providing correspondence between condition and replacement.
Rule
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rule: """Class providing correspondence between condition and replacement.""" def __init__(self, iline, flags=''): """TODO""" <|body_0|> def __check_consistency(self, iline): """Check that internal state of object is correct.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_009652
17,033
permissive
[ { "docstring": "TODO", "name": "__init__", "signature": "def __init__(self, iline, flags='')" }, { "docstring": "Check that internal state of object is correct.", "name": "__check_consistency", "signature": "def __check_consistency(self, iline)" } ]
2
stack_v2_sparse_classes_30k_train_015880
Implement the Python class `Rule` described below. Class description: Class providing correspondence between condition and replacement. Method signatures and docstrings: - def __init__(self, iline, flags=''): TODO - def __check_consistency(self, iline): Check that internal state of object is correct.
Implement the Python class `Rule` described below. Class description: Class providing correspondence between condition and replacement. Method signatures and docstrings: - def __init__(self, iline, flags=''): TODO - def __check_consistency(self, iline): Check that internal state of object is correct. <|skeleton|> cl...
ac645fb41260b86491b17fbc50e5ea3300dc28b7
<|skeleton|> class Rule: """Class providing correspondence between condition and replacement.""" def __init__(self, iline, flags=''): """TODO""" <|body_0|> def __check_consistency(self, iline): """Check that internal state of object is correct.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rule: """Class providing correspondence between condition and replacement.""" def __init__(self, iline, flags=''): """TODO""" rule = RULE_SEPARATOR.split(iline) if len(rule) != 2: raise RuleFormatError('Missing rule separator in line: ' + iline) self.condition ...
the_stack_v2_python_sparse
scripts/lib/python/ld/p2p.py
WladimirSidorenko/TextNormalization
train
1
5730b3d0651858fa7d349af2c34395ade286145a
[ "q = deque()\nq.append(root)\ns = []\nwhile q:\n node = q.popleft()\n if node:\n s.append(str(node.val))\n q.append(node.left)\n q.append(node.right)\n else:\n s.append('N')\nreturn ','.join(s)", "q_s = deque(data.split(','))\nq = deque()\nif q_s:\n val = q_s.popleft()\n ...
<|body_start_0|> q = deque() q.append(root) s = [] while q: node = q.popleft() if node: s.append(str(node.val)) q.append(node.left) q.append(node.right) else: s.append('N') return ...
232ms
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: """232ms""" 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_ske...
stack_v2_sparse_classes_36k_train_009653
3,990
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_021401
Implement the Python class `Codec` described below. Class description: 232ms 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: TreeNode
Implement the Python class `Codec` described below. Class description: 232ms 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: TreeNode <|skeleton...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Codec: """232ms""" 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_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: """232ms""" def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" q = deque() q.append(root) s = [] while q: node = q.popleft() if node: s.append(str(node.val)) ...
the_stack_v2_python_sparse
SerializeAndDeserializeBinaryTree_HARD_297.py
953250587/leetcode-python
train
2
d517fc71f09fe5e4dabddad9218335a817d2a60e
[ "self.setMassFrac('CR', 0.07)\nself.setMassFrac('MO', 0.16)\nself.setMassFrac('FE', 0.04)\nself.setMassFrac('SI', 0.01)\nself.setMassFrac('MN', 0.008)\nself.setMassFrac('V', 0.0005)\nself.setMassFrac('C', 0.0006)\nself.setMassFrac('CO', 0.002)\nself.setMassFrac('CU', 0.0035)\nself.setMassFrac('W', 0.005)\nself.setM...
<|body_start_0|> self.setMassFrac('CR', 0.07) self.setMassFrac('MO', 0.16) self.setMassFrac('FE', 0.04) self.setMassFrac('SI', 0.01) self.setMassFrac('MN', 0.008) self.setMassFrac('V', 0.0005) self.setMassFrac('C', 0.0006) self.setMassFrac('CO', 0.002) ...
Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility Study of Secondary Heat Exchanger Concepts for the Advanced High Temperature Re...
HastelloyN
[ "Apache-2.0", "GPL-1.0-or-later", "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HastelloyN: """Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility Study of Secondary Heat Exchanger Concept...
stack_v2_sparse_classes_36k_train_009654
5,052
permissive
[ { "docstring": "Hastelloy N mass fractions. From [Haynes]_.", "name": "setDefaultMassFracs", "signature": "def setDefaultMassFracs(self)" }, { "docstring": "Calculates the thermal conductivity of Hastelloy N. Second order polynomial fit to data from [Haynes]_. Parameters ---------- Tk : float Te...
5
null
Implement the Python class `HastelloyN` described below. Class description: Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility St...
Implement the Python class `HastelloyN` described below. Class description: Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility St...
360791847227df3f3a337a996ef561e00f846a09
<|skeleton|> class HastelloyN: """Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility Study of Secondary Heat Exchanger Concept...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HastelloyN: """Hastelloy N alloy (UNS N10003). .. [Haynes] Haynes International, H-2052D 2020 (http://haynesintl.com/docs/default-source/pdfs/new-alloy-brochures/corrosion-resistant-alloys/brochures/n-brochure.pdf) .. [SAB] Sabharwall, et. al. Feasibility Study of Secondary Heat Exchanger Concepts for the Adv...
the_stack_v2_python_sparse
armi/materials/hastelloyN.py
terrapower/armi
train
204
150889e01da1f226bdc2e47e8d0f9ffe126531c4
[ "from danceschool.core.models import Customer\nfirst_name = first_name or invoice.firstName\nlast_name = last_name or invoice.lastName\nemail = email or invoice.email\ncustomer = Customer.objects.filter(first_name=first_name, last_name=last_name, email=email).first()\nvoucher_response = check_voucher.send(sender=Re...
<|body_start_0|> from danceschool.core.models import Customer first_name = first_name or invoice.firstName last_name = last_name or invoice.lastName email = email or invoice.email customer = Customer.objects.filter(first_name=first_name, last_name=last_name, email=email).first() ...
This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify it; that should be done in the view itself.
RegistrationAdjustmentsMixin
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistrationAdjustmentsMixin: """This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify it; that should be done in the view its...
stack_v2_sparse_classes_36k_train_009655
30,664
permissive
[ { "docstring": "This method looks for a voucher with the associated voucher ID, it checks for eligibility, and it returns an updated dictionary", "name": "getVoucher", "signature": "def getVoucher(self, voucherId, invoice, prior_adjustment=0, first_name=None, last_name=None, email=None)" }, { "d...
3
null
Implement the Python class `RegistrationAdjustmentsMixin` described below. Class description: This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify ...
Implement the Python class `RegistrationAdjustmentsMixin` described below. Class description: This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify ...
19db3e83e76ea2002ee841989410d12d1e601023
<|skeleton|> class RegistrationAdjustmentsMixin: """This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify it; that should be done in the view its...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegistrationAdjustmentsMixin: """This mixin provides convenience methods for the standard request of discounts, vouchers, and addons that happens in each step of the registration process. These methods reference a Registration object, but they do not modify it; that should be done in the view itself.""" ...
the_stack_v2_python_sparse
danceschool/core/mixins.py
django-danceschool/django-danceschool
train
40
0a0d89da75fd9831a6415d1d0eddec79dfa655ba
[ "res = ''\n\ndef serializeHelp(r, string):\n if r is None:\n string += 'None,'\n else:\n string += str(r.val) + ','\n string = serializeHelp(r.left, string)\n string = serializeHelp(r.right, string)\n return string\nreturn serializeHelp(root, res)", "def deserializeHelp(l: Lis...
<|body_start_0|> res = '' def serializeHelp(r, string): if r is None: string += 'None,' else: string += str(r.val) + ',' string = serializeHelp(r.left, string) string = serializeHelp(r.right, string) ret...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_009656
1,462
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:...
d135f9ec06d90ba331310ce0e20e6948cb7737bb
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" res = '' def serializeHelp(r, string): if r is None: string += 'None,' else: string += str(r.val) + ',' s...
the_stack_v2_python_sparse
297Codec.py
wbhelloo/pythonleetcode
train
0
081eeea2ba6d25fdf59e65583fe89e665157a39f
[ "if dtype:\n pyKeOps_Warning('keyword argument dtype in Genred is deprecated ; argument is ignored.')\nif cuda_type:\n pyKeOps_Warning('keyword argument cuda_type in Genred is deprecated ; argument is ignored.')\nself.reduction_op = reduction_op\nreduction_op_internal, formula2 = preprocess(reduction_op, form...
<|body_start_0|> if dtype: pyKeOps_Warning('keyword argument dtype in Genred is deprecated ; argument is ignored.') if cuda_type: pyKeOps_Warning('keyword argument cuda_type in Genred is deprecated ; argument is ignored.') self.reduction_op = reduction_op reductio...
Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tutorials/index>`. Taking as input a handful of strings and integers that sp...
Genred
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Genred: """Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tutorials/index>`. Taking as input a handf...
stack_v2_sparse_classes_36k_train_009657
29,229
permissive
[ { "docstring": "Instantiate a new generic operation. Note: :class:`Genred` relies on C++ or CUDA kernels that are compiled on-the-fly, and stored in a :ref:`cache directory <part.cache>` as shared libraries (\".so\" files) for later use. Args: formula (string): The scalar- or vector-valued expression that shoul...
2
stack_v2_sparse_classes_30k_train_013690
Implement the Python class `Genred` described below. Class description: Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tut...
Implement the Python class `Genred` described below. Class description: Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tut...
52ed22a7fbbcf4bd02dbdf5dc2b00bf79cceddf5
<|skeleton|> class Genred: """Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tutorials/index>`. Taking as input a handf...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Genred: """Creates a new generic operation. This is KeOps' main function, whose usage is documented in the :doc:`user-guide <../../Genred>`, the :doc:`gallery of examples <../../../_auto_examples/index>` and the :doc:`high-level tutorials <../../../_auto_tutorials/index>`. Taking as input a handful of strings...
the_stack_v2_python_sparse
pykeops/pykeops/torch/generic/generic_red.py
getkeops/keops
train
910
6595236c44c4057a806bd33297495d727865a14e
[ "p = head\ndummy = ListNode(0)\npre = dummy\npre.next = p\nwhile pre.next and p and p.next:\n if p.val == p.next.val:\n t = p\n while t.next and t.val == t.next.val:\n t = t.next\n if t.next:\n p.val = t.next.val\n p.next = t.next.next\n else:\n ...
<|body_start_0|> p = head dummy = ListNode(0) pre = dummy pre.next = p while pre.next and p and p.next: if p.val == p.next.val: t = p while t.next and t.val == t.next.val: t = t.next if t.next: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates2(self, head): """记录下是否需要删除最右一个节点 :type head: ListNode :rtype: ListNode""" <|body_1|> def deleteDuplicates3(self, head): """看大佬...
stack_v2_sparse_classes_36k_train_009658
3,703
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates", "signature": "def deleteDuplicates(self, head)" }, { "docstring": "记录下是否需要删除最右一个节点 :type head: ListNode :rtype: ListNode", "name": "deleteDuplicates2", "signature": "def deleteDuplicates2(self, head)" }...
4
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates2(self, head): 记录下是否需要删除最右一个节点 :type head: ListNode :rtype: ListNode - def deleteDup...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates2(self, head): 记录下是否需要删除最右一个节点 :type head: ListNode :rtype: ListNode - def deleteDup...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates2(self, head): """记录下是否需要删除最右一个节点 :type head: ListNode :rtype: ListNode""" <|body_1|> def deleteDuplicates3(self, head): """看大佬...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" p = head dummy = ListNode(0) pre = dummy pre.next = p while pre.next and p and p.next: if p.val == p.next.val: t = p while t.next ...
the_stack_v2_python_sparse
82_删除排序链表中的重复元素 II.py
lovehhf/LeetCode
train
0
97c6a9ba97285ce1e460158b94b8e7f4e21c6d02
[ "self.logger = logger\nself.options = options\nif options.checkpoint_file is not None:\n local_ckpt_file = os.path.join(options.checkpoint_dir, options.checkpoint_file)\n if not os.path.exists(local_ckpt_file):\n raise ValueError('Checkpoint file [{}] does not exist!'.format(options.checkpoint_file))\n...
<|body_start_0|> self.logger = logger self.options = options if options.checkpoint_file is not None: local_ckpt_file = os.path.join(options.checkpoint_dir, options.checkpoint_file) if not os.path.exists(local_ckpt_file): raise ValueError('Checkpoint file [...
Class that handles saving and loading checkpoints during training.
CheckpointSaver
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheckpointSaver: """Class that handles saving and loading checkpoints during training.""" def __init__(self, logger: Logger, options: EasyDict, training: str): """Initialization function. :param logger :param options""" <|body_0|> def check_end_epoch(self, fn: str) -> bo...
stack_v2_sparse_classes_36k_train_009659
5,171
permissive
[ { "docstring": "Initialization function. :param logger :param options", "name": "__init__", "signature": "def __init__(self, logger: Logger, options: EasyDict, training: str)" }, { "docstring": "Check if the checkpoint file is the end of one epoch. :param fn: :return:", "name": "check_end_ep...
5
stack_v2_sparse_classes_30k_train_007899
Implement the Python class `CheckpointSaver` described below. Class description: Class that handles saving and loading checkpoints during training. Method signatures and docstrings: - def __init__(self, logger: Logger, options: EasyDict, training: str): Initialization function. :param logger :param options - def chec...
Implement the Python class `CheckpointSaver` described below. Class description: Class that handles saving and loading checkpoints during training. Method signatures and docstrings: - def __init__(self, logger: Logger, options: EasyDict, training: str): Initialization function. :param logger :param options - def chec...
ca88df568a6f2143dcb85d22c005fce4562a7523
<|skeleton|> class CheckpointSaver: """Class that handles saving and loading checkpoints during training.""" def __init__(self, logger: Logger, options: EasyDict, training: str): """Initialization function. :param logger :param options""" <|body_0|> def check_end_epoch(self, fn: str) -> bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CheckpointSaver: """Class that handles saving and loading checkpoints during training.""" def __init__(self, logger: Logger, options: EasyDict, training: str): """Initialization function. :param logger :param options""" self.logger = logger self.options = options if option...
the_stack_v2_python_sparse
PointNetBaseline/code/functions/saver.py
zshyang/FieldConvolution
train
1
40d2d842b3b1cd030ada3b5898bc6ca763b843c2
[ "reward = torch.ones(2)\nsequence_length = torch.tensor([3, 5])\ndiscounted_reward = rewards.discount_reward(reward, sequence_length, discount=1.0)\ndiscounted_reward_n = rewards.discount_reward(reward, sequence_length, discount=0.1, normalize=True)\ndiscounted_reward_ = rewards.discount_reward(reward, sequence_len...
<|body_start_0|> reward = torch.ones(2) sequence_length = torch.tensor([3, 5]) discounted_reward = rewards.discount_reward(reward, sequence_length, discount=1.0) discounted_reward_n = rewards.discount_reward(reward, sequence_length, discount=0.1, normalize=True) discounted_reward...
Tests reward related functions.
RewardTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RewardTest: """Tests reward related functions.""" def test_discount_reward(self): """Tests :func:`texar.torch.losses.rewards.discount_reward`""" <|body_0|> def test_discount_reward_tensor_1d(self): """Tests :func:`texar.torch.losses.rewards._discount_reward_tenso...
stack_v2_sparse_classes_36k_train_009660
4,889
permissive
[ { "docstring": "Tests :func:`texar.torch.losses.rewards.discount_reward`", "name": "test_discount_reward", "signature": "def test_discount_reward(self)" }, { "docstring": "Tests :func:`texar.torch.losses.rewards._discount_reward_tensor_1d`", "name": "test_discount_reward_tensor_1d", "sig...
3
stack_v2_sparse_classes_30k_train_014987
Implement the Python class `RewardTest` described below. Class description: Tests reward related functions. Method signatures and docstrings: - def test_discount_reward(self): Tests :func:`texar.torch.losses.rewards.discount_reward` - def test_discount_reward_tensor_1d(self): Tests :func:`texar.torch.losses.rewards._...
Implement the Python class `RewardTest` described below. Class description: Tests reward related functions. Method signatures and docstrings: - def test_discount_reward(self): Tests :func:`texar.torch.losses.rewards.discount_reward` - def test_discount_reward_tensor_1d(self): Tests :func:`texar.torch.losses.rewards._...
931ead9222ca90bfc75c3045dc79fb118de340c9
<|skeleton|> class RewardTest: """Tests reward related functions.""" def test_discount_reward(self): """Tests :func:`texar.torch.losses.rewards.discount_reward`""" <|body_0|> def test_discount_reward_tensor_1d(self): """Tests :func:`texar.torch.losses.rewards._discount_reward_tenso...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RewardTest: """Tests reward related functions.""" def test_discount_reward(self): """Tests :func:`texar.torch.losses.rewards.discount_reward`""" reward = torch.ones(2) sequence_length = torch.tensor([3, 5]) discounted_reward = rewards.discount_reward(reward, sequence_lengt...
the_stack_v2_python_sparse
texar/torch/losses/rewards_test.py
panaali/texar-pytorch
train
1
2cb80e1bcc8046168061edb78acc8389fb88c62e
[ "super(KLGaussianNormal, self).__init__()\nassert isinstance(input_shape, tuple) and len(input_shape) == 1, '\"input_shape\" should be a tuple.'\nassert isinstance(output_shape, tuple) and len(output_shape) == 1, '\"output_shape\" should be a tuple.'\nassert output_shape[0] * 2 == input_shape[0], '\"output_shape\" ...
<|body_start_0|> super(KLGaussianNormal, self).__init__() assert isinstance(input_shape, tuple) and len(input_shape) == 1, '"input_shape" should be a tuple.' assert isinstance(output_shape, tuple) and len(output_shape) == 1, '"output_shape" should be a tuple.' assert output_shape[0] * 2 ...
KLGaussianNormal
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KLGaussianNormal: def __init__(self, input_shape, output_shape): """This function initializes the class. The shape of two tensor should be double. Parameters ---------- input_shape: tuple a tuple of three values, i.e., (input channel, input width, input height). output_shape: tuple a tup...
stack_v2_sparse_classes_36k_train_009661
19,014
permissive
[ { "docstring": "This function initializes the class. The shape of two tensor should be double. Parameters ---------- input_shape: tuple a tuple of three values, i.e., (input channel, input width, input height). output_shape: tuple a tuple of single value, i.e., (input channel,) or (input dim,).", "name": "_...
2
null
Implement the Python class `KLGaussianNormal` described below. Class description: Implement the KLGaussianNormal class. Method signatures and docstrings: - def __init__(self, input_shape, output_shape): This function initializes the class. The shape of two tensor should be double. Parameters ---------- input_shape: t...
Implement the Python class `KLGaussianNormal` described below. Class description: Implement the KLGaussianNormal class. Method signatures and docstrings: - def __init__(self, input_shape, output_shape): This function initializes the class. The shape of two tensor should be double. Parameters ---------- input_shape: t...
7585261dd1b1c6c99dada5d2d1aabf482e89e880
<|skeleton|> class KLGaussianNormal: def __init__(self, input_shape, output_shape): """This function initializes the class. The shape of two tensor should be double. Parameters ---------- input_shape: tuple a tuple of three values, i.e., (input channel, input width, input height). output_shape: tuple a tup...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KLGaussianNormal: def __init__(self, input_shape, output_shape): """This function initializes the class. The shape of two tensor should be double. Parameters ---------- input_shape: tuple a tuple of three values, i.e., (input channel, input width, input height). output_shape: tuple a tuple of single v...
the_stack_v2_python_sparse
lemontree/objectives.py
khshim/lemontree
train
3
0ebc8acedc20dab13f0f55b1fb2a72636170567f
[ "self.session = session\nsuper().__init__(cmdlist)\nself.sighandle = self.session.sighandle\nfor cmd in cmdlist:\n cmdname = cmd.__name__.lower()\n cmdinst = getattr(self, cmdname)\n cmdinst.sighandle = self.sighandle\nself.session_lock_string = ''", "self.mem_handle = self.session.mem_handle\nself.cmdlo...
<|body_start_0|> self.session = session super().__init__(cmdlist) self.sighandle = self.session.sighandle for cmd in cmdlist: cmdname = cmd.__name__.lower() cmdinst = getattr(self, cmdname) cmdinst.sighandle = self.sighandle self.session_lock_s...
@brief Overloading the logging functions and user input methods to allow for interactions through the web GUI
GUIcontrolterm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GUIcontrolterm: """@brief Overloading the logging functions and user input methods to allow for interactions through the web GUI""" def __init__(self, cmdlist, session, **kwargs): """User action prompts requires a reference to the socketio interface""" <|body_0|> def ini...
stack_v2_sparse_classes_36k_train_009662
16,012
no_license
[ { "docstring": "User action prompts requires a reference to the socketio interface", "name": "__init__", "signature": "def __init__(self, cmdlist, session, **kwargs)" }, { "docstring": "@brief Overloading the settings for the logger instances. @details Additional settings for the memory settings...
3
stack_v2_sparse_classes_30k_test_001014
Implement the Python class `GUIcontrolterm` described below. Class description: @brief Overloading the logging functions and user input methods to allow for interactions through the web GUI Method signatures and docstrings: - def __init__(self, cmdlist, session, **kwargs): User action prompts requires a reference to ...
Implement the Python class `GUIcontrolterm` described below. Class description: @brief Overloading the logging functions and user input methods to allow for interactions through the web GUI Method signatures and docstrings: - def __init__(self, cmdlist, session, **kwargs): User action prompts requires a reference to ...
592a21b2361969faab075f31cc70e1fc05af7fd1
<|skeleton|> class GUIcontrolterm: """@brief Overloading the logging functions and user input methods to allow for interactions through the web GUI""" def __init__(self, cmdlist, session, **kwargs): """User action prompts requires a reference to the socketio interface""" <|body_0|> def ini...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GUIcontrolterm: """@brief Overloading the logging functions and user input methods to allow for interactions through the web GUI""" def __init__(self, cmdlist, session, **kwargs): """User action prompts requires a reference to the socketio interface""" self.session = session super...
the_stack_v2_python_sparse
server/session.py
yimuchen/SiPMCalibControl
train
0
71d4c182dc8a673978bc8eed78de1a5b5611b9a9
[ "try:\n self.sqlhandler = None\n if 'UID' not in self.request.cookies.keys():\n self.write('no uid')\n return\n if not utils.isUIDValid(self):\n self.write('no uid')\n return\n if self.getStuList():\n self.write(json.dumps(self.stuList if self.stuList is not None else ...
<|body_start_0|> try: self.sqlhandler = None if 'UID' not in self.request.cookies.keys(): self.write('no uid') return if not utils.isUIDValid(self): self.write('no uid') return if self.getStuList(): ...
AdmGetStudentListRequestHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdmGetStudentListRequestHandler: def get(self): """从数据库获取学生列表返回给管理员""" <|body_0|> def getStuList(self): """从数据库读取学生信息""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: self.sqlhandler = None if 'UID' not in self.request.co...
stack_v2_sparse_classes_36k_train_009663
1,937
no_license
[ { "docstring": "从数据库获取学生列表返回给管理员", "name": "get", "signature": "def get(self)" }, { "docstring": "从数据库读取学生信息", "name": "getStuList", "signature": "def getStuList(self)" } ]
2
null
Implement the Python class `AdmGetStudentListRequestHandler` described below. Class description: Implement the AdmGetStudentListRequestHandler class. Method signatures and docstrings: - def get(self): 从数据库获取学生列表返回给管理员 - def getStuList(self): 从数据库读取学生信息
Implement the Python class `AdmGetStudentListRequestHandler` described below. Class description: Implement the AdmGetStudentListRequestHandler class. Method signatures and docstrings: - def get(self): 从数据库获取学生列表返回给管理员 - def getStuList(self): 从数据库读取学生信息 <|skeleton|> class AdmGetStudentListRequestHandler: def get...
b28eb4163b02bd0a931653b94851592f2654b199
<|skeleton|> class AdmGetStudentListRequestHandler: def get(self): """从数据库获取学生列表返回给管理员""" <|body_0|> def getStuList(self): """从数据库读取学生信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdmGetStudentListRequestHandler: def get(self): """从数据库获取学生列表返回给管理员""" try: self.sqlhandler = None if 'UID' not in self.request.cookies.keys(): self.write('no uid') return if not utils.isUIDValid(self): self.wr...
the_stack_v2_python_sparse
server/admin/python/AdmGetStudentListRequestHandler.py
lyh-ADT/edu-app
train
1
2b22956e6bca7f03e33d693c0fc35db607789936
[ "for j in range(i + 1, l):\n n2 = ns2[j]\n if n2 > n:\n return n2\nreturn -1", "l2 = len(nums2)\nr = []\nfor n1 in nums1:\n i2 = nums2.index(n1)\n r.append(self.bigger(n1, i2, l2, nums2))\nreturn r" ]
<|body_start_0|> for j in range(i + 1, l): n2 = ns2[j] if n2 > n: return n2 return -1 <|end_body_0|> <|body_start_1|> l2 = len(nums2) r = [] for n1 in nums1: i2 = nums2.index(n1) r.append(self.bigger(n1, i2, l2, num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def bigger(self, n, i, l, ns2): """:type n: int :type i: int :type l: int :type ns: List[int] :rtype: int""" <|body_0|> def nextGreaterElement(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_009664
1,937
no_license
[ { "docstring": ":type n: int :type i: int :type l: int :type ns: List[int] :rtype: int", "name": "bigger", "signature": "def bigger(self, n, i, l, ns2)" }, { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int]", "name": "nextGreaterElement", "signature": "def ne...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def bigger(self, n, i, l, ns2): :type n: int :type i: int :type l: int :type ns: List[int] :rtype: int - def nextGreaterElement(self, nums1, nums2): :type nums1: List[int] :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def bigger(self, n, i, l, ns2): :type n: int :type i: int :type l: int :type ns: List[int] :rtype: int - def nextGreaterElement(self, nums1, nums2): :type nums1: List[int] :type ...
62ccbdedf4e1fb9788acfeb2a5bfce70f86c68b6
<|skeleton|> class Solution: def bigger(self, n, i, l, ns2): """:type n: int :type i: int :type l: int :type ns: List[int] :rtype: int""" <|body_0|> def nextGreaterElement(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int]""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def bigger(self, n, i, l, ns2): """:type n: int :type i: int :type l: int :type ns: List[int] :rtype: int""" for j in range(i + 1, l): n2 = ns2[j] if n2 > n: return n2 return -1 def nextGreaterElement(self, nums1, nums2): "...
the_stack_v2_python_sparse
LeetCode/496.py
cylinder-lee-cn/LeetCode
train
0
7a09780d23b7c1a6fa3c8883149960bd40442331
[ "super().__init__()\nself.input_dim = input_dim\nself.dec_dim = dec_dim\nself.num_layers = 1\nself.lstm = nn.LSTM(input_dim, dec_dim, num_layers=self.num_layers, dropout=dropout)\nself.fc_out_xypen = nn.Linear(dec_dim, 5)", "bsz = strokes.size(1)\nif hidden_cell is None:\n hidden = torch.zeros(self.lstm.num_la...
<|body_start_0|> super().__init__() self.input_dim = input_dim self.dec_dim = dec_dim self.num_layers = 1 self.lstm = nn.LSTM(input_dim, dec_dim, num_layers=self.num_layers, dropout=dropout) self.fc_out_xypen = nn.Linear(dec_dim, 5) <|end_body_0|> <|body_start_1|> ...
SketchRNNDecoderLSTM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SketchRNNDecoderLSTM: def __init__(self, input_dim, dec_dim, dropout=0.0): """Args: input_dim: int (size of input) dec_dim: int (size of hidden states) M: int (number of mixtures) dropout: float""" <|body_0|> def forward(self, strokes, stroke_lens=None, hidden_cell=None, out...
stack_v2_sparse_classes_36k_train_009665
40,451
permissive
[ { "docstring": "Args: input_dim: int (size of input) dec_dim: int (size of hidden states) M: int (number of mixtures) dropout: float", "name": "__init__", "signature": "def __init__(self, input_dim, dec_dim, dropout=0.0)" }, { "docstring": "Args: strokes: [max_len + 1, bsz, input_dim] (+ 1 for s...
4
stack_v2_sparse_classes_30k_train_011608
Implement the Python class `SketchRNNDecoderLSTM` described below. Class description: Implement the SketchRNNDecoderLSTM class. Method signatures and docstrings: - def __init__(self, input_dim, dec_dim, dropout=0.0): Args: input_dim: int (size of input) dec_dim: int (size of hidden states) M: int (number of mixtures)...
Implement the Python class `SketchRNNDecoderLSTM` described below. Class description: Implement the SketchRNNDecoderLSTM class. Method signatures and docstrings: - def __init__(self, input_dim, dec_dim, dropout=0.0): Args: input_dim: int (size of input) dec_dim: int (size of hidden states) M: int (number of mixtures)...
b0c7f25d13e1713b883335c278d1e0db67c50bbe
<|skeleton|> class SketchRNNDecoderLSTM: def __init__(self, input_dim, dec_dim, dropout=0.0): """Args: input_dim: int (size of input) dec_dim: int (size of hidden states) M: int (number of mixtures) dropout: float""" <|body_0|> def forward(self, strokes, stroke_lens=None, hidden_cell=None, out...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SketchRNNDecoderLSTM: def __init__(self, input_dim, dec_dim, dropout=0.0): """Args: input_dim: int (size of input) dec_dim: int (size of hidden states) M: int (number of mixtures) dropout: float""" super().__init__() self.input_dim = input_dim self.dec_dim = dec_dim sel...
the_stack_v2_python_sparse
src/models/base/stroke_models.py
sosuperic/sketching-with-language
train
0
0f9c22d0619771241895bda5077b516105d52d89
[ "self.x = x\nself.M = np.shape(x)[0]\nself.N = np.shape(x)[1]", "X = np.zeros([self.M, self.N], dtype=np.complex)\nfor m in range(self.M):\n for n in range(self.N):\n for i in range(self.M):\n for j in range(self.N):\n X[m, n] = X[m, n] + self.x[i, j] / np.sqrt(self.M * self.N)...
<|body_start_0|> self.x = x self.M = np.shape(x)[0] self.N = np.shape(x)[1] <|end_body_0|> <|body_start_1|> X = np.zeros([self.M, self.N], dtype=np.complex) for m in range(self.M): for n in range(self.N): for i in range(self.M): fo...
2-D DFT
DFT_2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DFT_2D: """2-D DFT""" def __init__(self, x): """input time-domain signal x""" <|body_0|> def solve(self): """\\\\\\ METHOD: Compute DFT of x""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.x = x self.M = np.shape(x)[0] self....
stack_v2_sparse_classes_36k_train_009666
4,947
no_license
[ { "docstring": "input time-domain signal x", "name": "__init__", "signature": "def __init__(self, x)" }, { "docstring": "\\\\\\\\\\\\ METHOD: Compute DFT of x", "name": "solve", "signature": "def solve(self)" } ]
2
stack_v2_sparse_classes_30k_train_021184
Implement the Python class `DFT_2D` described below. Class description: 2-D DFT Method signatures and docstrings: - def __init__(self, x): input time-domain signal x - def solve(self): \\\\\\ METHOD: Compute DFT of x
Implement the Python class `DFT_2D` described below. Class description: 2-D DFT Method signatures and docstrings: - def __init__(self, x): input time-domain signal x - def solve(self): \\\\\\ METHOD: Compute DFT of x <|skeleton|> class DFT_2D: """2-D DFT""" def __init__(self, x): """input time-domai...
b72322cfc6d81c996117cea2160ee312da62d3ed
<|skeleton|> class DFT_2D: """2-D DFT""" def __init__(self, x): """input time-domain signal x""" <|body_0|> def solve(self): """\\\\\\ METHOD: Compute DFT of x""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DFT_2D: """2-D DFT""" def __init__(self, x): """input time-domain signal x""" self.x = x self.M = np.shape(x)[0] self.N = np.shape(x)[1] def solve(self): """\\\\\\ METHOD: Compute DFT of x""" X = np.zeros([self.M, self.N], dtype=np.complex) for...
the_stack_v2_python_sparse
2D Signal Processing and Image De-noising/discrete_signal.py
FG-14/Signals-and-Information-Processing-DSP-
train
0
44cac54378a735725021a68cdda13586540904fb
[ "super().__init__(xid)\nself.error_type = error_type\nself.code = code\nself.data = data", "super().unpack(buff, offset)\ncode_class = ErrorType(self.error_type).get_class()\nself.code = code_class(self.code)" ]
<|body_start_0|> super().__init__(xid) self.error_type = error_type self.code = code self.data = data <|end_body_0|> <|body_start_1|> super().unpack(buff, offset) code_class = ErrorType(self.error_type).get_class() self.code = code_class(self.code) <|end_body_1|>...
OpenFlow Error Message. This message does not contain a body in addition to the OpenFlow Header.
ErrorMsg
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ErrorMsg: """OpenFlow Error Message. This message does not contain a body in addition to the OpenFlow Header.""" def __init__(self, xid=None, error_type=None, code=None, data=b''): """Assign parameters to object attributes. Args: xid (int): To be included in the message header. error...
stack_v2_sparse_classes_36k_train_009667
16,980
permissive
[ { "docstring": "Assign parameters to object attributes. Args: xid (int): To be included in the message header. error_type (ErrorType): Error type. code (Enum): Error code. data: Its content is specified in the error code documentation. Unless specified otherwise, the data field contains at least 64 bytes of the...
2
stack_v2_sparse_classes_30k_train_002133
Implement the Python class `ErrorMsg` described below. Class description: OpenFlow Error Message. This message does not contain a body in addition to the OpenFlow Header. Method signatures and docstrings: - def __init__(self, xid=None, error_type=None, code=None, data=b''): Assign parameters to object attributes. Arg...
Implement the Python class `ErrorMsg` described below. Class description: OpenFlow Error Message. This message does not contain a body in addition to the OpenFlow Header. Method signatures and docstrings: - def __init__(self, xid=None, error_type=None, code=None, data=b''): Assign parameters to object attributes. Arg...
89940bed83f8e792f5ed5c9f12346016cd380d6f
<|skeleton|> class ErrorMsg: """OpenFlow Error Message. This message does not contain a body in addition to the OpenFlow Header.""" def __init__(self, xid=None, error_type=None, code=None, data=b''): """Assign parameters to object attributes. Args: xid (int): To be included in the message header. error...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ErrorMsg: """OpenFlow Error Message. This message does not contain a body in addition to the OpenFlow Header.""" def __init__(self, xid=None, error_type=None, code=None, data=b''): """Assign parameters to object attributes. Args: xid (int): To be included in the message header. error_type (ErrorT...
the_stack_v2_python_sparse
pyof/v0x04/asynchronous/error_msg.py
kytos/python-openflow
train
53
435a3385c0320825231df20600b603743aaed547
[ "patch_dir = os.path.dirname(seriesfile)\nif not os.path.exists(seriesfile):\n return []\ntry:\n s = open(seriesfile)\nexcept Exception as err:\n raise GbpError('Cannot open series file: %s' % err)\nqueue = klass._read_series(s, patch_dir)\ns.close()\nreturn queue", "queue = PatchSeries()\nfor line in se...
<|body_start_0|> patch_dir = os.path.dirname(seriesfile) if not os.path.exists(seriesfile): return [] try: s = open(seriesfile) except Exception as err: raise GbpError('Cannot open series file: %s' % err) queue = klass._read_series(s, patch_dir...
A series of L{Patch}es as read from a quilt series file).
PatchSeries
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatchSeries: """A series of L{Patch}es as read from a quilt series file).""" def read_series_file(klass, seriesfile): """Read a series file into L{Patch} objects""" <|body_0|> def _read_series(klass, series, patch_dir): """Read patch series >>> PatchSeries._read_...
stack_v2_sparse_classes_36k_train_009668
8,474
no_license
[ { "docstring": "Read a series file into L{Patch} objects", "name": "read_series_file", "signature": "def read_series_file(klass, seriesfile)" }, { "docstring": "Read patch series >>> PatchSeries._read_series(['a/b', 'a -p1', 'a/b -p2'], '.') # doctest:+NORMALIZE_WHITESPACE [<gbp.patch_series.Pat...
5
stack_v2_sparse_classes_30k_train_006593
Implement the Python class `PatchSeries` described below. Class description: A series of L{Patch}es as read from a quilt series file). Method signatures and docstrings: - def read_series_file(klass, seriesfile): Read a series file into L{Patch} objects - def _read_series(klass, series, patch_dir): Read patch series >...
Implement the Python class `PatchSeries` described below. Class description: A series of L{Patch}es as read from a quilt series file). Method signatures and docstrings: - def read_series_file(klass, seriesfile): Read a series file into L{Patch} objects - def _read_series(klass, series, patch_dir): Read patch series >...
0dca507f38faf606ed8b6dd0f8815bea9b422f58
<|skeleton|> class PatchSeries: """A series of L{Patch}es as read from a quilt series file).""" def read_series_file(klass, seriesfile): """Read a series file into L{Patch} objects""" <|body_0|> def _read_series(klass, series, patch_dir): """Read patch series >>> PatchSeries._read_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PatchSeries: """A series of L{Patch}es as read from a quilt series file).""" def read_series_file(klass, seriesfile): """Read a series file into L{Patch} objects""" patch_dir = os.path.dirname(seriesfile) if not os.path.exists(seriesfile): return [] try: ...
the_stack_v2_python_sparse
gbp/patch_series.py
marquiz/git-buildpackage-rpm
train
10
9f7584608e21a7b95704df29eeb99956f1120fec
[ "fg_cache = defaultdict(list)\nlogger.info('Building Sampling Cache for Dataloder')\nfor case_id, item in maybe_verbose_iterable(self._data.items(), desc='Sampling Cache'):\n candidates = load_pickle(item['boxes_file'])\n if candidates['instances']:\n for instance_id, instance_class in zip(candidates['...
<|body_start_0|> fg_cache = defaultdict(list) logger.info('Building Sampling Cache for Dataloder') for case_id, item in maybe_verbose_iterable(self._data.items(), desc='Sampling Cache'): candidates = load_pickle(item['boxes_file']) if candidates['instances']: ...
DataLoader3DBalanced
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataLoader3DBalanced: def build_cache(self) -> Tuple[Dict[int, List[Tuple[str, int]]], List]: """Build up cache for sampling Returns: Dict[int, List[Tuple[str, int]]]: foreground cache which contains of list of tuple of case ids and instance ids for each class List: background cache (all...
stack_v2_sparse_classes_36k_train_009669
18,912
permissive
[ { "docstring": "Build up cache for sampling Returns: Dict[int, List[Tuple[str, int]]]: foreground cache which contains of list of tuple of case ids and instance ids for each class List: background cache (all samples which do not have any foreground)", "name": "build_cache", "signature": "def build_cache...
2
stack_v2_sparse_classes_30k_test_000739
Implement the Python class `DataLoader3DBalanced` described below. Class description: Implement the DataLoader3DBalanced class. Method signatures and docstrings: - def build_cache(self) -> Tuple[Dict[int, List[Tuple[str, int]]], List]: Build up cache for sampling Returns: Dict[int, List[Tuple[str, int]]]: foreground ...
Implement the Python class `DataLoader3DBalanced` described below. Class description: Implement the DataLoader3DBalanced class. Method signatures and docstrings: - def build_cache(self) -> Tuple[Dict[int, List[Tuple[str, int]]], List]: Build up cache for sampling Returns: Dict[int, List[Tuple[str, int]]]: foreground ...
4f41faa7536dcef8fca7b647dcdca25360e5b58a
<|skeleton|> class DataLoader3DBalanced: def build_cache(self) -> Tuple[Dict[int, List[Tuple[str, int]]], List]: """Build up cache for sampling Returns: Dict[int, List[Tuple[str, int]]]: foreground cache which contains of list of tuple of case ids and instance ids for each class List: background cache (all...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataLoader3DBalanced: def build_cache(self) -> Tuple[Dict[int, List[Tuple[str, int]]], List]: """Build up cache for sampling Returns: Dict[int, List[Tuple[str, int]]]: foreground cache which contains of list of tuple of case ids and instance ids for each class List: background cache (all samples which...
the_stack_v2_python_sparse
nndet/io/datamodule/bg_loader.py
dboun/nnDetection
train
1
ad2f6561c62783e60303233d0dccc3220fe0ac5e
[ "left, right = (0, len(nums) - 1)\nresult = []\nwhile left < right:\n if nums[left] + nums[right] == target:\n if [-target, nums[left], nums[right]] not in result:\n result.append([-target, nums[left], nums[right]])\n left += 1\n right -= 1\n elif nums[left] + nums[right] < tar...
<|body_start_0|> left, right = (0, len(nums) - 1) result = [] while left < right: if nums[left] + nums[right] == target: if [-target, nums[left], nums[right]] not in result: result.append([-target, nums[left], nums[right]]) left += ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> left, rig...
stack_v2_sparse_classes_36k_train_009670
1,141
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_007812
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> ...
9bd2d706f014ce84356ba38fc7801da0285a91d3
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" left, right = (0, len(nums) - 1) result = [] while left < right: if nums[left] + nums[right] == target: if [-target, nums[left], nums[right]] no...
the_stack_v2_python_sparse
leetcode/threeSum-15.py
pittcat/Algorithm_Practice
train
0
63d0c290475cd872d4e0c53ed8d78f4cbd133bcd
[ "def replace(match_obj):\n \"\"\"\n Returns the match text prefixed with backslash\n\n :param re.match match_obj: The match.\n\n :rtype: str\n \"\"\"\n return '\\\\' + match_obj.group(0)\nreturn re.sub('[\\\\\\\\{}]', replace, text)", "def replace(match_obj):\n ...
<|body_start_0|> def replace(match_obj): """ Returns the match text prefixed with backslash :param re.match match_obj: The match. :rtype: str """ return '\\' + match_obj.group(0) return re.sub('[\\\...
Utility class with functions for generating SDoc code.
SDoc
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SDoc: """Utility class with functions for generating SDoc code.""" def escape(text: str) -> str: """Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string.""" <|body_0|> def unescape(text: str) -> str: """Returns an unescaped S...
stack_v2_sparse_classes_36k_train_009671
1,442
permissive
[ { "docstring": "Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string.", "name": "escape", "signature": "def escape(text: str) -> str" }, { "docstring": "Returns an unescaped SDoc escaped string. I.e. removes back slashes. :param str text: The SDoc escaped st...
2
stack_v2_sparse_classes_30k_val_000086
Implement the Python class `SDoc` described below. Class description: Utility class with functions for generating SDoc code. Method signatures and docstrings: - def escape(text: str) -> str: Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string. - def unescape(text: str) -> str: R...
Implement the Python class `SDoc` described below. Class description: Utility class with functions for generating SDoc code. Method signatures and docstrings: - def escape(text: str) -> str: Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string. - def unescape(text: str) -> str: R...
589c2a27eceebb7d96c14744c1632bdbdee9be52
<|skeleton|> class SDoc: """Utility class with functions for generating SDoc code.""" def escape(text: str) -> str: """Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string.""" <|body_0|> def unescape(text: str) -> str: """Returns an unescaped S...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SDoc: """Utility class with functions for generating SDoc code.""" def escape(text: str) -> str: """Returns an escaped string that is safe to use in SDoc. :param str text: The escaped string.""" def replace(match_obj): """ Returns the match text prefixed wi...
the_stack_v2_python_sparse
sdoc/helper/SDoc.py
SDoc/py-sdoc
train
2
05a152f09390369a6d9d02a0febe6cec74d508b7
[ "response = {'success': False, 'message': 'something went wrong', 'data': []}\ntry:\n user = request.user\n redis_data = red.hvals(str(user.id) + 'label')\n if len(redis_data) == 0:\n labels = Label.objects.filter(user_id=user.id)\n label_name = [i.name for i in labels]\n logger.info('...
<|body_start_0|> response = {'success': False, 'message': 'something went wrong', 'data': []} try: user = request.user redis_data = red.hvals(str(user.id) + 'label') if len(redis_data) == 0: labels = Label.objects.filter(user_id=user.id) ...
Summary: -------- Label create class will let authorized user to get and create label. Methods: -------- get: User will get all the created labels by the user. post: User will able to create more labels.
LabelsCreate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelsCreate: """Summary: -------- Label create class will let authorized user to get and create label. Methods: -------- get: User will get all the created labels by the user. post: User will able to create more labels.""" def get(self, request): """Summary: -------- label will be f...
stack_v2_sparse_classes_36k_train_009672
30,711
no_license
[ { "docstring": "Summary: -------- label will be fetched by the User. Exception: ---------- Exception: if anything goes wrong. Returns: -------- response: User will get all the created labels by the user or error msg if label id does not exist.", "name": "get", "signature": "def get(self, request)" }, ...
2
stack_v2_sparse_classes_30k_train_002411
Implement the Python class `LabelsCreate` described below. Class description: Summary: -------- Label create class will let authorized user to get and create label. Methods: -------- get: User will get all the created labels by the user. post: User will able to create more labels. Method signatures and docstrings: - ...
Implement the Python class `LabelsCreate` described below. Class description: Summary: -------- Label create class will let authorized user to get and create label. Methods: -------- get: User will get all the created labels by the user. post: User will able to create more labels. Method signatures and docstrings: - ...
f4035742d959f493f93a593f49e2fcacb721f85d
<|skeleton|> class LabelsCreate: """Summary: -------- Label create class will let authorized user to get and create label. Methods: -------- get: User will get all the created labels by the user. post: User will able to create more labels.""" def get(self, request): """Summary: -------- label will be f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LabelsCreate: """Summary: -------- Label create class will let authorized user to get and create label. Methods: -------- get: User will get all the created labels by the user. post: User will able to create more labels.""" def get(self, request): """Summary: -------- label will be fetched by the...
the_stack_v2_python_sparse
note/views.py
nk900600/fundooapp
train
3
277672d3e329c6df185fb6c4add750e4a964c717
[ "responses = super().get_source_responses(api_url)\nurl = Collector.api_url(self)\ncomponent = self.parameters.get('component')\napi_url = URL(f'{url}/api/issues/search?componentKeys={component}&status=RESOLVED&resolutions=WONTFIX,FALSE-POSITIVE&ps=500')\nreturn responses + [requests.get(api_url, timeout=self.TIMEO...
<|body_start_0|> responses = super().get_source_responses(api_url) url = Collector.api_url(self) component = self.parameters.get('component') api_url = URL(f'{url}/api/issues/search?componentKeys={component}&status=RESOLVED&resolutions=WONTFIX,FALSE-POSITIVE&ps=500') return respo...
SonarQube suppressed violations collector.
SonarQubeSuppressedViolations
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SonarQubeSuppressedViolations: """SonarQube suppressed violations collector.""" def get_source_responses(self, api_url: URL) -> List[requests.Response]: """Next to the suppressed rules, also get issues closed as false positive and won't fix from SonarQube.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_009673
7,307
permissive
[ { "docstring": "Next to the suppressed rules, also get issues closed as false positive and won't fix from SonarQube.", "name": "get_source_responses", "signature": "def get_source_responses(self, api_url: URL) -> List[requests.Response]" }, { "docstring": "Also add the resolution to the entity."...
2
stack_v2_sparse_classes_30k_train_021100
Implement the Python class `SonarQubeSuppressedViolations` described below. Class description: SonarQube suppressed violations collector. Method signatures and docstrings: - def get_source_responses(self, api_url: URL) -> List[requests.Response]: Next to the suppressed rules, also get issues closed as false positive ...
Implement the Python class `SonarQubeSuppressedViolations` described below. Class description: SonarQube suppressed violations collector. Method signatures and docstrings: - def get_source_responses(self, api_url: URL) -> List[requests.Response]: Next to the suppressed rules, also get issues closed as false positive ...
bfbdb2c43d7883abaf54999411aa4ac4897e9043
<|skeleton|> class SonarQubeSuppressedViolations: """SonarQube suppressed violations collector.""" def get_source_responses(self, api_url: URL) -> List[requests.Response]: """Next to the suppressed rules, also get issues closed as false positive and won't fix from SonarQube.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SonarQubeSuppressedViolations: """SonarQube suppressed violations collector.""" def get_source_responses(self, api_url: URL) -> List[requests.Response]: """Next to the suppressed rules, also get issues closed as false positive and won't fix from SonarQube.""" responses = super().get_sourc...
the_stack_v2_python_sparse
components/collector/src/collectors/sonarqube.py
Hedde/quality-time
train
0
8154bf856ea7c7b9578c63f59ccffd17b566d746
[ "super().__init__()\nself.multioutputWrapper = True\nimport sklearn\nimport sklearn.ensemble\nself.model = sklearn.ensemble.BaggingRegressor", "specs = super().getInputSpecification()\nspecs.description = 'The \\\\xmlNode{BaggingRegressor} is an ensemble meta-estimator that fits base regressors each on random sub...
<|body_start_0|> super().__init__() self.multioutputWrapper = True import sklearn import sklearn.ensemble self.model = sklearn.ensemble.BaggingRegressor <|end_body_0|> <|body_start_1|> specs = super().getInputSpecification() specs.description = 'The \\xmlNode{Bag...
A Bagging Regressor A Bagging regressor is an ensemble meta-estimator that fits base regressors each on random subsets of the original dataset and then aggregate their individual predictions (either by voting or by averaging) to form a final prediction. Such a meta-estimator can typically be used as a way to reduce the...
BaggingRegressor
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaggingRegressor: """A Bagging Regressor A Bagging regressor is an ensemble meta-estimator that fits base regressors each on random subsets of the original dataset and then aggregate their individual predictions (either by voting or by averaging) to form a final prediction. Such a meta-estimator ...
stack_v2_sparse_classes_36k_train_009674
8,307
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
4
stack_v2_sparse_classes_30k_train_008633
Implement the Python class `BaggingRegressor` described below. Class description: A Bagging Regressor A Bagging regressor is an ensemble meta-estimator that fits base regressors each on random subsets of the original dataset and then aggregate their individual predictions (either by voting or by averaging) to form a f...
Implement the Python class `BaggingRegressor` described below. Class description: A Bagging Regressor A Bagging regressor is an ensemble meta-estimator that fits base regressors each on random subsets of the original dataset and then aggregate their individual predictions (either by voting or by averaging) to form a f...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class BaggingRegressor: """A Bagging Regressor A Bagging regressor is an ensemble meta-estimator that fits base regressors each on random subsets of the original dataset and then aggregate their individual predictions (either by voting or by averaging) to form a final prediction. Such a meta-estimator ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaggingRegressor: """A Bagging Regressor A Bagging regressor is an ensemble meta-estimator that fits base regressors each on random subsets of the original dataset and then aggregate their individual predictions (either by voting or by averaging) to form a final prediction. Such a meta-estimator can typically...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/Ensemble/BaggingRegressor.py
idaholab/raven
train
201
71e5ec9f0105511cb33dd5bbec9e2789017b92b4
[ "self.id = id\nself.provider_id = provider_id\nself.server_time = server_time\nself.active_from = active_from\nself.active_to = active_to\nself.rpm_over_value = rpm_over_value\nself.over_speed_value = over_speed_value\nself.excess_speed_value = excess_speed_value\nself.long_idle_value = long_idle_value\nself.hi_thr...
<|body_start_0|> self.id = id self.provider_id = provider_id self.server_time = server_time self.active_from = active_from self.active_to = active_to self.rpm_over_value = rpm_over_value self.over_speed_value = over_speed_value self.excess_speed_value = ex...
Implementation of the 'Performance Thresholds' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of the TSP server_time (string): Date and time when this object was received at the TSP act...
PerformanceThresholds
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerformanceThresholds: """Implementation of the 'Performance Thresholds' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of the TSP server_time (string): Date and ...
stack_v2_sparse_classes_36k_train_009675
4,395
permissive
[ { "docstring": "Constructor for the PerformanceThresholds class", "name": "__init__", "signature": "def __init__(self, id=None, provider_id=None, server_time=None, active_from=None, active_to=None, rpm_over_value=None, over_speed_value=None, excess_speed_value=None, long_idle_value=None, hi_throttle_val...
2
stack_v2_sparse_classes_30k_train_003952
Implement the Python class `PerformanceThresholds` described below. Class description: Implementation of the 'Performance Thresholds' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of ...
Implement the Python class `PerformanceThresholds` described below. Class description: Implementation of the 'Performance Thresholds' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of ...
729e9391879e273545a4818558677b2e47261f08
<|skeleton|> class PerformanceThresholds: """Implementation of the 'Performance Thresholds' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of the TSP server_time (string): Date and ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PerformanceThresholds: """Implementation of the 'Performance Thresholds' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of the TSP server_time (string): Date and time when thi...
the_stack_v2_python_sparse
sdk/python/v0.1-rc.4/opentelematicsapi/models/performance_thresholds.py
nmfta-repo/nmfta-opentelematics-prototype
train
2
629160f732b6b93b93b54ca8c66240d1678ef76c
[ "self.GET_PARSER.add_argument('uid', required=True, type=int, location='args')\nself.GET_PARSER.add_argument('type', type=int, default=0, location='args')\nargs = self.GET_PARSER.parse_args()\nuser = User.query.filter_by(id=args['uid']).first()\nif user is None:\n return ({'error': 'no such user found'}, 404)\nu...
<|body_start_0|> self.GET_PARSER.add_argument('uid', required=True, type=int, location='args') self.GET_PARSER.add_argument('type', type=int, default=0, location='args') args = self.GET_PARSER.parse_args() user = User.query.filter_by(id=args['uid']).first() if user is None: ...
UnreadResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnreadResource: def get(self): """测试: 参数: uid, type(可选, 0(默认值) - 获取post_id; 1 - 获取对应的 post, 返回值与 get post 返回值一致) curl "localhost:8080/interaction/api/v2/unread?uid=1&type=0" # type 默认为 0 curl "localhost:8080/interaction/api/v2/unread?uid=1&type=1" :return: 可能返回值: 404, 表示没有该用户, 或者该用户并没有未读...
stack_v2_sparse_classes_36k_train_009676
3,791
no_license
[ { "docstring": "测试: 参数: uid, type(可选, 0(默认值) - 获取post_id; 1 - 获取对应的 post, 返回值与 get post 返回值一致) curl \"localhost:8080/interaction/api/v2/unread?uid=1&type=0\" # type 默认为 0 curl \"localhost:8080/interaction/api/v2/unread?uid=1&type=1\" :return: 可能返回值: 404, 表示没有该用户, 或者该用户并没有未读信息 200, {\"messages\": [1, 2, 3,...]},...
2
stack_v2_sparse_classes_30k_train_000452
Implement the Python class `UnreadResource` described below. Class description: Implement the UnreadResource class. Method signatures and docstrings: - def get(self): 测试: 参数: uid, type(可选, 0(默认值) - 获取post_id; 1 - 获取对应的 post, 返回值与 get post 返回值一致) curl "localhost:8080/interaction/api/v2/unread?uid=1&type=0" # type 默认为 ...
Implement the Python class `UnreadResource` described below. Class description: Implement the UnreadResource class. Method signatures and docstrings: - def get(self): 测试: 参数: uid, type(可选, 0(默认值) - 获取post_id; 1 - 获取对应的 post, 返回值与 get post 返回值一致) curl "localhost:8080/interaction/api/v2/unread?uid=1&type=0" # type 默认为 ...
076f2a6ed334f8a96b741d0c5c9d268f3716c8b3
<|skeleton|> class UnreadResource: def get(self): """测试: 参数: uid, type(可选, 0(默认值) - 获取post_id; 1 - 获取对应的 post, 返回值与 get post 返回值一致) curl "localhost:8080/interaction/api/v2/unread?uid=1&type=0" # type 默认为 0 curl "localhost:8080/interaction/api/v2/unread?uid=1&type=1" :return: 可能返回值: 404, 表示没有该用户, 或者该用户并没有未读...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnreadResource: def get(self): """测试: 参数: uid, type(可选, 0(默认值) - 获取post_id; 1 - 获取对应的 post, 返回值与 get post 返回值一致) curl "localhost:8080/interaction/api/v2/unread?uid=1&type=0" # type 默认为 0 curl "localhost:8080/interaction/api/v2/unread?uid=1&type=1" :return: 可能返回值: 404, 表示没有该用户, 或者该用户并没有未读信息 200, {"mess...
the_stack_v2_python_sparse
app/mod_interaction/resources/UnreadResource.py
xiaofud/syllabus_backend
train
0
e5b52a15afb6a90b02115a2567485fe602292fc2
[ "bert = cls()\nif 'farm_lm_name' in kwargs:\n bert.name = kwargs['farm_lm_name']\nelse:\n bert.name = pretrained_model_name_or_path\nfarm_lm_config = Path(pretrained_model_name_or_path) / 'language_model_config.json'\nif os.path.exists(farm_lm_config):\n bert_config = BertConfig.from_pretrained(farm_lm_con...
<|body_start_0|> bert = cls() if 'farm_lm_name' in kwargs: bert.name = kwargs['farm_lm_name'] else: bert.name = pretrained_model_name_or_path farm_lm_config = Path(pretrained_model_name_or_path) / 'language_model_config.json' if os.path.exists(farm_lm_conf...
BertLongLanguageModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BertLongLanguageModel: def load(cls, pretrained_model_name_or_path, language=None, **kwargs): """Load a pretrained model by supplying * the name of a remote model on s3 ("bert-base-cased" ...) * OR a local path of a model trained via transformers ("some_dir/huggingface_model") * OR a loc...
stack_v2_sparse_classes_36k_train_009677
4,031
no_license
[ { "docstring": "Load a pretrained model by supplying * the name of a remote model on s3 (\"bert-base-cased\" ...) * OR a local path of a model trained via transformers (\"some_dir/huggingface_model\") * OR a local path of a model trained via FARM (\"some_dir/farm_model\") :param pretrained_model_name_or_path: T...
2
stack_v2_sparse_classes_30k_train_010106
Implement the Python class `BertLongLanguageModel` described below. Class description: Implement the BertLongLanguageModel class. Method signatures and docstrings: - def load(cls, pretrained_model_name_or_path, language=None, **kwargs): Load a pretrained model by supplying * the name of a remote model on s3 ("bert-ba...
Implement the Python class `BertLongLanguageModel` described below. Class description: Implement the BertLongLanguageModel class. Method signatures and docstrings: - def load(cls, pretrained_model_name_or_path, language=None, **kwargs): Load a pretrained model by supplying * the name of a remote model on s3 ("bert-ba...
79aa582d0f17f1e8dace19d4b893daf15fb1b793
<|skeleton|> class BertLongLanguageModel: def load(cls, pretrained_model_name_or_path, language=None, **kwargs): """Load a pretrained model by supplying * the name of a remote model on s3 ("bert-base-cased" ...) * OR a local path of a model trained via transformers ("some_dir/huggingface_model") * OR a loc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BertLongLanguageModel: def load(cls, pretrained_model_name_or_path, language=None, **kwargs): """Load a pretrained model by supplying * the name of a remote model on s3 ("bert-base-cased" ...) * OR a local path of a model trained via transformers ("some_dir/huggingface_model") * OR a local path of a m...
the_stack_v2_python_sparse
experiments/custom_models/Longformer.py
agrov/MTL_clinical_outcome
train
0
49b80de6cc9939b4ac50cabdcd7e56d3bfe68323
[ "if not nums:\n return nums\nwindow, res = ([], [])\nfor i, x in enumerate(nums):\n if i >= k and window[0] <= i - k:\n window.pop(0)\n while window and nums[window[-1]] <= x:\n window.pop()\n window.append(i)\n if i >= k - 1:\n res.append(nums[window[0]])\nreturn res", "if not...
<|body_start_0|> if not nums: return nums window, res = ([], []) for i, x in enumerate(nums): if i >= k and window[0] <= i - k: window.pop(0) while window and nums[window[-1]] <= x: window.pop() window.append(i) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """使用列表模拟双端队列""" <|body_0|> def maxSlidingWindow1(self, nums: List[int], k: int) -> List[int]: """使用双端队列结构""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: ...
stack_v2_sparse_classes_36k_train_009678
3,160
no_license
[ { "docstring": "使用列表模拟双端队列", "name": "maxSlidingWindow", "signature": "def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]" }, { "docstring": "使用双端队列结构", "name": "maxSlidingWindow1", "signature": "def maxSlidingWindow1(self, nums: List[int], k: int) -> List[int]" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: 使用列表模拟双端队列 - def maxSlidingWindow1(self, nums: List[int], k: int) -> List[int]: 使用双端队列结构
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: 使用列表模拟双端队列 - def maxSlidingWindow1(self, nums: List[int], k: int) -> List[int]: 使用双端队列结构 <|skeleton|> class Sol...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """使用列表模拟双端队列""" <|body_0|> def maxSlidingWindow1(self, nums: List[int], k: int) -> List[int]: """使用双端队列结构""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """使用列表模拟双端队列""" if not nums: return nums window, res = ([], []) for i, x in enumerate(nums): if i >= k and window[0] <= i - k: window.pop(0) while wi...
the_stack_v2_python_sparse
算法/Week_02/239. 滑动窗口最大值.py
RichieSong/algorithm
train
0
6c067716a141f10b1af4d89086fc442c1dcc42fb
[ "n = len(s)\nif n == 0:\n return True\nfor i in range(n + 1):\n if s[:i] in wordDict and self.wordBreak(s[i:], wordDict):\n return True\nreturn False", "n = len(s)\ndp = [False for _ in range(n + 1)]\ndp[0] = True\nfor i in range(1, n + 1):\n for j in range(i):\n if dp[j] and s[j:i] in word...
<|body_start_0|> n = len(s) if n == 0: return True for i in range(n + 1): if s[:i] in wordDict and self.wordBreak(s[i:], wordDict): return True return False <|end_body_0|> <|body_start_1|> n = len(s) dp = [False for _ in range(n + ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool Time limit exceeded""" <|body_0|> def wordBreak1(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> def wordBreak0(se...
stack_v2_sparse_classes_36k_train_009679
1,355
no_license
[ { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool Time limit exceeded", "name": "wordBreak", "signature": "def wordBreak(self, s, wordDict)" }, { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak1", "signature": "def wordBreak1(self,...
3
stack_v2_sparse_classes_30k_train_007148
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool Time limit exceeded - def wordBreak1(self, s, wordDict): :type s: str :type wordDict: List[s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool Time limit exceeded - def wordBreak1(self, s, wordDict): :type s: str :type wordDict: List[s...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool Time limit exceeded""" <|body_0|> def wordBreak1(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> def wordBreak0(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool Time limit exceeded""" n = len(s) if n == 0: return True for i in range(n + 1): if s[:i] in wordDict and self.wordBreak(s[i:], wordDict): r...
the_stack_v2_python_sparse
PythonCode/src/0139_Word_Break.py
oneyuan/CodeforFun
train
0
3e14cbc3d56ea721b7b395be63542ab9305ae4b5
[ "self.pump = Pump('127.0.0.1', 1000)\nself.sensor = Sensor('127.0.0.2', 2000)\nself.decider = Decider(100, 0.05)\nself.controller = Controller(self.sensor, self.pump, self.decider)", "self.sensor.measure = MagicMock(return_value=130)\nself.pump.get_state = MagicMock(return_value='PUMP_OFF')\nself.controller.tick ...
<|body_start_0|> self.pump = Pump('127.0.0.1', 1000) self.sensor = Sensor('127.0.0.2', 2000) self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, self.pump, self.decider) <|end_body_0|> <|body_start_1|> self.sensor.measure = MagicMock(return_value=130) ...
Unit tests for the Controller class
ControllerTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """This method does a setup for unit testing Controller""" <|body_0|> def test_tick(self): """This method performs a unit test on tick""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_009680
3,866
no_license
[ { "docstring": "This method does a setup for unit testing Controller", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "This method performs a unit test on tick", "name": "test_tick", "signature": "def test_tick(self)" } ]
2
null
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): This method does a setup for unit testing Controller - def test_tick(self): This method performs a unit test on tick
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class Method signatures and docstrings: - def setUp(self): This method does a setup for unit testing Controller - def test_tick(self): This method performs a unit test on tick <|skeleton|> class ControllerT...
263685ca90110609bfd05d621516727f8cd0028f
<|skeleton|> class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """This method does a setup for unit testing Controller""" <|body_0|> def test_tick(self): """This method performs a unit test on tick""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ControllerTests: """Unit tests for the Controller class""" def setUp(self): """This method does a setup for unit testing Controller""" self.pump = Pump('127.0.0.1', 1000) self.sensor = Sensor('127.0.0.2', 2000) self.decider = Decider(100, 0.05) self.controller = Co...
the_stack_v2_python_sparse
students/Gabe_Lamberth/lesson06/water-regulation/waterregulation/test.py
aurel1212/Sp2018-Online
train
0
3d2a9b7782448fb7a65c9d65715362958ce73809
[ "self.N = N\nself.timestep = timestep * unit.femtosecond\nself.collision_rate = collision_rate * (1 / unit.picosecond)\nself.length_scale = length_scale * unit.nanometer\nself.temperature = temperature * unit.kelvin\nself.mass = mass * unit.amu", "mass_in_kg = self.mass._value * 1.66 * 10 ** (-27) * unit.kilogram...
<|body_start_0|> self.N = N self.timestep = timestep * unit.femtosecond self.collision_rate = collision_rate * (1 / unit.picosecond) self.length_scale = length_scale * unit.nanometer self.temperature = temperature * unit.kelvin self.mass = mass * unit.amu <|end_body_0|> ...
The methods in this class provide ways of calculating physically meaningful quantities in the Rouse model fromn polychrom parameter values and vice versa. The parameters in the constructor are usually set for computational convenience and do not have any physical meaning, except the number of monomers, N. Notes ----- T...
SimulationParams
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulationParams: """The methods in this class provide ways of calculating physically meaningful quantities in the Rouse model fromn polychrom parameter values and vice versa. The parameters in the constructor are usually set for computational convenience and do not have any physical meaning, exc...
stack_v2_sparse_classes_36k_train_009681
9,573
permissive
[ { "docstring": "Parameters ---------- N : int number of particles (default 1000) timestep : float timestep in femtoseconds (default 170) collision_rate : float collision rate in inverse picoseconds (default 2.0) mass : float Particle mass (default 100 amu) temperature : float temperature in kelvins, (defaults t...
5
stack_v2_sparse_classes_30k_train_018809
Implement the Python class `SimulationParams` described below. Class description: The methods in this class provide ways of calculating physically meaningful quantities in the Rouse model fromn polychrom parameter values and vice versa. The parameters in the constructor are usually set for computational convenience an...
Implement the Python class `SimulationParams` described below. Class description: The methods in this class provide ways of calculating physically meaningful quantities in the Rouse model fromn polychrom parameter values and vice versa. The parameters in the constructor are usually set for computational convenience an...
8052c597b0566f88a7b7ef80658a3f077e474a7e
<|skeleton|> class SimulationParams: """The methods in this class provide ways of calculating physically meaningful quantities in the Rouse model fromn polychrom parameter values and vice versa. The parameters in the constructor are usually set for computational convenience and do not have any physical meaning, exc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimulationParams: """The methods in this class provide ways of calculating physically meaningful quantities in the Rouse model fromn polychrom parameter values and vice versa. The parameters in the constructor are usually set for computational convenience and do not have any physical meaning, except the numbe...
the_stack_v2_python_sparse
polychrom/param_units.py
open2c/polychrom
train
24
6fc130749d5ac0d903d98b7d4deee629fa40a6e3
[ "if hyperparameter_config is None:\n hyperparameter_config = configs.encoder_decoder()\nsuper().__init__(name, parent=parent, hyperparameter_config=hyperparameter_config, spatial_scale=0)\nself.setup_children()\npass", "child_number = len(self.children)\nnew_block = ConvBlockGene(f'conv block {child_number}', ...
<|body_start_0|> if hyperparameter_config is None: hyperparameter_config = configs.encoder_decoder() super().__init__(name, parent=parent, hyperparameter_config=hyperparameter_config, spatial_scale=0) self.setup_children() pass <|end_body_0|> <|body_start_1|> child_n...
A sequence of ConvBlockGenes with different dilation rates. Hyperparameters: n_blocks (int): Number of computation block Genes descending from this BlockSetGene. TODO Attributes:
DilatedGene
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DilatedGene: """A sequence of ConvBlockGenes with different dilation rates. Hyperparameters: n_blocks (int): Number of computation block Genes descending from this BlockSetGene. TODO Attributes:""" def __init__(self, name: str, parent: Optional[ScaleGene]=None, hyperparameter_config: Optiona...
stack_v2_sparse_classes_36k_train_009682
4,228
no_license
[ { "docstring": "Constructor. Args: name (str): This gene's name. parent (Optional[ScaleGene]): Parent Gene. hyperparameter_config (Optional[mt.HyperparameterConfig]): The HyperparameterConfig governing this Gene's hyperparameters. If none is supplied, inherit from parent.", "name": "__init__", "signatur...
5
stack_v2_sparse_classes_30k_val_001061
Implement the Python class `DilatedGene` described below. Class description: A sequence of ConvBlockGenes with different dilation rates. Hyperparameters: n_blocks (int): Number of computation block Genes descending from this BlockSetGene. TODO Attributes: Method signatures and docstrings: - def __init__(self, name: s...
Implement the Python class `DilatedGene` described below. Class description: A sequence of ConvBlockGenes with different dilation rates. Hyperparameters: n_blocks (int): Number of computation block Genes descending from this BlockSetGene. TODO Attributes: Method signatures and docstrings: - def __init__(self, name: s...
6b78dc5e1e793a206ae3f4860d3a9ac887e663e5
<|skeleton|> class DilatedGene: """A sequence of ConvBlockGenes with different dilation rates. Hyperparameters: n_blocks (int): Number of computation block Genes descending from this BlockSetGene. TODO Attributes:""" def __init__(self, name: str, parent: Optional[ScaleGene]=None, hyperparameter_config: Optiona...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DilatedGene: """A sequence of ConvBlockGenes with different dilation rates. Hyperparameters: n_blocks (int): Number of computation block Genes descending from this BlockSetGene. TODO Attributes:""" def __init__(self, name: str, parent: Optional[ScaleGene]=None, hyperparameter_config: Optional[mt.Hyperpar...
the_stack_v2_python_sparse
example3/src/_private/genenet/genes/DilatedGene.py
leapmanlab/examples
train
1
601ce8f15d0a98c16fb4074c01f56c03c5490a44
[ "try:\n copied_dict = event.actions.copy()\nexcept AttributeError:\n copied_dict = {}\ncopied_dict.update(actions)\nevent.actions = copied_dict", "allowed_fields = ['enabled', 'ref', 'condition', 'actions']\nfor event_def in event_defs:\n valid_values = {k: v for k, v in event_def.items() if k in allowed...
<|body_start_0|> try: copied_dict = event.actions.copy() except AttributeError: copied_dict = {} copied_dict.update(actions) event.actions = copied_dict <|end_body_0|> <|body_start_1|> allowed_fields = ['enabled', 'ref', 'condition', 'actions'] fo...
Mixin that things can subclass from to allow parsing event defitions on it currently only works on Devices and Products
EventDefinitionMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventDefinitionMixin: """Mixin that things can subclass from to allow parsing event defitions on it currently only works on Devices and Products""" def update_actions(self, event, actions): """Add more actions to an event definition DynamicField's need a new dict to know there's a ch...
stack_v2_sparse_classes_36k_train_009683
2,384
permissive
[ { "docstring": "Add more actions to an event definition DynamicField's need a new dict to know there's a change Args: event (EventDefinition): What definition triggered this event actions (dict): DynamicField of actions to add to event Returns: EventDefinition: Updated definition", "name": "update_actions",...
3
null
Implement the Python class `EventDefinitionMixin` described below. Class description: Mixin that things can subclass from to allow parsing event defitions on it currently only works on Devices and Products Method signatures and docstrings: - def update_actions(self, event, actions): Add more actions to an event defin...
Implement the Python class `EventDefinitionMixin` described below. Class description: Mixin that things can subclass from to allow parsing event defitions on it currently only works on Devices and Products Method signatures and docstrings: - def update_actions(self, event, actions): Add more actions to an event defin...
5c569f54f100e23d72e2ac4de795739ea461a431
<|skeleton|> class EventDefinitionMixin: """Mixin that things can subclass from to allow parsing event defitions on it currently only works on Devices and Products""" def update_actions(self, event, actions): """Add more actions to an event definition DynamicField's need a new dict to know there's a ch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventDefinitionMixin: """Mixin that things can subclass from to allow parsing event defitions on it currently only works on Devices and Products""" def update_actions(self, event, actions): """Add more actions to an event definition DynamicField's need a new dict to know there's a change Args: ev...
the_stack_v2_python_sparse
zconnect/_models/mixins.py
zconnect-iot/zconnect-django
train
2
bb399ff89a7572a8d09d9d2600d287d72f04a4c6
[ "if not l1 or not l2:\n return l1 or l2\nhead = point = ListNode(0)\nwhile l1 and l2:\n if l1.val > l2.val:\n point.next = ListNode(l2.val)\n l2 = l2.next\n else:\n point.next = ListNode(l1.val)\n l1 = l1.next\n point = point.next\npoint.next = l1 or l2\nreturn head.next", ...
<|body_start_0|> if not l1 or not l2: return l1 or l2 head = point = ListNode(0) while l1 and l2: if l1.val > l2.val: point.next = ListNode(l2.val) l2 = l2.next else: point.next = ListNode(l1.val) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists1(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_009684
1,938
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists1", "signature": "def mergeTwoLists1(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists1(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists1(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode...
d181f2075c6c3881772dfbf54df3ac3390936079
<|skeleton|> class Solution: def mergeTwoLists1(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists1(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" if not l1 or not l2: return l1 or l2 head = point = ListNode(0) while l1 and l2: if l1.val > l2.val: point.next = ListNode(l2.val) ...
the_stack_v2_python_sparse
21. Merge Two Sorted Lists_Easy.py
melekoktay/Leetcode-Practice
train
0
6862042ea7709d986b271d2a30ace5d10f560a58
[ "server = self.create_test_server(wait_until='ACTIVE')\nself.client.remove_security_group(server['id'], name=server['security_groups'][0]['name'])\nserver = self.client.show_server(server['id'])['server']\nself.assertNotIn('security_groups', server)", "tenant_network = self.get_tenant_network()\n_, servers = comp...
<|body_start_0|> server = self.create_test_server(wait_until='ACTIVE') self.client.remove_security_group(server['id'], name=server['security_groups'][0]['name']) server = self.client.show_server(server['id'])['server'] self.assertNotIn('security_groups', server) <|end_body_0|> <|body_st...
ServerActionsTestOtherA
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerActionsTestOtherA: def test_remove_server_all_security_groups(self): """Test removing all security groups from server""" <|body_0|> def test_rebuild_server_in_stop_state(self): """Test rebuilding server in stop state The server in stop state should be rebuilt u...
stack_v2_sparse_classes_36k_train_009685
42,147
permissive
[ { "docstring": "Test removing all security groups from server", "name": "test_remove_server_all_security_groups", "signature": "def test_remove_server_all_security_groups(self)" }, { "docstring": "Test rebuilding server in stop state The server in stop state should be rebuilt using the provided ...
4
null
Implement the Python class `ServerActionsTestOtherA` described below. Class description: Implement the ServerActionsTestOtherA class. Method signatures and docstrings: - def test_remove_server_all_security_groups(self): Test removing all security groups from server - def test_rebuild_server_in_stop_state(self): Test ...
Implement the Python class `ServerActionsTestOtherA` described below. Class description: Implement the ServerActionsTestOtherA class. Method signatures and docstrings: - def test_remove_server_all_security_groups(self): Test removing all security groups from server - def test_rebuild_server_in_stop_state(self): Test ...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class ServerActionsTestOtherA: def test_remove_server_all_security_groups(self): """Test removing all security groups from server""" <|body_0|> def test_rebuild_server_in_stop_state(self): """Test rebuilding server in stop state The server in stop state should be rebuilt u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServerActionsTestOtherA: def test_remove_server_all_security_groups(self): """Test removing all security groups from server""" server = self.create_test_server(wait_until='ACTIVE') self.client.remove_security_group(server['id'], name=server['security_groups'][0]['name']) server...
the_stack_v2_python_sparse
tempest/api/compute/servers/test_server_actions.py
openstack/tempest
train
270
4fba029f77175c032e004305d8fa66c508a8968f
[ "logging.critical(\"Initiating Connection to service('cloudwatch') in region(%s)\" % region)\nself.client = boto3.client('ec2', region_name=region)\nreturn self.client", "logging.critical(\"Initiating Connection to service('cloudwatch') in region(%s)\" % region)\nself.client = boto3.client('cloudwatch', region_na...
<|body_start_0|> logging.critical("Initiating Connection to service('cloudwatch') in region(%s)" % region) self.client = boto3.client('ec2', region_name=region) return self.client <|end_body_0|> <|body_start_1|> logging.critical("Initiating Connection to service('cloudwatch') in region(...
conn
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class conn: def ec2(self, region): """Class to broker connection to aws""" <|body_0|> def cloudwatch(self, region): """Class to broker connection to aws""" <|body_1|> <|end_skeleton|> <|body_start_0|> logging.critical("Initiating Connection to service('cl...
stack_v2_sparse_classes_36k_train_009686
883
no_license
[ { "docstring": "Class to broker connection to aws", "name": "ec2", "signature": "def ec2(self, region)" }, { "docstring": "Class to broker connection to aws", "name": "cloudwatch", "signature": "def cloudwatch(self, region)" } ]
2
stack_v2_sparse_classes_30k_train_020113
Implement the Python class `conn` described below. Class description: Implement the conn class. Method signatures and docstrings: - def ec2(self, region): Class to broker connection to aws - def cloudwatch(self, region): Class to broker connection to aws
Implement the Python class `conn` described below. Class description: Implement the conn class. Method signatures and docstrings: - def ec2(self, region): Class to broker connection to aws - def cloudwatch(self, region): Class to broker connection to aws <|skeleton|> class conn: def ec2(self, region): "...
44abcc2993cab29c1e1da57382fcc3cf94a2d465
<|skeleton|> class conn: def ec2(self, region): """Class to broker connection to aws""" <|body_0|> def cloudwatch(self, region): """Class to broker connection to aws""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class conn: def ec2(self, region): """Class to broker connection to aws""" logging.critical("Initiating Connection to service('cloudwatch') in region(%s)" % region) self.client = boto3.client('ec2', region_name=region) return self.client def cloudwatch(self, region): """...
the_stack_v2_python_sparse
snapshot/aws_conn.py
wileyj/public-python
train
0
f8f1f5b53b5da617646d4f62eea453425e0d9f6c
[ "for key in data.keys():\n if key == k:\n data[key] = v\n elif type(data[key]) is dict:\n Json._replace_value(data[key], k, v)", "assert File.exists(file_path), 'Failed to find file: ' + file_path\nwith open(file_path) as json_file:\n data = json.load(json_file)\nreturn data", "with open(...
<|body_start_0|> for key in data.keys(): if key == k: data[key] = v elif type(data[key]) is dict: Json._replace_value(data[key], k, v) <|end_body_0|> <|body_start_1|> assert File.exists(file_path), 'Failed to find file: ' + file_path with ...
Json
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Json: def _replace_value(data, k, v): """Replace value of key inside json object. :param data: json object. :param k: key. :param v: value.""" <|body_0|> def read(file_path): """Read content of json file. :param file_path: Path to file. :return: Content of file as js...
stack_v2_sparse_classes_36k_train_009687
1,357
no_license
[ { "docstring": "Replace value of key inside json object. :param data: json object. :param k: key. :param v: value.", "name": "_replace_value", "signature": "def _replace_value(data, k, v)" }, { "docstring": "Read content of json file. :param file_path: Path to file. :return: Content of file as j...
3
stack_v2_sparse_classes_30k_train_013034
Implement the Python class `Json` described below. Class description: Implement the Json class. Method signatures and docstrings: - def _replace_value(data, k, v): Replace value of key inside json object. :param data: json object. :param k: key. :param v: value. - def read(file_path): Read content of json file. :para...
Implement the Python class `Json` described below. Class description: Implement the Json class. Method signatures and docstrings: - def _replace_value(data, k, v): Replace value of key inside json object. :param data: json object. :param k: key. :param v: value. - def read(file_path): Read content of json file. :para...
b173dc78de9f45a383bf74c2175f24e7fbae02c9
<|skeleton|> class Json: def _replace_value(data, k, v): """Replace value of key inside json object. :param data: json object. :param k: key. :param v: value.""" <|body_0|> def read(file_path): """Read content of json file. :param file_path: Path to file. :return: Content of file as js...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Json: def _replace_value(data, k, v): """Replace value of key inside json object. :param data: json object. :param k: key. :param v: value.""" for key in data.keys(): if key == k: data[key] = v elif type(data[key]) is dict: Json._replace_...
the_stack_v2_python_sparse
core/json/json_utils.py
niravgohil/nativescript-cli-tests
train
0
00c032be190b1786d10e6b2595539109a57a0509
[ "super().__init__(sensitivity, initial_x, initial_y, lives, game_width, game_height, None, bullet_grp, debug)\nself.scale(50 * game_width // 600, 50 * game_height // 800)\nself.delta_x = self.sensitivity // 4\nself.delta_y = self.sensitivity // 4\nself.set_points(200 * lives)", "if not direction:\n direction =...
<|body_start_0|> super().__init__(sensitivity, initial_x, initial_y, lives, game_width, game_height, None, bullet_grp, debug) self.scale(50 * game_width // 600, 50 * game_height // 800) self.delta_x = self.sensitivity // 4 self.delta_y = self.sensitivity // 4 self.set_points(200 ...
Crabs
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Crabs: def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): """The main class for Crabs""" <|body_0|> def shoot(self, direction: Direction=None): """Lets the mob shoot""" ...
stack_v2_sparse_classes_36k_train_009688
1,818
permissive
[ { "docstring": "The main class for Crabs", "name": "__init__", "signature": "def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool)" }, { "docstring": "Lets the mob shoot", "name": "shoot", "signature":...
3
null
Implement the Python class `Crabs` described below. Class description: Implement the Crabs class. Method signatures and docstrings: - def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): The main class for Crabs - def shoot(self,...
Implement the Python class `Crabs` described below. Class description: Implement the Crabs class. Method signatures and docstrings: - def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): The main class for Crabs - def shoot(self,...
6f8f2da4fd26ef1d77c0c6183230c3a5e6bf0bb9
<|skeleton|> class Crabs: def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): """The main class for Crabs""" <|body_0|> def shoot(self, direction: Direction=None): """Lets the mob shoot""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Crabs: def __init__(self, sensitivity: int, initial_x: int, initial_y: int, lives: int, game_width: int, game_height: int, bullet_grp, debug: bool): """The main class for Crabs""" super().__init__(sensitivity, initial_x, initial_y, lives, game_width, game_height, None, bullet_grp, debug) ...
the_stack_v2_python_sparse
Space_Invaders/classes/Game/Sprites/Crabs.py
Jh123x/Orbital
train
4
c3d467b3541385dac6c1fe7fd6887cca93785f40
[ "self.api_key = api_key\nself.api_secret = api_secret\nself.api = flickrapi.FlickrAPI(self.api_key)\nself.logger = logging.getLogger(__name__)", "try:\n photos_xml = self.api.interestingness_getList()\nexcept Exception as exc:\n self.logger.error(u'could not get photos XML: {0}'.format(exc))\nusernames = se...
<|body_start_0|> self.api_key = api_key self.api_secret = api_secret self.api = flickrapi.FlickrAPI(self.api_key) self.logger = logging.getLogger(__name__) <|end_body_0|> <|body_start_1|> try: photos_xml = self.api.interestingness_getList() except Exception a...
Represents utilities for using Flickr.
FlickrUtility
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlickrUtility: """Represents utilities for using Flickr.""" def __init__(self, api_key='71ae5bd2b331d44649161f6d3ff7e6b6', api_secret='45f1be4bd59f9155'): """Constructs a FlickrUtility.""" <|body_0|> def get_names_from_term(self): """Gets usernames for interestin...
stack_v2_sparse_classes_36k_train_009689
1,480
no_license
[ { "docstring": "Constructs a FlickrUtility.", "name": "__init__", "signature": "def __init__(self, api_key='71ae5bd2b331d44649161f6d3ff7e6b6', api_secret='45f1be4bd59f9155')" }, { "docstring": "Gets usernames for interesting photos.", "name": "get_names_from_term", "signature": "def get_...
2
stack_v2_sparse_classes_30k_train_010782
Implement the Python class `FlickrUtility` described below. Class description: Represents utilities for using Flickr. Method signatures and docstrings: - def __init__(self, api_key='71ae5bd2b331d44649161f6d3ff7e6b6', api_secret='45f1be4bd59f9155'): Constructs a FlickrUtility. - def get_names_from_term(self): Gets use...
Implement the Python class `FlickrUtility` described below. Class description: Represents utilities for using Flickr. Method signatures and docstrings: - def __init__(self, api_key='71ae5bd2b331d44649161f6d3ff7e6b6', api_secret='45f1be4bd59f9155'): Constructs a FlickrUtility. - def get_names_from_term(self): Gets use...
4abd3a0d8fe32c39a0755b6500cf39f0c71b03b4
<|skeleton|> class FlickrUtility: """Represents utilities for using Flickr.""" def __init__(self, api_key='71ae5bd2b331d44649161f6d3ff7e6b6', api_secret='45f1be4bd59f9155'): """Constructs a FlickrUtility.""" <|body_0|> def get_names_from_term(self): """Gets usernames for interestin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlickrUtility: """Represents utilities for using Flickr.""" def __init__(self, api_key='71ae5bd2b331d44649161f6d3ff7e6b6', api_secret='45f1be4bd59f9155'): """Constructs a FlickrUtility.""" self.api_key = api_key self.api_secret = api_secret self.api = flickrapi.FlickrAPI(s...
the_stack_v2_python_sparse
source/author/FlickrUtility.py
ralatsdc/bp-content
train
0
e21b359050ac425edf5f6aa730a2e29e6fca9a00
[ "self.working_directory = working_directory\nself.command_line = []\nself.env = {}\nself.status = 0\nself.output_std = ''\nself.output_err = ''", "LOGGER.info('Running %s', self.command_line)\nself.status = launch_command(self.command_line)\nif self.status != 0:\n raise MajaCotsException('Error running {}. Exi...
<|body_start_0|> self.working_directory = working_directory self.command_line = [] self.env = {} self.status = 0 self.output_std = '' self.output_err = '' <|end_body_0|> <|body_start_1|> LOGGER.info('Running %s', self.command_line) self.status = launch_co...
classdocs
MajaCots
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MajaCots: """classdocs""" def __init__(self, working_directory): """Constructor""" <|body_0|> def run(self): """Run self.command_line""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.working_directory = working_directory self.command...
stack_v2_sparse_classes_36k_train_009690
2,530
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, working_directory)" }, { "docstring": "Run self.command_line", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_018732
Implement the Python class `MajaCots` described below. Class description: classdocs Method signatures and docstrings: - def __init__(self, working_directory): Constructor - def run(self): Run self.command_line
Implement the Python class `MajaCots` described below. Class description: classdocs Method signatures and docstrings: - def __init__(self, working_directory): Constructor - def run(self): Run self.command_line <|skeleton|> class MajaCots: """classdocs""" def __init__(self, working_directory): """Con...
9688780f8dd8244e60603e1f11385e1fadc90cb4
<|skeleton|> class MajaCots: """classdocs""" def __init__(self, working_directory): """Constructor""" <|body_0|> def run(self): """Run self.command_line""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MajaCots: """classdocs""" def __init__(self, working_directory): """Constructor""" self.working_directory = working_directory self.command_line = [] self.env = {} self.status = 0 self.output_std = '' self.output_err = '' def run(self): ...
the_stack_v2_python_sparse
orchestrator/cots/maja_cots.py
alexgoussev/maja_gitlab
train
0
25d97f1cabf98aeee8ec31a1a997c9826212b5d9
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Auth Registry API The Auth Registry API is meant to as registry to obtain information of available auth providers. For example, to use OIDC or Kerberos for authentication. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document ar...
AuthRegistryServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthRegistryServiceServicer: """Auth Registry API The Auth Registry API is meant to as registry to obtain information of available auth providers. For example, to use OIDC or Kerberos for authentication. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "...
stack_v2_sparse_classes_36k_train_009691
4,150
no_license
[ { "docstring": "Returns the auth provider that is reponsible for the given resource reference. MUST return CODE_NOT_FOUND if the reference does not exist.", "name": "GetAuthProvider", "signature": "def GetAuthProvider(self, request, context)" }, { "docstring": "Returns a list of the available au...
2
stack_v2_sparse_classes_30k_train_005270
Implement the Python class `AuthRegistryServiceServicer` described below. Class description: Auth Registry API The Auth Registry API is meant to as registry to obtain information of available auth providers. For example, to use OIDC or Kerberos for authentication. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",...
Implement the Python class `AuthRegistryServiceServicer` described below. Class description: Auth Registry API The Auth Registry API is meant to as registry to obtain information of available auth providers. For example, to use OIDC or Kerberos for authentication. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",...
dad1a042b38db5f8bedcac3b6af25066f4d6eef9
<|skeleton|> class AuthRegistryServiceServicer: """Auth Registry API The Auth Registry API is meant to as registry to obtain information of available auth providers. For example, to use OIDC or Kerberos for authentication. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthRegistryServiceServicer: """Auth Registry API The Auth Registry API is meant to as registry to obtain information of available auth providers. For example, to use OIDC or Kerberos for authentication. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",...
the_stack_v2_python_sparse
cs3/authregistry/v0alpha/authregistry_pb2_grpc.py
SamuAlfageme/python-cs3apis
train
0
fd7d45849aec7fe660ba60b07c97d468b06f671c
[ "gr = FakeGraph()\ngr.add_edus(1, 2, 3)\ngr.add_rel('a', 1, 2)\ngr.add_cdu('X', [1, 2])\nmembers = gr.cdu_members('X')\nexpected = frozenset(['1', '2'])\nself.assertEqual(expected, members)", "gr = FakeGraph()\ngr.add_edus('a1', 'a2', 'b')\ngr.add_cdu('A', ['a1', 'a2'])\nns1 = frozenset(gr.neighbors('a1'))\nexpec...
<|body_start_0|> gr = FakeGraph() gr.add_edus(1, 2, 3) gr.add_rel('a', 1, 2) gr.add_cdu('X', [1, 2]) members = gr.cdu_members('X') expected = frozenset(['1', '2']) self.assertEqual(expected, members) <|end_body_0|> <|body_start_1|> gr = FakeGraph() ...
BasicGraphTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicGraphTest: def test_cdu_members_trivial(self): """trivial CDU membership""" <|body_0|> def test_cdu_neighbors(self): """does belong in the same CDU make you a neighbour?""" <|body_1|> def test_copy(self): """graph in essentially two componen...
stack_v2_sparse_classes_36k_train_009692
11,843
no_license
[ { "docstring": "trivial CDU membership", "name": "test_cdu_members_trivial", "signature": "def test_cdu_members_trivial(self)" }, { "docstring": "does belong in the same CDU make you a neighbour?", "name": "test_cdu_neighbors", "signature": "def test_cdu_neighbors(self)" }, { "do...
3
null
Implement the Python class `BasicGraphTest` described below. Class description: Implement the BasicGraphTest class. Method signatures and docstrings: - def test_cdu_members_trivial(self): trivial CDU membership - def test_cdu_neighbors(self): does belong in the same CDU make you a neighbour? - def test_copy(self): gr...
Implement the Python class `BasicGraphTest` described below. Class description: Implement the BasicGraphTest class. Method signatures and docstrings: - def test_cdu_members_trivial(self): trivial CDU membership - def test_cdu_neighbors(self): does belong in the same CDU make you a neighbour? - def test_copy(self): gr...
c550f4383016e05fe20ad7180a027979e3540d1f
<|skeleton|> class BasicGraphTest: def test_cdu_members_trivial(self): """trivial CDU membership""" <|body_0|> def test_cdu_neighbors(self): """does belong in the same CDU make you a neighbour?""" <|body_1|> def test_copy(self): """graph in essentially two componen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicGraphTest: def test_cdu_members_trivial(self): """trivial CDU membership""" gr = FakeGraph() gr.add_edus(1, 2, 3) gr.add_rel('a', 1, 2) gr.add_cdu('X', [1, 2]) members = gr.cdu_members('X') expected = frozenset(['1', '2']) self.assertEqual(e...
the_stack_v2_python_sparse
educe/tests.py
kowey/educe
train
1
e3685d5e705d429cc8cddd3d16edb7631f2047bf
[ "serialized = pickle.dumps(obj)\nif cls.COMPRESSION_CUTOFF_LEN and len(serialized) > cls.COMPRESSION_CUTOFF_LEN:\n serialized = cls.ZLIB_COMPRESSED_HEADER + zlib.compress(serialized)\nreturn serialized", "if obj[:len(cls.ZLIB_COMPRESSED_HEADER)] == cls.ZLIB_COMPRESSED_HEADER:\n obj = zlib.decompress(obj[len...
<|body_start_0|> serialized = pickle.dumps(obj) if cls.COMPRESSION_CUTOFF_LEN and len(serialized) > cls.COMPRESSION_CUTOFF_LEN: serialized = cls.ZLIB_COMPRESSED_HEADER + zlib.compress(serialized) return serialized <|end_body_0|> <|body_start_1|> if obj[:len(cls.ZLIB_COMPRESS...
PickleSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PickleSerializer: def _serialize(cls, obj): """Common serialization for storing objects in cache. If the object is huge, it will be transparently compressed.""" <|body_0|> def _deserialize(cls, obj): """Common deserialization for fetching objects from cache. `obj` mu...
stack_v2_sparse_classes_36k_train_009693
3,420
no_license
[ { "docstring": "Common serialization for storing objects in cache. If the object is huge, it will be transparently compressed.", "name": "_serialize", "signature": "def _serialize(cls, obj)" }, { "docstring": "Common deserialization for fetching objects from cache. `obj` must be not-None. Handle...
2
stack_v2_sparse_classes_30k_train_005149
Implement the Python class `PickleSerializer` described below. Class description: Implement the PickleSerializer class. Method signatures and docstrings: - def _serialize(cls, obj): Common serialization for storing objects in cache. If the object is huge, it will be transparently compressed. - def _deserialize(cls, o...
Implement the Python class `PickleSerializer` described below. Class description: Implement the PickleSerializer class. Method signatures and docstrings: - def _serialize(cls, obj): Common serialization for storing objects in cache. If the object is huge, it will be transparently compressed. - def _deserialize(cls, o...
dcc66feed986b8970c5e8827107c075e6655b692
<|skeleton|> class PickleSerializer: def _serialize(cls, obj): """Common serialization for storing objects in cache. If the object is huge, it will be transparently compressed.""" <|body_0|> def _deserialize(cls, obj): """Common deserialization for fetching objects from cache. `obj` mu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PickleSerializer: def _serialize(cls, obj): """Common serialization for storing objects in cache. If the object is huge, it will be transparently compressed.""" serialized = pickle.dumps(obj) if cls.COMPRESSION_CUTOFF_LEN and len(serialized) > cls.COMPRESSION_CUTOFF_LEN: se...
the_stack_v2_python_sparse
pypipes/service/base_client.py
vani-public/pipes
train
3
6cbb073eefcb2371ff40183a96f348d5313c11f0
[ "n = len(s)\ndp = [[0] * n for _ in range(n)]\nres = 0\nfor i in range(n - 1, -1, -1):\n for j in range(i, n):\n if s[i] == s[j]:\n if j - i < 3 or dp[i + 1][j - 1] == 1:\n dp[i][j] = 1\n res += 1\nreturn res", "def helper(s, left, right):\n res = 0\n while...
<|body_start_0|> n = len(s) dp = [[0] * n for _ in range(n)] res = 0 for i in range(n - 1, -1, -1): for j in range(i, n): if s[i] == s[j]: if j - i < 3 or dp[i + 1][j - 1] == 1: dp[i][j] = 1 r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countSubstrings0(self, s): """:type s: str :rtype: int""" <|body_0|> def countSubstrings(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(s) dp = [[0] * n for _ in range(n)] ...
stack_v2_sparse_classes_36k_train_009694
1,490
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "countSubstrings0", "signature": "def countSubstrings0(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "countSubstrings", "signature": "def countSubstrings(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_000144
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubstrings0(self, s): :type s: str :rtype: int - def countSubstrings(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubstrings0(self, s): :type s: str :rtype: int - def countSubstrings(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def countSubstrings0(self, s):...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def countSubstrings0(self, s): """:type s: str :rtype: int""" <|body_0|> def countSubstrings(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countSubstrings0(self, s): """:type s: str :rtype: int""" n = len(s) dp = [[0] * n for _ in range(n)] res = 0 for i in range(n - 1, -1, -1): for j in range(i, n): if s[i] == s[j]: if j - i < 3 or dp[i + 1][j ...
the_stack_v2_python_sparse
剑指 Offer II 020. 回文子字符串的个数.py
yangyuxiang1996/leetcode
train
0
0a11d970678b1787807bb3d4a261fb5f33e2c368
[ "hashMap = {}\nfor c in s:\n if c not in hashMap:\n hashMap[c] = 1\n else:\n hashMap[c] += 1\nfor c in t:\n if c not in hashMap:\n return False\n else:\n hashMap[c] -= 1\nfor key in hashMap:\n if hashMap[key] != 0:\n return False\nreturn True", "if len(s) != len(t...
<|body_start_0|> hashMap = {} for c in s: if c not in hashMap: hashMap[c] = 1 else: hashMap[c] += 1 for c in t: if c not in hashMap: return False else: hashMap[c] -= 1 for key ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isAnagram(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_0|> def isAnagram_self(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> hashMap = {} for c in s: ...
stack_v2_sparse_classes_36k_train_009695
1,068
no_license
[ { "docstring": ":type s: str :type t: str :rtype: bool", "name": "isAnagram", "signature": "def isAnagram(self, s, t)" }, { "docstring": ":type s: str :type t: str :rtype: bool", "name": "isAnagram_self", "signature": "def isAnagram_self(self, s, t)" } ]
2
stack_v2_sparse_classes_30k_train_015596
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isAnagram(self, s, t): :type s: str :type t: str :rtype: bool - def isAnagram_self(self, s, t): :type s: str :type t: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isAnagram(self, s, t): :type s: str :type t: str :rtype: bool - def isAnagram_self(self, s, t): :type s: str :type t: str :rtype: bool <|skeleton|> class Solution: def ...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution: def isAnagram(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_0|> def isAnagram_self(self, s, t): """:type s: str :type t: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isAnagram(self, s, t): """:type s: str :type t: str :rtype: bool""" hashMap = {} for c in s: if c not in hashMap: hashMap[c] = 1 else: hashMap[c] += 1 for c in t: if c not in hashMap: ...
the_stack_v2_python_sparse
242_valid_anagram/sol.py
lianke123321/leetcode_sol
train
0
9ff57083169c2e53ff90fa0efeee7d4db03e144c
[ "if admin_membership.is_admin is False:\n return None\nnew_membership = InitiativeMembership()\nnew_membership.initiative = self.initiative\nnew_membership.user = self.user\nnew_membership.save()\nself.approved_by = admin_membership\nself.is_open = False\nself.save()\nreturn new_membership", "if not admin_memb...
<|body_start_0|> if admin_membership.is_admin is False: return None new_membership = InitiativeMembership() new_membership.initiative = self.initiative new_membership.user = self.user new_membership.save() self.approved_by = admin_membership self.is_op...
Represents a request from a user to join the initiative. Must be approved by an admin.
JoinRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinRequest: """Represents a request from a user to join the initiative. Must be approved by an admin.""" def approve(self, admin_membership): """Approve a request for membership. :param admin_membership: The admin's membership that approves the request. :return: A new membership if ...
stack_v2_sparse_classes_36k_train_009696
7,959
no_license
[ { "docstring": "Approve a request for membership. :param admin_membership: The admin's membership that approves the request. :return: A new membership if success, None if fails.", "name": "approve", "signature": "def approve(self, admin_membership)" }, { "docstring": "Declines membership :param ...
2
stack_v2_sparse_classes_30k_train_013387
Implement the Python class `JoinRequest` described below. Class description: Represents a request from a user to join the initiative. Must be approved by an admin. Method signatures and docstrings: - def approve(self, admin_membership): Approve a request for membership. :param admin_membership: The admin's membership...
Implement the Python class `JoinRequest` described below. Class description: Represents a request from a user to join the initiative. Must be approved by an admin. Method signatures and docstrings: - def approve(self, admin_membership): Approve a request for membership. :param admin_membership: The admin's membership...
d099e5f4cb5fa412f6e1aa71b5dd7ba022161501
<|skeleton|> class JoinRequest: """Represents a request from a user to join the initiative. Must be approved by an admin.""" def approve(self, admin_membership): """Approve a request for membership. :param admin_membership: The admin's membership that approves the request. :return: A new membership if ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JoinRequest: """Represents a request from a user to join the initiative. Must be approved by an admin.""" def approve(self, admin_membership): """Approve a request for membership. :param admin_membership: The admin's membership that approves the request. :return: A new membership if success, None...
the_stack_v2_python_sparse
mapstory/apps/initiatives/models.py
ngageoint/storyscapes
train
3
f71043721417d00212bc58287a844aacdc4aca5b
[ "if not self.instance:\n raise RuntimeError('Manager method should be called: instance.images.get_or_download()')\nimage = Image.objects.get_image_from_url(url=url)\nif image.id:\n image_link = self.get_or_create(image=image, object_id=self.instance.id, content_type=ContentType.objects.get_for_model(self.inst...
<|body_start_0|> if not self.instance: raise RuntimeError('Manager method should be called: instance.images.get_or_download()') image = Image.objects.get_image_from_url(url=url) if image.id: image_link = self.get_or_create(image=image, object_id=self.instance.id, content_...
ImageLinkManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageLinkManager: def get_or_download(self, url, **kwargs): """Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and boolean flag equal True if image was downloaded""" <|body_0|> def download(self, url, **kwarg...
stack_v2_sparse_classes_36k_train_009697
5,904
permissive
[ { "docstring": "Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and boolean flag equal True if image was downloaded", "name": "get_or_download", "signature": "def get_or_download(self, url, **kwargs)" }, { "docstring": "Download ...
2
stack_v2_sparse_classes_30k_train_007362
Implement the Python class `ImageLinkManager` described below. Class description: Implement the ImageLinkManager class. Method signatures and docstrings: - def get_or_download(self, url, **kwargs): Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and b...
Implement the Python class `ImageLinkManager` described below. Class description: Implement the ImageLinkManager class. Method signatures and docstrings: - def get_or_download(self, url, **kwargs): Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and b...
c393dc8c2d59dc99aa2c3314d3372b6e2bf5497f
<|skeleton|> class ImageLinkManager: def get_or_download(self, url, **kwargs): """Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and boolean flag equal True if image was downloaded""" <|body_0|> def download(self, url, **kwarg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageLinkManager: def get_or_download(self, url, **kwargs): """Try to get already downloaded or download image using self.download() method Return tuple with image_link instance and boolean flag equal True if image was downloaded""" if not self.instance: raise RuntimeError('Manager...
the_stack_v2_python_sparse
cinemanio/images/models.py
cinemanio/backend
train
4
c94132212b48f1989fa77f852a05906e316f3629
[ "if data is not None:\n if self.__check_is_xarray(data) is True:\n self.data = data\n self.dataset_name = list(data.data_vars.keys())[0]\nelif fname is not None:\n self.fname = fname\n self.dataset_name = None\n self.__get_dataset()\nself.output_fname = output_fname\nself.smoothing_method ...
<|body_start_0|> if data is not None: if self.__check_is_xarray(data) is True: self.data = data self.dataset_name = list(data.data_vars.keys())[0] elif fname is not None: self.fname = fname self.dataset_name = None self.__ge...
Class to perform a time series analysis
Smoothing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Smoothing: """Class to perform a time series analysis""" def __init__(self, data=None, fname=None, output_fname=None, smoothing_method='smoothn', s=0.75, progressBar=None): """TATSSI smoother. Can receive either: - an xarray with dimensions time, latitude and longitude - a file name ...
stack_v2_sparse_classes_36k_train_009698
5,714
no_license
[ { "docstring": "TATSSI smoother. Can receive either: - an xarray with dimensions time, latitude and longitude - a file name full path with a valid TATSSI file that includes metadata to set the dates/time steps The results of smoother will be saved in output_fname for all valid smoothing methods :param data: xar...
5
stack_v2_sparse_classes_30k_train_019777
Implement the Python class `Smoothing` described below. Class description: Class to perform a time series analysis Method signatures and docstrings: - def __init__(self, data=None, fname=None, output_fname=None, smoothing_method='smoothn', s=0.75, progressBar=None): TATSSI smoother. Can receive either: - an xarray wi...
Implement the Python class `Smoothing` described below. Class description: Class to perform a time series analysis Method signatures and docstrings: - def __init__(self, data=None, fname=None, output_fname=None, smoothing_method='smoothn', s=0.75, progressBar=None): TATSSI smoother. Can receive either: - an xarray wi...
62762288e1b20a9369f68053a156d02ca9d94610
<|skeleton|> class Smoothing: """Class to perform a time series analysis""" def __init__(self, data=None, fname=None, output_fname=None, smoothing_method='smoothn', s=0.75, progressBar=None): """TATSSI smoother. Can receive either: - an xarray with dimensions time, latitude and longitude - a file name ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Smoothing: """Class to perform a time series analysis""" def __init__(self, data=None, fname=None, output_fname=None, smoothing_method='smoothn', s=0.75, progressBar=None): """TATSSI smoother. Can receive either: - an xarray with dimensions time, latitude and longitude - a file name full path wit...
the_stack_v2_python_sparse
TATSSI/time_series/smoothing.py
GerardoLopez/TATSSI
train
11
57b4459d36f9eababd4baff81bbd7ca1d6d9f1cb
[ "if root is None:\n return TreeNode(None)\nif p.val >= root.val and q.val <= root.val or (p.val <= root.val and q.val >= root.val):\n return root\nnodel = self.lowestCommonAncestor(root.left, p, q)\nnoder = self.lowestCommonAncestor(root.right, p, q)\nreturn nodel if noder.val is None else noder", "if p.val...
<|body_start_0|> if root is None: return TreeNode(None) if p.val >= root.val and q.val <= root.val or (p.val <= root.val and q.val >= root.val): return root nodel = self.lowestCommonAncestor(root.left, p, q) noder = self.lowestCommonAncestor(root.right, p, q) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """考虑到二叉搜索树的特性,使用递归方法 当前节点的值大于等于p小于等于q或者大于等于q小于等于p时满足最近公共祖先""" <|body_0|> def lowestCommonAncestor1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': ...
stack_v2_sparse_classes_36k_train_009699
1,754
no_license
[ { "docstring": "考虑到二叉搜索树的特性,使用递归方法 当前节点的值大于等于p小于等于q或者大于等于q小于等于p时满足最近公共祖先", "name": "lowestCommonAncestor", "signature": "def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode'" }, { "docstring": "考虑到二叉搜索树的特性,使用非递归方法", "name": "lowestCommonAncestor1", ...
2
stack_v2_sparse_classes_30k_train_001373
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': 考虑到二叉搜索树的特性,使用递归方法 当前节点的值大于等于p小于等于q或者大于等于q小于等于p时满足最近公共祖先 - def lowestCommonAncestor1...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': 考虑到二叉搜索树的特性,使用递归方法 当前节点的值大于等于p小于等于q或者大于等于q小于等于p时满足最近公共祖先 - def lowestCommonAncestor1...
95dddb78bccd169d9d219a473627361fe739ab5e
<|skeleton|> class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """考虑到二叉搜索树的特性,使用递归方法 当前节点的值大于等于p小于等于q或者大于等于q小于等于p时满足最近公共祖先""" <|body_0|> def lowestCommonAncestor1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': """考虑到二叉搜索树的特性,使用递归方法 当前节点的值大于等于p小于等于q或者大于等于q小于等于p时满足最近公共祖先""" if root is None: return TreeNode(None) if p.val >= root.val and q.val <= root.val or (p.val <= root.val and...
the_stack_v2_python_sparse
TreeOperation/lowestCommonAncestor.py
Philex5/codingPractice
train
0