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
bb1aa61f197e545dac1a4ff767ffb7480eb28b33
[ "for page in range(1, 6):\n page_url = self.url.format(page)\n yield scrapy.Request(url=page_url, callback=self.parse)", "li_list = response.xpath('//ul[@class=\"carlist clearfix js-top\"]/li')\nfor li in li_list:\n item = GuaziItem()\n item['title'] = li.xpath('./a/@title').get()\n item['price'] =...
<|body_start_0|> for page in range(1, 6): page_url = self.url.format(page) yield scrapy.Request(url=page_url, callback=self.parse) <|end_body_0|> <|body_start_1|> li_list = response.xpath('//ul[@class="carlist clearfix js-top"]/li') for li in li_list: item = ...
GuaziSpider
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GuaziSpider: def start_requests(self): """生成所有要抓取的URL地址,一次性交给调度器如队列""" <|body_0|> def parse(self, response): """一级页面解析函数: 名称、价格、链接""" <|body_1|> def parse_second_page(self, response): """二级页面解析函数:里程、排量、变速箱""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_003200
2,329
permissive
[ { "docstring": "生成所有要抓取的URL地址,一次性交给调度器如队列", "name": "start_requests", "signature": "def start_requests(self)" }, { "docstring": "一级页面解析函数: 名称、价格、链接", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "二级页面解析函数:里程、排量、变速箱", "name": "parse_second_page",...
3
stack_v2_sparse_classes_30k_train_023037
Implement the Python class `GuaziSpider` described below. Class description: Implement the GuaziSpider class. Method signatures and docstrings: - def start_requests(self): 生成所有要抓取的URL地址,一次性交给调度器如队列 - def parse(self, response): 一级页面解析函数: 名称、价格、链接 - def parse_second_page(self, response): 二级页面解析函数:里程、排量、变速箱
Implement the Python class `GuaziSpider` described below. Class description: Implement the GuaziSpider class. Method signatures and docstrings: - def start_requests(self): 生成所有要抓取的URL地址,一次性交给调度器如队列 - def parse(self, response): 一级页面解析函数: 名称、价格、链接 - def parse_second_page(self, response): 二级页面解析函数:里程、排量、变速箱 <|skeleton|...
abe983ddc52690f4726cf42cc6390cba815026d8
<|skeleton|> class GuaziSpider: def start_requests(self): """生成所有要抓取的URL地址,一次性交给调度器如队列""" <|body_0|> def parse(self, response): """一级页面解析函数: 名称、价格、链接""" <|body_1|> def parse_second_page(self, response): """二级页面解析函数:里程、排量、变速箱""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GuaziSpider: def start_requests(self): """生成所有要抓取的URL地址,一次性交给调度器如队列""" for page in range(1, 6): page_url = self.url.format(page) yield scrapy.Request(url=page_url, callback=self.parse) def parse(self, response): """一级页面解析函数: 名称、价格、链接""" li_list = re...
the_stack_v2_python_sparse
month05/spider/day07_course/day07_code/Guazi/Guazi/spiders/guazi.py
chaofan-zheng/tedu-python-demo
train
4
ba673a5211d0569b5aadd295db90d517f2387b26
[ "if pretty:\n return self.as_dict(as_json_pretty=True)\nreturn self.as_dict(as_json=True)", "as_json = kwargs.get('as_json', False)\nas_json_pretty = kwargs.get('as_json_pretty', False)\nod = OrderedDict()\nfor param in self.FIELDS_TO_SERIALIZE:\n od[param] = self.__dict__.get(param)\nif as_json:\n retur...
<|body_start_0|> if pretty: return self.as_dict(as_json_pretty=True) return self.as_dict(as_json=True) <|end_body_0|> <|body_start_1|> as_json = kwargs.get('as_json', False) as_json_pretty = kwargs.get('as_json_pretty', False) od = OrderedDict() for param in ...
New user class to hold extra attributes in the future
User
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: """New user class to hold extra attributes in the future""" def as_json(self, pretty=False): """Return as a JSON string""" <|body_0|> def as_dict(self, **kwargs): """Return as an OrderedDict""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_003201
1,223
permissive
[ { "docstring": "Return as a JSON string", "name": "as_json", "signature": "def as_json(self, pretty=False)" }, { "docstring": "Return as an OrderedDict", "name": "as_dict", "signature": "def as_dict(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_028176
Implement the Python class `User` described below. Class description: New user class to hold extra attributes in the future Method signatures and docstrings: - def as_json(self, pretty=False): Return as a JSON string - def as_dict(self, **kwargs): Return as an OrderedDict
Implement the Python class `User` described below. Class description: New user class to hold extra attributes in the future Method signatures and docstrings: - def as_json(self, pretty=False): Return as a JSON string - def as_dict(self, **kwargs): Return as an OrderedDict <|skeleton|> class User: """New user cla...
e5f820557d6646df525ceed15e17d79f4159cf0a
<|skeleton|> class User: """New user class to hold extra attributes in the future""" def as_json(self, pretty=False): """Return as a JSON string""" <|body_0|> def as_dict(self, **kwargs): """Return as an OrderedDict""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class User: """New user class to hold extra attributes in the future""" def as_json(self, pretty=False): """Return as a JSON string""" if pretty: return self.as_dict(as_json_pretty=True) return self.as_dict(as_json=True) def as_dict(self, **kwargs): """Return as...
the_stack_v2_python_sparse
tworaven_apps/raven_auth/models.py
TwoRavens/TwoRavens
train
21
18d06109c15b51173d876e3369f003a6570b10cc
[ "super(NodeEncoder, self).__init__()\nself.feat_enc = feat_enc\nself.pos_enc = pos_enc\nself.agg_type = agg_type\nif feat_enc is None and pos_enc is None:\n raise Exception('pos_enc and feat_enc are both None!!')", "if self.feat_enc is not None and self.pos_enc is not None:\n feat_embeds = self.feat_enc(nod...
<|body_start_0|> super(NodeEncoder, self).__init__() self.feat_enc = feat_enc self.pos_enc = pos_enc self.agg_type = agg_type if feat_enc is None and pos_enc is None: raise Exception('pos_enc and feat_enc are both None!!') <|end_body_0|> <|body_start_1|> if s...
This is the encoder for each entity or node which has two components" 1. feature encoder (DirectEncoder): feat_enc 2. position encoder (PositionEncoder): pos_enc
NodeEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeEncoder: """This is the encoder for each entity or node which has two components" 1. feature encoder (DirectEncoder): feat_enc 2. position encoder (PositionEncoder): pos_enc""" def __init__(self, feat_enc, pos_enc, agg_type='add'): """Args: feat_enc:feature encoder pos_enc: posit...
stack_v2_sparse_classes_75kplus_train_003202
34,194
permissive
[ { "docstring": "Args: feat_enc:feature encoder pos_enc: position encoder agg_type: how to combine the feature embedding and space embedding of a node/entity", "name": "__init__", "signature": "def __init__(self, feat_enc, pos_enc, agg_type='add')" }, { "docstring": "Args: nodes: a list of node i...
2
null
Implement the Python class `NodeEncoder` described below. Class description: This is the encoder for each entity or node which has two components" 1. feature encoder (DirectEncoder): feat_enc 2. position encoder (PositionEncoder): pos_enc Method signatures and docstrings: - def __init__(self, feat_enc, pos_enc, agg_t...
Implement the Python class `NodeEncoder` described below. Class description: This is the encoder for each entity or node which has two components" 1. feature encoder (DirectEncoder): feat_enc 2. position encoder (PositionEncoder): pos_enc Method signatures and docstrings: - def __init__(self, feat_enc, pos_enc, agg_t...
0e5a630a8403d4c7965de0f71e2e22b95f7be7bd
<|skeleton|> class NodeEncoder: """This is the encoder for each entity or node which has two components" 1. feature encoder (DirectEncoder): feat_enc 2. position encoder (PositionEncoder): pos_enc""" def __init__(self, feat_enc, pos_enc, agg_type='add'): """Args: feat_enc:feature encoder pos_enc: posit...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NodeEncoder: """This is the encoder for each entity or node which has two components" 1. feature encoder (DirectEncoder): feat_enc 2. position encoder (PositionEncoder): pos_enc""" def __init__(self, feat_enc, pos_enc, agg_type='add'): """Args: feat_enc:feature encoder pos_enc: position encoder a...
the_stack_v2_python_sparse
graphqa/netquery/encoders.py
Moon-xm/se-kge
train
0
af5ca28ac889d8321da129af9eab0dcfea02551f
[ "plugin_meta = self.get_object()\nrequest.data['name'] = plugin_meta.name\nrequest.data.pop('title', None)\nrequest.data.pop('license', None)\nrequest.data.pop('type', None)\nrequest.data.pop('icon', None)\nrequest.data.pop('category', None)\nrequest.data.pop('authors', None)\nrequest.data.pop('documentation', None...
<|body_start_0|> plugin_meta = self.get_object() request.data['name'] = plugin_meta.name request.data.pop('title', None) request.data.pop('license', None) request.data.pop('type', None) request.data.pop('icon', None) request.data.pop('category', None) requ...
A plugin meta view.
PluginMetaDetail
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PluginMetaDetail: """A plugin meta view.""" def update(self, request, *args, **kwargs): """Overriden to remove descriptors that are not allowed to be updated before the serializer performs validation.""" <|body_0|> def retrieve(self, request, *args, **kwargs): ""...
stack_v2_sparse_classes_75kplus_train_003203
13,541
permissive
[ { "docstring": "Overriden to remove descriptors that are not allowed to be updated before the serializer performs validation.", "name": "update", "signature": "def update(self, request, *args, **kwargs)" }, { "docstring": "Overriden to append a collection+json template.", "name": "retrieve",...
2
stack_v2_sparse_classes_30k_train_007676
Implement the Python class `PluginMetaDetail` described below. Class description: A plugin meta view. Method signatures and docstrings: - def update(self, request, *args, **kwargs): Overriden to remove descriptors that are not allowed to be updated before the serializer performs validation. - def retrieve(self, reque...
Implement the Python class `PluginMetaDetail` described below. Class description: A plugin meta view. Method signatures and docstrings: - def update(self, request, *args, **kwargs): Overriden to remove descriptors that are not allowed to be updated before the serializer performs validation. - def retrieve(self, reque...
5ffacfdfc8e6cedbee3d43fef3778973439c1367
<|skeleton|> class PluginMetaDetail: """A plugin meta view.""" def update(self, request, *args, **kwargs): """Overriden to remove descriptors that are not allowed to be updated before the serializer performs validation.""" <|body_0|> def retrieve(self, request, *args, **kwargs): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PluginMetaDetail: """A plugin meta view.""" def update(self, request, *args, **kwargs): """Overriden to remove descriptors that are not allowed to be updated before the serializer performs validation.""" plugin_meta = self.get_object() request.data['name'] = plugin_meta.name ...
the_stack_v2_python_sparse
store_backend/plugins/views.py
FNNDSC/ChRIS_store
train
16
8b2f365dc23da70e324d160267952ea3c4a488cb
[ "super(CloudkittyTest, cls).setUpClass()\ncls.current_release = openstack_utils.get_os_release()\nlogging.info('Instantiating cloudkitty client...')\ncls.cloudkitty = client.Client(CloudkittyTest.API_VERSION, session=cls.keystone_session)", "rating = self.cloudkitty.rating\nif not rating.get_module(module_id='has...
<|body_start_0|> super(CloudkittyTest, cls).setUpClass() cls.current_release = openstack_utils.get_os_release() logging.info('Instantiating cloudkitty client...') cls.cloudkitty = client.Client(CloudkittyTest.API_VERSION, session=cls.keystone_session) <|end_body_0|> <|body_start_1|> ...
Encapsulate Cloudkitty tests.
CloudkittyTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudkittyTest: """Encapsulate Cloudkitty tests.""" def setUpClass(cls): """Run class setup for running Cloudkitty tests.""" <|body_0|> def tearDown(self): """Run teardown for test class.""" <|body_1|> def test_400_api_connection(self): """Si...
stack_v2_sparse_classes_75kplus_train_003204
4,140
permissive
[ { "docstring": "Run class setup for running Cloudkitty tests.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Run teardown for test class.", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "Simple api calls to check service is...
5
stack_v2_sparse_classes_30k_train_035454
Implement the Python class `CloudkittyTest` described below. Class description: Encapsulate Cloudkitty tests. Method signatures and docstrings: - def setUpClass(cls): Run class setup for running Cloudkitty tests. - def tearDown(self): Run teardown for test class. - def test_400_api_connection(self): Simple api calls ...
Implement the Python class `CloudkittyTest` described below. Class description: Encapsulate Cloudkitty tests. Method signatures and docstrings: - def setUpClass(cls): Run class setup for running Cloudkitty tests. - def tearDown(self): Run teardown for test class. - def test_400_api_connection(self): Simple api calls ...
3b17ad9d97c57b6e62797d4e3333e4b83e43a447
<|skeleton|> class CloudkittyTest: """Encapsulate Cloudkitty tests.""" def setUpClass(cls): """Run class setup for running Cloudkitty tests.""" <|body_0|> def tearDown(self): """Run teardown for test class.""" <|body_1|> def test_400_api_connection(self): """Si...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CloudkittyTest: """Encapsulate Cloudkitty tests.""" def setUpClass(cls): """Run class setup for running Cloudkitty tests.""" super(CloudkittyTest, cls).setUpClass() cls.current_release = openstack_utils.get_os_release() logging.info('Instantiating cloudkitty client...') ...
the_stack_v2_python_sparse
zaza/openstack/charm_tests/cloudkitty/tests.py
openstack-charmers/zaza-openstack-tests
train
7
0c947d2de390f62ebf5d9cba02a9bffba8063935
[ "q = Queue()\nq.enqueue(3)\nself.assertEqual(q.head, q.tail)\nself.assertEqual(q.head.value, 3)", "q = Queue()\nq.enqueue(3)\nresult = q.dequeue()\nself.assertEqual(result, 3)\nself.assertIsNone(q.head)", "q = Queue()\nq.enqueue(3)\nq.enqueue(4)\nq.enqueue(5)\nself.assertEqual(q.head.value, 3)\nself.assertEqual...
<|body_start_0|> q = Queue() q.enqueue(3) self.assertEqual(q.head, q.tail) self.assertEqual(q.head.value, 3) <|end_body_0|> <|body_start_1|> q = Queue() q.enqueue(3) result = q.dequeue() self.assertEqual(result, 3) self.assertIsNone(q.head) <|end_...
test_queue_implementation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_queue_implementation: def test_first_elemnt_of_queue(self): """test that after initial enqueue, the head of the Queue is correct""" <|body_0|> def test_enqueue_then_dequeue(self): """test that after an enqueue a dequeue gives what is expected""" <|body_1...
stack_v2_sparse_classes_75kplus_train_003205
1,023
no_license
[ { "docstring": "test that after initial enqueue, the head of the Queue is correct", "name": "test_first_elemnt_of_queue", "signature": "def test_first_elemnt_of_queue(self)" }, { "docstring": "test that after an enqueue a dequeue gives what is expected", "name": "test_enqueue_then_dequeue", ...
4
stack_v2_sparse_classes_30k_train_033666
Implement the Python class `test_queue_implementation` described below. Class description: Implement the test_queue_implementation class. Method signatures and docstrings: - def test_first_elemnt_of_queue(self): test that after initial enqueue, the head of the Queue is correct - def test_enqueue_then_dequeue(self): t...
Implement the Python class `test_queue_implementation` described below. Class description: Implement the test_queue_implementation class. Method signatures and docstrings: - def test_first_elemnt_of_queue(self): test that after initial enqueue, the head of the Queue is correct - def test_enqueue_then_dequeue(self): t...
7e884adb19b84a2e5960d1b6e81cd926f0b46705
<|skeleton|> class test_queue_implementation: def test_first_elemnt_of_queue(self): """test that after initial enqueue, the head of the Queue is correct""" <|body_0|> def test_enqueue_then_dequeue(self): """test that after an enqueue a dequeue gives what is expected""" <|body_1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class test_queue_implementation: def test_first_elemnt_of_queue(self): """test that after initial enqueue, the head of the Queue is correct""" q = Queue() q.enqueue(3) self.assertEqual(q.head, q.tail) self.assertEqual(q.head.value, 3) def test_enqueue_then_dequeue(self):...
the_stack_v2_python_sparse
questions/linked_lists/queue_test.py
qdonnellan/random_questions
train
0
e0fcea2a030dfd00d393cca01e27438072f867ab
[ "self.folder_vec = folder_vec\nself.is_entire_mailbox_required = is_entire_mailbox_required\nself.object = object", "if dictionary is None:\n return None\nfolder_vec = None\nif dictionary.get('folderVec') != None:\n folder_vec = list()\n for structure in dictionary.get('folderVec'):\n folder_vec.a...
<|body_start_0|> self.folder_vec = folder_vec self.is_entire_mailbox_required = is_entire_mailbox_required self.object = object <|end_body_0|> <|body_start_1|> if dictionary is None: return None folder_vec = None if dictionary.get('folderVec') != None: ...
Implementation of the 'RestoreOutlookParams_Mailbox' model. TODO: type description here. Attributes: folder_vec (list of RestoreOutlookParams_Folder): If is_entire_mailbox_required is set to false, user will then specify which particular folders are to be restored. is_entire_mailbox_required (bool): Specify if the enti...
RestoreOutlookParams_Mailbox
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestoreOutlookParams_Mailbox: """Implementation of the 'RestoreOutlookParams_Mailbox' model. TODO: type description here. Attributes: folder_vec (list of RestoreOutlookParams_Folder): If is_entire_mailbox_required is set to false, user will then specify which particular folders are to be restored...
stack_v2_sparse_classes_75kplus_train_003206
2,651
permissive
[ { "docstring": "Constructor for the RestoreOutlookParams_Mailbox class", "name": "__init__", "signature": "def __init__(self, folder_vec=None, is_entire_mailbox_required=None, object=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A di...
2
null
Implement the Python class `RestoreOutlookParams_Mailbox` described below. Class description: Implementation of the 'RestoreOutlookParams_Mailbox' model. TODO: type description here. Attributes: folder_vec (list of RestoreOutlookParams_Folder): If is_entire_mailbox_required is set to false, user will then specify whic...
Implement the Python class `RestoreOutlookParams_Mailbox` described below. Class description: Implementation of the 'RestoreOutlookParams_Mailbox' model. TODO: type description here. Attributes: folder_vec (list of RestoreOutlookParams_Folder): If is_entire_mailbox_required is set to false, user will then specify whic...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class RestoreOutlookParams_Mailbox: """Implementation of the 'RestoreOutlookParams_Mailbox' model. TODO: type description here. Attributes: folder_vec (list of RestoreOutlookParams_Folder): If is_entire_mailbox_required is set to false, user will then specify which particular folders are to be restored...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RestoreOutlookParams_Mailbox: """Implementation of the 'RestoreOutlookParams_Mailbox' model. TODO: type description here. Attributes: folder_vec (list of RestoreOutlookParams_Folder): If is_entire_mailbox_required is set to false, user will then specify which particular folders are to be restored. is_entire_m...
the_stack_v2_python_sparse
cohesity_management_sdk/models/restore_outlook_params_mailbox.py
cohesity/management-sdk-python
train
24
6023aca096afced53e25939605ec0a273972f5f6
[ "project_id = request.GET.get('project_id')\nlocation_choices = Projects.LOCATION_CHOICES\nproject = ''\nif project_id:\n project = Projects.objects.get(project_id=project_id)\ncontext = {'project': project, 'location_choices': location_choices}\nreturn render(request, 'project/add.html', context)", "user = re...
<|body_start_0|> project_id = request.GET.get('project_id') location_choices = Projects.LOCATION_CHOICES project = '' if project_id: project = Projects.objects.get(project_id=project_id) context = {'project': project, 'location_choices': location_choices} retu...
ProjectAddView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectAddView: def get(self, request): """显示页面""" <|body_0|> def post(self, request): """添加新项目""" <|body_1|> <|end_skeleton|> <|body_start_0|> project_id = request.GET.get('project_id') location_choices = Projects.LOCATION_CHOICES p...
stack_v2_sparse_classes_75kplus_train_003207
17,526
no_license
[ { "docstring": "显示页面", "name": "get", "signature": "def get(self, request)" }, { "docstring": "添加新项目", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `ProjectAddView` described below. Class description: Implement the ProjectAddView class. Method signatures and docstrings: - def get(self, request): 显示页面 - def post(self, request): 添加新项目
Implement the Python class `ProjectAddView` described below. Class description: Implement the ProjectAddView class. Method signatures and docstrings: - def get(self, request): 显示页面 - def post(self, request): 添加新项目 <|skeleton|> class ProjectAddView: def get(self, request): """显示页面""" <|body_0|> ...
63b214194e019ecf8c89cfc2890c340ef2bf5adf
<|skeleton|> class ProjectAddView: def get(self, request): """显示页面""" <|body_0|> def post(self, request): """添加新项目""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProjectAddView: def get(self, request): """显示页面""" project_id = request.GET.get('project_id') location_choices = Projects.LOCATION_CHOICES project = '' if project_id: project = Projects.objects.get(project_id=project_id) context = {'project': project...
the_stack_v2_python_sparse
apps/project/views.py
pysunny/HPFWMS
train
0
535f5da35483c84166da689e686287a0887e4e36
[ "if isinstance(value, str):\n path = epath.Path(value)\n return cls(root_path=path.parent, filenames=[path.name])\nelif isinstance(value, dict):\n return cls(root_path=epath.Path(value['root_path']), filenames=value['filenames'])\nelse:\n raise ValueError(f'Invalid input: {value}')", "if len(self.file...
<|body_start_0|> if isinstance(value, str): path = epath.Path(value) return cls(root_path=path.parent, filenames=[path.name]) elif isinstance(value, dict): return cls(root_path=epath.Path(value['root_path']), filenames=value['filenames']) else: rai...
Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package
DatasetSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetSource: """Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package""" def from_json(cls, value: utils.JsonValue) -> 'D...
stack_v2_sparse_classes_75kplus_train_003208
2,642
permissive
[ { "docstring": "Imports from JSON.", "name": "from_json", "signature": "def from_json(cls, value: utils.JsonValue) -> 'DatasetSource'" }, { "docstring": "Exports to JSON.", "name": "to_json", "signature": "def to_json(self) -> utils.JsonValue" } ]
2
stack_v2_sparse_classes_30k_train_020264
Implement the Python class `DatasetSource` described below. Class description: Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package Method signature...
Implement the Python class `DatasetSource` described below. Class description: Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package Method signature...
41ae3cf1439711ed2f50f99caa0e6702082e6d37
<|skeleton|> class DatasetSource: """Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package""" def from_json(cls, value: utils.JsonValue) -> 'D...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DatasetSource: """Structure containing information required to fetch a dataset. Attributes: root_path: Root directory of the dataset package (e.g. `gs://.../my_dataset/`, `github://.../my_dataset/`) filenames: Content of the dataset package""" def from_json(cls, value: utils.JsonValue) -> 'DatasetSource'...
the_stack_v2_python_sparse
tensorflow_datasets/core/community/dataset_sources.py
tensorflow/datasets
train
4,224
8c42522c263eb8d0c4d6be04b4102fab36834681
[ "args = failed_parser.parse_args()\npage = args['page']\nper_page = args['per_page']\nsort_by = args['sort_by']\nsort_order = args['order']\nif sort_by == 'failure_time':\n sort_by = 'tof'\nif per_page > 100:\n per_page = 100\ndescending = sort_order == 'desc'\nif per_page > 100:\n per_page = 100\nstart = ...
<|body_start_0|> args = failed_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_by = args['sort_by'] sort_order = args['order'] if sort_by == 'failure_time': sort_by = 'tof' if per_page > 100: per_page = 100 ...
RetryFailed
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetryFailed: def get(self, session=None): """List all failed entries""" <|body_0|> def delete(self, session=None): """Clear all failed entries""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = failed_parser.parse_args() page = args['pag...
stack_v2_sparse_classes_75kplus_train_003209
4,968
permissive
[ { "docstring": "List all failed entries", "name": "get", "signature": "def get(self, session=None)" }, { "docstring": "Clear all failed entries", "name": "delete", "signature": "def delete(self, session=None)" } ]
2
stack_v2_sparse_classes_30k_train_044754
Implement the Python class `RetryFailed` described below. Class description: Implement the RetryFailed class. Method signatures and docstrings: - def get(self, session=None): List all failed entries - def delete(self, session=None): Clear all failed entries
Implement the Python class `RetryFailed` described below. Class description: Implement the RetryFailed class. Method signatures and docstrings: - def get(self, session=None): List all failed entries - def delete(self, session=None): Clear all failed entries <|skeleton|> class RetryFailed: def get(self, session=...
2b7e8314d103c94cf4552bd0152699eeca0ad159
<|skeleton|> class RetryFailed: def get(self, session=None): """List all failed entries""" <|body_0|> def delete(self, session=None): """Clear all failed entries""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RetryFailed: def get(self, session=None): """List all failed entries""" args = failed_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_by = args['sort_by'] sort_order = args['order'] if sort_by == 'failure_time': sort_...
the_stack_v2_python_sparse
flexget/components/failed/api.py
BrutuZ/Flexget
train
1
58ff5b8946f1f6ef460d74c94a0e9ac3d8abc2cc
[ "parser.add_argument('--ip4_ttl', default=21)\nparser.add_argument('--ip4_source_address', default='self', help='eg. a.b.c.d|self|rnd|drnd')\nparser.add_argument('--ip4_destination_address', default='self', help='eg. a.b.c.d|self|rnd|drnd')", "def process_ip4_address(fields, selector):\n \"\"\"handle self, rnd...
<|body_start_0|> parser.add_argument('--ip4_ttl', default=21) parser.add_argument('--ip4_source_address', default='self', help='eg. a.b.c.d|self|rnd|drnd') parser.add_argument('--ip4_destination_address', default='self', help='eg. a.b.c.d|self|rnd|drnd') <|end_body_0|> <|body_start_1|> ...
layer ip4 impl
Ip4
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ip4: """layer ip4 impl""" def parse_arguments(parser): """parse arguments""" <|body_0|> def process_fields(fields): """process input parameters to fields""" <|body_1|> <|end_skeleton|> <|body_start_0|> parser.add_argument('--ip4_ttl', default=21...
stack_v2_sparse_classes_75kplus_train_003210
10,681
no_license
[ { "docstring": "parse arguments", "name": "parse_arguments", "signature": "def parse_arguments(parser)" }, { "docstring": "process input parameters to fields", "name": "process_fields", "signature": "def process_fields(fields)" } ]
2
stack_v2_sparse_classes_30k_train_043391
Implement the Python class `Ip4` described below. Class description: layer ip4 impl Method signatures and docstrings: - def parse_arguments(parser): parse arguments - def process_fields(fields): process input parameters to fields
Implement the Python class `Ip4` described below. Class description: layer ip4 impl Method signatures and docstrings: - def parse_arguments(parser): parse arguments - def process_fields(fields): process input parameters to fields <|skeleton|> class Ip4: """layer ip4 impl""" def parse_arguments(parser): ...
dd7129bf323312daa05d0d9fef8ecbacf831029a
<|skeleton|> class Ip4: """layer ip4 impl""" def parse_arguments(parser): """parse arguments""" <|body_0|> def process_fields(fields): """process input parameters to fields""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Ip4: """layer ip4 impl""" def parse_arguments(parser): """parse arguments""" parser.add_argument('--ip4_ttl', default=21) parser.add_argument('--ip4_source_address', default='self', help='eg. a.b.c.d|self|rnd|drnd') parser.add_argument('--ip4_destination_address', default=...
the_stack_v2_python_sparse
tg/tg/layer.py
bodik/ddos-cz2
train
2
1dac0e13dc3c0201506d2b6a4fdc19dec076e3bd
[ "self.__screen = screen\nself.__dns = DNS()\nself.__hostnameLabel = Label('Hostname')\nself.__primaryDNSLabel = Label('Primary DNS')\nself.__secondaryDNSLabel = Label('Secondary DNS')\nself.__searchListLabel = Label('Search')\nself.__hostname = Entry(15, socket.gethostname())\nself.__primaryDNS = Entry(15, self.__d...
<|body_start_0|> self.__screen = screen self.__dns = DNS() self.__hostnameLabel = Label('Hostname') self.__primaryDNSLabel = Label('Primary DNS') self.__secondaryDNSLabel = Label('Secondary DNS') self.__searchListLabel = Label('Search') self.__hostname = Entry(15,...
Represents the DNS configuration screen
DNSConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DNSConfig: """Represents the DNS configuration screen""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" <|body_0|> def __writeConfig(self): """Write configuration into the file @rtype: None @returns: no...
stack_v2_sparse_classes_75kplus_train_003211
2,694
no_license
[ { "docstring": "Constructor @type screen: SnackScreen @param screen: SnackScreen instance", "name": "__init__", "signature": "def __init__(self, screen)" }, { "docstring": "Write configuration into the file @rtype: None @returns: nothing", "name": "__writeConfig", "signature": "def __wri...
3
stack_v2_sparse_classes_30k_train_045754
Implement the Python class `DNSConfig` described below. Class description: Represents the DNS configuration screen Method signatures and docstrings: - def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance - def __writeConfig(self): Write configuration into the file @rty...
Implement the Python class `DNSConfig` described below. Class description: Represents the DNS configuration screen Method signatures and docstrings: - def __init__(self, screen): Constructor @type screen: SnackScreen @param screen: SnackScreen instance - def __writeConfig(self): Write configuration into the file @rty...
1c738fd5e6ee3f8fd4f47acf2207038f20868212
<|skeleton|> class DNSConfig: """Represents the DNS configuration screen""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" <|body_0|> def __writeConfig(self): """Write configuration into the file @rtype: None @returns: no...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DNSConfig: """Represents the DNS configuration screen""" def __init__(self, screen): """Constructor @type screen: SnackScreen @param screen: SnackScreen instance""" self.__screen = screen self.__dns = DNS() self.__hostnameLabel = Label('Hostname') self.__primaryDNS...
the_stack_v2_python_sparse
zfrobisher-installer/src/ui/networkcfg/dnsconfig.py
fedosu85nce/work
train
2
dde7513b9bccb6f11d919cb3a193d41bdbeb9f95
[ "self._input = input\nself._internal = internal\nself._ses = ses", "if not self._internal:\n exported.write_user_data(self._input)\nexported.lyntin_command(self._input, internal=self._internal, session=self._ses)" ]
<|body_start_0|> self._input = input self._internal = internal self._ses = ses <|end_body_0|> <|body_start_1|> if not self._internal: exported.write_user_data(self._input) exported.lyntin_command(self._input, internal=self._internal, session=self._ses) <|end_body_1|>...
A user input event is created whenever the user types something into their ui and it creates a user event from it.
InputEvent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputEvent: """A user input event is created whenever the user types something into their ui and it creates a user event from it.""" def __init__(self, input, internal=0, ses=None): """Initializes the InputEvent. @param input: the data from the user @type input: string @param interna...
stack_v2_sparse_classes_75kplus_train_003212
5,535
no_license
[ { "docstring": "Initializes the InputEvent. @param input: the data from the user @type input: string @param internal: whether this is an internally generated user input. if it is internally generated then we don't record it in history. 1 if it's internal, 0 if not. @type internal: int @param ses: the session ex...
2
null
Implement the Python class `InputEvent` described below. Class description: A user input event is created whenever the user types something into their ui and it creates a user event from it. Method signatures and docstrings: - def __init__(self, input, internal=0, ses=None): Initializes the InputEvent. @param input: ...
Implement the Python class `InputEvent` described below. Class description: A user input event is created whenever the user types something into their ui and it creates a user event from it. Method signatures and docstrings: - def __init__(self, input, internal=0, ses=None): Initializes the InputEvent. @param input: ...
992736c2cb85ffe61f49a4bb6591f3adacd30134
<|skeleton|> class InputEvent: """A user input event is created whenever the user types something into their ui and it creates a user event from it.""" def __init__(self, input, internal=0, ses=None): """Initializes the InputEvent. @param input: the data from the user @type input: string @param interna...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InputEvent: """A user input event is created whenever the user types something into their ui and it creates a user event from it.""" def __init__(self, input, internal=0, ses=None): """Initializes the InputEvent. @param input: the data from the user @type input: string @param internal: whether th...
the_stack_v2_python_sparse
solutions/event.py
petro-ew/test1
train
1
34eff110d493729bc093fdc6360311743a742e69
[ "self.capacity = capacity\nself.entry_map = collections.defaultdict()\nself.L = []\nself.counter = 0", "if key in self.entry_map:\n entry = self.entry_map[key]\n entry[0] = self.counter\n self.counter += 1\n heapq.heapify(self.L)\n return self.entry_map[key][2]\nreturn -1", "if len(self.L) < self...
<|body_start_0|> self.capacity = capacity self.entry_map = collections.defaultdict() self.L = [] self.counter = 0 <|end_body_0|> <|body_start_1|> if key in self.entry_map: entry = self.entry_map[key] entry[0] = self.counter self.counter += 1 ...
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: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus_train_003213
1,901
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: None", "name": "pu...
3
stack_v2_sparse_classes_30k_train_013047
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: None
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: None <|sk...
f05aac9aeadec1febe4c8323849c0a9f07a1fd1c
<|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: None""" <|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.capacity = capacity self.entry_map = collections.defaultdict() self.L = [] self.counter = 0 def get(self, key): """:type key: int :rtype: int""" if key in self.entry_map: ...
the_stack_v2_python_sparse
Problems/Medium/146.LRU_Cache.py
ramakanthd92/LeetCode
train
2
6db7f3977c51e52ccbd38eb097ee45f4adc4c79f
[ "client_ip, is_routable = get_client_ip(self.request)\nobject = get_object_or_404(ProductionInspection, slug=slug)\nself.check_object_permissions(request, object)\nread_serializer = ProductionInspectionRetrieveSerializer(object, many=False, context={'authenticated_by': request.user, 'authenticated_from': client_ip,...
<|body_start_0|> client_ip, is_routable = get_client_ip(self.request) object = get_object_or_404(ProductionInspection, slug=slug) self.check_object_permissions(request, object) read_serializer = ProductionInspectionRetrieveSerializer(object, many=False, context={'authenticated_by': reque...
ProductionInspectionRetrieveUpdateAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductionInspectionRetrieveUpdateAPIView: def get(self, request, slug=None): """Retrieve""" <|body_0|> def put(self, request, slug=None): """Update""" <|body_1|> <|end_skeleton|> <|body_start_0|> client_ip, is_routable = get_client_ip(self.request)...
stack_v2_sparse_classes_75kplus_train_003214
3,164
permissive
[ { "docstring": "Retrieve", "name": "get", "signature": "def get(self, request, slug=None)" }, { "docstring": "Update", "name": "put", "signature": "def put(self, request, slug=None)" } ]
2
null
Implement the Python class `ProductionInspectionRetrieveUpdateAPIView` described below. Class description: Implement the ProductionInspectionRetrieveUpdateAPIView class. Method signatures and docstrings: - def get(self, request, slug=None): Retrieve - def put(self, request, slug=None): Update
Implement the Python class `ProductionInspectionRetrieveUpdateAPIView` described below. Class description: Implement the ProductionInspectionRetrieveUpdateAPIView class. Method signatures and docstrings: - def get(self, request, slug=None): Retrieve - def put(self, request, slug=None): Update <|skeleton|> class Prod...
98e1ff8bab7dda3492e5ff637bf5aafd111c840c
<|skeleton|> class ProductionInspectionRetrieveUpdateAPIView: def get(self, request, slug=None): """Retrieve""" <|body_0|> def put(self, request, slug=None): """Update""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProductionInspectionRetrieveUpdateAPIView: def get(self, request, slug=None): """Retrieve""" client_ip, is_routable = get_client_ip(self.request) object = get_object_or_404(ProductionInspection, slug=slug) self.check_object_permissions(request, object) read_serializer =...
the_stack_v2_python_sparse
mikaponics/production/views/resource_views/production_inspection_retrieve_update_view.py
mikaponics/mikaponics-back
train
4
79772a99c2fa4ad12f16ec854d845c14d552a378
[ "self.assertDirectoryContents(('produce.ini',))\nself.produce('b.txt')\nself.assertDirectoryContents(('produce.ini', 'a.txt', 'b.txt', 'c.txt'))", "self.assertDirectoryContents(('produce.ini',))\nwith self.assertRaisesRegex(ProduceError, 'cyclic dependency'):\n self.produce('c.txt')\nself.assertDirectoryConten...
<|body_start_0|> self.assertDirectoryContents(('produce.ini',)) self.produce('b.txt') self.assertDirectoryContents(('produce.ini', 'a.txt', 'b.txt', 'c.txt')) <|end_body_0|> <|body_start_1|> self.assertDirectoryContents(('produce.ini',)) with self.assertRaisesRegex(ProduceError,...
SoftCycleTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftCycleTest: def test_soft_cycle_allowed(self): """c.txt depends on a.txt, presumably to indicate that you have to build a.txt in order to get c.txt (c.txt is a side output of the instantiated rule for a.txt). That's fine because the instantiated rule for b.txt doesn't have its own rec...
stack_v2_sparse_classes_75kplus_train_003215
1,103
permissive
[ { "docstring": "c.txt depends on a.txt, presumably to indicate that you have to build a.txt in order to get c.txt (c.txt is a side output of the instantiated rule for a.txt). That's fine because the instantiated rule for b.txt doesn't have its own recipe, so there's no clash.", "name": "test_soft_cycle_allo...
2
stack_v2_sparse_classes_30k_train_032135
Implement the Python class `SoftCycleTest` described below. Class description: Implement the SoftCycleTest class. Method signatures and docstrings: - def test_soft_cycle_allowed(self): c.txt depends on a.txt, presumably to indicate that you have to build a.txt in order to get c.txt (c.txt is a side output of the inst...
Implement the Python class `SoftCycleTest` described below. Class description: Implement the SoftCycleTest class. Method signatures and docstrings: - def test_soft_cycle_allowed(self): c.txt depends on a.txt, presumably to indicate that you have to build a.txt in order to get c.txt (c.txt is a side output of the inst...
fe4116d063b8820877b9f589e40cae29721511bf
<|skeleton|> class SoftCycleTest: def test_soft_cycle_allowed(self): """c.txt depends on a.txt, presumably to indicate that you have to build a.txt in order to get c.txt (c.txt is a side output of the instantiated rule for a.txt). That's fine because the instantiated rule for b.txt doesn't have its own rec...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SoftCycleTest: def test_soft_cycle_allowed(self): """c.txt depends on a.txt, presumably to indicate that you have to build a.txt in order to get c.txt (c.txt is a side output of the instantiated rule for a.txt). That's fine because the instantiated rule for b.txt doesn't have its own recipe, so there'...
the_stack_v2_python_sparse
t/test_soft_cycle.py
texttheater/produce
train
14
c1c91c5e57ec59ebc0286711031602876e1e37e7
[ "actions = self._default_attribute_actions.copy()\nactions['href'] = 'must'\nactions['title'] = 'drop'\nactions['class'] = 'keep'\nconverted = self._visit_open(node, children, actions)\nattrs = converted.attributes.attrs\nif 'href' in attrs:\n href = attrs['href'].value\n if href and href[0] == '/':\n ...
<|body_start_0|> actions = self._default_attribute_actions.copy() actions['href'] = 'must' actions['title'] = 'drop' actions['class'] = 'keep' converted = self._visit_open(node, children, actions) attrs = converted.attributes.attrs if 'href' in attrs: ...
Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting compat divs - Keeps <td colspan=# rowspan=#>, for detecting spanning compat cells...
KumaVisitor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KumaVisitor: """Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting compat divs - Keeps <td colspan=# rowspan=...
stack_v2_sparse_classes_75kplus_train_003216
38,117
no_license
[ { "docstring": "Validate and cleanup <a> open tags.", "name": "visit_a_open", "signature": "def visit_a_open(self, node, children)" }, { "docstring": "Retain id attribute of <div> tags.", "name": "visit_div_open", "signature": "def visit_div_open(self, node, children)" }, { "docs...
5
stack_v2_sparse_classes_30k_train_051703
Implement the Python class `KumaVisitor` described below. Class description: Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting com...
Implement the Python class `KumaVisitor` described below. Class description: Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting com...
bc092964153b03381aaff74a4d80f43a2b2dec19
<|skeleton|> class KumaVisitor: """Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting compat divs - Keeps <td colspan=# rowspan=...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KumaVisitor: """Extract HTML structure from a MDN Kuma raw fragment. Include extra policy for scraping pages for the importer: - Converts <span>content</span> to "content", with issues - Validate and cleanup <a> tags - Keeps <div id="foo">, for detecting compat divs - Keeps <td colspan=# rowspan=#>, for detec...
the_stack_v2_python_sparse
browsercompat/mdn/kumascript.py
WeilerWebServices/MDN-Web-Docs
train
1
6af4abf9e98904497b46e72a12c781b993ca5cb2
[ "aluno_selected = Aluno.query.filter_by(matricula=matricula)\nif not aluno_selected.first():\n return abort(400, 'Não existe aluno com essa matricula no banco de dados.')\nreturn AlunoSchema(many=True, only=('nome', 'matricula', 'curso')).dump(aluno_selected)", "parser = reqparse.RequestParser(bundle_errors=Tr...
<|body_start_0|> aluno_selected = Aluno.query.filter_by(matricula=matricula) if not aluno_selected.first(): return abort(400, 'Não existe aluno com essa matricula no banco de dados.') return AlunoSchema(many=True, only=('nome', 'matricula', 'curso')).dump(aluno_selected) <|end_body_0...
rota_acesso_unico_alunos
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class rota_acesso_unico_alunos: def get(self, matricula): """Retorna os dados de um aluno com a determinada matricula presente no banco de dados.""" <|body_0|> def put(self, matricula): """Atualiza as informações de um aluno com determinada matricula (a sua imagem só pode ...
stack_v2_sparse_classes_75kplus_train_003217
7,337
no_license
[ { "docstring": "Retorna os dados de um aluno com a determinada matricula presente no banco de dados.", "name": "get", "signature": "def get(self, matricula)" }, { "docstring": "Atualiza as informações de um aluno com determinada matricula (a sua imagem só pode ser atualizada com envio de 'formDa...
3
stack_v2_sparse_classes_30k_train_027615
Implement the Python class `rota_acesso_unico_alunos` described below. Class description: Implement the rota_acesso_unico_alunos class. Method signatures and docstrings: - def get(self, matricula): Retorna os dados de um aluno com a determinada matricula presente no banco de dados. - def put(self, matricula): Atualiz...
Implement the Python class `rota_acesso_unico_alunos` described below. Class description: Implement the rota_acesso_unico_alunos class. Method signatures and docstrings: - def get(self, matricula): Retorna os dados de um aluno com a determinada matricula presente no banco de dados. - def put(self, matricula): Atualiz...
130f59d7bf54e1238f5ba4d293acc4947dbbabbe
<|skeleton|> class rota_acesso_unico_alunos: def get(self, matricula): """Retorna os dados de um aluno com a determinada matricula presente no banco de dados.""" <|body_0|> def put(self, matricula): """Atualiza as informações de um aluno com determinada matricula (a sua imagem só pode ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class rota_acesso_unico_alunos: def get(self, matricula): """Retorna os dados de um aluno com a determinada matricula presente no banco de dados.""" aluno_selected = Aluno.query.filter_by(matricula=matricula) if not aluno_selected.first(): return abort(400, 'Não existe aluno com ...
the_stack_v2_python_sparse
core/APIs/alunos.py
angelomenezes/face-attendance-api
train
4
b488d2526603b4da5aadbf9db61454ea910b87e0
[ "response = super(PipelineDetail, self).retrieve(request, *args, **kwargs)\ntemplate_data = {'name': '', 'authors': '', 'category': '', 'description': ''}\npipeline = self.get_object()\nif pipeline.locked:\n template_data['locked'] = ''\nreturn services.append_collection_template(response, template_data)", "re...
<|body_start_0|> response = super(PipelineDetail, self).retrieve(request, *args, **kwargs) template_data = {'name': '', 'authors': '', 'category': '', 'description': ''} pipeline = self.get_object() if pipeline.locked: template_data['locked'] = '' return services.appe...
A pipeline view.
PipelineDetail
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PipelineDetail: """A pipeline view.""" def retrieve(self, request, *args, **kwargs): """Overriden to append a collection+json template.""" <|body_0|> def update(self, request, *args, **kwargs): """Overriden to remove parameters that are not allowed to be used on ...
stack_v2_sparse_classes_75kplus_train_003218
14,989
permissive
[ { "docstring": "Overriden to append a collection+json template.", "name": "retrieve", "signature": "def retrieve(self, request, *args, **kwargs)" }, { "docstring": "Overriden to remove parameters that are not allowed to be used on update, include required parameters if not in the request and del...
3
stack_v2_sparse_classes_30k_train_044196
Implement the Python class `PipelineDetail` described below. Class description: A pipeline 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 remove parameters that are not a...
Implement the Python class `PipelineDetail` described below. Class description: A pipeline 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 remove parameters that are not a...
20d3eedf20610af9182f6cca8db8f0b3546b5336
<|skeleton|> class PipelineDetail: """A pipeline view.""" def retrieve(self, request, *args, **kwargs): """Overriden to append a collection+json template.""" <|body_0|> def update(self, request, *args, **kwargs): """Overriden to remove parameters that are not allowed to be used on ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PipelineDetail: """A pipeline view.""" def retrieve(self, request, *args, **kwargs): """Overriden to append a collection+json template.""" response = super(PipelineDetail, self).retrieve(request, *args, **kwargs) template_data = {'name': '', 'authors': '', 'category': '', 'descrip...
the_stack_v2_python_sparse
chris_backend/pipelines/views.py
FNNDSC/ChRIS_ultron_backEnd
train
36
0bc1995012f335dc23954956458b64443310c7f2
[ "super(AdamWeightDecayOptimizer, self).__init__(False, name)\nself.learning_rate = learning_rate\nself.weight_decay_rate = weight_decay_rate\nself.beta_1 = beta_1\nself.beta_2 = beta_2\nself.epsilon = epsilon\nself.exclude_from_weight_decay = exclude_from_weight_decay\nself.pretrained_param_names = pretrained_param...
<|body_start_0|> super(AdamWeightDecayOptimizer, self).__init__(False, name) self.learning_rate = learning_rate self.weight_decay_rate = weight_decay_rate self.beta_1 = beta_1 self.beta_2 = beta_2 self.epsilon = epsilon self.exclude_from_weight_decay = exclude_fro...
A basic Adam optimizer that includes "correct" L2 weight decay.
AdamWeightDecayOptimizer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, pretrained_param_names=None, freeze_pretrained_steps=None, name='A...
stack_v2_sparse_classes_75kplus_train_003219
10,781
permissive
[ { "docstring": "Constructs a AdamWeightDecayOptimizer.", "name": "__init__", "signature": "def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, pretrained_param_names=None, freeze_pretrained_steps=None, name='AdamWeightDecayOpt...
4
stack_v2_sparse_classes_30k_train_001337
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None...
Implement the Python class `AdamWeightDecayOptimizer` described below. Class description: A basic Adam optimizer that includes "correct" L2 weight decay. Method signatures and docstrings: - def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None...
ac9447064195e06de48cc91ff642f7fffa28ffe8
<|skeleton|> class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, pretrained_param_names=None, freeze_pretrained_steps=None, name='A...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdamWeightDecayOptimizer: """A basic Adam optimizer that includes "correct" L2 weight decay.""" def __init__(self, learning_rate, weight_decay_rate=0.0, beta_1=0.9, beta_2=0.999, epsilon=1e-06, exclude_from_weight_decay=None, pretrained_param_names=None, freeze_pretrained_steps=None, name='AdamWeightDeca...
the_stack_v2_python_sparse
language/xsp/model/adam_weight_decay.py
google-research/language
train
1,567
4109b0a3748f7d5d98c91fd5f9cadfed173c5270
[ "self.batteries = {}\nfor section in cfg.sections():\n parts = section.split('.')\n if parts[0] == 'battery':\n name = parts[1]\n empty = cfg.getint(section, 'empty')\n full = cfg.getint(section, 'full')\n self.batteries[name] = Battery(empty, full)\nself.BATT_LOW = 30\nself.screen...
<|body_start_0|> self.batteries = {} for section in cfg.sections(): parts = section.split('.') if parts[0] == 'battery': name = parts[1] empty = cfg.getint(section, 'empty') full = cfg.getint(section, 'full') self.ba...
Contains the important state and functions for this script.
BatteryMonitor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatteryMonitor: """Contains the important state and functions for this script.""" def __init__(self, screen, cfg): """Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a RawConfigParser object that contains the battery configura...
stack_v2_sparse_classes_75kplus_train_003220
5,209
no_license
[ { "docstring": "Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a RawConfigParser object that contains the battery configuration information.", "name": "__init__", "signature": "def __init__(self, screen, cfg)" }, { "docstring": "A callba...
4
stack_v2_sparse_classes_30k_train_022339
Implement the Python class `BatteryMonitor` described below. Class description: Contains the important state and functions for this script. Method signatures and docstrings: - def __init__(self, screen, cfg): Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a R...
Implement the Python class `BatteryMonitor` described below. Class description: Contains the important state and functions for this script. Method signatures and docstrings: - def __init__(self, screen, cfg): Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a R...
52bacd9f58524090e0ab421a47714629249ca273
<|skeleton|> class BatteryMonitor: """Contains the important state and functions for this script.""" def __init__(self, screen, cfg): """Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a RawConfigParser object that contains the battery configura...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BatteryMonitor: """Contains the important state and functions for this script.""" def __init__(self, screen, cfg): """Constructor. @param screen: a curses window object on which the battery levels will be drawn. @param cfg: a RawConfigParser object that contains the battery configuration informat...
the_stack_v2_python_sparse
src/09-10/ubc-tbird-ros-pkg/sb_util/scripts/battery_monitor.py
jpearkes/snowbots
train
0
8c69a4f47b3ec26b96582d4559cd8a1a48e3960a
[ "Parametre.__init__(self, 'hisser', 'up')\nself.schema = '<nom_objet>'\nself.aide_courte = 'hisse le pavillon'\nself.aide_longue = 'Cette commande vous permet de hisser un pavillon en tête de mât (ou tout autre moyen disponible dans cette embarcation pour montrer vos couleurs). Vous devez préciser en paramètre un f...
<|body_start_0|> Parametre.__init__(self, 'hisser', 'up') self.schema = '<nom_objet>' self.aide_courte = 'hisse le pavillon' self.aide_longue = 'Cette commande vous permet de hisser un pavillon en tête de mât (ou tout autre moyen disponible dans cette embarcation pour montrer vos couleur...
Commande 'pavillon hisser'.
PrmHisser
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmHisser: """Commande 'pavillon hisser'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def ajouter(self): """Méthode appelée lors de l'ajout de la commande à l'interpréteur""" <|body_1|> def interpreter(self, personnage, dic_masq...
stack_v2_sparse_classes_75kplus_train_003221
4,119
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Méthode appelée lors de l'ajout de la commande à l'interpréteur", "name": "ajouter", "signature": "def ajouter(self)" }, { "docstring": "Interprétation du paramètr...
3
stack_v2_sparse_classes_30k_test_001731
Implement the Python class `PrmHisser` described below. Class description: Commande 'pavillon hisser'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def ajouter(self): Méthode appelée lors de l'ajout de la commande à l'interpréteur - def interpreter(self, personnage, dic_masques)...
Implement the Python class `PrmHisser` described below. Class description: Commande 'pavillon hisser'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def ajouter(self): Méthode appelée lors de l'ajout de la commande à l'interpréteur - def interpreter(self, personnage, dic_masques)...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmHisser: """Commande 'pavillon hisser'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def ajouter(self): """Méthode appelée lors de l'ajout de la commande à l'interpréteur""" <|body_1|> def interpreter(self, personnage, dic_masq...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrmHisser: """Commande 'pavillon hisser'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'hisser', 'up') self.schema = '<nom_objet>' self.aide_courte = 'hisse le pavillon' self.aide_longue = 'Cette commande vous permet de hisser un ...
the_stack_v2_python_sparse
src/secondaires/navigation/commandes/pavillon/hisser.py
vincent-lg/tsunami
train
5
2238757765430213ab6e26b875d4e1ef3d185747
[ "if data is empty:\n return True\nreturn not any(json.loads(data).values())", "if self.is_empty_i18n_data(data) and self.required:\n self.fail('required')\nreturn super().validate_empty_values(data)" ]
<|body_start_0|> if data is empty: return True return not any(json.loads(data).values()) <|end_body_0|> <|body_start_1|> if self.is_empty_i18n_data(data) and self.required: self.fail('required') return super().validate_empty_values(data) <|end_body_1|>
I18nCharField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class I18nCharField: def is_empty_i18n_data(data): """check for values in each language empty value example: {"en":""}""" <|body_0|> def validate_empty_values(self, data): """Empty i18n fields have the following format: {"en":""}, we have to decode json and check empty str...
stack_v2_sparse_classes_75kplus_train_003222
759
no_license
[ { "docstring": "check for values in each language empty value example: {\"en\":\"\"}", "name": "is_empty_i18n_data", "signature": "def is_empty_i18n_data(data)" }, { "docstring": "Empty i18n fields have the following format: {\"en\":\"\"}, we have to decode json and check empty strings for langu...
2
stack_v2_sparse_classes_30k_train_020791
Implement the Python class `I18nCharField` described below. Class description: Implement the I18nCharField class. Method signatures and docstrings: - def is_empty_i18n_data(data): check for values in each language empty value example: {"en":""} - def validate_empty_values(self, data): Empty i18n fields have the follo...
Implement the Python class `I18nCharField` described below. Class description: Implement the I18nCharField class. Method signatures and docstrings: - def is_empty_i18n_data(data): check for values in each language empty value example: {"en":""} - def validate_empty_values(self, data): Empty i18n fields have the follo...
338fd6396dbdce971bc542718fbb9608bdcfc2a7
<|skeleton|> class I18nCharField: def is_empty_i18n_data(data): """check for values in each language empty value example: {"en":""}""" <|body_0|> def validate_empty_values(self, data): """Empty i18n fields have the following format: {"en":""}, we have to decode json and check empty str...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class I18nCharField: def is_empty_i18n_data(data): """check for values in each language empty value example: {"en":""}""" if data is empty: return True return not any(json.loads(data).values()) def validate_empty_values(self, data): """Empty i18n fields have the foll...
the_stack_v2_python_sparse
api/custom_fields.py
sai9912/mypyton
train
0
a809226b9b44efdad9e007a1b1a8049b6a6f4856
[ "for row in matrix:\n for col in range(1, len(row)):\n row[col] += row[col - 1]\nself.matrix = matrix", "original = self.matrix[row][col]\nif col != 0:\n original -= self.matrix[row][col - 1]\ndiff = original - val\nfor y in xrange(col, len(self.matrix[0])):\n self.matrix[row][y] -= diff", "ans ...
<|body_start_0|> for row in matrix: for col in range(1, len(row)): row[col] += row[col - 1] self.matrix = matrix <|end_body_0|> <|body_start_1|> original = self.matrix[row][col] if col != 0: original -= self.matrix[row][col - 1] diff = ori...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def update(self, row, col, val): """:type row: int :type col: int :type val: int :rtype: None""" <|body_1|> def sumRegion(self, row1, col1, row2, col2): """:typ...
stack_v2_sparse_classes_75kplus_train_003223
1,190
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row: int :type col: int :type val: int :rtype: None", "name": "update", "signature": "def update(self, row, col, val)" }, { "docstring": ":type r...
3
stack_v2_sparse_classes_30k_train_027103
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: None - def sumRegion(self, row...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: None - def sumRegion(self, row...
06961cc468211b9692cd7a889ee38d1cd4e1d11e
<|skeleton|> class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def update(self, row, col, val): """:type row: int :type col: int :type val: int :rtype: None""" <|body_1|> def sumRegion(self, row1, col1, row2, col2): """:typ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NumMatrix: def __init__(self, matrix): """:type matrix: List[List[int]]""" for row in matrix: for col in range(1, len(row)): row[col] += row[col - 1] self.matrix = matrix def update(self, row, col, val): """:type row: int :type col: int :type va...
the_stack_v2_python_sparse
308. Range Sum Query 2D - Mutable.py
peraktong/LEETCODE_Jason
train
0
f0ed4f1772fffb8e3b610de102c02102e7619c7b
[ "super(TokenEmbedding, self).__init__()\nself.num_embeddings = num_embeddings\nself.embedding_dim = embedding_dim\nself.embeddings = nn.Embedding(num_embeddings, embedding_dim)\nif static:\n for param in self.embeddings.parameters():\n param.requires_grad = False\nif output_dim:\n self.output_dim = out...
<|body_start_0|> super(TokenEmbedding, self).__init__() self.num_embeddings = num_embeddings self.embedding_dim = embedding_dim self.embeddings = nn.Embedding(num_embeddings, embedding_dim) if static: for param in self.embeddings.parameters(): param.re...
Token embedding.
TokenEmbedding
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenEmbedding: """Token embedding.""" def __init__(self, num_embeddings, embedding_dim, output_dim=None, static=True): """Create an embedding for the tokens in a sequence. The input is a tensor of token indices, the output is the embedding of each tokens. Parameters: :param: num_emb...
stack_v2_sparse_classes_75kplus_train_003224
8,938
permissive
[ { "docstring": "Create an embedding for the tokens in a sequence. The input is a tensor of token indices, the output is the embedding of each tokens. Parameters: :param: num_embeddings (int): the size of the dictionary (i.e. the number of tokens) :param: embedding_dim (int): the size of the embedding vectors :p...
2
null
Implement the Python class `TokenEmbedding` described below. Class description: Token embedding. Method signatures and docstrings: - def __init__(self, num_embeddings, embedding_dim, output_dim=None, static=True): Create an embedding for the tokens in a sequence. The input is a tensor of token indices, the output is ...
Implement the Python class `TokenEmbedding` described below. Class description: Token embedding. Method signatures and docstrings: - def __init__(self, num_embeddings, embedding_dim, output_dim=None, static=True): Create an embedding for the tokens in a sequence. The input is a tensor of token indices, the output is ...
0f778988abeb1628c76cc944740451fe59bb43b7
<|skeleton|> class TokenEmbedding: """Token embedding.""" def __init__(self, num_embeddings, embedding_dim, output_dim=None, static=True): """Create an embedding for the tokens in a sequence. The input is a tensor of token indices, the output is the embedding of each tokens. Parameters: :param: num_emb...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TokenEmbedding: """Token embedding.""" def __init__(self, num_embeddings, embedding_dim, output_dim=None, static=True): """Create an embedding for the tokens in a sequence. The input is a tensor of token indices, the output is the embedding of each tokens. Parameters: :param: num_embeddings (int)...
the_stack_v2_python_sparse
Baseline/mrcqa/modules/embeddings.py
microsoft/MSMARCO-Question-Answering
train
159
2c160e3d78b731a3acb332ccdd3af099038d4c85
[ "if read_first:\n self.policy_1, self.i_epoch = pickle.load(open(path, 'rb'))\n print('Policy read from file. Trained for %i epochs.' % self.i_epoch)\nself.path = path\nself.i_epoch = 0\nself.policy_1 = TabularPolicy()", "self.policy_2 = TabularPolicy()\nreturns = dict()\nfor num in range(int('1' + '0' * 9,...
<|body_start_0|> if read_first: self.policy_1, self.i_epoch = pickle.load(open(path, 'rb')) print('Policy read from file. Trained for %i epochs.' % self.i_epoch) self.path = path self.i_epoch = 0 self.policy_1 = TabularPolicy() <|end_body_0|> <|body_start_1|> ...
TrainOneRound
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainOneRound: def __init__(self, path, read_first=False): """Input: path: the path to save the policy read_first: if true, read from the path first""" <|body_0|> def MCPrediction(self, n_epoch): """MC prediction following Sutton Barto 5.1 Against rush opponent Input...
stack_v2_sparse_classes_75kplus_train_003225
2,243
no_license
[ { "docstring": "Input: path: the path to save the policy read_first: if true, read from the path first", "name": "__init__", "signature": "def __init__(self, path, read_first=False)" }, { "docstring": "MC prediction following Sutton Barto 5.1 Against rush opponent Input: n_epoch: the number of e...
2
stack_v2_sparse_classes_30k_train_023941
Implement the Python class `TrainOneRound` described below. Class description: Implement the TrainOneRound class. Method signatures and docstrings: - def __init__(self, path, read_first=False): Input: path: the path to save the policy read_first: if true, read from the path first - def MCPrediction(self, n_epoch): MC...
Implement the Python class `TrainOneRound` described below. Class description: Implement the TrainOneRound class. Method signatures and docstrings: - def __init__(self, path, read_first=False): Input: path: the path to save the policy read_first: if true, read from the path first - def MCPrediction(self, n_epoch): MC...
5831d4c1eaf21d41007eb6988f3c9885b55d13b2
<|skeleton|> class TrainOneRound: def __init__(self, path, read_first=False): """Input: path: the path to save the policy read_first: if true, read from the path first""" <|body_0|> def MCPrediction(self, n_epoch): """MC prediction following Sutton Barto 5.1 Against rush opponent Input...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TrainOneRound: def __init__(self, path, read_first=False): """Input: path: the path to save the policy read_first: if true, read from the path first""" if read_first: self.policy_1, self.i_epoch = pickle.load(open(path, 'rb')) print('Policy read from file. Trained for %...
the_stack_v2_python_sparse
ttt_train_mc_prediction.py
sw2703/rl_tictactoe
train
0
001f73e9d51180d1b7846fc0a0d30b35af1dc76c
[ "super(SwallowCritic, self).__init__()\nself.device = device\nself.layer1 = torch.nn.Sequential(torch.nn.Linear(input_shape[0], 64), torch.nn.ReLU())\nself.layer2 = torch.nn.Sequential(torch.nn.Linear(64, 32), torch.nn.ReLU())\nself.critic = torch.nn.Linear(32, output_shape)", "x = x.to(self.device)\nx = self.lay...
<|body_start_0|> super(SwallowCritic, self).__init__() self.device = device self.layer1 = torch.nn.Sequential(torch.nn.Linear(input_shape[0], 64), torch.nn.ReLU()) self.layer2 = torch.nn.Sequential(torch.nn.Linear(64, 32), torch.nn.ReLU()) self.critic = torch.nn.Linear(32, output...
SwallowCritic
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwallowCritic: def __init__(self, input_shape, output_shape=1, device=torch.device('cpu')): """Una red neorunal que produce un valor contínuo. Se utiliza para representar el papel del crítico en A2C. Estima el valor de la observación / estado actual :param input_shape: Forma de los datos...
stack_v2_sparse_classes_75kplus_train_003226
6,347
permissive
[ { "docstring": "Una red neorunal que produce un valor contínuo. Se utiliza para representar el papel del crítico en A2C. Estima el valor de la observación / estado actual :param input_shape: Forma de los datos de entrada (representan las observaciones del actor) :param output_shape: Forma de los datos de salida...
2
stack_v2_sparse_classes_30k_train_037007
Implement the Python class `SwallowCritic` described below. Class description: Implement the SwallowCritic class. Method signatures and docstrings: - def __init__(self, input_shape, output_shape=1, device=torch.device('cpu')): Una red neorunal que produce un valor contínuo. Se utiliza para representar el papel del cr...
Implement the Python class `SwallowCritic` described below. Class description: Implement the SwallowCritic class. Method signatures and docstrings: - def __init__(self, input_shape, output_shape=1, device=torch.device('cpu')): Una red neorunal que produce un valor contínuo. Se utiliza para representar el papel del cr...
5e987fac269afcb8f43aa9da1d07e34e1e036948
<|skeleton|> class SwallowCritic: def __init__(self, input_shape, output_shape=1, device=torch.device('cpu')): """Una red neorunal que produce un valor contínuo. Se utiliza para representar el papel del crítico en A2C. Estima el valor de la observación / estado actual :param input_shape: Forma de los datos...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SwallowCritic: def __init__(self, input_shape, output_shape=1, device=torch.device('cpu')): """Una red neorunal que produce un valor contínuo. Se utiliza para representar el papel del crítico en A2C. Estima el valor de la observación / estado actual :param input_shape: Forma de los datos de entrada (r...
the_stack_v2_python_sparse
tema5/function_aproximator/swallow.py
dabamascodes/ia-course
train
1
009f894c80f4e38fa9a68179511d9c76c36abee2
[ "if self.nb_rects == 0 or self.nb_steps >= self.max_iter or self.stuck:\n return False\nreturn True", "row = random.randint(0, self.nb_rows - 1)\ncolumn = random.randint(0, self.nb_columns - 1)\nfor colour in self.grid[row]:\n if self.grid[row][colour] & 2 ** column:\n current_colour = colour\n ...
<|body_start_0|> if self.nb_rects == 0 or self.nb_steps >= self.max_iter or self.stuck: return False return True <|end_body_0|> <|body_start_1|> row = random.randint(0, self.nb_rows - 1) column = random.randint(0, self.nb_columns - 1) for colour in self.grid[row]: ...
Solves a given grid by picking a point at random and attempting to change its colour; if it reduces the number of problematic point, we keep the solution.
RandomDotGreedySolver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomDotGreedySolver: """Solves a given grid by picking a point at random and attempting to change its colour; if it reduces the number of problematic point, we keep the solution.""" def not_done(self): """simple method to determine if the solver must terminate""" <|body_0|>...
stack_v2_sparse_classes_75kplus_train_003227
12,324
no_license
[ { "docstring": "simple method to determine if the solver must terminate", "name": "not_done", "signature": "def not_done(self)" }, { "docstring": "pick a point (row, column) at random and change its colour", "name": "pick_new_configuration", "signature": "def pick_new_configuration(self)...
4
stack_v2_sparse_classes_30k_train_026285
Implement the Python class `RandomDotGreedySolver` described below. Class description: Solves a given grid by picking a point at random and attempting to change its colour; if it reduces the number of problematic point, we keep the solution. Method signatures and docstrings: - def not_done(self): simple method to det...
Implement the Python class `RandomDotGreedySolver` described below. Class description: Solves a given grid by picking a point at random and attempting to change its colour; if it reduces the number of problematic point, we keep the solution. Method signatures and docstrings: - def not_done(self): simple method to det...
dd721e096f8445aee48e69c3a3ebf6501aecc95b
<|skeleton|> class RandomDotGreedySolver: """Solves a given grid by picking a point at random and attempting to change its colour; if it reduces the number of problematic point, we keep the solution.""" def not_done(self): """simple method to determine if the solver must terminate""" <|body_0|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomDotGreedySolver: """Solves a given grid by picking a point at random and attempting to change its colour; if it reduces the number of problematic point, we keep the solution.""" def not_done(self): """simple method to determine if the solver must terminate""" if self.nb_rects == 0 o...
the_stack_v2_python_sparse
grid_challenge/solver.py
aroberge/py-fun
train
0
ac996c3aeac95f3dbcd99eda132bfb007a11c3ae
[ "self.latlon = latlon\nself.mag = mag\nself.delta_logl = delta_logl\nself.delta_logw = delta_logw\nself.depth_offset = depth_offset", "lat = sample['latitude']\nlon = sample['longitude']\nmag = sample['magnitude']\ndelta_logl = sample['delta_logl']\ndelta_logw = sample['delta_logw']\ndepth_offset = sample['depth_...
<|body_start_0|> self.latlon = latlon self.mag = mag self.delta_logl = delta_logl self.delta_logw = delta_logw self.depth_offset = depth_offset <|end_body_0|> <|body_start_1|> lat = sample['latitude'] lon = sample['longitude'] mag = sample['magnitude'] ...
The child class of Base Prior that creates a prior distribution, specifically for the Banda 1852 event.
BandaPrior
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BandaPrior: """The child class of Base Prior that creates a prior distribution, specifically for the Banda 1852 event.""" def __init__(self, latlon, mag, delta_logl, delta_logw, depth_offset): """Initializes all the necessary variables for the subclass. Parameters ---------- latlon :...
stack_v2_sparse_classes_75kplus_train_003228
8,162
no_license
[ { "docstring": "Initializes all the necessary variables for the subclass. Parameters ---------- latlon : LatLonPrior Object Contains attirbutes fault and depth_dist, with methods logpdf, pdf, and rvs. mag : scipy.stats rv_frozen object A truncated continous random variable describing the sample's magnitude with...
3
null
Implement the Python class `BandaPrior` described below. Class description: The child class of Base Prior that creates a prior distribution, specifically for the Banda 1852 event. Method signatures and docstrings: - def __init__(self, latlon, mag, delta_logl, delta_logw, depth_offset): Initializes all the necessary v...
Implement the Python class `BandaPrior` described below. Class description: The child class of Base Prior that creates a prior distribution, specifically for the Banda 1852 event. Method signatures and docstrings: - def __init__(self, latlon, mag, delta_logl, delta_logw, depth_offset): Initializes all the necessary v...
c537a77ea071d4d8fc0590771efe1ec7646536e5
<|skeleton|> class BandaPrior: """The child class of Base Prior that creates a prior distribution, specifically for the Banda 1852 event.""" def __init__(self, latlon, mag, delta_logl, delta_logw, depth_offset): """Initializes all the necessary variables for the subclass. Parameters ---------- latlon :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BandaPrior: """The child class of Base Prior that creates a prior distribution, specifically for the Banda 1852 event.""" def __init__(self, latlon, mag, delta_logl, delta_logw, depth_offset): """Initializes all the necessary variables for the subclass. Parameters ---------- latlon : LatLonPrior ...
the_stack_v2_python_sparse
scenarios/banda_1852/prior.py
jpw37/tsunamibayes
train
11
885528bbd45f9e7fdc481b7a529841bf8339c662
[ "self.url = url\nself.repo = repo\nself.name = cookbook_name\nself.version = version\nself.manager = who", "folder = './cookbooks/'\nmsg = 'En el getCookbook. \\n '\nset_info_log('url: ' + self.url + '. name: ' + folder + self.name)\nif self.repo == 'svn':\n try:\n Client().checkout(self.url, folder + s...
<|body_start_0|> self.url = url self.repo = repo self.name = cookbook_name self.version = version self.manager = who <|end_body_0|> <|body_start_1|> folder = './cookbooks/' msg = 'En el getCookbook. \n ' set_info_log('url: ' + self.url + '. name: ' + fold...
Download
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Download: def __init__(self, url, repo, cookbook_name, version, who): """Initial parameters @param url: The url of the repository @param repo: kind os repository @param cookbook_name: software name @param version: software version @param who: configuration management type @return: None i...
stack_v2_sparse_classes_75kplus_train_003229
3,001
no_license
[ { "docstring": "Initial parameters @param url: The url of the repository @param repo: kind os repository @param cookbook_name: software name @param version: software version @param who: configuration management type @return: None if all OK or an error on failure", "name": "__init__", "signature": "def _...
3
stack_v2_sparse_classes_30k_train_038975
Implement the Python class `Download` described below. Class description: Implement the Download class. Method signatures and docstrings: - def __init__(self, url, repo, cookbook_name, version, who): Initial parameters @param url: The url of the repository @param repo: kind os repository @param cookbook_name: softwar...
Implement the Python class `Download` described below. Class description: Implement the Download class. Method signatures and docstrings: - def __init__(self, url, repo, cookbook_name, version, who): Initial parameters @param url: The url of the repository @param repo: kind os repository @param cookbook_name: softwar...
34e1cb245b88789e779282db88108dd512e24bac
<|skeleton|> class Download: def __init__(self, url, repo, cookbook_name, version, who): """Initial parameters @param url: The url of the repository @param repo: kind os repository @param cookbook_name: software name @param version: software version @param who: configuration management type @return: None i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Download: def __init__(self, url, repo, cookbook_name, version, who): """Initial parameters @param url: The url of the repository @param repo: kind os repository @param cookbook_name: software name @param version: software version @param who: configuration management type @return: None if all OK or an...
the_stack_v2_python_sparse
recipes/download.py
telefonicaid/fiware-uploadrecipes
train
0
4da3f11a9429588354e0a02bb2992b752b8deaa4
[ "if factory is not None:\n self.set_default_kind(DEFAULT_FACTORY, factory)\nelif args is not None or kwargs is not None:\n args = args or ()\n kwargs = kwargs or {}\n self.set_default_kind(USER_DEFAULT, (args, kwargs))\nelse:\n self.set_default_kind(DEFAULT_VALUE, None)\nself.set_validate_kind(USER_V...
<|body_start_0|> if factory is not None: self.set_default_kind(DEFAULT_FACTORY, factory) elif args is not None or kwargs is not None: args = args or () kwargs = kwargs or {} self.set_default_kind(USER_DEFAULT, (args, kwargs)) else: self...
An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance.
ForwardInstance
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForwardInstance: """An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance.""" def __init__(self, resolve, factory=None, args=None, kwargs=None):...
stack_v2_sparse_classes_75kplus_train_003230
4,941
permissive
[ { "docstring": "Initialize a ForwardInstance. resolve : callable A callable which takes no arguments and returns the type or tuple of types to use for validating the values. factory : callable, optional An optional factory to use for creating the default value. If this is not provided and 'args' and 'kwargs' is...
3
stack_v2_sparse_classes_30k_train_017455
Implement the Python class `ForwardInstance` described below. Class description: An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance. Method signatures and docstrings: ...
Implement the Python class `ForwardInstance` described below. Class description: An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance. Method signatures and docstrings: ...
1f194e3550d62c4ca1d79521dff97531ffe3f0ac
<|skeleton|> class ForwardInstance: """An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance.""" def __init__(self, resolve, factory=None, args=None, kwargs=None):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ForwardInstance: """An Instance which delays resolving the type definition. The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance.""" def __init__(self, resolve, factory=None, args=None, kwargs=None): """I...
the_stack_v2_python_sparse
atom/instance.py
enthought/atom
train
0
f8ee82da5e5e5c8e58fe06ba91e15fddab3a5999
[ "self.variables = {}\ntry:\n JoinVariablesPass(tree)\n InitialTypeInfoPass(tree, self)\n PropagateTypes(tree, self)\n AssignmentsPass(tree)\n FunctionCallsPass(tree)\n TransformIndexExpressionPass(tree)\n LastCleanupPass(tree)\nexcept MCError as err:\n print('/Error when doing semantic analy...
<|body_start_0|> self.variables = {} try: JoinVariablesPass(tree) InitialTypeInfoPass(tree, self) PropagateTypes(tree, self) AssignmentsPass(tree) FunctionCallsPass(tree) TransformIndexExpressionPass(tree) LastCleanupPas...
A user defined payoff expression, including vars and params
UDMCSemanticAnalyzer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UDMCSemanticAnalyzer: """A user defined payoff expression, including vars and params""" def __init__(self, tree): """Create an instance given text definition""" <|body_0|> def add_variable(self, varname, vartype, isparam, isprocess, initinfo, impid): """Add a var...
stack_v2_sparse_classes_75kplus_train_003231
15,420
no_license
[ { "docstring": "Create an instance given text definition", "name": "__init__", "signature": "def __init__(self, tree)" }, { "docstring": "Add a variable", "name": "add_variable", "signature": "def add_variable(self, varname, vartype, isparam, isprocess, initinfo, impid)" }, { "do...
3
stack_v2_sparse_classes_30k_train_010294
Implement the Python class `UDMCSemanticAnalyzer` described below. Class description: A user defined payoff expression, including vars and params Method signatures and docstrings: - def __init__(self, tree): Create an instance given text definition - def add_variable(self, varname, vartype, isparam, isprocess, initin...
Implement the Python class `UDMCSemanticAnalyzer` described below. Class description: A user defined payoff expression, including vars and params Method signatures and docstrings: - def __init__(self, tree): Create an instance given text definition - def add_variable(self, varname, vartype, isparam, isprocess, initin...
5e7cc7de3495145501ca53deb9efee2233ab7e1c
<|skeleton|> class UDMCSemanticAnalyzer: """A user defined payoff expression, including vars and params""" def __init__(self, tree): """Create an instance given text definition""" <|body_0|> def add_variable(self, varname, vartype, isparam, isprocess, initinfo, impid): """Add a var...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UDMCSemanticAnalyzer: """A user defined payoff expression, including vars and params""" def __init__(self, tree): """Create an instance given text definition""" self.variables = {} try: JoinVariablesPass(tree) InitialTypeInfoPass(tree, self) Pro...
the_stack_v2_python_sparse
Extensions/UDMCMod/FPythonCode/FUDMCSemanticAnalyzer_CPP.py
webclinic017/fa-absa-py3
train
0
6d6aec76675c2519488a5937ebbd17df5715afb1
[ "self.__dmd = getUtility(IDataRootFactory)()\nself.__modeling_pause_timeout = modeling_pause_timeout\nself.__priority = getattr(ServiceCallPriority, modeling_priority)", "if self.__dmd.getPauseADMLife() <= self.__modeling_pause_timeout:\n return [self.__priority]\nreturn []" ]
<|body_start_0|> self.__dmd = getUtility(IDataRootFactory)() self.__modeling_pause_timeout = modeling_pause_timeout self.__priority = getattr(ServiceCallPriority, modeling_priority) <|end_body_0|> <|body_start_1|> if self.__dmd.getPauseADMLife() <= self.__modeling_pause_timeout: ...
A predicate that reports whether modeling is paused. ModelingPaused instances can be used as predicates due to their return values having boolean properties. When modeling is paused, i.e. the predicate is true, then paused = ModelingPaused(dmd, Priority.MODELING, 60) assert bool(paused()) is True assert [Priority.MODEL...
ModelingPaused
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelingPaused: """A predicate that reports whether modeling is paused. ModelingPaused instances can be used as predicates due to their return values having boolean properties. When modeling is paused, i.e. the predicate is true, then paused = ModelingPaused(dmd, Priority.MODELING, 60) assert boo...
stack_v2_sparse_classes_75kplus_train_003232
10,770
no_license
[ { "docstring": "Initialize a ModelingPaused instance. :param modeling_priority: Priority for modeling calls :param float modeling_pause_timeout: Duration of modeling pause", "name": "__init__", "signature": "def __init__(self, modeling_priority, modeling_pause_timeout)" }, { "docstring": "Return...
2
stack_v2_sparse_classes_30k_train_046033
Implement the Python class `ModelingPaused` described below. Class description: A predicate that reports whether modeling is paused. ModelingPaused instances can be used as predicates due to their return values having boolean properties. When modeling is paused, i.e. the predicate is true, then paused = ModelingPaused...
Implement the Python class `ModelingPaused` described below. Class description: A predicate that reports whether modeling is paused. ModelingPaused instances can be used as predicates due to their return values having boolean properties. When modeling is paused, i.e. the predicate is true, then paused = ModelingPaused...
1ea508c3d2b51742bc3b448c445cd0a3dba9e798
<|skeleton|> class ModelingPaused: """A predicate that reports whether modeling is paused. ModelingPaused instances can be used as predicates due to their return values having boolean properties. When modeling is paused, i.e. the predicate is true, then paused = ModelingPaused(dmd, Priority.MODELING, 60) assert boo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ModelingPaused: """A predicate that reports whether modeling is paused. ModelingPaused instances can be used as predicates due to their return values having boolean properties. When modeling is paused, i.e. the predicate is true, then paused = ModelingPaused(dmd, Priority.MODELING, 60) assert bool(paused()) i...
the_stack_v2_python_sparse
Products/ZenHub/server/priority.py
zenoss/zenoss-prodbin
train
27
1ea4e1b5e0f73331d785fa74b5e23be9c4629c59
[ "path_sub = 'data/ds005/sub%s/' % sub_id\npath_run = 'task001_run%s' % run_id\npath_behav = path_sub + 'behav/' + path_run + '/behavdata.txt'\nraw = np.array([row.split() for row in list(open(path_behav))[1:]])\nkept_rows = raw[:, 4] != '0' if rm_nonresp else np.arange(raw.shape[0])\nrare = raw[kept_rows].astype('f...
<|body_start_0|> path_sub = 'data/ds005/sub%s/' % sub_id path_run = 'task001_run%s' % run_id path_behav = path_sub + 'behav/' + path_run + '/behavdata.txt' raw = np.array([row.split() for row in list(open(path_behav))[1:]]) kept_rows = raw[:, 4] != '0' if rm_nonresp else np.arang...
This class allows organization of the data by runs. In addition to the behavioral data, it also contains as subobjects the raw and filtered data.
ds005
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ds005: """This class allows organization of the data by runs. In addition to the behavioral data, it also contains as subobjects the raw and filtered data.""" def __init__(self, sub_id, run_id, rm_nonresp=True): """Each object of this class created contains both sets of fMRI data alo...
stack_v2_sparse_classes_75kplus_train_003233
9,808
no_license
[ { "docstring": "Each object of this class created contains both sets of fMRI data along with the corresponding behavioral data. Parameters ---------- sub_id : str Unique key used to identify the subject (i.e., 001, ..., 016) run_id : str Unique key used to identify the run number (i.e, 001, ..., 003) rm_nonresp...
4
stack_v2_sparse_classes_30k_train_030264
Implement the Python class `ds005` described below. Class description: This class allows organization of the data by runs. In addition to the behavioral data, it also contains as subobjects the raw and filtered data. Method signatures and docstrings: - def __init__(self, sub_id, run_id, rm_nonresp=True): Each object ...
Implement the Python class `ds005` described below. Class description: This class allows organization of the data by runs. In addition to the behavioral data, it also contains as subobjects the raw and filtered data. Method signatures and docstrings: - def __init__(self, sub_id, run_id, rm_nonresp=True): Each object ...
3fa926c3a2b8ebf1d7af1e12fe50b62587885a24
<|skeleton|> class ds005: """This class allows organization of the data by runs. In addition to the behavioral data, it also contains as subobjects the raw and filtered data.""" def __init__(self, sub_id, run_id, rm_nonresp=True): """Each object of this class created contains both sets of fMRI data alo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ds005: """This class allows organization of the data by runs. In addition to the behavioral data, it also contains as subobjects the raw and filtered data.""" def __init__(self, sub_id, run_id, rm_nonresp=True): """Each object of this class created contains both sets of fMRI data along with the c...
the_stack_v2_python_sparse
code/utils/make_class.py
berkeley-stat159/project-delta
train
4
d8fd92235c7250909a84326b40d03d184af10f6f
[ "rst = {'data': {'list': []}}\ntry:\n rst['errcode'] = 0\n page_num = int(request.params['pageNum']) - 1\n page_size = int(request.params['pageSize'])\n query = request.params['query']\n model = http.request.env['project_manage.project_manage']\n domain = []\n if query and query != '':\n ...
<|body_start_0|> rst = {'data': {'list': []}} try: rst['errcode'] = 0 page_num = int(request.params['pageNum']) - 1 page_size = int(request.params['pageSize']) query = request.params['query'] model = http.request.env['project_manage.project_man...
接口
ProjectManage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectManage: """接口""" def get_project(self, **kw): """取得所有的项目 :param kw: :return:""" <|body_0|> def get_project_info(self, **kw): """取得项目信息 :param kw: :return:""" <|body_1|> def get_project_info(self, **kw): """获取登陆用户的信息 :param kw: :return:...
stack_v2_sparse_classes_75kplus_train_003234
3,532
no_license
[ { "docstring": "取得所有的项目 :param kw: :return:", "name": "get_project", "signature": "def get_project(self, **kw)" }, { "docstring": "取得项目信息 :param kw: :return:", "name": "get_project_info", "signature": "def get_project_info(self, **kw)" }, { "docstring": "获取登陆用户的信息 :param kw: :ret...
3
stack_v2_sparse_classes_30k_train_029264
Implement the Python class `ProjectManage` described below. Class description: 接口 Method signatures and docstrings: - def get_project(self, **kw): 取得所有的项目 :param kw: :return: - def get_project_info(self, **kw): 取得项目信息 :param kw: :return: - def get_project_info(self, **kw): 获取登陆用户的信息 :param kw: :return:
Implement the Python class `ProjectManage` described below. Class description: 接口 Method signatures and docstrings: - def get_project(self, **kw): 取得所有的项目 :param kw: :return: - def get_project_info(self, **kw): 取得项目信息 :param kw: :return: - def get_project_info(self, **kw): 获取登陆用户的信息 :param kw: :return: <|skeleton|> ...
13b428a5c4ade6278e3e5e996ef10d9fb0fea4b9
<|skeleton|> class ProjectManage: """接口""" def get_project(self, **kw): """取得所有的项目 :param kw: :return:""" <|body_0|> def get_project_info(self, **kw): """取得项目信息 :param kw: :return:""" <|body_1|> def get_project_info(self, **kw): """获取登陆用户的信息 :param kw: :return:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProjectManage: """接口""" def get_project(self, **kw): """取得所有的项目 :param kw: :return:""" rst = {'data': {'list': []}} try: rst['errcode'] = 0 page_num = int(request.params['pageNum']) - 1 page_size = int(request.params['pageSize']) que...
the_stack_v2_python_sparse
mdias_addons/project_manage/controllers/controllers.py
rezaghanimi/main_mdias
train
0
67c3863e5e0f5f1ca16558756c129d21122b1e0b
[ "Parametre.__init__(self, 'éditer', 'edit')\nself.groupe = 'administrateur'\nself.schema = '<nombre> <message>'\nself.aide_courte = 'édite la feuille de route'\nself.aide_longue = 'Cette sous-commande permet d\\'éditer la feuille de route. Elle prend en premier paramètre le numéro de l\\'élément à éditer tel que vo...
<|body_start_0|> Parametre.__init__(self, 'éditer', 'edit') self.groupe = 'administrateur' self.schema = '<nombre> <message>' self.aide_courte = 'édite la feuille de route' self.aide_longue = 'Cette sous-commande permet d\'éditer la feuille de route. Elle prend en premier paramèt...
Commande 'roadmap éditer'.
PrmEditer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmEditer: """Commande 'roadmap éditer'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|> <|body_start_0|> Parametre._...
stack_v2_sparse_classes_75kplus_train_003235
4,189
permissive
[ { "docstring": "Constructeur du paramètre", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Interprétation du paramètre", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
stack_v2_sparse_classes_30k_train_021259
Implement the Python class `PrmEditer` described below. Class description: Commande 'roadmap éditer'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre
Implement the Python class `PrmEditer` described below. Class description: Commande 'roadmap éditer'. Method signatures and docstrings: - def __init__(self): Constructeur du paramètre - def interpreter(self, personnage, dic_masques): Interprétation du paramètre <|skeleton|> class PrmEditer: """Commande 'roadmap ...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmEditer: """Commande 'roadmap éditer'.""" def __init__(self): """Constructeur du paramètre""" <|body_0|> def interpreter(self, personnage, dic_masques): """Interprétation du paramètre""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrmEditer: """Commande 'roadmap éditer'.""" def __init__(self): """Constructeur du paramètre""" Parametre.__init__(self, 'éditer', 'edit') self.groupe = 'administrateur' self.schema = '<nombre> <message>' self.aide_courte = 'édite la feuille de route' self....
the_stack_v2_python_sparse
src/primaires/information/commandes/roadmap/editer.py
vincent-lg/tsunami
train
5
43d4b7b7ffb85ed309077166842d47c14b6fdbad
[ "sess = super().create_session(user_id)\nif sess is None:\n return None\nUserSession(user_id=user_id, session_id=sess).save()\nreturn sess", "if session_id is None:\n return None\nsession_dictionary = None\nif session_id not in SessionAuth.user_id_by_session_id.keys():\n sessData = UserSession.search({'s...
<|body_start_0|> sess = super().create_session(user_id) if sess is None: return None UserSession(user_id=user_id, session_id=sess).save() return sess <|end_body_0|> <|body_start_1|> if session_id is None: return None session_dictionary = None ...
The session auth class with expiration
SessionDBAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionDBAuth: """The session auth class with expiration""" def create_session(self, user_id=None): """create a new session for a user overloaded""" <|body_0|> def user_id_for_session_id(self, session_id=None): """get the user id for a session overloaded""" ...
stack_v2_sparse_classes_75kplus_train_003236
2,111
no_license
[ { "docstring": "create a new session for a user overloaded", "name": "create_session", "signature": "def create_session(self, user_id=None)" }, { "docstring": "get the user id for a session overloaded", "name": "user_id_for_session_id", "signature": "def user_id_for_session_id(self, sess...
3
stack_v2_sparse_classes_30k_train_003277
Implement the Python class `SessionDBAuth` described below. Class description: The session auth class with expiration Method signatures and docstrings: - def create_session(self, user_id=None): create a new session for a user overloaded - def user_id_for_session_id(self, session_id=None): get the user id for a sessio...
Implement the Python class `SessionDBAuth` described below. Class description: The session auth class with expiration Method signatures and docstrings: - def create_session(self, user_id=None): create a new session for a user overloaded - def user_id_for_session_id(self, session_id=None): get the user id for a sessio...
231a975bbaa60233e5e5260d91c968e865bb85a7
<|skeleton|> class SessionDBAuth: """The session auth class with expiration""" def create_session(self, user_id=None): """create a new session for a user overloaded""" <|body_0|> def user_id_for_session_id(self, session_id=None): """get the user id for a session overloaded""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SessionDBAuth: """The session auth class with expiration""" def create_session(self, user_id=None): """create a new session for a user overloaded""" sess = super().create_session(user_id) if sess is None: return None UserSession(user_id=user_id, session_id=sess...
the_stack_v2_python_sparse
0x07-Session_authentication/api/v1/auth/session_db_auth.py
maybe-william/holbertonschool-web_back_end
train
0
59a010135f9132fa0ae4044e581d8764292992be
[ "self.public_name = name\nself.private_name = '_' + name\nself.default_name = 'default_' + ''.join(name.split('_'))", "default = getattr(obj, self.default_name)\nd = getattr(obj, self.private_name)\nif d is not None:\n return d\nreturn defaultdict(lambda: default)", "if not value:\n return\nif isinstance(...
<|body_start_0|> self.public_name = name self.private_name = '_' + name self.default_name = 'default_' + ''.join(name.split('_')) <|end_body_0|> <|body_start_1|> default = getattr(obj, self.default_name) d = getattr(obj, self.private_name) if d is not None: r...
Descriptor for color dictionaries. To use this descriptor, some requirements need to be fulfilled. The descriptor should be assigned to a class attribute that has a protected counterpart that will hold the actual dictionary values, and a corresponding attribute that defines the default value for missing colors. Both th...
ColorDict
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ColorDict: """Descriptor for color dictionaries. To use this descriptor, some requirements need to be fulfilled. The descriptor should be assigned to a class attribute that has a protected counterpart that will hold the actual dictionary values, and a corresponding attribute that defines the defa...
stack_v2_sparse_classes_75kplus_train_003237
4,102
permissive
[ { "docstring": "Record the name of the attribute this descriptor is assigned to. The attribute name is then used to identify the corresponding private attribute, and the attribute containing a default value. Parameters ---------- owner : object The class owning the attribute. name : str The name of the attribut...
3
null
Implement the Python class `ColorDict` described below. Class description: Descriptor for color dictionaries. To use this descriptor, some requirements need to be fulfilled. The descriptor should be assigned to a class attribute that has a protected counterpart that will hold the actual dictionary values, and a corres...
Implement the Python class `ColorDict` described below. Class description: Descriptor for color dictionaries. To use this descriptor, some requirements need to be fulfilled. The descriptor should be assigned to a class attribute that has a protected counterpart that will hold the actual dictionary values, and a corres...
486e2e9332553240bcbd80e100d26bff58071709
<|skeleton|> class ColorDict: """Descriptor for color dictionaries. To use this descriptor, some requirements need to be fulfilled. The descriptor should be assigned to a class attribute that has a protected counterpart that will hold the actual dictionary values, and a corresponding attribute that defines the defa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ColorDict: """Descriptor for color dictionaries. To use this descriptor, some requirements need to be fulfilled. The descriptor should be assigned to a class attribute that has a protected counterpart that will hold the actual dictionary values, and a corresponding attribute that defines the default value for...
the_stack_v2_python_sparse
src/compas/artists/colordict.py
compas-dev/compas
train
286
c593d793fabfcaaca45ee6569db22ae280b8ef34
[ "params = {'term': city, 'location_types': 'city'}\nheaders = {'apikey': TEQUILA_API_KEY}\nresponse = requests.get(url=f'{TEQUILA_ENDPOINT}locations/query', params=params, headers=headers)\nresponse.raise_for_status()\npprint(response.json())\ndata = response.json()\niata_code = data['locations'][0]['code']\nreturn...
<|body_start_0|> params = {'term': city, 'location_types': 'city'} headers = {'apikey': TEQUILA_API_KEY} response = requests.get(url=f'{TEQUILA_ENDPOINT}locations/query', params=params, headers=headers) response.raise_for_status() pprint(response.json()) data = response.j...
This class is responsible for talking to the Flight Search (tequila-kwi) API.
FlightSearch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlightSearch: """This class is responsible for talking to the Flight Search (tequila-kwi) API.""" def search_flight_iatacode(self, city): """return iatacode fetched from tequila API""" <|body_0|> def search_flight(self, fly_to, price_to): """return cheapest fligh...
stack_v2_sparse_classes_75kplus_train_003238
2,419
no_license
[ { "docstring": "return iatacode fetched from tequila API", "name": "search_flight_iatacode", "signature": "def search_flight_iatacode(self, city)" }, { "docstring": "return cheapest flight data from tequila API", "name": "search_flight", "signature": "def search_flight(self, fly_to, pric...
2
stack_v2_sparse_classes_30k_train_037351
Implement the Python class `FlightSearch` described below. Class description: This class is responsible for talking to the Flight Search (tequila-kwi) API. Method signatures and docstrings: - def search_flight_iatacode(self, city): return iatacode fetched from tequila API - def search_flight(self, fly_to, price_to): ...
Implement the Python class `FlightSearch` described below. Class description: This class is responsible for talking to the Flight Search (tequila-kwi) API. Method signatures and docstrings: - def search_flight_iatacode(self, city): return iatacode fetched from tequila API - def search_flight(self, fly_to, price_to): ...
edc8ab39cbe9fef9bf8955b9e21aeedd4281c812
<|skeleton|> class FlightSearch: """This class is responsible for talking to the Flight Search (tequila-kwi) API.""" def search_flight_iatacode(self, city): """return iatacode fetched from tequila API""" <|body_0|> def search_flight(self, fly_to, price_to): """return cheapest fligh...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FlightSearch: """This class is responsible for talking to the Flight Search (tequila-kwi) API.""" def search_flight_iatacode(self, city): """return iatacode fetched from tequila API""" params = {'term': city, 'location_types': 'city'} headers = {'apikey': TEQUILA_API_KEY} ...
the_stack_v2_python_sparse
5_API/flight_deal_finder/flight_search.py
day-lee/Python_Bootcamp_Udemy
train
0
4e08a2f5bbf1ea99a1438a74b84a27e364ed64f9
[ "if use_pardiso:\n mtype = mtypes[matrix_type]\n self.pSolve = pardisoSolver(A, mtype=mtype, verbose=verbose)\n self.pSolve.run_pardiso(12)\nelse:\n self.pSolve = sp.sparse.linalg.splu(A)", "if use_pardiso:\n x = self.pSolve.run_pardiso(33, b)\nelse:\n x = self.pSolve.solve(b)\nreturn x", "if ...
<|body_start_0|> if use_pardiso: mtype = mtypes[matrix_type] self.pSolve = pardisoSolver(A, mtype=mtype, verbose=verbose) self.pSolve.run_pardiso(12) else: self.pSolve = sp.sparse.linalg.splu(A) <|end_body_0|> <|body_start_1|> if use_pardiso: ...
Solver class for solving the sparse system Ax=b for multiple right hand sides b using the fastest solver available, i.e. the Intel MKL Pardiso, if available.
SpSolve
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpSolve: """Solver class for solving the sparse system Ax=b for multiple right hand sides b using the fastest solver available, i.e. the Intel MKL Pardiso, if available.""" def __init__(self, A, matrix_type='symm', verbose=False): """Parameters ---------- A : sp.sparse.CSR sparse mat...
stack_v2_sparse_classes_75kplus_train_003239
31,960
permissive
[ { "docstring": "Parameters ---------- A : sp.sparse.CSR sparse matrix in CSR-format matrixd_type : {'spd', 'symm', 'unsymm'}, optional Specifier for the matrix type: - 'spd' : symmetric positive definite - 'symm' : symmetric indefinite - 'unsymm' : generally unsymmetric verbose : bool Flag for verbosity.", ...
3
stack_v2_sparse_classes_30k_train_038612
Implement the Python class `SpSolve` described below. Class description: Solver class for solving the sparse system Ax=b for multiple right hand sides b using the fastest solver available, i.e. the Intel MKL Pardiso, if available. Method signatures and docstrings: - def __init__(self, A, matrix_type='symm', verbose=F...
Implement the Python class `SpSolve` described below. Class description: Solver class for solving the sparse system Ax=b for multiple right hand sides b using the fastest solver available, i.e. the Intel MKL Pardiso, if available. Method signatures and docstrings: - def __init__(self, A, matrix_type='symm', verbose=F...
0dad8df6277a09b2f250010b476854dc91d4d8ad
<|skeleton|> class SpSolve: """Solver class for solving the sparse system Ax=b for multiple right hand sides b using the fastest solver available, i.e. the Intel MKL Pardiso, if available.""" def __init__(self, A, matrix_type='symm', verbose=False): """Parameters ---------- A : sp.sparse.CSR sparse mat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SpSolve: """Solver class for solving the sparse system Ax=b for multiple right hand sides b using the fastest solver available, i.e. the Intel MKL Pardiso, if available.""" def __init__(self, A, matrix_type='symm', verbose=False): """Parameters ---------- A : sp.sparse.CSR sparse matrix in CSR-fo...
the_stack_v2_python_sparse
amfe/solver.py
AsclepiusInformatica/github-spielwiese
train
0
d3b37c2ed5fd532516a6bd68b27a16ff5f2d8196
[ "length = len(nums)\nif length == 0:\n return nums\nleft = 0\nright = length - 1\nself.sort(nums, left, right)\nreturn nums", "if left < right:\n partition_index = self.get_partition_index(nums, left, right)\n self.sort(nums, left, partition_index - 1)\n self.sort(nums, partition_index + 1, right)", ...
<|body_start_0|> length = len(nums) if length == 0: return nums left = 0 right = length - 1 self.sort(nums, left, right) return nums <|end_body_0|> <|body_start_1|> if left < right: partition_index = self.get_partition_index(nums, left, ri...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def quick_sort(self, nums: list) -> list: """sort the array by the quick sort method :param nums: :return:""" <|body_0|> def sort(self, nums: list, left: int, right: int): """:param nums: :param left: :param right: :return:""" <|body_1|> def ge...
stack_v2_sparse_classes_75kplus_train_003240
2,514
no_license
[ { "docstring": "sort the array by the quick sort method :param nums: :return:", "name": "quick_sort", "signature": "def quick_sort(self, nums: list) -> list" }, { "docstring": ":param nums: :param left: :param right: :return:", "name": "sort", "signature": "def sort(self, nums: list, lef...
4
stack_v2_sparse_classes_30k_train_048254
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def quick_sort(self, nums: list) -> list: sort the array by the quick sort method :param nums: :return: - def sort(self, nums: list, left: int, right: int): :param nums: :param l...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def quick_sort(self, nums: list) -> list: sort the array by the quick sort method :param nums: :return: - def sort(self, nums: list, left: int, right: int): :param nums: :param l...
37710292b2cfc6060098363c8d5f8881a4c22b26
<|skeleton|> class Solution: def quick_sort(self, nums: list) -> list: """sort the array by the quick sort method :param nums: :return:""" <|body_0|> def sort(self, nums: list, left: int, right: int): """:param nums: :param left: :param right: :return:""" <|body_1|> def ge...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def quick_sort(self, nums: list) -> list: """sort the array by the quick sort method :param nums: :return:""" length = len(nums) if length == 0: return nums left = 0 right = length - 1 self.sort(nums, left, right) return nums d...
the_stack_v2_python_sparse
python/sort/quick_sort.py
yudongnan23/algorithmRoad
train
0
80715e18997712a7c6e0771e2a2f99a8846a9e33
[ "self._which = which\nself._executable_search_paths = executable_search_paths\nself._osutils = osutils", "LOG.debug('checking for cargo-lambda')\nbinaries = self._which('cargo-lambda', executable_search_paths=self._executable_search_paths)\nLOG.debug('potential cargo-lambda binaries: %s', binaries)\nif binaries:\...
<|body_start_0|> self._which = which self._executable_search_paths = executable_search_paths self._osutils = osutils <|end_body_0|> <|body_start_1|> LOG.debug('checking for cargo-lambda') binaries = self._which('cargo-lambda', executable_search_paths=self._executable_search_path...
Wrapper around the Cargo Lambda command line utility, making it easy to consume execution results.
SubprocessCargoLambda
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubprocessCargoLambda: """Wrapper around the Cargo Lambda command line utility, making it easy to consume execution results.""" def __init__(self, which, executable_search_paths=None, osutils=OSUtils()): """Parameters ---------- which : aws_lambda_builders.utils.which Function to get...
stack_v2_sparse_classes_75kplus_train_003241
4,323
permissive
[ { "docstring": "Parameters ---------- which : aws_lambda_builders.utils.which Function to get paths which conform to the given mode on the PATH with the prepended additional search paths executable_search_paths : list, optional List of paths to the NPM package binary utilities. This will be used to find embedde...
3
stack_v2_sparse_classes_30k_train_018932
Implement the Python class `SubprocessCargoLambda` described below. Class description: Wrapper around the Cargo Lambda command line utility, making it easy to consume execution results. Method signatures and docstrings: - def __init__(self, which, executable_search_paths=None, osutils=OSUtils()): Parameters ---------...
Implement the Python class `SubprocessCargoLambda` described below. Class description: Wrapper around the Cargo Lambda command line utility, making it easy to consume execution results. Method signatures and docstrings: - def __init__(self, which, executable_search_paths=None, osutils=OSUtils()): Parameters ---------...
c90c9bc8953aa684a23a3b438c7a71cc41cce809
<|skeleton|> class SubprocessCargoLambda: """Wrapper around the Cargo Lambda command line utility, making it easy to consume execution results.""" def __init__(self, which, executable_search_paths=None, osutils=OSUtils()): """Parameters ---------- which : aws_lambda_builders.utils.which Function to get...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubprocessCargoLambda: """Wrapper around the Cargo Lambda command line utility, making it easy to consume execution results.""" def __init__(self, which, executable_search_paths=None, osutils=OSUtils()): """Parameters ---------- which : aws_lambda_builders.utils.which Function to get paths which ...
the_stack_v2_python_sparse
aws_lambda_builders/workflows/rust_cargo/cargo_lambda.py
aws/aws-lambda-builders
train
144
de2a96d5e994fc42504ae48fb2c3f24b2c7ec710
[ "def postorder(root):\n return postorder(root.left) + postorder(root.right) + [root.val] if root else []\nreturn ' '.join(map(str, postorder(root)))", "def helper(lower=float('-inf'), upper=float('inf')):\n if not data or data[-1] < lower or data[-1] > upper:\n return None\n val = data.pop()\n ...
<|body_start_0|> def postorder(root): return postorder(root.left) + postorder(root.right) + [root.val] if root else [] return ' '.join(map(str, postorder(root))) <|end_body_0|> <|body_start_1|> def helper(lower=float('-inf'), upper=float('inf')): if not data or data[-1] ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize1(self, root): """Encodes a tree to a single string.""" <|body_0|> def deserialize1(self, data): """Decodes your encoded data to tree.""" <|body_1|> def serialize(self, root): """Encodes a tree to a single string.""" <...
stack_v2_sparse_classes_75kplus_train_003242
1,915
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize1", "signature": "def serialize1(self, root)" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize1", "signature": "def deserialize1(self, data)" }, { "docstring": "Encodes a tree to a ...
4
stack_v2_sparse_classes_30k_train_017209
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize1(self, root): Encodes a tree to a single string. - def deserialize1(self, data): Decodes your encoded data to tree. - def serialize(self, root): Encodes a tree to a singl...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize1(self, root): Encodes a tree to a single string. - def deserialize1(self, data): Decodes your encoded data to tree. - def serialize(self, root): Encodes a tree to a singl...
61966ef769b079024a6f72bcf608486343e033e6
<|skeleton|> class Codec: def serialize1(self, root): """Encodes a tree to a single string.""" <|body_0|> def deserialize1(self, data): """Decodes your encoded data to tree.""" <|body_1|> def serialize(self, root): """Encodes a tree to a single string.""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize1(self, root): """Encodes a tree to a single string.""" def postorder(root): return postorder(root.left) + postorder(root.right) + [root.val] if root else [] return ' '.join(map(str, postorder(root))) def deserialize1(self, data): """Decodes...
the_stack_v2_python_sparse
lintcode/P449SerializeandDeserializeBST.py
hanrick2000/coderunpython
train
0
a2f72edc82606e21cf58be2fa1e349e4938d1a49
[ "self.start_number = start_number\nself.rename_pairs = []\nself.zfillsize = None\nself.process_rename()", "files = os.listdir('.')\nsorted(files)\ntotal_files = len(files)\nself.zfillsize = len(str(total_files))\nfileseq = self.start_number\nfor i, filename in enumerate(files):\n new_filename = str(fileseq).zf...
<|body_start_0|> self.start_number = start_number self.rename_pairs = [] self.zfillsize = None self.process_rename() <|end_body_0|> <|body_start_1|> files = os.listdir('.') sorted(files) total_files = len(files) self.zfillsize = len(str(total_files)) ...
This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder.
Renamer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Renamer: """This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder.""" def __init__(self, start_number): """start_number determines the first prefix ...
stack_v2_sparse_classes_75kplus_train_003243
2,741
no_license
[ { "docstring": "start_number determines the first prefix number for renames The numbering goes along the alphanumeric ordering given by sorted(files)", "name": "__init__", "signature": "def __init__(self, start_number)" }, { "docstring": "Prepare renames", "name": "prep_rename", "signatu...
5
stack_v2_sparse_classes_30k_train_030573
Implement the Python class `Renamer` described below. Class description: This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder. Method signatures and docstrings: - def __init__(self,...
Implement the Python class `Renamer` described below. Class description: This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder. Method signatures and docstrings: - def __init__(self,...
b4c5642c8d5843846d529630f8d93a7103676539
<|skeleton|> class Renamer: """This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder.""" def __init__(self, start_number): """start_number determines the first prefix ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Renamer: """This class takes a start number as parameter, loops thru all files on folder, prefixes numbers sequencially to all files, asks rename confirmation, if confirmed, renames all files on folder.""" def __init__(self, start_number): """start_number determines the first prefix number for re...
the_stack_v2_python_sparse
renameNumberPrefix.py
alclass/bin
train
0
28d8ca8fe401e5e77888d61cdb98f6e9f49fae94
[ "super().__init__()\nself.filename = filename\nself.line_format = '[{0:20s}]\\t\\t[Requested: {1} -- Data: {2}]\\n'", "f = open(self.filename, 'a')\nfor key in data:\n f.write(self.line_format.format(datetime.now().__str__(), key, data[key]))\nf.close()" ]
<|body_start_0|> super().__init__() self.filename = filename self.line_format = '[{0:20s}]\t\t[Requested: {1} -- Data: {2}]\n' <|end_body_0|> <|body_start_1|> f = open(self.filename, 'a') for key in data: f.write(self.line_format.format(datetime.now().__str__(), key,...
Implements an interface to write data to file.
FileWriter
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileWriter: """Implements an interface to write data to file.""" def __init__(self, filename): """FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.""" <|body_0|> def publish_dictionary(self, data): """...
stack_v2_sparse_classes_75kplus_train_003244
2,907
permissive
[ { "docstring": "FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.", "name": "__init__", "signature": "def __init__(self, filename)" }, { "docstring": "Writes a formated dictionary update to file. Keyword Arguments: data -- The data di...
2
stack_v2_sparse_classes_30k_train_047682
Implement the Python class `FileWriter` described below. Class description: Implements an interface to write data to file. Method signatures and docstrings: - def __init__(self, filename): FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to. - def publish_dic...
Implement the Python class `FileWriter` described below. Class description: Implements an interface to write data to file. Method signatures and docstrings: - def __init__(self, filename): FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to. - def publish_dic...
b5d75cb82e4bc3e9c4e428a288c6ac98a4aa2c52
<|skeleton|> class FileWriter: """Implements an interface to write data to file.""" def __init__(self, filename): """FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.""" <|body_0|> def publish_dictionary(self, data): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FileWriter: """Implements an interface to write data to file.""" def __init__(self, filename): """FileWriter implementation of broadcaster. Keyword Arguments: filename -- the name of the file to read/write to.""" super().__init__() self.filename = filename self.line_format...
the_stack_v2_python_sparse
src/broadcaster/broadcaster.py
vt-sailbot/sailbot-21
train
5
a31c15d94cc0232d3f6d2ee9506a996d1bcc130c
[ "if issubclass(type_, float) and separator == '.':\n raise ValueError(f\"invalid separator '{separator}' for type '{type_.__name__}'\")\nself.type_: Type[Any] = type_\nself.separator: str = separator\nself.unique: bool = unique\nself.name: str = name or f'{type_.__name__}{separator}' * 2 + '...'", "values_str ...
<|body_start_0|> if issubclass(type_, float) and separator == '.': raise ValueError(f"invalid separator '{separator}' for type '{type_.__name__}'") self.type_: Type[Any] = type_ self.separator: str = separator self.unique: bool = unique self.name: str = name or f'{typ...
List of elements of a given type separated by a given character.
CharSepList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CharSepList: """List of elements of a given type separated by a given character.""" def __init__(self, type_: Type[Any], separator: str, *, name: Optional[str]=None, unique: bool=False) -> None: """Create an instance of ``CharSepList``. Args: type_: Type of list elements. separator: ...
stack_v2_sparse_classes_75kplus_train_003245
5,209
permissive
[ { "docstring": "Create an instance of ``CharSepList``. Args: type_: Type of list elements. separator: Separator of list elements. name (optional): Name of the type. If omitted, the default name is derived from ``type_`` and ``separator``. unique (optional): Whether the list elements must be unique. Example: Cre...
2
stack_v2_sparse_classes_30k_train_053427
Implement the Python class `CharSepList` described below. Class description: List of elements of a given type separated by a given character. Method signatures and docstrings: - def __init__(self, type_: Type[Any], separator: str, *, name: Optional[str]=None, unique: bool=False) -> None: Create an instance of ``CharS...
Implement the Python class `CharSepList` described below. Class description: List of elements of a given type separated by a given character. Method signatures and docstrings: - def __init__(self, type_: Type[Any], separator: str, *, name: Optional[str]=None, unique: bool=False) -> None: Create an instance of ``CharS...
879dfedc40b91157322a0b59a51e08c76257fb7b
<|skeleton|> class CharSepList: """List of elements of a given type separated by a given character.""" def __init__(self, type_: Type[Any], separator: str, *, name: Optional[str]=None, unique: bool=False) -> None: """Create an instance of ``CharSepList``. Args: type_: Type of list elements. separator: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CharSepList: """List of elements of a given type separated by a given character.""" def __init__(self, type_: Type[Any], separator: str, *, name: Optional[str]=None, unique: bool=False) -> None: """Create an instance of ``CharSepList``. Args: type_: Type of list elements. separator: Separator of ...
the_stack_v2_python_sparse
src/srutils/click.py
MeteoSwiss-APN/pyflexplot
train
9
15cf2b112c003d861e51752b5b81467034054941
[ "super().setUp()\nself.plugin = Plugin()\nself.plugin.current_forecast = self.current_temperature_forecast_cube\nself.plugin.coefficients_cubelist = self.coeffs_from_mean", "location_parameter = self.plugin._calculate_location_parameter_from_mean()\nself.assertCalibratedVariablesAlmostEqual(location_parameter, se...
<|body_start_0|> super().setUp() self.plugin = Plugin() self.plugin.current_forecast = self.current_temperature_forecast_cube self.plugin.coefficients_cubelist = self.coeffs_from_mean <|end_body_0|> <|body_start_1|> location_parameter = self.plugin._calculate_location_parameter_...
Test the __calculate_location_parameter_from_mean method.
Test__calculate_location_parameter_from_mean
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__calculate_location_parameter_from_mean: """Test the __calculate_location_parameter_from_mean method.""" def setUp(self): """Set-up coefficients and plugin for testing.""" <|body_0|> def test_basic(self): """Test that the expected values for the location par...
stack_v2_sparse_classes_75kplus_train_003246
23,621
permissive
[ { "docstring": "Set-up coefficients and plugin for testing.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that the expected values for the location parameter are calculated when using the ensemble mean. These expected values are compared to the results when using the ...
3
stack_v2_sparse_classes_30k_val_001976
Implement the Python class `Test__calculate_location_parameter_from_mean` described below. Class description: Test the __calculate_location_parameter_from_mean method. Method signatures and docstrings: - def setUp(self): Set-up coefficients and plugin for testing. - def test_basic(self): Test that the expected values...
Implement the Python class `Test__calculate_location_parameter_from_mean` described below. Class description: Test the __calculate_location_parameter_from_mean method. Method signatures and docstrings: - def setUp(self): Set-up coefficients and plugin for testing. - def test_basic(self): Test that the expected values...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__calculate_location_parameter_from_mean: """Test the __calculate_location_parameter_from_mean method.""" def setUp(self): """Set-up coefficients and plugin for testing.""" <|body_0|> def test_basic(self): """Test that the expected values for the location par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test__calculate_location_parameter_from_mean: """Test the __calculate_location_parameter_from_mean method.""" def setUp(self): """Set-up coefficients and plugin for testing.""" super().setUp() self.plugin = Plugin() self.plugin.current_forecast = self.current_temperature_f...
the_stack_v2_python_sparse
improver_tests/calibration/ensemble_calibration/test_CalibratedForecastDistributionParameters.py
metoppv/improver
train
101
669ba5d3ddcb833f1e01465ccec198b7daee4b80
[ "super(SupportingOutputLayer, self).__init__()\nself.linear_1 = Linear(linear_weight_shape=linear_1_weight_shape, linear_bias_shape=linear_1_bias_shape)\nself.bert_layer_norm = BertLayerNorm(bert_layer_norm_weight_shape=bert_layer_norm_weight_shape, bert_layer_norm_bias_shape=bert_layer_norm_bias_shape)\nself.matmu...
<|body_start_0|> super(SupportingOutputLayer, self).__init__() self.linear_1 = Linear(linear_weight_shape=linear_1_weight_shape, linear_bias_shape=linear_1_bias_shape) self.bert_layer_norm = BertLayerNorm(bert_layer_norm_weight_shape=bert_layer_norm_weight_shape, bert_layer_norm_bias_shape=bert_...
module of reader downstream
SupportingOutputLayer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupportingOutputLayer: """module of reader downstream""" def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): """init function""" <|body_0|> def construct(self, x): """construct function""" ...
stack_v2_sparse_classes_75kplus_train_003247
9,011
permissive
[ { "docstring": "init function", "name": "__init__", "signature": "def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape)" }, { "docstring": "construct function", "name": "construct", "signature": "def construct(self, x)" ...
2
stack_v2_sparse_classes_30k_train_045211
Implement the Python class `SupportingOutputLayer` described below. Class description: module of reader downstream Method signatures and docstrings: - def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): init function - def construct(self, x): const...
Implement the Python class `SupportingOutputLayer` described below. Class description: module of reader downstream Method signatures and docstrings: - def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): init function - def construct(self, x): const...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class SupportingOutputLayer: """module of reader downstream""" def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): """init function""" <|body_0|> def construct(self, x): """construct function""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SupportingOutputLayer: """module of reader downstream""" def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): """init function""" super(SupportingOutputLayer, self).__init__() self.linear_1 = Linear(linear_weight...
the_stack_v2_python_sparse
research/nlp/tprr/src/reader_downstream.py
mindspore-ai/models
train
301
cd102f5300af6281e69c5382e2b46cbdff469242
[ "if len(s) == 0:\n return -1\nsat = {}\nfor i in s:\n if i not in sat:\n sat[i] = 1\n else:\n sat[i] += 1\nfor c, i in enumerate(s):\n if sat[i] == 1:\n return c\nreturn -1", "char = {}\nfor i in range(len(s)):\n if s[i] not in char:\n char[s[i]] = i\n else:\n ...
<|body_start_0|> if len(s) == 0: return -1 sat = {} for i in s: if i not in sat: sat[i] = 1 else: sat[i] += 1 for c, i in enumerate(s): if sat[i] == 1: return c return -1 <|end_body_0|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstUniqChar(self, s): """:type s: str :rtype: int""" <|body_0|> def firstUniqChar2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) == 0: return -1 sat = {} f...
stack_v2_sparse_classes_75kplus_train_003248
1,380
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "firstUniqChar", "signature": "def firstUniqChar(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "firstUniqChar2", "signature": "def firstUniqChar2(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstUniqChar(self, s): :type s: str :rtype: int - def firstUniqChar2(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 firstUniqChar(self, s): :type s: str :rtype: int - def firstUniqChar2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def firstUniqChar(self, s): ...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def firstUniqChar(self, s): """:type s: str :rtype: int""" <|body_0|> def firstUniqChar2(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 firstUniqChar(self, s): """:type s: str :rtype: int""" if len(s) == 0: return -1 sat = {} for i in s: if i not in sat: sat[i] = 1 else: sat[i] += 1 for c, i in enumerate(s): if...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00387.First_Unique_Character_in_a_String.py
roger6blog/LeetCode
train
0
163373fe25c3323235d1139532c49f5c9aa32ddf
[ "self.root = root\nself.tlh = tlh\nself.top_level = Tkinter.Toplevel(self.root)\nself.top_level.transient(self.root)\nself.top_level.grab_set()\nself.top_level.bind('<Return>', self._cancel)\nself.top_level.bind('<Escape>', self._cancel)\nself.top_level.title('Error!')\nif message:\n Tkinter.Label(self.top_level...
<|body_start_0|> self.root = root self.tlh = tlh self.top_level = Tkinter.Toplevel(self.root) self.top_level.transient(self.root) self.top_level.grab_set() self.top_level.bind('<Return>', self._cancel) self.top_level.bind('<Escape>', self._cancel) self.top...
show_error_and_exit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class show_error_and_exit: def __init__(self, root=None, tlh=None, message=None): """Display an error message in a widget with an "Exit" button until the button is clicked.""" <|body_0|> def _cancel(self, event=None): """The button has been clicked. Restore the TCL_LIBRARY...
stack_v2_sparse_classes_75kplus_train_003249
13,571
no_license
[ { "docstring": "Display an error message in a widget with an \"Exit\" button until the button is clicked.", "name": "__init__", "signature": "def __init__(self, root=None, tlh=None, message=None)" }, { "docstring": "The button has been clicked. Restore the TCL_LIBRARY environment variable to its...
2
stack_v2_sparse_classes_30k_train_015384
Implement the Python class `show_error_and_exit` described below. Class description: Implement the show_error_and_exit class. Method signatures and docstrings: - def __init__(self, root=None, tlh=None, message=None): Display an error message in a widget with an "Exit" button until the button is clicked. - def _cancel...
Implement the Python class `show_error_and_exit` described below. Class description: Implement the show_error_and_exit class. Method signatures and docstrings: - def __init__(self, root=None, tlh=None, message=None): Display an error message in a widget with an "Exit" button until the button is clicked. - def _cancel...
bff2d8c9e5e1ead4018f63098c1adea0e0c28184
<|skeleton|> class show_error_and_exit: def __init__(self, root=None, tlh=None, message=None): """Display an error message in a widget with an "Exit" button until the button is clicked.""" <|body_0|> def _cancel(self, event=None): """The button has been clicked. Restore the TCL_LIBRARY...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class show_error_and_exit: def __init__(self, root=None, tlh=None, message=None): """Display an error message in a widget with an "Exit" button until the button is clicked.""" self.root = root self.tlh = tlh self.top_level = Tkinter.Toplevel(self.root) self.top_level.transien...
the_stack_v2_python_sparse
adk/tools/packages/menus/pydbgCoredump.py
litterstar7/Qualcomm_BT_Audio
train
4
34ab408d0d89991e46f0701c5ec45f078153e577
[ "super().setUpClass()\ncls.cinder_ceph_app_name = 'cinder-ceph'\ncls.test_cinder_volume_name = 'test-cinder-ceph-volume'\ncls.site_a_model = cls.site_b_model = zaza.model.get_juju_model()\ncls.site_b_app_suffix = '-b'", "action_params = {'verbose': True, 'format': 'json'}\nif len(pools) > 0:\n action_params['p...
<|body_start_0|> super().setUpClass() cls.cinder_ceph_app_name = 'cinder-ceph' cls.test_cinder_volume_name = 'test-cinder-ceph-volume' cls.site_a_model = cls.site_b_model = zaza.model.get_juju_model() cls.site_b_app_suffix = '-b' <|end_body_0|> <|body_start_1|> action_pa...
Base class for ``ceph-rbd-mirror`` tests.
CephRBDMirrorBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CephRBDMirrorBase: """Base class for ``ceph-rbd-mirror`` tests.""" def setUpClass(cls): """Run setup for ``ceph-rbd-mirror`` tests.""" <|body_0|> def run_status_action(self, application_name=None, model_name=None, pools=[]): """Run status action, decode and retur...
stack_v2_sparse_classes_75kplus_train_003250
33,962
permissive
[ { "docstring": "Run setup for ``ceph-rbd-mirror`` tests.", "name": "setUpClass", "signature": "def setUpClass(cls)" }, { "docstring": "Run status action, decode and return response.", "name": "run_status_action", "signature": "def run_status_action(self, application_name=None, model_name...
6
stack_v2_sparse_classes_30k_train_024797
Implement the Python class `CephRBDMirrorBase` described below. Class description: Base class for ``ceph-rbd-mirror`` tests. Method signatures and docstrings: - def setUpClass(cls): Run setup for ``ceph-rbd-mirror`` tests. - def run_status_action(self, application_name=None, model_name=None, pools=[]): Run status act...
Implement the Python class `CephRBDMirrorBase` described below. Class description: Base class for ``ceph-rbd-mirror`` tests. Method signatures and docstrings: - def setUpClass(cls): Run setup for ``ceph-rbd-mirror`` tests. - def run_status_action(self, application_name=None, model_name=None, pools=[]): Run status act...
3b17ad9d97c57b6e62797d4e3333e4b83e43a447
<|skeleton|> class CephRBDMirrorBase: """Base class for ``ceph-rbd-mirror`` tests.""" def setUpClass(cls): """Run setup for ``ceph-rbd-mirror`` tests.""" <|body_0|> def run_status_action(self, application_name=None, model_name=None, pools=[]): """Run status action, decode and retur...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CephRBDMirrorBase: """Base class for ``ceph-rbd-mirror`` tests.""" def setUpClass(cls): """Run setup for ``ceph-rbd-mirror`` tests.""" super().setUpClass() cls.cinder_ceph_app_name = 'cinder-ceph' cls.test_cinder_volume_name = 'test-cinder-ceph-volume' cls.site_a_m...
the_stack_v2_python_sparse
zaza/openstack/charm_tests/ceph/rbd_mirror/tests.py
openstack-charmers/zaza-openstack-tests
train
7
7c65c1f87e7479845c8be9e88462f3b715e71f46
[ "if subkey is not None:\n return self.store_subkey(key, subkey, value, expiration_time)\nelse:\n return super().store(key, value, expiration_time)", "previous_value, previous_expiration_time = self.get(key) or (b'', -float('inf'))\nif isinstance(previous_value, BinaryDHTValue) and expiration_time > previous...
<|body_start_0|> if subkey is not None: return self.store_subkey(key, subkey, value, expiration_time) else: return super().store(key, value, expiration_time) <|end_body_0|> <|body_start_1|> previous_value, previous_expiration_time = self.get(key) or (b'', -float('inf')) ...
A dictionary-like storage that can store binary values and/or nested dictionaries until expiration
DHTLocalStorage
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DHTLocalStorage: """A dictionary-like storage that can store binary values and/or nested dictionaries until expiration""" def store(self, key: DHTID, value: BinaryDHTValue, expiration_time: DHTExpiration, subkey: Optional[Subkey]=None) -> bool: """Store a (key, value) pair locally at...
stack_v2_sparse_classes_75kplus_train_003251
3,757
permissive
[ { "docstring": "Store a (key, value) pair locally at least until expiration_time. See class docstring for details. If subkey is not None, adds a subkey-value pair to a dictionary associated with :key: (see store_subkey below) :returns: True if new value was stored, False it was rejected (current value is newer)...
2
stack_v2_sparse_classes_30k_train_005042
Implement the Python class `DHTLocalStorage` described below. Class description: A dictionary-like storage that can store binary values and/or nested dictionaries until expiration Method signatures and docstrings: - def store(self, key: DHTID, value: BinaryDHTValue, expiration_time: DHTExpiration, subkey: Optional[Su...
Implement the Python class `DHTLocalStorage` described below. Class description: A dictionary-like storage that can store binary values and/or nested dictionaries until expiration Method signatures and docstrings: - def store(self, key: DHTID, value: BinaryDHTValue, expiration_time: DHTExpiration, subkey: Optional[Su...
27318f96a62bb4c7c8804cb14359d8a70e95af5d
<|skeleton|> class DHTLocalStorage: """A dictionary-like storage that can store binary values and/or nested dictionaries until expiration""" def store(self, key: DHTID, value: BinaryDHTValue, expiration_time: DHTExpiration, subkey: Optional[Subkey]=None) -> bool: """Store a (key, value) pair locally at...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DHTLocalStorage: """A dictionary-like storage that can store binary values and/or nested dictionaries until expiration""" def store(self, key: DHTID, value: BinaryDHTValue, expiration_time: DHTExpiration, subkey: Optional[Subkey]=None) -> bool: """Store a (key, value) pair locally at least until ...
the_stack_v2_python_sparse
hivemind/dht/storage.py
learning-at-home/hivemind
train
1,662
80d599a72b2874f7c907b3cc362274669670f885
[ "super().__init__(input_key, output_key or input_key)\nself.dtype = dtype\nself.default_value = default_value\nself.one_hot_classes = one_hot_classes\nself.smoothing = smoothing\nif self.one_hot_classes is not None and self.smoothing is not None:\n assert 0.0 < smoothing < 1.0, 'If smoothing is specified it must...
<|body_start_0|> super().__init__(input_key, output_key or input_key) self.dtype = dtype self.default_value = default_value self.one_hot_classes = one_hot_classes self.smoothing = smoothing if self.one_hot_classes is not None and self.smoothing is not None: as...
Numeric data reader abstraction. Reads a single float, int, str or other from data
ScalarReader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScalarReader: """Numeric data reader abstraction. Reads a single float, int, str or other from data""" def __init__(self, input_key: str, output_key: Optional[str]=None, dtype: Type=np.float32, default_value: float=None, one_hot_classes: int=None, smoothing: float=None): """Args: inp...
stack_v2_sparse_classes_75kplus_train_003252
5,229
permissive
[ { "docstring": "Args: input_key: input key to use from annotation dict output_key: output key to use to store the result, default: ``input_key`` dtype: datatype of scalar values to use default_value: default value to use if something goes wrong one_hot_classes: number of one-hot classes smoothing (float, option...
2
stack_v2_sparse_classes_30k_train_027436
Implement the Python class `ScalarReader` described below. Class description: Numeric data reader abstraction. Reads a single float, int, str or other from data Method signatures and docstrings: - def __init__(self, input_key: str, output_key: Optional[str]=None, dtype: Type=np.float32, default_value: float=None, one...
Implement the Python class `ScalarReader` described below. Class description: Numeric data reader abstraction. Reads a single float, int, str or other from data Method signatures and docstrings: - def __init__(self, input_key: str, output_key: Optional[str]=None, dtype: Type=np.float32, default_value: float=None, one...
e99f90655d0efcf22559a46e928f0f98c9807ebf
<|skeleton|> class ScalarReader: """Numeric data reader abstraction. Reads a single float, int, str or other from data""" def __init__(self, input_key: str, output_key: Optional[str]=None, dtype: Type=np.float32, default_value: float=None, one_hot_classes: int=None, smoothing: float=None): """Args: inp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ScalarReader: """Numeric data reader abstraction. Reads a single float, int, str or other from data""" def __init__(self, input_key: str, output_key: Optional[str]=None, dtype: Type=np.float32, default_value: float=None, one_hot_classes: int=None, smoothing: float=None): """Args: input_key: input...
the_stack_v2_python_sparse
catalyst/contrib/data/reader.py
catalyst-team/catalyst
train
3,038
c87b5f435ace6e515cb65a064ee8eecbaad7fad9
[ "yield (None, 'port grouping is determined by the global default.')\nyield (False, 'ports are not grouped in an additional record.')\nyield (re.compile('[a-zA-Z][a-zA-Z0-9_]*'), 'ports are grouped in a record with the specified name.')", "yield (None, 'port flattening is determined by the global default.')\nyield...
<|body_start_0|> yield (None, 'port grouping is determined by the global default.') yield (False, 'ports are not grouped in an additional record.') yield (re.compile('[a-zA-Z][a-zA-Z0-9_]*'), 'ports are grouped in a record with the specified name.') <|end_body_0|> <|body_start_1|> yield...
Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by field/interrupt into records while generics are flattened, but either can be overridd...
InterfaceConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterfaceConfig: """Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by field/interrupt into records while generic...
stack_v2_sparse_classes_75kplus_train_003253
3,434
permissive
[ { "docstring": "Name of the group record used for ports, if any. The ports for any objects that share the same non-null `group` tag are combined into a single record pair (`in` and `out`).", "name": "group", "signature": "def group()" }, { "docstring": "Whether the ports for this object should b...
4
stack_v2_sparse_classes_30k_train_025931
Implement the Python class `InterfaceConfig` described below. Class description: Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by fie...
Implement the Python class `InterfaceConfig` described below. Class description: Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by fie...
d0417925cd72dfb973431d6948e65b662a75c5fa
<|skeleton|> class InterfaceConfig: """Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by field/interrupt into records while generic...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InterfaceConfig: """Each field and interrupt in `vhdmmio` can register scalar and vector inputs and outputs, as well as generics. This configuration structure determines how these interfaces are exposed in the entity. By default, the ports are grouped by field/interrupt into records while generics are flatten...
the_stack_v2_python_sparse
vhdmmio/config/interface.py
abs-tudelft/vhdmmio
train
5
aaf4c6919b61cca96ecd1f0c5338a6d55e3a508c
[ "index = 0\nresult = 0\ncount = 0\ncutline = -1\ndictionary = {}\nwhile index < len(s):\n chr = s[index]\n oldIndex = dictionary.get(chr, -1)\n if oldIndex == -1 or cutline >= oldIndex:\n dictionary[chr] = index\n count += 1\n else:\n if result < count:\n result = count\n...
<|body_start_0|> index = 0 result = 0 count = 0 cutline = -1 dictionary = {} while index < len(s): chr = s[index] oldIndex = dictionary.get(chr, -1) if oldIndex == -1 or cutline >= oldIndex: dictionary[chr] = index ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> index = 0 result = 0 count...
stack_v2_sparse_classes_75kplus_train_003254
1,257
permissive
[ { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstring2", "signature": "def lengthOfLongestSubstring2(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int - def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def lengthOf...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstring2(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 lengthOfLongestSubstring(self, s): """:type s: str :rtype: int""" index = 0 result = 0 count = 0 cutline = -1 dictionary = {} while index < len(s): chr = s[index] oldIndex = dictionary.get(chr, -1) if old...
the_stack_v2_python_sparse
1-100/1-10/3-longestSubstring/longestSubstring.py
xuychen/Leetcode
train
0
18e3d8f86b9310fe9df271e8440e83b809b66b3e
[ "ConfigParameters.__init__(self)\nself.declareBaseParameters()\nif __name__ == '__main__':\n self.fname_cp = './confpars-def.txt'\n self.readParametersFromFile()", "self.list_of_sources = None\nself.instr_dir = self.declareParameter(name='INSTRUMENT_DIR', val_def='/reg/d/psdm', type='str')\nself.instr_name ...
<|body_start_0|> ConfigParameters.__init__(self) self.declareBaseParameters() if __name__ == '__main__': self.fname_cp = './confpars-def.txt' self.readParametersFromFile() <|end_body_0|> <|body_start_1|> self.list_of_sources = None self.instr_dir = self.d...
A storage of configuration parameters for Experiment Monitor (EM) project.
PSConfigParameters
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PSConfigParameters: """A storage of configuration parameters for Experiment Monitor (EM) project.""" def __init__(self, fname=None): """fname : str - the file name with configuration parameters, if not specified then use default.""" <|body_0|> def declareBaseParameters(s...
stack_v2_sparse_classes_75kplus_train_003255
3,994
no_license
[ { "docstring": "fname : str - the file name with configuration parameters, if not specified then use default.", "name": "__init__", "signature": "def __init__(self, fname=None)" }, { "docstring": "Declaration of common paramaters for all PS apps", "name": "declareBaseParameters", "signat...
2
null
Implement the Python class `PSConfigParameters` described below. Class description: A storage of configuration parameters for Experiment Monitor (EM) project. Method signatures and docstrings: - def __init__(self, fname=None): fname : str - the file name with configuration parameters, if not specified then use defaul...
Implement the Python class `PSConfigParameters` described below. Class description: A storage of configuration parameters for Experiment Monitor (EM) project. Method signatures and docstrings: - def __init__(self, fname=None): fname : str - the file name with configuration parameters, if not specified then use defaul...
2b929d7526a151d8efdd9447756f807b171c00d7
<|skeleton|> class PSConfigParameters: """A storage of configuration parameters for Experiment Monitor (EM) project.""" def __init__(self, fname=None): """fname : str - the file name with configuration parameters, if not specified then use default.""" <|body_0|> def declareBaseParameters(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PSConfigParameters: """A storage of configuration parameters for Experiment Monitor (EM) project.""" def __init__(self, fname=None): """fname : str - the file name with configuration parameters, if not specified then use default.""" ConfigParameters.__init__(self) self.declareBase...
the_stack_v2_python_sparse
src/PSConfigParameters.py
lcls-psana/expmon
train
0
4a568831581b53f29c13b0bfcba6db435b34bc84
[ "try:\n story = story_fetchers.get_story_from_model(story_model)\n story.validate()\n assert topic_id_to_topic is not None\n corresponding_topic = topic_id_to_topic[story.corresponding_topic_id]\n story_services.validate_prerequisite_skills_in_story_contents(corresponding_topic.get_all_skill_ids(), s...
<|body_start_0|> try: story = story_fetchers.get_story_from_model(story_model) story.validate() assert topic_id_to_topic is not None corresponding_topic = topic_id_to_topic[story.corresponding_topic_id] story_services.validate_prerequisite_skills_in_st...
Transform that gets all Story models, performs migration and filters any error results.
MigrateStoryModels
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MigrateStoryModels: """Transform that gets all Story models, performs migration and filters any error results.""" def _migrate_story(story_id: str, story_model: story_models.StoryModel, topic_id_to_topic: Optional[Dict[str, topic_domain.Topic]]=None) -> result.Result[Tuple[str, story_domain....
stack_v2_sparse_classes_75kplus_train_003256
14,753
permissive
[ { "docstring": "Migrates story and transform story model into story object. Args: story_id: str. The id of the story. story_model: StoryModel. The story model to migrate. topic_id_to_topic: dict(str, Topic). The mapping from topic ID to topic. Returns: Result((str, Story), (str, Exception)). Result containing t...
3
stack_v2_sparse_classes_30k_train_044253
Implement the Python class `MigrateStoryModels` described below. Class description: Transform that gets all Story models, performs migration and filters any error results. Method signatures and docstrings: - def _migrate_story(story_id: str, story_model: story_models.StoryModel, topic_id_to_topic: Optional[Dict[str, ...
Implement the Python class `MigrateStoryModels` described below. Class description: Transform that gets all Story models, performs migration and filters any error results. Method signatures and docstrings: - def _migrate_story(story_id: str, story_model: story_models.StoryModel, topic_id_to_topic: Optional[Dict[str, ...
d16fdf23d790eafd63812bd7239532256e30a21d
<|skeleton|> class MigrateStoryModels: """Transform that gets all Story models, performs migration and filters any error results.""" def _migrate_story(story_id: str, story_model: story_models.StoryModel, topic_id_to_topic: Optional[Dict[str, topic_domain.Topic]]=None) -> result.Result[Tuple[str, story_domain....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MigrateStoryModels: """Transform that gets all Story models, performs migration and filters any error results.""" def _migrate_story(story_id: str, story_model: story_models.StoryModel, topic_id_to_topic: Optional[Dict[str, topic_domain.Topic]]=None) -> result.Result[Tuple[str, story_domain.Story], Tuple...
the_stack_v2_python_sparse
core/jobs/batch_jobs/story_migration_jobs.py
oppia/oppia
train
6,172
c4b33bbefec626b282378f9a84f76f6fe4888843
[ "super().__init__(send_type='ding', send_config=send_config)\ndd_token = send_config.get('dd_token', Config.DD_TOKEN)\nself.url = f'https://oapi.dingtalk.com/robot/send?access_token={dd_token}'", "doc_id = send_data['doc_id']\ndoc_name = send_data['doc_name']\ndoc_source = send_data['doc_source']\ndoc_link = send...
<|body_start_0|> super().__init__(send_type='ding', send_config=send_config) dd_token = send_config.get('dd_token', Config.DD_TOKEN) self.url = f'https://oapi.dingtalk.com/robot/send?access_token={dd_token}' <|end_body_0|> <|body_start_1|> doc_id = send_data['doc_id'] doc_name =...
钉钉分发类
DingSender
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DingSender: """钉钉分发类""" def __init__(self, send_config: dict): """初始化相关变量 :param send_config:""" <|body_0|> def send(self, send_data) -> bool: """下发到钉钉终端 :param send_data: 下发内容字典,字段开发者自定义 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_003257
3,794
permissive
[ { "docstring": "初始化相关变量 :param send_config:", "name": "__init__", "signature": "def __init__(self, send_config: dict)" }, { "docstring": "下发到钉钉终端 :param send_data: 下发内容字典,字段开发者自定义 :return:", "name": "send", "signature": "def send(self, send_data) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_037394
Implement the Python class `DingSender` described below. Class description: 钉钉分发类 Method signatures and docstrings: - def __init__(self, send_config: dict): 初始化相关变量 :param send_config: - def send(self, send_data) -> bool: 下发到钉钉终端 :param send_data: 下发内容字典,字段开发者自定义 :return:
Implement the Python class `DingSender` described below. Class description: 钉钉分发类 Method signatures and docstrings: - def __init__(self, send_config: dict): 初始化相关变量 :param send_config: - def send(self, send_data) -> bool: 下发到钉钉终端 :param send_data: 下发内容字典,字段开发者自定义 :return: <|skeleton|> class DingSender: """钉钉分发类"...
2b1093c9f15c713dac51aec5c1244ec285e49782
<|skeleton|> class DingSender: """钉钉分发类""" def __init__(self, send_config: dict): """初始化相关变量 :param send_config:""" <|body_0|> def send(self, send_data) -> bool: """下发到钉钉终端 :param send_data: 下发内容字典,字段开发者自定义 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DingSender: """钉钉分发类""" def __init__(self, send_config: dict): """初始化相关变量 :param send_config:""" super().__init__(send_type='ding', send_config=send_config) dd_token = send_config.get('dd_token', Config.DD_TOKEN) self.url = f'https://oapi.dingtalk.com/robot/send?access_tok...
the_stack_v2_python_sparse
src/sender/ding_sender.py
baboon-king/2c
train
0
bffd9c525951410739e5c89a9eef84a7a23756dc
[ "def recursion_core(element, start):\n if start == len(element):\n comb.append(element[:])\n else:\n for i in range(start, len(element)):\n element[i], element[start] = (element[start], element[i])\n recursion_core(element, start + 1)\n element[i], element[start]...
<|body_start_0|> def recursion_core(element, start): if start == len(element): comb.append(element[:]) else: for i in range(start, len(element)): element[i], element[start] = (element[start], element[i]) recursion_co...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permute_2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def recursion_core(element,...
stack_v2_sparse_classes_75kplus_train_003258
1,045
permissive
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permute", "signature": "def permute(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permute_2", "signature": "def permute_2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_054567
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permute_2(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permute_2(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution: ...
1a73ce6e81cf8c3ebe58f736204dc686e85d44c5
<|skeleton|> class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permute_2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" def recursion_core(element, start): if start == len(element): comb.append(element[:]) else: for i in range(start, len(element)): el...
the_stack_v2_python_sparse
leetcode/46_permutations.py
Run0812/Algorithm-Learning
train
0
c87ee79af6bd24fbbecb41be4fa66fbf5cf3b09b
[ "self.W = W\nself.b = b\nself.x = None\nself.db = None\nself.dW = None", "self.x = x\nout = np.dot(x, self.W) + self.b\nreturn out", "dx = np.dot(dout, self.W.T)\nself.dW = np.dot(self.x.T, dout)\nself.db = np.sum(dout, axis=0)\nreturn dx" ]
<|body_start_0|> self.W = W self.b = b self.x = None self.db = None self.dW = None <|end_body_0|> <|body_start_1|> self.x = x out = np.dot(x, self.W) + self.b return out <|end_body_1|> <|body_start_2|> dx = np.dot(dout, self.W.T) self.dW ...
신경망의 순전파에서 행해지는 내적을 기하학에서는 어파인 변환 affine transformation 이라고 한다.
Affine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Affine: """신경망의 순전파에서 행해지는 내적을 기하학에서는 어파인 변환 affine transformation 이라고 한다.""" def __init__(self, W, b): """입력에 가중치를 곱하고 편향을 더하는 affine 변환 전체를 정의한 클래스이므로 가중치 W, 편향 b 를 포함하고, 이 값들을 갱신하기 위해 dW, db 값을 갖는다. 미분값을 역전파하기위해서 입력 x 를 보관한다. :param W: numpy matrix : 가중치 :param b: numpy array : 편향...
stack_v2_sparse_classes_75kplus_train_003259
7,302
permissive
[ { "docstring": "입력에 가중치를 곱하고 편향을 더하는 affine 변환 전체를 정의한 클래스이므로 가중치 W, 편향 b 를 포함하고, 이 값들을 갱신하기 위해 dW, db 값을 갖는다. 미분값을 역전파하기위해서 입력 x 를 보관한다. :param W: numpy matrix : 가중치 :param b: numpy array : 편향", "name": "__init__", "signature": "def __init__(self, W, b)" }, { "docstring": "순전파 :param x: numpy m...
3
stack_v2_sparse_classes_30k_train_036879
Implement the Python class `Affine` described below. Class description: 신경망의 순전파에서 행해지는 내적을 기하학에서는 어파인 변환 affine transformation 이라고 한다. Method signatures and docstrings: - def __init__(self, W, b): 입력에 가중치를 곱하고 편향을 더하는 affine 변환 전체를 정의한 클래스이므로 가중치 W, 편향 b 를 포함하고, 이 값들을 갱신하기 위해 dW, db 값을 갖는다. 미분값을 역전파하기위해서 입력 x 를 보관한다...
Implement the Python class `Affine` described below. Class description: 신경망의 순전파에서 행해지는 내적을 기하학에서는 어파인 변환 affine transformation 이라고 한다. Method signatures and docstrings: - def __init__(self, W, b): 입력에 가중치를 곱하고 편향을 더하는 affine 변환 전체를 정의한 클래스이므로 가중치 W, 편향 b 를 포함하고, 이 값들을 갱신하기 위해 dW, db 값을 갖는다. 미분값을 역전파하기위해서 입력 x 를 보관한다...
4d319c8729472cc5f490935854441a2d4b4e8818
<|skeleton|> class Affine: """신경망의 순전파에서 행해지는 내적을 기하학에서는 어파인 변환 affine transformation 이라고 한다.""" def __init__(self, W, b): """입력에 가중치를 곱하고 편향을 더하는 affine 변환 전체를 정의한 클래스이므로 가중치 W, 편향 b 를 포함하고, 이 값들을 갱신하기 위해 dW, db 값을 갖는다. 미분값을 역전파하기위해서 입력 x 를 보관한다. :param W: numpy matrix : 가중치 :param b: numpy array : 편향...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Affine: """신경망의 순전파에서 행해지는 내적을 기하학에서는 어파인 변환 affine transformation 이라고 한다.""" def __init__(self, W, b): """입력에 가중치를 곱하고 편향을 더하는 affine 변환 전체를 정의한 클래스이므로 가중치 W, 편향 b 를 포함하고, 이 값들을 갱신하기 위해 dW, db 값을 갖는다. 미분값을 역전파하기위해서 입력 x 를 보관한다. :param W: numpy matrix : 가중치 :param b: numpy array : 편향""" s...
the_stack_v2_python_sparse
DeepLearning/DeepLearning/09_Deep_SongJW/ch5/layers.py
ghost9023/DeepLearningPythonStudy
train
1
adcdcacbe23177ce6da0b52e8d9bca3eba65918f
[ "self.kind = kind\nslideLexer.lineno = lineno\nself.title = slideParser.parse(title, slideLexer)\nslideLexer.lineno = lineno + 1\nself.children = slideParser.parse(content, slideLexer)\nself.overlay = overlay or ''", "title = ''.join(map(lambda x: str(x), self.title))\nself.before = self.explainBefore + Config.ge...
<|body_start_0|> self.kind = kind slideLexer.lineno = lineno self.title = slideParser.parse(title, slideLexer) slideLexer.lineno = lineno + 1 self.children = slideParser.parse(content, slideLexer) self.overlay = overlay or '' <|end_body_0|> <|body_start_1|> title...
Box
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Box: def lateInit(self, kind, title, content, overlay, lineno, **kw): """Initialise box :param kind: Symbol (one of ?!*) denoting box kind :param title: Box title (will be parsed) :param content: Box content (will be parsed) :param overlay: Beamer overlay command :param lineno: Line numb...
stack_v2_sparse_classes_75kplus_train_003260
29,071
permissive
[ { "docstring": "Initialise box :param kind: Symbol (one of ?!*) denoting box kind :param title: Box title (will be parsed) :param content: Box content (will be parsed) :param overlay: Beamer overlay command :param lineno: Line number at the beginning of box", "name": "lateInit", "signature": "def lateIn...
2
stack_v2_sparse_classes_30k_train_044751
Implement the Python class `Box` described below. Class description: Implement the Box class. Method signatures and docstrings: - def lateInit(self, kind, title, content, overlay, lineno, **kw): Initialise box :param kind: Symbol (one of ?!*) denoting box kind :param title: Box title (will be parsed) :param content: ...
Implement the Python class `Box` described below. Class description: Implement the Box class. Method signatures and docstrings: - def lateInit(self, kind, title, content, overlay, lineno, **kw): Initialise box :param kind: Symbol (one of ?!*) denoting box kind :param title: Box title (will be parsed) :param content: ...
fbd2c7a72ed2b6347a131a5b54740e7b15bf1624
<|skeleton|> class Box: def lateInit(self, kind, title, content, overlay, lineno, **kw): """Initialise box :param kind: Symbol (one of ?!*) denoting box kind :param title: Box title (will be parsed) :param content: Box content (will be parsed) :param overlay: Beamer overlay command :param lineno: Line numb...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Box: def lateInit(self, kind, title, content, overlay, lineno, **kw): """Initialise box :param kind: Symbol (one of ?!*) denoting box kind :param title: Box title (will be parsed) :param content: Box content (will be parsed) :param overlay: Beamer overlay command :param lineno: Line number at the begi...
the_stack_v2_python_sparse
beamr/interpreters/hierarchical.py
teonistor/beamr
train
5
51e3d1e21cf07757485a41632db4ef092670d956
[ "if single:\n listing = get_object_or_404(Listing, **filter)\n ids = Similarity.objects.filter(Q(listing_1=listing) | Q(listing_2=listing)).values_list('listing_1', 'listing_2').order_by('-score')[:5]\n pks = set([id[0] for id in ids] + [id[1] for id in ids])\n if len(pks) > 0:\n pks.remove(listi...
<|body_start_0|> if single: listing = get_object_or_404(Listing, **filter) ids = Similarity.objects.filter(Q(listing_1=listing) | Q(listing_2=listing)).values_list('listing_1', 'listing_2').order_by('-score')[:5] pks = set([id[0] for id in ids] + [id[1] for id in ids]) ...
ListingView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListingView: def get_listing(self, filter, single=False): """Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template""" <|body_0|> def get(self, request, *args, **kwargs): """Get listings based o...
stack_v2_sparse_classes_75kplus_train_003261
6,828
no_license
[ { "docstring": "Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template", "name": "get_listing", "signature": "def get_listing(self, filter, single=False)" }, { "docstring": "Get listings based on the input arguments. it ret...
2
stack_v2_sparse_classes_30k_train_001996
Implement the Python class `ListingView` described below. Class description: Implement the ListingView class. Method signatures and docstrings: - def get_listing(self, filter, single=False): Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template...
Implement the Python class `ListingView` described below. Class description: Implement the ListingView class. Method signatures and docstrings: - def get_listing(self, filter, single=False): Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template...
c87755c6fcc487768ace72e5d9617c67295299fd
<|skeleton|> class ListingView: def get_listing(self, filter, single=False): """Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template""" <|body_0|> def get(self, request, *args, **kwargs): """Get listings based o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ListingView: def get_listing(self, filter, single=False): """Retrives listings based on the 'filter' or 404 :param: filter a query Returns the listing dictionary to be sent to the template""" if single: listing = get_object_or_404(Listing, **filter) ids = Similarity.obj...
the_stack_v2_python_sparse
feira/fair/views.py
fmstam/feira
train
0
98db7cb9c3df6058da52be6c2e1589e028090bd4
[ "dofs = numpy.arange(self.ndof)\nfixed = numpy.union1d(dofs[0:2 * (self.nely + 1):2], numpy.array([2 * (self.nelx + 1) * (self.nely + 1) - 1]))\nreturn fixed", "f = numpy.zeros((self.ndof, 1))\nf[1, 0] = -1\nreturn f" ]
<|body_start_0|> dofs = numpy.arange(self.ndof) fixed = numpy.union1d(dofs[0:2 * (self.nely + 1):2], numpy.array([2 * (self.nelx + 1) * (self.nely + 1) - 1])) return fixed <|end_body_0|> <|body_start_1|> f = numpy.zeros((self.ndof, 1)) f[1, 0] = -1 return f <|end_body_1|...
Boundary conditions for the Messerschmitt–Bölkow–Blohm (MBB) beam.
MBBBeamBoundaryConditions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MBBBeamBoundaryConditions: """Boundary conditions for the Messerschmitt–Bölkow–Blohm (MBB) beam.""" def fixed_nodes(self): """:obj:`numpy.ndarray`: Fixed nodes in the bottom corners.""" <|body_0|> def forces(self): """:obj:`numpy.ndarray`: Force vector in the top...
stack_v2_sparse_classes_75kplus_train_003262
8,719
no_license
[ { "docstring": ":obj:`numpy.ndarray`: Fixed nodes in the bottom corners.", "name": "fixed_nodes", "signature": "def fixed_nodes(self)" }, { "docstring": ":obj:`numpy.ndarray`: Force vector in the top center.", "name": "forces", "signature": "def forces(self)" } ]
2
stack_v2_sparse_classes_30k_train_010702
Implement the Python class `MBBBeamBoundaryConditions` described below. Class description: Boundary conditions for the Messerschmitt–Bölkow–Blohm (MBB) beam. Method signatures and docstrings: - def fixed_nodes(self): :obj:`numpy.ndarray`: Fixed nodes in the bottom corners. - def forces(self): :obj:`numpy.ndarray`: Fo...
Implement the Python class `MBBBeamBoundaryConditions` described below. Class description: Boundary conditions for the Messerschmitt–Bölkow–Blohm (MBB) beam. Method signatures and docstrings: - def fixed_nodes(self): :obj:`numpy.ndarray`: Fixed nodes in the bottom corners. - def forces(self): :obj:`numpy.ndarray`: Fo...
067bf9b768e020b3de15fc1dee06c2ca36875619
<|skeleton|> class MBBBeamBoundaryConditions: """Boundary conditions for the Messerschmitt–Bölkow–Blohm (MBB) beam.""" def fixed_nodes(self): """:obj:`numpy.ndarray`: Fixed nodes in the bottom corners.""" <|body_0|> def forces(self): """:obj:`numpy.ndarray`: Force vector in the top...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MBBBeamBoundaryConditions: """Boundary conditions for the Messerschmitt–Bölkow–Blohm (MBB) beam.""" def fixed_nodes(self): """:obj:`numpy.ndarray`: Fixed nodes in the bottom corners.""" dofs = numpy.arange(self.ndof) fixed = numpy.union1d(dofs[0:2 * (self.nely + 1):2], numpy.array...
the_stack_v2_python_sparse
topopt/boundary_conditions.py
carloshernangarrido/topopt1
train
0
d4cbb741b8ec547b373a190af7c89ec71a382815
[ "self._needle = needle\nkmp = [0] * (len(needle) + 2)\nkmp[0] = -1\nkmp[1] = 0\ni = 2\nj = 0\nwhile i < len(needle):\n if needle[i - 1] == needle[j]:\n kmp[i] = j + 1\n i += 1\n j += 1\n elif j > 0:\n j = kmp[j]\n else:\n kmp[i] = 0\n i += 1\nself._kmp = kmp", "w...
<|body_start_0|> self._needle = needle kmp = [0] * (len(needle) + 2) kmp[0] = -1 kmp[1] = 0 i = 2 j = 0 while i < len(needle): if needle[i - 1] == needle[j]: kmp[i] = j + 1 i += 1 j += 1 elif ...
KMP
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KMP: def __init__(self, needle): """https://ja.wikipedia.org/wiki/クヌース–モリス–プラット法 :param typing.Sequence needle: 何を検索するか""" <|body_0|> def index_of(self, haystack, m=0, i=0): """m + (haystack[m:] の何番目に needle があるか) 見つからなければ -1 needle[i:] のみ比較する :param typing.Sequence ...
stack_v2_sparse_classes_75kplus_train_003263
1,969
permissive
[ { "docstring": "https://ja.wikipedia.org/wiki/クヌース–モリス–プラット法 :param typing.Sequence needle: 何を検索するか", "name": "__init__", "signature": "def __init__(self, needle)" }, { "docstring": "m + (haystack[m:] の何番目に needle があるか) 見つからなければ -1 needle[i:] のみ比較する :param typing.Sequence haystack: 何から検索するか :par...
3
null
Implement the Python class `KMP` described below. Class description: Implement the KMP class. Method signatures and docstrings: - def __init__(self, needle): https://ja.wikipedia.org/wiki/クヌース–モリス–プラット法 :param typing.Sequence needle: 何を検索するか - def index_of(self, haystack, m=0, i=0): m + (haystack[m:] の何番目に needle がある...
Implement the Python class `KMP` described below. Class description: Implement the KMP class. Method signatures and docstrings: - def __init__(self, needle): https://ja.wikipedia.org/wiki/クヌース–モリス–プラット法 :param typing.Sequence needle: 何を検索するか - def index_of(self, haystack, m=0, i=0): m + (haystack[m:] の何番目に needle がある...
7d38884007541061ddd69d617a69a0d9bc6176fa
<|skeleton|> class KMP: def __init__(self, needle): """https://ja.wikipedia.org/wiki/クヌース–モリス–プラット法 :param typing.Sequence needle: 何を検索するか""" <|body_0|> def index_of(self, haystack, m=0, i=0): """m + (haystack[m:] の何番目に needle があるか) 見つからなければ -1 needle[i:] のみ比較する :param typing.Sequence ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KMP: def __init__(self, needle): """https://ja.wikipedia.org/wiki/クヌース–モリス–プラット法 :param typing.Sequence needle: 何を検索するか""" self._needle = needle kmp = [0] * (len(needle) + 2) kmp[0] = -1 kmp[1] = 0 i = 2 j = 0 while i < len(needle): i...
the_stack_v2_python_sparse
kmp.py
nohtaray/competitive-programming.py
train
1
62811666d903b82bf81f98dfc8b997a86f1a7d0d
[ "for a1, a2 in itertools.combinations(table_aliases, 2):\n if a1.ref_str == a2.ref_str and a1.ref_str:\n return [LintResult(anchor=a2.segment, description='Duplicate table alias {!r}. Table aliases should be unique.'.format(a2.ref_str))]\nreturn None", "if segment.is_type('select_statement'):\n selec...
<|body_start_0|> for a1, a2 in itertools.combinations(table_aliases, 2): if a1.ref_str == a2.ref_str and a1.ref_str: return [LintResult(anchor=a2.segment, description='Duplicate table alias {!r}. Table aliases should be unique.'.format(a2.ref_str))] return None <|end_body_0|>...
Table aliases should be unique within each clause.
Rule_L020
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rule_L020: """Table aliases should be unique within each clause.""" def _lint_references_and_aliases(self, table_aliases, value_table_function_aliases, references, col_aliases, using_cols, parent_select): """Check whether any aliases are duplicates. NB: Subclasses of this error shoul...
stack_v2_sparse_classes_75kplus_train_003264
2,658
permissive
[ { "docstring": "Check whether any aliases are duplicates. NB: Subclasses of this error should override this function.", "name": "_lint_references_and_aliases", "signature": "def _lint_references_and_aliases(self, table_aliases, value_table_function_aliases, references, col_aliases, using_cols, parent_se...
2
stack_v2_sparse_classes_30k_train_038397
Implement the Python class `Rule_L020` described below. Class description: Table aliases should be unique within each clause. Method signatures and docstrings: - def _lint_references_and_aliases(self, table_aliases, value_table_function_aliases, references, col_aliases, using_cols, parent_select): Check whether any a...
Implement the Python class `Rule_L020` described below. Class description: Table aliases should be unique within each clause. Method signatures and docstrings: - def _lint_references_and_aliases(self, table_aliases, value_table_function_aliases, references, col_aliases, using_cols, parent_select): Check whether any a...
98623974ecc816ac7e23843472d6bbd2c3936800
<|skeleton|> class Rule_L020: """Table aliases should be unique within each clause.""" def _lint_references_and_aliases(self, table_aliases, value_table_function_aliases, references, col_aliases, using_cols, parent_select): """Check whether any aliases are duplicates. NB: Subclasses of this error shoul...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Rule_L020: """Table aliases should be unique within each clause.""" def _lint_references_and_aliases(self, table_aliases, value_table_function_aliases, references, col_aliases, using_cols, parent_select): """Check whether any aliases are duplicates. NB: Subclasses of this error should override th...
the_stack_v2_python_sparse
src/sqlfluff/rules/L020.py
andres-lowrie/sqlfluff
train
1
207b93e58cf13852fde826ed26f8c3c6d8c73424
[ "if not re.match('1[3-9]\\\\d{9}$', value):\n raise serializers.ValidationError('手机号有误')\nreturn value", "if value != 'true':\n raise serializers.ValidationError('请先同意使用协议')\nreturn value", "if attr.get('password') != attr.get('password2'):\n raise serializers.ValidationError('两个密码不一致')\nredis_conn = g...
<|body_start_0|> if not re.match('1[3-9]\\d{9}$', value): raise serializers.ValidationError('手机号有误') return value <|end_body_0|> <|body_start_1|> if value != 'true': raise serializers.ValidationError('请先同意使用协议') return value <|end_body_1|> <|body_start_2|> ...
注册序列化器
CreateUserSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateUserSerializer: """注册序列化器""" def validate_mobile(self, value): """单独校验手机号""" <|body_0|> def validate_allow(self, value): """校验是否同意协议""" <|body_1|> def validate(self, attr): """校验两次密码是否相同""" <|body_2|> def create(self, valid...
stack_v2_sparse_classes_75kplus_train_003265
8,653
no_license
[ { "docstring": "单独校验手机号", "name": "validate_mobile", "signature": "def validate_mobile(self, value)" }, { "docstring": "校验是否同意协议", "name": "validate_allow", "signature": "def validate_allow(self, value)" }, { "docstring": "校验两次密码是否相同", "name": "validate", "signature": "de...
4
stack_v2_sparse_classes_30k_train_034532
Implement the Python class `CreateUserSerializer` described below. Class description: 注册序列化器 Method signatures and docstrings: - def validate_mobile(self, value): 单独校验手机号 - def validate_allow(self, value): 校验是否同意协议 - def validate(self, attr): 校验两次密码是否相同 - def create(self, validated_data): 重写create方法
Implement the Python class `CreateUserSerializer` described below. Class description: 注册序列化器 Method signatures and docstrings: - def validate_mobile(self, value): 单独校验手机号 - def validate_allow(self, value): 校验是否同意协议 - def validate(self, attr): 校验两次密码是否相同 - def create(self, validated_data): 重写create方法 <|skeleton|> cla...
a8fb0fc2352e0c71bab756a06c5a8babd8c350da
<|skeleton|> class CreateUserSerializer: """注册序列化器""" def validate_mobile(self, value): """单独校验手机号""" <|body_0|> def validate_allow(self, value): """校验是否同意协议""" <|body_1|> def validate(self, attr): """校验两次密码是否相同""" <|body_2|> def create(self, valid...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateUserSerializer: """注册序列化器""" def validate_mobile(self, value): """单独校验手机号""" if not re.match('1[3-9]\\d{9}$', value): raise serializers.ValidationError('手机号有误') return value def validate_allow(self, value): """校验是否同意协议""" if value != 'true': ...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/users/serializers.py
zhangjian-ai/meiduo
train
22
f24d9e1202ce469f85a88fb6c7406b3303f43d27
[ "if len(name) == 7 and name[0] == '#':\n self.set_hex(name)\nelse:\n value = Color.colors.get(name, None)\n if value is None:\n raise ValueError(\"Unknown color name '{}'.\".format(name))\n if len(value) == 7:\n self.set_hex(value)\n else:\n self.red, self.green, self.blue = valu...
<|body_start_0|> if len(name) == 7 and name[0] == '#': self.set_hex(name) else: value = Color.colors.get(name, None) if value is None: raise ValueError("Unknown color name '{}'.".format(name)) if len(value) == 7: self.set_he...
Lists of known colors.
Color
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Color: """Lists of known colors.""" def __init__(self, name): """@param name hexadecimal or name""" <|body_0|> def set_hex(self, name): """Converts a string like ``#AABBCC`` into `(red, green, blue)`.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_003266
6,106
permissive
[ { "docstring": "@param name hexadecimal or name", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "Converts a string like ``#AABBCC`` into `(red, green, blue)`.", "name": "set_hex", "signature": "def set_hex(self, name)" } ]
2
stack_v2_sparse_classes_30k_train_045643
Implement the Python class `Color` described below. Class description: Lists of known colors. Method signatures and docstrings: - def __init__(self, name): @param name hexadecimal or name - def set_hex(self, name): Converts a string like ``#AABBCC`` into `(red, green, blue)`.
Implement the Python class `Color` described below. Class description: Lists of known colors. Method signatures and docstrings: - def __init__(self, name): @param name hexadecimal or name - def set_hex(self, name): Converts a string like ``#AABBCC`` into `(red, green, blue)`. <|skeleton|> class Color: """Lists o...
33af98adb093f525df7fac7c86613fa7cd181b44
<|skeleton|> class Color: """Lists of known colors.""" def __init__(self, name): """@param name hexadecimal or name""" <|body_0|> def set_hex(self, name): """Converts a string like ``#AABBCC`` into `(red, green, blue)`.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Color: """Lists of known colors.""" def __init__(self, name): """@param name hexadecimal or name""" if len(name) == 7 and name[0] == '#': self.set_hex(name) else: value = Color.colors.get(name, None) if value is None: raise Value...
the_stack_v2_python_sparse
src/pyensae/graphhelper/_colormap.py
sdpython/pyensae
train
33
64d76b3a5d46c7187335ff0d6d207758c273cc5b
[ "qs = Branch.objects.filter(branch_agent=agent)\nif qs.exists():\n return qs.first()\nreturn None", "if self.get_agent_branch(agent=branch_agent):\n raise TypeError('This agent already has an active branch assigned to them.')\nif not branch_agent:\n raise TypeError('Branches must have an agent.')\nif not...
<|body_start_0|> qs = Branch.objects.filter(branch_agent=agent) if qs.exists(): return qs.first() return None <|end_body_0|> <|body_start_1|> if self.get_agent_branch(agent=branch_agent): raise TypeError('This agent already has an active branch assigned to them.'...
This will have methods to easily help us interact with the Branch object. We override the default Django Manager.
BranchManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BranchManager: """This will have methods to easily help us interact with the Branch object. We override the default Django Manager.""" def get_agent_branch(self, agent=None): """Get the agent's branch. If the agent does not have a branch, return None.""" <|body_0|> def c...
stack_v2_sparse_classes_75kplus_train_003267
2,830
permissive
[ { "docstring": "Get the agent's branch. If the agent does not have a branch, return None.", "name": "get_agent_branch", "signature": "def get_agent_branch(self, agent=None)" }, { "docstring": "This method helps us to create branches with their agents", "name": "create_branch", "signature...
4
stack_v2_sparse_classes_30k_train_037470
Implement the Python class `BranchManager` described below. Class description: This will have methods to easily help us interact with the Branch object. We override the default Django Manager. Method signatures and docstrings: - def get_agent_branch(self, agent=None): Get the agent's branch. If the agent does not hav...
Implement the Python class `BranchManager` described below. Class description: This will have methods to easily help us interact with the Branch object. We override the default Django Manager. Method signatures and docstrings: - def get_agent_branch(self, agent=None): Get the agent's branch. If the agent does not hav...
60d034681da66771412fc73402d690a9fcaa5920
<|skeleton|> class BranchManager: """This will have methods to easily help us interact with the Branch object. We override the default Django Manager.""" def get_agent_branch(self, agent=None): """Get the agent's branch. If the agent does not have a branch, return None.""" <|body_0|> def c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BranchManager: """This will have methods to easily help us interact with the Branch object. We override the default Django Manager.""" def get_agent_branch(self, agent=None): """Get the agent's branch. If the agent does not have a branch, return None.""" qs = Branch.objects.filter(branch_...
the_stack_v2_python_sparse
cargotracker/branches/models.py
MandelaK/CargoTracker
train
0
bc5e42f55a06b65b7b535ab2f3ae1fef626d524f
[ "self._kind = 'kkm'\nself.q_nominal = q_nominal\nself.t_min = t_min\nself.lower_activation_limit = lower_activation_limit\ntimesteps_total = environment.timer.timestepsTotal\nself.total_q_output = np.zeros(environment.timer.timestepsTotal)\nself.current_q_output = np.zeros(environment.timer.timestepsUsedHorizon)\ns...
<|body_start_0|> self._kind = 'kkm' self.q_nominal = q_nominal self.t_min = t_min self.lower_activation_limit = lower_activation_limit timesteps_total = environment.timer.timestepsTotal self.total_q_output = np.zeros(environment.timer.timestepsTotal) self.current_...
Implementation of simple Chiller. Values are based on regeressions for chillers based on fixme. As a first reference i'll use the bachelor thesis of Hardy Lottermann
AbsorptionChiller
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbsorptionChiller: """Implementation of simple Chiller. Values are based on regeressions for chillers based on fixme. As a first reference i'll use the bachelor thesis of Hardy Lottermann""" def __init__(self, environment, q_nominal, t_min=4, lower_activation_limit=0.2): """Construct...
stack_v2_sparse_classes_75kplus_train_003268
6,648
permissive
[ { "docstring": "Constructor of the chiller calculation class Parameters ---------- environment : Extended environment object Common to all other objects. Includes time and weather instances q_nominal: float [W] max cooling load of chiller lower_activation_limit : float , optional (0 <= lowerActivationLimit <= 1...
5
null
Implement the Python class `AbsorptionChiller` described below. Class description: Implementation of simple Chiller. Values are based on regeressions for chillers based on fixme. As a first reference i'll use the bachelor thesis of Hardy Lottermann Method signatures and docstrings: - def __init__(self, environment, q...
Implement the Python class `AbsorptionChiller` described below. Class description: Implementation of simple Chiller. Values are based on regeressions for chillers based on fixme. As a first reference i'll use the bachelor thesis of Hardy Lottermann Method signatures and docstrings: - def __init__(self, environment, q...
99fd0dab7f9a9030fd84ba4715753364662927ec
<|skeleton|> class AbsorptionChiller: """Implementation of simple Chiller. Values are based on regeressions for chillers based on fixme. As a first reference i'll use the bachelor thesis of Hardy Lottermann""" def __init__(self, environment, q_nominal, t_min=4, lower_activation_limit=0.2): """Construct...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AbsorptionChiller: """Implementation of simple Chiller. Values are based on regeressions for chillers based on fixme. As a first reference i'll use the bachelor thesis of Hardy Lottermann""" def __init__(self, environment, q_nominal, t_min=4, lower_activation_limit=0.2): """Constructor of the chi...
the_stack_v2_python_sparse
pycity_calc/energysystems/absorptionchiller.py
RWTH-EBC/pyCity_calc
train
4
f3b9a242811ee112bd5397c230958ad1c6a8adf3
[ "self.physics_controller = physics_controller\nself.physics_controller.add_device_gyro_channel('navxmxp_spi_4_angle')\nr_int = 1.03\nr_kV = 0.742\nr_kA = 0.312\nl_int = 1.01\nl_kV = 0.758\nl_kA = 0.299\nvolts_per_fps = units.volts / (units.inch / units.second)\nvolts_per_acc = units.volts / (units.inch / units.seco...
<|body_start_0|> self.physics_controller = physics_controller self.physics_controller.add_device_gyro_channel('navxmxp_spi_4_angle') r_int = 1.03 r_kV = 0.742 r_kA = 0.312 l_int = 1.01 l_kV = 0.758 l_kA = 0.299 volts_per_fps = units.volts / (units....
PhysicsEngine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhysicsEngine: def __init__(self, physics_controller): """:param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to""" <|body_0|> def update_sim(self, hal_data, now, tm_diff): """Called when the simulation parameters...
stack_v2_sparse_classes_75kplus_train_003269
3,791
no_license
[ { "docstring": ":param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to", "name": "__init__", "signature": "def __init__(self, physics_controller)" }, { "docstring": "Called when the simulation parameters for the program need to be updated. :p...
2
stack_v2_sparse_classes_30k_train_000018
Implement the Python class `PhysicsEngine` described below. Class description: Implement the PhysicsEngine class. Method signatures and docstrings: - def __init__(self, physics_controller): :param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to - def update_sim(se...
Implement the Python class `PhysicsEngine` described below. Class description: Implement the PhysicsEngine class. Method signatures and docstrings: - def __init__(self, physics_controller): :param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to - def update_sim(se...
19846ebf27c99d58075e9f2085e87512c3f67023
<|skeleton|> class PhysicsEngine: def __init__(self, physics_controller): """:param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to""" <|body_0|> def update_sim(self, hal_data, now, tm_diff): """Called when the simulation parameters...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PhysicsEngine: def __init__(self, physics_controller): """:param physics_controller: `pyfrc.physics.core.PhysicsInterface` object to communicate simulation effects to""" self.physics_controller = physics_controller self.physics_controller.add_device_gyro_channel('navxmxp_spi_4_angle') ...
the_stack_v2_python_sparse
physics.py
FRC3184/frc2018
train
3
2923764e629070672dcdd18fc6f44c16e5e98cd6
[ "self.matrix = matrix\nif len(matrix) == 0 or len(matrix[0]) == 0:\n self.mat = []\n return\nif len(matrix) == 1 and len(matrix[0]) == 1:\n a = matrix[0][0]\n self.mat = [[a]]\n return\nself.mat = [[0] * len(matrix[0]) for i in matrix]\nself.mat[0][0] = matrix[0][0]\nfor i in range(1, len(matrix[0]))...
<|body_start_0|> self.matrix = matrix if len(matrix) == 0 or len(matrix[0]) == 0: self.mat = [] return if len(matrix) == 1 and len(matrix[0]) == 1: a = matrix[0][0] self.mat = [[a]] return self.mat = [[0] * len(matrix[0]) for i ...
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_003270
1,776
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_018498
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:...
2337b5031d4dfe033a471cea8ab4aa5ab66122d0
<|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]]""" self.matrix = matrix if len(matrix) == 0 or len(matrix[0]) == 0: self.mat = [] return if len(matrix) == 1 and len(matrix[0]) == 1: a = matrix[0][0] self.ma...
the_stack_v2_python_sparse
304.py
shants/LeetCodePy
train
0
0994f9f83084f58d5df45c069fef3605a9e39d2b
[ "kw = super(FacetPreCreateView, self).get_form_kwargs()\nkw.update({'organization': self.request.user.organization})\nreturn kw", "template = form.data['template']\nname = form.cleaned_data['name']\nurl = reverse('facet_add', kwargs={'template_id': template, 'story': self.kwargs['story']})\nreturn redirect('{}?na...
<|body_start_0|> kw = super(FacetPreCreateView, self).get_form_kwargs() kw.update({'organization': self.request.user.organization}) return kw <|end_body_0|> <|body_start_1|> template = form.data['template'] name = form.cleaned_data['name'] url = reverse('facet_add', kwar...
First step in creating a facet.
FacetPreCreateView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacetPreCreateView: """First step in creating a facet.""" def get_form_kwargs(self): """Pass user organization to the form.""" <|body_0|> def form_valid(self, form): """Redirect to real facet-creation form.""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_75kplus_train_003271
12,799
permissive
[ { "docstring": "Pass user organization to the form.", "name": "get_form_kwargs", "signature": "def get_form_kwargs(self)" }, { "docstring": "Redirect to real facet-creation form.", "name": "form_valid", "signature": "def form_valid(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_011649
Implement the Python class `FacetPreCreateView` described below. Class description: First step in creating a facet. Method signatures and docstrings: - def get_form_kwargs(self): Pass user organization to the form. - def form_valid(self, form): Redirect to real facet-creation form.
Implement the Python class `FacetPreCreateView` described below. Class description: First step in creating a facet. Method signatures and docstrings: - def get_form_kwargs(self): Pass user organization to the form. - def form_valid(self, form): Redirect to real facet-creation form. <|skeleton|> class FacetPreCreateV...
dc6bc79d450f7e2bdf59cfbcd306d05a736e4db9
<|skeleton|> class FacetPreCreateView: """First step in creating a facet.""" def get_form_kwargs(self): """Pass user organization to the form.""" <|body_0|> def form_valid(self, form): """Redirect to real facet-creation form.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FacetPreCreateView: """First step in creating a facet.""" def get_form_kwargs(self): """Pass user organization to the form.""" kw = super(FacetPreCreateView, self).get_form_kwargs() kw.update({'organization': self.request.user.organization}) return kw def form_valid(s...
the_stack_v2_python_sparse
project/editorial/views/facet.py
ProjectFacet/facet
train
25
66c40696b65ffd6ce586eef0762d0e2b2595037f
[ "self.decoder_binlen = kwargs.pop('decoder_binlen', 0.1)\nself.assist_speed = kwargs.pop('assist_speed', 5.0)\nself.target_radius = kwargs.pop('target_radius', 2.0)", "Bu = None\nassist_weight = 0.0\nif assist_level > 0:\n cursor_pos = np.array(current_state[0:3, 0]).ravel()\n target_pos = np.array(target_s...
<|body_start_0|> self.decoder_binlen = kwargs.pop('decoder_binlen', 0.1) self.assist_speed = kwargs.pop('assist_speed', 5.0) self.target_radius = kwargs.pop('target_radius', 2.0) <|end_body_0|> <|body_start_1|> Bu = None assist_weight = 0.0 if assist_level > 0: ...
Constant velocity toward the target if the cursor is outside the target. If the cursor is inside the target, the speed becomes the distance to the center of the target divided by 2.
SimpleEndpointAssister
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleEndpointAssister: """Constant velocity toward the target if the cursor is outside the target. If the cursor is inside the target, the speed becomes the distance to the center of the target divided by 2.""" def __init__(self, *args, **kwargs): """Docstring""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_003272
12,931
permissive
[ { "docstring": "Docstring", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Docstring", "name": "calc_assisted_BMI_state", "signature": "def calc_assisted_BMI_state(self, current_state, target_state, assist_level, mode=None, **kwargs)" }, { ...
3
stack_v2_sparse_classes_30k_train_016069
Implement the Python class `SimpleEndpointAssister` described below. Class description: Constant velocity toward the target if the cursor is outside the target. If the cursor is inside the target, the speed becomes the distance to the center of the target divided by 2. Method signatures and docstrings: - def __init__...
Implement the Python class `SimpleEndpointAssister` described below. Class description: Constant velocity toward the target if the cursor is outside the target. If the cursor is inside the target, the speed becomes the distance to the center of the target divided by 2. Method signatures and docstrings: - def __init__...
a0e296aa663b49e767c9ebb274defb54b301eb12
<|skeleton|> class SimpleEndpointAssister: """Constant velocity toward the target if the cursor is outside the target. If the cursor is inside the target, the speed becomes the distance to the center of the target divided by 2.""" def __init__(self, *args, **kwargs): """Docstring""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleEndpointAssister: """Constant velocity toward the target if the cursor is outside the target. If the cursor is inside the target, the speed becomes the distance to the center of the target divided by 2.""" def __init__(self, *args, **kwargs): """Docstring""" self.decoder_binlen = kw...
the_stack_v2_python_sparse
built_in_tasks/bmimultitasks.py
carmenalab/brain-python-interface
train
9
966ca4d6cc5abbbc3afc3bb3bcd577cc38541683
[ "for length in self.LENGTHS:\n pendulum = PendulumPlant(length=length)\n for _ in range(self.iterations):\n angle = (np.random.rand() - 0.5) * 2 * self.max_angle\n self.assertIsInstance(angle, float)\n ee_pos = pendulum.forward_kinematics(angle)[0]\n self.assertIsInstance(ee_pos, l...
<|body_start_0|> for length in self.LENGTHS: pendulum = PendulumPlant(length=length) for _ in range(self.iterations): angle = (np.random.rand() - 0.5) * 2 * self.max_angle self.assertIsInstance(angle, float) ee_pos = pendulum.forward_kinema...
Test
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test: def test_0_kinematics(self): """Unit test for pendulum kinematics""" <|body_0|> def test_1_dynamics(self): """Unit test for pendulum dynamics""" <|body_1|> <|end_skeleton|> <|body_start_0|> for length in self.LENGTHS: pendulum = Pe...
stack_v2_sparse_classes_75kplus_train_003273
4,821
permissive
[ { "docstring": "Unit test for pendulum kinematics", "name": "test_0_kinematics", "signature": "def test_0_kinematics(self)" }, { "docstring": "Unit test for pendulum dynamics", "name": "test_1_dynamics", "signature": "def test_1_dynamics(self)" } ]
2
stack_v2_sparse_classes_30k_train_012592
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_0_kinematics(self): Unit test for pendulum kinematics - def test_1_dynamics(self): Unit test for pendulum dynamics
Implement the Python class `Test` described below. Class description: Implement the Test class. Method signatures and docstrings: - def test_0_kinematics(self): Unit test for pendulum kinematics - def test_1_dynamics(self): Unit test for pendulum dynamics <|skeleton|> class Test: def test_0_kinematics(self): ...
2dab162a3a7bd33632fd36924b2bfb289249ffa3
<|skeleton|> class Test: def test_0_kinematics(self): """Unit test for pendulum kinematics""" <|body_0|> def test_1_dynamics(self): """Unit test for pendulum dynamics""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test: def test_0_kinematics(self): """Unit test for pendulum kinematics""" for length in self.LENGTHS: pendulum = PendulumPlant(length=length) for _ in range(self.iterations): angle = (np.random.rand() - 0.5) * 2 * self.max_angle self.ass...
the_stack_v2_python_sparse
software/python/simple_pendulum/model/unit_test.py
dfki-ric-underactuated-lab/torque_limited_simple_pendulum
train
37
8e29b3d7ff8b82583d0e9d55abf25b32e33c24c4
[ "if numRows == 0:\n return []\nans = [[1]]\nfor i in range(1, numRows):\n ans.append([1])\n for j in range(1, i):\n ans[i].append(ans[i - 1][j - 1] + ans[i - 1][j])\n ans[i].append(1)\nreturn ans", "if num == 0:\n return []\nans = [[1]]\nfor i in range(num - 1):\n ans.append([sum(item) fo...
<|body_start_0|> if numRows == 0: return [] ans = [[1]] for i in range(1, numRows): ans.append([1]) for j in range(1, i): ans[i].append(ans[i - 1][j - 1] + ans[i - 1][j]) ans[i].append(1) return ans <|end_body_0|> <|body_st...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" <|body_0|> def method_two(num): """用移位的方式,比如: 1 1 0 + 0 1 1 --------- 1 2 1 :param num: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if numRows == 0:...
stack_v2_sparse_classes_75kplus_train_003274
993
permissive
[ { "docstring": ":type numRows: int :rtype: List[List[int]]", "name": "generate", "signature": "def generate(self, numRows)" }, { "docstring": "用移位的方式,比如: 1 1 0 + 0 1 1 --------- 1 2 1 :param num: :return:", "name": "method_two", "signature": "def method_two(num)" } ]
2
stack_v2_sparse_classes_30k_train_011597
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate(self, numRows): :type numRows: int :rtype: List[List[int]] - def method_two(num): 用移位的方式,比如: 1 1 0 + 0 1 1 --------- 1 2 1 :param num: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate(self, numRows): :type numRows: int :rtype: List[List[int]] - def method_two(num): 用移位的方式,比如: 1 1 0 + 0 1 1 --------- 1 2 1 :param num: :return: <|skeleton|> class S...
f71118e8e05d4bcdcfb2dfc42187c73961b8b926
<|skeleton|> class Solution: def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" <|body_0|> def method_two(num): """用移位的方式,比如: 1 1 0 + 0 1 1 --------- 1 2 1 :param num: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def generate(self, numRows): """:type numRows: int :rtype: List[List[int]]""" if numRows == 0: return [] ans = [[1]] for i in range(1, numRows): ans.append([1]) for j in range(1, i): ans[i].append(ans[i - 1][j - 1] +...
the_stack_v2_python_sparse
leetcode-algorithms/118. Pascal's Triangle/solution.py
bbruceyuan/algorithms-and-oj
train
11
91a5687d4c4396e68d100be19e5339ffe3d70d6f
[ "id = str(id)\nconfig = dict(self.config[id])\nwidget_class = get_widget_class(config.pop('class'))\nreturn widget_class(id=id, **config)", "widgets = []\nfor grid_item in self.layout:\n widget = self.get_widget(grid_item['id'])\n widget.set_layout(grid_item)\n widgets.append(widget)\nreturn widgets", ...
<|body_start_0|> id = str(id) config = dict(self.config[id]) widget_class = get_widget_class(config.pop('class')) return widget_class(id=id, **config) <|end_body_0|> <|body_start_1|> widgets = [] for grid_item in self.layout: widget = self.get_widget(grid_ite...
Dashboard
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dashboard: def get_widget(self, id): """Instantiate and return a widget by its ID""" <|body_0|> def get_layout(self): """Return the dashboard's configured layout, suitable for rendering with gridstack.js.""" <|body_1|> def add_widget(self, widget, x=None...
stack_v2_sparse_classes_75kplus_train_003275
1,918
permissive
[ { "docstring": "Instantiate and return a widget by its ID", "name": "get_widget", "signature": "def get_widget(self, id)" }, { "docstring": "Return the dashboard's configured layout, suitable for rendering with gridstack.js.", "name": "get_layout", "signature": "def get_layout(self)" }...
4
stack_v2_sparse_classes_30k_test_000153
Implement the Python class `Dashboard` described below. Class description: Implement the Dashboard class. Method signatures and docstrings: - def get_widget(self, id): Instantiate and return a widget by its ID - def get_layout(self): Return the dashboard's configured layout, suitable for rendering with gridstack.js. ...
Implement the Python class `Dashboard` described below. Class description: Implement the Dashboard class. Method signatures and docstrings: - def get_widget(self, id): Instantiate and return a widget by its ID - def get_layout(self): Return the dashboard's configured layout, suitable for rendering with gridstack.js. ...
506884bc4dc70299db3e2a7ad577dd7fd808065e
<|skeleton|> class Dashboard: def get_widget(self, id): """Instantiate and return a widget by its ID""" <|body_0|> def get_layout(self): """Return the dashboard's configured layout, suitable for rendering with gridstack.js.""" <|body_1|> def add_widget(self, widget, x=None...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dashboard: def get_widget(self, id): """Instantiate and return a widget by its ID""" id = str(id) config = dict(self.config[id]) widget_class = get_widget_class(config.pop('class')) return widget_class(id=id, **config) def get_layout(self): """Return the da...
the_stack_v2_python_sparse
netbox/extras/models/dashboard.py
netbox-community/netbox
train
8,122
a68ac4fff2c6dd140f5baecc0b0d38453e065515
[ "datafile = open(trace_file, 'r')\ntrace_list = []\nwhile True:\n line = datafile.readline()\n if not line:\n break\n PC, TNT = line.split()\n PC = int(PC, 16)\n TNT = int(TNT)\n trace = Trace(PC, TNT)\n trace_list.append(trace)\nreturn trace_list", "binary_address = bin(int(address))[...
<|body_start_0|> datafile = open(trace_file, 'r') trace_list = [] while True: line = datafile.readline() if not line: break PC, TNT = line.split() PC = int(PC, 16) TNT = int(TNT) trace = Trace(PC, TNT) ...
TraceGenerator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TraceGenerator: def trace_list_generator(trace_file): """Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: trace.txt :return: a list of trace""" <|body_0|> def input_vector_generator(global_hr, local...
stack_v2_sparse_classes_75kplus_train_003276
1,596
no_license
[ { "docstring": "Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: trace.txt :return: a list of trace", "name": "trace_list_generator", "signature": "def trace_list_generator(trace_file)" }, { "docstring": ":param global_...
2
stack_v2_sparse_classes_30k_train_052463
Implement the Python class `TraceGenerator` described below. Class description: Implement the TraceGenerator class. Method signatures and docstrings: - def trace_list_generator(trace_file): Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: tr...
Implement the Python class `TraceGenerator` described below. Class description: Implement the TraceGenerator class. Method signatures and docstrings: - def trace_list_generator(trace_file): Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: tr...
2711bc08f15266bec4ca135e8e3e629df46713eb
<|skeleton|> class TraceGenerator: def trace_list_generator(trace_file): """Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: trace.txt :return: a list of trace""" <|body_0|> def input_vector_generator(global_hr, local...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TraceGenerator: def trace_list_generator(trace_file): """Transfer trace.txt into a list of trace, where trace.PC is the decimal address, trace.TNT is branch result :param trace_file: trace.txt :return: a list of trace""" datafile = open(trace_file, 'r') trace_list = [] while Tr...
the_stack_v2_python_sparse
6.基于机器学习的CPU分支预测/Trace_Initializer.py
unlimitediw/CheckCode
train
0
37126b94ad27104a8d2118cb27e3e0ab1b073682
[ "if pos == 2 * n:\n ps.append(''.join(curr_str))\nelse:\n if n_left < n:\n curr_str[pos] = '('\n self._gen(ps, curr_str, pos + 1, n, n_left + 1, n_right)\n if n_left > n_right:\n curr_str[pos] = ')'\n self._gen(ps, curr_str, pos + 1, n, n_left, n_right + 1)\nreturn ps", "if n ...
<|body_start_0|> if pos == 2 * n: ps.append(''.join(curr_str)) else: if n_left < n: curr_str[pos] = '(' self._gen(ps, curr_str, pos + 1, n, n_left + 1, n_right) if n_left > n_right: curr_str[pos] = ')' se...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _gen(self, ps, curr_str, pos, n, n_left, n_right): """:param ps: Global list to save all the parentheses :param curr_str: The current char list. Don't use string for performance consideration. :param pos: The current position :param n: # parentheses to generate :param n_lef...
stack_v2_sparse_classes_75kplus_train_003277
1,205
no_license
[ { "docstring": ":param ps: Global list to save all the parentheses :param curr_str: The current char list. Don't use string for performance consideration. :param pos: The current position :param n: # parentheses to generate :param n_left: # left parentheses generated :param n_right: # right parentheses generate...
2
stack_v2_sparse_classes_30k_val_002447
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _gen(self, ps, curr_str, pos, n, n_left, n_right): :param ps: Global list to save all the parentheses :param curr_str: The current char list. Don't use string for performance...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _gen(self, ps, curr_str, pos, n, n_left, n_right): :param ps: Global list to save all the parentheses :param curr_str: The current char list. Don't use string for performance...
20580185c6f72f3c09a725168af48893156161f5
<|skeleton|> class Solution: def _gen(self, ps, curr_str, pos, n, n_left, n_right): """:param ps: Global list to save all the parentheses :param curr_str: The current char list. Don't use string for performance consideration. :param pos: The current position :param n: # parentheses to generate :param n_lef...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def _gen(self, ps, curr_str, pos, n, n_left, n_right): """:param ps: Global list to save all the parentheses :param curr_str: The current char list. Don't use string for performance consideration. :param pos: The current position :param n: # parentheses to generate :param n_left: # left pare...
the_stack_v2_python_sparse
coding/00022-gen-parentheses/solution.py
misaka-10032/leetcode
train
3
33454ffc195104110836a9655d6065ae3de0b41b
[ "nom = 'detail_' + str(edition.annee) + '_' + Outils.mois_string(edition.mois) + '_' + str(edition.version)\nif edition.version > 0:\n nom += '_' + str(edition.client_unique)\nnom += '.csv'\nwith dossier_destination.writer(nom) as fichier_writer:\n ligne = ['Année', 'Mois', 'Code Client Facture', 'Code Client...
<|body_start_0|> nom = 'detail_' + str(edition.annee) + '_' + Outils.mois_string(edition.mois) + '_' + str(edition.version) if edition.version > 0: nom += '_' + str(edition.client_unique) nom += '.csv' with dossier_destination.writer(nom) as fichier_writer: ligne ...
Classe pour la création du détail des coûts
Detail
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Detail: """Classe pour la création du détail des coûts""" def detail(dossier_destination, edition, lignes): """création du détail des coûts :param dossier_destination: Une instance de la classe dossier.DossierDestination :param edition: paramètres d'édition :param lignes: lignes de d...
stack_v2_sparse_classes_75kplus_train_003278
4,685
no_license
[ { "docstring": "création du détail des coûts :param dossier_destination: Une instance de la classe dossier.DossierDestination :param edition: paramètres d'édition :param lignes: lignes de données du détail", "name": "detail", "signature": "def detail(dossier_destination, edition, lignes)" }, { "...
2
null
Implement the Python class `Detail` described below. Class description: Classe pour la création du détail des coûts Method signatures and docstrings: - def detail(dossier_destination, edition, lignes): création du détail des coûts :param dossier_destination: Une instance de la classe dossier.DossierDestination :param...
Implement the Python class `Detail` described below. Class description: Classe pour la création du détail des coûts Method signatures and docstrings: - def detail(dossier_destination, edition, lignes): création du détail des coûts :param dossier_destination: Une instance de la classe dossier.DossierDestination :param...
6ae8fa5d20d00a3a018e87c2c3878dbd24cd6ac2
<|skeleton|> class Detail: """Classe pour la création du détail des coûts""" def detail(dossier_destination, edition, lignes): """création du détail des coûts :param dossier_destination: Une instance de la classe dossier.DossierDestination :param edition: paramètres d'édition :param lignes: lignes de d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Detail: """Classe pour la création du détail des coûts""" def detail(dossier_destination, edition, lignes): """création du détail des coûts :param dossier_destination: Une instance de la classe dossier.DossierDestination :param edition: paramètres d'édition :param lignes: lignes de données du dét...
the_stack_v2_python_sparse
traitement/detail.py
gusthiot/PyFactEl-V6
train
0
bda0696eb6a8b2554afb96089956b629d59ee50a
[ "try:\n self.target_obj = Target.objects.get(created_by=self.request.user, is_quick_target=True)\nexcept:\n self.target_obj = None\nreturn TargetMinions.objects.filter(target=self.target_obj)", "response = generics.ListAPIView.list(self, request, *args, **kwargs).data\nminion_paginator = self.paginate_query...
<|body_start_0|> try: self.target_obj = Target.objects.get(created_by=self.request.user, is_quick_target=True) except: self.target_obj = None return TargetMinions.objects.filter(target=self.target_obj) <|end_body_0|> <|body_start_1|> response = generics.ListAPIVi...
Get quick target object list and return the response
ListQuickTargetView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListQuickTargetView: """Get quick target object list and return the response""" def get_queryset(self): """get query set""" <|body_0|> def list(self, request, *args, **kwargs): """send custom response using overriding the list method""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus_train_003279
32,893
no_license
[ { "docstring": "get query set", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "send custom response using overriding the list method", "name": "list", "signature": "def list(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_012970
Implement the Python class `ListQuickTargetView` described below. Class description: Get quick target object list and return the response Method signatures and docstrings: - def get_queryset(self): get query set - def list(self, request, *args, **kwargs): send custom response using overriding the list method
Implement the Python class `ListQuickTargetView` described below. Class description: Get quick target object list and return the response Method signatures and docstrings: - def get_queryset(self): get query set - def list(self, request, *args, **kwargs): send custom response using overriding the list method <|skele...
122a172caea82ef660e81a9dfc6377afd731f9cb
<|skeleton|> class ListQuickTargetView: """Get quick target object list and return the response""" def get_queryset(self): """get query set""" <|body_0|> def list(self, request, *args, **kwargs): """send custom response using overriding the list method""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ListQuickTargetView: """Get quick target object list and return the response""" def get_queryset(self): """get query set""" try: self.target_obj = Target.objects.get(created_by=self.request.user, is_quick_target=True) except: self.target_obj = None ...
the_stack_v2_python_sparse
sso/files/gui/sse/target/views.py
nofxrok/headless
train
1
857fc3a44974fc4a2ca529f319bdbac4498990ce
[ "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...
The RemoteDataSource service definition.
RemoteDataSourceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoteDataSourceServicer: """The RemoteDataSource service definition.""" def ListDataSources(self, request, context): """Return a list of dataSources this remote service has""" <|body_0|> def dataSourceUniques(self, request, context): """Return unique records for...
stack_v2_sparse_classes_75kplus_train_003280
4,605
permissive
[ { "docstring": "Return a list of dataSources this remote service has", "name": "ListDataSources", "signature": "def ListDataSources(self, request, context)" }, { "docstring": "Return unique records for indexing into search", "name": "dataSourceUniques", "signature": "def dataSourceUnique...
4
stack_v2_sparse_classes_30k_train_014151
Implement the Python class `RemoteDataSourceServicer` described below. Class description: The RemoteDataSource service definition. Method signatures and docstrings: - def ListDataSources(self, request, context): Return a list of dataSources this remote service has - def dataSourceUniques(self, request, context): Retu...
Implement the Python class `RemoteDataSourceServicer` described below. Class description: The RemoteDataSource service definition. Method signatures and docstrings: - def ListDataSources(self, request, context): Return a list of dataSources this remote service has - def dataSourceUniques(self, request, context): Retu...
9cd9bc2bcfd3fb88f242dcf3e49a43fb0165633d
<|skeleton|> class RemoteDataSourceServicer: """The RemoteDataSource service definition.""" def ListDataSources(self, request, context): """Return a list of dataSources this remote service has""" <|body_0|> def dataSourceUniques(self, request, context): """Return unique records for...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RemoteDataSourceServicer: """The RemoteDataSource service definition.""" def ListDataSources(self, request, context): """Return a list of dataSources this remote service has""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') r...
the_stack_v2_python_sparse
dv_pyclient/grpc/dataSources_pb2_grpc.py
datavore-labs/dv-pyclient
train
0
e2e06bd241469da798402383bb39efc37e311e32
[ "time = timezone.now() + timedelta(days=10)\nfuture_event = Event(start=time, end=time + timedelta(hours=1), label='test event', category='tests')\nself.assertIs(future_event.is_upcoming(), False)", "time = timezone.now() + timedelta(hours=2)\nfuture_event = Event(start=time, end=time + timedelta(hours=1), label=...
<|body_start_0|> time = timezone.now() + timedelta(days=10) future_event = Event(start=time, end=time + timedelta(hours=1), label='test event', category='tests') self.assertIs(future_event.is_upcoming(), False) <|end_body_0|> <|body_start_1|> time = timezone.now() + timedelta(hours=2) ...
DateModelTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateModelTests: def test_is_upcoming_for_not_upcoming_event(self): """Checks is_upcoming function with events that are not upcoming""" <|body_0|> def test_is_upcoming_for_upcoming_event(self): """Checks is_upcoming with events that are upcoming""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_003281
1,853
no_license
[ { "docstring": "Checks is_upcoming function with events that are not upcoming", "name": "test_is_upcoming_for_not_upcoming_event", "signature": "def test_is_upcoming_for_not_upcoming_event(self)" }, { "docstring": "Checks is_upcoming with events that are upcoming", "name": "test_is_upcoming_...
2
stack_v2_sparse_classes_30k_train_013240
Implement the Python class `DateModelTests` described below. Class description: Implement the DateModelTests class. Method signatures and docstrings: - def test_is_upcoming_for_not_upcoming_event(self): Checks is_upcoming function with events that are not upcoming - def test_is_upcoming_for_upcoming_event(self): Chec...
Implement the Python class `DateModelTests` described below. Class description: Implement the DateModelTests class. Method signatures and docstrings: - def test_is_upcoming_for_not_upcoming_event(self): Checks is_upcoming function with events that are not upcoming - def test_is_upcoming_for_upcoming_event(self): Chec...
62b4d64e9fe98c8e8221526ee47668160f0bc246
<|skeleton|> class DateModelTests: def test_is_upcoming_for_not_upcoming_event(self): """Checks is_upcoming function with events that are not upcoming""" <|body_0|> def test_is_upcoming_for_upcoming_event(self): """Checks is_upcoming with events that are upcoming""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DateModelTests: def test_is_upcoming_for_not_upcoming_event(self): """Checks is_upcoming function with events that are not upcoming""" time = timezone.now() + timedelta(days=10) future_event = Event(start=time, end=time + timedelta(hours=1), label='test event', category='tests') ...
the_stack_v2_python_sparse
events/tests.py
eddumpy/EventPlanner
train
0
da386638f05c716a947156ce61d51dd5042cacbb
[ "delivery_mode = self._parse_arguments(arguments, results)\nif delivery_mode is ContinueProcessing.no:\n return ContinueProcessing.no\ndisplay_name, email = parseaddr(msg['from'])\nif not email:\n email = msg.sender\nif not email:\n print(_('$self.name: No valid address found to subscribe'), file=results)\...
<|body_start_0|> delivery_mode = self._parse_arguments(arguments, results) if delivery_mode is ContinueProcessing.no: return ContinueProcessing.no display_name, email = parseaddr(msg['from']) if not email: email = msg.sender if not email: print...
The email 'join' command.
Join
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Join: """The email 'join' command.""" def process(self, mlist, msg, msgdata, arguments, results): """See `IEmailCommand`.""" <|body_0|> def _parse_arguments(self, arguments, results): """Parse command arguments. :param arguments: The sequences of arguments as giv...
stack_v2_sparse_classes_75kplus_train_003282
8,737
no_license
[ { "docstring": "See `IEmailCommand`.", "name": "process", "signature": "def process(self, mlist, msg, msgdata, arguments, results)" }, { "docstring": "Parse command arguments. :param arguments: The sequences of arguments as given to the `process()` method. :param results: The results object. :re...
2
stack_v2_sparse_classes_30k_train_004321
Implement the Python class `Join` described below. Class description: The email 'join' command. Method signatures and docstrings: - def process(self, mlist, msg, msgdata, arguments, results): See `IEmailCommand`. - def _parse_arguments(self, arguments, results): Parse command arguments. :param arguments: The sequence...
Implement the Python class `Join` described below. Class description: The email 'join' command. Method signatures and docstrings: - def process(self, mlist, msg, msgdata, arguments, results): See `IEmailCommand`. - def _parse_arguments(self, arguments, results): Parse command arguments. :param arguments: The sequence...
7edf8148e34b9f73ca6433ceb43a1770f4fa32c1
<|skeleton|> class Join: """The email 'join' command.""" def process(self, mlist, msg, msgdata, arguments, results): """See `IEmailCommand`.""" <|body_0|> def _parse_arguments(self, arguments, results): """Parse command arguments. :param arguments: The sequences of arguments as giv...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Join: """The email 'join' command.""" def process(self, mlist, msg, msgdata, arguments, results): """See `IEmailCommand`.""" delivery_mode = self._parse_arguments(arguments, results) if delivery_mode is ContinueProcessing.no: return ContinueProcessing.no displa...
the_stack_v2_python_sparse
libs/Mailman/mailman/commands/eml_membership.py
masomel/py-import-analysis
train
1
10ee6eb07536dd1c49755073b616ab1520b23731
[ "try:\n time.sleep(0.5)\n elements = dr.find_visible_elements(selectory[0])\n if len(elements) == 1:\n time.sleep(0.5)\n elements[0].click()\n else:\n element = elements[selectory[1]]\n element.click()\nexcept IndexError:\n elements = dr.find_elements(selectory[0])\n if...
<|body_start_0|> try: time.sleep(0.5) elements = dr.find_visible_elements(selectory[0]) if len(elements) == 1: time.sleep(0.5) elements[0].click() else: element = elements[selectory[1]] element.click(...
MyElements
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyElements: def elements_click(self, dr, selectory): """探针卸载获得的class都是第一个 #elements=dr.find_visible_elements(".ivu-btn.ivu-btn-primary.ivu-btn-large")#确定""" <|body_0|> def elements_text_update(self, dr, selectory, msg): """探针卸载获得的class都是第一个 #elements=dr.find_visible_...
stack_v2_sparse_classes_75kplus_train_003283
3,395
no_license
[ { "docstring": "探针卸载获得的class都是第一个 #elements=dr.find_visible_elements(\".ivu-btn.ivu-btn-primary.ivu-btn-large\")#确定", "name": "elements_click", "signature": "def elements_click(self, dr, selectory)" }, { "docstring": "探针卸载获得的class都是第一个 #elements=dr.find_visible_elements(\".ivu-btn.ivu-btn-primar...
2
stack_v2_sparse_classes_30k_val_002954
Implement the Python class `MyElements` described below. Class description: Implement the MyElements class. Method signatures and docstrings: - def elements_click(self, dr, selectory): 探针卸载获得的class都是第一个 #elements=dr.find_visible_elements(".ivu-btn.ivu-btn-primary.ivu-btn-large")#确定 - def elements_text_update(self, dr...
Implement the Python class `MyElements` described below. Class description: Implement the MyElements class. Method signatures and docstrings: - def elements_click(self, dr, selectory): 探针卸载获得的class都是第一个 #elements=dr.find_visible_elements(".ivu-btn.ivu-btn-primary.ivu-btn-large")#确定 - def elements_text_update(self, dr...
a5cf2ab372d1e1e09cae1904c22dba2eab3c29de
<|skeleton|> class MyElements: def elements_click(self, dr, selectory): """探针卸载获得的class都是第一个 #elements=dr.find_visible_elements(".ivu-btn.ivu-btn-primary.ivu-btn-large")#确定""" <|body_0|> def elements_text_update(self, dr, selectory, msg): """探针卸载获得的class都是第一个 #elements=dr.find_visible_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MyElements: def elements_click(self, dr, selectory): """探针卸载获得的class都是第一个 #elements=dr.find_visible_elements(".ivu-btn.ivu-btn-primary.ivu-btn-large")#确定""" try: time.sleep(0.5) elements = dr.find_visible_elements(selectory[0]) if len(elements) == 1: ...
the_stack_v2_python_sparse
common/elements_base.py
ItTestKing/Base_test
train
0
de2ff30cd2c1c67f09d3878bc8682564434d1756
[ "self.arm_options = config_entry.options.get(OPTIONS_ARM, DEFAULT_ARM_OPTIONS)\nself.zone_options = config_entry.options.get(OPTIONS_ZONES, DEFAULT_ZONE_OPTIONS)\nself.selected_zone = None", "if user_input is not None:\n if user_input[EDIT_KEY] == EDIT_SETTINGS:\n return await self.async_step_arm_settin...
<|body_start_0|> self.arm_options = config_entry.options.get(OPTIONS_ARM, DEFAULT_ARM_OPTIONS) self.zone_options = config_entry.options.get(OPTIONS_ZONES, DEFAULT_ZONE_OPTIONS) self.selected_zone = None <|end_body_0|> <|body_start_1|> if user_input is not None: if user_input...
Handle AlarmDecoder options.
AlarmDecoderOptionsFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlarmDecoderOptionsFlowHandler: """Handle AlarmDecoder options.""" def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize AlarmDecoder options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Manage the options...
stack_v2_sparse_classes_75kplus_train_003284
12,612
permissive
[ { "docstring": "Initialize AlarmDecoder options flow.", "name": "__init__", "signature": "def __init__(self, config_entry: config_entries.ConfigEntry) -> None" }, { "docstring": "Manage the options.", "name": "async_step_init", "signature": "async def async_step_init(self, user_input=Non...
5
stack_v2_sparse_classes_30k_train_014380
Implement the Python class `AlarmDecoderOptionsFlowHandler` described below. Class description: Handle AlarmDecoder options. Method signatures and docstrings: - def __init__(self, config_entry: config_entries.ConfigEntry) -> None: Initialize AlarmDecoder options flow. - async def async_step_init(self, user_input=None...
Implement the Python class `AlarmDecoderOptionsFlowHandler` described below. Class description: Handle AlarmDecoder options. Method signatures and docstrings: - def __init__(self, config_entry: config_entries.ConfigEntry) -> None: Initialize AlarmDecoder options flow. - async def async_step_init(self, user_input=None...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AlarmDecoderOptionsFlowHandler: """Handle AlarmDecoder options.""" def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize AlarmDecoder options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Manage the options...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AlarmDecoderOptionsFlowHandler: """Handle AlarmDecoder options.""" def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize AlarmDecoder options flow.""" self.arm_options = config_entry.options.get(OPTIONS_ARM, DEFAULT_ARM_OPTIONS) self.zone_options = co...
the_stack_v2_python_sparse
homeassistant/components/alarmdecoder/config_flow.py
home-assistant/core
train
35,501
48c39f607c3157312342e8aafa3f6f33a2fd5a67
[ "def _serialize(node):\n if node is None:\n return\n data.append(str(node.val))\n _serialize(node.left)\n _serialize(node.right)\ndata = []\n_serialize(root)\nreturn self.SEP.join(data)", "def _deserialize(min_val, max_val):\n if not data or data[0] < min_val or data[0] > max_val:\n r...
<|body_start_0|> def _serialize(node): if node is None: return data.append(str(node.val)) _serialize(node.left) _serialize(node.right) data = [] _serialize(root) return self.SEP.join(data) <|end_body_0|> <|body_start_1|> ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def _serialize...
stack_v2_sparse_classes_75kplus_train_003285
1,526
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_028987
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
4f5f5124534bd4423356a5f5572b8a39b7828d80
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def _serialize(node): if node is None: return data.append(str(node.val)) _serialize(node.left) _serialize(node.right) data = [] ...
the_stack_v2_python_sparse
leetcode/serialize-and-deserialize-bst/285913288.py
ausaki/data_structures_and_algorithms
train
1
b5299c1d2d250e00335b293ad06db1c62a68d3bb
[ "self._graph = graph\nself._valid_ops = valid_ops\nself.detect_ops_in_graph(op_to_module_dict)", "all_op_patterns_list = [op_dict['pattern'] for op_dict in list(reference_op_pattern_info_dict.values())]\nfor pattern in all_op_patterns_list:\n layer_matcher = graph_matcher.GraphMatcher(pattern)\n for match_r...
<|body_start_0|> self._graph = graph self._valid_ops = valid_ops self.detect_ops_in_graph(op_to_module_dict) <|end_body_0|> <|body_start_1|> all_op_patterns_list = [op_dict['pattern'] for op_dict in list(reference_op_pattern_info_dict.values())] for pattern in all_op_patterns_li...
The SubGraphMatcher class encapsulates the functionality associated with individual Op level subgraphs. It creates OpTypePattern for those Ops in a model that have multiple associated internal Ops in the Session Graph. It uses these OpTypePattern objects to detect Ops in the Session Graph. It holds the detected Ops and...
SubGraphMatcher
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubGraphMatcher: """The SubGraphMatcher class encapsulates the functionality associated with individual Op level subgraphs. It creates OpTypePattern for those Ops in a model that have multiple associated internal Ops in the Session Graph. It uses these OpTypePattern objects to detect Ops in the S...
stack_v2_sparse_classes_75kplus_train_003286
30,820
permissive
[ { "docstring": "Initialize the SubGraphMatcher. :param graph: Session Graph associated with the model :param op_to_module_dict: Dictionary mapping op to module op info, to be filled in by SubGraphMatcher :param valid_ops: Ops that will be considered during module detection", "name": "__init__", "signatu...
3
stack_v2_sparse_classes_30k_train_012254
Implement the Python class `SubGraphMatcher` described below. Class description: The SubGraphMatcher class encapsulates the functionality associated with individual Op level subgraphs. It creates OpTypePattern for those Ops in a model that have multiple associated internal Ops in the Session Graph. It uses these OpTyp...
Implement the Python class `SubGraphMatcher` described below. Class description: The SubGraphMatcher class encapsulates the functionality associated with individual Op level subgraphs. It creates OpTypePattern for those Ops in a model that have multiple associated internal Ops in the Session Graph. It uses these OpTyp...
5a406e657082b6a4f6e4bf48f0e46e085cb1e351
<|skeleton|> class SubGraphMatcher: """The SubGraphMatcher class encapsulates the functionality associated with individual Op level subgraphs. It creates OpTypePattern for those Ops in a model that have multiple associated internal Ops in the Session Graph. It uses these OpTypePattern objects to detect Ops in the S...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubGraphMatcher: """The SubGraphMatcher class encapsulates the functionality associated with individual Op level subgraphs. It creates OpTypePattern for those Ops in a model that have multiple associated internal Ops in the Session Graph. It uses these OpTypePattern objects to detect Ops in the Session Graph....
the_stack_v2_python_sparse
TrainingExtensions/tensorflow/src/python/aimet_tensorflow/common/sub_graph_matcher.py
quic/aimet
train
1,676
089999c449eae46d79e91689a2c2dc53a5c68d92
[ "self.availability_set = availability_set\nself.azure_managed_disk_params = azure_managed_disk_params\nself.compute_options = compute_options\nself.data_transfer_info = data_transfer_info\nself.network_resource_group = network_resource_group\nself.network_security_group = network_security_group\nself.resource_group...
<|body_start_0|> self.availability_set = availability_set self.azure_managed_disk_params = azure_managed_disk_params self.compute_options = compute_options self.data_transfer_info = data_transfer_info self.network_resource_group = network_resource_group self.network_secur...
Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Availability set in which the VM is to be restored. azure_managed_disk_params (AzureManagedD...
DeployVMsToAzureParams
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeployVMsToAzureParams: """Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Availability set in which the VM is to be ...
stack_v2_sparse_classes_75kplus_train_003287
10,381
permissive
[ { "docstring": "Constructor for the DeployVMsToAzureParams class", "name": "__init__", "signature": "def __init__(self, availability_set=None, azure_managed_disk_params=None, compute_options=None, data_transfer_info=None, network_resource_group=None, network_security_group=None, resource_group=None, sto...
2
stack_v2_sparse_classes_30k_train_018118
Implement the Python class `DeployVMsToAzureParams` described below. Class description: Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Ava...
Implement the Python class `DeployVMsToAzureParams` described below. Class description: Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Ava...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DeployVMsToAzureParams: """Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Availability set in which the VM is to be ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeployVMsToAzureParams: """Implementation of the 'DeployVMsToAzureParams' model. Contains Azure specific information needed to identify various resources when converting and deploying a VM to Azure. Attributes: availability_set (EntityProto): Name of the Availability set in which the VM is to be restored. azu...
the_stack_v2_python_sparse
cohesity_management_sdk/models/deploy_vms_to_azure_params.py
cohesity/management-sdk-python
train
24
55c573795c3ab90a55ab5e34086e5dfd8d83028d
[ "res = []\nn = len(nums)\nfor i in range(n + 1):\n for j in combinations(nums, i):\n res.append(list(j))\nreturn res", "output = [[]]\nfor num in nums:\n output += [result + [num] for result in output]\nreturn output" ]
<|body_start_0|> res = [] n = len(nums) for i in range(n + 1): for j in combinations(nums, i): res.append(list(j)) return res <|end_body_0|> <|body_start_1|> output = [[]] for num in nums: output += [result + [num] for result in ou...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsets1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] n = len(nu...
stack_v2_sparse_classes_75kplus_train_003288
938
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets1", "signature": "def subsets1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "subsets2", "signature": "def subsets2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets1(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsets2(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets1(self, nums): :type nums: List[int] :rtype: List[List[int]] - def subsets2(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution: ...
c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0
<|skeleton|> class Solution: def subsets1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def subsets2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def subsets1(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" res = [] n = len(nums) for i in range(n + 1): for j in combinations(nums, i): res.append(list(j)) return res def subsets2(self, nums): """:ty...
the_stack_v2_python_sparse
code/78#Subsets.py
EachenKuang/LeetCode
train
28
5aac4f9e66d377e9b84da7f2de737fb35b9ce902
[ "if not self.user:\n self.redirect('/login')\n return\ncomment = Comments.get_by_id(int(comment_id))\nif not comment:\n self.error(404)\n return\nif self.user:\n content = comment.content\n post_id = comment.post\n self.render('blog_editcomment_page.html', key=post_id, content=content, user=sel...
<|body_start_0|> if not self.user: self.redirect('/login') return comment = Comments.get_by_id(int(comment_id)) if not comment: self.error(404) return if self.user: content = comment.content post_id = comment.post ...
Render single comment handler
EditComment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EditComment: """Render single comment handler""" def get(self, comment_id): """Blog post""" <|body_0|> def post(self, comment_id): """Add Edited-comment to db""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not self.user: self.red...
stack_v2_sparse_classes_75kplus_train_003289
1,670
no_license
[ { "docstring": "Blog post", "name": "get", "signature": "def get(self, comment_id)" }, { "docstring": "Add Edited-comment to db", "name": "post", "signature": "def post(self, comment_id)" } ]
2
null
Implement the Python class `EditComment` described below. Class description: Render single comment handler Method signatures and docstrings: - def get(self, comment_id): Blog post - def post(self, comment_id): Add Edited-comment to db
Implement the Python class `EditComment` described below. Class description: Render single comment handler Method signatures and docstrings: - def get(self, comment_id): Blog post - def post(self, comment_id): Add Edited-comment to db <|skeleton|> class EditComment: """Render single comment handler""" def g...
269a47ede1857ddc28ecc70811d5a47a264d6961
<|skeleton|> class EditComment: """Render single comment handler""" def get(self, comment_id): """Blog post""" <|body_0|> def post(self, comment_id): """Add Edited-comment to db""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EditComment: """Render single comment handler""" def get(self, comment_id): """Blog post""" if not self.user: self.redirect('/login') return comment = Comments.get_by_id(int(comment_id)) if not comment: self.error(404) return...
the_stack_v2_python_sparse
handlers/editcomment.py
RoseannaM/web-log
train
0
1e471f9f14face543d7994a2f9edbe03938b69f7
[ "if root is None:\n return []\nresult = []\n\ndef dfs(root, total, path):\n if root.left is None and root.right is None and (total == sum):\n result.append(path[:])\n if root.left:\n path.append(root.left.val)\n dfs(root.left, total + root.left.val, path)\n path.pop()\n if ro...
<|body_start_0|> if root is None: return [] result = [] def dfs(root, total, path): if root.left is None and root.right is None and (total == sum): result.append(path[:]) if root.left: path.append(root.left.val) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: """DFS, Time: O(n), Space: O(n)""" <|body_0|> def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: """BFS, Time: O(n), Space: O(n)""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_75kplus_train_003290
1,566
no_license
[ { "docstring": "DFS, Time: O(n), Space: O(n)", "name": "pathSum", "signature": "def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]" }, { "docstring": "BFS, Time: O(n), Space: O(n)", "name": "pathSum", "signature": "def pathSum(self, root: TreeNode, sum: int) -> List[List[int]...
2
stack_v2_sparse_classes_30k_train_021773
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: DFS, Time: O(n), Space: O(n) - def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: BFS, Time: O(n), Sp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: DFS, Time: O(n), Space: O(n) - def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: BFS, Time: O(n), Sp...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: """DFS, Time: O(n), Space: O(n)""" <|body_0|> def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: """BFS, Time: O(n), Space: O(n)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: """DFS, Time: O(n), Space: O(n)""" if root is None: return [] result = [] def dfs(root, total, path): if root.left is None and root.right is None and (total == sum): ...
the_stack_v2_python_sparse
python/113-Path Sum II.py
cwza/leetcode
train
0
bd57e9a2be88e02d4b9e2d74ab8292335490ce7b
[ "super().__init__()\nself.game = game\nself.gun = gun\nself.game.gun_sprites.add(self)\nself.game.all_sprites.add(self)\nself.frames = []\nself.load_frames()\nself.image = self.frames[0]\nself.rect = self.image.get_rect(midbottom=(self.gun.pos.x, self.gun.pos.y - self.gun.rect.h / 5))\nself.last_frame_update = 0\ns...
<|body_start_0|> super().__init__() self.game = game self.gun = gun self.game.gun_sprites.add(self) self.game.all_sprites.add(self) self.frames = [] self.load_frames() self.image = self.frames[0] self.rect = self.image.get_rect(midbottom=(self.gun....
GunFX
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GunFX: def __init__(self, game, gun): """Fire effect that is attached to the "gun" (Not a child of FX class because animation loops :param game: reference to game instance :param gun: gun sprite object""" <|body_0|> def load_frames(self): """Load frame images into fr...
stack_v2_sparse_classes_75kplus_train_003291
6,351
no_license
[ { "docstring": "Fire effect that is attached to the \"gun\" (Not a child of FX class because animation loops :param game: reference to game instance :param gun: gun sprite object", "name": "__init__", "signature": "def __init__(self, game, gun)" }, { "docstring": "Load frame images into frame li...
3
stack_v2_sparse_classes_30k_train_036803
Implement the Python class `GunFX` described below. Class description: Implement the GunFX class. Method signatures and docstrings: - def __init__(self, game, gun): Fire effect that is attached to the "gun" (Not a child of FX class because animation loops :param game: reference to game instance :param gun: gun sprite...
Implement the Python class `GunFX` described below. Class description: Implement the GunFX class. Method signatures and docstrings: - def __init__(self, game, gun): Fire effect that is attached to the "gun" (Not a child of FX class because animation loops :param game: reference to game instance :param gun: gun sprite...
99f87258d60aab8bb9959cc8df5d6c76236f6db2
<|skeleton|> class GunFX: def __init__(self, game, gun): """Fire effect that is attached to the "gun" (Not a child of FX class because animation loops :param game: reference to game instance :param gun: gun sprite object""" <|body_0|> def load_frames(self): """Load frame images into fr...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GunFX: def __init__(self, game, gun): """Fire effect that is attached to the "gun" (Not a child of FX class because animation loops :param game: reference to game instance :param gun: gun sprite object""" super().__init__() self.game = game self.gun = gun self.game.gun_...
the_stack_v2_python_sparse
src/gun.py
asdf57/RogueRobotRambo
train
0
de2c7fe33201066931f0976c53c663619b00fe22
[ "self.config = config\nself.formatter = logging.Formatter(fmt='[%(asctime)s] %(levelname)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S')\nself.loggers = {}", "tag = record.name\nif tag not in self.loggers:\n self.loggers[tag] = SingleFileLogger(self.config, tag, formatter=self.formatter)\nreturn self.loggers[tag]...
<|body_start_0|> self.config = config self.formatter = logging.Formatter(fmt='[%(asctime)s] %(levelname)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S') self.loggers = {} <|end_body_0|> <|body_start_1|> tag = record.name if tag not in self.loggers: self.loggers[tag] = Si...
A class whose 'handle' method will return the handle method of a different file logger class for each tag, so that different tags get logged to different files. The SingleFileLogger objects are created on the fly in handle() when new tags appear that are have not been seen yet, so there is no need to specify the set of...
MultiFileLogger
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiFileLogger: """A class whose 'handle' method will return the handle method of a different file logger class for each tag, so that different tags get logged to different files. The SingleFileLogger objects are created on the fly in handle() when new tags appear that are have not been seen yet...
stack_v2_sparse_classes_75kplus_train_003292
5,340
permissive
[ { "docstring": "Arg is GlobalConfig / DatasetConfig object", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Handles a record by calling the necessary SingleFileLogger, creating it if not already cached.", "name": "handle", "signature": "def handle(self, ...
2
stack_v2_sparse_classes_30k_train_053151
Implement the Python class `MultiFileLogger` described below. Class description: A class whose 'handle' method will return the handle method of a different file logger class for each tag, so that different tags get logged to different files. The SingleFileLogger objects are created on the fly in handle() when new tags...
Implement the Python class `MultiFileLogger` described below. Class description: A class whose 'handle' method will return the handle method of a different file logger class for each tag, so that different tags get logged to different files. The SingleFileLogger objects are created on the fly in handle() when new tags...
37ad31c4c66658c4c77340efc783040f94df3f3f
<|skeleton|> class MultiFileLogger: """A class whose 'handle' method will return the handle method of a different file logger class for each tag, so that different tags get logged to different files. The SingleFileLogger objects are created on the fly in handle() when new tags appear that are have not been seen yet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiFileLogger: """A class whose 'handle' method will return the handle method of a different file logger class for each tag, so that different tags get logged to different files. The SingleFileLogger objects are created on the fly in handle() when new tags appear that are have not been seen yet, so there is...
the_stack_v2_python_sparse
lib/LoggerServer.py
cedadev/mistamover
train
0
06fdbd5e5bf8dcc90ace8ff30c0aa406da1b4ae0
[ "self.page_mock.text = '{{REDaten\\n|BAND=S I\\n|KEINE_SCHÖPFUNGSHÖHE=ON\\n|TODESJAHR=1950\\n}}\\nbla\\n{{REAutor|Stein.}}'\nre_page = RePage(self.page_mock)\ntask = PDKSTask(None, self.logger)\ncompare({'success': True, 'changed': True}, task.run(re_page))\ncompare('', re_page[0]['TODESJAHR'].value)", "self.page...
<|body_start_0|> self.page_mock.text = '{{REDaten\n|BAND=S I\n|KEINE_SCHÖPFUNGSHÖHE=ON\n|TODESJAHR=1950\n}}\nbla\n{{REAutor|Stein.}}' re_page = RePage(self.page_mock) task = PDKSTask(None, self.logger) compare({'success': True, 'changed': True}, task.run(re_page)) compare('', re_...
TestCOPDTask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCOPDTask: def test_process_newly_public_domain_tj(self): """article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article changed""" <|body_0|> def test_process_newly_public_domain_gj(self): """article is in...
stack_v2_sparse_classes_75kplus_train_003293
3,086
permissive
[ { "docstring": "article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article changed", "name": "test_process_newly_public_domain_tj", "signature": "def test_process_newly_public_domain_tj(self)" }, { "docstring": "article is in public doma...
5
stack_v2_sparse_classes_30k_test_001490
Implement the Python class `TestCOPDTask` described below. Class description: Implement the TestCOPDTask class. Method signatures and docstrings: - def test_process_newly_public_domain_tj(self): article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article chang...
Implement the Python class `TestCOPDTask` described below. Class description: Implement the TestCOPDTask class. Method signatures and docstrings: - def test_process_newly_public_domain_tj(self): article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article chang...
ce0ff778eb895da81ca5fb1cf2ef4d91f08c1881
<|skeleton|> class TestCOPDTask: def test_process_newly_public_domain_tj(self): """article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article changed""" <|body_0|> def test_process_newly_public_domain_gj(self): """article is in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestCOPDTask: def test_process_newly_public_domain_tj(self): """article is in public domain since this day and has no height of creation. Defined by death year. Expectation: article changed""" self.page_mock.text = '{{REDaten\n|BAND=S I\n|KEINE_SCHÖPFUNGSHÖHE=ON\n|TODESJAHR=1950\n}}\nbla\n{{RE...
the_stack_v2_python_sparse
service/ws_re/scanner/tasks/test_move_to_public_domain.py
the-it/WS_THEbotIT
train
6
b71fe722d7c66fb18faf18f86b97d049d02c3be1
[ "if pid == 0:\n logger.warning(\"PID 0 refers to 'every process in calling processes', and should be untouched\")\n return True\ntry:\n os.kill(pid, 0)\nexcept OSError as pid_checkout_error:\n if pid_checkout_error.errno == errno.ESRCH:\n return False\n if pid_checkout_error.errno == errno.EPE...
<|body_start_0|> if pid == 0: logger.warning("PID 0 refers to 'every process in calling processes', and should be untouched") return True try: os.kill(pid, 0) except OSError as pid_checkout_error: if pid_checkout_error.errno == errno.ESRCH: ...
.. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline.
CommandLine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommandLine: """.. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline.""" def check_pid_exists(pid: int) -> bool: """.. versionadded:: 0.2.0 Check whether the given *PID* exists in the current process table. Args: pid (i...
stack_v2_sparse_classes_75kplus_train_003294
5,903
permissive
[ { "docstring": ".. versionadded:: 0.2.0 Check whether the given *PID* exists in the current process table. Args: pid (int): the Process ID you want to check. Returns: A boolean stating the result. Example: .. code-block:: python CommandLine.check_pid_exists(os.getpid()) True", "name": "check_pid_exists", ...
3
stack_v2_sparse_classes_30k_train_048172
Implement the Python class `CommandLine` described below. Class description: .. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline. Method signatures and docstrings: - def check_pid_exists(pid: int) -> bool: .. versionadded:: 0.2.0 Check whether the give...
Implement the Python class `CommandLine` described below. Class description: .. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline. Method signatures and docstrings: - def check_pid_exists(pid: int) -> bool: .. versionadded:: 0.2.0 Check whether the give...
5e63e4e78a9db4929a34f76b8db5099f0cc49115
<|skeleton|> class CommandLine: """.. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline.""" def check_pid_exists(pid: int) -> bool: """.. versionadded:: 0.2.0 Check whether the given *PID* exists in the current process table. Args: pid (i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommandLine: """.. versionadded:: 0.2.0 A high-level object to encapsulate the different methods for interacting with the commandline.""" def check_pid_exists(pid: int) -> bool: """.. versionadded:: 0.2.0 Check whether the given *PID* exists in the current process table. Args: pid (int): the Proc...
the_stack_v2_python_sparse
pyhdtoolkit/utils/cmdline.py
fsoubelet/PyhDToolkit
train
7
b78d0923b8486f19528620bd9a647c84590d3ab4
[ "self.controller = controller\nself.sock_l = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself.sock_l.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\nself.sock_l.bind(('localhost', 9999))\nself.sock_l.listen(0)\nself.sock = None", "self.sock, addr = self.sock_l.accept()\nself.sock_l.close()\nself.soc...
<|body_start_0|> self.controller = controller self.sock_l = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock_l.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.sock_l.bind(('localhost', 9999)) self.sock_l.listen(0) self.sock = None <|end_body_0|> <|b...
Simulation server exposing PandA simulation controller to TCP server
SimulationServer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulationServer: """Simulation server exposing PandA simulation controller to TCP server""" def __init__(self, controller): """Start simulation server and create controller Args: controller(Controller): Zebra2 controller object""" <|body_0|> def run(self): """Ac...
stack_v2_sparse_classes_75kplus_train_003295
23,000
permissive
[ { "docstring": "Start simulation server and create controller Args: controller(Controller): Zebra2 controller object", "name": "__init__", "signature": "def __init__(self, controller)" }, { "docstring": "Accept the first connection to server, then start simulation", "name": "run", "signa...
4
stack_v2_sparse_classes_30k_train_014614
Implement the Python class `SimulationServer` described below. Class description: Simulation server exposing PandA simulation controller to TCP server Method signatures and docstrings: - def __init__(self, controller): Start simulation server and create controller Args: controller(Controller): Zebra2 controller objec...
Implement the Python class `SimulationServer` described below. Class description: Simulation server exposing PandA simulation controller to TCP server Method signatures and docstrings: - def __init__(self, controller): Start simulation server and create controller Args: controller(Controller): Zebra2 controller objec...
9ad5512556c94d38f817b0c02a38d660c8777f43
<|skeleton|> class SimulationServer: """Simulation server exposing PandA simulation controller to TCP server""" def __init__(self, controller): """Start simulation server and create controller Args: controller(Controller): Zebra2 controller object""" <|body_0|> def run(self): """Ac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimulationServer: """Simulation server exposing PandA simulation controller to TCP server""" def __init__(self, controller): """Start simulation server and create controller Args: controller(Controller): Zebra2 controller object""" self.controller = controller self.sock_l = socket...
the_stack_v2_python_sparse
common/python/simulations.py
PandABlocks/PandABlocks-FPGA
train
17
a41b1df91bfb4a684d6d908af56644acef1f0e43
[ "nb_weather = len(WEATHER)\nnb_conditions = len(CAR_CONDITION)\nnb_road_status = len(ROAD_STATE)\nobservation_space = MultiDiscrete((nb_weather, nb_conditions, nb_road_status))\naction_space = Discrete(2)\nself.encoder = partial(np.ravel_multi_index, dims=observation_space.nvec)\nself.decoder = partial(np.unravel_i...
<|body_start_0|> nb_weather = len(WEATHER) nb_conditions = len(CAR_CONDITION) nb_road_status = len(ROAD_STATE) observation_space = MultiDiscrete((nb_weather, nb_conditions, nb_road_status)) action_space = Discrete(2) self.encoder = partial(np.ravel_multi_index, dims=obser...
Driving agent environment.
DrivingAgentEnv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DrivingAgentEnv: """Driving agent environment.""" def __init__(self): """Initialize the environment.""" <|body_0|> def _compute_dynamics(self) -> Dict: """Compute dynamics of the system.""" <|body_1|> <|end_skeleton|> <|body_start_0|> nb_weather...
stack_v2_sparse_classes_75kplus_train_003296
5,627
no_license
[ { "docstring": "Initialize the environment.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Compute dynamics of the system.", "name": "_compute_dynamics", "signature": "def _compute_dynamics(self) -> Dict" } ]
2
stack_v2_sparse_classes_30k_train_013892
Implement the Python class `DrivingAgentEnv` described below. Class description: Driving agent environment. Method signatures and docstrings: - def __init__(self): Initialize the environment. - def _compute_dynamics(self) -> Dict: Compute dynamics of the system.
Implement the Python class `DrivingAgentEnv` described below. Class description: Driving agent environment. Method signatures and docstrings: - def __init__(self): Initialize the environment. - def _compute_dynamics(self) -> Dict: Compute dynamics of the system. <|skeleton|> class DrivingAgentEnv: """Driving age...
b516ffa46e9df6a67fbda7546f9128c23920c460
<|skeleton|> class DrivingAgentEnv: """Driving agent environment.""" def __init__(self): """Initialize the environment.""" <|body_0|> def _compute_dynamics(self) -> Dict: """Compute dynamics of the system.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DrivingAgentEnv: """Driving agent environment.""" def __init__(self): """Initialize the environment.""" nb_weather = len(WEATHER) nb_conditions = len(CAR_CONDITION) nb_road_status = len(ROAD_STATE) observation_space = MultiDiscrete((nb_weather, nb_conditions, nb_ro...
the_stack_v2_python_sparse
src/envs/driving_agent.py
marcofavorito/PAC-RDPs-code
train
2
27cec197f57377f6998ac3dfa06cf52a6454d702
[ "super(G4_SF, self).__init__()\nself.lambd = tf.cast(lambd, tf.keras.backend.floatx())\nself.zeta = tf.cast(zeta, tf.keras.backend.floatx())\nself.basis = GaussianBasis(center=np.zeros_like(eta), gamma=eta)\nself.i = i\nself.j = j\nself.k = k", "i_rind, a_rind, ind_ij, ind_ik = _triplet_filter(ind_2, ind_3, elems...
<|body_start_0|> super(G4_SF, self).__init__() self.lambd = tf.cast(lambd, tf.keras.backend.floatx()) self.zeta = tf.cast(zeta, tf.keras.backend.floatx()) self.basis = GaussianBasis(center=np.zeros_like(eta), gamma=eta) self.i = i self.j = j self.k = k <|end_body_...
BP-style G4 symmetry functions.
G4_SF
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class G4_SF: """BP-style G4 symmetry functions.""" def __init__(self, lambd, zeta, eta, i='ALL', j='ALL', k='ALL'): """Args: lambd (list of floats): lambda parameter of G4 SF zeta (list of floats): zeta parameter of G4 SF eta (list of floats): Gaussian widths i (str): species i j (str): sp...
stack_v2_sparse_classes_75kplus_train_003297
10,280
permissive
[ { "docstring": "Args: lambd (list of floats): lambda parameter of G4 SF zeta (list of floats): zeta parameter of G4 SF eta (list of floats): Gaussian widths i (str): species i j (str): species j k (str): species k", "name": "__init__", "signature": "def __init__(self, lambd, zeta, eta, i='ALL', j='ALL',...
2
stack_v2_sparse_classes_30k_train_013228
Implement the Python class `G4_SF` described below. Class description: BP-style G4 symmetry functions. Method signatures and docstrings: - def __init__(self, lambd, zeta, eta, i='ALL', j='ALL', k='ALL'): Args: lambd (list of floats): lambda parameter of G4 SF zeta (list of floats): zeta parameter of G4 SF eta (list o...
Implement the Python class `G4_SF` described below. Class description: BP-style G4 symmetry functions. Method signatures and docstrings: - def __init__(self, lambd, zeta, eta, i='ALL', j='ALL', k='ALL'): Args: lambd (list of floats): lambda parameter of G4 SF zeta (list of floats): zeta parameter of G4 SF eta (list o...
5717be6dab46c980d6c1e13949719e61b2ba335a
<|skeleton|> class G4_SF: """BP-style G4 symmetry functions.""" def __init__(self, lambd, zeta, eta, i='ALL', j='ALL', k='ALL'): """Args: lambd (list of floats): lambda parameter of G4 SF zeta (list of floats): zeta parameter of G4 SF eta (list of floats): Gaussian widths i (str): species i j (str): sp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class G4_SF: """BP-style G4 symmetry functions.""" def __init__(self, lambd, zeta, eta, i='ALL', j='ALL', k='ALL'): """Args: lambd (list of floats): lambda parameter of G4 SF zeta (list of floats): zeta parameter of G4 SF eta (list of floats): Gaussian widths i (str): species i j (str): species j k (st...
the_stack_v2_python_sparse
pinn/layers/bpsf.py
Teoroo-CMC/PiNN
train
108
c87919dc93fafaa2d8e584a99a9487bedd084d4f
[ "if len(center) == dim:\n self._center = center\nelif len(center) > dim:\n dim = len(center)\n self._center = center\nelse:\n self._center = np.zeros(shape=(dim,))\nif self._center.shape != (dim,):\n raise ValueError(f'Expected {dim}-dimensional inputs.')\nself._amp = amplitude\nself._width = width\n...
<|body_start_0|> if len(center) == dim: self._center = center elif len(center) > dim: dim = len(center) self._center = center else: self._center = np.zeros(shape=(dim,)) if self._center.shape != (dim,): raise ValueError(f'Expect...
Solution initializer for N-dimensional Gaussian acoustic pulse. The Gaussian pulse is defined by: .. math:: {\\rho}E(\\mathbf{r}) = {\\rho}E + a_0 * G(\\mathbf{r})\\\\ G(\\mathbf{r}) = \\exp^{-(\\frac{(\\mathbf{r}-\\mathbf{r}_0)}{\\sqrt{2}w})^{2}}, where $\\mathbf{r}$ are the nodal coordinates, and $\\mathbf{r}_0$, $am...
AcousticPulse
[ "X11", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AcousticPulse: """Solution initializer for N-dimensional Gaussian acoustic pulse. The Gaussian pulse is defined by: .. math:: {\\rho}E(\\mathbf{r}) = {\\rho}E + a_0 * G(\\mathbf{r})\\\\ G(\\mathbf{r}) = \\exp^{-(\\frac{(\\mathbf{r}-\\mathbf{r}_0)}{\\sqrt{2}w})^{2}}, where $\\mathbf{r}$ are the no...
stack_v2_sparse_classes_75kplus_train_003298
32,800
permissive
[ { "docstring": "Initialize acoustic pulse parameters. Parameters ---------- dim: int specify the number of dimensions for the pulse amplitude: float specifies the value of $amplitude$ width: float specifies the rms width of the pulse center: numpy.ndarray pulse location, shape ``(dim,)``", "name": "__init__...
2
stack_v2_sparse_classes_30k_train_029516
Implement the Python class `AcousticPulse` described below. Class description: Solution initializer for N-dimensional Gaussian acoustic pulse. The Gaussian pulse is defined by: .. math:: {\\rho}E(\\mathbf{r}) = {\\rho}E + a_0 * G(\\mathbf{r})\\\\ G(\\mathbf{r}) = \\exp^{-(\\frac{(\\mathbf{r}-\\mathbf{r}_0)}{\\sqrt{2}w...
Implement the Python class `AcousticPulse` described below. Class description: Solution initializer for N-dimensional Gaussian acoustic pulse. The Gaussian pulse is defined by: .. math:: {\\rho}E(\\mathbf{r}) = {\\rho}E + a_0 * G(\\mathbf{r})\\\\ G(\\mathbf{r}) = \\exp^{-(\\frac{(\\mathbf{r}-\\mathbf{r}_0)}{\\sqrt{2}w...
47f144782258eae2b1fb39520e96f414ae176ff4
<|skeleton|> class AcousticPulse: """Solution initializer for N-dimensional Gaussian acoustic pulse. The Gaussian pulse is defined by: .. math:: {\\rho}E(\\mathbf{r}) = {\\rho}E + a_0 * G(\\mathbf{r})\\\\ G(\\mathbf{r}) = \\exp^{-(\\frac{(\\mathbf{r}-\\mathbf{r}_0)}{\\sqrt{2}w})^{2}}, where $\\mathbf{r}$ are the no...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AcousticPulse: """Solution initializer for N-dimensional Gaussian acoustic pulse. The Gaussian pulse is defined by: .. math:: {\\rho}E(\\mathbf{r}) = {\\rho}E + a_0 * G(\\mathbf{r})\\\\ G(\\mathbf{r}) = \\exp^{-(\\frac{(\\mathbf{r}-\\mathbf{r}_0)}{\\sqrt{2}w})^{2}}, where $\\mathbf{r}$ are the nodal coordinat...
the_stack_v2_python_sparse
mirgecom/initializers.py
kaushikcfd/mirgecom
train
0
e1c54603613e217938c5ea0074b929eb25c6ccdc
[ "super(ElasticSearchOutput, self).__init__(store, formatter_mediator, filehandle=filehandle, config=config, filter_use=filter_use)\nself._counter = 0\nself._data = []\nelastic_host = getattr(config, 'elastic_server', '127.0.0.1')\nelastic_port = getattr(config, 'elastic_port', 9200)\nself._elastic_db = pyelasticsea...
<|body_start_0|> super(ElasticSearchOutput, self).__init__(store, formatter_mediator, filehandle=filehandle, config=config, filter_use=filter_use) self._counter = 0 self._data = [] elastic_host = getattr(config, 'elastic_server', '127.0.0.1') elastic_port = getattr(config, 'elast...
Saves the events into an ElasticSearch database.
ElasticSearchOutput
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElasticSearchOutput: """Saves the events into an ElasticSearch database.""" def __init__(self, store, formatter_mediator, filehandle=sys.stdout, config=None, filter_use=None): """Initializes the log output formatter object. Args: store: A storage file object (instance of StorageFile)...
stack_v2_sparse_classes_75kplus_train_003299
8,615
permissive
[ { "docstring": "Initializes the log output formatter object. Args: store: A storage file object (instance of StorageFile) that defines the storage. formatter_mediator: the formatter mediator object (instance of FormatterMediator). filehandle: Optional file-like object that can be written to. The default is sys....
5
stack_v2_sparse_classes_30k_test_001619
Implement the Python class `ElasticSearchOutput` described below. Class description: Saves the events into an ElasticSearch database. Method signatures and docstrings: - def __init__(self, store, formatter_mediator, filehandle=sys.stdout, config=None, filter_use=None): Initializes the log output formatter object. Arg...
Implement the Python class `ElasticSearchOutput` described below. Class description: Saves the events into an ElasticSearch database. Method signatures and docstrings: - def __init__(self, store, formatter_mediator, filehandle=sys.stdout, config=None, filter_use=None): Initializes the log output formatter object. Arg...
2c504690d589bb9e6203d00d9ad53bfd45b32255
<|skeleton|> class ElasticSearchOutput: """Saves the events into an ElasticSearch database.""" def __init__(self, store, formatter_mediator, filehandle=sys.stdout, config=None, filter_use=None): """Initializes the log output formatter object. Args: store: A storage file object (instance of StorageFile)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ElasticSearchOutput: """Saves the events into an ElasticSearch database.""" def __init__(self, store, formatter_mediator, filehandle=sys.stdout, config=None, filter_use=None): """Initializes the log output formatter object. Args: store: A storage file object (instance of StorageFile) that defines...
the_stack_v2_python_sparse
plaso/output/elastic.py
f-s-p/plaso
train
0