blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3a65c2e4a42a6902c9b1e98bfa023e4e0bde7002 | [
"allure.dynamic.title('Wolf at the beginning of the queue')\nallure.dynamic.severity(allure.severity_level.NORMAL)\nallure.dynamic.description_html('<h3>Codewars badge:</h3><img src=\"https://www.codewars.com/users/myFirstCode/badges/large\"><h3>Test Description:</h3><p></p>')\nlst = ['wolf', 'sheep', 'sheep', 'she... | <|body_start_0|>
allure.dynamic.title('Wolf at the beginning of the queue')
allure.dynamic.severity(allure.severity_level.NORMAL)
allure.dynamic.description_html('<h3>Codewars badge:</h3><img src="https://www.codewars.com/users/myFirstCode/badges/large"><h3>Test Description:</h3><p></p>')
... | Testing warn_the_sheep function | WarnTheSheepTestCase | [
"Unlicense",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WarnTheSheepTestCase:
"""Testing warn_the_sheep function"""
def test_warn_the_sheep_wolf_at_start(self):
"""If the wolf is the closest animal to you, return "Pls go away and stop eating my sheep". :return:"""
<|body_0|>
def test_warn_the_sheep_wolf_in_middle(self):
... | stack_v2_sparse_classes_75kplus_train_071500 | 4,284 | permissive | [
{
"docstring": "If the wolf is the closest animal to you, return \"Pls go away and stop eating my sheep\". :return:",
"name": "test_warn_the_sheep_wolf_at_start",
"signature": "def test_warn_the_sheep_wolf_at_start(self)"
},
{
"docstring": "If the wolf is the closest animal to you, return \"Pls ... | 3 | stack_v2_sparse_classes_30k_train_047028 | Implement the Python class `WarnTheSheepTestCase` described below.
Class description:
Testing warn_the_sheep function
Method signatures and docstrings:
- def test_warn_the_sheep_wolf_at_start(self): If the wolf is the closest animal to you, return "Pls go away and stop eating my sheep". :return:
- def test_warn_the_s... | Implement the Python class `WarnTheSheepTestCase` described below.
Class description:
Testing warn_the_sheep function
Method signatures and docstrings:
- def test_warn_the_sheep_wolf_at_start(self): If the wolf is the closest animal to you, return "Pls go away and stop eating my sheep". :return:
- def test_warn_the_s... | ba3ea81125b6082d867f0ae34c6c9be15e153966 | <|skeleton|>
class WarnTheSheepTestCase:
"""Testing warn_the_sheep function"""
def test_warn_the_sheep_wolf_at_start(self):
"""If the wolf is the closest animal to you, return "Pls go away and stop eating my sheep". :return:"""
<|body_0|>
def test_warn_the_sheep_wolf_in_middle(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WarnTheSheepTestCase:
"""Testing warn_the_sheep function"""
def test_warn_the_sheep_wolf_at_start(self):
"""If the wolf is the closest animal to you, return "Pls go away and stop eating my sheep". :return:"""
allure.dynamic.title('Wolf at the beginning of the queue')
allure.dynami... | the_stack_v2_python_sparse | kyu_8/wolf_in_sheep_clothing/test_wolf_in_sheep_clothing.py | qamine-test/codewars | train | 0 |
5be36dd7c0286d3094e189756a5d4521ce61c20f | [
"try:\n entity = EntityService.find_by_business_identifier(business_identifier, allowed_roles=ALL_ALLOWED_ROLES)\n if entity is not None:\n response, status = (entity.as_dict(), http_status.HTTP_200_OK)\n else:\n response, status = ({'message': f'A business for {business_identifier} was not f... | <|body_start_0|>
try:
entity = EntityService.find_by_business_identifier(business_identifier, allowed_roles=ALL_ALLOWED_ROLES)
if entity is not None:
response, status = (entity.as_dict(), http_status.HTTP_200_OK)
else:
response, status = ({'mes... | Resource for managing entities. | EntityResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntityResource:
"""Resource for managing entities."""
def get(business_identifier):
"""Get an existing entity by it's business number."""
<|body_0|>
def patch(business_identifier):
"""Update an existing business by it's business number."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_071501 | 9,654 | permissive | [
{
"docstring": "Get an existing entity by it's business number.",
"name": "get",
"signature": "def get(business_identifier)"
},
{
"docstring": "Update an existing business by it's business number.",
"name": "patch",
"signature": "def patch(business_identifier)"
},
{
"docstring": ... | 3 | null | Implement the Python class `EntityResource` described below.
Class description:
Resource for managing entities.
Method signatures and docstrings:
- def get(business_identifier): Get an existing entity by it's business number.
- def patch(business_identifier): Update an existing business by it's business number.
- def... | Implement the Python class `EntityResource` described below.
Class description:
Resource for managing entities.
Method signatures and docstrings:
- def get(business_identifier): Get an existing entity by it's business number.
- def patch(business_identifier): Update an existing business by it's business number.
- def... | 923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01 | <|skeleton|>
class EntityResource:
"""Resource for managing entities."""
def get(business_identifier):
"""Get an existing entity by it's business number."""
<|body_0|>
def patch(business_identifier):
"""Update an existing business by it's business number."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EntityResource:
"""Resource for managing entities."""
def get(business_identifier):
"""Get an existing entity by it's business number."""
try:
entity = EntityService.find_by_business_identifier(business_identifier, allowed_roles=ALL_ALLOWED_ROLES)
if entity is not ... | the_stack_v2_python_sparse | auth-api/src/auth_api/resources/entity.py | bcgov/sbc-auth | train | 13 |
12b58b3225d863cbcf85c2e5380d45f9d4b90f24 | [
"parser = super(BaseDetectorService, self).add_arguments(parser, **kwargs)\nparser = self.add_input_arguments(parser, **kwargs)\nreturn parser",
"parser.add_argument('-i', '--input-uri', dest='raw_input_uri', default='{base}/{name}{ext}', metavar='URI', help='Name of the video file input or path to the resource. ... | <|body_start_0|>
parser = super(BaseDetectorService, self).add_arguments(parser, **kwargs)
parser = self.add_input_arguments(parser, **kwargs)
return parser
<|end_body_0|>
<|body_start_1|>
parser.add_argument('-i', '--input-uri', dest='raw_input_uri', default='{base}/{name}{ext}', metav... | ... | BaseDetectorService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseDetectorService:
"""..."""
def add_arguments(self, parser, **kwargs):
""":param parser: :param kwargs: :return:"""
<|body_0|>
def add_input_arguments(parser, **kwargs):
""":param parser: :param kwargs: :return:"""
<|body_1|>
def handle_options(se... | stack_v2_sparse_classes_75kplus_train_071502 | 3,731 | permissive | [
{
"docstring": ":param parser: :param kwargs: :return:",
"name": "add_arguments",
"signature": "def add_arguments(self, parser, **kwargs)"
},
{
"docstring": ":param parser: :param kwargs: :return:",
"name": "add_input_arguments",
"signature": "def add_input_arguments(parser, **kwargs)"
... | 4 | stack_v2_sparse_classes_30k_train_019162 | Implement the Python class `BaseDetectorService` described below.
Class description:
...
Method signatures and docstrings:
- def add_arguments(self, parser, **kwargs): :param parser: :param kwargs: :return:
- def add_input_arguments(parser, **kwargs): :param parser: :param kwargs: :return:
- def handle_options(self, ... | Implement the Python class `BaseDetectorService` described below.
Class description:
...
Method signatures and docstrings:
- def add_arguments(self, parser, **kwargs): :param parser: :param kwargs: :return:
- def add_input_arguments(parser, **kwargs): :param parser: :param kwargs: :return:
- def handle_options(self, ... | 617ff45c9c3c96bbd9a975aef15f1b2697282b9c | <|skeleton|>
class BaseDetectorService:
"""..."""
def add_arguments(self, parser, **kwargs):
""":param parser: :param kwargs: :return:"""
<|body_0|>
def add_input_arguments(parser, **kwargs):
""":param parser: :param kwargs: :return:"""
<|body_1|>
def handle_options(se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BaseDetectorService:
"""..."""
def add_arguments(self, parser, **kwargs):
""":param parser: :param kwargs: :return:"""
parser = super(BaseDetectorService, self).add_arguments(parser, **kwargs)
parser = self.add_input_arguments(parser, **kwargs)
return parser
def add_i... | the_stack_v2_python_sparse | shot_detector/services/base_detector_service.py | w495/python-video-shot-detector | train | 20 |
b4953c948cb12315264fc454f9bcb235e80f91cd | [
"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... | This service will provide the game state to clients as well as accept paddle input commands | GameMasterServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GameMasterServicer:
"""This service will provide the game state to clients as well as accept paddle input commands"""
def stream_game_state(self, request, context):
"""This is a hot stream of game state. Stream will exhaust when a player loses a match. rpc stream_game_state(PlayerIde... | stack_v2_sparse_classes_75kplus_train_071503 | 3,393 | permissive | [
{
"docstring": "This is a hot stream of game state. Stream will exhaust when a player loses a match. rpc stream_game_state(PlayerIdentifier) returns (stream GameState) {}",
"name": "stream_game_state",
"signature": "def stream_game_state(self, request, context)"
},
{
"docstring": "Let the game e... | 3 | stack_v2_sparse_classes_30k_train_023480 | Implement the Python class `GameMasterServicer` described below.
Class description:
This service will provide the game state to clients as well as accept paddle input commands
Method signatures and docstrings:
- def stream_game_state(self, request, context): This is a hot stream of game state. Stream will exhaust whe... | Implement the Python class `GameMasterServicer` described below.
Class description:
This service will provide the game state to clients as well as accept paddle input commands
Method signatures and docstrings:
- def stream_game_state(self, request, context): This is a hot stream of game state. Stream will exhaust whe... | e0d548267d7e0ca1b8690224cfd827af8ff571ab | <|skeleton|>
class GameMasterServicer:
"""This service will provide the game state to clients as well as accept paddle input commands"""
def stream_game_state(self, request, context):
"""This is a hot stream of game state. Stream will exhaust when a player loses a match. rpc stream_game_state(PlayerIde... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GameMasterServicer:
"""This service will provide the game state to clients as well as accept paddle input commands"""
def stream_game_state(self, request, context):
"""This is a hot stream of game state. Stream will exhaust when a player loses a match. rpc stream_game_state(PlayerIdentifier) retu... | the_stack_v2_python_sparse | proto_gen/gamemaster_pb2_grpc.py | dkeefe3773/pong-rl | train | 0 |
98d20027dc3eb270b1e9636165296c15b5482d38 | [
"pk = kwargs.get('pk')\nproj = Project.objects.filter(id=pk).first()\nif check_user_can_edit(proj, request.user):\n team_can_edit = check_user_teams_can_edit(proj, request.user)\n form = ProjectForm(instance=proj, can_edit=team_can_edit)\n return render(request, self.template_name, {'object': proj, 'form':... | <|body_start_0|>
pk = kwargs.get('pk')
proj = Project.objects.filter(id=pk).first()
if check_user_can_edit(proj, request.user):
team_can_edit = check_user_teams_can_edit(proj, request.user)
form = ProjectForm(instance=proj, can_edit=team_can_edit)
return rende... | View for editing the details of an existing Project instance. | ProjectEditView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectEditView:
"""View for editing the details of an existing Project instance."""
def get(self, request, *args, **kwargs):
"""Override default get request. So we can verify the user has edit privileges, either through super status or team membership."""
<|body_0|>
def... | stack_v2_sparse_classes_75kplus_train_071504 | 10,681 | no_license | [
{
"docstring": "Override default get request. So we can verify the user has edit privileges, either through super status or team membership.",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Project Edit Form validation and redirect.",
"name": "form_v... | 2 | stack_v2_sparse_classes_30k_train_020869 | Implement the Python class `ProjectEditView` described below.
Class description:
View for editing the details of an existing Project instance.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Override default get request. So we can verify the user has edit privileges, either through super ... | Implement the Python class `ProjectEditView` described below.
Class description:
View for editing the details of an existing Project instance.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Override default get request. So we can verify the user has edit privileges, either through super ... | ee419afa3c9f4b9ef3b30b62b693cfac956ce5b4 | <|skeleton|>
class ProjectEditView:
"""View for editing the details of an existing Project instance."""
def get(self, request, *args, **kwargs):
"""Override default get request. So we can verify the user has edit privileges, either through super status or team membership."""
<|body_0|>
def... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProjectEditView:
"""View for editing the details of an existing Project instance."""
def get(self, request, *args, **kwargs):
"""Override default get request. So we can verify the user has edit privileges, either through super status or team membership."""
pk = kwargs.get('pk')
pr... | the_stack_v2_python_sparse | DataSearch/projects/views.py | USEPA/FoodWaste | train | 1 |
0a8fe7f1d12e665f718c4f75ea152321564a628b | [
"super().validate(attrs)\nrun_id = attrs['run_id']\nplatform = attrs['platform']\nif self.instance is None and LearningResourceRun.objects.filter(platform=platform, run_id=run_id).exists():\n raise serializers.ValidationError('LearningResourceRun already exists')\nreturn attrs",
"super().handle_many_to_many(re... | <|body_start_0|>
super().validate(attrs)
run_id = attrs['run_id']
platform = attrs['platform']
if self.instance is None and LearningResourceRun.objects.filter(platform=platform, run_id=run_id).exists():
raise serializers.ValidationError('LearningResourceRun already exists')
... | Serializer for creating LearningResourceRun objects from edx data | LearningResourceRunSerializer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LearningResourceRunSerializer:
"""Serializer for creating LearningResourceRun objects from edx data"""
def validate(self, attrs):
"""Verify the run doesn't exist if we're creating a new one"""
<|body_0|>
def handle_many_to_many(self, resource):
"""Handle the crea... | stack_v2_sparse_classes_75kplus_train_071505 | 35,789 | permissive | [
{
"docstring": "Verify the run doesn't exist if we're creating a new one",
"name": "validate",
"signature": "def validate(self, attrs)"
},
{
"docstring": "Handle the creation and assignment of instructors and prices",
"name": "handle_many_to_many",
"signature": "def handle_many_to_many(s... | 3 | stack_v2_sparse_classes_30k_test_000681 | Implement the Python class `LearningResourceRunSerializer` described below.
Class description:
Serializer for creating LearningResourceRun objects from edx data
Method signatures and docstrings:
- def validate(self, attrs): Verify the run doesn't exist if we're creating a new one
- def handle_many_to_many(self, resou... | Implement the Python class `LearningResourceRunSerializer` described below.
Class description:
Serializer for creating LearningResourceRun objects from edx data
Method signatures and docstrings:
- def validate(self, attrs): Verify the run doesn't exist if we're creating a new one
- def handle_many_to_many(self, resou... | ba7442482da97d463302658c0aac989567ee1241 | <|skeleton|>
class LearningResourceRunSerializer:
"""Serializer for creating LearningResourceRun objects from edx data"""
def validate(self, attrs):
"""Verify the run doesn't exist if we're creating a new one"""
<|body_0|>
def handle_many_to_many(self, resource):
"""Handle the crea... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LearningResourceRunSerializer:
"""Serializer for creating LearningResourceRun objects from edx data"""
def validate(self, attrs):
"""Verify the run doesn't exist if we're creating a new one"""
super().validate(attrs)
run_id = attrs['run_id']
platform = attrs['platform']
... | the_stack_v2_python_sparse | course_catalog/serializers.py | mitodl/open-discussions | train | 13 |
13975bb4bf117af6d12835a2a501fadc5a650aea | [
"if not prices:\n return 0\nn = len(prices)\ndp = [0] * n\nmin_vals = [[0] * n for _ in range(n)]\nfor i in range(n - 1):\n min_price = 2147483647\n for j in range(i, n):\n if min_price > prices[j]:\n min_price = prices[j]\n min_vals[i][j] = min_price\nfor i in range(k):\n dp2 =... | <|body_start_0|>
if not prices:
return 0
n = len(prices)
dp = [0] * n
min_vals = [[0] * n for _ in range(n)]
for i in range(n - 1):
min_price = 2147483647
for j in range(i, n):
if min_price > prices[j]:
min_p... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit1(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit2(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
<|body_1|>
def maxProfit(self, k, prices):
""":ty... | stack_v2_sparse_classes_75kplus_train_071506 | 5,158 | no_license | [
{
"docstring": ":type k: int :type prices: List[int] :rtype: int",
"name": "maxProfit1",
"signature": "def maxProfit1(self, k, prices)"
},
{
"docstring": ":type k: int :type prices: List[int] :rtype: int",
"name": "maxProfit2",
"signature": "def maxProfit2(self, k, prices)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_018398 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit1(self, k, prices): :type k: int :type prices: List[int] :rtype: int
- def maxProfit2(self, k, prices): :type k: int :type prices: List[int] :rtype: int
- def maxPro... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit1(self, k, prices): :type k: int :type prices: List[int] :rtype: int
- def maxProfit2(self, k, prices): :type k: int :type prices: List[int] :rtype: int
- def maxPro... | 4a1747b6497305f3821612d9c358a6795b1690da | <|skeleton|>
class Solution:
def maxProfit1(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit2(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
<|body_1|>
def maxProfit(self, k, prices):
""":ty... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxProfit1(self, k, prices):
""":type k: int :type prices: List[int] :rtype: int"""
if not prices:
return 0
n = len(prices)
dp = [0] * n
min_vals = [[0] * n for _ in range(n)]
for i in range(n - 1):
min_price = 2147483647
... | the_stack_v2_python_sparse | DynamicProgramming/q188_best_time_to_buy_and_sell_stock_iv.py | sevenhe716/LeetCode | train | 0 | |
240eb56fbcd5ad0dcbe31232941174222398f78f | [
"if not root:\n return ''\nleft = self.serialize(root.left)\nright = self.serialize(root.right)\nans = str(root.val)\nif left:\n ans += ',' + left\nif right:\n ans += ',' + right\nreturn ans",
"if not data:\n return None\nnstack, rstack = ([], [2147483647])\nfor val in map(int, data.split(',')):\n ... | <|body_start_0|>
if not root:
return ''
left = self.serialize(root.left)
right = self.serialize(root.right)
ans = str(root.val)
if left:
ans += ',' + left
if right:
ans += ',' + right
return ans
<|end_body_0|>
<|body_start_1|>
... | Codec | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_75kplus_train_071507 | 1,513 | permissive | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | 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:... | 6edefc9e65a26e28dc2b0201d89f0578391ff195 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return ''
left = self.serialize(root.left)
right = self.serialize(root.right)
ans = str(root.val)
if left:
ans += ','... | the_stack_v2_python_sparse | Serialize and Deserialize BST.py | Eurus-Holmes/LCED | train | 12 | |
bee5bb7528216f52d5a7cb3ea19a030df36bfd69 | [
"self.search_space = search_space\nsuper(PBTHpo, self).__init__(search_space, **kwargs)\nself.hyperparameter_list = self.get_hyperparameters(self.config.policy.config_count)\nself.hpo = PBT(self.config.policy.config_count, self.config.policy.each_epochs, self.config.policy.total_rungs, self.local_base_path, paras_l... | <|body_start_0|>
self.search_space = search_space
super(PBTHpo, self).__init__(search_space, **kwargs)
self.hyperparameter_list = self.get_hyperparameters(self.config.policy.config_count)
self.hpo = PBT(self.config.policy.config_count, self.config.policy.each_epochs, self.config.policy.t... | An Hpo of PBT. | PBTHpo | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PBTHpo:
"""An Hpo of PBT."""
def __init__(self, search_space=None, **kwargs):
"""Init PBTHpo."""
<|body_0|>
def get_hyperparameters(self, num):
"""Use the trained model to propose a set of params from SearchSpace. :param int num: number of random samples from hyp... | stack_v2_sparse_classes_75kplus_train_071508 | 3,870 | permissive | [
{
"docstring": "Init PBTHpo.",
"name": "__init__",
"signature": "def __init__(self, search_space=None, **kwargs)"
},
{
"docstring": "Use the trained model to propose a set of params from SearchSpace. :param int num: number of random samples from hyperparameter space. :return: list of random samp... | 4 | stack_v2_sparse_classes_30k_train_021737 | Implement the Python class `PBTHpo` described below.
Class description:
An Hpo of PBT.
Method signatures and docstrings:
- def __init__(self, search_space=None, **kwargs): Init PBTHpo.
- def get_hyperparameters(self, num): Use the trained model to propose a set of params from SearchSpace. :param int num: number of ra... | Implement the Python class `PBTHpo` described below.
Class description:
An Hpo of PBT.
Method signatures and docstrings:
- def __init__(self, search_space=None, **kwargs): Init PBTHpo.
- def get_hyperparameters(self, num): Use the trained model to propose a set of params from SearchSpace. :param int num: number of ra... | 8e0af84a57eca5745fe2db3d13075393838036bb | <|skeleton|>
class PBTHpo:
"""An Hpo of PBT."""
def __init__(self, search_space=None, **kwargs):
"""Init PBTHpo."""
<|body_0|>
def get_hyperparameters(self, num):
"""Use the trained model to propose a set of params from SearchSpace. :param int num: number of random samples from hyp... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PBTHpo:
"""An Hpo of PBT."""
def __init__(self, search_space=None, **kwargs):
"""Init PBTHpo."""
self.search_space = search_space
super(PBTHpo, self).__init__(search_space, **kwargs)
self.hyperparameter_list = self.get_hyperparameters(self.config.policy.config_count)
... | the_stack_v2_python_sparse | vega/algorithms/hpo/pbt_hpo.py | fmsnew/vega | train | 0 |
78a3afdf07b376c584c9ccd984080a6c320483df | [
"store = Store.objects.filter(app_id=request.headers.get('APP-ID'), deleted_at=None).first()\ncustomer = Customer.objects.filter(customer_id=customer_id, store_id=store, deleted_at=None).first()\nif customer is None:\n return (jsonify({'error': CUSTOMER_NOT_FOUND}), 404)\ncart = Cart.objects.filter(customer_id=c... | <|body_start_0|>
store = Store.objects.filter(app_id=request.headers.get('APP-ID'), deleted_at=None).first()
customer = Customer.objects.filter(customer_id=customer_id, store_id=store, deleted_at=None).first()
if customer is None:
return (jsonify({'error': CUSTOMER_NOT_FOUND}), 404)
... | CartAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CartAPI:
def get(self, customer_id):
"""returns the open cart for the customer Endpoint: localhost/customer/203143206815474133956265931856458093780/cart Example Response: { "cart": { "cart_id": "111448983167709818199901427478800268832", "closed_at": null, "created_at": "Tue, 22 Jan 2019 ... | stack_v2_sparse_classes_75kplus_train_071509 | 14,136 | no_license | [
{
"docstring": "returns the open cart for the customer Endpoint: localhost/customer/203143206815474133956265931856458093780/cart Example Response: { \"cart\": { \"cart_id\": \"111448983167709818199901427478800268832\", \"closed_at\": null, \"created_at\": \"Tue, 22 Jan 2019 04:30:35 GMT\", \"invoice_created_at\... | 3 | stack_v2_sparse_classes_30k_train_031310 | Implement the Python class `CartAPI` described below.
Class description:
Implement the CartAPI class.
Method signatures and docstrings:
- def get(self, customer_id): returns the open cart for the customer Endpoint: localhost/customer/203143206815474133956265931856458093780/cart Example Response: { "cart": { "cart_id"... | Implement the Python class `CartAPI` described below.
Class description:
Implement the CartAPI class.
Method signatures and docstrings:
- def get(self, customer_id): returns the open cart for the customer Endpoint: localhost/customer/203143206815474133956265931856458093780/cart Example Response: { "cart": { "cart_id"... | dc737f15eaad555186127c4c3fe81ba0c6fa179d | <|skeleton|>
class CartAPI:
def get(self, customer_id):
"""returns the open cart for the customer Endpoint: localhost/customer/203143206815474133956265931856458093780/cart Example Response: { "cart": { "cart_id": "111448983167709818199901427478800268832", "closed_at": null, "created_at": "Tue, 22 Jan 2019 ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CartAPI:
def get(self, customer_id):
"""returns the open cart for the customer Endpoint: localhost/customer/203143206815474133956265931856458093780/cart Example Response: { "cart": { "cart_id": "111448983167709818199901427478800268832", "closed_at": null, "created_at": "Tue, 22 Jan 2019 04:30:35 GMT",... | the_stack_v2_python_sparse | cart/api.py | chipmyersjr/flask_rest_api | train | 0 | |
884b86e1c63265020f9e0eb79cf147ec697ffe39 | [
"self.conditions_dict = conditions_dict\nself.axes_vars = axes_vars\nself.x_axis_label = labels['x_axis']\nself.y_axis_label = labels['y_axis']\nsuper(VegaGraphBarBase, self).__init__(output_path, input_path, config_dir, labels)\nself.graph_type = 'barbase'",
"pandas_df = super(VegaGraphBarBase, self).parse_jsons... | <|body_start_0|>
self.conditions_dict = conditions_dict
self.axes_vars = axes_vars
self.x_axis_label = labels['x_axis']
self.y_axis_label = labels['y_axis']
super(VegaGraphBarBase, self).__init__(output_path, input_path, config_dir, labels)
self.graph_type = 'barbase'
<|e... | Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBar and VegaGraphScatter. Attributes: output_path: the output directory to write the ... | VegaGraphBarBase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VegaGraphBarBase:
"""Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBar and VegaGraphScatter. Attributes: out... | stack_v2_sparse_classes_75kplus_train_071510 | 16,246 | no_license | [
{
"docstring": "Instantiate the input arguments. References the base class __init__ to instantiate recurring ones.",
"name": "__init__",
"signature": "def __init__(self, output_path, input_path, config_dir, labels, conditions_dict, axes_vars)"
},
{
"docstring": "Parses the input json files using... | 2 | stack_v2_sparse_classes_30k_train_001388 | Implement the Python class `VegaGraphBarBase` described below.
Class description:
Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBa... | Implement the Python class `VegaGraphBarBase` described below.
Class description:
Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBa... | d42ec8e8328117d70fb910f2d1f751ce15862810 | <|skeleton|>
class VegaGraphBarBase:
"""Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBar and VegaGraphScatter. Attributes: out... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VegaGraphBarBase:
"""Class for converting json outputs of different algorithms to vega-specific bar or scatter graph json files. This class is a child class of VegaGraphBase and inherits all the methods and variables. It serves as a base class to VegaGraphBar and VegaGraphScatter. Attributes: output_path: the... | the_stack_v2_python_sparse | scripts/json2vega.py | gunrock/io | train | 11 |
f9564338e87e6a54a9481a757b09a17c88df3964 | [
"self.post_reqparser = reqparse.RequestParser()\nself.post_reqparser.add_argument('email', required=True, location=['form', 'json'])\nself.post_reqparser.add_argument('activated', location=['form', 'json'])\nself.post_reqparser.add_argument('admin', location=['form', 'json'])\nsuper().__init__()",
"args = self.po... | <|body_start_0|>
self.post_reqparser = reqparse.RequestParser()
self.post_reqparser.add_argument('email', required=True, location=['form', 'json'])
self.post_reqparser.add_argument('activated', location=['form', 'json'])
self.post_reqparser.add_argument('admin', location=['form', 'json']... | API resource class which updates a users admin and/or activated field Parameters can be passed using a POST request that contains a JSON with the following fields: :required: valid access JWT where the admin claim has to be true :param email: users email address :param activated: the value of the user's activated field... | UserPermissions | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserPermissions:
"""API resource class which updates a users admin and/or activated field Parameters can be passed using a POST request that contains a JSON with the following fields: :required: valid access JWT where the admin claim has to be true :param email: users email address :param activat... | stack_v2_sparse_classes_75kplus_train_071511 | 3,152 | permissive | [
{
"docstring": "Instantiates the user permissions endpoint Parameters can be passed using a POST request that contains a JSON with the following fields: :required: valid access JWT where the admin claim has to be true :param email: users email address :param activated: the value of the user's activated field :p... | 2 | null | Implement the Python class `UserPermissions` described below.
Class description:
API resource class which updates a users admin and/or activated field Parameters can be passed using a POST request that contains a JSON with the following fields: :required: valid access JWT where the admin claim has to be true :param em... | Implement the Python class `UserPermissions` described below.
Class description:
API resource class which updates a users admin and/or activated field Parameters can be passed using a POST request that contains a JSON with the following fields: :required: valid access JWT where the admin claim has to be true :param em... | 5d123691d1f25d0b85e20e4e8293266bf23c9f8a | <|skeleton|>
class UserPermissions:
"""API resource class which updates a users admin and/or activated field Parameters can be passed using a POST request that contains a JSON with the following fields: :required: valid access JWT where the admin claim has to be true :param email: users email address :param activat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserPermissions:
"""API resource class which updates a users admin and/or activated field Parameters can be passed using a POST request that contains a JSON with the following fields: :required: valid access JWT where the admin claim has to be true :param email: users email address :param activated: the value... | the_stack_v2_python_sparse | Analytics/resources/admin/user_permissions.py | thanosbnt/SharingCitiesDashboard | train | 0 |
00e5e0d509c9a17bf7bb6083ef0d9be41c42e90a | [
"enter_app_manual()\nglobal case_flag\ncase_flag = False\nbrowser.pre_check()\nif not test_suit_browser.BOOL_STK_WIFI_CHECK:\n start_activity('com.android.settings', '.Settings')\n settings.disable_wifi()\nif not is_cdma():\n start_activity('com.android.settings', '.Settings')\n settings.set_default_dat... | <|body_start_0|>
enter_app_manual()
global case_flag
case_flag = False
browser.pre_check()
if not test_suit_browser.BOOL_STK_WIFI_CHECK:
start_activity('com.android.settings', '.Settings')
settings.disable_wifi()
if not is_cdma():
start... | test_suit_browser_case2 is a class for browser case. @see: L{TestCaseBase <TestCaseBase>} | test_suit_browser_case2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_suit_browser_case2:
"""test_suit_browser_case2 is a class for browser case. @see: L{TestCaseBase <TestCaseBase>}"""
def test_case_main(self, case_results):
"""main entry. @type case_results: tuple @param case_results: record some case result information"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_071512 | 2,773 | no_license | [
{
"docstring": "main entry. @type case_results: tuple @param case_results: record some case result information",
"name": "test_case_main",
"signature": "def test_case_main(self, case_results)"
},
{
"docstring": "record the case result",
"name": "test_case_end",
"signature": "def test_cas... | 2 | stack_v2_sparse_classes_30k_train_047692 | Implement the Python class `test_suit_browser_case2` described below.
Class description:
test_suit_browser_case2 is a class for browser case. @see: L{TestCaseBase <TestCaseBase>}
Method signatures and docstrings:
- def test_case_main(self, case_results): main entry. @type case_results: tuple @param case_results: reco... | Implement the Python class `test_suit_browser_case2` described below.
Class description:
test_suit_browser_case2 is a class for browser case. @see: L{TestCaseBase <TestCaseBase>}
Method signatures and docstrings:
- def test_case_main(self, case_results): main entry. @type case_results: tuple @param case_results: reco... | a04b717ae437511abae1e7e9e399373c161a7b65 | <|skeleton|>
class test_suit_browser_case2:
"""test_suit_browser_case2 is a class for browser case. @see: L{TestCaseBase <TestCaseBase>}"""
def test_case_main(self, case_results):
"""main entry. @type case_results: tuple @param case_results: record some case result information"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class test_suit_browser_case2:
"""test_suit_browser_case2 is a class for browser case. @see: L{TestCaseBase <TestCaseBase>}"""
def test_case_main(self, case_results):
"""main entry. @type case_results: tuple @param case_results: record some case result information"""
enter_app_manual()
... | the_stack_v2_python_sparse | test_env/test_suit_browser/test_suit_browser_case2.py | wwlwwlqaz/Qualcomm | train | 1 |
ec07ba7279d8e8176b4bb602260dbb999d413c17 | [
"self.input_arr = [7, 6, 4, -1, 1, 2]\nself.targetSum = 16\nself.output = [[7, 6, 4, -1], [7, 6, 1, 2]]\nreturn (self.input_arr, self.targetSum, self.output)",
"input_arr, targetSum, output_arr = self.setUp()\noutput = fourNumberSum(input_arr, targetSum)\nself.assertEqual(output, output_arr)"
] | <|body_start_0|>
self.input_arr = [7, 6, 4, -1, 1, 2]
self.targetSum = 16
self.output = [[7, 6, 4, -1], [7, 6, 1, 2]]
return (self.input_arr, self.targetSum, self.output)
<|end_body_0|>
<|body_start_1|>
input_arr, targetSum, output_arr = self.setUp()
output = fourNumberS... | Class with unittests for FourNumberSum.py | test_FourNumberSum | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_FourNumberSum:
"""Class with unittests for FourNumberSum.py"""
def setUp(self):
"""Sets up input."""
<|body_0|>
def test_ExpectedOutput(self):
"""Checks if returned output is as expected."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self... | stack_v2_sparse_classes_75kplus_train_071513 | 931 | no_license | [
{
"docstring": "Sets up input.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Checks if returned output is as expected.",
"name": "test_ExpectedOutput",
"signature": "def test_ExpectedOutput(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_052007 | Implement the Python class `test_FourNumberSum` described below.
Class description:
Class with unittests for FourNumberSum.py
Method signatures and docstrings:
- def setUp(self): Sets up input.
- def test_ExpectedOutput(self): Checks if returned output is as expected. | Implement the Python class `test_FourNumberSum` described below.
Class description:
Class with unittests for FourNumberSum.py
Method signatures and docstrings:
- def setUp(self): Sets up input.
- def test_ExpectedOutput(self): Checks if returned output is as expected.
<|skeleton|>
class test_FourNumberSum:
"""Cl... | 3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f | <|skeleton|>
class test_FourNumberSum:
"""Class with unittests for FourNumberSum.py"""
def setUp(self):
"""Sets up input."""
<|body_0|>
def test_ExpectedOutput(self):
"""Checks if returned output is as expected."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class test_FourNumberSum:
"""Class with unittests for FourNumberSum.py"""
def setUp(self):
"""Sets up input."""
self.input_arr = [7, 6, 4, -1, 1, 2]
self.targetSum = 16
self.output = [[7, 6, 4, -1], [7, 6, 1, 2]]
return (self.input_arr, self.targetSum, self.output)
... | the_stack_v2_python_sparse | AlgoExpert_algorithms/Hard/FourNumberSort/test_FourNumberSum.py | JakubKazimierski/PythonPortfolio | train | 9 |
ec30809c98a1a632a8ac73950f52a49534804545 | [
"self.tapRound = tapRound\nself.extraRounds = extraRounds\nself.name = 'ICEDOLL'\nself.keySize = keySize\nself.strength = keySize\nself.blockSize = blockSize\nself.padding = padding\nassert keySize % 4 == 0 and NrTable[4].has_key(keySize / 4), 'key size must be 16,20,24,29 or 32 bytes'\nassert blockSize % 4 == 0 an... | <|body_start_0|>
self.tapRound = tapRound
self.extraRounds = extraRounds
self.name = 'ICEDOLL'
self.keySize = keySize
self.strength = keySize
self.blockSize = blockSize
self.padding = padding
assert keySize % 4 == 0 and NrTable[4].has_key(keySize / 4), 'ke... | IceDoll encryption algorithm based on Rijndael, with added feedback for better integrity processing. Note - no integrity check is built into Icedoll directly | Icedoll | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Icedoll:
"""IceDoll encryption algorithm based on Rijndael, with added feedback for better integrity processing. Note - no integrity check is built into Icedoll directly"""
def __init__(self, key=None, padding=padWithPadLen(), keySize=16, blockSize=16, tapRound=6, extraRounds=6):
"""... | stack_v2_sparse_classes_75kplus_train_071514 | 5,225 | permissive | [
{
"docstring": "key, keysize, blockSize same as Rijndael, tapROund is feedback tap,",
"name": "__init__",
"signature": "def __init__(self, key=None, padding=padWithPadLen(), keySize=16, blockSize=16, tapRound=6, extraRounds=6)"
},
{
"docstring": "Set a key and generate the expanded key",
"na... | 4 | stack_v2_sparse_classes_30k_train_011869 | Implement the Python class `Icedoll` described below.
Class description:
IceDoll encryption algorithm based on Rijndael, with added feedback for better integrity processing. Note - no integrity check is built into Icedoll directly
Method signatures and docstrings:
- def __init__(self, key=None, padding=padWithPadLen(... | Implement the Python class `Icedoll` described below.
Class description:
IceDoll encryption algorithm based on Rijndael, with added feedback for better integrity processing. Note - no integrity check is built into Icedoll directly
Method signatures and docstrings:
- def __init__(self, key=None, padding=padWithPadLen(... | ed4d80d1e6f09634c12c0c3096e39667c6642b95 | <|skeleton|>
class Icedoll:
"""IceDoll encryption algorithm based on Rijndael, with added feedback for better integrity processing. Note - no integrity check is built into Icedoll directly"""
def __init__(self, key=None, padding=padWithPadLen(), keySize=16, blockSize=16, tapRound=6, extraRounds=6):
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Icedoll:
"""IceDoll encryption algorithm based on Rijndael, with added feedback for better integrity processing. Note - no integrity check is built into Icedoll directly"""
def __init__(self, key=None, padding=padWithPadLen(), keySize=16, blockSize=16, tapRound=6, extraRounds=6):
"""key, keysize,... | the_stack_v2_python_sparse | script.module.cryptolib/lib/cryptopy/cipher/icedoll.py | gacj22/WizardGacj22 | train | 4 |
ee495329b18d505281129ba357ccb1e8f8ae5268 | [
"self.north_key = north_key\nself.south_key = south_key\nself.east_key = east_key\nself.west_key = west_key\nself._pressed_keys = set()\nself._lock = threading.Lock()",
"with self._lock:\n for direction, key in [(north, self.north_key), (south, self.south_key), (east, self.east_key), (west, self.west_key)]:\n ... | <|body_start_0|>
self.north_key = north_key
self.south_key = south_key
self.east_key = east_key
self.west_key = west_key
self._pressed_keys = set()
self._lock = threading.Lock()
<|end_body_0|>
<|body_start_1|>
with self._lock:
for direction, key in [(... | Allows movement by holding keys. | KeyMover | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeyMover:
"""Allows movement by holding keys."""
def __init__(self, north_key='up', south_key='down', east_key='left', west_key='right'):
"""Create a new mover that scrolls with keys."""
<|body_0|>
def do_move(self, north, south, east, west):
"""Update scroll wit... | stack_v2_sparse_classes_75kplus_train_071515 | 6,737 | permissive | [
{
"docstring": "Create a new mover that scrolls with keys.",
"name": "__init__",
"signature": "def __init__(self, north_key='up', south_key='down', east_key='left', west_key='right')"
},
{
"docstring": "Update scroll with the given directions. This method can be passed to `EyeScroller`.",
"n... | 2 | null | Implement the Python class `KeyMover` described below.
Class description:
Allows movement by holding keys.
Method signatures and docstrings:
- def __init__(self, north_key='up', south_key='down', east_key='left', west_key='right'): Create a new mover that scrolls with keys.
- def do_move(self, north, south, east, wes... | Implement the Python class `KeyMover` described below.
Class description:
Allows movement by holding keys.
Method signatures and docstrings:
- def __init__(self, north_key='up', south_key='down', east_key='left', west_key='right'): Create a new mover that scrolls with keys.
- def do_move(self, north, south, east, wes... | b5c1ec10207a66a04226abe865d694e3786dc30d | <|skeleton|>
class KeyMover:
"""Allows movement by holding keys."""
def __init__(self, north_key='up', south_key='down', east_key='left', west_key='right'):
"""Create a new mover that scrolls with keys."""
<|body_0|>
def do_move(self, north, south, east, west):
"""Update scroll wit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KeyMover:
"""Allows movement by holding keys."""
def __init__(self, north_key='up', south_key='down', east_key='left', west_key='right'):
"""Create a new mover that scrolls with keys."""
self.north_key = north_key
self.south_key = south_key
self.east_key = east_key
... | the_stack_v2_python_sparse | games/hiss_map_scroll.py | jcaw/talon_config | train | 12 |
86aca52a1250e3def5de314444c164773f7b6129 | [
"day_data = []\nstream_ids = self.CC.get_stream_id(user_id, stream_name)\nfor stream_id in stream_ids:\n data_stream = self.CC.get_stream(stream_id['identifier'], day=day, user_id=user_id, data_type=DataSet.COMPLETE, localtime=False)\n if data_stream is not None and len(data_stream.data) > 0:\n day_dat... | <|body_start_0|>
day_data = []
stream_ids = self.CC.get_stream_id(user_id, stream_name)
for stream_id in stream_ids:
data_stream = self.CC.get_stream(stream_id['identifier'], day=day, user_id=user_id, data_type=DataSet.COMPLETE, localtime=False)
if data_stream is not None... | Detect whether a person was interacting with other people immediately before filling qualtrics survey. | Context | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Context:
"""Detect whether a person was interacting with other people immediately before filling qualtrics survey."""
def get_day_data(self, user_id, stream_name, day):
"""get list of DataPoint for the stream name :param string stream_name: Name of the stream :param string user_id: U... | stack_v2_sparse_classes_75kplus_train_071516 | 7,927 | permissive | [
{
"docstring": "get list of DataPoint for the stream name :param string stream_name: Name of the stream :param string user_id: UID of the user :param string day: YYYYMMDD :return:",
"name": "get_day_data",
"signature": "def get_day_data(self, user_id, stream_name, day)"
},
{
"docstring": "Return... | 3 | null | Implement the Python class `Context` described below.
Class description:
Detect whether a person was interacting with other people immediately before filling qualtrics survey.
Method signatures and docstrings:
- def get_day_data(self, user_id, stream_name, day): get list of DataPoint for the stream name :param string... | Implement the Python class `Context` described below.
Class description:
Detect whether a person was interacting with other people immediately before filling qualtrics survey.
Method signatures and docstrings:
- def get_day_data(self, user_id, stream_name, day): get list of DataPoint for the stream name :param string... | 73f5ea2430bc7c23de422dccb7b65ef9f8917595 | <|skeleton|>
class Context:
"""Detect whether a person was interacting with other people immediately before filling qualtrics survey."""
def get_day_data(self, user_id, stream_name, day):
"""get list of DataPoint for the stream name :param string stream_name: Name of the stream :param string user_id: U... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Context:
"""Detect whether a person was interacting with other people immediately before filling qualtrics survey."""
def get_day_data(self, user_id, stream_name, day):
"""get list of DataPoint for the stream name :param string stream_name: Name of the stream :param string user_id: UID of the use... | the_stack_v2_python_sparse | core/feature/context/context.py | MD2Korg/CerebralCortex-DataAnalysis | train | 1 |
e3971317e01666e071acbfd95b35537556be8ab2 | [
"super().__init__(coordinator)\nself.ws_id = ws_id\nself._attr_device_info = DeviceInfo(connections={(dr.CONNECTION_NETWORK_MAC, ws_id)}, identifiers={(DOMAIN, ws_id)}, manufacturer=MANUFACTURER, name=ws_data[AZD_NAME], sw_version=ws_data[AZD_FIRMWARE])",
"value = None\nif (webserver := self.coordinator.data[AZD_... | <|body_start_0|>
super().__init__(coordinator)
self.ws_id = ws_id
self._attr_device_info = DeviceInfo(connections={(dr.CONNECTION_NETWORK_MAC, ws_id)}, identifiers={(DOMAIN, ws_id)}, manufacturer=MANUFACTURER, name=ws_data[AZD_NAME], sw_version=ws_data[AZD_FIRMWARE])
<|end_body_0|>
<|body_start... | Define an Airzone Cloud WebServer entity. | AirzoneWebServerEntity | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AirzoneWebServerEntity:
"""Define an Airzone Cloud WebServer entity."""
def __init__(self, coordinator: AirzoneUpdateCoordinator, ws_id: str, ws_data: dict[str, Any]) -> None:
"""Initialize."""
<|body_0|>
def get_airzone_value(self, key: str) -> Any:
"""Return We... | stack_v2_sparse_classes_75kplus_train_071517 | 4,444 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, coordinator: AirzoneUpdateCoordinator, ws_id: str, ws_data: dict[str, Any]) -> None"
},
{
"docstring": "Return WebServer value by key.",
"name": "get_airzone_value",
"signature": "def get_airzone_value(sel... | 2 | null | Implement the Python class `AirzoneWebServerEntity` described below.
Class description:
Define an Airzone Cloud WebServer entity.
Method signatures and docstrings:
- def __init__(self, coordinator: AirzoneUpdateCoordinator, ws_id: str, ws_data: dict[str, Any]) -> None: Initialize.
- def get_airzone_value(self, key: s... | Implement the Python class `AirzoneWebServerEntity` described below.
Class description:
Define an Airzone Cloud WebServer entity.
Method signatures and docstrings:
- def __init__(self, coordinator: AirzoneUpdateCoordinator, ws_id: str, ws_data: dict[str, Any]) -> None: Initialize.
- def get_airzone_value(self, key: s... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class AirzoneWebServerEntity:
"""Define an Airzone Cloud WebServer entity."""
def __init__(self, coordinator: AirzoneUpdateCoordinator, ws_id: str, ws_data: dict[str, Any]) -> None:
"""Initialize."""
<|body_0|>
def get_airzone_value(self, key: str) -> Any:
"""Return We... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AirzoneWebServerEntity:
"""Define an Airzone Cloud WebServer entity."""
def __init__(self, coordinator: AirzoneUpdateCoordinator, ws_id: str, ws_data: dict[str, Any]) -> None:
"""Initialize."""
super().__init__(coordinator)
self.ws_id = ws_id
self._attr_device_info = Devic... | the_stack_v2_python_sparse | homeassistant/components/airzone_cloud/entity.py | home-assistant/core | train | 35,501 |
645021bac95726a95e7f8e26f805e3b68af5ede3 | [
"self.snn = snn\nself.xtrn = xtrn\nself.ytrn = ytrn",
"self.snn.coefs_[0] = weights[:1800].reshape((30, 60))\nself.snn.coefs_[1] = weights[1800:1860].reshape((60, 1))\nself.snn.intercepts_[0] = weights[1860:1920]\nself.snn.intercepts_[1] = weights[1920]\nreturn 1.0 - self.snn.score(self.xtrn, self.ytrn)"
] | <|body_start_0|>
self.snn = snn
self.xtrn = xtrn
self.ytrn = ytrn
<|end_body_0|>
<|body_start_1|>
self.snn.coefs_[0] = weights[:1800].reshape((30, 60))
self.snn.coefs_[1] = weights[1800:1860].reshape((60, 1))
self.snn.intercepts_[0] = weights[1860:1920]
self.snn.... | SwarmObjective | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SwarmObjective:
def __init__(self, snn, xtrn, ytrn):
"""Keep the NN object and test data"""
<|body_0|>
def Evaluate(self, weights):
"""Test the NN with the given weights"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.snn = snn
self.xtr... | stack_v2_sparse_classes_75kplus_train_071518 | 5,989 | permissive | [
{
"docstring": "Keep the NN object and test data",
"name": "__init__",
"signature": "def __init__(self, snn, xtrn, ytrn)"
},
{
"docstring": "Test the NN with the given weights",
"name": "Evaluate",
"signature": "def Evaluate(self, weights)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017548 | Implement the Python class `SwarmObjective` described below.
Class description:
Implement the SwarmObjective class.
Method signatures and docstrings:
- def __init__(self, snn, xtrn, ytrn): Keep the NN object and test data
- def Evaluate(self, weights): Test the NN with the given weights | Implement the Python class `SwarmObjective` described below.
Class description:
Implement the SwarmObjective class.
Method signatures and docstrings:
- def __init__(self, snn, xtrn, ytrn): Keep the NN object and test data
- def Evaluate(self, weights): Test the NN with the given weights
<|skeleton|>
class SwarmObjec... | 5445b6f90ab49339ca0fdb71e98d44e6827c95a8 | <|skeleton|>
class SwarmObjective:
def __init__(self, snn, xtrn, ytrn):
"""Keep the NN object and test data"""
<|body_0|>
def Evaluate(self, weights):
"""Test the NN with the given weights"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SwarmObjective:
def __init__(self, snn, xtrn, ytrn):
"""Keep the NN object and test data"""
self.snn = snn
self.xtrn = xtrn
self.ytrn = ytrn
def Evaluate(self, weights):
"""Test the NN with the given weights"""
self.snn.coefs_[0] = weights[:1800].reshape((3... | the_stack_v2_python_sparse | nn/nn.py | dayoladejo/SwarmOptimization | train | 0 | |
976402db022bf67f63dfed5157ba4f203c6a85e9 | [
"super().__init__(netatmo_device.data_handler)\nself.entity_description = BATTERY_SENSOR_DESCRIPTION\nself._module = cast(pyatmo.modules.NRV, netatmo_device.device)\nself._id = netatmo_device.parent_id\nself._publishers.extend([{'name': HOME, 'home_id': netatmo_device.device.home.entity_id, SIGNAL_NAME: netatmo_dev... | <|body_start_0|>
super().__init__(netatmo_device.data_handler)
self.entity_description = BATTERY_SENSOR_DESCRIPTION
self._module = cast(pyatmo.modules.NRV, netatmo_device.device)
self._id = netatmo_device.parent_id
self._publishers.extend([{'name': HOME, 'home_id': netatmo_device... | Implementation of a Netatmo sensor. | NetatmoClimateBatterySensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetatmoClimateBatterySensor:
"""Implementation of a Netatmo sensor."""
def __init__(self, netatmo_device: NetatmoDevice) -> None:
"""Initialize the sensor."""
<|body_0|>
def async_update_callback(self) -> None:
"""Update the entity's state."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_071519 | 25,750 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, netatmo_device: NetatmoDevice) -> None"
},
{
"docstring": "Update the entity's state.",
"name": "async_update_callback",
"signature": "def async_update_callback(self) -> None"
}
] | 2 | stack_v2_sparse_classes_30k_train_038141 | Implement the Python class `NetatmoClimateBatterySensor` described below.
Class description:
Implementation of a Netatmo sensor.
Method signatures and docstrings:
- def __init__(self, netatmo_device: NetatmoDevice) -> None: Initialize the sensor.
- def async_update_callback(self) -> None: Update the entity's state. | Implement the Python class `NetatmoClimateBatterySensor` described below.
Class description:
Implementation of a Netatmo sensor.
Method signatures and docstrings:
- def __init__(self, netatmo_device: NetatmoDevice) -> None: Initialize the sensor.
- def async_update_callback(self) -> None: Update the entity's state.
... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class NetatmoClimateBatterySensor:
"""Implementation of a Netatmo sensor."""
def __init__(self, netatmo_device: NetatmoDevice) -> None:
"""Initialize the sensor."""
<|body_0|>
def async_update_callback(self) -> None:
"""Update the entity's state."""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NetatmoClimateBatterySensor:
"""Implementation of a Netatmo sensor."""
def __init__(self, netatmo_device: NetatmoDevice) -> None:
"""Initialize the sensor."""
super().__init__(netatmo_device.data_handler)
self.entity_description = BATTERY_SENSOR_DESCRIPTION
self._module = ... | the_stack_v2_python_sparse | homeassistant/components/netatmo/sensor.py | home-assistant/core | train | 35,501 |
26785751065b87146ccd135f98b0c68a1ef80a91 | [
"res = GraphConnection().get_graph_connect()\ngraph_id = res[1]['data']['records'][0]['id']\nreturn graph_id",
"res = GraphConnection().get_graph_connect()\ngraph_id = res[1]['data']['records'][0]['id']\nres = Load.query_load_job(graph_id)\njob_id = res[1]['data']['records'][0]['id']\nreturn (graph_id, job_id)",
... | <|body_start_0|>
res = GraphConnection().get_graph_connect()
graph_id = res[1]['data']['records'][0]['id']
return graph_id
<|end_body_0|>
<|body_start_1|>
res = GraphConnection().get_graph_connect()
graph_id = res[1]['data']['records'][0]['id']
res = Load.query_load_job(... | 提供case需要的ID | ID | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ID:
"""提供case需要的ID"""
def get_graph_id():
"""获取图ID"""
<|body_0|>
def get_job_id():
"""获取图ID,和任务ID"""
<|body_1|>
def get_file_id():
"""获取ID,任务ID和文件ID"""
<|body_2|>
def get_task_id():
"""获取图ID,任务ID,文件ID和任务ID"""
<|bo... | stack_v2_sparse_classes_75kplus_train_071520 | 26,078 | no_license | [
{
"docstring": "获取图ID",
"name": "get_graph_id",
"signature": "def get_graph_id()"
},
{
"docstring": "获取图ID,和任务ID",
"name": "get_job_id",
"signature": "def get_job_id()"
},
{
"docstring": "获取ID,任务ID和文件ID",
"name": "get_file_id",
"signature": "def get_file_id()"
},
{
... | 6 | stack_v2_sparse_classes_30k_train_029269 | Implement the Python class `ID` described below.
Class description:
提供case需要的ID
Method signatures and docstrings:
- def get_graph_id(): 获取图ID
- def get_job_id(): 获取图ID,和任务ID
- def get_file_id(): 获取ID,任务ID和文件ID
- def get_task_id(): 获取图ID,任务ID,文件ID和任务ID
- def get_vertexMapping_id(): 获取图ID,任务ID,文件ID和顶点映射ID
- def get_edg... | Implement the Python class `ID` described below.
Class description:
提供case需要的ID
Method signatures and docstrings:
- def get_graph_id(): 获取图ID
- def get_job_id(): 获取图ID,和任务ID
- def get_file_id(): 获取ID,任务ID和文件ID
- def get_task_id(): 获取图ID,任务ID,文件ID和任务ID
- def get_vertexMapping_id(): 获取图ID,任务ID,文件ID和顶点映射ID
- def get_edg... | 89e5b34ab925bcc0bbc4ad63302e96c62a420399 | <|skeleton|>
class ID:
"""提供case需要的ID"""
def get_graph_id():
"""获取图ID"""
<|body_0|>
def get_job_id():
"""获取图ID,和任务ID"""
<|body_1|>
def get_file_id():
"""获取ID,任务ID和文件ID"""
<|body_2|>
def get_task_id():
"""获取图ID,任务ID,文件ID和任务ID"""
<|bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ID:
"""提供case需要的ID"""
def get_graph_id():
"""获取图ID"""
res = GraphConnection().get_graph_connect()
graph_id = res[1]['data']['records'][0]['id']
return graph_id
def get_job_id():
"""获取图ID,和任务ID"""
res = GraphConnection().get_graph_connect()
grap... | the_stack_v2_python_sparse | src/common/hubble_api.py | hugegraph/hugegraph-test | train | 1 |
7530b1d90dffd7b94ab179e70c8c4c3c4be33380 | [
"self.disks = disks\nself.display_name = display_name\nself.filesystem_type = filesystem_type\nself.filesystem_uuid = filesystem_uuid\nself.is_supported = is_supported\nself.logical_volume = logical_volume\nself.logical_volume_type = logical_volume_type\nself.name = name\nself.volume_guid = volume_guid",
"if dict... | <|body_start_0|>
self.disks = disks
self.display_name = display_name
self.filesystem_type = filesystem_type
self.filesystem_uuid = filesystem_uuid
self.is_supported = is_supported
self.logical_volume = logical_volume
self.logical_volume_type = logical_volume_type
... | Implementation of the 'FilesystemVolume' model. Specifies information about a filesystem volume. Attributes: disks (list of Disk): Array of Disks and Partitions. Specifies information about all the disks and partitions needed to mount this logical volume. display_name (string): Specifies a description about the filesys... | FilesystemVolume | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FilesystemVolume:
"""Implementation of the 'FilesystemVolume' model. Specifies information about a filesystem volume. Attributes: disks (list of Disk): Array of Disks and Partitions. Specifies information about all the disks and partitions needed to mount this logical volume. display_name (string... | stack_v2_sparse_classes_75kplus_train_071521 | 4,757 | permissive | [
{
"docstring": "Constructor for the FilesystemVolume class",
"name": "__init__",
"signature": "def __init__(self, disks=None, display_name=None, filesystem_type=None, filesystem_uuid=None, is_supported=None, logical_volume=None, logical_volume_type=None, name=None, volume_guid=None)"
},
{
"docst... | 2 | stack_v2_sparse_classes_30k_train_051445 | Implement the Python class `FilesystemVolume` described below.
Class description:
Implementation of the 'FilesystemVolume' model. Specifies information about a filesystem volume. Attributes: disks (list of Disk): Array of Disks and Partitions. Specifies information about all the disks and partitions needed to mount th... | Implement the Python class `FilesystemVolume` described below.
Class description:
Implementation of the 'FilesystemVolume' model. Specifies information about a filesystem volume. Attributes: disks (list of Disk): Array of Disks and Partitions. Specifies information about all the disks and partitions needed to mount th... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class FilesystemVolume:
"""Implementation of the 'FilesystemVolume' model. Specifies information about a filesystem volume. Attributes: disks (list of Disk): Array of Disks and Partitions. Specifies information about all the disks and partitions needed to mount this logical volume. display_name (string... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FilesystemVolume:
"""Implementation of the 'FilesystemVolume' model. Specifies information about a filesystem volume. Attributes: disks (list of Disk): Array of Disks and Partitions. Specifies information about all the disks and partitions needed to mount this logical volume. display_name (string): Specifies ... | the_stack_v2_python_sparse | cohesity_management_sdk/models/filesystem_volume.py | cohesity/management-sdk-python | train | 24 |
2b70d624e676dc6b7f794e93288b1599d782f203 | [
"dp = [False] * len(s)\nret = 0\nfor i in range(len(s) - 1, -1, -1):\n ret += 1\n buff = [False] * len(s)\n buff[i] = True\n for j in range(i + 1, len(s)):\n if i + 1 <= j - 1 and dp[j - 1] and (s[i] == s[j]) or (i + 1 > j - 1 and s[i] == s[j]):\n buff[j] = True\n ret += 1\n... | <|body_start_0|>
dp = [False] * len(s)
ret = 0
for i in range(len(s) - 1, -1, -1):
ret += 1
buff = [False] * len(s)
buff[i] = True
for j in range(i + 1, len(s)):
if i + 1 <= j - 1 and dp[j - 1] and (s[i] == s[j]) or (i + 1 > j - 1 a... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countSubstrings(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def countSubstrings1(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = [False] * len(s)
ret = 0
for i in range... | stack_v2_sparse_classes_75kplus_train_071522 | 1,354 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "countSubstrings",
"signature": "def countSubstrings(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "countSubstrings1",
"signature": "def countSubstrings1(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_047948 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countSubstrings(self, s): :type s: str :rtype: int
- def countSubstrings1(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 countSubstrings(self, s): :type s: str :rtype: int
- def countSubstrings1(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def countSubstrings(self, s):
... | 70bdd75b6af2e1811c1beab22050c01d28d7373e | <|skeleton|>
class Solution:
def countSubstrings(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def countSubstrings1(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def countSubstrings(self, s):
""":type s: str :rtype: int"""
dp = [False] * len(s)
ret = 0
for i in range(len(s) - 1, -1, -1):
ret += 1
buff = [False] * len(s)
buff[i] = True
for j in range(i + 1, len(s)):
... | the_stack_v2_python_sparse | python/leetcode/647_Palindromic_Substrings.py | bobcaoge/my-code | train | 0 | |
42ffa662c5f7dd12746030c45d9256227a477f9f | [
"source_data = self.cache.get_data(Census, boundary)\nif not source_data:\n return None\nelse:\n total_fields, _ = self.get_fields()\n for field in total_fields:\n if getattr(source_data, field):\n return source_data\n return None",
"total_fields, target_fields = self.get_fields()\nt... | <|body_start_0|>
source_data = self.cache.get_data(Census, boundary)
if not source_data:
return None
else:
total_fields, _ = self.get_fields()
for field in total_fields:
if getattr(source_data, field):
return source_data
... | Algorithm for census-based calcuations of ratio vs. the state average | CensusPercentAlgorithm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CensusPercentAlgorithm:
"""Algorithm for census-based calcuations of ratio vs. the state average"""
def source_data_for_boundary(self, boundary):
"""Get census data where the total population is not 0"""
<|body_0|>
def local_percent(self, source_data):
"""Calcula... | stack_v2_sparse_classes_75kplus_train_071523 | 34,944 | no_license | [
{
"docstring": "Get census data where the total population is not 0",
"name": "source_data_for_boundary",
"signature": "def source_data_for_boundary(self, boundary)"
},
{
"docstring": "Calculate the local percentage for the source data",
"name": "local_percent",
"signature": "def local_p... | 3 | null | Implement the Python class `CensusPercentAlgorithm` described below.
Class description:
Algorithm for census-based calcuations of ratio vs. the state average
Method signatures and docstrings:
- def source_data_for_boundary(self, boundary): Get census data where the total population is not 0
- def local_percent(self, ... | Implement the Python class `CensusPercentAlgorithm` described below.
Class description:
Algorithm for census-based calcuations of ratio vs. the state average
Method signatures and docstrings:
- def source_data_for_boundary(self, boundary): Get census data where the total population is not 0
- def local_percent(self, ... | 0d29c3e1599b187c17ea2a2c68f8a9b78f430442 | <|skeleton|>
class CensusPercentAlgorithm:
"""Algorithm for census-based calcuations of ratio vs. the state average"""
def source_data_for_boundary(self, boundary):
"""Get census data where the total population is not 0"""
<|body_0|>
def local_percent(self, source_data):
"""Calcula... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CensusPercentAlgorithm:
"""Algorithm for census-based calcuations of ratio vs. the state average"""
def source_data_for_boundary(self, boundary):
"""Get census data where the total population is not 0"""
source_data = self.cache.get_data(Census, boundary)
if not source_data:
... | the_stack_v2_python_sparse | healthdata/algorithms.py | CivicNinjas/HealthAround.me | train | 1 |
5b0e146faa4385be3784d4152122f4c63fcd8253 | [
"def increase(A):\n for i in range(1, len(A)):\n if A[i] > A[i - 1]:\n return False\n return True\n\ndef decrease(A):\n for i in range(1, len(A)):\n if A[i] < A[i - 1]:\n return False\n return True\nreturn increase(A) or decrease(A)",
"inc = True\ndec = True\nfor i ... | <|body_start_0|>
def increase(A):
for i in range(1, len(A)):
if A[i] > A[i - 1]:
return False
return True
def decrease(A):
for i in range(1, len(A)):
if A[i] < A[i - 1]:
return False
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isMonotonic(self, A):
""":type A: List[int] :rtype: bool"""
<|body_0|>
def isMonotonic2(self, A):
""":param A: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def increase(A):
for i in range(1, len(A)):
... | stack_v2_sparse_classes_75kplus_train_071524 | 1,606 | no_license | [
{
"docstring": ":type A: List[int] :rtype: bool",
"name": "isMonotonic",
"signature": "def isMonotonic(self, A)"
},
{
"docstring": ":param A: :return:",
"name": "isMonotonic2",
"signature": "def isMonotonic2(self, A)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isMonotonic(self, A): :type A: List[int] :rtype: bool
- def isMonotonic2(self, A): :param A: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isMonotonic(self, A): :type A: List[int] :rtype: bool
- def isMonotonic2(self, A): :param A: :return:
<|skeleton|>
class Solution:
def isMonotonic(self, A):
"""... | 8595b04cf5a024c2cd8a97f750d890a818568401 | <|skeleton|>
class Solution:
def isMonotonic(self, A):
""":type A: List[int] :rtype: bool"""
<|body_0|>
def isMonotonic2(self, A):
""":param A: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isMonotonic(self, A):
""":type A: List[int] :rtype: bool"""
def increase(A):
for i in range(1, len(A)):
if A[i] > A[i - 1]:
return False
return True
def decrease(A):
for i in range(1, len(A)):
... | the_stack_v2_python_sparse | python/896.monotonic-array.py | tainenko/Leetcode2019 | train | 5 | |
a665cf5b5a8e24e868fbcc1ededbd58390b539d2 | [
"super(Evolutionary, self).__init__()\nassert learning_rate > 0.0\nself.learning_rate = learning_rate\nassert num_samples >= 1\nself.num_samples = num_samples",
"unperturbed_loss = fn_loss()\ndeltas = variables\ndeltas_list = list()\nprevious_perturbations = None\nfor sample in xrange(self.num_samples):\n with... | <|body_start_0|>
super(Evolutionary, self).__init__()
assert learning_rate > 0.0
self.learning_rate = learning_rate
assert num_samples >= 1
self.num_samples = num_samples
<|end_body_0|>
<|body_start_1|>
unperturbed_loss = fn_loss()
deltas = variables
delt... | Evolutionary optimizer which samples random perturbations and applies them either positively or negatively, depending on their improvement of the loss. | Evolutionary | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Evolutionary:
"""Evolutionary optimizer which samples random perturbations and applies them either positively or negatively, depending on their improvement of the loss."""
def __init__(self, learning_rate, num_samples=1):
"""Creates a new evolutionary optimizer instance. Args: learni... | stack_v2_sparse_classes_75kplus_train_071525 | 3,921 | permissive | [
{
"docstring": "Creates a new evolutionary optimizer instance. Args: learning_rate: Learning rate. num_samples: Number of sampled perturbations.",
"name": "__init__",
"signature": "def __init__(self, learning_rate, num_samples=1)"
},
{
"docstring": "Creates the TensorFlow operations for performi... | 2 | null | Implement the Python class `Evolutionary` described below.
Class description:
Evolutionary optimizer which samples random perturbations and applies them either positively or negatively, depending on their improvement of the loss.
Method signatures and docstrings:
- def __init__(self, learning_rate, num_samples=1): Cr... | Implement the Python class `Evolutionary` described below.
Class description:
Evolutionary optimizer which samples random perturbations and applies them either positively or negatively, depending on their improvement of the loss.
Method signatures and docstrings:
- def __init__(self, learning_rate, num_samples=1): Cr... | 524976f9cdbeebb01eb88c77ae842dbe4c4a1f36 | <|skeleton|>
class Evolutionary:
"""Evolutionary optimizer which samples random perturbations and applies them either positively or negatively, depending on their improvement of the loss."""
def __init__(self, learning_rate, num_samples=1):
"""Creates a new evolutionary optimizer instance. Args: learni... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Evolutionary:
"""Evolutionary optimizer which samples random perturbations and applies them either positively or negatively, depending on their improvement of the loss."""
def __init__(self, learning_rate, num_samples=1):
"""Creates a new evolutionary optimizer instance. Args: learning_rate: Lear... | the_stack_v2_python_sparse | tensorforce/core/optimizers/evolutionary.py | jesuscast/tensorforce-clone | train | 1 |
46f849a0629755e5aa50ee49579539f03ec01baf | [
"self.alphabet = alphabet\nself.n = n\nif key != None:\n self.key = valid_key(key, self.alphabet, self.n)\nelse:\n self.key = valid_key('BBCD', self.alphabet, self.n)",
"message = message.replace(' ', '')\nwhile len(message) % int(math.sqrt(self.n)) != 0:\n message += 'A'\nmatrix_message = matriz_text(me... | <|body_start_0|>
self.alphabet = alphabet
self.n = n
if key != None:
self.key = valid_key(key, self.alphabet, self.n)
else:
self.key = valid_key('BBCD', self.alphabet, self.n)
<|end_body_0|>
<|body_start_1|>
message = message.replace(' ', '')
whil... | Hill | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Hill:
def __init__(self, alphabet, n, key=None):
"""Constructor de clase, recibiendo un alfabeto completamente necesario pero podría no recibir una llave de cifrado, en cuyo caso, hay que generar una, para el caso del tamañHo de la llave, hay que asegurarse que tiene raíz entera. :param ... | stack_v2_sparse_classes_75kplus_train_071526 | 2,634 | permissive | [
{
"docstring": "Constructor de clase, recibiendo un alfabeto completamente necesario pero podría no recibir una llave de cifrado, en cuyo caso, hay que generar una, para el caso del tamañHo de la llave, hay que asegurarse que tiene raíz entera. :param alphabet: una cadena con todos los elementos del alfabeto. :... | 3 | null | Implement the Python class `Hill` described below.
Class description:
Implement the Hill class.
Method signatures and docstrings:
- def __init__(self, alphabet, n, key=None): Constructor de clase, recibiendo un alfabeto completamente necesario pero podría no recibir una llave de cifrado, en cuyo caso, hay que generar... | Implement the Python class `Hill` described below.
Class description:
Implement the Hill class.
Method signatures and docstrings:
- def __init__(self, alphabet, n, key=None): Constructor de clase, recibiendo un alfabeto completamente necesario pero podría no recibir una llave de cifrado, en cuyo caso, hay que generar... | b702854a6cc23a46a5b477abc74bf0d9d2ee9ef4 | <|skeleton|>
class Hill:
def __init__(self, alphabet, n, key=None):
"""Constructor de clase, recibiendo un alfabeto completamente necesario pero podría no recibir una llave de cifrado, en cuyo caso, hay que generar una, para el caso del tamañHo de la llave, hay que asegurarse que tiene raíz entera. :param ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Hill:
def __init__(self, alphabet, n, key=None):
"""Constructor de clase, recibiendo un alfabeto completamente necesario pero podría no recibir una llave de cifrado, en cuyo caso, hay que generar una, para el caso del tamañHo de la llave, hay que asegurarse que tiene raíz entera. :param alphabet: una ... | the_stack_v2_python_sparse | Practica02/hill.py | Argenis616/cryptography | train | 0 | |
f8fd5c147cd95cff9ec08b6064c21d6d26971c08 | [
"ASprite.__init__(self, sprite_filename, speed)\nself.target = target\nself.speed = speed",
"selfx, selfy = self.rect.center\ntargx, targy = self.target.rect.center\ndirection = round_to_45(get_direction(self.rect.center, self.target.rect.center))\nself.move(direction)"
] | <|body_start_0|>
ASprite.__init__(self, sprite_filename, speed)
self.target = target
self.speed = speed
<|end_body_0|>
<|body_start_1|>
selfx, selfy = self.rect.center
targx, targy = self.target.rect.center
direction = round_to_45(get_direction(self.rect.center, self.tar... | A sprite that takes and follows a target | HomingBullet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HomingBullet:
"""A sprite that takes and follows a target"""
def __init__(self, sprite_filename, target, speed):
"""sprite_filename is the sprite file target is the Sprite that the bullet follows"""
<|body_0|>
def update(self):
"""moves the bullet in the directio... | stack_v2_sparse_classes_75kplus_train_071527 | 834 | no_license | [
{
"docstring": "sprite_filename is the sprite file target is the Sprite that the bullet follows",
"name": "__init__",
"signature": "def __init__(self, sprite_filename, target, speed)"
},
{
"docstring": "moves the bullet in the direction of the target",
"name": "update",
"signature": "def... | 2 | stack_v2_sparse_classes_30k_train_034159 | Implement the Python class `HomingBullet` described below.
Class description:
A sprite that takes and follows a target
Method signatures and docstrings:
- def __init__(self, sprite_filename, target, speed): sprite_filename is the sprite file target is the Sprite that the bullet follows
- def update(self): moves the b... | Implement the Python class `HomingBullet` described below.
Class description:
A sprite that takes and follows a target
Method signatures and docstrings:
- def __init__(self, sprite_filename, target, speed): sprite_filename is the sprite file target is the Sprite that the bullet follows
- def update(self): moves the b... | 8f5b8d50b20c8004758998f17e7d1c9b05ce01ae | <|skeleton|>
class HomingBullet:
"""A sprite that takes and follows a target"""
def __init__(self, sprite_filename, target, speed):
"""sprite_filename is the sprite file target is the Sprite that the bullet follows"""
<|body_0|>
def update(self):
"""moves the bullet in the directio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HomingBullet:
"""A sprite that takes and follows a target"""
def __init__(self, sprite_filename, target, speed):
"""sprite_filename is the sprite file target is the Sprite that the bullet follows"""
ASprite.__init__(self, sprite_filename, speed)
self.target = target
self.s... | the_stack_v2_python_sparse | homing_bullet.py | BuddhaRandom/yars-revenge | train | 0 |
46e4d8883b8a3cf9ea71825f7286740aa371176f | [
"self._custom_migrations = custom_migrations or MigrationList()\nself._applied_migrations = None\nself._lock_migrations = False\nself.extra_applied_migrations = MigrationList()\nsuper(MigrationLoader, self).__init__(connection, *args, **kwargs)",
"extra_migrations = self.extra_applied_migrations\nif isinstance(se... | <|body_start_0|>
self._custom_migrations = custom_migrations or MigrationList()
self._applied_migrations = None
self._lock_migrations = False
self.extra_applied_migrations = MigrationList()
super(MigrationLoader, self).__init__(connection, *args, **kwargs)
<|end_body_0|>
<|body_... | Loads migration files from disk. This is a specialization of Django's own :py:class:`~django.db.migrations.loader.MigrationLoader` that allows for providing additional migrations not available on disk. Attributes: extra_applied_migrations (MigrationList): Migrations to mark as already applied. This can be used to augme... | MigrationLoader | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MigrationLoader:
"""Loads migration files from disk. This is a specialization of Django's own :py:class:`~django.db.migrations.loader.MigrationLoader` that allows for providing additional migrations not available on disk. Attributes: extra_applied_migrations (MigrationList): Migrations to mark as... | stack_v2_sparse_classes_75kplus_train_071528 | 35,220 | permissive | [
{
"docstring": "Initialize the loader. Args: connection (django.db.backends.base.BaseDatabaseWrapper): The connection to load applied migrations from. custom_migrations (MigrationList, optional): Custom migrations not available on disk. *args (tuple): Additional positional arguments for the parent class. **kwar... | 5 | stack_v2_sparse_classes_30k_train_004804 | Implement the Python class `MigrationLoader` described below.
Class description:
Loads migration files from disk. This is a specialization of Django's own :py:class:`~django.db.migrations.loader.MigrationLoader` that allows for providing additional migrations not available on disk. Attributes: extra_applied_migrations... | Implement the Python class `MigrationLoader` described below.
Class description:
Loads migration files from disk. This is a specialization of Django's own :py:class:`~django.db.migrations.loader.MigrationLoader` that allows for providing additional migrations not available on disk. Attributes: extra_applied_migrations... | 756eedeacc41f77111a557fc13dee559cb94f433 | <|skeleton|>
class MigrationLoader:
"""Loads migration files from disk. This is a specialization of Django's own :py:class:`~django.db.migrations.loader.MigrationLoader` that allows for providing additional migrations not available on disk. Attributes: extra_applied_migrations (MigrationList): Migrations to mark as... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MigrationLoader:
"""Loads migration files from disk. This is a specialization of Django's own :py:class:`~django.db.migrations.loader.MigrationLoader` that allows for providing additional migrations not available on disk. Attributes: extra_applied_migrations (MigrationList): Migrations to mark as already appl... | the_stack_v2_python_sparse | django_evolution/utils/migrations.py | beanbaginc/django-evolution | train | 22 |
9799a093125dba3bb7aa2a9730b5c5f33c3879bc | [
"super(Perceptron, self).__init__()\nself.learning_rate = learning_rate\nself.mode = mode\nself.layer = nn.Linear(input_size, output_size)",
"if self.mode == 1:\n activation_fn = nn.Sigmoid()\n self.output = activation_fn(self.layer(data))\n loss_fn = nn.BCELoss()\n self.cost = loss_fn(self.output, ch... | <|body_start_0|>
super(Perceptron, self).__init__()
self.learning_rate = learning_rate
self.mode = mode
self.layer = nn.Linear(input_size, output_size)
<|end_body_0|>
<|body_start_1|>
if self.mode == 1:
activation_fn = nn.Sigmoid()
self.output = activatio... | Simplest unit of Neural Networks | Perceptron | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Perceptron:
"""Simplest unit of Neural Networks"""
def __init__(self, input_size, output_size, learning_rate, mode):
"""Constructor"""
<|body_0|>
def forward(self, data, check_data):
"""Feed data to Perceptron. Calculate the estimated output and Cost function usi... | stack_v2_sparse_classes_75kplus_train_071529 | 1,335 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, input_size, output_size, learning_rate, mode)"
},
{
"docstring": "Feed data to Perceptron. Calculate the estimated output and Cost function using Sigmoid as activation function",
"name": "forward",
"signat... | 3 | stack_v2_sparse_classes_30k_train_027886 | Implement the Python class `Perceptron` described below.
Class description:
Simplest unit of Neural Networks
Method signatures and docstrings:
- def __init__(self, input_size, output_size, learning_rate, mode): Constructor
- def forward(self, data, check_data): Feed data to Perceptron. Calculate the estimated output ... | Implement the Python class `Perceptron` described below.
Class description:
Simplest unit of Neural Networks
Method signatures and docstrings:
- def __init__(self, input_size, output_size, learning_rate, mode): Constructor
- def forward(self, data, check_data): Feed data to Perceptron. Calculate the estimated output ... | 44ffe8b19254662c08641ec8923de2e065282540 | <|skeleton|>
class Perceptron:
"""Simplest unit of Neural Networks"""
def __init__(self, input_size, output_size, learning_rate, mode):
"""Constructor"""
<|body_0|>
def forward(self, data, check_data):
"""Feed data to Perceptron. Calculate the estimated output and Cost function usi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Perceptron:
"""Simplest unit of Neural Networks"""
def __init__(self, input_size, output_size, learning_rate, mode):
"""Constructor"""
super(Perceptron, self).__init__()
self.learning_rate = learning_rate
self.mode = mode
self.layer = nn.Linear(input_size, output_s... | the_stack_v2_python_sparse | A2/perceptron.py | adgp97/NNandDL | train | 0 |
cf35c8d2006c1c237a689f05be7a58bd21571780 | [
"print('Inside __init__()')\nself.arg1 = arg1\nprint('self.arg1', self.arg1)",
"def powers_f(*args):\n print('In powers_f()')\n print('Decorator Argument', self.arg1)\n x = self.arg1\n print('x is', x)\n if False == isinstance(x, int):\n raise TypeError\n elif x < 0:\n raise ValueE... | <|body_start_0|>
print('Inside __init__()')
self.arg1 = arg1
print('self.arg1', self.arg1)
<|end_body_0|>
<|body_start_1|>
def powers_f(*args):
print('In powers_f()')
print('Decorator Argument', self.arg1)
x = self.arg1
print('x is', x)
... | myPow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class myPow:
def __init__(self, arg1):
"""If there are decorator arguments, the function to be decorated is not passed to the constructor!"""
<|body_0|>
def __call__(self, f):
"""If there are decorator arguments, __call__() is only called once, as part of the decoration pr... | stack_v2_sparse_classes_75kplus_train_071530 | 1,613 | no_license | [
{
"docstring": "If there are decorator arguments, the function to be decorated is not passed to the constructor!",
"name": "__init__",
"signature": "def __init__(self, arg1)"
},
{
"docstring": "If there are decorator arguments, __call__() is only called once, as part of the decoration process! Y... | 2 | stack_v2_sparse_classes_30k_train_053101 | Implement the Python class `myPow` described below.
Class description:
Implement the myPow class.
Method signatures and docstrings:
- def __init__(self, arg1): If there are decorator arguments, the function to be decorated is not passed to the constructor!
- def __call__(self, f): If there are decorator arguments, __... | Implement the Python class `myPow` described below.
Class description:
Implement the myPow class.
Method signatures and docstrings:
- def __init__(self, arg1): If there are decorator arguments, the function to be decorated is not passed to the constructor!
- def __call__(self, f): If there are decorator arguments, __... | 7306581d542d6d045a9b2e6377ade0fc5ab8bc0e | <|skeleton|>
class myPow:
def __init__(self, arg1):
"""If there are decorator arguments, the function to be decorated is not passed to the constructor!"""
<|body_0|>
def __call__(self, f):
"""If there are decorator arguments, __call__() is only called once, as part of the decoration pr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class myPow:
def __init__(self, arg1):
"""If there are decorator arguments, the function to be decorated is not passed to the constructor!"""
print('Inside __init__()')
self.arg1 = arg1
print('self.arg1', self.arg1)
def __call__(self, f):
"""If there are decorator argume... | the_stack_v2_python_sparse | PythonHomeWork/Py4/Py4_Lesson07/src/myPowClass.py | rduvalwa5/OReillyPy | train | 0 | |
f1880b9335bfbe05a0c1f542f6ea87cde3281113 | [
"if not s:\n return True\nl = 0\nr = len(s) - 1\nwhile l < r:\n l, r = self.eval_next_char(l, r, s)\n if l == len(s) - 1 and r == 0:\n return True\n elif s[l].lower() != s[r].lower():\n return False\n else:\n l += 1\n r -= 1\nreturn True",
"while not s[l].isalnum() and l... | <|body_start_0|>
if not s:
return True
l = 0
r = len(s) - 1
while l < r:
l, r = self.eval_next_char(l, r, s)
if l == len(s) - 1 and r == 0:
return True
elif s[l].lower() != s[r].lower():
return False
... | Iteration over character indicies in string. Time complexity: O(n) - Amortized iterate over all characters in string Space complexity: O(1) - Update constant number of pointers | Solution | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Iteration over character indicies in string. Time complexity: O(n) - Amortized iterate over all characters in string Space complexity: O(1) - Update constant number of pointers"""
def is_palindrome(self, s):
"""Determines whether alphanumeric characters comprise a valid ... | stack_v2_sparse_classes_75kplus_train_071531 | 3,473 | permissive | [
{
"docstring": "Determines whether alphanumeric characters comprise a valid palindrome. :param str s: input string :return: True if relevant string characters are valid palindrome :rtype: bool",
"name": "is_palindrome",
"signature": "def is_palindrome(self, s)"
},
{
"docstring": "Moves index poi... | 2 | stack_v2_sparse_classes_30k_train_004088 | Implement the Python class `Solution` described below.
Class description:
Iteration over character indicies in string. Time complexity: O(n) - Amortized iterate over all characters in string Space complexity: O(1) - Update constant number of pointers
Method signatures and docstrings:
- def is_palindrome(self, s): Det... | Implement the Python class `Solution` described below.
Class description:
Iteration over character indicies in string. Time complexity: O(n) - Amortized iterate over all characters in string Space complexity: O(1) - Update constant number of pointers
Method signatures and docstrings:
- def is_palindrome(self, s): Det... | 69f90877c5466927e8b081c4268cbcda074813ec | <|skeleton|>
class Solution:
"""Iteration over character indicies in string. Time complexity: O(n) - Amortized iterate over all characters in string Space complexity: O(1) - Update constant number of pointers"""
def is_palindrome(self, s):
"""Determines whether alphanumeric characters comprise a valid ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""Iteration over character indicies in string. Time complexity: O(n) - Amortized iterate over all characters in string Space complexity: O(1) - Update constant number of pointers"""
def is_palindrome(self, s):
"""Determines whether alphanumeric characters comprise a valid palindrome. :... | the_stack_v2_python_sparse | 0125_valid_palindrome/python_source.py | arthurdysart/LeetCode | train | 0 |
1ea887d1fe29976aefb53bda0aebaf68f3a15dc8 | [
"is_jit = isinstance(model, torch.jit.ScriptModule)\nsave = torch.jit.save if is_jit else torch.save\nmodel_name = self.model_jit_file_name if is_jit else self.model_file_name\nbuffer = BytesIO()\nsave(model, buffer)\nyield Blobs({model_name: InMemoryBlob(buffer.getvalue())})",
"model_path = os.path.join(path, se... | <|body_start_0|>
is_jit = isinstance(model, torch.jit.ScriptModule)
save = torch.jit.save if is_jit else torch.save
model_name = self.model_jit_file_name if is_jit else self.model_file_name
buffer = BytesIO()
save(model, buffer)
yield Blobs({model_name: InMemoryBlob(buffe... | :class:`ebonite.core.objects.ModelIO` for PyTorch models | TorchModelIO | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TorchModelIO:
""":class:`ebonite.core.objects.ModelIO` for PyTorch models"""
def dump(self, model) -> ArtifactCollection:
"""Dumps `torch.nn.Module` instance to :class:`.InMemoryBlob` and creates :class:`.ArtifactCollection` from it :return: context manager with :class:`~ebonite.core... | stack_v2_sparse_classes_75kplus_train_071532 | 2,575 | permissive | [
{
"docstring": "Dumps `torch.nn.Module` instance to :class:`.InMemoryBlob` and creates :class:`.ArtifactCollection` from it :return: context manager with :class:`~ebonite.core.objects.ArtifactCollection`",
"name": "dump",
"signature": "def dump(self, model) -> ArtifactCollection"
},
{
"docstring... | 2 | null | Implement the Python class `TorchModelIO` described below.
Class description:
:class:`ebonite.core.objects.ModelIO` for PyTorch models
Method signatures and docstrings:
- def dump(self, model) -> ArtifactCollection: Dumps `torch.nn.Module` instance to :class:`.InMemoryBlob` and creates :class:`.ArtifactCollection` fr... | Implement the Python class `TorchModelIO` described below.
Class description:
:class:`ebonite.core.objects.ModelIO` for PyTorch models
Method signatures and docstrings:
- def dump(self, model) -> ArtifactCollection: Dumps `torch.nn.Module` instance to :class:`.InMemoryBlob` and creates :class:`.ArtifactCollection` fr... | b01b662c43709d152940f488574d78ff25f89ecf | <|skeleton|>
class TorchModelIO:
""":class:`ebonite.core.objects.ModelIO` for PyTorch models"""
def dump(self, model) -> ArtifactCollection:
"""Dumps `torch.nn.Module` instance to :class:`.InMemoryBlob` and creates :class:`.ArtifactCollection` from it :return: context manager with :class:`~ebonite.core... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TorchModelIO:
""":class:`ebonite.core.objects.ModelIO` for PyTorch models"""
def dump(self, model) -> ArtifactCollection:
"""Dumps `torch.nn.Module` instance to :class:`.InMemoryBlob` and creates :class:`.ArtifactCollection` from it :return: context manager with :class:`~ebonite.core.objects.Arti... | the_stack_v2_python_sparse | src/ebonite/ext/torch/model.py | zyfra/ebonite | train | 275 |
9d4564c1837557212ea053de51c3fe191c543cd2 | [
"toi_information = DataFetcher.getTargetInformation()\nself.start_url = 'https://archive.stsci.edu/missions/tess/ete-6/tid/'\nself.end_url = '-0016-s_lc.fits'\nsuper(DataFetcher, self).__init__(ap_paramList, toi_information)",
"url_list = []\nfor tid in tid_list:\n url_path = tid[:2] + '/' + tid[2:5] + '/' + t... | <|body_start_0|>
toi_information = DataFetcher.getTargetInformation()
self.start_url = 'https://archive.stsci.edu/missions/tess/ete-6/tid/'
self.end_url = '-0016-s_lc.fits'
super(DataFetcher, self).__init__(ap_paramList, toi_information)
<|end_body_0|>
<|body_start_1|>
url_list ... | Data Fetcher for TESS data alerts | DataFetcher | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataFetcher:
"""Data Fetcher for TESS data alerts"""
def __init__(self, ap_paramList):
"""Initialize TESS Data Fetcher @param ap_paramList[tess_ids]: List of TESS IDs to retrieve @param start_url: URL to prepend before the TESS ID @param end_url: URL to append after the TESS ID"""
... | stack_v2_sparse_classes_75kplus_train_071533 | 3,008 | permissive | [
{
"docstring": "Initialize TESS Data Fetcher @param ap_paramList[tess_ids]: List of TESS IDs to retrieve @param start_url: URL to prepend before the TESS ID @param end_url: URL to append after the TESS ID",
"name": "__init__",
"signature": "def __init__(self, ap_paramList)"
},
{
"docstring": "Ge... | 3 | stack_v2_sparse_classes_30k_train_002441 | Implement the Python class `DataFetcher` described below.
Class description:
Data Fetcher for TESS data alerts
Method signatures and docstrings:
- def __init__(self, ap_paramList): Initialize TESS Data Fetcher @param ap_paramList[tess_ids]: List of TESS IDs to retrieve @param start_url: URL to prepend before the TESS... | Implement the Python class `DataFetcher` described below.
Class description:
Data Fetcher for TESS data alerts
Method signatures and docstrings:
- def __init__(self, ap_paramList): Initialize TESS Data Fetcher @param ap_paramList[tess_ids]: List of TESS IDs to retrieve @param start_url: URL to prepend before the TESS... | 935bfd54149abd9542fe38e77b7eabab48b1c3a1 | <|skeleton|>
class DataFetcher:
"""Data Fetcher for TESS data alerts"""
def __init__(self, ap_paramList):
"""Initialize TESS Data Fetcher @param ap_paramList[tess_ids]: List of TESS IDs to retrieve @param start_url: URL to prepend before the TESS ID @param end_url: URL to append after the TESS ID"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DataFetcher:
"""Data Fetcher for TESS data alerts"""
def __init__(self, ap_paramList):
"""Initialize TESS Data Fetcher @param ap_paramList[tess_ids]: List of TESS IDs to retrieve @param start_url: URL to prepend before the TESS ID @param end_url: URL to append after the TESS ID"""
toi_inf... | the_stack_v2_python_sparse | skdaccess/astro/tess/simulated/cache.py | MITHaystack/scikit-dataaccess | train | 41 |
f81ecf269bf9fec5a881377050a7264962a6177f | [
"self.driver.click('#authentication')\nself.driver.wait_for_visible('div.auth-form')\nself.driver.type_in('form#login_form #id_username', email)\nself.driver.type_in('form#login_form #id_password', password)\nself.driver.click('form#login_form input.link-button')\nself.assertTrue(self.driver.is_element_present('#us... | <|body_start_0|>
self.driver.click('#authentication')
self.driver.wait_for_visible('div.auth-form')
self.driver.type_in('form#login_form #id_username', email)
self.driver.type_in('form#login_form #id_password', password)
self.driver.click('form#login_form input.link-button')
... | Default interface test case to provide common methods | InterfaceTestCase | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InterfaceTestCase:
"""Default interface test case to provide common methods"""
def _login(self, email='test@gmail.com', password='a'):
"""Login user to the system"""
<|body_0|>
def _single_update_and_restore(self):
"""Performs quantity update for the product in t... | stack_v2_sparse_classes_75kplus_train_071534 | 3,056 | permissive | [
{
"docstring": "Login user to the system",
"name": "_login",
"signature": "def _login(self, email='test@gmail.com', password='a')"
},
{
"docstring": "Performs quantity update for the product in the first row",
"name": "_single_update_and_restore",
"signature": "def _single_update_and_res... | 2 | stack_v2_sparse_classes_30k_train_009882 | Implement the Python class `InterfaceTestCase` described below.
Class description:
Default interface test case to provide common methods
Method signatures and docstrings:
- def _login(self, email='test@gmail.com', password='a'): Login user to the system
- def _single_update_and_restore(self): Performs quantity update... | Implement the Python class `InterfaceTestCase` described below.
Class description:
Default interface test case to provide common methods
Method signatures and docstrings:
- def _login(self, email='test@gmail.com', password='a'): Login user to the system
- def _single_update_and_restore(self): Performs quantity update... | 7106909ba7a1ce7d0368afd1b41be6462c6d2310 | <|skeleton|>
class InterfaceTestCase:
"""Default interface test case to provide common methods"""
def _login(self, email='test@gmail.com', password='a'):
"""Login user to the system"""
<|body_0|>
def _single_update_and_restore(self):
"""Performs quantity update for the product in t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InterfaceTestCase:
"""Default interface test case to provide common methods"""
def _login(self, email='test@gmail.com', password='a'):
"""Login user to the system"""
self.driver.click('#authentication')
self.driver.wait_for_visible('div.auth-form')
self.driver.type_in('for... | the_stack_v2_python_sparse | tools/test_runner.py | johnulist/prestashop-sync | train | 0 |
78684c89a06df79f0c2207c4a41c7b4ebdf4a036 | [
"y = 0\nfor x in range(len(nums)):\n if nums[x]:\n nums[x], nums[y] = (nums[y], nums[x])\n y += 1",
"l = len(nums)\nfor i in range(l):\n if nums[i] == 0:\n j = i + 1\n while j < l and nums[j] == 0:\n j += 1\n if j < l:\n nums[i], nums[j] = (nums[j], n... | <|body_start_0|>
y = 0
for x in range(len(nums)):
if nums[x]:
nums[x], nums[y] = (nums[y], nums[x])
y += 1
<|end_body_0|>
<|body_start_1|>
l = len(nums)
for i in range(l):
if nums[i] == 0:
j = i + 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def moveZeroes(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def moveZeroes(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_1... | stack_v2_sparse_classes_75kplus_train_071535 | 1,129 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.",
"name": "moveZeroes",
"signature": "def moveZeroes(self, nums)"
},
{
"docstring": "Do not return anything, modify nums in-place instead.",
"name": "moveZeroes",
"signature": "def mo... | 2 | stack_v2_sparse_classes_30k_train_010022 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def moveZeroes(self, nums: List[int]) -> None: Do not retur... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def moveZeroes(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
- def moveZeroes(self, nums: List[int]) -> None: Do not retur... | 378cb9b53e7710c5cf546f5d75e572060e2a211a | <|skeleton|>
class Solution:
def moveZeroes(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
<|body_0|>
def moveZeroes(self, nums: List[int]) -> None:
"""Do not return anything, modify nums in-place instead."""
<|body_1... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def moveZeroes(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead."""
y = 0
for x in range(len(nums)):
if nums[x]:
nums[x], nums[y] = (nums[y], nums[x])
y += 1
def moveZeroes... | the_stack_v2_python_sparse | 283.MoveZeroes.py | RupertMa/LeetCode-Playground | train | 0 | |
9c9f4307eb7cb95bd122278e03949b450fd8f1ae | [
"self.calc_losses = calc_losses\nself.weights = weights\nself.stereo = stereo",
"augm_data = self.augment_data(features, predictions)\nif self.stereo:\n augm_data_rig = self.augment_data(features, predictions, '_R')\n augm_data.update(augm_data_rig)\nlosses = []\nfor calc_loss, weight in zip(self.calc_losse... | <|body_start_0|>
self.calc_losses = calc_losses
self.weights = weights
self.stereo = stereo
<|end_body_0|>
<|body_start_1|>
augm_data = self.augment_data(features, predictions)
if self.stereo:
augm_data_rig = self.augment_data(features, predictions, '_R')
... | TotalLoss | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TotalLoss:
def __init__(self, calc_losses=None, weights=None, stereo=False):
""":param calc_losses: list of loss calculators :param weights: list of weights of loss calculators"""
<|body_0|>
def __call__(self, predictions, features):
""":param predictions: {"depth_ms... | stack_v2_sparse_classes_75kplus_train_071536 | 16,559 | permissive | [
{
"docstring": ":param calc_losses: list of loss calculators :param weights: list of weights of loss calculators",
"name": "__init__",
"signature": "def __init__(self, calc_losses=None, weights=None, stereo=False)"
},
{
"docstring": ":param predictions: {\"depth_ms\": .., \"disp_ms\": .., \"pose... | 3 | stack_v2_sparse_classes_30k_train_034502 | Implement the Python class `TotalLoss` described below.
Class description:
Implement the TotalLoss class.
Method signatures and docstrings:
- def __init__(self, calc_losses=None, weights=None, stereo=False): :param calc_losses: list of loss calculators :param weights: list of weights of loss calculators
- def __call_... | Implement the Python class `TotalLoss` described below.
Class description:
Implement the TotalLoss class.
Method signatures and docstrings:
- def __init__(self, calc_losses=None, weights=None, stereo=False): :param calc_losses: list of loss calculators :param weights: list of weights of loss calculators
- def __call_... | 592e587a608e9e5c568b70e04c142a7e8d61aa62 | <|skeleton|>
class TotalLoss:
def __init__(self, calc_losses=None, weights=None, stereo=False):
""":param calc_losses: list of loss calculators :param weights: list of weights of loss calculators"""
<|body_0|>
def __call__(self, predictions, features):
""":param predictions: {"depth_ms... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TotalLoss:
def __init__(self, calc_losses=None, weights=None, stereo=False):
""":param calc_losses: list of loss calculators :param weights: list of weights of loss calculators"""
self.calc_losses = calc_losses
self.weights = weights
self.stereo = stereo
def __call__(self,... | the_stack_v2_python_sparse | model/loss_and_metric/losses.py | WELLBEINGLWB/vode-2020 | train | 0 | |
fb6010d6a5296e6a8f3911e4433f5648df844fa3 | [
"qs = Event.objects.filter(is_public=True).order_by('-id')\nserializer = EventSerializer(instance=qs, many=True)\nreturn Response(JSONRenderer().render(serializer.data), content_type='json')",
"try:\n client = Client.objects.filter(user=request.user.id)[0]\n event = Event.objects.get(id=request.data['event'... | <|body_start_0|>
qs = Event.objects.filter(is_public=True).order_by('-id')
serializer = EventSerializer(instance=qs, many=True)
return Response(JSONRenderer().render(serializer.data), content_type='json')
<|end_body_0|>
<|body_start_1|>
try:
client = Client.objects.filter(us... | API endpoint that allows Events to be viewed or edited. https://www.django-rest-framework.org/api-guide/viewsets/ https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/ | EventViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventViewSet:
"""API endpoint that allows Events to be viewed or edited. https://www.django-rest-framework.org/api-guide/viewsets/ https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/"""
def public(self, request):
"""Gets all public Events. :param request: HTTP requ... | stack_v2_sparse_classes_75kplus_train_071537 | 17,549 | no_license | [
{
"docstring": "Gets all public Events. :param request: HTTP request object :return: HTTP Response",
"name": "public",
"signature": "def public(self, request)"
},
{
"docstring": "Joins the logged in user to the Event, passed as POST param. :param request: HTTP request object :return: HTTP Respon... | 4 | stack_v2_sparse_classes_30k_train_025746 | Implement the Python class `EventViewSet` described below.
Class description:
API endpoint that allows Events to be viewed or edited. https://www.django-rest-framework.org/api-guide/viewsets/ https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/
Method signatures and docstrings:
- def public(self, re... | Implement the Python class `EventViewSet` described below.
Class description:
API endpoint that allows Events to be viewed or edited. https://www.django-rest-framework.org/api-guide/viewsets/ https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/
Method signatures and docstrings:
- def public(self, re... | d71dece8f582fd95975371c636e25475a843b958 | <|skeleton|>
class EventViewSet:
"""API endpoint that allows Events to be viewed or edited. https://www.django-rest-framework.org/api-guide/viewsets/ https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/"""
def public(self, request):
"""Gets all public Events. :param request: HTTP requ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EventViewSet:
"""API endpoint that allows Events to be viewed or edited. https://www.django-rest-framework.org/api-guide/viewsets/ https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/"""
def public(self, request):
"""Gets all public Events. :param request: HTTP request object :r... | the_stack_v2_python_sparse | royale/views.py | rlawton1243/Routine-Royale | train | 3 |
df701bf4ed4bc74949f6c2b3a843956abb6e58c9 | [
"try:\n player_id = current_user['player_id']\n match_placement = match_placements.get_player_match_placement(player_id)\n match_placement['match_placement_url'] = url_for('match-placements.match-placement', match_placement_id=match_placement['placement_id'], _external=True)\n return match_placement\nex... | <|body_start_0|>
try:
player_id = current_user['player_id']
match_placement = match_placements.get_player_match_placement(player_id)
match_placement['match_placement_url'] = url_for('match-placements.match-placement', match_placement_id=match_placement['placement_id'], _exter... | MatchPlacementsAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MatchPlacementsAPI:
def get(self):
"""Gets the current match placement for the requesting player. Returns a match placement."""
<|body_0|>
def post(self, args):
"""Create a match placement for the requesting player. Returns a match placement."""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus_train_071538 | 9,013 | permissive | [
{
"docstring": "Gets the current match placement for the requesting player. Returns a match placement.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create a match placement for the requesting player. Returns a match placement.",
"name": "post",
"signature": "def post(... | 2 | null | Implement the Python class `MatchPlacementsAPI` described below.
Class description:
Implement the MatchPlacementsAPI class.
Method signatures and docstrings:
- def get(self): Gets the current match placement for the requesting player. Returns a match placement.
- def post(self, args): Create a match placement for the... | Implement the Python class `MatchPlacementsAPI` described below.
Class description:
Implement the MatchPlacementsAPI class.
Method signatures and docstrings:
- def get(self): Gets the current match placement for the requesting player. Returns a match placement.
- def post(self, args): Create a match placement for the... | 2771bb46db7fd331448f9db3cfb257fab7f89bcc | <|skeleton|>
class MatchPlacementsAPI:
def get(self):
"""Gets the current match placement for the requesting player. Returns a match placement."""
<|body_0|>
def post(self, args):
"""Create a match placement for the requesting player. Returns a match placement."""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MatchPlacementsAPI:
def get(self):
"""Gets the current match placement for the requesting player. Returns a match placement."""
try:
player_id = current_user['player_id']
match_placement = match_placements.get_player_match_placement(player_id)
match_placemen... | the_stack_v2_python_sparse | driftbase/api/match_placements.py | directivegames/drift-base | train | 1 | |
8b6c9e8ef6205912cd18b32f410d788dc0ec1a64 | [
"sentinel = dummy = ListNode(0)\nlength = 0\narr = []\nwhile head:\n arr.append(head.val)\n head = head.next\n length += 1\nif n == 1:\n arr = arr[:-1]\nelse:\n arr = arr[:-n] + arr[-n + 1:]\nfor num in arr:\n dummy.next = ListNode(num)\n dummy = dummy.next\nreturn sentinel.next",
"second = f... | <|body_start_0|>
sentinel = dummy = ListNode(0)
length = 0
arr = []
while head:
arr.append(head.val)
head = head.next
length += 1
if n == 1:
arr = arr[:-1]
else:
arr = arr[:-n] + arr[-n + 1:]
for num in a... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode:
"""Additional space + additional pass"""
<|body_0|>
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
"""Approch: Use two pointers. The first pointer advances the list by n+1 ste... | stack_v2_sparse_classes_75kplus_train_071539 | 2,372 | no_license | [
{
"docstring": "Additional space + additional pass",
"name": "removeNthFromEnd1",
"signature": "def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode"
},
{
"docstring": "Approch: Use two pointers. The first pointer advances the list by n+1 steps from the beginning, while the second poi... | 3 | stack_v2_sparse_classes_30k_train_018350 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode: Additional space + additional pass
- def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: Approch: Use... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode: Additional space + additional pass
- def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: Approch: Use... | fbaae4bdbb2017ee43b0d1a3f23137a75f7ea2c1 | <|skeleton|>
class Solution:
def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode:
"""Additional space + additional pass"""
<|body_0|>
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
"""Approch: Use two pointers. The first pointer advances the list by n+1 ste... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def removeNthFromEnd1(self, head: ListNode, n: int) -> ListNode:
"""Additional space + additional pass"""
sentinel = dummy = ListNode(0)
length = 0
arr = []
while head:
arr.append(head.val)
head = head.next
length += 1
... | the_stack_v2_python_sparse | b_75/remove_nth_node_end_list.py | Milan-Chicago/ds-guide | train | 0 | |
32f7c3700045023f2e50252a59b90f773f490e69 | [
"self.x = x\nself.y = y\nself.width = width\nself.length = length\nself.psi = psi\nself.skewness = skewness",
"skew23 = np.abs(self.skewness) ** (2 / 3)\ndelta = np.sign(self.skewness) * np.sqrt(np.pi / 2 * skew23 / (skew23 + (0.5 * (4 - np.pi)) ** (2 / 3)))\na = delta / np.sqrt(1 - delta ** 2)\nscale = self.leng... | <|body_start_0|>
self.x = x
self.y = y
self.width = width
self.length = length
self.psi = psi
self.skewness = skewness
<|end_body_0|>
<|body_start_1|>
skew23 = np.abs(self.skewness) ** (2 / 3)
delta = np.sign(self.skewness) * np.sqrt(np.pi / 2 * skew23 / ... | A shower image that has a skewness along the major axis. | SkewedGaussian | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SkewedGaussian:
"""A shower image that has a skewness along the major axis."""
def __init__(self, x, y, length, width, psi, skewness):
"""Create 2D skewed Gaussian model for a shower image in a camera. Skewness is only applied along the main shower axis. See https://en.wikipedia.org/... | stack_v2_sparse_classes_75kplus_train_071540 | 12,327 | permissive | [
{
"docstring": "Create 2D skewed Gaussian model for a shower image in a camera. Skewness is only applied along the main shower axis. See https://en.wikipedia.org/wiki/Skew_normal_distribution and https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.skewnorm.html for details. Parameters ---------- ce... | 3 | stack_v2_sparse_classes_30k_train_036780 | Implement the Python class `SkewedGaussian` described below.
Class description:
A shower image that has a skewness along the major axis.
Method signatures and docstrings:
- def __init__(self, x, y, length, width, psi, skewness): Create 2D skewed Gaussian model for a shower image in a camera. Skewness is only applied ... | Implement the Python class `SkewedGaussian` described below.
Class description:
A shower image that has a skewness along the major axis.
Method signatures and docstrings:
- def __init__(self, x, y, length, width, psi, skewness): Create 2D skewed Gaussian model for a shower image in a camera. Skewness is only applied ... | 10b058f8dcc166177d1eb5b2af638ca37722a021 | <|skeleton|>
class SkewedGaussian:
"""A shower image that has a skewness along the major axis."""
def __init__(self, x, y, length, width, psi, skewness):
"""Create 2D skewed Gaussian model for a shower image in a camera. Skewness is only applied along the main shower axis. See https://en.wikipedia.org/... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SkewedGaussian:
"""A shower image that has a skewness along the major axis."""
def __init__(self, x, y, length, width, psi, skewness):
"""Create 2D skewed Gaussian model for a shower image in a camera. Skewness is only applied along the main shower axis. See https://en.wikipedia.org/wiki/Skew_nor... | the_stack_v2_python_sparse | ctapipe/image/toymodel.py | cta-sst-1m/ctapipe | train | 1 |
405c13cebc4d869b65f92408ab0da886ca8bdafc | [
"rights = access.Checker(params)\nrights['listSelf'] = ['checkIsUser']\nrights['create'] = ['deny']\nrights['edit'] = ['checkIsDeveloper']\nrights['process_invite'] = ['checkIsMyGroupAcceptedRequest']\nrights['list'] = ['checkIsDeveloper']\nrights['delete'] = ['checkIsDeveloper']\nrights['roles'] = ['checkIsUser']\... | <|body_start_0|>
rights = access.Checker(params)
rights['listSelf'] = ['checkIsUser']
rights['create'] = ['deny']
rights['edit'] = ['checkIsDeveloper']
rights['process_invite'] = ['checkIsMyGroupAcceptedRequest']
rights['list'] = ['checkIsDeveloper']
rights['delet... | View methods for the Request model. | View | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class View:
"""View methods for the Request model."""
def __init__(self, params=None):
"""Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View"""
<|body... | stack_v2_sparse_classes_75kplus_train_071541 | 8,122 | permissive | [
{
"docstring": "Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View",
"name": "__init__",
"signature": "def __init__(self, params=None)"
},
{
"docstring": "Creates t... | 3 | stack_v2_sparse_classes_30k_train_010744 | Implement the Python class `View` described below.
Class description:
View methods for the Request model.
Method signatures and docstrings:
- def __init__(self, params=None): Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: p... | Implement the Python class `View` described below.
Class description:
View methods for the Request model.
Method signatures and docstrings:
- def __init__(self, params=None): Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: p... | 4ea49a137a1120b44a891e1c796910bc332cf096 | <|skeleton|>
class View:
"""View methods for the Request model."""
def __init__(self, params=None):
"""Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class View:
"""View methods for the Request model."""
def __init__(self, params=None):
"""Defines the fields and methods required for the base View class to provide the user with list, public, create, edit and delete views. Params: params: a dict with params for this View"""
rights = access.Che... | the_stack_v2_python_sparse | app/soc/views/models/request.py | jaytoday/Melange | train | 0 |
b0573534f9c53ce27cb10b6dfdbc341c6a7185e2 | [
"to_socket.settimeout(send_timeout)\ntry:\n data_fragments = []\n for i in range(0, len(data_stream), 4096):\n data_fragments.append(data_stream[i:i + 4096])\n if data_fragments[-1] == 4096:\n data_fragments.append(b'\\n')\n for frag in data_fragments:\n to_socket.send(frag)\nexcept... | <|body_start_0|>
to_socket.settimeout(send_timeout)
try:
data_fragments = []
for i in range(0, len(data_stream), 4096):
data_fragments.append(data_stream[i:i + 4096])
if data_fragments[-1] == 4096:
data_fragments.append(b'\n')
... | Static functions, to use as helpers | Helpers | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Helpers:
"""Static functions, to use as helpers"""
def send_data(to_socket: socket.socket, data_stream: bytes, send_timeout=2) -> None:
"""Centralised function to handle sending data stream to receive data. Sends data in consistent buffer sizes Args: to_socket: Socket to send stream ... | stack_v2_sparse_classes_75kplus_train_071542 | 5,200 | permissive | [
{
"docstring": "Centralised function to handle sending data stream to receive data. Sends data in consistent buffer sizes Args: to_socket: Socket to send stream to data_stream: Data stream to send send_timeout: Set timeout for to_socket",
"name": "send_data",
"signature": "def send_data(to_socket: socke... | 4 | stack_v2_sparse_classes_30k_train_023038 | Implement the Python class `Helpers` described below.
Class description:
Static functions, to use as helpers
Method signatures and docstrings:
- def send_data(to_socket: socket.socket, data_stream: bytes, send_timeout=2) -> None: Centralised function to handle sending data stream to receive data. Sends data in consis... | Implement the Python class `Helpers` described below.
Class description:
Static functions, to use as helpers
Method signatures and docstrings:
- def send_data(to_socket: socket.socket, data_stream: bytes, send_timeout=2) -> None: Centralised function to handle sending data stream to receive data. Sends data in consis... | 73a84ceec6220ec51d83c36afdfb558c8ddbd5e5 | <|skeleton|>
class Helpers:
"""Static functions, to use as helpers"""
def send_data(to_socket: socket.socket, data_stream: bytes, send_timeout=2) -> None:
"""Centralised function to handle sending data stream to receive data. Sends data in consistent buffer sizes Args: to_socket: Socket to send stream ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Helpers:
"""Static functions, to use as helpers"""
def send_data(to_socket: socket.socket, data_stream: bytes, send_timeout=2) -> None:
"""Centralised function to handle sending data stream to receive data. Sends data in consistent buffer sizes Args: to_socket: Socket to send stream to data_strea... | the_stack_v2_python_sparse | Chapter_02/Z_helpers.py | dpazavalos/BlackHatPython3 | train | 1 |
bb1908e455736d5f2dc4491ee0dcf4c856a5191d | [
"self._attribute_groep_id: int = attribute_groep_id\n'\\n Het ID van deze attribuutgroep.\\n '\nself._aantal_voorwaarden_voor_true: int = aantal_voorwaarden_voor_true\n'\\n Het minimale aantal voorwaarden waaraan moet worden voldaan om deze attribuutgroep te laten vuren.\\n '\nself._kopp... | <|body_start_0|>
self._attribute_groep_id: int = attribute_groep_id
'\n Het ID van deze attribuutgroep.\n '
self._aantal_voorwaarden_voor_true: int = aantal_voorwaarden_voor_true
'\n Het minimale aantal voorwaarden waaraan moet worden voldaan om deze attribuutgroep t... | Klasse voor attribuutgroep. | AttribuutGroep | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttribuutGroep:
"""Klasse voor attribuutgroep."""
def __init__(self, attribute_groep_id: int, aantal_voorwaarden_voor_true: int, koppelingen: List[AttribuutGroepKoppeling]):
"""Object constructor. :param int attribute_groep_id: Het ID van deze attribuutgroep. :param int aantal_voorwa... | stack_v2_sparse_classes_75kplus_train_071543 | 2,059 | permissive | [
{
"docstring": "Object constructor. :param int attribute_groep_id: Het ID van deze attribuutgroep. :param int aantal_voorwaarden_voor_true: Het minimale aantal voorwaarden waaraan moet worden voldaan. :param list[kerapu.boom.attribuut_groep_koppeling.AttribuutGroepKoppeling.AttribuutGroepKoppeling] koppelingen:... | 2 | stack_v2_sparse_classes_30k_train_014264 | Implement the Python class `AttribuutGroep` described below.
Class description:
Klasse voor attribuutgroep.
Method signatures and docstrings:
- def __init__(self, attribute_groep_id: int, aantal_voorwaarden_voor_true: int, koppelingen: List[AttribuutGroepKoppeling]): Object constructor. :param int attribute_groep_id:... | Implement the Python class `AttribuutGroep` described below.
Class description:
Klasse voor attribuutgroep.
Method signatures and docstrings:
- def __init__(self, attribute_groep_id: int, aantal_voorwaarden_voor_true: int, koppelingen: List[AttribuutGroepKoppeling]): Object constructor. :param int attribute_groep_id:... | fdae5ce96e9c79bf0d325c488077436fa31ad03f | <|skeleton|>
class AttribuutGroep:
"""Klasse voor attribuutgroep."""
def __init__(self, attribute_groep_id: int, aantal_voorwaarden_voor_true: int, koppelingen: List[AttribuutGroepKoppeling]):
"""Object constructor. :param int attribute_groep_id: Het ID van deze attribuutgroep. :param int aantal_voorwa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AttribuutGroep:
"""Klasse voor attribuutgroep."""
def __init__(self, attribute_groep_id: int, aantal_voorwaarden_voor_true: int, koppelingen: List[AttribuutGroepKoppeling]):
"""Object constructor. :param int attribute_groep_id: Het ID van deze attribuutgroep. :param int aantal_voorwaarden_voor_tr... | the_stack_v2_python_sparse | kerapu/boom/AttribuutGroep.py | SetBased/py-kerapu | train | 5 |
a9733df36dd056cc3c91715cebb5f0cca8697d5e | [
"if not nums:\n return 0\nsize = len(nums)\ndp = [0 for _ in range(size + 1)]\ndp[1] = nums[0]\nfor i in range(2, size + 1):\n dp[i] = max(dp[i - 1], dp[i - 2] + nums[i - 1])\nreturn dp[size]",
"if not nums:\n return 0\nsize = len(nums)\nyes, no = (nums[0], 0)\nfor i in range(1, size):\n yes, no = (no... | <|body_start_0|>
if not nums:
return 0
size = len(nums)
dp = [0 for _ in range(size + 1)]
dp[1] = nums[0]
for i in range(2, size + 1):
dp[i] = max(dp[i - 1], dp[i - 2] + nums[i - 1])
return dp[size]
<|end_body_0|>
<|body_start_1|>
if not n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rob(self, nums: List[int]) -> int:
"""打家劫舍 自底向上的动态规划"""
<|body_0|>
def rob_1(self, nums: List[int]) -> int:
"""打家劫舍 动态规划-空间优化"""
<|body_1|>
def rob_2(self, nums: List[int]) -> int:
"""打家劫舍 自顶向下的递归+备忘录"""
<|body_2|>
def ... | stack_v2_sparse_classes_75kplus_train_071544 | 2,436 | no_license | [
{
"docstring": "打家劫舍 自底向上的动态规划",
"name": "rob",
"signature": "def rob(self, nums: List[int]) -> int"
},
{
"docstring": "打家劫舍 动态规划-空间优化",
"name": "rob_1",
"signature": "def rob_1(self, nums: List[int]) -> int"
},
{
"docstring": "打家劫舍 自顶向下的递归+备忘录",
"name": "rob_2",
"signatu... | 5 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob(self, nums: List[int]) -> int: 打家劫舍 自底向上的动态规划
- def rob_1(self, nums: List[int]) -> int: 打家劫舍 动态规划-空间优化
- def rob_2(self, nums: List[int]) -> int: 打家劫舍 自顶向下的递归+备忘录
- def ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob(self, nums: List[int]) -> int: 打家劫舍 自底向上的动态规划
- def rob_1(self, nums: List[int]) -> int: 打家劫舍 动态规划-空间优化
- def rob_2(self, nums: List[int]) -> int: 打家劫舍 自顶向下的递归+备忘录
- def ... | 3508e1ce089131b19603c3206aab4cf43023bb19 | <|skeleton|>
class Solution:
def rob(self, nums: List[int]) -> int:
"""打家劫舍 自底向上的动态规划"""
<|body_0|>
def rob_1(self, nums: List[int]) -> int:
"""打家劫舍 动态规划-空间优化"""
<|body_1|>
def rob_2(self, nums: List[int]) -> int:
"""打家劫舍 自顶向下的递归+备忘录"""
<|body_2|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rob(self, nums: List[int]) -> int:
"""打家劫舍 自底向上的动态规划"""
if not nums:
return 0
size = len(nums)
dp = [0 for _ in range(size + 1)]
dp[1] = nums[0]
for i in range(2, size + 1):
dp[i] = max(dp[i - 1], dp[i - 2] + nums[i - 1])
... | the_stack_v2_python_sparse | algorithm/leetcode/dp/28-打家劫舍系列.py | lxconfig/UbuntuCode_bak | train | 0 | |
1d0992fb5224f8c24724b01cf5b1f44fb80201ff | [
"direct_weight = self._one_strand_molec_weight(self._sequence)\nrev_comp = self.rev_comp()\nrev_comp_weight = self._one_strand_molec_weight(rev_comp.sequence)\nreturn direct_weight + rev_comp_weight",
"rev = self.sequence[::-1]\ntable = str.maketrans(self._alphabet, self._alphabet[::-1])\nrev_comp = str.translate... | <|body_start_0|>
direct_weight = self._one_strand_molec_weight(self._sequence)
rev_comp = self.rev_comp()
rev_comp_weight = self._one_strand_molec_weight(rev_comp.sequence)
return direct_weight + rev_comp_weight
<|end_body_0|>
<|body_start_1|>
rev = self.sequence[::-1]
t... | NonMutableDNASequence | [
"CC0-1.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NonMutableDNASequence:
def molecular_weight(self):
""":return: The molecular weight :rtype: float"""
<|body_0|>
def rev_comp(self):
""":return: a new sequence representing the reverse complement :rtype: :class:`Sequence` object"""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_75kplus_train_071545 | 4,156 | permissive | [
{
"docstring": ":return: The molecular weight :rtype: float",
"name": "molecular_weight",
"signature": "def molecular_weight(self)"
},
{
"docstring": ":return: a new sequence representing the reverse complement :rtype: :class:`Sequence` object",
"name": "rev_comp",
"signature": "def rev_... | 2 | stack_v2_sparse_classes_30k_train_040038 | Implement the Python class `NonMutableDNASequence` described below.
Class description:
Implement the NonMutableDNASequence class.
Method signatures and docstrings:
- def molecular_weight(self): :return: The molecular weight :rtype: float
- def rev_comp(self): :return: a new sequence representing the reverse complemen... | Implement the Python class `NonMutableDNASequence` described below.
Class description:
Implement the NonMutableDNASequence class.
Method signatures and docstrings:
- def molecular_weight(self): :return: The molecular weight :rtype: float
- def rev_comp(self): :return: a new sequence representing the reverse complemen... | 4f476d4e8b636f9e4480437f776c528666fad96a | <|skeleton|>
class NonMutableDNASequence:
def molecular_weight(self):
""":return: The molecular weight :rtype: float"""
<|body_0|>
def rev_comp(self):
""":return: a new sequence representing the reverse complement :rtype: :class:`Sequence` object"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NonMutableDNASequence:
def molecular_weight(self):
""":return: The molecular weight :rtype: float"""
direct_weight = self._one_strand_molec_weight(self._sequence)
rev_comp = self.rev_comp()
rev_comp_weight = self._one_strand_molec_weight(rev_comp.sequence)
return direct... | the_stack_v2_python_sparse | source/_static/code/multi_inheritance.py | C3BI-pasteur-fr/python-solutions-1 | train | 0 | |
c7bf7f1e3d7c5ee4f4d4e5cc86c8cbba6404c6a7 | [
"super(TmxLoader, self).__init__()\nself._map_node = disk.DiskLoader.load_xml(tmx_path)\nmap_attr = self._map_node.attrib\nif StrictVersion(map_attr['version']) < StrictVersion('1.2'):\n raise AttributeError('TMX format 1.2 or higher is supported, found {}'.format(map_attr['version']))\nif map_attr['orientation'... | <|body_start_0|>
super(TmxLoader, self).__init__()
self._map_node = disk.DiskLoader.load_xml(tmx_path)
map_attr = self._map_node.attrib
if StrictVersion(map_attr['version']) < StrictVersion('1.2'):
raise AttributeError('TMX format 1.2 or higher is supported, found {}'.format(... | Loads a TMX file from disk into graphical objects and room layers. Attributes: layers (:obj:`engine.room.RoomLayerCollection`): Collection of layers from the map. | TmxLoader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TmxLoader:
"""Loads a TMX file from disk into graphical objects and room layers. Attributes: layers (:obj:`engine.room.RoomLayerCollection`): Collection of layers from the map."""
def __init__(self, tmx_path, object_factory):
"""Loads a TMX file from disk to layers for a :obj:`engine... | stack_v2_sparse_classes_75kplus_train_071546 | 3,301 | permissive | [
{
"docstring": "Loads a TMX file from disk to layers for a :obj:`engine.room.Room`. Args: tmx_path (str): Path to the TMX file, relative to the :obj:`engine.disk.DiskLoader` resource path. object_factory (:obj:`engine.factory.GenericFactory`): An factory to convert TMX object names into Python objects.",
"n... | 3 | stack_v2_sparse_classes_30k_train_047020 | Implement the Python class `TmxLoader` described below.
Class description:
Loads a TMX file from disk into graphical objects and room layers. Attributes: layers (:obj:`engine.room.RoomLayerCollection`): Collection of layers from the map.
Method signatures and docstrings:
- def __init__(self, tmx_path, object_factory)... | Implement the Python class `TmxLoader` described below.
Class description:
Loads a TMX file from disk into graphical objects and room layers. Attributes: layers (:obj:`engine.room.RoomLayerCollection`): Collection of layers from the map.
Method signatures and docstrings:
- def __init__(self, tmx_path, object_factory)... | 7c19b8f09d298a55e4276bb959f0ac9bc8ea534a | <|skeleton|>
class TmxLoader:
"""Loads a TMX file from disk into graphical objects and room layers. Attributes: layers (:obj:`engine.room.RoomLayerCollection`): Collection of layers from the map."""
def __init__(self, tmx_path, object_factory):
"""Loads a TMX file from disk to layers for a :obj:`engine... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TmxLoader:
"""Loads a TMX file from disk into graphical objects and room layers. Attributes: layers (:obj:`engine.room.RoomLayerCollection`): Collection of layers from the map."""
def __init__(self, tmx_path, object_factory):
"""Loads a TMX file from disk to layers for a :obj:`engine.room.Room`. ... | the_stack_v2_python_sparse | engine/tiled_editor/tmx_loader.py | codehearts/pickles-fetch-quest | train | 3 |
8aae4ff91449da4dfc6b0a9d81626ae5972e7376 | [
"super(Skipgram, self).__init__()\nself.target_embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim, input_length=1, name='w2v_embedding')\nself.context_embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim, input_length=4 + 1, name='context_embedding')\nself.dots = tf.keras.layers.Dot(axes=(3,... | <|body_start_0|>
super(Skipgram, self).__init__()
self.target_embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim, input_length=1, name='w2v_embedding')
self.context_embedding = tf.keras.layers.Embedding(vocab_size, embedding_dim, input_length=4 + 1, name='context_embedding')
... | Negative Sampling Skigpram implementation. ```python w2v = Skipgram(vocab_size=4096, embedding_dim=128) ```` | Skipgram | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Skipgram:
"""Negative Sampling Skigpram implementation. ```python w2v = Skipgram(vocab_size=4096, embedding_dim=128) ````"""
def __init__(self, vocab_size, embedding_dim):
"""Skigpram class constructor. Parameters ---------- vocab_size: int. Size of the vocabulary. embedding_dim: int... | stack_v2_sparse_classes_75kplus_train_071547 | 1,307 | no_license | [
{
"docstring": "Skigpram class constructor. Parameters ---------- vocab_size: int. Size of the vocabulary. embedding_dim: int. Dimension of trained word2vec Skipgram embeddings.",
"name": "__init__",
"signature": "def __init__(self, vocab_size, embedding_dim)"
},
{
"docstring": "Model forward me... | 2 | stack_v2_sparse_classes_30k_test_000567 | Implement the Python class `Skipgram` described below.
Class description:
Negative Sampling Skigpram implementation. ```python w2v = Skipgram(vocab_size=4096, embedding_dim=128) ````
Method signatures and docstrings:
- def __init__(self, vocab_size, embedding_dim): Skigpram class constructor. Parameters ---------- vo... | Implement the Python class `Skipgram` described below.
Class description:
Negative Sampling Skigpram implementation. ```python w2v = Skipgram(vocab_size=4096, embedding_dim=128) ````
Method signatures and docstrings:
- def __init__(self, vocab_size, embedding_dim): Skigpram class constructor. Parameters ---------- vo... | cbd54f040d97520084f3e175f03a574a21806477 | <|skeleton|>
class Skipgram:
"""Negative Sampling Skigpram implementation. ```python w2v = Skipgram(vocab_size=4096, embedding_dim=128) ````"""
def __init__(self, vocab_size, embedding_dim):
"""Skigpram class constructor. Parameters ---------- vocab_size: int. Size of the vocabulary. embedding_dim: int... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Skipgram:
"""Negative Sampling Skigpram implementation. ```python w2v = Skipgram(vocab_size=4096, embedding_dim=128) ````"""
def __init__(self, vocab_size, embedding_dim):
"""Skigpram class constructor. Parameters ---------- vocab_size: int. Size of the vocabulary. embedding_dim: int. Dimension o... | the_stack_v2_python_sparse | Deliverable_4/EmbeddorSkipgram.py | henrique-britoleao/trip_advisor_scrap | train | 0 |
1c86a1d6a713c70555e11d24d09baea96ac19f71 | [
"if nuke.thisNode().Class().endswith('DA_WriteMovieSlices'):\n nuke.thisNode().knob('first').setValue(nuke.root().knob('first_frame').value())\n nuke.thisNode().knob('last').setValue(nuke.root().knob('last_frame').value())",
"slice_number = nuke.thisNode().knob('slice').value()\noutput_fpath = nuke.thisPare... | <|body_start_0|>
if nuke.thisNode().Class().endswith('DA_WriteMovieSlices'):
nuke.thisNode().knob('first').setValue(nuke.root().knob('first_frame').value())
nuke.thisNode().knob('last').setValue(nuke.root().knob('last_frame').value())
<|end_body_0|>
<|body_start_1|>
slice_number... | DA_WriteMovieSlices | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DA_WriteMovieSlices:
def onUserCreateCallback():
"""Populate defaults on creation of a DA_WriteMovieSlices node."""
<|body_0|>
def beforeRenderCallback():
"""Prepare to render from a DA_WriteMovieSlices node."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_071548 | 1,462 | permissive | [
{
"docstring": "Populate defaults on creation of a DA_WriteMovieSlices node.",
"name": "onUserCreateCallback",
"signature": "def onUserCreateCallback()"
},
{
"docstring": "Prepare to render from a DA_WriteMovieSlices node.",
"name": "beforeRenderCallback",
"signature": "def beforeRenderC... | 2 | stack_v2_sparse_classes_30k_test_002860 | Implement the Python class `DA_WriteMovieSlices` described below.
Class description:
Implement the DA_WriteMovieSlices class.
Method signatures and docstrings:
- def onUserCreateCallback(): Populate defaults on creation of a DA_WriteMovieSlices node.
- def beforeRenderCallback(): Prepare to render from a DA_WriteMovi... | Implement the Python class `DA_WriteMovieSlices` described below.
Class description:
Implement the DA_WriteMovieSlices class.
Method signatures and docstrings:
- def onUserCreateCallback(): Populate defaults on creation of a DA_WriteMovieSlices node.
- def beforeRenderCallback(): Prepare to render from a DA_WriteMovi... | 0e326207a7ba6d9d86b1327d3d90c811ab6bdf9a | <|skeleton|>
class DA_WriteMovieSlices:
def onUserCreateCallback():
"""Populate defaults on creation of a DA_WriteMovieSlices node."""
<|body_0|>
def beforeRenderCallback():
"""Prepare to render from a DA_WriteMovieSlices node."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DA_WriteMovieSlices:
def onUserCreateCallback():
"""Populate defaults on creation of a DA_WriteMovieSlices node."""
if nuke.thisNode().Class().endswith('DA_WriteMovieSlices'):
nuke.thisNode().knob('first').setValue(nuke.root().knob('first_frame').value())
nuke.thisNode(... | the_stack_v2_python_sparse | nuke/nodes/DA_WriteMovieSlices.py | UTSDataArena/examples | train | 2 | |
2acbea6a11925dbc3541f7d29f2420eafd4a7187 | [
"while num > 9:\n num = sum(map(int, list(str(num))))\nreturn num",
"if num < 9:\n return num\nleft = num % 9\nreturn left if left != 0 else 9"
] | <|body_start_0|>
while num > 9:
num = sum(map(int, list(str(num))))
return num
<|end_body_0|>
<|body_start_1|>
if num < 9:
return num
left = num % 9
return left if left != 0 else 9
<|end_body_1|>
| Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _addDigits(self, num):
""":type num: int :rtype: int"""
<|body_0|>
def addDigits(self, num):
""":type num: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
while num > 9:
num = sum(map(int, list(str(num))))
... | stack_v2_sparse_classes_75kplus_train_071549 | 1,149 | permissive | [
{
"docstring": ":type num: int :rtype: int",
"name": "_addDigits",
"signature": "def _addDigits(self, num)"
},
{
"docstring": ":type num: int :rtype: int",
"name": "addDigits",
"signature": "def addDigits(self, num)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _addDigits(self, num): :type num: int :rtype: int
- def addDigits(self, num): :type num: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _addDigits(self, num): :type num: int :rtype: int
- def addDigits(self, num): :type num: int :rtype: int
<|skeleton|>
class Solution:
def _addDigits(self, num):
... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _addDigits(self, num):
""":type num: int :rtype: int"""
<|body_0|>
def addDigits(self, num):
""":type num: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def _addDigits(self, num):
""":type num: int :rtype: int"""
while num > 9:
num = sum(map(int, list(str(num))))
return num
def addDigits(self, num):
""":type num: int :rtype: int"""
if num < 9:
return num
left = num % 9
... | the_stack_v2_python_sparse | 258.add-digits.py | windard/leeeeee | train | 0 | |
5ac2dcc82b88e970d6a90cc69f91423b1a236eb9 | [
"SCons.Warnings._enabled = []\nSCons.Warnings._warningAsException = 0\nto = TestOutput()\nSCons.Warnings._warningOut = to\nSCons.Warnings.enableWarningClass(SCons.Warnings.SConsWarning)\nSCons.Warnings.warn(SCons.Warnings.DeprecatedWarning, 'Foo')\nassert to.out == 'Foo', to.out\nSCons.Warnings.warn(SCons.Warnings.... | <|body_start_0|>
SCons.Warnings._enabled = []
SCons.Warnings._warningAsException = 0
to = TestOutput()
SCons.Warnings._warningOut = to
SCons.Warnings.enableWarningClass(SCons.Warnings.SConsWarning)
SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning, 'Foo')
asser... | WarningsTestCase | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WarningsTestCase:
def test_Warning(self) -> None:
"""Test warn function."""
<|body_0|>
def test_WarningAsExc(self) -> None:
"""Test warnings as exceptions."""
<|body_1|>
def test_Disable(self) -> None:
"""Test disabling/enabling warnings."""
... | stack_v2_sparse_classes_75kplus_train_071550 | 4,552 | permissive | [
{
"docstring": "Test warn function.",
"name": "test_Warning",
"signature": "def test_Warning(self) -> None"
},
{
"docstring": "Test warnings as exceptions.",
"name": "test_WarningAsExc",
"signature": "def test_WarningAsExc(self) -> None"
},
{
"docstring": "Test disabling/enabling... | 3 | stack_v2_sparse_classes_30k_train_043458 | Implement the Python class `WarningsTestCase` described below.
Class description:
Implement the WarningsTestCase class.
Method signatures and docstrings:
- def test_Warning(self) -> None: Test warn function.
- def test_WarningAsExc(self) -> None: Test warnings as exceptions.
- def test_Disable(self) -> None: Test dis... | Implement the Python class `WarningsTestCase` described below.
Class description:
Implement the WarningsTestCase class.
Method signatures and docstrings:
- def test_Warning(self) -> None: Test warn function.
- def test_WarningAsExc(self) -> None: Test warnings as exceptions.
- def test_Disable(self) -> None: Test dis... | b2a7d7066a2b854460a334a5fe737ea389655e6e | <|skeleton|>
class WarningsTestCase:
def test_Warning(self) -> None:
"""Test warn function."""
<|body_0|>
def test_WarningAsExc(self) -> None:
"""Test warnings as exceptions."""
<|body_1|>
def test_Disable(self) -> None:
"""Test disabling/enabling warnings."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WarningsTestCase:
def test_Warning(self) -> None:
"""Test warn function."""
SCons.Warnings._enabled = []
SCons.Warnings._warningAsException = 0
to = TestOutput()
SCons.Warnings._warningOut = to
SCons.Warnings.enableWarningClass(SCons.Warnings.SConsWarning)
... | the_stack_v2_python_sparse | SCons/WarningsTests.py | SCons/scons | train | 1,827 | |
6b6bc3a002a6cebfdc09952b5b8492bf32fb0980 | [
"self.d_maas_free_trial__c = d_maas_free_trial__c\nself.end_date = end_date\nself.id = id\nself.name = name\nself.sku__c = sku__c\nself.start_date = start_date",
"if dictionary is None:\n return None\nd_maas_free_trial__c = dictionary.get('DMaaS_Free_Trial__c')\nend_date = dictionary.get('EndDate')\nid = dicti... | <|body_start_0|>
self.d_maas_free_trial__c = d_maas_free_trial__c
self.end_date = end_date
self.id = id
self.name = name
self.sku__c = sku__c
self.start_date = start_date
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
d_maa... | Implementation of the 'AccountEntitlement' model. Specifies the account entitlement for a Salesforce account. Attributes: d_maas_free_trial__c (bool): Specifies whether DMaaS free trail is active. end_date (string): Specifies the end date for the entitlement. id (bool): Specifies the entitlement ID. name (bool): Specif... | AccountEntitlement | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountEntitlement:
"""Implementation of the 'AccountEntitlement' model. Specifies the account entitlement for a Salesforce account. Attributes: d_maas_free_trial__c (bool): Specifies whether DMaaS free trail is active. end_date (string): Specifies the end date for the entitlement. id (bool): Spe... | stack_v2_sparse_classes_75kplus_train_071551 | 2,530 | permissive | [
{
"docstring": "Constructor for the AccountEntitlement class",
"name": "__init__",
"signature": "def __init__(self, d_maas_free_trial__c=None, end_date=None, id=None, name=None, sku__c=None, start_date=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary... | 2 | stack_v2_sparse_classes_30k_train_017603 | Implement the Python class `AccountEntitlement` described below.
Class description:
Implementation of the 'AccountEntitlement' model. Specifies the account entitlement for a Salesforce account. Attributes: d_maas_free_trial__c (bool): Specifies whether DMaaS free trail is active. end_date (string): Specifies the end d... | Implement the Python class `AccountEntitlement` described below.
Class description:
Implementation of the 'AccountEntitlement' model. Specifies the account entitlement for a Salesforce account. Attributes: d_maas_free_trial__c (bool): Specifies whether DMaaS free trail is active. end_date (string): Specifies the end d... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class AccountEntitlement:
"""Implementation of the 'AccountEntitlement' model. Specifies the account entitlement for a Salesforce account. Attributes: d_maas_free_trial__c (bool): Specifies whether DMaaS free trail is active. end_date (string): Specifies the end date for the entitlement. id (bool): Spe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AccountEntitlement:
"""Implementation of the 'AccountEntitlement' model. Specifies the account entitlement for a Salesforce account. Attributes: d_maas_free_trial__c (bool): Specifies whether DMaaS free trail is active. end_date (string): Specifies the end date for the entitlement. id (bool): Specifies the en... | the_stack_v2_python_sparse | cohesity_management_sdk/models/account_entitlement.py | cohesity/management-sdk-python | train | 24 |
5ff5cba680205bc9df115fc375fdf2b8c49a8ca2 | [
"while len(lists) > 1:\n a = lists.pop() if len(lists) > 0 else None\n b = lists.pop() if len(lists) > 0 else None\n lists.insert(0, self.mergeTwoLists(a, b))\nreturn None if len(lists) < 1 else lists[0]",
"newhead = ListNode(0)\np = newhead\nwhile l1 and l2:\n if l1.val < l2.val:\n p.next = Li... | <|body_start_0|>
while len(lists) > 1:
a = lists.pop() if len(lists) > 0 else None
b = lists.pop() if len(lists) > 0 else None
lists.insert(0, self.mergeTwoLists(a, b))
return None if len(lists) < 1 else lists[0]
<|end_body_0|>
<|body_start_1|>
newhead = List... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[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|>
while le... | stack_v2_sparse_classes_75kplus_train_071552 | 2,895 | no_license | [
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
},
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, l2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_047118 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[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 mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
<|skeleton|>... | 720bb530850febc2aa67a56a7a0b3a85ab37f415 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
while len(lists) > 1:
a = lists.pop() if len(lists) > 0 else None
b = lists.pop() if len(lists) > 0 else None
lists.insert(0, self.mergeTwoLists(a, b))
return ... | the_stack_v2_python_sparse | 0023 合并K个排序链表/0023 合并K个排序链表.py | Aurora-yuan/Leetcode_Python3 | train | 4 | |
0e4170fadaf37e32e407432dd3c19403dd92e9fa | [
"if context:\n extra_flags = context.extra_flags\n for extra_flag in extra_flags:\n if extra_flag.startswith(TEST_DATA_DIR_FLAG) and test_data_dir is None:\n test_data_dir = extra_flag[len(TEST_DATA_DIR_FLAG) + 1:]\n elif extra_flag.startswith(COMPONENT_ID_FLAG) and component_id is No... | <|body_start_0|>
if context:
extra_flags = context.extra_flags
for extra_flag in extra_flags:
if extra_flag.startswith(TEST_DATA_DIR_FLAG) and test_data_dir is None:
test_data_dir = extra_flag[len(TEST_DATA_DIR_FLAG) + 1:]
elif extra_fl... | TFX base stub executor. | BaseStubExecutor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseStubExecutor:
"""TFX base stub executor."""
def __init__(self, component_id: Optional[str]=None, test_data_dir: Optional[str]=None, context: Optional[base_executor.BaseExecutor.Context]=None):
"""Initializes a BaseStubExecutor. Args: component_id: component id of a component asso... | stack_v2_sparse_classes_75kplus_train_071553 | 3,423 | permissive | [
{
"docstring": "Initializes a BaseStubExecutor. Args: component_id: component id of a component associated with the stub executor. test_data_dir: The directory to test data (pipeline_recorder.py). context: context class for all executors. component_id and test_data_dir can be encoded in the context as well. Rai... | 2 | stack_v2_sparse_classes_30k_train_036264 | Implement the Python class `BaseStubExecutor` described below.
Class description:
TFX base stub executor.
Method signatures and docstrings:
- def __init__(self, component_id: Optional[str]=None, test_data_dir: Optional[str]=None, context: Optional[base_executor.BaseExecutor.Context]=None): Initializes a BaseStubExecu... | Implement the Python class `BaseStubExecutor` described below.
Class description:
TFX base stub executor.
Method signatures and docstrings:
- def __init__(self, component_id: Optional[str]=None, test_data_dir: Optional[str]=None, context: Optional[base_executor.BaseExecutor.Context]=None): Initializes a BaseStubExecu... | 1b328504fa08a70388691e4072df76f143631325 | <|skeleton|>
class BaseStubExecutor:
"""TFX base stub executor."""
def __init__(self, component_id: Optional[str]=None, test_data_dir: Optional[str]=None, context: Optional[base_executor.BaseExecutor.Context]=None):
"""Initializes a BaseStubExecutor. Args: component_id: component id of a component asso... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BaseStubExecutor:
"""TFX base stub executor."""
def __init__(self, component_id: Optional[str]=None, test_data_dir: Optional[str]=None, context: Optional[base_executor.BaseExecutor.Context]=None):
"""Initializes a BaseStubExecutor. Args: component_id: component id of a component associated with t... | the_stack_v2_python_sparse | tfx/experimental/pipeline_testing/base_stub_executor.py | tensorflow/tfx | train | 2,116 |
c38961be6a51046ba1b3467ade6742179ee25dc2 | [
"content_parser = self.get(content_type)\nif not content_parser:\n raise UnsupportedContentType(f'No parser for `{content_type}`')\nreturn content_parser(fp)",
"if isinstance(content_types, str):\n content_types = (content_types,)\nfor content_type in content_types:\n self[content_type] = parser"
] | <|body_start_0|>
content_parser = self.get(content_type)
if not content_parser:
raise UnsupportedContentType(f'No parser for `{content_type}`')
return content_parser(fp)
<|end_body_0|>
<|body_start_1|>
if isinstance(content_types, str):
content_types = (content_t... | Registry of content type parsers. | ContentTypeParserRegistry | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContentTypeParserRegistry:
"""Registry of content type parsers."""
def parse_file(self, fp, content_type: str) -> Dict[str, Any]:
"""Parse a file using the specified content type. :raises: UnsupportedContentType"""
<|body_0|>
def register(self, content_types: Union[str, ... | stack_v2_sparse_classes_75kplus_train_071554 | 2,441 | permissive | [
{
"docstring": "Parse a file using the specified content type. :raises: UnsupportedContentType",
"name": "parse_file",
"signature": "def parse_file(self, fp, content_type: str) -> Dict[str, Any]"
},
{
"docstring": "Register a content type parser.",
"name": "register",
"signature": "def r... | 2 | stack_v2_sparse_classes_30k_val_002399 | Implement the Python class `ContentTypeParserRegistry` described below.
Class description:
Registry of content type parsers.
Method signatures and docstrings:
- def parse_file(self, fp, content_type: str) -> Dict[str, Any]: Parse a file using the specified content type. :raises: UnsupportedContentType
- def register(... | Implement the Python class `ContentTypeParserRegistry` described below.
Class description:
Registry of content type parsers.
Method signatures and docstrings:
- def parse_file(self, fp, content_type: str) -> Dict[str, Any]: Parse a file using the specified content type. :raises: UnsupportedContentType
- def register(... | 1fa2651d8b42f6e28b0c33b2b4fd287affd3a88f | <|skeleton|>
class ContentTypeParserRegistry:
"""Registry of content type parsers."""
def parse_file(self, fp, content_type: str) -> Dict[str, Any]:
"""Parse a file using the specified content type. :raises: UnsupportedContentType"""
<|body_0|>
def register(self, content_types: Union[str, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ContentTypeParserRegistry:
"""Registry of content type parsers."""
def parse_file(self, fp, content_type: str) -> Dict[str, Any]:
"""Parse a file using the specified content type. :raises: UnsupportedContentType"""
content_parser = self.get(content_type)
if not content_parser:
... | the_stack_v2_python_sparse | pyapp/conf/loaders/content_types.py | gc-ss/pyapp | train | 0 |
498d9a59d7333b2cd9d22f1493eb2b77673a7f7b | [
"local_links = set()\nwith requests.Session() as req:\n html_text = req.get(url).text\n soup = BeautifulSoup(html_text, 'html.parser')\n for link in soup.find_all('a', href=True):\n anchor_tag = link.get('href')\n if anchor_tag.startswith(('/', '#')):\n local = url + anchor_tag\n ... | <|body_start_0|>
local_links = set()
with requests.Session() as req:
html_text = req.get(url).text
soup = BeautifulSoup(html_text, 'html.parser')
for link in soup.find_all('a', href=True):
anchor_tag = link.get('href')
if anchor_tag.sta... | Crawl | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Crawl:
def get_local_links(self, url):
"""Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://google.com) Returns: set : A set of URLs belonging to same domain"""
<|body_0|>
d... | stack_v2_sparse_classes_75kplus_train_071555 | 3,486 | no_license | [
{
"docstring": "Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://google.com) Returns: set : A set of URLs belonging to same domain",
"name": "get_local_links",
"signature": "def get_local_links(self, u... | 3 | stack_v2_sparse_classes_30k_train_029035 | Implement the Python class `Crawl` described below.
Class description:
Implement the Crawl class.
Method signatures and docstrings:
- def get_local_links(self, url): Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://... | Implement the Python class `Crawl` described below.
Class description:
Implement the Crawl class.
Method signatures and docstrings:
- def get_local_links(self, url): Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://... | 1a7094d0dca08ef9f8a481565e8344043c662aa5 | <|skeleton|>
class Crawl:
def get_local_links(self, url):
"""Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://google.com) Returns: set : A set of URLs belonging to same domain"""
<|body_0|>
d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Crawl:
def get_local_links(self, url):
"""Takes in a url and returns the links belonging to the same domain(first party) present on the page Args: url (str): This is the website name(eg: http://google.com) Returns: set : A set of URLs belonging to same domain"""
local_links = set()
wit... | the_stack_v2_python_sparse | web_crawler/web_crawl.py | SakthiKishore/Python | train | 0 | |
3b94f443693a2e332147080ed39b32323363f3cd | [
"response = super(UploadedFileDetail, self).retrieve(request, *args, **kwargs)\ntemplate_data = {'upload_path': ''}\nreturn services.append_collection_template(response, template_data)",
"user_file = self.get_object()\nrequest.data['fname'] = user_file.fname.file\nreturn super(UploadedFileDetail, self).update(req... | <|body_start_0|>
response = super(UploadedFileDetail, self).retrieve(request, *args, **kwargs)
template_data = {'upload_path': ''}
return services.append_collection_template(response, template_data)
<|end_body_0|>
<|body_start_1|>
user_file = self.get_object()
request.data['fnam... | An uploaded file view. | UploadedFileDetail | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UploadedFileDetail:
"""An uploaded file view."""
def retrieve(self, request, *args, **kwargs):
"""Overriden to append a collection+json template."""
<|body_0|>
def update(self, request, *args, **kwargs):
"""Overriden to include the current fname in the request.""... | stack_v2_sparse_classes_75kplus_train_071556 | 4,631 | permissive | [
{
"docstring": "Overriden to append a collection+json template.",
"name": "retrieve",
"signature": "def retrieve(self, request, *args, **kwargs)"
},
{
"docstring": "Overriden to include the current fname in the request.",
"name": "update",
"signature": "def update(self, request, *args, *... | 4 | stack_v2_sparse_classes_30k_train_032266 | Implement the Python class `UploadedFileDetail` described below.
Class description:
An uploaded file view.
Method signatures and docstrings:
- def retrieve(self, request, *args, **kwargs): Overriden to append a collection+json template.
- def update(self, request, *args, **kwargs): Overriden to include the current fn... | Implement the Python class `UploadedFileDetail` described below.
Class description:
An uploaded file view.
Method signatures and docstrings:
- def retrieve(self, request, *args, **kwargs): Overriden to append a collection+json template.
- def update(self, request, *args, **kwargs): Overriden to include the current fn... | 20d3eedf20610af9182f6cca8db8f0b3546b5336 | <|skeleton|>
class UploadedFileDetail:
"""An uploaded file view."""
def retrieve(self, request, *args, **kwargs):
"""Overriden to append a collection+json template."""
<|body_0|>
def update(self, request, *args, **kwargs):
"""Overriden to include the current fname in the request.""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UploadedFileDetail:
"""An uploaded file view."""
def retrieve(self, request, *args, **kwargs):
"""Overriden to append a collection+json template."""
response = super(UploadedFileDetail, self).retrieve(request, *args, **kwargs)
template_data = {'upload_path': ''}
return ser... | the_stack_v2_python_sparse | chris_backend/uploadedfiles/views.py | FNNDSC/ChRIS_ultron_backEnd | train | 36 |
484ab52a9b288846d4ff055d7a46687ac2ba512d | [
"super(NormalizeImage, self).__init__()\nself.mean = mean\nself.std = std\nself.is_scale = is_scale\nself.is_channel_first = is_channel_first\nif not (isinstance(self.mean, list) and isinstance(self.std, list) and isinstance(self.is_scale, bool)):\n raise TypeError('{}: input type is invalid.'.format(self))\nfro... | <|body_start_0|>
super(NormalizeImage, self).__init__()
self.mean = mean
self.std = std
self.is_scale = is_scale
self.is_channel_first = is_channel_first
if not (isinstance(self.mean, list) and isinstance(self.std, list) and isinstance(self.is_scale, bool)):
r... | NormalizeImage | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NormalizeImage:
def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True):
"""Args: mean (list): the pixel mean std (list): the pixel variance"""
<|body_0|>
def __call__(self, sample, context=None):
"""Normalize the image. Op... | stack_v2_sparse_classes_75kplus_train_071557 | 39,037 | permissive | [
{
"docstring": "Args: mean (list): the pixel mean std (list): the pixel variance",
"name": "__init__",
"signature": "def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True)"
},
{
"docstring": "Normalize the image. Operators: 1.(optional) Scale the imag... | 2 | stack_v2_sparse_classes_30k_train_041053 | Implement the Python class `NormalizeImage` described below.
Class description:
Implement the NormalizeImage class.
Method signatures and docstrings:
- def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): Args: mean (list): the pixel mean std (list): the pixel variance
... | Implement the Python class `NormalizeImage` described below.
Class description:
Implement the NormalizeImage class.
Method signatures and docstrings:
- def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True): Args: mean (list): the pixel mean std (list): the pixel variance
... | 420527996b6da60ca401717a734329f126ed0680 | <|skeleton|>
class NormalizeImage:
def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True):
"""Args: mean (list): the pixel mean std (list): the pixel variance"""
<|body_0|>
def __call__(self, sample, context=None):
"""Normalize the image. Op... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NormalizeImage:
def __init__(self, mean=[0.485, 0.456, 0.406], std=[1, 1, 1], is_scale=True, is_channel_first=True):
"""Args: mean (list): the pixel mean std (list): the pixel variance"""
super(NormalizeImage, self).__init__()
self.mean = mean
self.std = std
self.is_sca... | the_stack_v2_python_sparse | PaddleCV/PaddleDetection/ppdet/data/transform/operators.py | chenbjin/models | train | 3 | |
35db5a3db506d34cba4fb78ae0fd15ce29c7f519 | [
"if self.app.pargs.download is None:\n download_type = []\nelse:\n download_type = self.app.pargs.download.split(',')\n download_type = list(filter(lambda x: x in all_download_type, download_type))\nreturn download_type",
"help = None\nfun = getattr(self, func_name, None)\nif fun and getattr(fun, '__ceme... | <|body_start_0|>
if self.app.pargs.download is None:
download_type = []
else:
download_type = self.app.pargs.download.split(',')
download_type = list(filter(lambda x: x in all_download_type, download_type))
return download_type
<|end_body_0|>
<|body_start_1|>... | NXSpiderBaseController | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NXSpiderBaseController:
def parse_download(self):
"""lost of spider function will parse -dw param, this will do it :return:"""
<|body_0|>
def param_check(self, params, func_name):
"""this will check param inputted and require is complete or not, and print help help w... | stack_v2_sparse_classes_75kplus_train_071558 | 1,707 | permissive | [
{
"docstring": "lost of spider function will parse -dw param, this will do it :return:",
"name": "parse_download",
"signature": "def parse_download(self)"
},
{
"docstring": "this will check param inputted and require is complete or not, and print help help will be in expose(help='...'), and got ... | 2 | stack_v2_sparse_classes_30k_train_000633 | Implement the Python class `NXSpiderBaseController` described below.
Class description:
Implement the NXSpiderBaseController class.
Method signatures and docstrings:
- def parse_download(self): lost of spider function will parse -dw param, this will do it :return:
- def param_check(self, params, func_name): this will... | Implement the Python class `NXSpiderBaseController` described below.
Class description:
Implement the NXSpiderBaseController class.
Method signatures and docstrings:
- def parse_download(self): lost of spider function will parse -dw param, this will do it :return:
- def param_check(self, params, func_name): this will... | 68e588c0612d0ab2af3a820ff88ca24d698ceeb7 | <|skeleton|>
class NXSpiderBaseController:
def parse_download(self):
"""lost of spider function will parse -dw param, this will do it :return:"""
<|body_0|>
def param_check(self, params, func_name):
"""this will check param inputted and require is complete or not, and print help help w... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NXSpiderBaseController:
def parse_download(self):
"""lost of spider function will parse -dw param, this will do it :return:"""
if self.app.pargs.download is None:
download_type = []
else:
download_type = self.app.pargs.download.split(',')
download_ty... | the_stack_v2_python_sparse | NXSpider/bin/base_ctrl.py | Z-Shuming/NXSpider | train | 0 | |
ae5ccf755dbdbae16613eef9f933821805b5279f | [
"super(RandPointCNN, self).__init__()\nself.pointcnn = PointCNN(C_in, C_out, dims, K, D, P, r_indices_func)\nself.P = P",
"pts, fts = x\nif 0 < self.P < pts.size()[1]:\n idx = np.random.choice(pts.size()[1], self.P, replace=False).tolist()\n rep_pts = pts[:, idx, :]\nelse:\n rep_pts = pts\nrep_pts_fts = ... | <|body_start_0|>
super(RandPointCNN, self).__init__()
self.pointcnn = PointCNN(C_in, C_out, dims, K, D, P, r_indices_func)
self.P = P
<|end_body_0|>
<|body_start_1|>
pts, fts = x
if 0 < self.P < pts.size()[1]:
idx = np.random.choice(pts.size()[1], self.P, replace=Fal... | PointCNN with randomly subsampled representative points. | RandPointCNN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandPointCNN:
"""PointCNN with randomly subsampled representative points."""
def __init__(self, C_in: int, C_out: int, dims: int, K: int, D: int, P: int, r_indices_func: Callable[[UFloatTensor, UFloatTensor, int, int], ULongTensor]) -> None:
"""See documentation for PointCNN."""
... | stack_v2_sparse_classes_75kplus_train_071559 | 10,492 | permissive | [
{
"docstring": "See documentation for PointCNN.",
"name": "__init__",
"signature": "def __init__(self, C_in: int, C_out: int, dims: int, K: int, D: int, P: int, r_indices_func: Callable[[UFloatTensor, UFloatTensor, int, int], ULongTensor]) -> None"
},
{
"docstring": "Given a point cloud, and its... | 2 | null | Implement the Python class `RandPointCNN` described below.
Class description:
PointCNN with randomly subsampled representative points.
Method signatures and docstrings:
- def __init__(self, C_in: int, C_out: int, dims: int, K: int, D: int, P: int, r_indices_func: Callable[[UFloatTensor, UFloatTensor, int, int], ULong... | Implement the Python class `RandPointCNN` described below.
Class description:
PointCNN with randomly subsampled representative points.
Method signatures and docstrings:
- def __init__(self, C_in: int, C_out: int, dims: int, K: int, D: int, P: int, r_indices_func: Callable[[UFloatTensor, UFloatTensor, int, int], ULong... | 1befc7cfa7cccad3eb191e373749b8e1db1254d5 | <|skeleton|>
class RandPointCNN:
"""PointCNN with randomly subsampled representative points."""
def __init__(self, C_in: int, C_out: int, dims: int, K: int, D: int, P: int, r_indices_func: Callable[[UFloatTensor, UFloatTensor, int, int], ULongTensor]) -> None:
"""See documentation for PointCNN."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandPointCNN:
"""PointCNN with randomly subsampled representative points."""
def __init__(self, C_in: int, C_out: int, dims: int, K: int, D: int, P: int, r_indices_func: Callable[[UFloatTensor, UFloatTensor, int, int], ULongTensor]) -> None:
"""See documentation for PointCNN."""
super(Ran... | the_stack_v2_python_sparse | cls_seg_mt/utils/model.py | sarthakTUM/roofn3d | train | 47 |
70dbd76013e1ca8dc45b65ac43086b630dcce7d1 | [
"skip = self.descriptor.number_hidden_layers % (hypers['skip'] - 2) + 2\nlast_c = self.descriptor.input_dim[-1]\nwith graph.as_default():\n for ind in range(self.descriptor.number_hidden_layers):\n if skip == ind:\n last_c += ref_c\n if self.descriptor.layers[ind] == 2:\n if s... | <|body_start_0|>
skip = self.descriptor.number_hidden_layers % (hypers['skip'] - 2) + 2
last_c = self.descriptor.input_dim[-1]
with graph.as_default():
for ind in range(self.descriptor.number_hidden_layers):
if skip == ind:
last_c += ref_c
... | SkipCNN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SkipCNN:
def initialization(self, graph, hypers):
"""This function creates all the necessary filters for the CNN :param graph: Graph in which the variables are created (and convolutional operations are performed) :param hypers: Example of how to implement a skip connection :return:"""
... | stack_v2_sparse_classes_75kplus_train_071560 | 6,896 | no_license | [
{
"docstring": "This function creates all the necessary filters for the CNN :param graph: Graph in which the variables are created (and convolutional operations are performed) :param hypers: Example of how to implement a skip connection :return:",
"name": "initialization",
"signature": "def initializati... | 2 | stack_v2_sparse_classes_30k_val_001375 | Implement the Python class `SkipCNN` described below.
Class description:
Implement the SkipCNN class.
Method signatures and docstrings:
- def initialization(self, graph, hypers): This function creates all the necessary filters for the CNN :param graph: Graph in which the variables are created (and convolutional opera... | Implement the Python class `SkipCNN` described below.
Class description:
Implement the SkipCNN class.
Method signatures and docstrings:
- def initialization(self, graph, hypers): This function creates all the necessary filters for the CNN :param graph: Graph in which the variables are created (and convolutional opera... | ea0abc109ce7e80f4770c94ea9d534f131f51e91 | <|skeleton|>
class SkipCNN:
def initialization(self, graph, hypers):
"""This function creates all the necessary filters for the CNN :param graph: Graph in which the variables are created (and convolutional operations are performed) :param hypers: Example of how to implement a skip connection :return:"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SkipCNN:
def initialization(self, graph, hypers):
"""This function creates all the necessary filters for the CNN :param graph: Graph in which the variables are created (and convolutional operations are performed) :param hypers: Example of how to implement a skip connection :return:"""
skip = s... | the_stack_v2_python_sparse | SingleSkip.py | unaigarciarena/EvoFlow | train | 5 | |
c4ac7364d338b7ec22760f43d2c3b6c299f80c60 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.security.ediscoveryReviewTag'.casefold():\n... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
try:
mapping_value = parse_node.get_child_node('@odata.type').get_str_value()
except AttributeError:
mapping_value = None
if mapping_value and mapping_value.casefold() ==... | Tag | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tag:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Tag:
"""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: Tag"""
<|b... | stack_v2_sparse_classes_75kplus_train_071561 | 3,413 | 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: Tag",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(parse_nod... | 3 | stack_v2_sparse_classes_30k_train_041462 | Implement the Python class `Tag` described below.
Class description:
Implement the Tag class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Tag: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse n... | Implement the Python class `Tag` described below.
Class description:
Implement the Tag class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Tag: Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse n... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Tag:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Tag:
"""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: Tag"""
<|b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Tag:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Tag:
"""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: Tag"""
if not parse_node... | the_stack_v2_python_sparse | msgraph/generated/models/security/tag.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
19bf51b9b899aeae3c676e7bc4e292e8a482a107 | [
"c = Counter()\nfor ch in string:\n c[ch] += 1\nfor key in c.keys():\n if key > 1:\n return True\nreturn False",
"if len(string) == 1:\n return True\nfor i in range(len(string)):\n temp = string[i]\n substring = string[:i] + string[i + 1:]\n for temp_ch in substring:\n if temp == t... | <|body_start_0|>
c = Counter()
for ch in string:
c[ch] += 1
for key in c.keys():
if key > 1:
return True
return False
<|end_body_0|>
<|body_start_1|>
if len(string) == 1:
return True
for i in range(len(string)):
... | isUnique | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class isUnique:
def check_hashmap(self, string):
"""Solution uses additional Counter (hashmap) datastructure"""
<|body_0|>
def check_no_ds(self, string):
"""Solution without using any additional datastructures"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_071562 | 798 | no_license | [
{
"docstring": "Solution uses additional Counter (hashmap) datastructure",
"name": "check_hashmap",
"signature": "def check_hashmap(self, string)"
},
{
"docstring": "Solution without using any additional datastructures",
"name": "check_no_ds",
"signature": "def check_no_ds(self, string)"... | 2 | stack_v2_sparse_classes_30k_train_047774 | Implement the Python class `isUnique` described below.
Class description:
Implement the isUnique class.
Method signatures and docstrings:
- def check_hashmap(self, string): Solution uses additional Counter (hashmap) datastructure
- def check_no_ds(self, string): Solution without using any additional datastructures | Implement the Python class `isUnique` described below.
Class description:
Implement the isUnique class.
Method signatures and docstrings:
- def check_hashmap(self, string): Solution uses additional Counter (hashmap) datastructure
- def check_no_ds(self, string): Solution without using any additional datastructures
<... | 09d75e3ec63308d3b8be0b07748043cde79a62a1 | <|skeleton|>
class isUnique:
def check_hashmap(self, string):
"""Solution uses additional Counter (hashmap) datastructure"""
<|body_0|>
def check_no_ds(self, string):
"""Solution without using any additional datastructures"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class isUnique:
def check_hashmap(self, string):
"""Solution uses additional Counter (hashmap) datastructure"""
c = Counter()
for ch in string:
c[ch] += 1
for key in c.keys():
if key > 1:
return True
return False
def check_no_ds(se... | the_stack_v2_python_sparse | ctc/ch01-arrays/1-is-unique.py | skailasa/practice | train | 5 | |
558e0ed24330ec9dd2646cc760bddba35c849375 | [
"super(EffectOnStatModAbility, self).__init__(name)\nself.effects = effects\nself.message = message",
"messages = []\nif not selfInflicted:\n self.callEffects(user=pkmn)\n messages.append(self.message % pkmn.getHeader())\nreturn (degree, messages)"
] | <|body_start_0|>
super(EffectOnStatModAbility, self).__init__(name)
self.effects = effects
self.message = message
<|end_body_0|>
<|body_start_1|>
messages = []
if not selfInflicted:
self.callEffects(user=pkmn)
messages.append(self.message % pkmn.getHeader... | An ability that performs an effect on stat mod | EffectOnStatModAbility | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EffectOnStatModAbility:
"""An ability that performs an effect on stat mod"""
def __init__(self, name, effects, message):
"""Builds the Ability"""
<|body_0|>
def onStatMod(self, pkmn, stat, degree, selfInflicted):
"""Perform when a stat is modded"""
<|body... | stack_v2_sparse_classes_75kplus_train_071563 | 710 | no_license | [
{
"docstring": "Builds the Ability",
"name": "__init__",
"signature": "def __init__(self, name, effects, message)"
},
{
"docstring": "Perform when a stat is modded",
"name": "onStatMod",
"signature": "def onStatMod(self, pkmn, stat, degree, selfInflicted)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019974 | Implement the Python class `EffectOnStatModAbility` described below.
Class description:
An ability that performs an effect on stat mod
Method signatures and docstrings:
- def __init__(self, name, effects, message): Builds the Ability
- def onStatMod(self, pkmn, stat, degree, selfInflicted): Perform when a stat is mod... | Implement the Python class `EffectOnStatModAbility` described below.
Class description:
An ability that performs an effect on stat mod
Method signatures and docstrings:
- def __init__(self, name, effects, message): Builds the Ability
- def onStatMod(self, pkmn, stat, degree, selfInflicted): Perform when a stat is mod... | 3931eee5fd04e18bb1738a0b27a4c6979dc4db01 | <|skeleton|>
class EffectOnStatModAbility:
"""An ability that performs an effect on stat mod"""
def __init__(self, name, effects, message):
"""Builds the Ability"""
<|body_0|>
def onStatMod(self, pkmn, stat, degree, selfInflicted):
"""Perform when a stat is modded"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EffectOnStatModAbility:
"""An ability that performs an effect on stat mod"""
def __init__(self, name, effects, message):
"""Builds the Ability"""
super(EffectOnStatModAbility, self).__init__(name)
self.effects = effects
self.message = message
def onStatMod(self, pkmn,... | the_stack_v2_python_sparse | src/Pokemon/Abilities/effecton_statmod_ability.py | sgtnourry/Pokemon-Project | train | 0 |
b95fc5d42668d2563628032b45ee6432d67ce846 | [
"if issubclass(viewset, viewsets.ViewSetMixin):\n return super(DefaultRouterWithAPIViews, self).get_default_base_name(viewset)\nreturn underscore(viewset.__name__)",
"if issubclass(viewset, viewsets.ViewSetMixin):\n return super(DefaultRouterWithAPIViews, self).get_routes(viewset)\nreturn []",
"ret = []\n... | <|body_start_0|>
if issubclass(viewset, viewsets.ViewSetMixin):
return super(DefaultRouterWithAPIViews, self).get_default_base_name(viewset)
return underscore(viewset.__name__)
<|end_body_0|>
<|body_start_1|>
if issubclass(viewset, viewsets.ViewSetMixin):
return super(De... | Extends functionality of DefaultRouter adding possibility to register simple API views, not just Viewsets. | DefaultRouterWithAPIViews | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefaultRouterWithAPIViews:
"""Extends functionality of DefaultRouter adding possibility to register simple API views, not just Viewsets."""
def get_default_base_name(self, viewset):
"""Checks if the viewset is an instance of ViewSet, otherwise assumes it's a simple view and does not ... | stack_v2_sparse_classes_75kplus_train_071564 | 2,157 | permissive | [
{
"docstring": "Checks if the viewset is an instance of ViewSet, otherwise assumes it's a simple view and does not run original `get_default_base_name` code.",
"name": "get_default_base_name",
"signature": "def get_default_base_name(self, viewset)"
},
{
"docstring": "Checks if the viewset is an ... | 3 | stack_v2_sparse_classes_30k_train_040065 | Implement the Python class `DefaultRouterWithAPIViews` described below.
Class description:
Extends functionality of DefaultRouter adding possibility to register simple API views, not just Viewsets.
Method signatures and docstrings:
- def get_default_base_name(self, viewset): Checks if the viewset is an instance of Vi... | Implement the Python class `DefaultRouterWithAPIViews` described below.
Class description:
Extends functionality of DefaultRouter adding possibility to register simple API views, not just Viewsets.
Method signatures and docstrings:
- def get_default_base_name(self, viewset): Checks if the viewset is an instance of Vi... | cbac4109b6a4082eb3eb08448e62e0b4115b5816 | <|skeleton|>
class DefaultRouterWithAPIViews:
"""Extends functionality of DefaultRouter adding possibility to register simple API views, not just Viewsets."""
def get_default_base_name(self, viewset):
"""Checks if the viewset is an instance of ViewSet, otherwise assumes it's a simple view and does not ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DefaultRouterWithAPIViews:
"""Extends functionality of DefaultRouter adding possibility to register simple API views, not just Viewsets."""
def get_default_base_name(self, viewset):
"""Checks if the viewset is an instance of ViewSet, otherwise assumes it's a simple view and does not run original ... | the_stack_v2_python_sparse | api/utils/router.py | Ogutu-Brian/questioners | train | 0 |
1ad942e14fc35fc1fdb88bc36101297ef05d77a2 | [
"hints = driver_hints.Hints()\nif project_id:\n hints.add_filter('project_id', project_id)\nelse:\n hints.add_filter('domain_id', domain_id)\nhints.add_filter('service_id', service_id)\nhints.add_filter('resource_name', resource_name)\nhints.add_filter('region_id', region_id)\nlimits = PROVIDERS.unified_limit... | <|body_start_0|>
hints = driver_hints.Hints()
if project_id:
hints.add_filter('project_id', project_id)
else:
hints.add_filter('domain_id', domain_id)
hints.add_filter('service_id', service_id)
hints.add_filter('resource_name', resource_name)
hints... | StrictTwoLevelModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StrictTwoLevelModel:
def _get_specified_limit_value(self, resource_name, service_id, region_id, project_id=None, domain_id=None):
"""Get the specified limit value. Try to give the resource limit first. If the specified limit is a domain limit and the resource limit value is None, get the... | stack_v2_sparse_classes_75kplus_train_071565 | 7,578 | permissive | [
{
"docstring": "Get the specified limit value. Try to give the resource limit first. If the specified limit is a domain limit and the resource limit value is None, get the related registered limit value instead.",
"name": "_get_specified_limit_value",
"signature": "def _get_specified_limit_value(self, r... | 3 | stack_v2_sparse_classes_30k_train_043036 | Implement the Python class `StrictTwoLevelModel` described below.
Class description:
Implement the StrictTwoLevelModel class.
Method signatures and docstrings:
- def _get_specified_limit_value(self, resource_name, service_id, region_id, project_id=None, domain_id=None): Get the specified limit value. Try to give the ... | Implement the Python class `StrictTwoLevelModel` described below.
Class description:
Implement the StrictTwoLevelModel class.
Method signatures and docstrings:
- def _get_specified_limit_value(self, resource_name, service_id, region_id, project_id=None, domain_id=None): Get the specified limit value. Try to give the ... | 03a0a8146a78682ede9eca12a5a7fdacde2035c8 | <|skeleton|>
class StrictTwoLevelModel:
def _get_specified_limit_value(self, resource_name, service_id, region_id, project_id=None, domain_id=None):
"""Get the specified limit value. Try to give the resource limit first. If the specified limit is a domain limit and the resource limit value is None, get the... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StrictTwoLevelModel:
def _get_specified_limit_value(self, resource_name, service_id, region_id, project_id=None, domain_id=None):
"""Get the specified limit value. Try to give the resource limit first. If the specified limit is a domain limit and the resource limit value is None, get the related regis... | the_stack_v2_python_sparse | keystone/limit/models/strict_two_level.py | sapcc/keystone | train | 0 | |
49e2ff6ea58dc32da1126841d7d9d9258427eb66 | [
"n = len(s)\ni = 0\nj = n - 1\nwhile i < j:\n s[i], s[j] = (s[j], s[i])\n i += 1\n j -= 1\nreturn s",
"def helper(i, j):\n if i >= j:\n return\n s[i], s[j] = (s[j], s[i])\n i += 1\n j -= 1\n helper(i, j)\nn = len(s)\ni = 0\nj = n - 1\nhelper(i, j)\nreturn s",
"if head is None:\n ... | <|body_start_0|>
n = len(s)
i = 0
j = n - 1
while i < j:
s[i], s[j] = (s[j], s[i])
i += 1
j -= 1
return s
<|end_body_0|>
<|body_start_1|>
def helper(i, j):
if i >= j:
return
s[i], s[j] = (s[j], s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def reverseString(self, s):
"""迭代的方式 :type s: List[str] :rtype: None Do not return anything, modify s in-place instead."""
<|body_0|>
def reverseString2(self, s):
"""递归的方式 :type s: List[str] :rtype: None Do not return anything, modify s in-place instead."""... | stack_v2_sparse_classes_75kplus_train_071566 | 2,868 | no_license | [
{
"docstring": "迭代的方式 :type s: List[str] :rtype: None Do not return anything, modify s in-place instead.",
"name": "reverseString",
"signature": "def reverseString(self, s)"
},
{
"docstring": "递归的方式 :type s: List[str] :rtype: None Do not return anything, modify s in-place instead.",
"name": ... | 4 | stack_v2_sparse_classes_30k_test_001261 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseString(self, s): 迭代的方式 :type s: List[str] :rtype: None Do not return anything, modify s in-place instead.
- def reverseString2(self, s): 递归的方式 :type s: List[str] :rtyp... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def reverseString(self, s): 迭代的方式 :type s: List[str] :rtype: None Do not return anything, modify s in-place instead.
- def reverseString2(self, s): 递归的方式 :type s: List[str] :rtyp... | 3b13b36f37eb364410b3b5b4f10a1808d8b1111e | <|skeleton|>
class Solution:
def reverseString(self, s):
"""迭代的方式 :type s: List[str] :rtype: None Do not return anything, modify s in-place instead."""
<|body_0|>
def reverseString2(self, s):
"""递归的方式 :type s: List[str] :rtype: None Do not return anything, modify s in-place instead."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def reverseString(self, s):
"""迭代的方式 :type s: List[str] :rtype: None Do not return anything, modify s in-place instead."""
n = len(s)
i = 0
j = n - 1
while i < j:
s[i], s[j] = (s[j], s[i])
i += 1
j -= 1
return s
... | the_stack_v2_python_sparse | practice/20191028.py | yanggelinux/algorithm-data-structure | train | 0 | |
5a78ef6fad0e42fd6fb8337c44a31cf17b5b3770 | [
"super(SelfAttention, self).__init__()\nself.attn_hops = attn_hops\nself.ws1 = nn.Linear(input_size, attn_unit, bias=False)\nself.ws2 = nn.Linear(attn_unit, attn_hops, bias=False)\nself.I = torch.eye(attn_hops, requires_grad=False)\nself.I_origin = self.I\nself.dropout = dropout",
"baz = attention.size(0)\nsize =... | <|body_start_0|>
super(SelfAttention, self).__init__()
self.attn_hops = attn_hops
self.ws1 = nn.Linear(input_size, attn_unit, bias=False)
self.ws2 = nn.Linear(attn_unit, attn_hops, bias=False)
self.I = torch.eye(attn_hops, requires_grad=False)
self.I_origin = self.I
... | reference: https://github.com/fastnlp/fastNLP/blob/master/fastNLP/modules/encoder/attention.py 这是一个基于论文 `A structured self-attentive sentence embedding <https://arxiv.org/pdf/1703.03130.pdf>`_ 的Self Attention Module. | SelfAttention | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelfAttention:
"""reference: https://github.com/fastnlp/fastNLP/blob/master/fastNLP/modules/encoder/attention.py 这是一个基于论文 `A structured self-attentive sentence embedding <https://arxiv.org/pdf/1703.03130.pdf>`_ 的Self Attention Module."""
def __init__(self, input_size: int, attn_hops: int, at... | stack_v2_sparse_classes_75kplus_train_071567 | 3,461 | permissive | [
{
"docstring": ":param int input_size: 输入tensor的hidden维度 :param int attn_unit: 输出tensor的hidden维度 :param int attn_hops:",
"name": "__init__",
"signature": "def __init__(self, input_size: int, attn_hops: int, attn_unit=300, dropout=None) -> None"
},
{
"docstring": "compute the penalization term fo... | 3 | null | Implement the Python class `SelfAttention` described below.
Class description:
reference: https://github.com/fastnlp/fastNLP/blob/master/fastNLP/modules/encoder/attention.py 这是一个基于论文 `A structured self-attentive sentence embedding <https://arxiv.org/pdf/1703.03130.pdf>`_ 的Self Attention Module.
Method signatures and ... | Implement the Python class `SelfAttention` described below.
Class description:
reference: https://github.com/fastnlp/fastNLP/blob/master/fastNLP/modules/encoder/attention.py 这是一个基于论文 `A structured self-attentive sentence embedding <https://arxiv.org/pdf/1703.03130.pdf>`_ 的Self Attention Module.
Method signatures and ... | 7bab9a97331fafac1235fb32de829ff8d572320f | <|skeleton|>
class SelfAttention:
"""reference: https://github.com/fastnlp/fastNLP/blob/master/fastNLP/modules/encoder/attention.py 这是一个基于论文 `A structured self-attentive sentence embedding <https://arxiv.org/pdf/1703.03130.pdf>`_ 的Self Attention Module."""
def __init__(self, input_size: int, attn_hops: int, at... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SelfAttention:
"""reference: https://github.com/fastnlp/fastNLP/blob/master/fastNLP/modules/encoder/attention.py 这是一个基于论文 `A structured self-attentive sentence embedding <https://arxiv.org/pdf/1703.03130.pdf>`_ 的Self Attention Module."""
def __init__(self, input_size: int, attn_hops: int, attn_unit=300, ... | the_stack_v2_python_sparse | ncc/modules/attention/self_attention.py | keiouok/naturalcc | train | 0 |
6bae48632bfbf0ce680b4fcbc7a4233f9d5a8134 | [
"for i in range(len(nums)):\n for j in range(len(nums)):\n if i == j:\n continue\n if nums[i] + nums[j] == target:\n return [i, j]",
"lookup = {}\nfor idx, num in enumerate(nums):\n if target - num in lookup:\n return [lookup[target - num], idx]\n lookup[num] = ... | <|body_start_0|>
for i in range(len(nums)):
for j in range(len(nums)):
if i == j:
continue
if nums[i] + nums[j] == target:
return [i, j]
<|end_body_0|>
<|body_start_1|>
lookup = {}
for idx, num in enumerate(nums... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
"""Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, nums, target):
"""Time: N Space: N :type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>... | stack_v2_sparse_classes_75kplus_train_071568 | 910 | permissive | [
{
"docstring": "Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum",
"signature": "def twoSum(self, nums, target)"
},
{
"docstring": "Time: N Space: N :type nums: List[int] :type target: int :rtype: List[int]",
"name": "twoSum2",
"signature": "d... | 2 | stack_v2_sparse_classes_30k_train_041652 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, nums, target): Time: N Space: N :type nums: List[i... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def twoSum(self, nums, target): Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int]
- def twoSum2(self, nums, target): Time: N Space: N :type nums: List[i... | d2ffcccede5d1543aea48f18a39cdbd3d83e3ed8 | <|skeleton|>
class Solution:
def twoSum(self, nums, target):
"""Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def twoSum2(self, nums, target):
"""Time: N Space: N :type nums: List[int] :type target: int :rtype: List[int]"""
<|body_1|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def twoSum(self, nums, target):
"""Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int]"""
for i in range(len(nums)):
for j in range(len(nums)):
if i == j:
continue
if nums[i] + nums[j] == target:
... | the_stack_v2_python_sparse | arrays/2sum.py | kandarpck/leetcode | train | 0 | |
0472713cb64d46adfcc4645c526503f760783d6a | [
"self.left = leftmotor\nself.right = rightmotor\nself.sml = leftspeedmeter\nself.smr = rightspeedmeter",
"ticks = abs(angle * math.pi / 180 * 13.6 / (6.7 * math.pi) * 20)\nif angle < 0:\n self.right.set(800)\n self.right.forward()\n self.smr.wait_ticks(ticks)\n self.right.stop()\n self.right.set(10... | <|body_start_0|>
self.left = leftmotor
self.right = rightmotor
self.sml = leftspeedmeter
self.smr = rightspeedmeter
<|end_body_0|>
<|body_start_1|>
ticks = abs(angle * math.pi / 180 * 13.6 / (6.7 * math.pi) * 20)
if angle < 0:
self.right.set(800)
... | Car | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Car:
def __init__(self, leftmotor, rightmotor, leftspeedmeter, rightspeedmeter):
"""Consolidates robot parts to one object :param leftmotor: Motor :param rightmotor: Motor :param leftspeedmeter: SpeedMeter :param rightspeedmeter: SpeedMeter"""
<|body_0|>
def turn_angle(self,... | stack_v2_sparse_classes_75kplus_train_071569 | 3,900 | permissive | [
{
"docstring": "Consolidates robot parts to one object :param leftmotor: Motor :param rightmotor: Motor :param leftspeedmeter: SpeedMeter :param rightspeedmeter: SpeedMeter",
"name": "__init__",
"signature": "def __init__(self, leftmotor, rightmotor, leftspeedmeter, rightspeedmeter)"
},
{
"docst... | 2 | null | Implement the Python class `Car` described below.
Class description:
Implement the Car class.
Method signatures and docstrings:
- def __init__(self, leftmotor, rightmotor, leftspeedmeter, rightspeedmeter): Consolidates robot parts to one object :param leftmotor: Motor :param rightmotor: Motor :param leftspeedmeter: S... | Implement the Python class `Car` described below.
Class description:
Implement the Car class.
Method signatures and docstrings:
- def __init__(self, leftmotor, rightmotor, leftspeedmeter, rightspeedmeter): Consolidates robot parts to one object :param leftmotor: Motor :param rightmotor: Motor :param leftspeedmeter: S... | 6b22527316f2bd23d781cf6dc7615bd179da1f7d | <|skeleton|>
class Car:
def __init__(self, leftmotor, rightmotor, leftspeedmeter, rightspeedmeter):
"""Consolidates robot parts to one object :param leftmotor: Motor :param rightmotor: Motor :param leftspeedmeter: SpeedMeter :param rightspeedmeter: SpeedMeter"""
<|body_0|>
def turn_angle(self,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Car:
def __init__(self, leftmotor, rightmotor, leftspeedmeter, rightspeedmeter):
"""Consolidates robot parts to one object :param leftmotor: Motor :param rightmotor: Motor :param leftspeedmeter: SpeedMeter :param rightspeedmeter: SpeedMeter"""
self.left = leftmotor
self.right = rightmo... | the_stack_v2_python_sparse | dev/deprecated/newcm.py | cloudmesh/cloudmesh-robot | train | 1 | |
4eabeae9478f8bf308079b24e40b0fd67c90eb10 | [
"user = IdentityService.get_required_session_user(request)\nmeeting_id = int(re.match('/api/meetings/([0-9]*)', request.path)[1])\nmeeting = MeetingService.get(meeting_id)\nif not PermissionsService.can_read_meetings_of_team(user.id, meeting.team.id):\n raise ForbiddenException('You are not allowed to view this ... | <|body_start_0|>
user = IdentityService.get_required_session_user(request)
meeting_id = int(re.match('/api/meetings/([0-9]*)', request.path)[1])
meeting = MeetingService.get(meeting_id)
if not PermissionsService.can_read_meetings_of_team(user.id, meeting.team.id):
raise Forbi... | All requests matching /api/meetings/... should be routed through here. | MeetingController | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeetingController:
"""All requests matching /api/meetings/... should be routed through here."""
def get_meeting_by_id(self, request):
"""Returns a given meeting and the team that held it, requires the session user be a member of said team. To check team membership (and thus permissio... | stack_v2_sparse_classes_75kplus_train_071570 | 4,336 | permissive | [
{
"docstring": "Returns a given meeting and the team that held it, requires the session user be a member of said team. To check team membership (and thus permission to read meetings), it's fine to get the team ID from the meeting itself for now, as retreiving meetings is not a particularly expensive operation."... | 5 | stack_v2_sparse_classes_30k_train_009149 | Implement the Python class `MeetingController` described below.
Class description:
All requests matching /api/meetings/... should be routed through here.
Method signatures and docstrings:
- def get_meeting_by_id(self, request): Returns a given meeting and the team that held it, requires the session user be a member o... | Implement the Python class `MeetingController` described below.
Class description:
All requests matching /api/meetings/... should be routed through here.
Method signatures and docstrings:
- def get_meeting_by_id(self, request): Returns a given meeting and the team that held it, requires the session user be a member o... | c454c26d06a0cdebabc7b9ec5fef22c9c48d6ea6 | <|skeleton|>
class MeetingController:
"""All requests matching /api/meetings/... should be routed through here."""
def get_meeting_by_id(self, request):
"""Returns a given meeting and the team that held it, requires the session user be a member of said team. To check team membership (and thus permissio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MeetingController:
"""All requests matching /api/meetings/... should be routed through here."""
def get_meeting_by_id(self, request):
"""Returns a given meeting and the team that held it, requires the session user be a member of said team. To check team membership (and thus permission to read mee... | the_stack_v2_python_sparse | mellophone/backend/controllers/meeting.py | nchlswhttkr/mellophone | train | 9 |
a9beb82e56f0b8ee7a2bf550c126d906789ddf08 | [
"self.X_train = None\nself.y_train = None\nself.priors = None\nself.posteriors = None",
"self.X_train = X_train\nself.y_train = y_train\nself.priors = myutils.get_priors(y_train)\nself.posteriors = myutils.get_posteriors(X_train, y_train, self.priors)",
"y_predicted = []\nfor test in X_test:\n probs = myutil... | <|body_start_0|>
self.X_train = None
self.y_train = None
self.priors = None
self.posteriors = None
<|end_body_0|>
<|body_start_1|>
self.X_train = X_train
self.y_train = y_train
self.priors = myutils.get_priors(y_train)
self.posteriors = myutils.get_poster... | Represents a Naive Bayes classifier. Attributes: X_train(list of list of obj): The list of training instances (samples). The shape of X_train is (n_train_samples, n_features) y_train(list of obj): The target y values (parallel to X_train). The shape of y_train is n_samples priors(YOU CHOOSE THE MOST APPROPRIATE TYPE): ... | MyNaiveBayesClassifier | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyNaiveBayesClassifier:
"""Represents a Naive Bayes classifier. Attributes: X_train(list of list of obj): The list of training instances (samples). The shape of X_train is (n_train_samples, n_features) y_train(list of obj): The target y values (parallel to X_train). The shape of y_train is n_samp... | stack_v2_sparse_classes_75kplus_train_071571 | 10,235 | no_license | [
{
"docstring": "Initializer for MyNaiveBayesClassifier.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Fits a Naive Bayes classifier to X_train and y_train. Args: X_train(list of list of obj): The list of training instances (samples). The shape of X_train is (n_train_... | 3 | stack_v2_sparse_classes_30k_train_037373 | Implement the Python class `MyNaiveBayesClassifier` described below.
Class description:
Represents a Naive Bayes classifier. Attributes: X_train(list of list of obj): The list of training instances (samples). The shape of X_train is (n_train_samples, n_features) y_train(list of obj): The target y values (parallel to X... | Implement the Python class `MyNaiveBayesClassifier` described below.
Class description:
Represents a Naive Bayes classifier. Attributes: X_train(list of list of obj): The list of training instances (samples). The shape of X_train is (n_train_samples, n_features) y_train(list of obj): The target y values (parallel to X... | e1c9bd77026dadb993361e79514a295edd5775f3 | <|skeleton|>
class MyNaiveBayesClassifier:
"""Represents a Naive Bayes classifier. Attributes: X_train(list of list of obj): The list of training instances (samples). The shape of X_train is (n_train_samples, n_features) y_train(list of obj): The target y values (parallel to X_train). The shape of y_train is n_samp... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyNaiveBayesClassifier:
"""Represents a Naive Bayes classifier. Attributes: X_train(list of list of obj): The list of training instances (samples). The shape of X_train is (n_train_samples, n_features) y_train(list of obj): The target y values (parallel to X_train). The shape of y_train is n_samples priors(YO... | the_stack_v2_python_sparse | mysklearn/myclassifiers.py | CarterKekoa/SpotifyRecommendationApp | train | 1 |
105c9ab67bbd18e09135ec34902023beb1dd1c84 | [
"userid = message.getUserid()\nconversation = cls._retrieveConversationFor(userid)\nconversation.append(message)",
"conversation = None\ntry:\n conversation = cls._conversations[userid]\nexcept KeyError:\n conversation = conversation_module.Conversation(userid)\n cls._conversations[userid] = conversation... | <|body_start_0|>
userid = message.getUserid()
conversation = cls._retrieveConversationFor(userid)
conversation.append(message)
<|end_body_0|>
<|body_start_1|>
conversation = None
try:
conversation = cls._conversations[userid]
except KeyError:
conv... | Class responsible for logging conversations between users and system | ConversationLogger | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConversationLogger:
"""Class responsible for logging conversations between users and system"""
def logUserMessage(cls, message):
"""To log a message on behalf of a user"""
<|body_0|>
def _retrieveConversationFor(cls, userid):
"""To retrieve the conversation for a... | stack_v2_sparse_classes_75kplus_train_071572 | 1,385 | no_license | [
{
"docstring": "To log a message on behalf of a user",
"name": "logUserMessage",
"signature": "def logUserMessage(cls, message)"
},
{
"docstring": "To retrieve the conversation for a given user",
"name": "_retrieveConversationFor",
"signature": "def _retrieveConversationFor(cls, userid)"... | 3 | stack_v2_sparse_classes_30k_train_013113 | Implement the Python class `ConversationLogger` described below.
Class description:
Class responsible for logging conversations between users and system
Method signatures and docstrings:
- def logUserMessage(cls, message): To log a message on behalf of a user
- def _retrieveConversationFor(cls, userid): To retrieve t... | Implement the Python class `ConversationLogger` described below.
Class description:
Class responsible for logging conversations between users and system
Method signatures and docstrings:
- def logUserMessage(cls, message): To log a message on behalf of a user
- def _retrieveConversationFor(cls, userid): To retrieve t... | 2103d6eb2f7b3310531c1f74ceb0c2143a8cda98 | <|skeleton|>
class ConversationLogger:
"""Class responsible for logging conversations between users and system"""
def logUserMessage(cls, message):
"""To log a message on behalf of a user"""
<|body_0|>
def _retrieveConversationFor(cls, userid):
"""To retrieve the conversation for a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConversationLogger:
"""Class responsible for logging conversations between users and system"""
def logUserMessage(cls, message):
"""To log a message on behalf of a user"""
userid = message.getUserid()
conversation = cls._retrieveConversationFor(userid)
conversation.append(... | the_stack_v2_python_sparse | FlaskWebProject/chatbot/messagelog/conversation_logging.py | andreallorerung/peach-chatbot-alpha | train | 1 |
7463025b5c37c6c76729f761891d1b0f75677aba | [
"for name, layer in self._tf_layers.items():\n if isinstance(layer, RasaCustomLayer):\n layer.adjust_sparse_layers_for_incremental_training(new_sparse_feature_sizes=new_sparse_feature_sizes, old_sparse_feature_sizes=old_sparse_feature_sizes, reg_lambda=reg_lambda)\n elif isinstance(layer, layers.DenseF... | <|body_start_0|>
for name, layer in self._tf_layers.items():
if isinstance(layer, RasaCustomLayer):
layer.adjust_sparse_layers_for_incremental_training(new_sparse_feature_sizes=new_sparse_feature_sizes, old_sparse_feature_sizes=old_sparse_feature_sizes, reg_lambda=reg_lambda)
... | Parent class for all classes in `rasa_layers.py`. Allows a shared implementation for adjusting `DenseForSparse` layers during incremental training. During fine-tuning, sparse feature sizes might change due to addition of new data. If this happens, we need to adjust our `DenseForSparse` layers to a new size. `Concatenat... | RasaCustomLayer | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RasaCustomLayer:
"""Parent class for all classes in `rasa_layers.py`. Allows a shared implementation for adjusting `DenseForSparse` layers during incremental training. During fine-tuning, sparse feature sizes might change due to addition of new data. If this happens, we need to adjust our `DenseF... | stack_v2_sparse_classes_75kplus_train_071573 | 49,066 | permissive | [
{
"docstring": "Finds and adjusts `DenseForSparse` layers during incremental training. Recursively looks through the layers until it finds all the `DenseForSparse` ones and adjusts those which have their sparse feature sizes increased. This function heavily relies on the name of `DenseForSparse` layer being in ... | 2 | stack_v2_sparse_classes_30k_train_030740 | Implement the Python class `RasaCustomLayer` described below.
Class description:
Parent class for all classes in `rasa_layers.py`. Allows a shared implementation for adjusting `DenseForSparse` layers during incremental training. During fine-tuning, sparse feature sizes might change due to addition of new data. If this... | Implement the Python class `RasaCustomLayer` described below.
Class description:
Parent class for all classes in `rasa_layers.py`. Allows a shared implementation for adjusting `DenseForSparse` layers during incremental training. During fine-tuning, sparse feature sizes might change due to addition of new data. If this... | 50857610bdf0c26dc61f3203a6cbb4bcf193768c | <|skeleton|>
class RasaCustomLayer:
"""Parent class for all classes in `rasa_layers.py`. Allows a shared implementation for adjusting `DenseForSparse` layers during incremental training. During fine-tuning, sparse feature sizes might change due to addition of new data. If this happens, we need to adjust our `DenseF... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RasaCustomLayer:
"""Parent class for all classes in `rasa_layers.py`. Allows a shared implementation for adjusting `DenseForSparse` layers during incremental training. During fine-tuning, sparse feature sizes might change due to addition of new data. If this happens, we need to adjust our `DenseForSparse` lay... | the_stack_v2_python_sparse | rasa/utils/tensorflow/rasa_layers.py | RasaHQ/rasa | train | 13,167 |
16750b4d1c68a6c6c374368b7eaf23d5fc30b964 | [
"if full_paths and (base_names or run_paths):\n raise InvalidPublishingDependency('A dependency was specified using full_paths={0} as well as base_names={1} and run_paths={2}'.format(full_paths, base_names, run_paths))\nself.base_names = sorted(base_names)\nif full_paths == None:\n self.full_paths = []\nelse:... | <|body_start_0|>
if full_paths and (base_names or run_paths):
raise InvalidPublishingDependency('A dependency was specified using full_paths={0} as well as base_names={1} and run_paths={2}'.format(full_paths, base_names, run_paths))
self.base_names = sorted(base_names)
if full_paths ... | This class serves as a base for all dependencies. It handles dependencies with multiple files, multiple paths, or both. File dependencies are stored either as a list of base_names and a list of run_paths, or are expanded, and stored as a list of full_paths to each file that could satisfy the dependency. | PublishingDependency | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PublishingDependency:
"""This class serves as a base for all dependencies. It handles dependencies with multiple files, multiple paths, or both. File dependencies are stored either as a list of base_names and a list of run_paths, or are expanded, and stored as a list of full_paths to each file th... | stack_v2_sparse_classes_75kplus_train_071574 | 18,231 | no_license | [
{
"docstring": "Construct a PublishingDependency object. 'action' is the action which produced this dependency. 'base_names' is the list of files of the dependency. 'run_paths' is the list of directory paths to the file of the dependency. 'pkg_vars' is the list of variants against which the package delivering t... | 5 | stack_v2_sparse_classes_30k_train_016805 | Implement the Python class `PublishingDependency` described below.
Class description:
This class serves as a base for all dependencies. It handles dependencies with multiple files, multiple paths, or both. File dependencies are stored either as a list of base_names and a list of run_paths, or are expanded, and stored ... | Implement the Python class `PublishingDependency` described below.
Class description:
This class serves as a base for all dependencies. It handles dependencies with multiple files, multiple paths, or both. File dependencies are stored either as a list of base_names and a list of run_paths, or are expanded, and stored ... | 22b1b6014ede0d4b669b61e4b2e318a56abe1b9f | <|skeleton|>
class PublishingDependency:
"""This class serves as a base for all dependencies. It handles dependencies with multiple files, multiple paths, or both. File dependencies are stored either as a list of base_names and a list of run_paths, or are expanded, and stored as a list of full_paths to each file th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PublishingDependency:
"""This class serves as a base for all dependencies. It handles dependencies with multiple files, multiple paths, or both. File dependencies are stored either as a list of base_names and a list of run_paths, or are expanded, and stored as a list of full_paths to each file that could sati... | the_stack_v2_python_sparse | src/modules/flavor/base.py | omniti-labs/pkg5 | train | 2 |
c94a2880a63fbaf3791d26f5efd26b8bc47132d7 | [
"try:\n self.ident = ident\n self.norder = self._find_order('DYDX_', ident, keylist)\n self.twodkeys = self._find_twodkeys('DYDX_', ident, keylist)\nexcept CKeyNotFound as e:\n raise TraceNotFound(ident, e.keyword)\nexcept CKeyLengthWrong as e:\n print('Field dependent keyword: ' + e.keyword)",
"de... | <|body_start_0|>
try:
self.ident = ident
self.norder = self._find_order('DYDX_', ident, keylist)
self.twodkeys = self._find_twodkeys('DYDX_', ident, keylist)
except CKeyNotFound as e:
raise TraceNotFound(ident, e.keyword)
except CKeyLengthWrong as ... | Configuration Beam object | ConfigTrace | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConfigTrace:
"""Configuration Beam object"""
def __init__(self, ident=None, keylist=None):
"""Initializer for the configuration beam object The method initializes a configuration beam object for a given beam identifier. All necessary keywords are extracted from an input keyword list.... | stack_v2_sparse_classes_75kplus_train_071575 | 48,172 | permissive | [
{
"docstring": "Initializer for the configuration beam object The method initializes a configuration beam object for a given beam identifier. All necessary keywords are extracted from an input keyword list. In case of missing keywords an exception is fired. @param ident: beam identification @type ident: Charact... | 2 | stack_v2_sparse_classes_30k_train_046810 | Implement the Python class `ConfigTrace` described below.
Class description:
Configuration Beam object
Method signatures and docstrings:
- def __init__(self, ident=None, keylist=None): Initializer for the configuration beam object The method initializes a configuration beam object for a given beam identifier. All nec... | Implement the Python class `ConfigTrace` described below.
Class description:
Configuration Beam object
Method signatures and docstrings:
- def __init__(self, ident=None, keylist=None): Initializer for the configuration beam object The method initializes a configuration beam object for a given beam identifier. All nec... | 043c173fd5497c18c2b1bfe8bcff65180bca3996 | <|skeleton|>
class ConfigTrace:
"""Configuration Beam object"""
def __init__(self, ident=None, keylist=None):
"""Initializer for the configuration beam object The method initializes a configuration beam object for a given beam identifier. All necessary keywords are extracted from an input keyword list.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConfigTrace:
"""Configuration Beam object"""
def __init__(self, ident=None, keylist=None):
"""Initializer for the configuration beam object The method initializes a configuration beam object for a given beam identifier. All necessary keywords are extracted from an input keyword list. In case of m... | the_stack_v2_python_sparse | stsdas/pkg/analysis/slitless/axe/axesrc/configfile.py | spacetelescope/stsdas_stripped | train | 1 |
34d37b27d3f5c365784d98a7cffc17f1f3b4ea9c | [
"if not matrix or not matrix[0]:\n self._summation_matrix = []\n return\nself._summation_matrix = [[0] * (len(matrix[0]) + 1) for _ in range(len(matrix) + 1)]\nfor i in range(len(matrix)):\n for j in range(len(matrix[0])):\n self._summation_matrix[i + 1][j + 1] = matrix[i][j] + self._summation_matri... | <|body_start_0|>
if not matrix or not matrix[0]:
self._summation_matrix = []
return
self._summation_matrix = [[0] * (len(matrix[0]) + 1) for _ in range(len(matrix) + 1)]
for i in range(len(matrix)):
for j in range(len(matrix[0])):
self._summati... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_75kplus_train_071576 | 1,130 | no_license | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int",
"name": "sumRegion",
"signature": "def sumRegion(self, row1, col1, row2, col2)"
... | 2 | stack_v2_sparse_classes_30k_train_043365 | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtype:... | 08500c39e14f3bf140db82a3dd2df4ca18705845 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
""":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
if not matrix or not matrix[0]:
self._summation_matrix = []
return
self._summation_matrix = [[0] * (len(matrix[0]) + 1) for _ in range(len(matrix) + 1)]
for i in range(len(matrix)... | the_stack_v2_python_sparse | 2019_round/304_range_sum_query_2D_immutable/solution.py | kfrancischen/leetcode | train | 2 | |
8dc2aa51db129732140674b9ff801965c29056b1 | [
"try:\n sql = \"\\n select t4.docuno,keeper_time,t3.travel_no,t4.productname, \\n t3.create_date waybill_time,t4.crted_date order_time\\n -- t3.waybill_no,\\n from db_dw.ods_db_trans_t_waybill t3,\\n (select t1.docuno,t2.crted_date,t1.productname,t1.crte... | <|body_start_0|>
try:
sql = "\n select t4.docuno,keeper_time,t3.travel_no,t4.productname, \n t3.create_date waybill_time,t4.crted_date order_time\n -- t3.waybill_no,\n from db_dw.ods_db_trans_t_waybill t3,\n (select t1.docuno,t2.crted_date,t... | GetCommodity | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetCommodity:
def get_commodity(start_date='2019-10-12'):
"""读数据 关于车牌、品种、发货单、发货单创建时间、运单创建时间、结算单创建时建的数据 Args: Returns: results:读到的数据 Raise:"""
<|body_0|>
def write_database(self, data):
"""写库 Args: data:要写入的数据 形如:[主品名,搭配品名,搭配次数,更新时间] Returns: Raise:"""
<|body_... | stack_v2_sparse_classes_75kplus_train_071577 | 4,345 | no_license | [
{
"docstring": "读数据 关于车牌、品种、发货单、发货单创建时间、运单创建时间、结算单创建时建的数据 Args: Returns: results:读到的数据 Raise:",
"name": "get_commodity",
"signature": "def get_commodity(start_date='2019-10-12')"
},
{
"docstring": "写库 Args: data:要写入的数据 形如:[主品名,搭配品名,搭配次数,更新时间] Returns: Raise:",
"name": "write_database",
"... | 5 | null | Implement the Python class `GetCommodity` described below.
Class description:
Implement the GetCommodity class.
Method signatures and docstrings:
- def get_commodity(start_date='2019-10-12'): 读数据 关于车牌、品种、发货单、发货单创建时间、运单创建时间、结算单创建时建的数据 Args: Returns: results:读到的数据 Raise:
- def write_database(self, data): 写库 Args: data:... | Implement the Python class `GetCommodity` described below.
Class description:
Implement the GetCommodity class.
Method signatures and docstrings:
- def get_commodity(start_date='2019-10-12'): 读数据 关于车牌、品种、发货单、发货单创建时间、运单创建时间、结算单创建时建的数据 Args: Returns: results:读到的数据 Raise:
- def write_database(self, data): 写库 Args: data:... | 5fb62820fa697ffc45931c4c19a9b0775feb1fc5 | <|skeleton|>
class GetCommodity:
def get_commodity(start_date='2019-10-12'):
"""读数据 关于车牌、品种、发货单、发货单创建时间、运单创建时间、结算单创建时建的数据 Args: Returns: results:读到的数据 Raise:"""
<|body_0|>
def write_database(self, data):
"""写库 Args: data:要写入的数据 形如:[主品名,搭配品名,搭配次数,更新时间] Returns: Raise:"""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GetCommodity:
def get_commodity(start_date='2019-10-12'):
"""读数据 关于车牌、品种、发货单、发货单创建时间、运单创建时间、结算单创建时建的数据 Args: Returns: results:读到的数据 Raise:"""
try:
sql = "\n select t4.docuno,keeper_time,t3.travel_no,t4.productname, \n t3.create_date waybill_time,t4.crted_d... | the_stack_v2_python_sparse | app/main/pipe_factory/dao/commodity_dao.py | 9Echo/gc-goods-allocation | train | 0 | |
d010a8590cd63712215591e23581976ee387f31b | [
"open_id = self.request['open_id']\nfs_user_img = self.request.app['fs_user_img']\ncollection_live_code = self.request.app['db'].live_code\nimg = self.request['body'].getall('img', [])\nlive_code_id = self.request['body'].get('live_code_id', None)\ntry:\n s_UserImg_post.validate({'live_code_id': live_code_id, 'i... | <|body_start_0|>
open_id = self.request['open_id']
fs_user_img = self.request.app['fs_user_img']
collection_live_code = self.request.app['db'].live_code
img = self.request['body'].getall('img', [])
live_code_id = self.request['body'].get('live_code_id', None)
try:
... | UserImg | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserImg:
async def post(self):
"""为活码上传图片"""
<|body_0|>
async def delete(self):
"""删除活码下的图片"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
open_id = self.request['open_id']
fs_user_img = self.request.app['fs_user_img']
collection_li... | stack_v2_sparse_classes_75kplus_train_071578 | 3,101 | no_license | [
{
"docstring": "为活码上传图片",
"name": "post",
"signature": "async def post(self)"
},
{
"docstring": "删除活码下的图片",
"name": "delete",
"signature": "async def delete(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_025875 | Implement the Python class `UserImg` described below.
Class description:
Implement the UserImg class.
Method signatures and docstrings:
- async def post(self): 为活码上传图片
- async def delete(self): 删除活码下的图片 | Implement the Python class `UserImg` described below.
Class description:
Implement the UserImg class.
Method signatures and docstrings:
- async def post(self): 为活码上传图片
- async def delete(self): 删除活码下的图片
<|skeleton|>
class UserImg:
async def post(self):
"""为活码上传图片"""
<|body_0|>
async def del... | e39606c3a5c2d1b92b506988f8144b006a3953db | <|skeleton|>
class UserImg:
async def post(self):
"""为活码上传图片"""
<|body_0|>
async def delete(self):
"""删除活码下的图片"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserImg:
async def post(self):
"""为活码上传图片"""
open_id = self.request['open_id']
fs_user_img = self.request.app['fs_user_img']
collection_live_code = self.request.app['db'].live_code
img = self.request['body'].getall('img', [])
live_code_id = self.request['body'].... | the_stack_v2_python_sparse | livecode/apis/user_img.py | eviltomato/wx_live_code_server | train | 0 | |
9d6fd3d12b2418c603df787e8523ba01956be39e | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=self.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"user = self.create_user(email, password=password)\nuser.is_admin = True\nuser.save(using=self._db)\nreturn user"
] | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email))
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
<|body_start_1|>
user = self.create_user(... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, email, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, email, password):
"""Creates and saves a superuser with the given email, date of birth a... | stack_v2_sparse_classes_75kplus_train_071579 | 2,325 | no_license | [
{
"docstring": "Creates and saves a User with the given email, date of birth and password.",
"name": "create_user",
"signature": "def create_user(self, email, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email, date of birth and password.",
"name": "create_... | 2 | stack_v2_sparse_classes_30k_train_012871 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, email, password): C... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, email, password): C... | 521bcdf8e30a9ce093df29cb7f28e8c2f2d4d979 | <|skeleton|>
class MyUserManager:
def create_user(self, email, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, email, password):
"""Creates and saves a superuser with the given email, date of birth a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyUserManager:
def create_user(self, email, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=self.normalize_email(email))
user.... | the_stack_v2_python_sparse | Family_Care/doctor/models.py | dkdinesh982/marvelapp | train | 0 | |
24a68b8268ae6e6956fe50583c45ef5fdf383153 | [
"self.debug = debug\nself.logger = AntiVirusLogger(__name__, debug=debug)\nif config_path is not None:\n self._CONFIG_PATH = config_path\nelse:\n self.logger.log('Configuration file path not found.', logtype='error')\n sys.exit(0)\nself.update = int(update)\nself.monitor_changes = int(monitor_changes)\nsel... | <|body_start_0|>
self.debug = debug
self.logger = AntiVirusLogger(__name__, debug=debug)
if config_path is not None:
self._CONFIG_PATH = config_path
else:
self.logger.log('Configuration file path not found.', logtype='error')
sys.exit(0)
self.u... | CoreEngine class. | CoreEngine | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CoreEngine:
"""CoreEngine class."""
def __init__(self, debug=False, config_path='securetea/lib/antivirus/config/config.json', vt_api_key=None, monitor_changes=1, monitor_usb=1, update=1, custom_scan=None, auto_delete=0):
"""Initialize CoreEngine. Args: debug (bool): Log on terminal o... | stack_v2_sparse_classes_75kplus_train_071580 | 7,612 | permissive | [
{
"docstring": "Initialize CoreEngine. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api_key (str): VirusTotal API Key monitor_changes (int): Monitor changes (1) or not (0) monitor_usb (int): Monitor USB (1) or not (0) Raises: None Returns: None",
"name": "__i... | 4 | stack_v2_sparse_classes_30k_train_032858 | Implement the Python class `CoreEngine` described below.
Class description:
CoreEngine class.
Method signatures and docstrings:
- def __init__(self, debug=False, config_path='securetea/lib/antivirus/config/config.json', vt_api_key=None, monitor_changes=1, monitor_usb=1, update=1, custom_scan=None, auto_delete=0): Ini... | Implement the Python class `CoreEngine` described below.
Class description:
CoreEngine class.
Method signatures and docstrings:
- def __init__(self, debug=False, config_path='securetea/lib/antivirus/config/config.json', vt_api_key=None, monitor_changes=1, monitor_usb=1, update=1, custom_scan=None, auto_delete=0): Ini... | 43dec187e5848b9ced8a6b4957b6e9028d4d43cd | <|skeleton|>
class CoreEngine:
"""CoreEngine class."""
def __init__(self, debug=False, config_path='securetea/lib/antivirus/config/config.json', vt_api_key=None, monitor_changes=1, monitor_usb=1, update=1, custom_scan=None, auto_delete=0):
"""Initialize CoreEngine. Args: debug (bool): Log on terminal o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CoreEngine:
"""CoreEngine class."""
def __init__(self, debug=False, config_path='securetea/lib/antivirus/config/config.json', vt_api_key=None, monitor_changes=1, monitor_usb=1, update=1, custom_scan=None, auto_delete=0):
"""Initialize CoreEngine. Args: debug (bool): Log on terminal or not config_... | the_stack_v2_python_sparse | securetea/lib/antivirus/core_engine.py | rejahrehim/SecureTea-Project | train | 1 |
30c74dd5818f1ab907868f2a89d8f6225c2980ae | [
"MARCImportBot.__init__(self, marc_file)\nself.stats['titles'] = 0\nself.series_statement = 'Gale virtual reference library'\nself.firm_name = 'Thomson Gale (Firm)'",
"if not marc_record.get_fields('490', '830'):\n marc_record.add_field(Field(tag='490', indicators=['1', '\\\\'], subfields=['a', self.series_sta... | <|body_start_0|>
MARCImportBot.__init__(self, marc_file)
self.stats['titles'] = 0
self.series_statement = 'Gale virtual reference library'
self.firm_name = 'Thomson Gale (Firm)'
<|end_body_0|>
<|body_start_1|>
if not marc_record.get_fields('490', '830'):
marc_record.... | Class reads Gale Virtual Reference MARC file, validates, and adds/modifies fields to a new import MARC record for importing into TIGER iii database. | GVRLBot | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GVRLBot:
"""Class reads Gale Virtual Reference MARC file, validates, and adds/modifies fields to a new import MARC record for importing into TIGER iii database."""
def __init__(self, marc_file):
"""Initializes instance. :param marc_file: file location of MARC file."""
<|body_... | stack_v2_sparse_classes_75kplus_train_071581 | 4,689 | permissive | [
{
"docstring": "Initializes instance. :param marc_file: file location of MARC file.",
"name": "__init__",
"signature": "def __init__(self, marc_file)"
},
{
"docstring": "Method iterates through specific MARC record and performs validation and updates to MARC record before writing to output MARC ... | 4 | stack_v2_sparse_classes_30k_train_008829 | Implement the Python class `GVRLBot` described below.
Class description:
Class reads Gale Virtual Reference MARC file, validates, and adds/modifies fields to a new import MARC record for importing into TIGER iii database.
Method signatures and docstrings:
- def __init__(self, marc_file): Initializes instance. :param ... | Implement the Python class `GVRLBot` described below.
Class description:
Class reads Gale Virtual Reference MARC file, validates, and adds/modifies fields to a new import MARC record for importing into TIGER iii database.
Method signatures and docstrings:
- def __init__(self, marc_file): Initializes instance. :param ... | b5c44fa008f9afb4441988803921a93ffd615c30 | <|skeleton|>
class GVRLBot:
"""Class reads Gale Virtual Reference MARC file, validates, and adds/modifies fields to a new import MARC record for importing into TIGER iii database."""
def __init__(self, marc_file):
"""Initializes instance. :param marc_file: file location of MARC file."""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GVRLBot:
"""Class reads Gale Virtual Reference MARC file, validates, and adds/modifies fields to a new import MARC record for importing into TIGER iii database."""
def __init__(self, marc_file):
"""Initializes instance. :param marc_file: file location of MARC file."""
MARCImportBot.__init... | the_stack_v2_python_sparse | aristotle/apps/marc/bots/galebots.py | jermnelson/Discover-Aristotle | train | 15 |
8594aff486c0b1c501b16e7f4cfec8be66228c51 | [
"groups = GroupService.filter(owner_id=current_user.id)\ngroups_json = GroupService.to_json_all(groups)\nreturn jsonify({'groups': groups_json})",
"data = request.get_json()\nis_correct, errors = GroupService.validate_post_data(data=data, user=current_user.id)\nif not is_correct:\n raise BadRequest(errors)\ngr... | <|body_start_0|>
groups = GroupService.filter(owner_id=current_user.id)
groups_json = GroupService.to_json_all(groups)
return jsonify({'groups': groups_json})
<|end_body_0|>
<|body_start_1|>
data = request.get_json()
is_correct, errors = GroupService.validate_post_data(data=data... | Groups API url: '/groups/' methods: get, post | GroupsAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupsAPI:
"""Groups API url: '/groups/' methods: get, post"""
def get(self):
"""Get all groups created by user"""
<|body_0|>
def post(self):
"""Create new group"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
groups = GroupService.filter(owner_... | stack_v2_sparse_classes_75kplus_train_071582 | 5,788 | no_license | [
{
"docstring": "Get all groups created by user",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Create new group",
"name": "post",
"signature": "def post(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_038096 | Implement the Python class `GroupsAPI` described below.
Class description:
Groups API url: '/groups/' methods: get, post
Method signatures and docstrings:
- def get(self): Get all groups created by user
- def post(self): Create new group | Implement the Python class `GroupsAPI` described below.
Class description:
Groups API url: '/groups/' methods: get, post
Method signatures and docstrings:
- def get(self): Get all groups created by user
- def post(self): Create new group
<|skeleton|>
class GroupsAPI:
"""Groups API url: '/groups/' methods: get, p... | 7344e4bd1cc977781b35a2ad1b38ff0d270163b7 | <|skeleton|>
class GroupsAPI:
"""Groups API url: '/groups/' methods: get, post"""
def get(self):
"""Get all groups created by user"""
<|body_0|>
def post(self):
"""Create new group"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GroupsAPI:
"""Groups API url: '/groups/' methods: get, post"""
def get(self):
"""Get all groups created by user"""
groups = GroupService.filter(owner_id=current_user.id)
groups_json = GroupService.to_json_all(groups)
return jsonify({'groups': groups_json})
def post(se... | the_stack_v2_python_sparse | src/app/routers/group.py | Lv-474-Python/ngfg | train | 0 |
2308b67facec3a4b1a03249d751bebe9a5e8a003 | [
"self.data = data\nself.next = None\nreturn",
"if self.data == value:\n return True\nelse:\n return False"
] | <|body_start_0|>
self.data = data
self.next = None
return
<|end_body_0|>
<|body_start_1|>
if self.data == value:
return True
else:
return False
<|end_body_1|>
| ListNode | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListNode:
def __init__(self, data):
"""constructor to initiate this object"""
<|body_0|>
def has_value(self, value):
"""method to compare the value with the node data"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.data = data
self.next... | stack_v2_sparse_classes_75kplus_train_071583 | 2,771 | no_license | [
{
"docstring": "constructor to initiate this object",
"name": "__init__",
"signature": "def __init__(self, data)"
},
{
"docstring": "method to compare the value with the node data",
"name": "has_value",
"signature": "def has_value(self, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009587 | Implement the Python class `ListNode` described below.
Class description:
Implement the ListNode class.
Method signatures and docstrings:
- def __init__(self, data): constructor to initiate this object
- def has_value(self, value): method to compare the value with the node data | Implement the Python class `ListNode` described below.
Class description:
Implement the ListNode class.
Method signatures and docstrings:
- def __init__(self, data): constructor to initiate this object
- def has_value(self, value): method to compare the value with the node data
<|skeleton|>
class ListNode:
def ... | d5efcfdaf7e632e1f0cb8b21c505c0c0a5325eb0 | <|skeleton|>
class ListNode:
def __init__(self, data):
"""constructor to initiate this object"""
<|body_0|>
def has_value(self, value):
"""method to compare the value with the node data"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ListNode:
def __init__(self, data):
"""constructor to initiate this object"""
self.data = data
self.next = None
return
def has_value(self, value):
"""method to compare the value with the node data"""
if self.data == value:
return True
el... | the_stack_v2_python_sparse | Linked_Lists/Linked_Lists_singly_linked_list_basic_2.py | zjxpirate/Daily-Upload-Python | train | 2 | |
33f54f850971a6e9051b931026ab1d7da71d4623 | [
"assert isinstance(model, torch.nn.Module)\nassert str(optimizer_type) in ['Adam', 'Adadelta', 'Adagrad', 'AdamW', 'SparseAdam', 'RMSprop', 'Rprop', 'LBFGS', 'ASGD', 'Adamax']\nself.model_type = model_type\nself.model = model\nself.optimizer_type = optimizer_type\nself.classify = classify\nself.optimizers = {}\nsel... | <|body_start_0|>
assert isinstance(model, torch.nn.Module)
assert str(optimizer_type) in ['Adam', 'Adadelta', 'Adagrad', 'AdamW', 'SparseAdam', 'RMSprop', 'Rprop', 'LBFGS', 'ASGD', 'Adamax']
self.model_type = model_type
self.model = model
self.optimizer_type = optimizer_type
... | Optimizer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Optimizer:
def __init__(self, model_type, model, optimizer_type, classify=False):
"""Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the model type is 'ae' or 'vae' - var optimizers is a dict with separate optimizers for encoder, decoder, ... | stack_v2_sparse_classes_75kplus_train_071584 | 5,226 | permissive | [
{
"docstring": "Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the model type is 'ae' or 'vae' - var optimizers is a dict with separate optimizers for encoder, decoder, latent and classifier. In case of 'lstm', var optimizers is an optimizer for lstm and TimeDis... | 3 | stack_v2_sparse_classes_30k_test_002652 | Implement the Python class `Optimizer` described below.
Class description:
Implement the Optimizer class.
Method signatures and docstrings:
- def __init__(self, model_type, model, optimizer_type, classify=False): Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the mode... | Implement the Python class `Optimizer` described below.
Class description:
Implement the Optimizer class.
Method signatures and docstrings:
- def __init__(self, model_type, model, optimizer_type, classify=False): Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the mode... | d4c5ff32ebdb9ee99a564e61a65dfd2443974a04 | <|skeleton|>
class Optimizer:
def __init__(self, model_type, model, optimizer_type, classify=False):
"""Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the model type is 'ae' or 'vae' - var optimizers is a dict with separate optimizers for encoder, decoder, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Optimizer:
def __init__(self, model_type, model, optimizer_type, classify=False):
"""Wrapper for setting the model optimizer and learning rate schedulers using ReduceLROnPlateau; If the model type is 'ae' or 'vae' - var optimizers is a dict with separate optimizers for encoder, decoder, latent and cla... | the_stack_v2_python_sparse | traja/models/optimizers.py | traja-team/traja | train | 73 | |
254f98416aa3173182783f958624dba2fc9d7666 | [
"create_ids = []\ncr.execute('SELECT s.employee_id as employee_id\\n From hr_employee_seniority s\\n where employee_id in %s', (tuple(emp_dict),))\nres = cr.dictfetchall()\nresult = map(lambda x: x['employee_id'], res)\ncreate_ids = list(set(emp_dict) - set(result))\nreturn create_ids",
"sen... | <|body_start_0|>
create_ids = []
cr.execute('SELECT s.employee_id as employee_id\n From hr_employee_seniority s\n where employee_id in %s', (tuple(emp_dict),))
res = cr.dictfetchall()
result = map(lambda x: x['employee_id'], res)
create_ids = list(set(emp_di... | seniority_update | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class seniority_update:
def check_create(self, cr, uid, ids, emp_dict, context=None):
"""To check create of Employee Seniority. @param emp_dict:Employee IDs @return:List of IDs"""
<|body_0|>
def check_update(self, cr, uid, ids, emp_dict, context=None):
"""To check update o... | stack_v2_sparse_classes_75kplus_train_071585 | 8,692 | no_license | [
{
"docstring": "To check create of Employee Seniority. @param emp_dict:Employee IDs @return:List of IDs",
"name": "check_create",
"signature": "def check_create(self, cr, uid, ids, emp_dict, context=None)"
},
{
"docstring": "To check update of Employee Seniority. @param emp_dict:Employee IDs @re... | 3 | stack_v2_sparse_classes_30k_train_007128 | Implement the Python class `seniority_update` described below.
Class description:
Implement the seniority_update class.
Method signatures and docstrings:
- def check_create(self, cr, uid, ids, emp_dict, context=None): To check create of Employee Seniority. @param emp_dict:Employee IDs @return:List of IDs
- def check_... | Implement the Python class `seniority_update` described below.
Class description:
Implement the seniority_update class.
Method signatures and docstrings:
- def check_create(self, cr, uid, ids, emp_dict, context=None): To check create of Employee Seniority. @param emp_dict:Employee IDs @return:List of IDs
- def check_... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class seniority_update:
def check_create(self, cr, uid, ids, emp_dict, context=None):
"""To check create of Employee Seniority. @param emp_dict:Employee IDs @return:List of IDs"""
<|body_0|>
def check_update(self, cr, uid, ids, emp_dict, context=None):
"""To check update o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class seniority_update:
def check_create(self, cr, uid, ids, emp_dict, context=None):
"""To check create of Employee Seniority. @param emp_dict:Employee IDs @return:List of IDs"""
create_ids = []
cr.execute('SELECT s.employee_id as employee_id\n From hr_employee_seniority s\n ... | the_stack_v2_python_sparse | v_7/NISS/common_shamil_v3/hr_custom_military/hr_employee_seniority.py | musabahmed/baba | train | 0 | |
5a90b24ae3ab0b5af9400c8e0debd9052d4079c1 | [
"self.update(**params)\nif np.min(np.diff(10 ** self.params['agebins'])) < 1000000.0:\n raise ValueError\nmtot = self.params['mass'].sum()\ntime, sfr, tmax = self.convert_sfh(self.params['agebins'], self.params['mass'])\nself.ssp.params['sfh'] = 3\nself.ssp.set_tabular_sfh(time, sfr)\nwave, spec = self.ssp.get_s... | <|body_start_0|>
self.update(**params)
if np.min(np.diff(10 ** self.params['agebins'])) < 1000000.0:
raise ValueError
mtot = self.params['mass'].sum()
time, sfr, tmax = self.convert_sfh(self.params['agebins'], self.params['mass'])
self.ssp.params['sfh'] = 3
se... | Subclass of :py:class:`SSPBasis` that implements a "nonparameteric" (i.e. binned) SFH. This is accomplished by generating a tabular SFH with the proper form to be passed to FSPS. The key parameters for this SFH are: * ``agebins`` - array of shape ``(nbin, 2)`` giving the younger and older (in lookback time) edges of ea... | FastStepBasis | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FastStepBasis:
"""Subclass of :py:class:`SSPBasis` that implements a "nonparameteric" (i.e. binned) SFH. This is accomplished by generating a tabular SFH with the proper form to be passed to FSPS. The key parameters for this SFH are: * ``agebins`` - array of shape ``(nbin, 2)`` giving the younger... | stack_v2_sparse_classes_75kplus_train_071586 | 15,991 | permissive | [
{
"docstring": "Construct the tabular SFH and feed it to the ``ssp``.",
"name": "get_galaxy_spectrum",
"signature": "def get_galaxy_spectrum(self, **params)"
},
{
"docstring": "Given arrays of agebins and formed masses with each bin, calculate a tabular SFH. The resulting time vector has time po... | 2 | stack_v2_sparse_classes_30k_train_023770 | Implement the Python class `FastStepBasis` described below.
Class description:
Subclass of :py:class:`SSPBasis` that implements a "nonparameteric" (i.e. binned) SFH. This is accomplished by generating a tabular SFH with the proper form to be passed to FSPS. The key parameters for this SFH are: * ``agebins`` - array of... | Implement the Python class `FastStepBasis` described below.
Class description:
Subclass of :py:class:`SSPBasis` that implements a "nonparameteric" (i.e. binned) SFH. This is accomplished by generating a tabular SFH with the proper form to be passed to FSPS. The key parameters for this SFH are: * ``agebins`` - array of... | 5c0255ae828c2b501e66747dcae963fec5e81a8d | <|skeleton|>
class FastStepBasis:
"""Subclass of :py:class:`SSPBasis` that implements a "nonparameteric" (i.e. binned) SFH. This is accomplished by generating a tabular SFH with the proper form to be passed to FSPS. The key parameters for this SFH are: * ``agebins`` - array of shape ``(nbin, 2)`` giving the younger... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FastStepBasis:
"""Subclass of :py:class:`SSPBasis` that implements a "nonparameteric" (i.e. binned) SFH. This is accomplished by generating a tabular SFH with the proper form to be passed to FSPS. The key parameters for this SFH are: * ``agebins`` - array of shape ``(nbin, 2)`` giving the younger and older (i... | the_stack_v2_python_sparse | prospect/sources/ssp_basis.py | bd-j/prospector | train | 139 |
b16f980cb2face72ae520a466091e66a270bf997 | [
"if 'mirror_hints' not in self._args:\n return\nfunc = lambda attr: attr and any((hint in attr for hint in self._args['mirror_hints']))\nif soup.find_all(href=func) or soup.find_all(src=func):\n raise ParserExclusionError()",
"try:\n return bs4.BeautifulSoup(text, 'lxml')\nexcept ValueError:\n return ... | <|body_start_0|>
if 'mirror_hints' not in self._args:
return
func = lambda attr: attr and any((hint in attr for hint in self._args['mirror_hints']))
if soup.find_all(href=func) or soup.find_all(src=func):
raise ParserExclusionError()
<|end_body_0|>
<|body_start_1|>
... | A parser that can extract the text from an HTML document. | _HTMLParser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _HTMLParser:
"""A parser that can extract the text from an HTML document."""
def _fail_if_mirror(self, soup):
"""Look for obvious signs that the given soup is a wiki mirror. If so, raise ParserExclusionError, which is caught in the workers and causes this source to excluded."""
... | stack_v2_sparse_classes_75kplus_train_071587 | 14,045 | permissive | [
{
"docstring": "Look for obvious signs that the given soup is a wiki mirror. If so, raise ParserExclusionError, which is caught in the workers and causes this source to excluded.",
"name": "_fail_if_mirror",
"signature": "def _fail_if_mirror(self, soup)"
},
{
"docstring": "Parse some text using ... | 6 | stack_v2_sparse_classes_30k_train_015023 | Implement the Python class `_HTMLParser` described below.
Class description:
A parser that can extract the text from an HTML document.
Method signatures and docstrings:
- def _fail_if_mirror(self, soup): Look for obvious signs that the given soup is a wiki mirror. If so, raise ParserExclusionError, which is caught in... | Implement the Python class `_HTMLParser` described below.
Class description:
A parser that can extract the text from an HTML document.
Method signatures and docstrings:
- def _fail_if_mirror(self, soup): Look for obvious signs that the given soup is a wiki mirror. If so, raise ParserExclusionError, which is caught in... | 9ee44932f6e9afeb0e5eb4bd01f3bc88fdb00790 | <|skeleton|>
class _HTMLParser:
"""A parser that can extract the text from an HTML document."""
def _fail_if_mirror(self, soup):
"""Look for obvious signs that the given soup is a wiki mirror. If so, raise ParserExclusionError, which is caught in the workers and causes this source to excluded."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _HTMLParser:
"""A parser that can extract the text from an HTML document."""
def _fail_if_mirror(self, soup):
"""Look for obvious signs that the given soup is a wiki mirror. If so, raise ParserExclusionError, which is caught in the workers and causes this source to excluded."""
if 'mirror... | the_stack_v2_python_sparse | earwigbot/wiki/copyvios/parsers.py | earwig/earwigbot | train | 23 |
b5fe0cb9b08fb979ea2dd93efe35179c4213de8f | [
"from_addr = optional_base64_base16_to_bytes(args.get('from', args.get('from_addr')), 'from')\npayment_code = PaymentCode.from_args(args)\nsession_code = SessionCode.from_args(args)\nttl_millis = args.get('ttl_millis')\ndependencies_hex = args.get('dependencies') or []\ndependencies = [bytes.fromhex(d) for d in dep... | <|body_start_0|>
from_addr = optional_base64_base16_to_bytes(args.get('from', args.get('from_addr')), 'from')
payment_code = PaymentCode.from_args(args)
session_code = SessionCode.from_args(args)
ttl_millis = args.get('ttl_millis')
dependencies_hex = args.get('dependencies') or [... | DeployData | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeployData:
def from_args(args: Dict) -> 'DeployData':
"""Build Deploy data class from command line arguments, this includes testing for combinations of args that are allowed or required."""
<|body_0|>
def make_protobuf(self) -> consensus.Deploy:
"""Create a protobuf... | stack_v2_sparse_classes_75kplus_train_071588 | 4,350 | permissive | [
{
"docstring": "Build Deploy data class from command line arguments, this includes testing for combinations of args that are allowed or required.",
"name": "from_args",
"signature": "def from_args(args: Dict) -> 'DeployData'"
},
{
"docstring": "Create a protobuf deploy object. See deploy for des... | 2 | stack_v2_sparse_classes_30k_train_025470 | Implement the Python class `DeployData` described below.
Class description:
Implement the DeployData class.
Method signatures and docstrings:
- def from_args(args: Dict) -> 'DeployData': Build Deploy data class from command line arguments, this includes testing for combinations of args that are allowed or required.
-... | Implement the Python class `DeployData` described below.
Class description:
Implement the DeployData class.
Method signatures and docstrings:
- def from_args(args: Dict) -> 'DeployData': Build Deploy data class from command line arguments, this includes testing for combinations of args that are allowed or required.
-... | 12955d2b88bc439f94a1cc33a063fda0c20ef8ab | <|skeleton|>
class DeployData:
def from_args(args: Dict) -> 'DeployData':
"""Build Deploy data class from command line arguments, this includes testing for combinations of args that are allowed or required."""
<|body_0|>
def make_protobuf(self) -> consensus.Deploy:
"""Create a protobuf... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DeployData:
def from_args(args: Dict) -> 'DeployData':
"""Build Deploy data class from command line arguments, this includes testing for combinations of args that are allowed or required."""
from_addr = optional_base64_base16_to_bytes(args.get('from', args.get('from_addr')), 'from')
pa... | the_stack_v2_python_sparse | casperlabs_client/deploy.py | CasperLabs/client-py | train | 2 | |
da2071dd619a7eb41a093b62b64d613569284d79 | [
"self.user = SocialUser.objects.create(firstName='nauman', lastName='sharif', email='testuser@gmail.com', moderation=False, anonymity=False, is_admin=False)\nself.user.set_password('123')\nself.user.save()\nself.resource_type = ResourceType.objects.create(resource_type='funding')\nself.resource = Resource.objects.c... | <|body_start_0|>
self.user = SocialUser.objects.create(firstName='nauman', lastName='sharif', email='testuser@gmail.com', moderation=False, anonymity=False, is_admin=False)
self.user.set_password('123')
self.user.save()
self.resource_type = ResourceType.objects.create(resource_type='fund... | This class contains tests for updating a project | TestUpdateProjectView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestUpdateProjectView:
"""This class contains tests for updating a project"""
def setUp(self):
"""This sets up request to update project :return:"""
<|body_0|>
def test_update_project_view(self):
"""This function makes request to update project :return:"""
... | stack_v2_sparse_classes_75kplus_train_071589 | 33,021 | no_license | [
{
"docstring": "This sets up request to update project :return:",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "This function makes request to update project :return:",
"name": "test_update_project_view",
"signature": "def test_update_project_view(self)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_033127 | Implement the Python class `TestUpdateProjectView` described below.
Class description:
This class contains tests for updating a project
Method signatures and docstrings:
- def setUp(self): This sets up request to update project :return:
- def test_update_project_view(self): This function makes request to update proje... | Implement the Python class `TestUpdateProjectView` described below.
Class description:
This class contains tests for updating a project
Method signatures and docstrings:
- def setUp(self): This sets up request to update project :return:
- def test_update_project_view(self): This function makes request to update proje... | 4da7f1d7f02695504887287db28f808c637a2286 | <|skeleton|>
class TestUpdateProjectView:
"""This class contains tests for updating a project"""
def setUp(self):
"""This sets up request to update project :return:"""
<|body_0|>
def test_update_project_view(self):
"""This function makes request to update project :return:"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestUpdateProjectView:
"""This class contains tests for updating a project"""
def setUp(self):
"""This sets up request to update project :return:"""
self.user = SocialUser.objects.create(firstName='nauman', lastName='sharif', email='testuser@gmail.com', moderation=False, anonymity=False, ... | the_stack_v2_python_sparse | SocialImpactNetwork/tests.py | nauman-pucit/problem_solver | train | 0 |
d3ebd052df120a4f43fd5c4cbf7101889991661c | [
"proxy = mgmt_session.proxy(RwsdnalYang)\nxpath = \"/rw-project:project[rw-project:name='default']/sdn-accounts/sdn-account-list[name=%s]\" % quoted_key(sdn_account_name)\nproxy.delete_config(xpath)",
"proxy = mgmt_session.proxy(RwSdnYang)\nxpath = '/rw-project:project[rw-project:name=\"default\"]/sdn/account[nam... | <|body_start_0|>
proxy = mgmt_session.proxy(RwsdnalYang)
xpath = "/rw-project:project[rw-project:name='default']/sdn-accounts/sdn-account-list[name=%s]" % quoted_key(sdn_account_name)
proxy.delete_config(xpath)
<|end_body_0|>
<|body_start_1|>
proxy = mgmt_session.proxy(RwSdnYang)
... | TestSdnTeardown | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSdnTeardown:
def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name):
"""Unconfigure sdn account"""
<|body_0|>
def test_delete_openstack_sdn_account(self, mgmt_session, openstack_sdn_account_name):
"""Unconfigure sdn account"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus_train_071590 | 8,232 | no_license | [
{
"docstring": "Unconfigure sdn account",
"name": "test_delete_odl_sdn_account",
"signature": "def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name)"
},
{
"docstring": "Unconfigure sdn account",
"name": "test_delete_openstack_sdn_account",
"signature": "def test_delete_op... | 2 | stack_v2_sparse_classes_30k_train_028939 | Implement the Python class `TestSdnTeardown` described below.
Class description:
Implement the TestSdnTeardown class.
Method signatures and docstrings:
- def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name): Unconfigure sdn account
- def test_delete_openstack_sdn_account(self, mgmt_session, openstack... | Implement the Python class `TestSdnTeardown` described below.
Class description:
Implement the TestSdnTeardown class.
Method signatures and docstrings:
- def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name): Unconfigure sdn account
- def test_delete_openstack_sdn_account(self, mgmt_session, openstack... | cdd0abe80a76d533d08a51c7970d8ded06624b7d | <|skeleton|>
class TestSdnTeardown:
def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name):
"""Unconfigure sdn account"""
<|body_0|>
def test_delete_openstack_sdn_account(self, mgmt_session, openstack_sdn_account_name):
"""Unconfigure sdn account"""
<|body_1|>
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestSdnTeardown:
def test_delete_odl_sdn_account(self, mgmt_session, sdn_account_name):
"""Unconfigure sdn account"""
proxy = mgmt_session.proxy(RwsdnalYang)
xpath = "/rw-project:project[rw-project:name='default']/sdn-accounts/sdn-account-list[name=%s]" % quoted_key(sdn_account_name)
... | the_stack_v2_python_sparse | osm/SO/rwlaunchpad/ra/pytest/test_launchpad.py | dennis-me/Pishahang | train | 2 | |
66c3d23da319794d095fe21ff8b7637225e23be0 | [
"super().__init__()\nself.input_channels = input_channels\nself.base_model = base_model\nself.srm_conv = setup_srm_layer(input_channels)",
"noise = self.srm_conv(img)\nimg = torch.cat([img, noise], dim=1)\nreturn self.base_model(img)"
] | <|body_start_0|>
super().__init__()
self.input_channels = input_channels
self.base_model = base_model
self.srm_conv = setup_srm_layer(input_channels)
<|end_body_0|>
<|body_start_1|>
noise = self.srm_conv(img)
img = torch.cat([img, noise], dim=1)
return self.base_... | Wraps a base model for Steganalysis Rich Model (SRM)-based noise analysis. | SRMWrapper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SRMWrapper:
"""Wraps a base model for Steganalysis Rich Model (SRM)-based noise analysis."""
def __init__(self, base_model: torch.nn.Module, input_channels: int=3):
"""Creates a SRM analysis layer and prepares internal params."""
<|body_0|>
def forward(self, img: torch.T... | stack_v2_sparse_classes_75kplus_train_071591 | 2,687 | permissive | [
{
"docstring": "Creates a SRM analysis layer and prepares internal params.",
"name": "__init__",
"signature": "def __init__(self, base_model: torch.nn.Module, input_channels: int=3)"
},
{
"docstring": "Adds a stack of noise channels to the input tensor, and processes it using the base model.",
... | 2 | stack_v2_sparse_classes_30k_train_024116 | Implement the Python class `SRMWrapper` described below.
Class description:
Wraps a base model for Steganalysis Rich Model (SRM)-based noise analysis.
Method signatures and docstrings:
- def __init__(self, base_model: torch.nn.Module, input_channels: int=3): Creates a SRM analysis layer and prepares internal params.
... | Implement the Python class `SRMWrapper` described below.
Class description:
Wraps a base model for Steganalysis Rich Model (SRM)-based noise analysis.
Method signatures and docstrings:
- def __init__(self, base_model: torch.nn.Module, input_channels: int=3): Creates a SRM analysis layer and prepares internal params.
... | d91c50d4e3755c4779ef882967519aaa9d863ff4 | <|skeleton|>
class SRMWrapper:
"""Wraps a base model for Steganalysis Rich Model (SRM)-based noise analysis."""
def __init__(self, base_model: torch.nn.Module, input_channels: int=3):
"""Creates a SRM analysis layer and prepares internal params."""
<|body_0|>
def forward(self, img: torch.T... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SRMWrapper:
"""Wraps a base model for Steganalysis Rich Model (SRM)-based noise analysis."""
def __init__(self, base_model: torch.nn.Module, input_channels: int=3):
"""Creates a SRM analysis layer and prepares internal params."""
super().__init__()
self.input_channels = input_chan... | the_stack_v2_python_sparse | thelper/nn/srm.py | plstcharles/thelper | train | 19 |
e2bfe39e9d5ef6b5d0ceb0f37c0f990f80981e34 | [
"if not strs or not strs[0]:\n return ''\nLCP = None\nfor s in strs:\n if LCP == None:\n LCP = s\n else:\n for i, e in enumerate(LCP):\n if i >= len(s) or e != s[i]:\n LCP = s[:i]\n break\nreturn LCP",
"if not strs or not strs[0]:\n return ''\nif ... | <|body_start_0|>
if not strs or not strs[0]:
return ''
LCP = None
for s in strs:
if LCP == None:
LCP = s
else:
for i, e in enumerate(LCP):
if i >= len(s) or e != s[i]:
LCP = s[:i]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestCommonPrefix(self, strs):
""":type strs: List[str] :rtype: str"""
<|body_0|>
def longestCommonPrefix_I(self, strs):
""":type strs: List[str] :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not strs or not strs[0]:... | stack_v2_sparse_classes_75kplus_train_071592 | 1,225 | no_license | [
{
"docstring": ":type strs: List[str] :rtype: str",
"name": "longestCommonPrefix",
"signature": "def longestCommonPrefix(self, strs)"
},
{
"docstring": ":type strs: List[str] :rtype: str",
"name": "longestCommonPrefix_I",
"signature": "def longestCommonPrefix_I(self, strs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021096 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str
- def longestCommonPrefix_I(self, strs): :type strs: List[str] :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestCommonPrefix(self, strs): :type strs: List[str] :rtype: str
- def longestCommonPrefix_I(self, strs): :type strs: List[str] :rtype: str
<|skeleton|>
class Solution:
... | 1a3c1f4d6e9d3444039f087763b93241f4ba7892 | <|skeleton|>
class Solution:
def longestCommonPrefix(self, strs):
""":type strs: List[str] :rtype: str"""
<|body_0|>
def longestCommonPrefix_I(self, strs):
""":type strs: List[str] :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def longestCommonPrefix(self, strs):
""":type strs: List[str] :rtype: str"""
if not strs or not strs[0]:
return ''
LCP = None
for s in strs:
if LCP == None:
LCP = s
else:
for i, e in enumerate(LCP):
... | the_stack_v2_python_sparse | Algorithm/014_Longest_Common_Prefix.py | Gi1ia/TechNoteBook | train | 7 | |
d25059110956a59cf2b5760b5b38a38df93f4aa0 | [
"Module.__init__(self)\nself.acq_func = acq_function\nmodel = self.acq_func.model\nif hasattr(acq_function, 'X_pending'):\n if acq_function.X_pending is not None:\n raise UnsupportedError('Proximal acquisition function requires `X_pending` to be None.')\n self.X_pending = acq_function.X_pending\nself.r... | <|body_start_0|>
Module.__init__(self)
self.acq_func = acq_function
model = self.acq_func.model
if hasattr(acq_function, 'X_pending'):
if acq_function.X_pending is not None:
raise UnsupportedError('Proximal acquisition function requires `X_pending` to be None.... | A wrapper around AcquisitionFunctions to add proximal weighting of the acquisition function. The acquisition function is weighted via a squared exponential centered at the last training point, with varying lengthscales corresponding to `proximal_weights`. Can only be used with acquisition functions based on single batc... | ProximalAcquisitionFunction | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProximalAcquisitionFunction:
"""A wrapper around AcquisitionFunctions to add proximal weighting of the acquisition function. The acquisition function is weighted via a squared exponential centered at the last training point, with varying lengthscales corresponding to `proximal_weights`. Can only ... | stack_v2_sparse_classes_75kplus_train_071593 | 8,229 | permissive | [
{
"docstring": "Derived Acquisition Function weighted by proximity to recently observed point. Args: acq_function: The base acquisition function, operating on input tensors of feature dimension `d`. proximal_weights: A `d` dim tensor used to bias locality along each axis. transformed_weighting: If True, the pro... | 2 | stack_v2_sparse_classes_30k_train_018671 | Implement the Python class `ProximalAcquisitionFunction` described below.
Class description:
A wrapper around AcquisitionFunctions to add proximal weighting of the acquisition function. The acquisition function is weighted via a squared exponential centered at the last training point, with varying lengthscales corresp... | Implement the Python class `ProximalAcquisitionFunction` described below.
Class description:
A wrapper around AcquisitionFunctions to add proximal weighting of the acquisition function. The acquisition function is weighted via a squared exponential centered at the last training point, with varying lengthscales corresp... | 4cc5ed59b2e8a9c780f786830c548e05cc74d53c | <|skeleton|>
class ProximalAcquisitionFunction:
"""A wrapper around AcquisitionFunctions to add proximal weighting of the acquisition function. The acquisition function is weighted via a squared exponential centered at the last training point, with varying lengthscales corresponding to `proximal_weights`. Can only ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProximalAcquisitionFunction:
"""A wrapper around AcquisitionFunctions to add proximal weighting of the acquisition function. The acquisition function is weighted via a squared exponential centered at the last training point, with varying lengthscales corresponding to `proximal_weights`. Can only be used with ... | the_stack_v2_python_sparse | botorch/acquisition/proximal.py | pytorch/botorch | train | 2,891 |
7025455e5a9f06a53ea6cc5e5007d55f86a6f0b4 | [
"Thread.__init__(self, name='Producer')\nself.accessCount = accessCount\nself.cell = cell\nself.sleepMax = sleepMax",
"print('%s starting up' % self.getName())\nfor count in range(self.accessCount):\n time.sleep(random.randint(1, self.sleepMax))\n self.cell.setData(count + 1)\nprint('%s is done producing\\n... | <|body_start_0|>
Thread.__init__(self, name='Producer')
self.accessCount = accessCount
self.cell = cell
self.sleepMax = sleepMax
<|end_body_0|>
<|body_start_1|>
print('%s starting up' % self.getName())
for count in range(self.accessCount):
time.sleep(random.r... | A producer of data in a shared cell. | Producer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Producer:
"""A producer of data in a shared cell."""
def __init__(self, cell, accessCount, sleepMax):
"""Create a producer with the given shared cell, number of accesses, and maximum sleep interval."""
<|body_0|>
def run(self):
"""Announce start-up, sleep and wri... | stack_v2_sparse_classes_75kplus_train_071594 | 5,244 | no_license | [
{
"docstring": "Create a producer with the given shared cell, number of accesses, and maximum sleep interval.",
"name": "__init__",
"signature": "def __init__(self, cell, accessCount, sleepMax)"
},
{
"docstring": "Announce start-up, sleep and write to shared cell the given number of times, and a... | 2 | null | Implement the Python class `Producer` described below.
Class description:
A producer of data in a shared cell.
Method signatures and docstrings:
- def __init__(self, cell, accessCount, sleepMax): Create a producer with the given shared cell, number of accesses, and maximum sleep interval.
- def run(self): Announce st... | Implement the Python class `Producer` described below.
Class description:
A producer of data in a shared cell.
Method signatures and docstrings:
- def __init__(self, cell, accessCount, sleepMax): Create a producer with the given shared cell, number of accesses, and maximum sleep interval.
- def run(self): Announce st... | 30375264cf0103e3455fdf92c35a2c5c15b5d7ef | <|skeleton|>
class Producer:
"""A producer of data in a shared cell."""
def __init__(self, cell, accessCount, sleepMax):
"""Create a producer with the given shared cell, number of accesses, and maximum sleep interval."""
<|body_0|>
def run(self):
"""Announce start-up, sleep and wri... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Producer:
"""A producer of data in a shared cell."""
def __init__(self, cell, accessCount, sleepMax):
"""Create a producer with the given shared cell, number of accesses, and maximum sleep interval."""
Thread.__init__(self, name='Producer')
self.accessCount = accessCount
s... | the_stack_v2_python_sparse | Ch10 exercises/producer-consumer.py | davelpat/Fundamentals_of_Python | train | 1 |
bdd311797f7708a40ec246fa8eda22177c619d1a | [
"if not head or not head.next or k == 0:\n return head\ntail = head\ncount = 1\nwhile tail.next:\n count += 1\n tail = tail.next\nif count == k:\n return head\nnode = head\nfor _ in range(count - k % count - 1):\n node = node.next\ntail.next = head\nhead = node.next\nnode.next = None\nreturn head",
... | <|body_start_0|>
if not head or not head.next or k == 0:
return head
tail = head
count = 1
while tail.next:
count += 1
tail = tail.next
if count == k:
return head
node = head
for _ in range(count - k % count - 1):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rotateRight(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_0|>
def rotateRight_cycle(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_1|>
def rotateRight_v2(self, head, k):
... | stack_v2_sparse_classes_75kplus_train_071595 | 2,578 | no_license | [
{
"docstring": ":type head: ListNode :type k: int :rtype: ListNode",
"name": "rotateRight",
"signature": "def rotateRight(self, head, k)"
},
{
"docstring": ":type head: ListNode :type k: int :rtype: ListNode",
"name": "rotateRight_cycle",
"signature": "def rotateRight_cycle(self, head, k... | 3 | stack_v2_sparse_classes_30k_train_054087 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
- def rotateRight_cycle(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
- de... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rotateRight(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
- def rotateRight_cycle(self, head, k): :type head: ListNode :type k: int :rtype: ListNode
- de... | e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59 | <|skeleton|>
class Solution:
def rotateRight(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_0|>
def rotateRight_cycle(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
<|body_1|>
def rotateRight_v2(self, head, k):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rotateRight(self, head, k):
""":type head: ListNode :type k: int :rtype: ListNode"""
if not head or not head.next or k == 0:
return head
tail = head
count = 1
while tail.next:
count += 1
tail = tail.next
if count... | the_stack_v2_python_sparse | src/lt_61.py | oxhead/CodingYourWay | train | 0 | |
3eb25e37fc03744017719d8338ab0aabcc17639a | [
"if isinstance(key, int):\n return HIAlgorithm(key)\nif key not in HIAlgorithm._member_map_:\n return extend_enum(HIAlgorithm, key, default)\nreturn HIAlgorithm[key]",
"if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 10 <= va... | <|body_start_0|>
if isinstance(key, int):
return HIAlgorithm(key)
if key not in HIAlgorithm._member_map_:
return extend_enum(HIAlgorithm, key, default)
return HIAlgorithm[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <= 65535)... | [HIAlgorithm] HI Algorithm | HIAlgorithm | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HIAlgorithm:
"""[HIAlgorithm] HI Algorithm"""
def get(key: 'int | str', default: 'int'=-1) -> 'HIAlgorithm':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def _missing_(cls, valu... | stack_v2_sparse_classes_75kplus_train_071596 | 2,103 | permissive | [
{
"docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:",
"name": "get",
"signature": "def get(key: 'int | str', default: 'int'=-1) -> 'HIAlgorithm'"
},
{
"docstring": "Lookup function used when value is not found.... | 2 | stack_v2_sparse_classes_30k_train_027752 | Implement the Python class `HIAlgorithm` described below.
Class description:
[HIAlgorithm] HI Algorithm
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'HIAlgorithm': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta pr... | Implement the Python class `HIAlgorithm` described below.
Class description:
[HIAlgorithm] HI Algorithm
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'HIAlgorithm': Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta pr... | a6fe49ec58f09e105bec5a00fb66d9b3f22730d9 | <|skeleton|>
class HIAlgorithm:
"""[HIAlgorithm] HI Algorithm"""
def get(key: 'int | str', default: 'int'=-1) -> 'HIAlgorithm':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def _missing_(cls, valu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HIAlgorithm:
"""[HIAlgorithm] HI Algorithm"""
def get(key: 'int | str', default: 'int'=-1) -> 'HIAlgorithm':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
if isinstance(key, int):
return HIAlgori... | the_stack_v2_python_sparse | pcapkit/const/hip/hi_algorithm.py | JarryShaw/PyPCAPKit | train | 204 |
9a238eecc6a435a2df9e7d85a2e37fc6b7a677d1 | [
"self._len = capacity\nself._caches = {}\nself._priority = []",
"if key in self._caches.keys():\n self._priority.remove(key)\n self._priority.append(key)\ntry:\n return self._caches[key]\nexcept:\n return -1",
"if len(self._caches) < self._len:\n self._caches[key] = value\nelse:\n self._caches... | <|body_start_0|>
self._len = capacity
self._caches = {}
self._priority = []
<|end_body_0|>
<|body_start_1|>
if key in self._caches.keys():
self._priority.remove(key)
self._priority.append(key)
try:
return self._caches[key]
except:
... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_75kplus_train_071597 | 989 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 3 | stack_v2_sparse_classes_30k_train_045069 | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
<|sk... | a6d0e392134afe19d1aed2dfe7914b674e05ecc6 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self._len = capacity
self._caches = {}
self._priority = []
def get(self, key):
""":type key: int :rtype: int"""
if key in self._caches.keys():
self._priority.remove(key)
... | the_stack_v2_python_sparse | 146LRUCache.py | Ting007/leetcodePractice | train | 0 | |
55d72c67ad38d7dae4f05c6d1cb7e56ae730e236 | [
"v0 = Vertex()\nself.assertIsNot(v0, None)\nself.assertIsInstance(v0, Vertex)",
"v0 = Vertex([1])\nself.assertIsNot(v0, None)\nself.assertIsInstance(v0, Vertex)\nv1 = Vertex([1, 2, 3])\nself.assertIsNot(v1, None)\nself.assertIsInstance(v1, Vertex)\nself.assertIsInstance(v1.coordinates(), Coordinates)\nv2 = Vertex... | <|body_start_0|>
v0 = Vertex()
self.assertIsNot(v0, None)
self.assertIsInstance(v0, Vertex)
<|end_body_0|>
<|body_start_1|>
v0 = Vertex([1])
self.assertIsNot(v0, None)
self.assertIsInstance(v0, Vertex)
v1 = Vertex([1, 2, 3])
self.assertIsNot(v1, None)
... | Test Vertex class calls | TestConstructor_Vertex | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestConstructor_Vertex:
"""Test Vertex class calls"""
def test_none(self):
"""Calling Vertex class with no key (key = None)"""
<|body_0|>
def test_iterable_simple(self):
"""Calling Vertex class with key containing simple types"""
<|body_1|>
def test_... | stack_v2_sparse_classes_75kplus_train_071598 | 6,423 | permissive | [
{
"docstring": "Calling Vertex class with no key (key = None)",
"name": "test_none",
"signature": "def test_none(self)"
},
{
"docstring": "Calling Vertex class with key containing simple types",
"name": "test_iterable_simple",
"signature": "def test_iterable_simple(self)"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_027532 | Implement the Python class `TestConstructor_Vertex` described below.
Class description:
Test Vertex class calls
Method signatures and docstrings:
- def test_none(self): Calling Vertex class with no key (key = None)
- def test_iterable_simple(self): Calling Vertex class with key containing simple types
- def test_iter... | Implement the Python class `TestConstructor_Vertex` described below.
Class description:
Test Vertex class calls
Method signatures and docstrings:
- def test_none(self): Calling Vertex class with no key (key = None)
- def test_iterable_simple(self): Calling Vertex class with key containing simple types
- def test_iter... | f9b00a39bc16aea4abac60c0dd0aab2acac5adcf | <|skeleton|>
class TestConstructor_Vertex:
"""Test Vertex class calls"""
def test_none(self):
"""Calling Vertex class with no key (key = None)"""
<|body_0|>
def test_iterable_simple(self):
"""Calling Vertex class with key containing simple types"""
<|body_1|>
def test_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestConstructor_Vertex:
"""Test Vertex class calls"""
def test_none(self):
"""Calling Vertex class with no key (key = None)"""
v0 = Vertex()
self.assertIsNot(v0, None)
self.assertIsInstance(v0, Vertex)
def test_iterable_simple(self):
"""Calling Vertex class wi... | the_stack_v2_python_sparse | _BACKUPS_v3/v3_1/LightPicture_Test.py | nagame/LightPicture | train | 0 |
e3c6595ed1648240e55b29a404ba00293e025ab8 | [
"requestId = data[:4]\ndata = data[4:]\nfilename, data = filetransfer.getNS(data)\nflags, = struct.unpack('!L', data[:4])\ndata = data[4:]\nattrs, data = self._parseAttributes(data)\nfilename = basename(filename)\nassert data == '', 'still have data in OPEN: %s' % repr(data)\nd = defer.maybeDeferred(self.client.ope... | <|body_start_0|>
requestId = data[:4]
data = data[4:]
filename, data = filetransfer.getNS(data)
flags, = struct.unpack('!L', data[:4])
data = data[4:]
attrs, data = self._parseAttributes(data)
filename = basename(filename)
assert data == '', 'still have da... | Custom SFTP file transfer server. Provides fixed size upload limit and disallows some unsafe and unneeded operation for what sshg is intended for. | FileTransferServer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileTransferServer:
"""Custom SFTP file transfer server. Provides fixed size upload limit and disallows some unsafe and unneeded operation for what sshg is intended for."""
def packet_OPEN(self, data):
"""Overridden method to disallow writing or opening files outside the created temp... | stack_v2_sparse_classes_75kplus_train_071599 | 6,191 | no_license | [
{
"docstring": "Overridden method to disallow writing or opening files outside the created temporary directory.",
"name": "packet_OPEN",
"signature": "def packet_OPEN(self, data)"
},
{
"docstring": "Overridden method to disallow writing or opening files outside the created temporary directory.",... | 4 | stack_v2_sparse_classes_30k_train_039936 | Implement the Python class `FileTransferServer` described below.
Class description:
Custom SFTP file transfer server. Provides fixed size upload limit and disallows some unsafe and unneeded operation for what sshg is intended for.
Method signatures and docstrings:
- def packet_OPEN(self, data): Overridden method to d... | Implement the Python class `FileTransferServer` described below.
Class description:
Custom SFTP file transfer server. Provides fixed size upload limit and disallows some unsafe and unneeded operation for what sshg is intended for.
Method signatures and docstrings:
- def packet_OPEN(self, data): Overridden method to d... | 75f0c76f67ad4d98f83645a1ae05980dd5aa28e6 | <|skeleton|>
class FileTransferServer:
"""Custom SFTP file transfer server. Provides fixed size upload limit and disallows some unsafe and unneeded operation for what sshg is intended for."""
def packet_OPEN(self, data):
"""Overridden method to disallow writing or opening files outside the created temp... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileTransferServer:
"""Custom SFTP file transfer server. Provides fixed size upload limit and disallows some unsafe and unneeded operation for what sshg is intended for."""
def packet_OPEN(self, data):
"""Overridden method to disallow writing or opening files outside the created temporary directo... | the_stack_v2_python_sparse | sshg/sftp.py | UfSoft/SSHg | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.