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
cb99203d724146daa66b1cac2376519bd1144f0d
[ "with self.getstream() as text_stream:\n for i, line in enumerate(text_stream):\n line = SMSCorpus.case_normalizer(line)\n if self.mask is not None and (not self.mask[i]):\n continue\n ngrams = []\n for ng in tokens2ngrams(self.tokenizer(line)):\n if SMSCorpus.ig...
<|body_start_0|> with self.getstream() as text_stream: for i, line in enumerate(text_stream): line = SMSCorpus.case_normalizer(line) if self.mask is not None and (not self.mask[i]): continue ngrams = [] for ng in tok...
SMSCorpus
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SMSCorpus: def get_texts(self): """Parse documents from a .txt file assuming 1 document per line, yielding lists of filtered tokens""" <|body_0|> def __len__(self): """Enables `len(corpus)`""" <|body_1|> <|end_skeleton|> <|body_start_0|> with self.g...
stack_v2_sparse_classes_75kplus_train_066600
5,014
permissive
[ { "docstring": "Parse documents from a .txt file assuming 1 document per line, yielding lists of filtered tokens", "name": "get_texts", "signature": "def get_texts(self)" }, { "docstring": "Enables `len(corpus)`", "name": "__len__", "signature": "def __len__(self)" } ]
2
stack_v2_sparse_classes_30k_train_014382
Implement the Python class `SMSCorpus` described below. Class description: Implement the SMSCorpus class. Method signatures and docstrings: - def get_texts(self): Parse documents from a .txt file assuming 1 document per line, yielding lists of filtered tokens - def __len__(self): Enables `len(corpus)`
Implement the Python class `SMSCorpus` described below. Class description: Implement the SMSCorpus class. Method signatures and docstrings: - def get_texts(self): Parse documents from a .txt file assuming 1 document per line, yielding lists of filtered tokens - def __len__(self): Enables `len(corpus)` <|skeleton|> c...
c5898e010b04aff72215ba8549859703857698fb
<|skeleton|> class SMSCorpus: def get_texts(self): """Parse documents from a .txt file assuming 1 document per line, yielding lists of filtered tokens""" <|body_0|> def __len__(self): """Enables `len(corpus)`""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SMSCorpus: def get_texts(self): """Parse documents from a .txt file assuming 1 document per line, yielding lists of filtered tokens""" with self.getstream() as text_stream: for i, line in enumerate(text_stream): line = SMSCorpus.case_normalizer(line) ...
the_stack_v2_python_sparse
src/nlpia/gensim_utils.py
totalgood/nlpia3
train
5
9c1c5754998438f0c5768d5e6eb1053e8147dffb
[ "rows_updated = queryset.update(published=False)\nif rows_updated == 1:\n message_bit = '1 story was'\nelse:\n message_bit = '%s stories were' % rows_updated\nself.message_user(request, '%s successfully marked as published.' % message_bit)", "rows_updated = queryset.update(published=True)\nif rows_updated =...
<|body_start_0|> rows_updated = queryset.update(published=False) if rows_updated == 1: message_bit = '1 story was' else: message_bit = '%s stories were' % rows_updated self.message_user(request, '%s successfully marked as published.' % message_bit) <|end_body_0|> ...
Action для публикации и снятия с публикации
ActionPublish
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionPublish: """Action для публикации и снятия с публикации""" def unpublish(self, request, queryset): """Снять с публикации""" <|body_0|> def publish(self, request, queryset): """Опубликовать""" <|body_1|> <|end_skeleton|> <|body_start_0|> ro...
stack_v2_sparse_classes_75kplus_train_066601
2,928
no_license
[ { "docstring": "Снять с публикации", "name": "unpublish", "signature": "def unpublish(self, request, queryset)" }, { "docstring": "Опубликовать", "name": "publish", "signature": "def publish(self, request, queryset)" } ]
2
stack_v2_sparse_classes_30k_train_017225
Implement the Python class `ActionPublish` described below. Class description: Action для публикации и снятия с публикации Method signatures and docstrings: - def unpublish(self, request, queryset): Снять с публикации - def publish(self, request, queryset): Опубликовать
Implement the Python class `ActionPublish` described below. Class description: Action для публикации и снятия с публикации Method signatures and docstrings: - def unpublish(self, request, queryset): Снять с публикации - def publish(self, request, queryset): Опубликовать <|skeleton|> class ActionPublish: """Actio...
d761f9203e3a310c16b66b8da6fbc03d8b8d033c
<|skeleton|> class ActionPublish: """Action для публикации и снятия с публикации""" def unpublish(self, request, queryset): """Снять с публикации""" <|body_0|> def publish(self, request, queryset): """Опубликовать""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ActionPublish: """Action для публикации и снятия с публикации""" def unpublish(self, request, queryset): """Снять с публикации""" rows_updated = queryset.update(published=False) if rows_updated == 1: message_bit = '1 story was' else: message_bit = '...
the_stack_v2_python_sparse
blog/admin.py
djek9007/ich
train
0
3273a4943f6155b3a306bcc9f40065ddb0c17de2
[ "start_index = 0\nend_index = 0\nfor cur_index in range(len(s)):\n odd_len = self.expand_from_center(cur_index, cur_index, s)\n even_len = self.expand_from_center(cur_index, cur_index + 1, s)\n max_len = max(odd_len, even_len)\n if max_len > end_index - start_index:\n start_index = cur_index - in...
<|body_start_0|> start_index = 0 end_index = 0 for cur_index in range(len(s)): odd_len = self.expand_from_center(cur_index, cur_index, s) even_len = self.expand_from_center(cur_index, cur_index + 1, s) max_len = max(odd_len, even_len) if max_len > ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def expand_from_center(self, left, right, s): """Helper function to simulate a sliding window to compute length of palindrome substring. :type left: int -> representing the sliding le...
stack_v2_sparse_classes_75kplus_train_066602
3,038
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": "Helper function to simulate a sliding window to compute length of palindrome substring. :type left: int -> representing the sliding left index :type right: int...
2
stack_v2_sparse_classes_30k_train_050967
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def expand_from_center(self, left, right, s): Helper function to simulate a sliding window to compute length of palindr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def expand_from_center(self, left, right, s): Helper function to simulate a sliding window to compute length of palindr...
3cda643de78c8ee31da16dcb76de936ebd73073b
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def expand_from_center(self, left, right, s): """Helper function to simulate a sliding window to compute length of palindrome substring. :type left: int -> representing the sliding le...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" start_index = 0 end_index = 0 for cur_index in range(len(s)): odd_len = self.expand_from_center(cur_index, cur_index, s) even_len = self.expand_from_center(cur_index, cur_index + 1,...
the_stack_v2_python_sparse
practice/leetcode/longest_palindrome.py
uzaymacar/python-interview-review
train
0
9430f70458f67d18b38397bb5b1aaa66446747b9
[ "print('test_login1_normal is start test...')\npo = LoginPage(self.driver)\npo.login_action('51zxw', 123456)\nsleep(2)\nself.assertEqual(po.type_loginPass_hint(), '我的空间')\nfunction.insert_img(self.driver, '51zxw_login1_normal.jpg')\nprint('test_login1_normal test end!')", "print('test_login2_passwdError is start ...
<|body_start_0|> print('test_login1_normal is start test...') po = LoginPage(self.driver) po.login_action('51zxw', 123456) sleep(2) self.assertEqual(po.type_loginPass_hint(), '我的空间') function.insert_img(self.driver, '51zxw_login1_normal.jpg') print('test_login1_no...
LoginTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginTest: def test_login1_normal(self): """username and passwd is normal""" <|body_0|> def test_login2_PasswdError(self): """username is ok,passwd is error""" <|body_1|> def test_login3_empty(self): """username and passwd is empty""" <|b...
stack_v2_sparse_classes_75kplus_train_066603
1,425
no_license
[ { "docstring": "username and passwd is normal", "name": "test_login1_normal", "signature": "def test_login1_normal(self)" }, { "docstring": "username is ok,passwd is error", "name": "test_login2_PasswdError", "signature": "def test_login2_PasswdError(self)" }, { "docstring": "use...
3
null
Implement the Python class `LoginTest` described below. Class description: Implement the LoginTest class. Method signatures and docstrings: - def test_login1_normal(self): username and passwd is normal - def test_login2_PasswdError(self): username is ok,passwd is error - def test_login3_empty(self): username and pass...
Implement the Python class `LoginTest` described below. Class description: Implement the LoginTest class. Method signatures and docstrings: - def test_login1_normal(self): username and passwd is normal - def test_login2_PasswdError(self): username is ok,passwd is error - def test_login3_empty(self): username and pass...
1c101bb5d6b06882b2f3f179b4dd548a61ed0406
<|skeleton|> class LoginTest: def test_login1_normal(self): """username and passwd is normal""" <|body_0|> def test_login2_PasswdError(self): """username is ok,passwd is error""" <|body_1|> def test_login3_empty(self): """username and passwd is empty""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LoginTest: def test_login1_normal(self): """username and passwd is normal""" print('test_login1_normal is start test...') po = LoginPage(self.driver) po.login_action('51zxw', 123456) sleep(2) self.assertEqual(po.type_loginPass_hint(), '我的空间') function.in...
the_stack_v2_python_sparse
AutoTest_project/Website/test_case/test_login.py
mcbobo/learngit
train
1
27671b9a09b3a6a82187012ba38f8193b9fbcb0c
[ "super().__init__(coordinator, entry, type_id)\nif description.name == UNDEFINED:\n self._attr_has_entity_name = True\nelse:\n self._attr_name = f'{self.product} {description.name}'\nself._attr_unique_id = f'{entry.unique_id}_{description.key}{description.sep_key}{description.subkey}'\nself.entity_description...
<|body_start_0|> super().__init__(coordinator, entry, type_id) if description.name == UNDEFINED: self._attr_has_entity_name = True else: self._attr_name = f'{self.product} {description.name}' self._attr_unique_id = f'{entry.unique_id}_{description.key}{description...
Define a QNAP QSW sensor.
QswSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QswSensor: """Define a QNAP QSW sensor.""" def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None: """Initialize.""" <|body_0|> def _async_update_attrs(self) -> None: """U...
stack_v2_sparse_classes_75kplus_train_066604
12,861
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None" }, { "docstring": "Update sensor attributes.", "name": "_async_update_attrs", ...
2
stack_v2_sparse_classes_30k_train_052412
Implement the Python class `QswSensor` described below. Class description: Define a QNAP QSW sensor. Method signatures and docstrings: - def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None: Initialize. - def _async_update_a...
Implement the Python class `QswSensor` described below. Class description: Define a QNAP QSW sensor. Method signatures and docstrings: - def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None: Initialize. - def _async_update_a...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class QswSensor: """Define a QNAP QSW sensor.""" def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None: """Initialize.""" <|body_0|> def _async_update_attrs(self) -> None: """U...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QswSensor: """Define a QNAP QSW sensor.""" def __init__(self, coordinator: QswDataCoordinator, description: QswSensorEntityDescription, entry: ConfigEntry, type_id: int | None=None) -> None: """Initialize.""" super().__init__(coordinator, entry, type_id) if description.name == UND...
the_stack_v2_python_sparse
homeassistant/components/qnap_qsw/sensor.py
home-assistant/core
train
35,501
930881b9a350ccaef8b6fd9c162071370daaaeda
[ "self.use_ssl = use_ssl\nself.timeout = timeout\nif persistent_params is None:\n self.persistent_params = {}\nelse:\n self.persistent_params = persistent_params\nif auth is not None:\n self.auth = auth\nself.baseurl = '{protocol}://{server}:{port}/'.format(protocol=use_ssl and 'https' or 'http', server=ser...
<|body_start_0|> self.use_ssl = use_ssl self.timeout = timeout if persistent_params is None: self.persistent_params = {} else: self.persistent_params = persistent_params if auth is not None: self.auth = auth self.baseurl = '{protocol}:/...
Connection to pcloud.com based on their json protocol. NOTE: loads the whole file in memory on data upload.
PCloudJSONConnection
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PCloudJSONConnection: """Connection to pcloud.com based on their json protocol. NOTE: loads the whole file in memory on data upload.""" def __init__(self, use_ssl=True, server=PCLOUD_SERVER, port=None, timeout=30, auth=None, persistent_params=None): """Connection to pcloud.com based ...
stack_v2_sparse_classes_75kplus_train_066605
2,417
permissive
[ { "docstring": "Connection to pcloud.com based on their json protocol. persistent_params is a dict that augments params on each command, this is useful for storing auth data. NOTE: persistent_params overrides any values in params on send_command", "name": "__init__", "signature": "def __init__(self, use...
2
stack_v2_sparse_classes_30k_train_042583
Implement the Python class `PCloudJSONConnection` described below. Class description: Connection to pcloud.com based on their json protocol. NOTE: loads the whole file in memory on data upload. Method signatures and docstrings: - def __init__(self, use_ssl=True, server=PCLOUD_SERVER, port=None, timeout=30, auth=None,...
Implement the Python class `PCloudJSONConnection` described below. Class description: Connection to pcloud.com based on their json protocol. NOTE: loads the whole file in memory on data upload. Method signatures and docstrings: - def __init__(self, use_ssl=True, server=PCLOUD_SERVER, port=None, timeout=30, auth=None,...
26d0aa4fe873ec3b41e026142ba547ca5271d4e9
<|skeleton|> class PCloudJSONConnection: """Connection to pcloud.com based on their json protocol. NOTE: loads the whole file in memory on data upload.""" def __init__(self, use_ssl=True, server=PCLOUD_SERVER, port=None, timeout=30, auth=None, persistent_params=None): """Connection to pcloud.com based ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PCloudJSONConnection: """Connection to pcloud.com based on their json protocol. NOTE: loads the whole file in memory on data upload.""" def __init__(self, use_ssl=True, server=PCLOUD_SERVER, port=None, timeout=30, auth=None, persistent_params=None): """Connection to pcloud.com based on their json...
the_stack_v2_python_sparse
pcloudapi/pcloudjson.py
tochev/python3-pcloudapi
train
6
618cd2ef55c365eedfdb416b0577aa38278d48df
[ "error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}\nerror_map.update(kwargs.pop('error_map', {}) or {})\n_headers = case_insensitive_dict(kwargs.pop('headers', {}) or {})\n_params = case_insensitive_dict(kwargs.pop('params', {}) or {})\napi_version = kwargs.pop('api_...
<|body_start_0|> error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {}) or {}) _headers = case_insensitive_dict(kwargs.pop('headers', {}) or {}) _params = case_insensitive_dict(kwargs.pop('params', {...
AuthenticationOperations
[ "LicenseRef-scancode-generic-cla", "MIT", "LGPL-2.1-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthenticationOperations: def exchange_aad_access_token_for_acr_refresh_token(self, grant_type, service, tenant=None, refresh_token=None, access_token=None, **kwargs): """Exchange AAD tokens for an ACR refresh Token. :param grant_type: Can take a value of access_token_refresh_token, or a...
stack_v2_sparse_classes_75kplus_train_066606
10,864
permissive
[ { "docstring": "Exchange AAD tokens for an ACR refresh Token. :param grant_type: Can take a value of access_token_refresh_token, or access_token, or refresh_token. :type grant_type: str or ~container_registry.models.PostContentSchemaGrantType :param service: Indicates the name of your Azure container registry. ...
2
stack_v2_sparse_classes_30k_train_016703
Implement the Python class `AuthenticationOperations` described below. Class description: Implement the AuthenticationOperations class. Method signatures and docstrings: - def exchange_aad_access_token_for_acr_refresh_token(self, grant_type, service, tenant=None, refresh_token=None, access_token=None, **kwargs): Exch...
Implement the Python class `AuthenticationOperations` described below. Class description: Implement the AuthenticationOperations class. Method signatures and docstrings: - def exchange_aad_access_token_for_acr_refresh_token(self, grant_type, service, tenant=None, refresh_token=None, access_token=None, **kwargs): Exch...
c2ca191e736bb06bfbbbc9493e8325763ba990bb
<|skeleton|> class AuthenticationOperations: def exchange_aad_access_token_for_acr_refresh_token(self, grant_type, service, tenant=None, refresh_token=None, access_token=None, **kwargs): """Exchange AAD tokens for an ACR refresh Token. :param grant_type: Can take a value of access_token_refresh_token, or a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuthenticationOperations: def exchange_aad_access_token_for_acr_refresh_token(self, grant_type, service, tenant=None, refresh_token=None, access_token=None, **kwargs): """Exchange AAD tokens for an ACR refresh Token. :param grant_type: Can take a value of access_token_refresh_token, or access_token, o...
the_stack_v2_python_sparse
sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/operations/_patch.py
Azure/azure-sdk-for-python
train
4,046
091b8e3aaadeb6a18ff4e1c862ed46c5c073d2b8
[ "self.tfrecords_file = tfrecords_file\nself.height = height\nself.width = width\nself.min_queue_examples = min_queue_examples\nself.batch_size = batch_size\nself.num_threads = num_threads\nself.reader = tf.TFRecordReader()\nself.name = name", "with tf.name_scope(self.name):\n filename_queue = tf.train.string_i...
<|body_start_0|> self.tfrecords_file = tfrecords_file self.height = height self.width = width self.min_queue_examples = min_queue_examples self.batch_size = batch_size self.num_threads = num_threads self.reader = tf.TFRecordReader() self.name = name <|end_...
Reader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reader: def __init__(self, tfrecords_file, height=64, width=64, min_queue_examples=5000, batch_size=128, num_threads=8, name=''): """Args: tfrecords_file: string, tfrecords file path min_queue_examples: integer, minimum number of samples to retain in the queue that provides of batches of...
stack_v2_sparse_classes_75kplus_train_066607
4,733
no_license
[ { "docstring": "Args: tfrecords_file: string, tfrecords file path min_queue_examples: integer, minimum number of samples to retain in the queue that provides of batches of examples batch_size: integer, number of images per batch num_threads: integer, number of preprocess threads", "name": "__init__", "s...
3
null
Implement the Python class `Reader` described below. Class description: Implement the Reader class. Method signatures and docstrings: - def __init__(self, tfrecords_file, height=64, width=64, min_queue_examples=5000, batch_size=128, num_threads=8, name=''): Args: tfrecords_file: string, tfrecords file path min_queue_...
Implement the Python class `Reader` described below. Class description: Implement the Reader class. Method signatures and docstrings: - def __init__(self, tfrecords_file, height=64, width=64, min_queue_examples=5000, batch_size=128, num_threads=8, name=''): Args: tfrecords_file: string, tfrecords file path min_queue_...
8f3924ce6e34e28bdeb130d623e4271e53435b46
<|skeleton|> class Reader: def __init__(self, tfrecords_file, height=64, width=64, min_queue_examples=5000, batch_size=128, num_threads=8, name=''): """Args: tfrecords_file: string, tfrecords file path min_queue_examples: integer, minimum number of samples to retain in the queue that provides of batches of...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Reader: def __init__(self, tfrecords_file, height=64, width=64, min_queue_examples=5000, batch_size=128, num_threads=8, name=''): """Args: tfrecords_file: string, tfrecords file path min_queue_examples: integer, minimum number of samples to retain in the queue that provides of batches of examples batc...
the_stack_v2_python_sparse
read_record.py
computervisionlearner/L2-Net-TensorFlow
train
2
9d746ead1ecfa2edc7e981f2a342e95a155e7b5a
[ "self.saved_rounds = settings.COMPETITION_ROUNDS\nself.saved_start = settings.COMPETITION_START\nself.saved_end = settings.COMPETITION_END\nself.current_round = 'Round 2'\nstart = datetime.date.today() - datetime.timedelta(days=7)\nend1 = start + datetime.timedelta(days=6)\nstart2 = datetime.date.today()\nend2 = st...
<|body_start_0|> self.saved_rounds = settings.COMPETITION_ROUNDS self.saved_start = settings.COMPETITION_START self.saved_end = settings.COMPETITION_END self.current_round = 'Round 2' start = datetime.date.today() - datetime.timedelta(days=7) end1 = start + datetime.timed...
Tests that the proper variables are loaded into a page.
ContextProcessorFunctionalTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContextProcessorFunctionalTestCase: """Tests that the proper variables are loaded into a page.""" def setUp(self): """Sets up round and competition info to be at the start of round 2.""" <|body_0|> def testRoundInfo(self): """Tests that round info is available fo...
stack_v2_sparse_classes_75kplus_train_066608
7,747
no_license
[ { "docstring": "Sets up round and competition info to be at the start of round 2.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests that round info is available for the page to process.", "name": "testRoundInfo", "signature": "def testRoundInfo(self)" }, { ...
3
null
Implement the Python class `ContextProcessorFunctionalTestCase` described below. Class description: Tests that the proper variables are loaded into a page. Method signatures and docstrings: - def setUp(self): Sets up round and competition info to be at the start of round 2. - def testRoundInfo(self): Tests that round...
Implement the Python class `ContextProcessorFunctionalTestCase` described below. Class description: Tests that the proper variables are loaded into a page. Method signatures and docstrings: - def setUp(self): Sets up round and competition info to be at the start of round 2. - def testRoundInfo(self): Tests that round...
783db33ed0b38fb4dccc371c426265f7028a2d13
<|skeleton|> class ContextProcessorFunctionalTestCase: """Tests that the proper variables are loaded into a page.""" def setUp(self): """Sets up round and competition info to be at the start of round 2.""" <|body_0|> def testRoundInfo(self): """Tests that round info is available fo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContextProcessorFunctionalTestCase: """Tests that the proper variables are loaded into a page.""" def setUp(self): """Sets up round and competition info to be at the start of round 2.""" self.saved_rounds = settings.COMPETITION_ROUNDS self.saved_start = settings.COMPETITION_START ...
the_stack_v2_python_sparse
makahiki/apps/components/makahiki_base/tests.py
keokilee/makahiki
train
2
5b4aec72b768dc96f5310aea98c1d8e0897e3970
[ "super().__init__()\nself.postnet = nn.LayerList()\nfor layer in six.moves.range(n_layers - 1):\n ichans = odim if layer == 0 else n_chans\n ochans = odim if layer == n_layers - 1 else n_chans\n if use_batch_norm:\n self.postnet.append(nn.Sequential(nn.Conv1D(ichans, ochans, n_filts, stride=1, paddi...
<|body_start_0|> super().__init__() self.postnet = nn.LayerList() for layer in six.moves.range(n_layers - 1): ichans = odim if layer == 0 else n_chans ochans = odim if layer == n_layers - 1 else n_chans if use_batch_norm: self.postnet.append(nn...
Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the predicted Mel-filterbank of the decoder, which helps to compensate the de...
Postnet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Postnet: """Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the predicted Mel-filterbank of the decode...
stack_v2_sparse_classes_75kplus_train_066609
6,559
permissive
[ { "docstring": "Initialize postnet module. Parameters ---------- idim : int Dimension of the inputs. odim : int Dimension of the outputs. n_layers : int, optional The number of layers. n_filts : int, optional The number of filter size. n_units : int, optional The number of filter channels. use_batch_norm : bool...
2
stack_v2_sparse_classes_30k_val_000429
Implement the Python class `Postnet` described below. Class description: Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the...
Implement the Python class `Postnet` described below. Class description: Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the...
8705a2a8405e3c63f2174d69880d2b5525a6c9fd
<|skeleton|> class Postnet: """Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the predicted Mel-filterbank of the decode...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Postnet: """Postnet module for Spectrogram prediction network. This is a module of Postnet in Spectrogram prediction network, which described in `Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions`_. The Postnet predicts refines the predicted Mel-filterbank of the decoder, which help...
the_stack_v2_python_sparse
parakeet/modules/tacotron2/decoder.py
PaddlePaddle/Parakeet
train
609
924e9f67a6cb32feb7708409647d9cb221b04cbe
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ConditionalAccessGuestsOrExternalUsers()", "from .conditional_access_external_tenants import ConditionalAccessExternalTenants\nfrom .conditional_access_guest_or_external_user_types import ConditionalAccessGuestOrExternalUserTypes\nfrom...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ConditionalAccessGuestsOrExternalUsers() <|end_body_0|> <|body_start_1|> from .conditional_access_external_tenants import ConditionalAccessExternalTenants from .conditional_access_guest_...
ConditionalAccessGuestsOrExternalUsers
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConditionalAccessGuestsOrExternalUsers: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessGuestsOrExternalUsers: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the...
stack_v2_sparse_classes_75kplus_train_066610
3,844
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ConditionalAccessGuestsOrExternalUsers", "name": "create_from_discriminator_value", "signature": "def create...
3
stack_v2_sparse_classes_30k_train_015570
Implement the Python class `ConditionalAccessGuestsOrExternalUsers` described below. Class description: Implement the ConditionalAccessGuestsOrExternalUsers class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessGuestsOrExternalUsers: C...
Implement the Python class `ConditionalAccessGuestsOrExternalUsers` described below. Class description: Implement the ConditionalAccessGuestsOrExternalUsers class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessGuestsOrExternalUsers: C...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ConditionalAccessGuestsOrExternalUsers: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessGuestsOrExternalUsers: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConditionalAccessGuestsOrExternalUsers: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessGuestsOrExternalUsers: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator...
the_stack_v2_python_sparse
msgraph/generated/models/conditional_access_guests_or_external_users.py
microsoftgraph/msgraph-sdk-python
train
135
54c4f3520d5d633aec41806b924b17ff1faf61a8
[ "QtWidgets.QDialog.__init__(self)\nself.df = pandaTable\nself.layout = QtWidgets.QGridLayout(self)\nself.rankSelect = QtWidgets.QComboBox()\nself.rankSelect.addItems(self.df.columns.values)\nself.programSelect = QtWidgets.QComboBox()\nself.programSelect.addItems(self.df.columns.values)\nself.layout.addWidget(self.p...
<|body_start_0|> QtWidgets.QDialog.__init__(self) self.df = pandaTable self.layout = QtWidgets.QGridLayout(self) self.rankSelect = QtWidgets.QComboBox() self.rankSelect.addItems(self.df.columns.values) self.programSelect = QtWidgets.QComboBox() self.programSelect....
A dialog box to get the information required by the ranksbyPrograms function.
RanksByProgramsDialogBox
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RanksByProgramsDialogBox: """A dialog box to get the information required by the ranksbyPrograms function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" <|body_0|> def getResult...
stack_v2_sparse_classes_75kplus_train_066611
29,548
no_license
[ { "docstring": "Initializes the UI and sets the two dropdowns to display column names of the active Panda.", "name": "__init__", "signature": "def __init__(self, pandaTable, parent)" }, { "docstring": "Returns the user's input", "name": "getResults", "signature": "def getResults(self, pa...
2
stack_v2_sparse_classes_30k_train_034838
Implement the Python class `RanksByProgramsDialogBox` described below. Class description: A dialog box to get the information required by the ranksbyPrograms function. Method signatures and docstrings: - def __init__(self, pandaTable, parent): Initializes the UI and sets the two dropdowns to display column names of t...
Implement the Python class `RanksByProgramsDialogBox` described below. Class description: A dialog box to get the information required by the ranksbyPrograms function. Method signatures and docstrings: - def __init__(self, pandaTable, parent): Initializes the UI and sets the two dropdowns to display column names of t...
1a3c5ad967472faf66236a311cc07a5128f5f911
<|skeleton|> class RanksByProgramsDialogBox: """A dialog box to get the information required by the ranksbyPrograms function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" <|body_0|> def getResult...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RanksByProgramsDialogBox: """A dialog box to get the information required by the ranksbyPrograms function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" QtWidgets.QDialog.__init__(self) s...
the_stack_v2_python_sparse
datatool/gui/Model.py
scottawalton/datatool
train
0
d1f50397ba3593ee2bd6da2b2e2cd558563458b4
[ "def two_sum(left, right, target):\n while left < right:\n if nums[left] + nums[right] + target == 0:\n output.append([target, nums[left], nums[right]])\n while left < right and nums[left] == nums[left + 1]:\n left += 1\n while left < right and nums[right] =...
<|body_start_0|> def two_sum(left, right, target): while left < right: if nums[left] + nums[right] + target == 0: output.append([target, nums[left], nums[right]]) while left < right and nums[left] == nums[left + 1]: left...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSum_failed(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> def threeSum_failed2(self, nums): """:type nums: Li...
stack_v2_sparse_classes_75kplus_train_066612
3,729
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum_failed", "signature": "def threeSum_failed(self, nums)" }, { "docstring...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum_failed(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum_failed2(se...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum_failed(self, nums): :type nums: List[int] :rtype: List[List[int]] - def threeSum_failed2(se...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def threeSum_failed(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> def threeSum_failed2(self, nums): """:type nums: Li...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" def two_sum(left, right, target): while left < right: if nums[left] + nums[right] + target == 0: output.append([target, nums[left], nums[right]]) ...
the_stack_v2_python_sparse
src/lt_15.py
oxhead/CodingYourWay
train
0
4f84e207d7b9eeebbb7e92b77aafeadb97b4514a
[ "errors = {}\nif user_input is not None:\n if user_input[CONF_DEVICE] == CONF_MANUAL_PATH:\n return await self.async_step_setup_serial_manual_path()\n dev_path = await self.hass.async_add_executor_job(usb.get_serial_by_id, user_input[CONF_DEVICE])\n _LOGGER.debug('Using this path : %s', dev_path)\n ...
<|body_start_0|> errors = {} if user_input is not None: if user_input[CONF_DEVICE] == CONF_MANUAL_PATH: return await self.async_step_setup_serial_manual_path() dev_path = await self.hass.async_add_executor_job(usb.get_serial_by_id, user_input[CONF_DEVICE]) ...
Handle a config flow for Ultraheat Heat Meter.
ConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigFlow: """Handle a config flow for Ultraheat Heat Meter.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Step when setting up serial configuration.""" <|body_0|> async def async_step_setup_serial_manual_path(self, user_in...
stack_v2_sparse_classes_75kplus_train_066613
4,924
permissive
[ { "docstring": "Step when setting up serial configuration.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult" }, { "docstring": "Set path manually.", "name": "async_step_setup_serial_manual_path", "signature":...
4
stack_v2_sparse_classes_30k_train_026082
Implement the Python class `ConfigFlow` described below. Class description: Handle a config flow for Ultraheat Heat Meter. Method signatures and docstrings: - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Step when setting up serial configuration. - async def async_step_setup_...
Implement the Python class `ConfigFlow` described below. Class description: Handle a config flow for Ultraheat Heat Meter. Method signatures and docstrings: - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Step when setting up serial configuration. - async def async_step_setup_...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ConfigFlow: """Handle a config flow for Ultraheat Heat Meter.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Step when setting up serial configuration.""" <|body_0|> async def async_step_setup_serial_manual_path(self, user_in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConfigFlow: """Handle a config flow for Ultraheat Heat Meter.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Step when setting up serial configuration.""" errors = {} if user_input is not None: if user_input[CONF_DEVICE] ==...
the_stack_v2_python_sparse
homeassistant/components/landisgyr_heat_meter/config_flow.py
home-assistant/core
train
35,501
76b3eb3cf2623d39f2eb054cc0b7636ae6827484
[ "data = {'id': self.id, 'email': self.email}\ntoken = SecretTool.encryption(data)\nverify_url = 'http://www.meiduo.site:8080/usercenter/verify_email?token=' + token\nreturn verify_url", "data = SecretTool.decryption(token)\nif data is None:\n return data\nid = data.get('id')\nemail = data.get('email')\ntry:\n ...
<|body_start_0|> data = {'id': self.id, 'email': self.email} token = SecretTool.encryption(data) verify_url = 'http://www.meiduo.site:8080/usercenter/verify_email?token=' + token return verify_url <|end_body_0|> <|body_start_1|> data = SecretTool.decryption(token) if dat...
User
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: def generate_verify_email_url(self): """在模型类中写入生成验证邮箱的地址,那么在视图或者序列化器中,就可以通过模型对象直接调用""" <|body_0|> def check_verify_email_token(token): """验证邮箱token""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = {'id': self.id, 'email': self.email} ...
stack_v2_sparse_classes_75kplus_train_066614
2,764
no_license
[ { "docstring": "在模型类中写入生成验证邮箱的地址,那么在视图或者序列化器中,就可以通过模型对象直接调用", "name": "generate_verify_email_url", "signature": "def generate_verify_email_url(self)" }, { "docstring": "验证邮箱token", "name": "check_verify_email_token", "signature": "def check_verify_email_token(token)" } ]
2
null
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def generate_verify_email_url(self): 在模型类中写入生成验证邮箱的地址,那么在视图或者序列化器中,就可以通过模型对象直接调用 - def check_verify_email_token(token): 验证邮箱token
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def generate_verify_email_url(self): 在模型类中写入生成验证邮箱的地址,那么在视图或者序列化器中,就可以通过模型对象直接调用 - def check_verify_email_token(token): 验证邮箱token <|skeleton|> class User: def generate_verify_email...
a8fb0fc2352e0c71bab756a06c5a8babd8c350da
<|skeleton|> class User: def generate_verify_email_url(self): """在模型类中写入生成验证邮箱的地址,那么在视图或者序列化器中,就可以通过模型对象直接调用""" <|body_0|> def check_verify_email_token(token): """验证邮箱token""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class User: def generate_verify_email_url(self): """在模型类中写入生成验证邮箱的地址,那么在视图或者序列化器中,就可以通过模型对象直接调用""" data = {'id': self.id, 'email': self.email} token = SecretTool.encryption(data) verify_url = 'http://www.meiduo.site:8080/usercenter/verify_email?token=' + token return verify_u...
the_stack_v2_python_sparse
meiduo_mall/meiduo_mall/apps/users/models.py
zhangjian-ai/meiduo
train
22
fb029b428627adba554347dbf73638f0e9527ac3
[ "today = datetime.today()\nprint(f'today: {today} (local time, NO time zone info)')\nself.assertTrue(today.year > 0)\nself.assertTrue(today.month > 0)\nself.assertTrue(today.day > 0)\nself.assertTrue(today.hour >= 0)\nself.assertTrue(today.minute >= 0)\nself.assertTrue(today.second >= 0)\nself.assertTrue(today.micr...
<|body_start_0|> today = datetime.today() print(f'today: {today} (local time, NO time zone info)') self.assertTrue(today.year > 0) self.assertTrue(today.month > 0) self.assertTrue(today.day > 0) self.assertTrue(today.hour >= 0) self.assertTrue(today.minute >= 0) ...
Test_datetime
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_datetime: def test_today(self): """Demo of `datetime.datetime.today()`. https://docs.python.org/3/library/datetime.html#datetime.datetime.today This method returns the local time but WITHOUT time zone info. Therefore, simply looking at the returned object by `today()` one would not ...
stack_v2_sparse_classes_75kplus_train_066615
3,889
no_license
[ { "docstring": "Demo of `datetime.datetime.today()`. https://docs.python.org/3/library/datetime.html#datetime.datetime.today This method returns the local time but WITHOUT time zone info. Therefore, simply looking at the returned object by `today()` one would not be able to tell if it's UTC or local time. There...
3
stack_v2_sparse_classes_30k_train_004142
Implement the Python class `Test_datetime` described below. Class description: Implement the Test_datetime class. Method signatures and docstrings: - def test_today(self): Demo of `datetime.datetime.today()`. https://docs.python.org/3/library/datetime.html#datetime.datetime.today This method returns the local time bu...
Implement the Python class `Test_datetime` described below. Class description: Implement the Test_datetime class. Method signatures and docstrings: - def test_today(self): Demo of `datetime.datetime.today()`. https://docs.python.org/3/library/datetime.html#datetime.datetime.today This method returns the local time bu...
2669a47213983879361e66aa7634a0897cf1695e
<|skeleton|> class Test_datetime: def test_today(self): """Demo of `datetime.datetime.today()`. https://docs.python.org/3/library/datetime.html#datetime.datetime.today This method returns the local time but WITHOUT time zone info. Therefore, simply looking at the returned object by `today()` one would not ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_datetime: def test_today(self): """Demo of `datetime.datetime.today()`. https://docs.python.org/3/library/datetime.html#datetime.datetime.today This method returns the local time but WITHOUT time zone info. Therefore, simply looking at the returned object by `today()` one would not be able to tel...
the_stack_v2_python_sparse
Python/datetime/datetime_demo.py
yaobinwen/robin_on_rails
train
9
c32de2297c1e259a3fb0b1d07f320c3a200fe0be
[ "if id is not None:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects", "if list_dictionaries is None:\n return '[]'\nelse:\n return json.dumps(list_dictionaries)", "if list_objs is None:\n list_objs = []\ndic_t = []\nfor a in list_objs:\n dic_t.append(cls.to_dict...
<|body_start_0|> if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects <|end_body_0|> <|body_start_1|> if list_dictionaries is None: return '[]' else: return json.dumps(list_dictionaries) <|en...
creando la clase
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """creando la clase""" def __init__(self, id=None): """constructor de clase""" <|body_0|> def to_json_string(list_dictionaries): """return list in json""" <|body_1|> def save_to_file(cls, list_objs): """class method to file in json stri...
stack_v2_sparse_classes_75kplus_train_066616
1,447
no_license
[ { "docstring": "constructor de clase", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "return list in json", "name": "to_json_string", "signature": "def to_json_string(list_dictionaries)" }, { "docstring": "class method to file in json string", ...
5
stack_v2_sparse_classes_30k_train_043412
Implement the Python class `Base` described below. Class description: creando la clase Method signatures and docstrings: - def __init__(self, id=None): constructor de clase - def to_json_string(list_dictionaries): return list in json - def save_to_file(cls, list_objs): class method to file in json string - def from_j...
Implement the Python class `Base` described below. Class description: creando la clase Method signatures and docstrings: - def __init__(self, id=None): constructor de clase - def to_json_string(list_dictionaries): return list in json - def save_to_file(cls, list_objs): class method to file in json string - def from_j...
6ede96eb50808e6e39aa57ffe0abfe4089408288
<|skeleton|> class Base: """creando la clase""" def __init__(self, id=None): """constructor de clase""" <|body_0|> def to_json_string(list_dictionaries): """return list in json""" <|body_1|> def save_to_file(cls, list_objs): """class method to file in json stri...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Base: """creando la clase""" def __init__(self, id=None): """constructor de clase""" if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects def to_json_string(list_dictionaries): """return list in j...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
SebastianMH14/holbertonschool-higher_level_programming
train
0
a64222290f506accae7857e7e16d9ddc2b66a2da
[ "if not people:\n return []\npeopledct, height, res = ({}, [], [])\nfor i in range(len(people)):\n p = people[i]\n if p[0] in peopledct:\n peopledct[p[0]] += ((p[1], i),)\n else:\n peopledct[p[0]] = [(p[1], i)]\n height += (p[0],)\nheight.sort()\nfor h in height[::-1]:\n peopledc...
<|body_start_0|> if not people: return [] peopledct, height, res = ({}, [], []) for i in range(len(people)): p = people[i] if p[0] in peopledct: peopledct[p[0]] += ((p[1], i),) else: peopledct[p[0]] = [(p[1], i)] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reconstructQueueFast(self, people): """:type people: List[List[int]] :rtype: List[List[int]] Pick out tallest group of people and sort them in a subarray (S). Since there's no other groups of people taller than them, therefore each guy's index will be just as same as his k ...
stack_v2_sparse_classes_75kplus_train_066617
3,454
no_license
[ { "docstring": ":type people: List[List[int]] :rtype: List[List[int]] Pick out tallest group of people and sort them in a subarray (S). Since there's no other groups of people taller than them, therefore each guy's index will be just as same as his k value. For 2nd tallest group (and the rest), insert each one ...
2
stack_v2_sparse_classes_30k_val_000424
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reconstructQueueFast(self, people): :type people: List[List[int]] :rtype: List[List[int]] Pick out tallest group of people and sort them in a subarray (S). Since there's no o...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reconstructQueueFast(self, people): :type people: List[List[int]] :rtype: List[List[int]] Pick out tallest group of people and sort them in a subarray (S). Since there's no o...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def reconstructQueueFast(self, people): """:type people: List[List[int]] :rtype: List[List[int]] Pick out tallest group of people and sort them in a subarray (S). Since there's no other groups of people taller than them, therefore each guy's index will be just as same as his k ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def reconstructQueueFast(self, people): """:type people: List[List[int]] :rtype: List[List[int]] Pick out tallest group of people and sort them in a subarray (S). Since there's no other groups of people taller than them, therefore each guy's index will be just as same as his k value. For 2nd...
the_stack_v2_python_sparse
Q/QueueReconstructionByHeight.py
bssrdf/pyleet
train
2
0dcdea92aec4ba85a80891a6725b54f37490b6a1
[ "processed_query = {}\nfor key, value in request.GET.items():\n processed_query[key] = value\nali_sign = processed_query.pop('sign', None)\nalipay = AliPay(appid='2016102600761595', app_notify_url=settings.NOTIFY_URL, app_private_key_path=settings.APP_PRIVATE_KEY_PATH, alipay_public_key_path=settings.ALIPAY_PUBL...
<|body_start_0|> processed_query = {} for key, value in request.GET.items(): processed_query[key] = value ali_sign = processed_query.pop('sign', None) alipay = AliPay(appid='2016102600761595', app_notify_url=settings.NOTIFY_URL, app_private_key_path=settings.APP_PRIVATE_KEY_P...
AliPayView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AliPayView: def get(request): """处理支付宝return_url :param request: :return:""" <|body_0|> def post(request): """处理支付宝notify_url :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> processed_query = {} for key, value in req...
stack_v2_sparse_classes_75kplus_train_066618
5,432
no_license
[ { "docstring": "处理支付宝return_url :param request: :return:", "name": "get", "signature": "def get(request)" }, { "docstring": "处理支付宝notify_url :param request: :return:", "name": "post", "signature": "def post(request)" } ]
2
stack_v2_sparse_classes_30k_train_051713
Implement the Python class `AliPayView` described below. Class description: Implement the AliPayView class. Method signatures and docstrings: - def get(request): 处理支付宝return_url :param request: :return: - def post(request): 处理支付宝notify_url :param request: :return:
Implement the Python class `AliPayView` described below. Class description: Implement the AliPayView class. Method signatures and docstrings: - def get(request): 处理支付宝return_url :param request: :return: - def post(request): 处理支付宝notify_url :param request: :return: <|skeleton|> class AliPayView: def get(request)...
bd8309087e2fc32c527e87af82d8f8e839763f97
<|skeleton|> class AliPayView: def get(request): """处理支付宝return_url :param request: :return:""" <|body_0|> def post(request): """处理支付宝notify_url :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AliPayView: def get(request): """处理支付宝return_url :param request: :return:""" processed_query = {} for key, value in request.GET.items(): processed_query[key] = value ali_sign = processed_query.pop('sign', None) alipay = AliPay(appid='2016102600761595', app_n...
the_stack_v2_python_sparse
apps/trades/views.py
Lchyang/SpaceShop
train
0
92d21f23e8f986666ede4e10477e79a34ec5dd81
[ "self.words = words\nself.temp_dict = {}\nfor i in range(len(words)):\n if words[i] not in self.temp_dict:\n self.temp_dict[words[i]] = [i]\n else:\n self.temp_dict[words[i]].append(i)", "maxi = sys.maxint\nlist1 = self.temp_dict[word1]\nlist2 = self.temp_dict[word2]\nfor i in range(len(list1)...
<|body_start_0|> self.words = words self.temp_dict = {} for i in range(len(words)): if words[i] not in self.temp_dict: self.temp_dict[words[i]] = [i] else: self.temp_dict[words[i]].append(i) <|end_body_0|> <|body_start_1|> maxi = s...
WordDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.words = words self.temp_...
stack_v2_sparse_classes_75kplus_train_066619
935
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
stack_v2_sparse_classes_30k_train_017521
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int <|skeleton|> class WordDistance: ...
2f53c4e16d244c83aad9b4d67a249f669b9da92a
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordDistance: def __init__(self, words): """:type words: List[str]""" self.words = words self.temp_dict = {} for i in range(len(words)): if words[i] not in self.temp_dict: self.temp_dict[words[i]] = [i] else: self.temp_dic...
the_stack_v2_python_sparse
prob244/shortest_word_distance2.py
sharath28/leetcode
train
1
32cfea1d1dd907b10d0ff264908bad6ac01880ff
[ "server = jenkins_server.get_jenkins_server()\ntry:\n env = server.get_build_env_vars(job_name, build_number)\nexcept JenkinsException as e:\n return '%s#%d不存在' % (job_name, build_number)\nreturn env", "server = jenkins_server.get_jenkins_server()\ntry:\n console_text = server.get_build_console_output(jo...
<|body_start_0|> server = jenkins_server.get_jenkins_server() try: env = server.get_build_env_vars(job_name, build_number) except JenkinsException as e: return '%s#%d不存在' % (job_name, build_number) return env <|end_body_0|> <|body_start_1|> server = jenki...
Manage builds
Build
[ "LicenseRef-scancode-mulanpsl-2.0-en", "MulanPSL-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Build: """Manage builds""" def env(self, job_name, build_number): """Display env vars of a build""" <|body_0|> def log(self, job_name, build_number): """Display log of a build""" <|body_1|> def info(self, job_name, build_number): """Display i...
stack_v2_sparse_classes_75kplus_train_066620
2,328
permissive
[ { "docstring": "Display env vars of a build", "name": "env", "signature": "def env(self, job_name, build_number)" }, { "docstring": "Display log of a build", "name": "log", "signature": "def log(self, job_name, build_number)" }, { "docstring": "Display info of a build", "name...
4
null
Implement the Python class `Build` described below. Class description: Manage builds Method signatures and docstrings: - def env(self, job_name, build_number): Display env vars of a build - def log(self, job_name, build_number): Display log of a build - def info(self, job_name, build_number): Display info of a build ...
Implement the Python class `Build` described below. Class description: Manage builds Method signatures and docstrings: - def env(self, job_name, build_number): Display env vars of a build - def log(self, job_name, build_number): Display log of a build - def info(self, job_name, build_number): Display info of a build ...
d8cbdab84d837a45c644a67e1072778f41bb89a5
<|skeleton|> class Build: """Manage builds""" def env(self, job_name, build_number): """Display env vars of a build""" <|body_0|> def log(self, job_name, build_number): """Display log of a build""" <|body_1|> def info(self, job_name, build_number): """Display i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Build: """Manage builds""" def env(self, job_name, build_number): """Display env vars of a build""" server = jenkins_server.get_jenkins_server() try: env = server.get_build_env_vars(job_name, build_number) except JenkinsException as e: return '%s#%d...
the_stack_v2_python_sparse
jenkinsclient/build.py
project-demo-auto/jenkinsclient
train
0
61844fe67498f91247ffde49913534ab30d59a3a
[ "user.set_unusable_password()\nuser = self.update_user(user, attributes, attribute_mapping, force_save=True)\nuser_pendings = Invitation.objects.filter(email=user.email)\nfor user_pending in user_pendings:\n CourseTeacher.objects.get_or_create(course=user_pending.course, teacher=user)\n user_pending.delete()\...
<|body_start_0|> user.set_unusable_password() user = self.update_user(user, attributes, attribute_mapping, force_save=True) user_pendings = Invitation.objects.filter(email=user.email) for user_pending in user_pendings: CourseTeacher.objects.get_or_create(course=user_pending.c...
Extend the SAML2 backend for the integration with OpenMOOC. .. versionadded:: 0.1
Saml2BackendExtension
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Saml2BackendExtension: """Extend the SAML2 backend for the integration with OpenMOOC. .. versionadded:: 0.1""" def configure_user(self, user, attributes, attribute_mapping): """Configures a user after creation and returns the updated user. By default, returns the user with his attrib...
stack_v2_sparse_classes_75kplus_train_066621
3,604
permissive
[ { "docstring": "Configures a user after creation and returns the updated user. By default, returns the user with his attributes updated.", "name": "configure_user", "signature": "def configure_user(self, user, attributes, attribute_mapping)" }, { "docstring": "Update a user with a set of attribu...
2
stack_v2_sparse_classes_30k_train_037342
Implement the Python class `Saml2BackendExtension` described below. Class description: Extend the SAML2 backend for the integration with OpenMOOC. .. versionadded:: 0.1 Method signatures and docstrings: - def configure_user(self, user, attributes, attribute_mapping): Configures a user after creation and returns the u...
Implement the Python class `Saml2BackendExtension` described below. Class description: Extend the SAML2 backend for the integration with OpenMOOC. .. versionadded:: 0.1 Method signatures and docstrings: - def configure_user(self, user, attributes, attribute_mapping): Configures a user after creation and returns the u...
d5301ba867cc6c982754478ad26df39d7d858b8d
<|skeleton|> class Saml2BackendExtension: """Extend the SAML2 backend for the integration with OpenMOOC. .. versionadded:: 0.1""" def configure_user(self, user, attributes, attribute_mapping): """Configures a user after creation and returns the updated user. By default, returns the user with his attrib...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Saml2BackendExtension: """Extend the SAML2 backend for the integration with OpenMOOC. .. versionadded:: 0.1""" def configure_user(self, user, attributes, attribute_mapping): """Configures a user after creation and returns the updated user. By default, returns the user with his attributes updated....
the_stack_v2_python_sparse
moocng/courses/backends.py
GeographicaGS/moocng
train
2
fbadcf696316b48fe484cb4894cb801bffb54001
[ "stub = reco_pb2_grpc.UserRecommendStub(current_app.rpc_reco)\nreq = reco_pb2.UserRequest()\nreq.user_id = str(g.user_id) if g.user_id is not None else 'Anony'\nreq.channel_id = channel_id\nreq.article_num = feed_count\nreq.time_stamp = timestamp\nret = stub.user_recommend(req)\npre_timestamp = ret.time_stamp\narti...
<|body_start_0|> stub = reco_pb2_grpc.UserRecommendStub(current_app.rpc_reco) req = reco_pb2.UserRequest() req.user_id = str(g.user_id) if g.user_id is not None else 'Anony' req.channel_id = channel_id req.article_num = feed_count req.time_stamp = timestamp ret = ...
获取推荐文章列表数据
ArticleListResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleListResource: """获取推荐文章列表数据""" def _feed_articles(self, channel_id, timestamp, feed_count): """获取推荐文章 :param channel_id: 频道id :param feed_count: 推荐数量 :param timestamp: 时间戳 :return: [{article_id, trace_params}, ...], timestamp""" <|body_0|> def get(self): "...
stack_v2_sparse_classes_75kplus_train_066622
9,216
no_license
[ { "docstring": "获取推荐文章 :param channel_id: 频道id :param feed_count: 推荐数量 :param timestamp: 时间戳 :return: [{article_id, trace_params}, ...], timestamp", "name": "_feed_articles", "signature": "def _feed_articles(self, channel_id, timestamp, feed_count)" }, { "docstring": "获取文章列表 /v1_1/articles?chann...
2
stack_v2_sparse_classes_30k_train_024846
Implement the Python class `ArticleListResource` described below. Class description: 获取推荐文章列表数据 Method signatures and docstrings: - def _feed_articles(self, channel_id, timestamp, feed_count): 获取推荐文章 :param channel_id: 频道id :param feed_count: 推荐数量 :param timestamp: 时间戳 :return: [{article_id, trace_params}, ...], time...
Implement the Python class `ArticleListResource` described below. Class description: 获取推荐文章列表数据 Method signatures and docstrings: - def _feed_articles(self, channel_id, timestamp, feed_count): 获取推荐文章 :param channel_id: 频道id :param feed_count: 推荐数量 :param timestamp: 时间戳 :return: [{article_id, trace_params}, ...], time...
12b52f21a4ec20b4853870468c28d2385dc185a8
<|skeleton|> class ArticleListResource: """获取推荐文章列表数据""" def _feed_articles(self, channel_id, timestamp, feed_count): """获取推荐文章 :param channel_id: 频道id :param feed_count: 推荐数量 :param timestamp: 时间戳 :return: [{article_id, trace_params}, ...], timestamp""" <|body_0|> def get(self): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArticleListResource: """获取推荐文章列表数据""" def _feed_articles(self, channel_id, timestamp, feed_count): """获取推荐文章 :param channel_id: 频道id :param feed_count: 推荐数量 :param timestamp: 时间戳 :return: [{article_id, trace_params}, ...], timestamp""" stub = reco_pb2_grpc.UserRecommendStub(current_app.rp...
the_stack_v2_python_sparse
flask_prj/tbd_42/toutiao/resources/news/article.py
123wuyu/demo_prj
train
1
ff0eb24014181d10dac403ffc269d5e581b658a9
[ "html_class = super(BaseBookmarkPlugin, self).html_class\nif self.data.image:\n html_class += ' iconic-url'\nreturn html_class", "try:\n bookmark = Bookmark._default_manager.get(pk=self.data.bookmark)\nexcept ObjectDoesNotExist:\n return\nif bookmark:\n data = {'bookmark': bookmark.pk, 'title': bookma...
<|body_start_0|> html_class = super(BaseBookmarkPlugin, self).html_class if self.data.image: html_class += ' iconic-url' return html_class <|end_body_0|> <|body_start_1|> try: bookmark = Bookmark._default_manager.get(pk=self.data.bookmark) except ObjectDo...
Base URL plugin.
BaseBookmarkPlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseBookmarkPlugin: """Base URL plugin.""" def html_class(self): """HTML class. If plugin has an image, we add a class `iconic` to it.""" <|body_0|> def update_plugin_data(self, dashboard_entry): """Update plugin data. Should return a dictionary with the plugin d...
stack_v2_sparse_classes_75kplus_train_066623
3,111
no_license
[ { "docstring": "HTML class. If plugin has an image, we add a class `iconic` to it.", "name": "html_class", "signature": "def html_class(self)" }, { "docstring": "Update plugin data. Should return a dictionary with the plugin data which is supposed to be updated.", "name": "update_plugin_data...
2
stack_v2_sparse_classes_30k_train_014505
Implement the Python class `BaseBookmarkPlugin` described below. Class description: Base URL plugin. Method signatures and docstrings: - def html_class(self): HTML class. If plugin has an image, we add a class `iconic` to it. - def update_plugin_data(self, dashboard_entry): Update plugin data. Should return a diction...
Implement the Python class `BaseBookmarkPlugin` described below. Class description: Base URL plugin. Method signatures and docstrings: - def html_class(self): HTML class. If plugin has an image, we add a class `iconic` to it. - def update_plugin_data(self, dashboard_entry): Update plugin data. Should return a diction...
bef95536e96417e18972a3118e19a8074bfc8684
<|skeleton|> class BaseBookmarkPlugin: """Base URL plugin.""" def html_class(self): """HTML class. If plugin has an image, we add a class `iconic` to it.""" <|body_0|> def update_plugin_data(self, dashboard_entry): """Update plugin data. Should return a dictionary with the plugin d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseBookmarkPlugin: """Base URL plugin.""" def html_class(self): """HTML class. If plugin has an image, we add a class `iconic` to it.""" html_class = super(BaseBookmarkPlugin, self).html_class if self.data.image: html_class += ' iconic-url' return html_class ...
the_stack_v2_python_sparse
ENV/Lib/site-packages/dash/contrib/plugins/url/dash_plugins.py
JulianYangJingJun/OSVRCMS
train
3
14f229d21cf6ef1b3df5017db0273fd6874a0179
[ "result = []\nif not root:\n return result\nqueue = collections.deque([root])\nwhile queue:\n root = queue.pop()\n if root:\n result.append(str(root.val))\n queue.appendleft(root.left)\n queue.appendleft(root.right)\n else:\n result.append('#')\nreturn ' '.join(result)", "i...
<|body_start_0|> result = [] if not root: return result queue = collections.deque([root]) while queue: root = queue.pop() if root: result.append(str(root.val)) queue.appendleft(root.left) queue.appendleft...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_066624
3,899
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_026013
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
d953abe2c9680f636563e76287d2f907e90ced63
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" result = [] if not root: return result queue = collections.deque([root]) while queue: root = queue.pop() if root: ...
the_stack_v2_python_sparse
Python_leetcode/297_serialize_and_deserialize.py
xiangcao/Leetcode
train
0
0638b165ff32189c208a1bdbba2f874e7e4d2f2b
[ "self.loader = self.loader_class()\nsuper().__init__(loader=self.loader)\nself.resource = resource\nself.dynamic_inventory()", "if isinstance(self.resource, list):\n self.parse_resource(self.resource, 'default')\nelif isinstance(self.resource, dict):\n for groupname, hosts_and_vars in self.resource.items():...
<|body_start_0|> self.loader = self.loader_class() super().__init__(loader=self.loader) self.resource = resource self.dynamic_inventory() <|end_body_0|> <|body_start_1|> if isinstance(self.resource, list): self.parse_resource(self.resource, 'default') elif is...
动态生成Inventory类
BaseInventory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseInventory: """动态生成Inventory类""" def __init__(self, resource=None): """resource的数据格式是一个列表字典,比如: { 'group1':{ "hosts": [{"ip": "10.0.0.0", "port": "22", "username": "root", "password": "pass"}, ...] "group_vars": {"var1", "var2", "var3", ...} } } 如果只传入一个列表,默认改列表内的所有主机属于default组,比如:...
stack_v2_sparse_classes_75kplus_train_066625
16,686
no_license
[ { "docstring": "resource的数据格式是一个列表字典,比如: { 'group1':{ \"hosts\": [{\"ip\": \"10.0.0.0\", \"port\": \"22\", \"username\": \"root\", \"password\": \"pass\"}, ...] \"group_vars\": {\"var1\", \"var2\", \"var3\", ...} } } 如果只传入一个列表,默认改列表内的所有主机属于default组,比如: [{\"ip\": \"10.0.0.0\", \"port\": \"22\", \"username\": \"r...
3
stack_v2_sparse_classes_30k_train_047085
Implement the Python class `BaseInventory` described below. Class description: 动态生成Inventory类 Method signatures and docstrings: - def __init__(self, resource=None): resource的数据格式是一个列表字典,比如: { 'group1':{ "hosts": [{"ip": "10.0.0.0", "port": "22", "username": "root", "password": "pass"}, ...] "group_vars": {"var1", "va...
Implement the Python class `BaseInventory` described below. Class description: 动态生成Inventory类 Method signatures and docstrings: - def __init__(self, resource=None): resource的数据格式是一个列表字典,比如: { 'group1':{ "hosts": [{"ip": "10.0.0.0", "port": "22", "username": "root", "password": "pass"}, ...] "group_vars": {"var1", "va...
04bb7f387633ba8af81148dc73a95c2a6d56a8d1
<|skeleton|> class BaseInventory: """动态生成Inventory类""" def __init__(self, resource=None): """resource的数据格式是一个列表字典,比如: { 'group1':{ "hosts": [{"ip": "10.0.0.0", "port": "22", "username": "root", "password": "pass"}, ...] "group_vars": {"var1", "var2", "var3", ...} } } 如果只传入一个列表,默认改列表内的所有主机属于default组,比如:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseInventory: """动态生成Inventory类""" def __init__(self, resource=None): """resource的数据格式是一个列表字典,比如: { 'group1':{ "hosts": [{"ip": "10.0.0.0", "port": "22", "username": "root", "password": "pass"}, ...] "group_vars": {"var1", "var2", "var3", ...} } } 如果只传入一个列表,默认改列表内的所有主机属于default组,比如: [{"ip": "10....
the_stack_v2_python_sparse
app/utils/ansible_api_v2.py
Rabbit-st/rabbit
train
0
27eb444023ba78a86999c926b4fd257944e2a312
[ "if getattr(user, 'is_superuser', False):\n return False\nif not getattr(user, 'is_authenticated', False):\n return True\nis_owner = instance.owner.id == user.id\nis_editor = user.id in [editor.id for editor in instance.authorized_editors.all()]\nis_game_master = user.id in [gm.id for gm in instance.get_parti...
<|body_start_0|> if getattr(user, 'is_superuser', False): return False if not getattr(user, 'is_authenticated', False): return True is_owner = instance.owner.id == user.id is_editor = user.id in [editor.id for editor in instance.authorized_editors.all()] i...
Serializer for the Handout model. Includes secret content.
HandoutSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HandoutSerializer: """Serializer for the Handout model. Includes secret content.""" def should_hide_secrets(user, instance): """Determine whether to hide the secret content and private files""" <|body_0|> def to_representation(self, instance): """Override to acco...
stack_v2_sparse_classes_75kplus_train_066626
1,967
permissive
[ { "docstring": "Determine whether to hide the secret content and private files", "name": "should_hide_secrets", "signature": "def should_hide_secrets(user, instance)" }, { "docstring": "Override to account for secret data", "name": "to_representation", "signature": "def to_representation...
2
stack_v2_sparse_classes_30k_train_000761
Implement the Python class `HandoutSerializer` described below. Class description: Serializer for the Handout model. Includes secret content. Method signatures and docstrings: - def should_hide_secrets(user, instance): Determine whether to hide the secret content and private files - def to_representation(self, instan...
Implement the Python class `HandoutSerializer` described below. Class description: Serializer for the Handout model. Includes secret content. Method signatures and docstrings: - def should_hide_secrets(user, instance): Determine whether to hide the secret content and private files - def to_representation(self, instan...
76a43f48b70c6a4b509c90757d7906689799cc25
<|skeleton|> class HandoutSerializer: """Serializer for the Handout model. Includes secret content.""" def should_hide_secrets(user, instance): """Determine whether to hide the secret content and private files""" <|body_0|> def to_representation(self, instance): """Override to acco...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HandoutSerializer: """Serializer for the Handout model. Includes secret content.""" def should_hide_secrets(user, instance): """Determine whether to hide the secret content and private files""" if getattr(user, 'is_superuser', False): return False if not getattr(user, ...
the_stack_v2_python_sparse
game_mastering/serializers/handout.py
seedwithroot/myth-caster-api
train
0
52863f0e3a17dce398ab62a8519da6e457f840b8
[ "serialized = []\nif not root:\n return ''\nqueue, q_index, q_cnt = ([root], 0, 1)\nwhile q_cnt > 0:\n curr, q_index, q_cnt = (queue[q_index], q_index + 1, q_cnt - 1)\n if curr is None:\n serialized.append('NULL')\n continue\n serialized.append(str(curr.val))\n queue.append(curr.left)\n...
<|body_start_0|> serialized = [] if not root: return '' queue, q_index, q_cnt = ([root], 0, 1) while q_cnt > 0: curr, q_index, q_cnt = (queue[q_index], q_index + 1, q_cnt - 1) if curr is None: serialized.append('NULL') c...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_066627
1,998
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_val_002116
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
49da8fca3e94cce01f2758b3f42f08b317db044d
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" serialized = [] if not root: return '' queue, q_index, q_cnt = ([root], 0, 1) while q_cnt > 0: curr, q_index, q_cnt = (queue[q_index], q_i...
the_stack_v2_python_sparse
Solutions/297 Serialize and Deserialize Binar Tree/Solution2.py
raoqiyu/LeetCode
train
1
90a51f49ad0ab093a135c5e70c07863e897b30d3
[ "dp = [0] * (N + 1)\ncnt = 0\nfor i in range(N + 1):\n if i == 0 or i == 1 or i == 8:\n dp[i] = 1\n elif i == 2 or i == 5 or i == 6 or (i == 9):\n dp[i] = 2\n cnt += 1\n else:\n a, b = (dp[i // 10], dp[i % 10])\n if a == 1 and b == 1:\n dp[i] = 1\n elif ...
<|body_start_0|> dp = [0] * (N + 1) cnt = 0 for i in range(N + 1): if i == 0 or i == 1 or i == 8: dp[i] = 1 elif i == 2 or i == 5 or i == 6 or (i == 9): dp[i] = 2 cnt += 1 else: a, b = (dp[i // 10...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotatedDigits_MK1(self, N: int) -> int: """Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def rotatedDigits(self, N: int) -> int: """Time complexity: O(lgn) Space complexity: O(lgn)""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_066628
1,596
no_license
[ { "docstring": "Time complexity: O(n) Space complexity: O(n)", "name": "rotatedDigits_MK1", "signature": "def rotatedDigits_MK1(self, N: int) -> int" }, { "docstring": "Time complexity: O(lgn) Space complexity: O(lgn)", "name": "rotatedDigits", "signature": "def rotatedDigits(self, N: in...
2
stack_v2_sparse_classes_30k_train_046365
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotatedDigits_MK1(self, N: int) -> int: Time complexity: O(n) Space complexity: O(n) - def rotatedDigits(self, N: int) -> int: Time complexity: O(lgn) Space complexity: O(lgn...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotatedDigits_MK1(self, N: int) -> int: Time complexity: O(n) Space complexity: O(n) - def rotatedDigits(self, N: int) -> int: Time complexity: O(lgn) Space complexity: O(lgn...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def rotatedDigits_MK1(self, N: int) -> int: """Time complexity: O(n) Space complexity: O(n)""" <|body_0|> def rotatedDigits(self, N: int) -> int: """Time complexity: O(lgn) Space complexity: O(lgn)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rotatedDigits_MK1(self, N: int) -> int: """Time complexity: O(n) Space complexity: O(n)""" dp = [0] * (N + 1) cnt = 0 for i in range(N + 1): if i == 0 or i == 1 or i == 8: dp[i] = 1 elif i == 2 or i == 5 or i == 6 or (i == 9...
the_stack_v2_python_sparse
0788. Rotated Digits/Solution.py
faterazer/LeetCode
train
4
44eb49d4a90b58cc8112aec5c115d04556fb898f
[ "self.safe_update(**kwargs)\nif butler is not None:\n self.log.warn('Ignoring butler')\nif not self.config.skip:\n outtable = vstack_tables(data, tablename='ptc_stats')\ndtables = TableDict()\ndtables.add_datatable('ptc_sum', outtable)\ndtables.make_datatable('runs', dict(runs=sorted(data.keys())))\nreturn dt...
<|body_start_0|> self.safe_update(**kwargs) if butler is not None: self.log.warn('Ignoring butler') if not self.config.skip: outtable = vstack_tables(data, tablename='ptc_stats') dtables = TableDict() dtables.add_datatable('ptc_sum', outtable) dtab...
Summarize the results for the analysis of variations of the photon transfer curves frames
PTCSummaryTask
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PTCSummaryTask: """Summarize the results for the analysis of variations of the photon transfer curves frames""" def extract(self, butler, data, **kwargs): """Extract the summary data from the PTC analyses Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionar...
stack_v2_sparse_classes_75kplus_train_066629
13,776
permissive
[ { "docstring": "Extract the summary data from the PTC analyses Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other structure) contain the input data kwargs Used to override default configuration Returns ------- dtables : `TableDict` The resulting data", "name": "extrac...
2
stack_v2_sparse_classes_30k_train_018333
Implement the Python class `PTCSummaryTask` described below. Class description: Summarize the results for the analysis of variations of the photon transfer curves frames Method signatures and docstrings: - def extract(self, butler, data, **kwargs): Extract the summary data from the PTC analyses Parameters ---------- ...
Implement the Python class `PTCSummaryTask` described below. Class description: Summarize the results for the analysis of variations of the photon transfer curves frames Method signatures and docstrings: - def extract(self, butler, data, **kwargs): Extract the summary data from the PTC analyses Parameters ---------- ...
28418284fdaf2b2fb0afbeccd4324f7ad3e676c8
<|skeleton|> class PTCSummaryTask: """Summarize the results for the analysis of variations of the photon transfer curves frames""" def extract(self, butler, data, **kwargs): """Extract the summary data from the PTC analyses Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PTCSummaryTask: """Summarize the results for the analysis of variations of the photon transfer curves frames""" def extract(self, butler, data, **kwargs): """Extract the summary data from the PTC analyses Parameters ---------- butler : `Butler` The data butler data : `dict` Dictionary (or other s...
the_stack_v2_python_sparse
python/lsst/eo_utils/flat/ptc.py
lsst-camera-dh/EO-utilities
train
2
fbd56d646930a400bad223587d419ae56059ad6a
[ "if graph.is_directed():\n raise ValueError('the graph is directed')\nself.graph = graph\nfor edge in self.graph.iteredges():\n if edge.source == edge.target:\n raise ValueError('a loop detected')\nself.independent_set = dict(((node, True) for node in self.graph.iternodes()))\nself.cardinality = self.g...
<|body_start_0|> if graph.is_directed(): raise ValueError('the graph is directed') self.graph = graph for edge in self.graph.iteredges(): if edge.source == edge.target: raise ValueError('a loop detected') self.independent_set = dict(((node, True) f...
Find a maximal independent set.
LargestLastIndependentSet2
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LargestLastIndependentSet2: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, source=None): """Executable pseudocode.""" <|body_1|> def _is_independent(self): """Inde...
stack_v2_sparse_classes_75kplus_train_066630
12,259
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, source=None)" }, { "docstring": "Independence test.", "name": "_is_independent",...
3
stack_v2_sparse_classes_30k_train_021211
Implement the Python class `LargestLastIndependentSet2` described below. Class description: Find a maximal independent set. Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, source=None): Executable pseudocode. - def _is_independent(self): Independence test.
Implement the Python class `LargestLastIndependentSet2` described below. Class description: Find a maximal independent set. Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, source=None): Executable pseudocode. - def _is_independent(self): Independence test. ...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class LargestLastIndependentSet2: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, source=None): """Executable pseudocode.""" <|body_1|> def _is_independent(self): """Inde...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LargestLastIndependentSet2: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" if graph.is_directed(): raise ValueError('the graph is directed') self.graph = graph for edge in self.graph.iteredges(): ...
the_stack_v2_python_sparse
graphtheory/independentsets/isetll.py
kgashok/graphs-dict
train
0
a2f227a6ebc857f96ccb2e45570b7ca7ec431079
[ "super().__init__(productcode, description, marketprice, rentalprice)\nself.productcode = productcode\nself.description = description\nself.marketprice = marketprice\nself.rentalprice = rentalprice\nself.brand = brand\nself.voltage = voltage", "outputdict = {}\noutputdict['productcode'] = self.productcode\noutput...
<|body_start_0|> super().__init__(productcode, description, marketprice, rentalprice) self.productcode = productcode self.description = description self.marketprice = marketprice self.rentalprice = rentalprice self.brand = brand self.voltage = voltage <|end_body_0...
Class docstring
Electricappliances
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Electricappliances: """Class docstring""" def __init__(self, productcode, description, marketprice, rentalprice, brand, voltage): """initializing variables""" <|body_0|> def returnasdictionary(self): """method docstring""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_75kplus_train_066631
1,134
no_license
[ { "docstring": "initializing variables", "name": "__init__", "signature": "def __init__(self, productcode, description, marketprice, rentalprice, brand, voltage)" }, { "docstring": "method docstring", "name": "returnasdictionary", "signature": "def returnasdictionary(self)" } ]
2
stack_v2_sparse_classes_30k_val_002823
Implement the Python class `Electricappliances` described below. Class description: Class docstring Method signatures and docstrings: - def __init__(self, productcode, description, marketprice, rentalprice, brand, voltage): initializing variables - def returnasdictionary(self): method docstring
Implement the Python class `Electricappliances` described below. Class description: Class docstring Method signatures and docstrings: - def __init__(self, productcode, description, marketprice, rentalprice, brand, voltage): initializing variables - def returnasdictionary(self): method docstring <|skeleton|> class El...
ac12beeae8aa57135bbcd03ac7a4f977fa3bdb56
<|skeleton|> class Electricappliances: """Class docstring""" def __init__(self, productcode, description, marketprice, rentalprice, brand, voltage): """initializing variables""" <|body_0|> def returnasdictionary(self): """method docstring""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Electricappliances: """Class docstring""" def __init__(self, productcode, description, marketprice, rentalprice, brand, voltage): """initializing variables""" super().__init__(productcode, description, marketprice, rentalprice) self.productcode = productcode self.descripti...
the_stack_v2_python_sparse
students/Daniel_Carrasco/lesson01/assignment/inventory_management/electricAppliancesClass.py
UWPCE-PythonCert-ClassRepos/py220-online-201904-V2
train
1
18099e29558d9db2e8d09fe8786733c6a3a884c6
[ "super(DQNModel, self).__init__()\nself.device = device\nself.conv_1 = nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=8, stride=4)\nself.conv_2 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size=4, stride=2)\nself.conv_3 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, stride=1)\ns...
<|body_start_0|> super(DQNModel, self).__init__() self.device = device self.conv_1 = nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=8, stride=4) self.conv_2 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size=4, stride=2) self.conv_3 = nn.Conv2d(in_channels=...
DQNModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DQNModel: def __init__(self, nr_actions, device, in_channels=4): """:param in_channels: :param nr_actions: :param device:""" <|body_0|> def forward(self, state): """:param state: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(DQNMode...
stack_v2_sparse_classes_75kplus_train_066632
19,004
no_license
[ { "docstring": ":param in_channels: :param nr_actions: :param device:", "name": "__init__", "signature": "def __init__(self, nr_actions, device, in_channels=4)" }, { "docstring": ":param state: :return:", "name": "forward", "signature": "def forward(self, state)" } ]
2
stack_v2_sparse_classes_30k_val_002720
Implement the Python class `DQNModel` described below. Class description: Implement the DQNModel class. Method signatures and docstrings: - def __init__(self, nr_actions, device, in_channels=4): :param in_channels: :param nr_actions: :param device: - def forward(self, state): :param state: :return:
Implement the Python class `DQNModel` described below. Class description: Implement the DQNModel class. Method signatures and docstrings: - def __init__(self, nr_actions, device, in_channels=4): :param in_channels: :param nr_actions: :param device: - def forward(self, state): :param state: :return: <|skeleton|> clas...
375633b9dc34302fa1d806a7ee69c86f97f1054d
<|skeleton|> class DQNModel: def __init__(self, nr_actions, device, in_channels=4): """:param in_channels: :param nr_actions: :param device:""" <|body_0|> def forward(self, state): """:param state: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DQNModel: def __init__(self, nr_actions, device, in_channels=4): """:param in_channels: :param nr_actions: :param device:""" super(DQNModel, self).__init__() self.device = device self.conv_1 = nn.Conv2d(in_channels=in_channels, out_channels=32, kernel_size=8, stride=4) ...
the_stack_v2_python_sparse
models/models.py
kessi1990/masterthesis
train
1
c015f7d1cb7f3ef62db3471c6959cb6cb2750a4b
[ "super(GateUnit, self).__init__()\nself.conv1 = nn.Conv2d(out_feat, in_feat, kernel_size=3, padding=1, stride=1, bias=False)\nself.bn1 = nn.BatchNorm2d(in_feat)\nself.relu1 = nn.ReLU(inplace=True)\nself.conv2 = nn.Conv2d(in_feat, in_feat, kernel_size=3, padding=1, stride=1, bias=False)\nself.bn2 = nn.BatchNorm2d(in...
<|body_start_0|> super(GateUnit, self).__init__() self.conv1 = nn.Conv2d(out_feat, in_feat, kernel_size=3, padding=1, stride=1, bias=False) self.bn1 = nn.BatchNorm2d(in_feat) self.relu1 = nn.ReLU(inplace=True) self.conv2 = nn.Conv2d(in_feat, in_feat, kernel_size=3, padding=1, str...
GateUnit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GateUnit: def __init__(self, in_feat, out_feat): """First is a smaller feature and second is a larger feature""" <|body_0|> def forward(self, x1, x2): """x1 is smaller feature map""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(GateUnit, self)...
stack_v2_sparse_classes_75kplus_train_066633
29,670
no_license
[ { "docstring": "First is a smaller feature and second is a larger feature", "name": "__init__", "signature": "def __init__(self, in_feat, out_feat)" }, { "docstring": "x1 is smaller feature map", "name": "forward", "signature": "def forward(self, x1, x2)" } ]
2
stack_v2_sparse_classes_30k_train_014246
Implement the Python class `GateUnit` described below. Class description: Implement the GateUnit class. Method signatures and docstrings: - def __init__(self, in_feat, out_feat): First is a smaller feature and second is a larger feature - def forward(self, x1, x2): x1 is smaller feature map
Implement the Python class `GateUnit` described below. Class description: Implement the GateUnit class. Method signatures and docstrings: - def __init__(self, in_feat, out_feat): First is a smaller feature and second is a larger feature - def forward(self, x1, x2): x1 is smaller feature map <|skeleton|> class GateUn...
23ab1cbe8a1e3f9d68ef774a51ce23eeff81aea9
<|skeleton|> class GateUnit: def __init__(self, in_feat, out_feat): """First is a smaller feature and second is a larger feature""" <|body_0|> def forward(self, x1, x2): """x1 is smaller feature map""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GateUnit: def __init__(self, in_feat, out_feat): """First is a smaller feature and second is a larger feature""" super(GateUnit, self).__init__() self.conv1 = nn.Conv2d(out_feat, in_feat, kernel_size=3, padding=1, stride=1, bias=False) self.bn1 = nn.BatchNorm2d(in_feat) ...
the_stack_v2_python_sparse
refinenet.py
JunhongXu/kaggle-carvana-car-masking
train
1
1a77a9303e4409fcd63876798322549aa828af96
[ "super(GraspSensorSimulator, self).__init__()\npackage_path = rospkg.RosPack().get_path('test_tools')\nui_filename = os.path.join(package_path, 'resource', 'grasp_sensor.ui')\nloadUi(ui_filename, self)\nself.left_slider.valueChanged.connect(self.left_indicator.display)\nself.right_slider.valueChanged.connect(self.r...
<|body_start_0|> super(GraspSensorSimulator, self).__init__() package_path = rospkg.RosPack().get_path('test_tools') ui_filename = os.path.join(package_path, 'resource', 'grasp_sensor.ui') loadUi(ui_filename, self) self.left_slider.valueChanged.connect(self.left_indicator.display...
QWidget to simulate the distance sensors on the grippers
GraspSensorSimulator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraspSensorSimulator: """QWidget to simulate the distance sensors on the grippers""" def __init__(self, robot_name): """Constructor :param robot_name: string with robot name""" <|body_0|> def _publish_values(self): """Publishes the current sensor values (converte...
stack_v2_sparse_classes_75kplus_train_066634
2,775
no_license
[ { "docstring": "Constructor :param robot_name: string with robot name", "name": "__init__", "signature": "def __init__(self, robot_name)" }, { "docstring": "Publishes the current sensor values (converted from mm to m)", "name": "_publish_values", "signature": "def _publish_values(self)" ...
2
stack_v2_sparse_classes_30k_train_035321
Implement the Python class `GraspSensorSimulator` described below. Class description: QWidget to simulate the distance sensors on the grippers Method signatures and docstrings: - def __init__(self, robot_name): Constructor :param robot_name: string with robot name - def _publish_values(self): Publishes the current se...
Implement the Python class `GraspSensorSimulator` described below. Class description: QWidget to simulate the distance sensors on the grippers Method signatures and docstrings: - def __init__(self, robot_name): Constructor :param robot_name: string with robot name - def _publish_values(self): Publishes the current se...
092a354315b9b2c08e32cdc049791d82dfd47745
<|skeleton|> class GraspSensorSimulator: """QWidget to simulate the distance sensors on the grippers""" def __init__(self, robot_name): """Constructor :param robot_name: string with robot name""" <|body_0|> def _publish_values(self): """Publishes the current sensor values (converte...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GraspSensorSimulator: """QWidget to simulate the distance sensors on the grippers""" def __init__(self, robot_name): """Constructor :param robot_name: string with robot name""" super(GraspSensorSimulator, self).__init__() package_path = rospkg.RosPack().get_path('test_tools') ...
the_stack_v2_python_sparse
test_tools/scripts/grasp-sensor-sim
tue-robotics/tue_robocup
train
39
2e764bb05e37ef38e6a6be032a292111d2edaef8
[ "if n == 1:\n return '1'\ni = 1\nret = '1'\nwhile i < n:\n i += 1\n pre_ret = ret\n pre_c = pre_ret[0]\n cnt = 1\n ret = ''\n for c in pre_ret[1:]:\n if c == pre_c:\n cnt += 1\n else:\n ret += f'{cnt}{pre_c}'\n pre_c = c\n cnt = 1\n r...
<|body_start_0|> if n == 1: return '1' i = 1 ret = '1' while i < n: i += 1 pre_ret = ret pre_c = pre_ret[0] cnt = 1 ret = '' for c in pre_ret[1:]: if c == pre_c: cnt +=...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countAndSay2(self, n: int) -> str: """CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% 1 <= n <= 30""" <|body_0|> def countAndSay(self, n): """:type n: int :rtype:...
stack_v2_sparse_classes_75kplus_train_066635
1,775
permissive
[ { "docstring": "CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% 1 <= n <= 30", "name": "countAndSay2", "signature": "def countAndSay2(self, n: int) -> str" }, { "docstring": ":type n: int :rtype: str", ...
2
stack_v2_sparse_classes_30k_train_023878
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countAndSay2(self, n: int) -> str: CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countAndSay2(self, n: int) -> str: CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def countAndSay2(self, n: int) -> str: """CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% 1 <= n <= 30""" <|body_0|> def countAndSay(self, n): """:type n: int :rtype:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def countAndSay2(self, n: int) -> str: """CREATED AT: 2022/2/15 30 / 30 test cases passed. Status: Accepted Runtime: 40 ms, faster than 94.24% Memory Usage: 14 MB, less than 78.47% 1 <= n <= 30""" if n == 1: return '1' i = 1 ret = '1' while i < n: ...
the_stack_v2_python_sparse
src/38-CountAndSay.py
Jiezhi/myleetcode
train
1
6c108f0f76fab42b28f5bf6422b5f77b3088d2c7
[ "x, y = (x.reshape(-1, 1), y.reshape(-1, 1))\nassert x.shape == y.shape, 'Input should have the same shape.'\nreturn np.sqrt(np.sum(np.square(x - y)))", "x, y = (x.reshape(-1, 1), y.reshape(-1, 1))\nassert x.shape == y.shape, 'Input should have the same shape.'\nreturn np.sum(np.abs(x - y))", "x, y = (x.reshape...
<|body_start_0|> x, y = (x.reshape(-1, 1), y.reshape(-1, 1)) assert x.shape == y.shape, 'Input should have the same shape.' return np.sqrt(np.sum(np.square(x - y))) <|end_body_0|> <|body_start_1|> x, y = (x.reshape(-1, 1), y.reshape(-1, 1)) assert x.shape == y.shape, 'Input shou...
All calculation are accelerated using not-just-in-time compilation Distance measure between two vectors including: (1) Euclidean distance (2) Manhattan distance (3) Chebyshev distance (4) Minkowski distance (5) Cosine distance
Distance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Distance: """All calculation are accelerated using not-just-in-time compilation Distance measure between two vectors including: (1) Euclidean distance (2) Manhattan distance (3) Chebyshev distance (4) Minkowski distance (5) Cosine distance""" def euclidean(x: np.ndarray, y: np.ndarray) -> Un...
stack_v2_sparse_classes_75kplus_train_066636
2,299
no_license
[ { "docstring": "D(x, y) = sqrt[sum_i (x_i - y_i)^2]", "name": "euclidean", "signature": "def euclidean(x: np.ndarray, y: np.ndarray) -> Union[float, np.ndarray]" }, { "docstring": "D(x, y) = sum_i (|x_i - y_i|)", "name": "manhattan", "signature": "def manhattan(x: np.ndarray, y: np.ndarr...
5
stack_v2_sparse_classes_30k_val_001379
Implement the Python class `Distance` described below. Class description: All calculation are accelerated using not-just-in-time compilation Distance measure between two vectors including: (1) Euclidean distance (2) Manhattan distance (3) Chebyshev distance (4) Minkowski distance (5) Cosine distance Method signatures...
Implement the Python class `Distance` described below. Class description: All calculation are accelerated using not-just-in-time compilation Distance measure between two vectors including: (1) Euclidean distance (2) Manhattan distance (3) Chebyshev distance (4) Minkowski distance (5) Cosine distance Method signatures...
1e0857872f6f97056eed4151b0870afec2d4b34e
<|skeleton|> class Distance: """All calculation are accelerated using not-just-in-time compilation Distance measure between two vectors including: (1) Euclidean distance (2) Manhattan distance (3) Chebyshev distance (4) Minkowski distance (5) Cosine distance""" def euclidean(x: np.ndarray, y: np.ndarray) -> Un...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Distance: """All calculation are accelerated using not-just-in-time compilation Distance measure between two vectors including: (1) Euclidean distance (2) Manhattan distance (3) Chebyshev distance (4) Minkowski distance (5) Cosine distance""" def euclidean(x: np.ndarray, y: np.ndarray) -> Union[float, np...
the_stack_v2_python_sparse
StatisticalLearning/Feature/Distance.py
resummerring/StatisticalLearning
train
0
25d4b8e14d01ece3538c8ec8280c09fcdb4de6b0
[ "args = get_comment_parser.find_parser.parse_args()\ncomments = CommentModelWorker.get_all_comments(args['get_field'], args['author'], args['article'], args['limit'], args['offset'])\nif 'image' in args['get_field']:\n for comment in comments:\n if comment['image'] is not None:\n comment['image...
<|body_start_0|> args = get_comment_parser.find_parser.parse_args() comments = CommentModelWorker.get_all_comments(args['get_field'], args['author'], args['article'], args['limit'], args['offset']) if 'image' in args['get_field']: for comment in comments: if comment['...
Ресурс для взаимодействия с комментариями через API
CommentsListResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentsListResource: """Ресурс для взаимодействия с комментариями через API""" def get(self): """Получение списка комментариев""" <|body_0|> def post(self): """Добавление комментария""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = get_co...
stack_v2_sparse_classes_75kplus_train_066637
4,217
no_license
[ { "docstring": "Получение списка комментариев", "name": "get", "signature": "def get(self)" }, { "docstring": "Добавление комментария", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_047775
Implement the Python class `CommentsListResource` described below. Class description: Ресурс для взаимодействия с комментариями через API Method signatures and docstrings: - def get(self): Получение списка комментариев - def post(self): Добавление комментария
Implement the Python class `CommentsListResource` described below. Class description: Ресурс для взаимодействия с комментариями через API Method signatures and docstrings: - def get(self): Получение списка комментариев - def post(self): Добавление комментария <|skeleton|> class CommentsListResource: """Ресурс дл...
1bc59640f13ae4fe6582bb10c9093ff3d671aeb1
<|skeleton|> class CommentsListResource: """Ресурс для взаимодействия с комментариями через API""" def get(self): """Получение списка комментариев""" <|body_0|> def post(self): """Добавление комментария""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommentsListResource: """Ресурс для взаимодействия с комментариями через API""" def get(self): """Получение списка комментариев""" args = get_comment_parser.find_parser.parse_args() comments = CommentModelWorker.get_all_comments(args['get_field'], args['author'], args['article'], ...
the_stack_v2_python_sparse
resources/comments.py
KosenokIvan/articles_website
train
1
5d755d25a57408a713ea354bad709ec6e61f0c12
[ "super(Discriminator, self).__init__()\nself.conv_dim = conv_dim\nself.conv1 = conv(3, conv_dim, 4, batch_norm=False)\nself.conv2 = conv(conv_dim, conv_dim * 2, 4)\nself.conv3 = conv(conv_dim * 2, conv_dim * 4, 4)\nself.fc = nn.Linear(conv_dim * 4 * 4 * 4, 1)", "x = F.leaky_relu(self.conv1(x), 0.2)\nx = F.leaky_r...
<|body_start_0|> super(Discriminator, self).__init__() self.conv_dim = conv_dim self.conv1 = conv(3, conv_dim, 4, batch_norm=False) self.conv2 = conv(conv_dim, conv_dim * 2, 4) self.conv3 = conv(conv_dim * 2, conv_dim * 4, 4) self.fc = nn.Linear(conv_dim * 4 * 4 * 4, 1) <...
Discriminator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Discriminator: def __init__(self, conv_dim=32): """Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer""" <|body_0|> def forward(self, x): """Forward propagation of the neural network :param x: The input to the neural netwo...
stack_v2_sparse_classes_75kplus_train_066638
12,896
permissive
[ { "docstring": "Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer", "name": "__init__", "signature": "def __init__(self, conv_dim=32)" }, { "docstring": "Forward propagation of the neural network :param x: The input to the neural network :return: Dis...
2
stack_v2_sparse_classes_30k_train_039227
Implement the Python class `Discriminator` described below. Class description: Implement the Discriminator class. Method signatures and docstrings: - def __init__(self, conv_dim=32): Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer - def forward(self, x): Forward propaga...
Implement the Python class `Discriminator` described below. Class description: Implement the Discriminator class. Method signatures and docstrings: - def __init__(self, conv_dim=32): Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer - def forward(self, x): Forward propaga...
b9b54564f94aadfc3c71ff513da0f05ef85d22a8
<|skeleton|> class Discriminator: def __init__(self, conv_dim=32): """Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer""" <|body_0|> def forward(self, x): """Forward propagation of the neural network :param x: The input to the neural netwo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Discriminator: def __init__(self, conv_dim=32): """Initialize the Discriminator Module :param conv_dim: The depth of the first convolutional layer""" super(Discriminator, self).__init__() self.conv_dim = conv_dim self.conv1 = conv(3, conv_dim, 4, batch_norm=False) self....
the_stack_v2_python_sparse
dl/pytorch/gan/face_gan.py
xta0/Python-Playground
train
0
86dd948bcd9ed9c93f4cb52026e7f4cf37afc639
[ "try:\n self.access_token = os.environ['DROPBOX_TOKEN']\n self.dropbox = dropbox.Dropbox(self.access_token)\nexcept Exception as e:\n raise InvalidCredentialsError(e)", "folder_path = '/' + folder_name\ncheck_if_folder_exist = self.dropbox.files_search(path='', query=self.folder_name)\nif check_if_folder...
<|body_start_0|> try: self.access_token = os.environ['DROPBOX_TOKEN'] self.dropbox = dropbox.Dropbox(self.access_token) except Exception as e: raise InvalidCredentialsError(e) <|end_body_0|> <|body_start_1|> folder_path = '/' + folder_name check_if_fo...
Entree Drop Box library. Storage for entree videos.
EntreeStorage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntreeStorage: """Entree Drop Box library. Storage for entree videos.""" def __init__(self): """class instantiated with a dropbox token raise authentication error if token doesnt exist""" <|body_0|> def create_folder(self, folder_name): """Organisation is key. Al...
stack_v2_sparse_classes_75kplus_train_066639
3,491
no_license
[ { "docstring": "class instantiated with a dropbox token raise authentication error if token doesnt exist", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Organisation is key. All tutorial should be properly organised in their various folder", "name": "create_folder"...
5
stack_v2_sparse_classes_30k_train_049061
Implement the Python class `EntreeStorage` described below. Class description: Entree Drop Box library. Storage for entree videos. Method signatures and docstrings: - def __init__(self): class instantiated with a dropbox token raise authentication error if token doesnt exist - def create_folder(self, folder_name): Or...
Implement the Python class `EntreeStorage` described below. Class description: Entree Drop Box library. Storage for entree videos. Method signatures and docstrings: - def __init__(self): class instantiated with a dropbox token raise authentication error if token doesnt exist - def create_folder(self, folder_name): Or...
5ab50cc7cccb972edd0e54812aa15e451c9aceba
<|skeleton|> class EntreeStorage: """Entree Drop Box library. Storage for entree videos.""" def __init__(self): """class instantiated with a dropbox token raise authentication error if token doesnt exist""" <|body_0|> def create_folder(self, folder_name): """Organisation is key. Al...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EntreeStorage: """Entree Drop Box library. Storage for entree videos.""" def __init__(self): """class instantiated with a dropbox token raise authentication error if token doesnt exist""" try: self.access_token = os.environ['DROPBOX_TOKEN'] self.dropbox = dropbox.D...
the_stack_v2_python_sparse
application/modules/core/utils/entree_box.py
segedy01/churner
train
0
41696d2af141e5ef644877111d98320e84366192
[ "try:\n if not authCheck(['12', '515400'], requests.session.get('login')):\n return JsonResponse({'status': False, 'err': '你没有权限'}, status=401)\n param = requests.body\n jsonParams = json.loads(param)\n user = getUser(requests.session.get('login'))\n if Classification.objects.filter(name__exac...
<|body_start_0|> try: if not authCheck(['12', '515400'], requests.session.get('login')): return JsonResponse({'status': False, 'err': '你没有权限'}, status=401) param = requests.body jsonParams = json.loads(param) user = getUser(requests.session.get('lo...
CommodityClassificationView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommodityClassificationView: def post(self, requests): """新增商品分类 :param requests: :return:""" <|body_0|> def get(self, requests): """获取商品分类列表 :param requests: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: if not authCheck...
stack_v2_sparse_classes_75kplus_train_066640
2,063
no_license
[ { "docstring": "新增商品分类 :param requests: :return:", "name": "post", "signature": "def post(self, requests)" }, { "docstring": "获取商品分类列表 :param requests: :return:", "name": "get", "signature": "def get(self, requests)" } ]
2
stack_v2_sparse_classes_30k_train_051820
Implement the Python class `CommodityClassificationView` described below. Class description: Implement the CommodityClassificationView class. Method signatures and docstrings: - def post(self, requests): 新增商品分类 :param requests: :return: - def get(self, requests): 获取商品分类列表 :param requests: :return:
Implement the Python class `CommodityClassificationView` described below. Class description: Implement the CommodityClassificationView class. Method signatures and docstrings: - def post(self, requests): 新增商品分类 :param requests: :return: - def get(self, requests): 获取商品分类列表 :param requests: :return: <|skeleton|> class...
526dea540048fc92260bce611c520c50af744e0b
<|skeleton|> class CommodityClassificationView: def post(self, requests): """新增商品分类 :param requests: :return:""" <|body_0|> def get(self, requests): """获取商品分类列表 :param requests: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CommodityClassificationView: def post(self, requests): """新增商品分类 :param requests: :return:""" try: if not authCheck(['12', '515400'], requests.session.get('login')): return JsonResponse({'status': False, 'err': '你没有权限'}, status=401) param = requests.body...
the_stack_v2_python_sparse
apps/market/views/classification/ClassificationInfo.py
DICKQI/ALGYunXS
train
0
2512e0e6376f2dca1602fda07c7e6c85e7553b5e
[ "parser.add_argument('log_name', help='The name of the log where the log entry will be written.')\nparser.add_argument('message', help='The message to put in the log entry. It can be JSON if you include --payload-type=json.')\nparser.add_argument('--payload-type', choices=Write.PAYLOAD_TYPE, default='text', help='T...
<|body_start_0|> parser.add_argument('log_name', help='The name of the log where the log entry will be written.') parser.add_argument('message', help='The message to put in the log entry. It can be JSON if you include --payload-type=json.') parser.add_argument('--payload-type', choices=Write.PAY...
Writes a log entry.
Write
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Write: """Writes a log entry.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this ...
stack_v2_sparse_classes_75kplus_train_066641
4,144
permissive
[ { "docstring": "Register flags for this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation.", "name": "Run",...
2
null
Implement the Python class `Write` described below. Class description: Writes a log entry. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that w...
Implement the Python class `Write` described below. Class description: Writes a log entry. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that w...
c98b58aeb0994e011df960163541e9379ae7ea06
<|skeleton|> class Write: """Writes a log entry.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Write: """Writes a log entry.""" def Args(parser): """Register flags for this command.""" parser.add_argument('log_name', help='The name of the log where the log entry will be written.') parser.add_argument('message', help='The message to put in the log entry. It can be JSON if yo...
the_stack_v2_python_sparse
google-cloud-sdk/lib/surface/logging/write.py
KaranToor/MA450
train
1
0f29dfbeb8b6a0df5cb497b266db133252027762
[ "def backtrack(nums, size, start, path):\n res.append(path[:])\n for i in range(start, size):\n path.append(nums[i])\n backtrack(nums, size, i + 1, path)\n path.pop()\nres = []\nsize = len(nums)\nbacktrack(nums, size, 0, [])\nreturn res", "if len(nums) == 0:\n return [[]]\nlast = num...
<|body_start_0|> def backtrack(nums, size, start, path): res.append(path[:]) for i in range(start, size): path.append(nums[i]) backtrack(nums, size, i + 1, path) path.pop() res = [] size = len(nums) backtrack(nums, s...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: """题解:https://leetcode-cn.com/problems/subsets/solution/c-zong-jie-liao-hui-su-wen-ti-lei-xing-dai-ni-gao-/""" <|body_0|> def subsets1(self, nums: List[int]) -> List[List[int]]: """数学归纳递归:subset([1,2,3]...
stack_v2_sparse_classes_75kplus_train_066642
3,816
permissive
[ { "docstring": "题解:https://leetcode-cn.com/problems/subsets/solution/c-zong-jie-liao-hui-su-wen-ti-lei-xing-dai-ni-gao-/", "name": "subsets", "signature": "def subsets(self, nums: List[int]) -> List[List[int]]" }, { "docstring": "数学归纳递归:subset([1,2,3]) = A + [A[i].add(3) for i = 1..len(A)] https...
5
stack_v2_sparse_classes_30k_train_029634
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums: List[int]) -> List[List[int]]: 题解:https://leetcode-cn.com/problems/subsets/solution/c-zong-jie-liao-hui-su-wen-ti-lei-xing-dai-ni-gao-/ - def subsets1(sel...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subsets(self, nums: List[int]) -> List[List[int]]: 题解:https://leetcode-cn.com/problems/subsets/solution/c-zong-jie-liao-hui-su-wen-ti-lei-xing-dai-ni-gao-/ - def subsets1(sel...
e8a1c6cae6547cbcb6e8494be6df685f3e7c837c
<|skeleton|> class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: """题解:https://leetcode-cn.com/problems/subsets/solution/c-zong-jie-liao-hui-su-wen-ti-lei-xing-dai-ni-gao-/""" <|body_0|> def subsets1(self, nums: List[int]) -> List[List[int]]: """数学归纳递归:subset([1,2,3]...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: """题解:https://leetcode-cn.com/problems/subsets/solution/c-zong-jie-liao-hui-su-wen-ti-lei-xing-dai-ni-gao-/""" def backtrack(nums, size, start, path): res.append(path[:]) for i in range(start, size): ...
the_stack_v2_python_sparse
78-subsets.py
yuenliou/leetcode
train
0
063be949ac4483b2b6a04ece1dfab82262dabbcc
[ "if not nums:\n return 0\nlength = len(nums)\nif nums[length - 1] < target:\n return length\nif nums[0] >= target:\n return 0\nfor i in range(0, length - 1):\n if nums[i] < target and nums[i + 1] >= target:\n return i + 1\nreturn -1", "if not nums:\n return 0\nif nums[0] >= target:\n retu...
<|body_start_0|> if not nums: return 0 length = len(nums) if nums[length - 1] < target: return length if nums[0] >= target: return 0 for i in range(0, length - 1): if nums[i] < target and nums[i + 1] >= target: retur...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search_insert(self, nums: List[int], target: int) -> int: """返回元素插入位置 Args: nums: 数组 target: 目标值 Returns: 返回需要插入的位置""" <|body_0|> def search_insert2(self, nums: List[int], target: int) -> int: """返回元素插入位置 Args: nums: 数组 target: 目标值 Returns: 返回需要插入的位置"""...
stack_v2_sparse_classes_75kplus_train_066643
3,290
permissive
[ { "docstring": "返回元素插入位置 Args: nums: 数组 target: 目标值 Returns: 返回需要插入的位置", "name": "search_insert", "signature": "def search_insert(self, nums: List[int], target: int) -> int" }, { "docstring": "返回元素插入位置 Args: nums: 数组 target: 目标值 Returns: 返回需要插入的位置", "name": "search_insert2", "signature":...
3
stack_v2_sparse_classes_30k_train_032785
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search_insert(self, nums: List[int], target: int) -> int: 返回元素插入位置 Args: nums: 数组 target: 目标值 Returns: 返回需要插入的位置 - def search_insert2(self, nums: List[int], target: int) -> i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search_insert(self, nums: List[int], target: int) -> int: 返回元素插入位置 Args: nums: 数组 target: 目标值 Returns: 返回需要插入的位置 - def search_insert2(self, nums: List[int], target: int) -> i...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def search_insert(self, nums: List[int], target: int) -> int: """返回元素插入位置 Args: nums: 数组 target: 目标值 Returns: 返回需要插入的位置""" <|body_0|> def search_insert2(self, nums: List[int], target: int) -> int: """返回元素插入位置 Args: nums: 数组 target: 目标值 Returns: 返回需要插入的位置"""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def search_insert(self, nums: List[int], target: int) -> int: """返回元素插入位置 Args: nums: 数组 target: 目标值 Returns: 返回需要插入的位置""" if not nums: return 0 length = len(nums) if nums[length - 1] < target: return length if nums[0] >= target: ...
the_stack_v2_python_sparse
src/leetcodepython/array/search_insert_position_35.py
zhangyu345293721/leetcode
train
101
370d0f94ff61a18f421e45617d057132a602a760
[ "helpMessage = 'Exec into the running Docker container'\nargHelp = 'Volume map the working directory onto the container'\nparser = subparsers.add_parser('exec', help=helpMessage)\nparser.add_argument('-m', '--map', action='store_true', help=argHelp)\nreturn subparsers", "mappings = []\nif args.map:\n mappings....
<|body_start_0|> helpMessage = 'Exec into the running Docker container' argHelp = 'Volume map the working directory onto the container' parser = subparsers.add_parser('exec', help=helpMessage) parser.add_argument('-m', '--map', action='store_true', help=argHelp) return subparsers...
Docker Exec Class Provides a command to access the project container via bash prompt with the option volume map the contents of the project into the container so that they can be modified as root
Dexec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dexec: """Docker Exec Class Provides a command to access the project container via bash prompt with the option volume map the contents of the project into the container so that they can be modified as root""" def addParsers(self, subparsers): """SkeleParser Hook Adds a parser for the...
stack_v2_sparse_classes_75kplus_train_066644
1,545
permissive
[ { "docstring": "SkeleParser Hook Adds a parser for the exec command that allows for bash access to the project container along with full project volume mapping support via an optional parameter flag", "name": "addParsers", "signature": "def addParsers(self, subparsers)" }, { "docstring": "Execut...
2
stack_v2_sparse_classes_30k_train_020398
Implement the Python class `Dexec` described below. Class description: Docker Exec Class Provides a command to access the project container via bash prompt with the option volume map the contents of the project into the container so that they can be modified as root Method signatures and docstrings: - def addParsers(...
Implement the Python class `Dexec` described below. Class description: Docker Exec Class Provides a command to access the project container via bash prompt with the option volume map the contents of the project into the container so that they can be modified as root Method signatures and docstrings: - def addParsers(...
c4299702994cdd55738de4591e85f4dc2a424d19
<|skeleton|> class Dexec: """Docker Exec Class Provides a command to access the project container via bash prompt with the option volume map the contents of the project into the container so that they can be modified as root""" def addParsers(self, subparsers): """SkeleParser Hook Adds a parser for the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Dexec: """Docker Exec Class Provides a command to access the project container via bash prompt with the option volume map the contents of the project into the container so that they can be modified as root""" def addParsers(self, subparsers): """SkeleParser Hook Adds a parser for the exec command...
the_stack_v2_python_sparse
skelebot/components/dexec.py
carsdotcom/skelebot
train
37
91257403a677e0b43a69877e47486942f19b07c4
[ "self._buf = record\nself.mandatory_header = _unpack_from_buf(self._buf, 0, UF_MANDATORY_HEADER)\nself.optional_header = None\nif self.mandatory_header['offset_optional_header'] != 0:\n offset = (self.mandatory_header['offset_optional_header'] - 1) * 2\n self.optional_header = _unpack_from_buf(self._buf, offs...
<|body_start_0|> self._buf = record self.mandatory_header = _unpack_from_buf(self._buf, 0, UF_MANDATORY_HEADER) self.optional_header = None if self.mandatory_header['offset_optional_header'] != 0: offset = (self.mandatory_header['offset_optional_header'] - 1) * 2 ...
A class for reading data from a single ray (record) in a UF file. Parameters ---------- record : str Byte string containing the binary data for a UF ray. Attributes ---------- mandatory_header : dic Mandatory header. optional_header : dic or None Optional header or None if no optional header exists in the record. data_...
UFRay
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UFRay: """A class for reading data from a single ray (record) in a UF file. Parameters ---------- record : str Byte string containing the binary data for a UF ray. Attributes ---------- mandatory_header : dic Mandatory header. optional_header : dic or None Optional header or None if no optional h...
stack_v2_sparse_classes_75kplus_train_066645
19,352
permissive
[ { "docstring": "Initalize the object.", "name": "__init__", "signature": "def __init__(self, record)" }, { "docstring": "Return array of raw data for a particular field in the ray. Field header is appended to the list in the field_headers attribute.", "name": "get_field_data", "signature...
4
stack_v2_sparse_classes_30k_train_000905
Implement the Python class `UFRay` described below. Class description: A class for reading data from a single ray (record) in a UF file. Parameters ---------- record : str Byte string containing the binary data for a UF ray. Attributes ---------- mandatory_header : dic Mandatory header. optional_header : dic or None O...
Implement the Python class `UFRay` described below. Class description: A class for reading data from a single ray (record) in a UF file. Parameters ---------- record : str Byte string containing the binary data for a UF ray. Attributes ---------- mandatory_header : dic Mandatory header. optional_header : dic or None O...
172bbcf1cf3bcdb953c76ebae72c27c95dc2e606
<|skeleton|> class UFRay: """A class for reading data from a single ray (record) in a UF file. Parameters ---------- record : str Byte string containing the binary data for a UF ray. Attributes ---------- mandatory_header : dic Mandatory header. optional_header : dic or None Optional header or None if no optional h...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UFRay: """A class for reading data from a single ray (record) in a UF file. Parameters ---------- record : str Byte string containing the binary data for a UF ray. Attributes ---------- mandatory_header : dic Mandatory header. optional_header : dic or None Optional header or None if no optional header exists ...
the_stack_v2_python_sparse
pyart/io/uffile.py
ARM-DOE/pyart
train
455
1132e744796fce7f11ab14cb21a3ae2973d69374
[ "log.info(f\"{'Getting osd configurations'}\")\ncmd = f'ceph config get osd {param}'\nout = super().run_ceph_command(cmd=cmd)\nreturn out", "cmd = f'ceph config set osd {param} {value}'\nout, err = self.node.shell([cmd])\nactual_value = self.get_osd_configuration(param)\nif actual_value == value:\n log.info(...
<|body_start_0|> log.info(f"{'Getting osd configurations'}") cmd = f'ceph config get osd {param}' out = super().run_ceph_command(cmd=cmd) return out <|end_body_0|> <|body_start_1|> cmd = f'ceph config set osd {param} {value}' out, err = self.node.shell([cmd]) a...
RadosScrubber
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RadosScrubber: def get_osd_configuration(self, param): """Used to get the osd parameter value Args: params : Parameter to get the value Returns : parameter value""" <|body_0|> def set_osd_configuration(self, param, value): """Used to set the configuration parametrs t...
stack_v2_sparse_classes_75kplus_train_066646
6,245
permissive
[ { "docstring": "Used to get the osd parameter value Args: params : Parameter to get the value Returns : parameter value", "name": "get_osd_configuration", "signature": "def get_osd_configuration(self, param)" }, { "docstring": "Used to set the configuration parametrs to the OSD's. Args: params :...
6
null
Implement the Python class `RadosScrubber` described below. Class description: Implement the RadosScrubber class. Method signatures and docstrings: - def get_osd_configuration(self, param): Used to get the osd parameter value Args: params : Parameter to get the value Returns : parameter value - def set_osd_configurat...
Implement the Python class `RadosScrubber` described below. Class description: Implement the RadosScrubber class. Method signatures and docstrings: - def get_osd_configuration(self, param): Used to get the osd parameter value Args: params : Parameter to get the value Returns : parameter value - def set_osd_configurat...
0691fbaf8fca2a9cd051c5049c83758c65301654
<|skeleton|> class RadosScrubber: def get_osd_configuration(self, param): """Used to get the osd parameter value Args: params : Parameter to get the value Returns : parameter value""" <|body_0|> def set_osd_configuration(self, param, value): """Used to set the configuration parametrs t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RadosScrubber: def get_osd_configuration(self, param): """Used to get the osd parameter value Args: params : Parameter to get the value Returns : parameter value""" log.info(f"{'Getting osd configurations'}") cmd = f'ceph config get osd {param}' out = super().run_ceph_command(...
the_stack_v2_python_sparse
ceph/rados/rados_scrub.py
red-hat-storage/cephci
train
28
19f3d75afccca7ed2b5fce7e8c3562179220b31d
[ "sig = inspect.signature(cls)\nclskwds = {}\nfor name, param in list(sig.parameters.items()):\n if param.kind in (param.POSITIONAL_OR_KEYWORD, param.KEYWORD_ONLY):\n try:\n clskwds[name] = kwargs.pop(name)\n except KeyError:\n pass\nreturn (cls(*args, **clskwds), kwargs)", "...
<|body_start_0|> sig = inspect.signature(cls) clskwds = {} for name, param in list(sig.parameters.items()): if param.kind in (param.POSITIONAL_OR_KEYWORD, param.KEYWORD_ONLY): try: clskwds[name] = kwargs.pop(name) except KeyError: ...
A base class for composable components. This class helps propagating, sharing, and intercepting arguments (initialization parameters) in a unified manner so that classes can pass arguments to their sub-components reliably. For a basic usage, `BaseComponent` only requires its subclass to *not* have keyword arguments (``...
BaseComponent
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseComponent: """A base class for composable components. This class helps propagating, sharing, and intercepting arguments (initialization parameters) in a unified manner so that classes can pass arguments to their sub-components reliably. For a basic usage, `BaseComponent` only requires its sub...
stack_v2_sparse_classes_75kplus_train_066647
8,935
permissive
[ { "docstring": "Instantiate `cls` using a subset of `kwargs` and return the rest. Returns ------- self : cls The result of ``cls(*args, **clskwds)`` where `clskwds` is a subset of `kwargs`. It is determined by the call signature of `cls.__init__`. rest : dict A subset of `kwargs` not used by `cls.__init__`; i.e...
3
stack_v2_sparse_classes_30k_train_016232
Implement the Python class `BaseComponent` described below. Class description: A base class for composable components. This class helps propagating, sharing, and intercepting arguments (initialization parameters) in a unified manner so that classes can pass arguments to their sub-components reliably. For a basic usage...
Implement the Python class `BaseComponent` described below. Class description: A base class for composable components. This class helps propagating, sharing, and intercepting arguments (initialization parameters) in a unified manner so that classes can pass arguments to their sub-components reliably. For a basic usage...
06c549e8ae74bc6af62fddeed698565ea1f548c5
<|skeleton|> class BaseComponent: """A base class for composable components. This class helps propagating, sharing, and intercepting arguments (initialization parameters) in a unified manner so that classes can pass arguments to their sub-components reliably. For a basic usage, `BaseComponent` only requires its sub...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseComponent: """A base class for composable components. This class helps propagating, sharing, and intercepting arguments (initialization parameters) in a unified manner so that classes can pass arguments to their sub-components reliably. For a basic usage, `BaseComponent` only requires its subclass to *not...
the_stack_v2_python_sparse
tc_gan/core.py
ahmadianlab/tc-gan
train
4
1d33c339a471d73df0253d0cda5ebe5e059f8fc7
[ "length = len(nums)\nif length > 0:\n maxSoFar = nums[0]\n maxEndingHere = nums[0]\n for i in range(1, length):\n maxEndingHere = max(maxEndingHere + nums[i], nums[i])\n maxSoFar = max(maxSoFar, maxEndingHere)\n return maxSoFar\nelse:\n return 0", "count = len(nums)\nif count == 0:\n ...
<|body_start_0|> length = len(nums) if length > 0: maxSoFar = nums[0] maxEndingHere = nums[0] for i in range(1, length): maxEndingHere = max(maxEndingHere + nums[i], nums[i]) maxSoFar = max(maxSoFar, maxEndingHere) return ma...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray_self(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> length = len(nums) if length > 0...
stack_v2_sparse_classes_75kplus_train_066648
896
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray_self", "signature": "def maxSubArray_self(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_053833
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray_self(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray_self(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxSub...
ea492ec864b50547214ecbbb2cdeeac21e70229b
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray_self(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" length = len(nums) if length > 0: maxSoFar = nums[0] maxEndingHere = nums[0] for i in range(1, length): maxEndingHere = max(maxEndingHere + nums[i], nums[i...
the_stack_v2_python_sparse
53_maximum_subarray/sol.py
lianke123321/leetcode_sol
train
0
598a5947b5edcd6e71016e7959d700f4e2e34524
[ "queryset = get_object_or_404(Upload, pk=pk)\nserializer = UploadSerializer(queryset)\nreturn Response(serializer.data)", "queryset = get_object_or_404(Upload, pk=pk)\nserializer = UploadSerializer(queryset, data=request.data)\nif serializer.is_valid():\n serializer.save()\n return Response(serializer.data,...
<|body_start_0|> queryset = get_object_or_404(Upload, pk=pk) serializer = UploadSerializer(queryset) return Response(serializer.data) <|end_body_0|> <|body_start_1|> queryset = get_object_or_404(Upload, pk=pk) serializer = UploadSerializer(queryset, data=request.data) if...
UploadDetailView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadDetailView: def get(self, request, pk): """Lista detalhes de um upload * É preciso estar autenticado para visualizar.""" <|body_0|> def put(self, request, pk): """Altera todos os dados do upload * É preciso estar autenticado para editar.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_066649
4,003
no_license
[ { "docstring": "Lista detalhes de um upload * É preciso estar autenticado para visualizar.", "name": "get", "signature": "def get(self, request, pk)" }, { "docstring": "Altera todos os dados do upload * É preciso estar autenticado para editar.", "name": "put", "signature": "def put(self,...
4
stack_v2_sparse_classes_30k_train_020147
Implement the Python class `UploadDetailView` described below. Class description: Implement the UploadDetailView class. Method signatures and docstrings: - def get(self, request, pk): Lista detalhes de um upload * É preciso estar autenticado para visualizar. - def put(self, request, pk): Altera todos os dados do uplo...
Implement the Python class `UploadDetailView` described below. Class description: Implement the UploadDetailView class. Method signatures and docstrings: - def get(self, request, pk): Lista detalhes de um upload * É preciso estar autenticado para visualizar. - def put(self, request, pk): Altera todos os dados do uplo...
06d7632eccdc013262e8c1476d2b6a7052bd3c52
<|skeleton|> class UploadDetailView: def get(self, request, pk): """Lista detalhes de um upload * É preciso estar autenticado para visualizar.""" <|body_0|> def put(self, request, pk): """Altera todos os dados do upload * É preciso estar autenticado para editar.""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UploadDetailView: def get(self, request, pk): """Lista detalhes de um upload * É preciso estar autenticado para visualizar.""" queryset = get_object_or_404(Upload, pk=pk) serializer = UploadSerializer(queryset) return Response(serializer.data) def put(self, request, pk): ...
the_stack_v2_python_sparse
upload/views.py
foschieraanderson/gallery-django-react
train
0
194a1abd2cf1e239502d52793b94d386d5390892
[ "today = timezone.now().date()\ncount = user.threads.filter(started__gte=today).count()\nreturn count", "timestamp = Negotiation.get_timestamp(timezone.now().date())\ncount = user.negotiations_made.filter(time__gte=timestamp).count()\nreturn count", "from scoop.messaging.models import Message\ntimestamp = Messa...
<|body_start_0|> today = timezone.now().date() count = user.threads.filter(started__gte=today).count() return count <|end_body_0|> <|body_start_1|> timestamp = Negotiation.get_timestamp(timezone.now().date()) count = user.negotiations_made.filter(time__gte=timestamp).count() ...
Manager des quotas
QuotaManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuotaManager: """Manager des quotas""" def get_threads_today_by(self, user): """Renvoyer le nombre de fils créés aujourd'hui par un utilisateur""" <|body_0|> def get_negotiations_today_by(self, user): """Renvoyer le nombre de négociations envoyées aujourd'hui par...
stack_v2_sparse_classes_75kplus_train_066650
3,706
no_license
[ { "docstring": "Renvoyer le nombre de fils créés aujourd'hui par un utilisateur", "name": "get_threads_today_by", "signature": "def get_threads_today_by(self, user)" }, { "docstring": "Renvoyer le nombre de négociations envoyées aujourd'hui par un utilisateur", "name": "get_negotiations_toda...
5
stack_v2_sparse_classes_30k_train_011107
Implement the Python class `QuotaManager` described below. Class description: Manager des quotas Method signatures and docstrings: - def get_threads_today_by(self, user): Renvoyer le nombre de fils créés aujourd'hui par un utilisateur - def get_negotiations_today_by(self, user): Renvoyer le nombre de négociations env...
Implement the Python class `QuotaManager` described below. Class description: Manager des quotas Method signatures and docstrings: - def get_threads_today_by(self, user): Renvoyer le nombre de fils créés aujourd'hui par un utilisateur - def get_negotiations_today_by(self, user): Renvoyer le nombre de négociations env...
8cef6f6e89c1990e2b25f83e54e0c3481d83b6d7
<|skeleton|> class QuotaManager: """Manager des quotas""" def get_threads_today_by(self, user): """Renvoyer le nombre de fils créés aujourd'hui par un utilisateur""" <|body_0|> def get_negotiations_today_by(self, user): """Renvoyer le nombre de négociations envoyées aujourd'hui par...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QuotaManager: """Manager des quotas""" def get_threads_today_by(self, user): """Renvoyer le nombre de fils créés aujourd'hui par un utilisateur""" today = timezone.now().date() count = user.threads.filter(started__gte=today).count() return count def get_negotiations_t...
the_stack_v2_python_sparse
scoop/messaging/models/quota.py
artscoop/scoop
train
0
4549b28bd76b451d26d9af6d5fb7ab6ebf431162
[ "self.model = model\nself.dataloader = dataloader\nself.loss = loss_function()\nself.optimizer = optimizer\nself.epochs = epochs\nself.lr_scheduler = lr_scheduler\nself.device = device\nself.log_step = log_step\nself.checkpoints_dir_path = checkpoints_dir_path\nself.validator = BaseTester(val_dataloader, loss_funct...
<|body_start_0|> self.model = model self.dataloader = dataloader self.loss = loss_function() self.optimizer = optimizer self.epochs = epochs self.lr_scheduler = lr_scheduler self.device = device self.log_step = log_step self.checkpoints_dir_path = ...
The class implements the base trainer pipeline.
BaseTrainer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseTrainer: """The class implements the base trainer pipeline.""" def __init__(self, model, dataloader, loss_function, optimizer, epochs, lr_scheduler=None, val_dataloader=None, device='cuda', log_step=50, checkpoints_dir_path=None): """Constructor, the function initializes the trai...
stack_v2_sparse_classes_75kplus_train_066651
4,215
permissive
[ { "docstring": "Constructor, the function initializes the training related parameters. :param model: The model to train :param dataloader: The dataloader to get training samples from :param loss_function: The loss function :param optimizer: The optimizer to be used for training :param epochs: Number of epochs :...
3
stack_v2_sparse_classes_30k_train_025892
Implement the Python class `BaseTrainer` described below. Class description: The class implements the base trainer pipeline. Method signatures and docstrings: - def __init__(self, model, dataloader, loss_function, optimizer, epochs, lr_scheduler=None, val_dataloader=None, device='cuda', log_step=50, checkpoints_dir_p...
Implement the Python class `BaseTrainer` described below. Class description: The class implements the base trainer pipeline. Method signatures and docstrings: - def __init__(self, model, dataloader, loss_function, optimizer, epochs, lr_scheduler=None, val_dataloader=None, device='cuda', log_step=50, checkpoints_dir_p...
9a4bf0a112b818caca8794868a903dc736839a43
<|skeleton|> class BaseTrainer: """The class implements the base trainer pipeline.""" def __init__(self, model, dataloader, loss_function, optimizer, epochs, lr_scheduler=None, val_dataloader=None, device='cuda', log_step=50, checkpoints_dir_path=None): """Constructor, the function initializes the trai...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseTrainer: """The class implements the base trainer pipeline.""" def __init__(self, model, dataloader, loss_function, optimizer, epochs, lr_scheduler=None, val_dataloader=None, device='cuda', log_step=50, checkpoints_dir_path=None): """Constructor, the function initializes the training related ...
the_stack_v2_python_sparse
train/base_trainer.py
Niousha12/ssl_for_fgvc
train
0
21c7e669f0e518f3a8ed6f3c6b34e36540504332
[ "sigmas, norms = get_sigmas_and_norms(**kwargs)\nm = MultiGauss2D(sigmas=sigmas, norms=norms)\nm.normalize()\ncontainment = m.containment_fraction(rad)\nreturn containment", "sigmas, norms = get_sigmas_and_norms(**kwargs)\nm = MultiGauss2D(sigmas=sigmas, norms=norms)\nm.normalize()\nreturn m(rad)" ]
<|body_start_0|> sigmas, norms = get_sigmas_and_norms(**kwargs) m = MultiGauss2D(sigmas=sigmas, norms=norms) m.normalize() containment = m.containment_fraction(rad) return containment <|end_body_0|> <|body_start_1|> sigmas, norms = get_sigmas_and_norms(**kwargs) ...
Triple Gauss analytical PSF depending on true energy and offset. Parameters ---------- axes : list of `MapAxis` Required axes are ["energy_true", "offset"] data : `~numpy.recarray` Data array meta : dict Meta data Examples -------- Plot R68 of the PSF vs. offset and true energy: .. plot:: :include-source: import matplo...
EnergyDependentMultiGaussPSF
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnergyDependentMultiGaussPSF: """Triple Gauss analytical PSF depending on true energy and offset. Parameters ---------- axes : list of `MapAxis` Required axes are ["energy_true", "offset"] data : `~numpy.recarray` Data array meta : dict Meta data Examples -------- Plot R68 of the PSF vs. offset a...
stack_v2_sparse_classes_75kplus_train_066652
12,422
permissive
[ { "docstring": "Containment of the PSF at given axes coordinates Parameters ---------- rad : `~astropy.units.Quantity` Rad value **kwargs : dict Parameters, see `required_parameters` Returns ------- containment : `~numpy.ndarray` Containment", "name": "evaluate_containment", "signature": "def evaluate_c...
2
null
Implement the Python class `EnergyDependentMultiGaussPSF` described below. Class description: Triple Gauss analytical PSF depending on true energy and offset. Parameters ---------- axes : list of `MapAxis` Required axes are ["energy_true", "offset"] data : `~numpy.recarray` Data array meta : dict Meta data Examples --...
Implement the Python class `EnergyDependentMultiGaussPSF` described below. Class description: Triple Gauss analytical PSF depending on true energy and offset. Parameters ---------- axes : list of `MapAxis` Required axes are ["energy_true", "offset"] data : `~numpy.recarray` Data array meta : dict Meta data Examples --...
60f03adb8fc7851b9f3ca039512c03a669e3fe10
<|skeleton|> class EnergyDependentMultiGaussPSF: """Triple Gauss analytical PSF depending on true energy and offset. Parameters ---------- axes : list of `MapAxis` Required axes are ["energy_true", "offset"] data : `~numpy.recarray` Data array meta : dict Meta data Examples -------- Plot R68 of the PSF vs. offset a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EnergyDependentMultiGaussPSF: """Triple Gauss analytical PSF depending on true energy and offset. Parameters ---------- axes : list of `MapAxis` Required axes are ["energy_true", "offset"] data : `~numpy.recarray` Data array meta : dict Meta data Examples -------- Plot R68 of the PSF vs. offset and true energ...
the_stack_v2_python_sparse
gammapy/irf/psf/parametric.py
gammapy/gammapy
train
204
a9eab2ef4b94851019af2eb8818ad7dd47e983e0
[ "form = ResearchInfoGetForm(request.args)\nif form.validate():\n try:\n all_research_info = ResearchInformation.query.filter(ResearchInformation.user_id == form.user_id.data).all()\n except:\n return make_response(jsonify({'error': 'Database Connection Problem'}), 500)\n research_list = [{'id...
<|body_start_0|> form = ResearchInfoGetForm(request.args) if form.validate(): try: all_research_info = ResearchInformation.query.filter(ResearchInformation.user_id == form.user_id.data).all() except: return make_response(jsonify({'error': 'Database...
Research Information Functionality is implemented in this class
ResearchInformationAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResearchInformationAPI: """Research Information Functionality is implemented in this class""" def get(user_id, self): """Returns all research information of a user""" <|body_0|> def post(user_id, self): """Adds new Research Information""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_066653
22,916
no_license
[ { "docstring": "Returns all research information of a user", "name": "get", "signature": "def get(user_id, self)" }, { "docstring": "Adds new Research Information", "name": "post", "signature": "def post(user_id, self)" }, { "docstring": "Updates a Research Information", "nam...
4
stack_v2_sparse_classes_30k_val_001702
Implement the Python class `ResearchInformationAPI` described below. Class description: Research Information Functionality is implemented in this class Method signatures and docstrings: - def get(user_id, self): Returns all research information of a user - def post(user_id, self): Adds new Research Information - def ...
Implement the Python class `ResearchInformationAPI` described below. Class description: Research Information Functionality is implemented in this class Method signatures and docstrings: - def get(user_id, self): Returns all research information of a user - def post(user_id, self): Adds new Research Information - def ...
f7aebee17a0a79e8d3c2927733bce8015b4a9da3
<|skeleton|> class ResearchInformationAPI: """Research Information Functionality is implemented in this class""" def get(user_id, self): """Returns all research information of a user""" <|body_0|> def post(user_id, self): """Adds new Research Information""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResearchInformationAPI: """Research Information Functionality is implemented in this class""" def get(user_id, self): """Returns all research information of a user""" form = ResearchInfoGetForm(request.args) if form.validate(): try: all_research_info = ...
the_stack_v2_python_sparse
platon/backend/app/profile_management/views.py
bounswe/bounswe2020group7
train
18
b4084bc0d7b769058e26c19c10430fffc3b2b790
[ "super().__init__()\nself.finetuning = finetuning\nModel, Tokenizer, weight = LANG_MODELS[arch]\nbert = Model.from_pretrained(weight, output_hidden_states=True)\nif not pretrained:\n bert.init_weights()\nif not self.finetuning:\n for param in bert.parameters():\n param.requires_grad = False\nbackbone_d...
<|body_start_0|> super().__init__() self.finetuning = finetuning Model, Tokenizer, weight = LANG_MODELS[arch] bert = Model.from_pretrained(weight, output_hidden_states=True) if not pretrained: bert.init_weights() if not self.finetuning: for param i...
LangModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LangModel: def __init__(self, dim, arch='BERT', layers=(-1,), pretrained=True, finetuning=False): """:param dim: dimension of the output :param arch: backbone architecture, :param aggregate: one of 'last4', :param pretrained: load feature with pre-trained vector :param finetuning: finetu...
stack_v2_sparse_classes_75kplus_train_066654
11,314
permissive
[ { "docstring": ":param dim: dimension of the output :param arch: backbone architecture, :param aggregate: one of 'last4', :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model", "name": "__init__", "signature": "def __init__(self, dim, arch='BERT', layers=(-1,), p...
2
stack_v2_sparse_classes_30k_train_013282
Implement the Python class `LangModel` described below. Class description: Implement the LangModel class. Method signatures and docstrings: - def __init__(self, dim, arch='BERT', layers=(-1,), pretrained=True, finetuning=False): :param dim: dimension of the output :param arch: backbone architecture, :param aggregate:...
Implement the Python class `LangModel` described below. Class description: Implement the LangModel class. Method signatures and docstrings: - def __init__(self, dim, arch='BERT', layers=(-1,), pretrained=True, finetuning=False): :param dim: dimension of the output :param arch: backbone architecture, :param aggregate:...
51ac07d1de564c26fbf038b07031a55660bbcb27
<|skeleton|> class LangModel: def __init__(self, dim, arch='BERT', layers=(-1,), pretrained=True, finetuning=False): """:param dim: dimension of the output :param arch: backbone architecture, :param aggregate: one of 'last4', :param pretrained: load feature with pre-trained vector :param finetuning: finetu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LangModel: def __init__(self, dim, arch='BERT', layers=(-1,), pretrained=True, finetuning=False): """:param dim: dimension of the output :param arch: backbone architecture, :param aggregate: one of 'last4', :param pretrained: load feature with pre-trained vector :param finetuning: finetune the model""...
the_stack_v2_python_sparse
retrieval_model/xmatching/model.py
CJJ2923/Maria
train
0
089a08ebd1c0f88313aca00dca8fb6b2aabc7f09
[ "self.temp_path = mkdtemp(prefix='pelicantests.')\nself.temp_cache = mkdtemp(prefix='pelican_cache.')\nos.chdir(TEST_DATA_DIR)", "rmtree(self.temp_path)\nrmtree(self.temp_cache)\nos.chdir(PLUGIN_DIR)", "base_path = os.path.dirname(os.path.abspath(__file__))\nbase_path = os.path.join(base_path, 'test_data')\ncon...
<|body_start_0|> self.temp_path = mkdtemp(prefix='pelicantests.') self.temp_cache = mkdtemp(prefix='pelican_cache.') os.chdir(TEST_DATA_DIR) <|end_body_0|> <|body_start_1|> rmtree(self.temp_path) rmtree(self.temp_cache) os.chdir(PLUGIN_DIR) <|end_body_1|> <|body_start_2...
Test running Pelican with the Plugin
TestFullRun
[ "AGPL-3.0-only", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFullRun: """Test running Pelican with the Plugin""" def setUp(self): """Create temporary output and cache folders""" <|body_0|> def tearDown(self): """Remove output and cache folders""" <|body_1|> def test_generate_with_ipython3(self): ""...
stack_v2_sparse_classes_75kplus_train_066655
3,556
permissive
[ { "docstring": "Create temporary output and cache folders", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Remove output and cache folders", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "Test generation of site with the plugin.", ...
4
stack_v2_sparse_classes_30k_train_001161
Implement the Python class `TestFullRun` described below. Class description: Test running Pelican with the Plugin Method signatures and docstrings: - def setUp(self): Create temporary output and cache folders - def tearDown(self): Remove output and cache folders - def test_generate_with_ipython3(self): Test generatio...
Implement the Python class `TestFullRun` described below. Class description: Test running Pelican with the Plugin Method signatures and docstrings: - def setUp(self): Create temporary output and cache folders - def tearDown(self): Remove output and cache folders - def test_generate_with_ipython3(self): Test generatio...
b5d68070b6f15677a183424c84e30440e128e1ea
<|skeleton|> class TestFullRun: """Test running Pelican with the Plugin""" def setUp(self): """Create temporary output and cache folders""" <|body_0|> def tearDown(self): """Remove output and cache folders""" <|body_1|> def test_generate_with_ipython3(self): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestFullRun: """Test running Pelican with the Plugin""" def setUp(self): """Create temporary output and cache folders""" self.temp_path = mkdtemp(prefix='pelicantests.') self.temp_cache = mkdtemp(prefix='pelican_cache.') os.chdir(TEST_DATA_DIR) def tearDown(self): ...
the_stack_v2_python_sparse
plugins/liquid_tags/test_generation.py
JackMcKew/jackmckew.dev
train
15
01f69e4541f9144b164c9c5256d6c2e6a1317b49
[ "super(PairedDataset, self).__init__(preprocess)\nself.dataroot = dataroot\nself.data_infos = self.prepare_data_infos()", "data_infos = []\npair_paths = sorted(self.scan_folder(self.dataroot))\nfor pair_path in pair_paths:\n data_infos.append(dict(pair_path=pair_path))\nreturn data_infos" ]
<|body_start_0|> super(PairedDataset, self).__init__(preprocess) self.dataroot = dataroot self.data_infos = self.prepare_data_infos() <|end_body_0|> <|body_start_1|> data_infos = [] pair_paths = sorted(self.scan_folder(self.dataroot)) for pair_path in pair_paths: ...
A dataset class for paired image dataset.
PairedDataset
[ "MIT", "Apache-2.0", "Python-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PairedDataset: """A dataset class for paired image dataset.""" def __init__(self, dataroot, preprocess): """Initialize this dataset class. Args: dataroot (str): Directory of dataset. preprocess (list[dict]): A sequence of data preprocess config.""" <|body_0|> def prepare...
stack_v2_sparse_classes_75kplus_train_066656
1,546
permissive
[ { "docstring": "Initialize this dataset class. Args: dataroot (str): Directory of dataset. preprocess (list[dict]): A sequence of data preprocess config.", "name": "__init__", "signature": "def __init__(self, dataroot, preprocess)" }, { "docstring": "Load paired image paths. Returns: list[dict]:...
2
stack_v2_sparse_classes_30k_train_046469
Implement the Python class `PairedDataset` described below. Class description: A dataset class for paired image dataset. Method signatures and docstrings: - def __init__(self, dataroot, preprocess): Initialize this dataset class. Args: dataroot (str): Directory of dataset. preprocess (list[dict]): A sequence of data ...
Implement the Python class `PairedDataset` described below. Class description: A dataset class for paired image dataset. Method signatures and docstrings: - def __init__(self, dataroot, preprocess): Initialize this dataset class. Args: dataroot (str): Directory of dataset. preprocess (list[dict]): A sequence of data ...
038fb5afe017b82334ad39a256531d2c4e9e1e1a
<|skeleton|> class PairedDataset: """A dataset class for paired image dataset.""" def __init__(self, dataroot, preprocess): """Initialize this dataset class. Args: dataroot (str): Directory of dataset. preprocess (list[dict]): A sequence of data preprocess config.""" <|body_0|> def prepare...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PairedDataset: """A dataset class for paired image dataset.""" def __init__(self, dataroot, preprocess): """Initialize this dataset class. Args: dataroot (str): Directory of dataset. preprocess (list[dict]): A sequence of data preprocess config.""" super(PairedDataset, self).__init__(prep...
the_stack_v2_python_sparse
15.PaddleGAN/PaddleGAN/ppgan/datasets/paired_dataset.py
yingshaoxo/ML
train
5
b68d51c273f030eebfd77ada31517e4924f96b20
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('ajr10_williami', 'ajr10_williami')\nrepo.dropCollection('ajr10_williami.area_spaces_cambridge')\nrepo.createCollection('ajr10_williami.area_spaces_cambridge')\nrepo.dropCollection('ajr10_williami.area_sp...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('ajr10_williami', 'ajr10_williami') repo.dropCollection('ajr10_williami.area_spaces_cambridge') repo.createCollection('ajr10_williami.area_spaces_c...
get_area
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class get_area: def execute(trial=False): """Retrieve some data sets and store in mongodb collections.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in this scrip...
stack_v2_sparse_classes_75kplus_train_066657
5,300
no_license
[ { "docstring": "Retrieve some data sets and store in mongodb collections.", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new document describing ...
2
stack_v2_sparse_classes_30k_train_052699
Implement the Python class `get_area` described below. Class description: Implement the get_area class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets and store in mongodb collections. - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Create the prov...
Implement the Python class `get_area` described below. Class description: Implement the get_area class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets and store in mongodb collections. - def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Create the prov...
0df485d0469c5451ebdcd684bed2a0960ba3ab84
<|skeleton|> class get_area: def execute(trial=False): """Retrieve some data sets and store in mongodb collections.""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everything happening in this scrip...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class get_area: def execute(trial=False): """Retrieve some data sets and store in mongodb collections.""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('ajr10_williami', 'ajr10_williami') repo.dropCollectio...
the_stack_v2_python_sparse
ajr10_williami/get_area.py
lingyigu/course-2017-spr-proj
train
0
b13cbaa8cbf23031d36150bc90eb0dd2a2fa87bb
[ "dict.__init__(self, *args, **kwargs)\nself.__dict__ = self\nself.__depth__ = dict_depth(self.__dict__)\nself.__getstr__ = ['dict.get(self,key[0],None)']\nif self.__depth__ > 1:\n for d in range(2, self.__depth__ + 1):\n self.__getstr__.append(self.__getstr__[d - 2].replace('None', '{}') + '.get(key[' + s...
<|body_start_0|> dict.__init__(self, *args, **kwargs) self.__dict__ = self self.__depth__ = dict_depth(self.__dict__) self.__getstr__ = ['dict.get(self,key[0],None)'] if self.__depth__ > 1: for d in range(2, self.__depth__ + 1): self.__getstr__.append(...
Gets items from nested dictionaries. Parameters ---------- dict: python dictionary. - For simple dictionaries: ``smart_dict(dict)[key]`` - For nested dictionaries up to n levels 1. First level: can declare key as single element or in list e.g. ``smart_dict(dict)[[key]]``, ``smart_dict(dict)[key]`` 2. Successive levels:...
smart_dict
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class smart_dict: """Gets items from nested dictionaries. Parameters ---------- dict: python dictionary. - For simple dictionaries: ``smart_dict(dict)[key]`` - For nested dictionaries up to n levels 1. First level: can declare key as single element or in list e.g. ``smart_dict(dict)[[key]]``, ``smart_d...
stack_v2_sparse_classes_75kplus_train_066658
8,899
no_license
[ { "docstring": "NEEDS DOCUMENTING Parameters ---------- args kwargs", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "NEEDS DOCUMENTING Parameters ---------- self: key: Returns ------- val:", "name": "__getitem__", "signature": "def __getitem__(s...
2
stack_v2_sparse_classes_30k_train_024400
Implement the Python class `smart_dict` described below. Class description: Gets items from nested dictionaries. Parameters ---------- dict: python dictionary. - For simple dictionaries: ``smart_dict(dict)[key]`` - For nested dictionaries up to n levels 1. First level: can declare key as single element or in list e.g....
Implement the Python class `smart_dict` described below. Class description: Gets items from nested dictionaries. Parameters ---------- dict: python dictionary. - For simple dictionaries: ``smart_dict(dict)[key]`` - For nested dictionaries up to n levels 1. First level: can declare key as single element or in list e.g....
d4ef13e4933cba0d2c1dd70730f03c8575e2f7a1
<|skeleton|> class smart_dict: """Gets items from nested dictionaries. Parameters ---------- dict: python dictionary. - For simple dictionaries: ``smart_dict(dict)[key]`` - For nested dictionaries up to n levels 1. First level: can declare key as single element or in list e.g. ``smart_dict(dict)[[key]]``, ``smart_d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class smart_dict: """Gets items from nested dictionaries. Parameters ---------- dict: python dictionary. - For simple dictionaries: ``smart_dict(dict)[key]`` - For nested dictionaries up to n levels 1. First level: can declare key as single element or in list e.g. ``smart_dict(dict)[[key]]``, ``smart_dict(dict)[key...
the_stack_v2_python_sparse
cdm/lib/mappings/mappings_hdlr.py
glamod/cdm_mapper_documentation
train
0
85182c4a9c40d01d4891430db90c7d7ad716eb0e
[ "self.label = label\nself.weight = weight\nself._get_field_widget = get_field", "lbl = Label()\nlbl.text = self.label\nlbl.size_hint_x = self.weight\nreturn lbl", "w = self._get_field_widget(data)\nw.size_hint_x = self.weight\nw.size_hint_max_y = row_height\nreturn w" ]
<|body_start_0|> self.label = label self.weight = weight self._get_field_widget = get_field <|end_body_0|> <|body_start_1|> lbl = Label() lbl.text = self.label lbl.size_hint_x = self.weight return lbl <|end_body_1|> <|body_start_2|> w = self._get_field_w...
Represents a field modeled in a table
TableField
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TableField: """Represents a field modeled in a table""" def __init__(self, label: str, weight: float, get_field: Callable[[object], Widget]): """Initialise table field :param label: The name of the field :param weight: The width sizing percentage :param get_field: A method to create ...
stack_v2_sparse_classes_75kplus_train_066659
5,221
no_license
[ { "docstring": "Initialise table field :param label: The name of the field :param weight: The width sizing percentage :param get_field: A method to create the table cell widget", "name": "__init__", "signature": "def __init__(self, label: str, weight: float, get_field: Callable[[object], Widget])" }, ...
3
null
Implement the Python class `TableField` described below. Class description: Represents a field modeled in a table Method signatures and docstrings: - def __init__(self, label: str, weight: float, get_field: Callable[[object], Widget]): Initialise table field :param label: The name of the field :param weight: The widt...
Implement the Python class `TableField` described below. Class description: Represents a field modeled in a table Method signatures and docstrings: - def __init__(self, label: str, weight: float, get_field: Callable[[object], Widget]): Initialise table field :param label: The name of the field :param weight: The widt...
7be0791d8bc0ba30c984d6c99a1094c5267479e6
<|skeleton|> class TableField: """Represents a field modeled in a table""" def __init__(self, label: str, weight: float, get_field: Callable[[object], Widget]): """Initialise table field :param label: The name of the field :param weight: The width sizing percentage :param get_field: A method to create ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TableField: """Represents a field modeled in a table""" def __init__(self, label: str, weight: float, get_field: Callable[[object], Widget]): """Initialise table field :param label: The name of the field :param weight: The width sizing percentage :param get_field: A method to create the table cel...
the_stack_v2_python_sparse
widgets/table.py
eperegrine/ECM2429-StockManager
train
1
a4bd136857769352d181965d0072472887e8c4bd
[ "self.xinput = xinput\nself.var_scope = var_scope\nself.critic_layers = critic_layers\nself.clusters_no = clusters_no\nself.input_clusters = input_clusters\nself.reuse = reuse\nself.dist = dist", "with tf.variable_scope(var_scope, reuse=reuse):\n for i_lay, output_size in enumerate(critic_layers):\n wit...
<|body_start_0|> self.xinput = xinput self.var_scope = var_scope self.critic_layers = critic_layers self.clusters_no = clusters_no self.input_clusters = input_clusters self.reuse = reuse self.dist = dist <|end_body_0|> <|body_start_1|> with tf.variable_sc...
Generic class for the Critic network
Critic
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Critic: """Generic class for the Critic network""" def __init__(self, xinput, dist, var_scope, critic_layers, input_clusters=None, clusters_no=None, reuse=None): """Default constructor. Parameters ---------- xinput : Tensor Tensor containing the input cells. dist : Tensor Tensor cont...
stack_v2_sparse_classes_75kplus_train_066660
29,633
permissive
[ { "docstring": "Default constructor. Parameters ---------- xinput : Tensor Tensor containing the input cells. dist : Tensor Tensor containing the output of the Critic (e.g. the Wasserstein distance). var_scope : str Variable scope used for the created tensors. critic_layers : list List of integers corresponding...
4
stack_v2_sparse_classes_30k_train_000675
Implement the Python class `Critic` described below. Class description: Generic class for the Critic network Method signatures and docstrings: - def __init__(self, xinput, dist, var_scope, critic_layers, input_clusters=None, clusters_no=None, reuse=None): Default constructor. Parameters ---------- xinput : Tensor Ten...
Implement the Python class `Critic` described below. Class description: Generic class for the Critic network Method signatures and docstrings: - def __init__(self, xinput, dist, var_scope, critic_layers, input_clusters=None, clusters_no=None, reuse=None): Default constructor. Parameters ---------- xinput : Tensor Ten...
a06f8ccd6a071d57e591dacd6164c9f78987a794
<|skeleton|> class Critic: """Generic class for the Critic network""" def __init__(self, xinput, dist, var_scope, critic_layers, input_clusters=None, clusters_no=None, reuse=None): """Default constructor. Parameters ---------- xinput : Tensor Tensor containing the input cells. dist : Tensor Tensor cont...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Critic: """Generic class for the Critic network""" def __init__(self, xinput, dist, var_scope, critic_layers, input_clusters=None, clusters_no=None, reuse=None): """Default constructor. Parameters ---------- xinput : Tensor Tensor containing the input cells. dist : Tensor Tensor containing the ou...
the_stack_v2_python_sparse
estimators/utilities.py
imsb-uke/scGAN
train
73
fe92d06a52de1b051d244e5cb360594f948fe353
[ "url = self.ip + '/api/scm/auth/scm/scmPoD/detailList.do'\nparams = {'status': 'NotReceived', 'poCode': order_no}\nr = self.s.post(url=url, params=params)\nreturn r.json()", "url = self.ip + '/api/scm//auth/scm/scmPoD/receive.do'\nparams = {'status': 'Received', 'deliveryDay': get_future_date(7), 'ids': ids}\nr =...
<|body_start_0|> url = self.ip + '/api/scm/auth/scm/scmPoD/detailList.do' params = {'status': 'NotReceived', 'poCode': order_no} r = self.s.post(url=url, params=params) return r.json() <|end_body_0|> <|body_start_1|> url = self.ip + '/api/scm//auth/scm/scmPoD/receive.do' ...
B2BPurchaseOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class B2BPurchaseOrder: def purchase_order_search_by_no(self, order_no): """通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return:""" <|body_0|> def receive_purchase_order(self, ids): """供应商订单确认 :param ids: 明细id :return:""" <|body_1|> def return_purchase_order(self, ...
stack_v2_sparse_classes_75kplus_train_066661
2,159
no_license
[ { "docstring": "通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return:", "name": "purchase_order_search_by_no", "signature": "def purchase_order_search_by_no(self, order_no)" }, { "docstring": "供应商订单确认 :param ids: 明细id :return:", "name": "receive_purchase_order", "signature": "def receive_purch...
4
stack_v2_sparse_classes_30k_train_014046
Implement the Python class `B2BPurchaseOrder` described below. Class description: Implement the B2BPurchaseOrder class. Method signatures and docstrings: - def purchase_order_search_by_no(self, order_no): 通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return: - def receive_purchase_order(self, ids): 供应商订单确认 :param ids: 明细id...
Implement the Python class `B2BPurchaseOrder` described below. Class description: Implement the B2BPurchaseOrder class. Method signatures and docstrings: - def purchase_order_search_by_no(self, order_no): 通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return: - def receive_purchase_order(self, ids): 供应商订单确认 :param ids: 明细id...
26d2ae773a999fd8446e18f9c0719d46402b19aa
<|skeleton|> class B2BPurchaseOrder: def purchase_order_search_by_no(self, order_no): """通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return:""" <|body_0|> def receive_purchase_order(self, ids): """供应商订单确认 :param ids: 明细id :return:""" <|body_1|> def return_purchase_order(self, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class B2BPurchaseOrder: def purchase_order_search_by_no(self, order_no): """通过采购订单号查询采购订单明细 :param order_no: 采购订单号 :return:""" url = self.ip + '/api/scm/auth/scm/scmPoD/detailList.do' params = {'status': 'NotReceived', 'poCode': order_no} r = self.s.post(url=url, params=params) ...
the_stack_v2_python_sparse
api/B2B_purchase_order_api.py
Leofighting/dimi_api_test
train
0
09daefadd62d7cd18f007346ed627bd2468cc59c
[ "from ..misc import RelativePath\nsuper(CallProcess, self).__init__(maxtrials=maxtrials)\nself.functional = functional\n' Functional to execute. '\ntry:\n self.functional = self.functional\nexcept:\n pass\nself.outdir = RelativePath(outdir)\n' Execution directory of the folder. '\nself.outdir = RelativePath(o...
<|body_start_0|> from ..misc import RelativePath super(CallProcess, self).__init__(maxtrials=maxtrials) self.functional = functional ' Functional to execute. ' try: self.functional = self.functional except: pass self.outdir = RelativePath(o...
Calls functional in child python process. This process pickles_ a callable and its arguments and executes it in a child python process. .. _pickles: http://docs.python.org/library/pickle.html
CallProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CallProcess: """Calls functional in child python process. This process pickles_ a callable and its arguments and executes it in a child python process. .. _pickles: http://docs.python.org/library/pickle.html""" def __init__(self, functional, outdir, stdout=None, stderr=None, maxtrials=1, dom...
stack_v2_sparse_classes_75kplus_train_066662
5,576
no_license
[ { "docstring": "Initializes a process. :param functional: A python callable. It should also be pickle-able. :param str outdir: Path where the python child process should be executed. :param str stdout: Optional path to an output file where the callable's output shall be streamed. :param str stderr: Optional pat...
6
stack_v2_sparse_classes_30k_train_046385
Implement the Python class `CallProcess` described below. Class description: Calls functional in child python process. This process pickles_ a callable and its arguments and executes it in a child python process. .. _pickles: http://docs.python.org/library/pickle.html Method signatures and docstrings: - def __init__(...
Implement the Python class `CallProcess` described below. Class description: Calls functional in child python process. This process pickles_ a callable and its arguments and executes it in a child python process. .. _pickles: http://docs.python.org/library/pickle.html Method signatures and docstrings: - def __init__(...
9c0ab667f94dc4629404a8ec99cbeaa323f0c8b3
<|skeleton|> class CallProcess: """Calls functional in child python process. This process pickles_ a callable and its arguments and executes it in a child python process. .. _pickles: http://docs.python.org/library/pickle.html""" def __init__(self, functional, outdir, stdout=None, stderr=None, maxtrials=1, dom...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CallProcess: """Calls functional in child python process. This process pickles_ a callable and its arguments and executes it in a child python process. .. _pickles: http://docs.python.org/library/pickle.html""" def __init__(self, functional, outdir, stdout=None, stderr=None, maxtrials=1, dompi=False, **k...
the_stack_v2_python_sparse
process/call.py
Shibu778/LaDa
train
0
344ec2bed37c4f8b21332c7078f4da2649f2c825
[ "super(ConvGRU, self).__init__()\nself.input_size = input_size\nif type(hidden_sizes) != list:\n self.hidden_sizes = [hidden_sizes] * n_layers\nelse:\n assert len(hidden_sizes) == n_layers, '`hidden_sizes` must have the same length as n_layers'\n self.hidden_sizes = hidden_sizes\nif type(kernel_sizes) != l...
<|body_start_0|> super(ConvGRU, self).__init__() self.input_size = input_size if type(hidden_sizes) != list: self.hidden_sizes = [hidden_sizes] * n_layers else: assert len(hidden_sizes) == n_layers, '`hidden_sizes` must have the same length as n_layers' ...
ConvGRU
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvGRU: def __init__(self, input_size, hidden_sizes, kernel_sizes, n_layers): """Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_sizes : intege...
stack_v2_sparse_classes_75kplus_train_066663
4,783
permissive
[ { "docstring": "Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_sizes : integer or list. depth dimensions of hidden state. if integer, the same hidden size is used for ...
2
stack_v2_sparse_classes_30k_train_039105
Implement the Python class `ConvGRU` described below. Class description: Implement the ConvGRU class. Method signatures and docstrings: - def __init__(self, input_size, hidden_sizes, kernel_sizes, n_layers): Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Par...
Implement the Python class `ConvGRU` described below. Class description: Implement the ConvGRU class. Method signatures and docstrings: - def __init__(self, input_size, hidden_sizes, kernel_sizes, n_layers): Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Par...
3efa944031e65d4a9fc6dee27381e73e446bb16d
<|skeleton|> class ConvGRU: def __init__(self, input_size, hidden_sizes, kernel_sizes, n_layers): """Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_sizes : intege...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConvGRU: def __init__(self, input_size, hidden_sizes, kernel_sizes, n_layers): """Generates a multi-layer convolutional GRU. Preserves spatial dimensions across cells, only altering depth. Parameters ---------- input_size : integer. depth dimension of input tensors. hidden_sizes : integer or list. dep...
the_stack_v2_python_sparse
gen_models/convgru.py
KamyarGh/rl_swiss
train
61
b0c7a2a0e4d9995cd85ca72d42762fd98785276b
[ "tempDictionary = {}\ntempDictionary['date'] = datetime.datetime.utcnow()\ntempDictionary['state'] = 'Confirm'\ntempDictionary['material'] = raw_material\ntempDictionary['name'] = new_product\ntempDictionary['quantity'] = quantity\ntempDictionary['price'] = price\norder = list(sorted(self.manufacture_details.keys()...
<|body_start_0|> tempDictionary = {} tempDictionary['date'] = datetime.datetime.utcnow() tempDictionary['state'] = 'Confirm' tempDictionary['material'] = raw_material tempDictionary['name'] = new_product tempDictionary['quantity'] = quantity tempDictionary['price'...
It is used to manufacture products
Manufacture
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Manufacture: """It is used to manufacture products""" def create_manufacture_order(self, new_product, raw_material, quantity, price): """func :- Manufactures new product. params :- new product name - string params :- raw material name and quantity - dictionary params :- quantity - in...
stack_v2_sparse_classes_75kplus_train_066664
2,479
no_license
[ { "docstring": "func :- Manufactures new product. params :- new product name - string params :- raw material name and quantity - dictionary params :- quantity - integer returns :- Manufacture order number", "name": "create_manufacture_order", "signature": "def create_manufacture_order(self, new_product,...
3
stack_v2_sparse_classes_30k_train_043063
Implement the Python class `Manufacture` described below. Class description: It is used to manufacture products Method signatures and docstrings: - def create_manufacture_order(self, new_product, raw_material, quantity, price): func :- Manufactures new product. params :- new product name - string params :- raw materi...
Implement the Python class `Manufacture` described below. Class description: It is used to manufacture products Method signatures and docstrings: - def create_manufacture_order(self, new_product, raw_material, quantity, price): func :- Manufactures new product. params :- new product name - string params :- raw materi...
08668c834bdb4aee3abafdedc9126bba7aa041b8
<|skeleton|> class Manufacture: """It is used to manufacture products""" def create_manufacture_order(self, new_product, raw_material, quantity, price): """func :- Manufactures new product. params :- new product name - string params :- raw material name and quantity - dictionary params :- quantity - in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Manufacture: """It is used to manufacture products""" def create_manufacture_order(self, new_product, raw_material, quantity, price): """func :- Manufactures new product. params :- new product name - string params :- raw material name and quantity - dictionary params :- quantity - integer returns...
the_stack_v2_python_sparse
Test1/manufacture.py
maulikb-emipro/Python-Training
train
0
02b5fe596c17b30103bbad8534de74176de1dcb2
[ "idx_sorted = sorted(range(len(height)), key=lambda x: (height[x], -weight[x]))\nweight_sorted = [weight[idx] for idx in idx_sorted]\ndp = [0] * len(weight_sorted)\ndp[0] = 1\nmax_ans = 0\nfor i in range(1, len(weight_sorted)):\n max_val = 0\n for j in range(i):\n if weight_sorted[i] > weight_sorted[j]...
<|body_start_0|> idx_sorted = sorted(range(len(height)), key=lambda x: (height[x], -weight[x])) weight_sorted = [weight[idx] for idx in idx_sorted] dp = [0] * len(weight_sorted) dp[0] = 1 max_ans = 0 for i in range(1, len(weight_sorted)): max_val = 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def bestSeqAtIndex(self, height, weight): """input| height: List[int], weight: List[int] output| int""" <|body_0|> def bestSeqAtIndex_bisect(self, height, weight): """input| height: List[int], weight: List[int] output| int""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_066665
3,006
no_license
[ { "docstring": "input| height: List[int], weight: List[int] output| int", "name": "bestSeqAtIndex", "signature": "def bestSeqAtIndex(self, height, weight)" }, { "docstring": "input| height: List[int], weight: List[int] output| int", "name": "bestSeqAtIndex_bisect", "signature": "def best...
2
stack_v2_sparse_classes_30k_test_002533
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def bestSeqAtIndex(self, height, weight): input| height: List[int], weight: List[int] output| int - def bestSeqAtIndex_bisect(self, height, weight): input| height: List[int], wei...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def bestSeqAtIndex(self, height, weight): input| height: List[int], weight: List[int] output| int - def bestSeqAtIndex_bisect(self, height, weight): input| height: List[int], wei...
8290ad1c763d9f7c7f7bed63426b4769b34fd2fc
<|skeleton|> class Solution: def bestSeqAtIndex(self, height, weight): """input| height: List[int], weight: List[int] output| int""" <|body_0|> def bestSeqAtIndex_bisect(self, height, weight): """input| height: List[int], weight: List[int] output| int""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def bestSeqAtIndex(self, height, weight): """input| height: List[int], weight: List[int] output| int""" idx_sorted = sorted(range(len(height)), key=lambda x: (height[x], -weight[x])) weight_sorted = [weight[idx] for idx in idx_sorted] dp = [0] * len(weight_sorted) ...
the_stack_v2_python_sparse
sort_mian17_08_bestSeqAtIndex.py
screnary/Algorithm_python
train
0
3dd5fa027d9ced006a4c21257c1b9de26b552a9c
[ "self.queryFile = os.path.realpath(queryFile)\nself.resultsDir = os.path.realpath(resultsDir)\nself.evalue = 0.05\nif os.path.isdir(resultsDir) == False or len(os.listdir(resultsDir)) == 0:\n raise Exception('The results directory does not exist')", "print('...parsing', resultsFilePath)\nparser = ParseBlast(re...
<|body_start_0|> self.queryFile = os.path.realpath(queryFile) self.resultsDir = os.path.realpath(resultsDir) self.evalue = 0.05 if os.path.isdir(resultsDir) == False or len(os.listdir(resultsDir)) == 0: raise Exception('The results directory does not exist') <|end_body_0|> <...
ParseParallelBlast
[ "BSD-3-Clause", "LicenseRef-scancode-public-domain", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParseParallelBlast: def __init__(self, queryFile, resultsDir=os.path.join('.', 'cluster')): """Constructor queryFile - is a fasta file of sequences resultsDir - is a directory that is purged and filled""" <|body_0|> def parse_file(self, resultsFilePath): """use Parse...
stack_v2_sparse_classes_75kplus_train_066666
3,238
permissive
[ { "docstring": "Constructor queryFile - is a fasta file of sequences resultsDir - is a directory that is purged and filled", "name": "__init__", "signature": "def __init__(self, queryFile, resultsDir=os.path.join('.', 'cluster'))" }, { "docstring": "use ParseBlast to parse a given xml formatted ...
3
null
Implement the Python class `ParseParallelBlast` described below. Class description: Implement the ParseParallelBlast class. Method signatures and docstrings: - def __init__(self, queryFile, resultsDir=os.path.join('.', 'cluster')): Constructor queryFile - is a fasta file of sequences resultsDir - is a directory that ...
Implement the Python class `ParseParallelBlast` described below. Class description: Implement the ParseParallelBlast class. Method signatures and docstrings: - def __init__(self, queryFile, resultsDir=os.path.join('.', 'cluster')): Constructor queryFile - is a fasta file of sequences resultsDir - is a directory that ...
a343aff9b833979b4f5d4ba6d16fc2b65d8ccfc1
<|skeleton|> class ParseParallelBlast: def __init__(self, queryFile, resultsDir=os.path.join('.', 'cluster')): """Constructor queryFile - is a fasta file of sequences resultsDir - is a directory that is purged and filled""" <|body_0|> def parse_file(self, resultsFilePath): """use Parse...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ParseParallelBlast: def __init__(self, queryFile, resultsDir=os.path.join('.', 'cluster')): """Constructor queryFile - is a fasta file of sequences resultsDir - is a directory that is purged and filled""" self.queryFile = os.path.realpath(queryFile) self.resultsDir = os.path.realpath(r...
the_stack_v2_python_sparse
htsint/blast/ParseParallelBlast.py
changanla/htsint
train
0
00c14cb5bd0632b595243826eff880a6fc1add65
[ "self.pump = Pump('127.0.0.1', 8000)\nself.decider = Decider(100, 0.05)\nself.sensor = Sensor('127.0.0.1', '8001')\nself.controller = Controller(self.sensor, self.pump, self.decider)\nself.actions = self.controller.actions", "self.assertEqual(self.decider.decide(90, self.actions['PUMP_OFF'], self.actions), self.a...
<|body_start_0|> self.pump = Pump('127.0.0.1', 8000) self.decider = Decider(100, 0.05) self.sensor = Sensor('127.0.0.1', '8001') self.controller = Controller(self.sensor, self.pump, self.decider) self.actions = self.controller.actions <|end_body_0|> <|body_start_1|> self...
Unit tests for the Decider class
DeciderTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeciderTests: """Unit tests for the Decider class""" def setUp(self): """setup""" <|body_0|> def test_decider(self): """Decider tests""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.pump = Pump('127.0.0.1', 8000) self.decider = Deci...
stack_v2_sparse_classes_75kplus_train_066667
3,712
no_license
[ { "docstring": "setup", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Decider tests", "name": "test_decider", "signature": "def test_decider(self)" } ]
2
stack_v2_sparse_classes_30k_train_046628
Implement the Python class `DeciderTests` described below. Class description: Unit tests for the Decider class Method signatures and docstrings: - def setUp(self): setup - def test_decider(self): Decider tests
Implement the Python class `DeciderTests` described below. Class description: Unit tests for the Decider class Method signatures and docstrings: - def setUp(self): setup - def test_decider(self): Decider tests <|skeleton|> class DeciderTests: """Unit tests for the Decider class""" def setUp(self): "...
263685ca90110609bfd05d621516727f8cd0028f
<|skeleton|> class DeciderTests: """Unit tests for the Decider class""" def setUp(self): """setup""" <|body_0|> def test_decider(self): """Decider tests""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DeciderTests: """Unit tests for the Decider class""" def setUp(self): """setup""" self.pump = Pump('127.0.0.1', 8000) self.decider = Decider(100, 0.05) self.sensor = Sensor('127.0.0.1', '8001') self.controller = Controller(self.sensor, self.pump, self.decider) ...
the_stack_v2_python_sparse
students/msirisha/lesson06/water-regulation/waterregulation/tests.py
aurel1212/Sp2018-Online
train
0
b9cc01d7479efafc02f59f278ea99e283ab9ad3d
[ "super(PublicAPIv3, self).__init__(**connkw)\nself.pairs = pairs\nif not self.pairs:\n self.pairs = self.call('info')['pairs'].items()\nif not isinstance(self.pairs, str):\n self.pairs = '-'.join(self.pairs)", "if method == 'info':\n url = '/api/3/{}'.format(method)\nelse:\n url = '/api/3/{}/{}'.forma...
<|body_start_0|> super(PublicAPIv3, self).__init__(**connkw) self.pairs = pairs if not self.pairs: self.pairs = self.call('info')['pairs'].items() if not isinstance(self.pairs, str): self.pairs = '-'.join(self.pairs) <|end_body_0|> <|body_start_1|> if met...
BTC-E Public API v3 <https://btc-e.com/api/3/docs>.
PublicAPIv3
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PublicAPIv3: """BTC-E Public API v3 <https://btc-e.com/api/3/docs>.""" def __init__(self, *pairs, **connkw): """Initialization of the BTC-E Public API v3. @param *pairs: [btc_usd[-btc_rur[-...]]] or arguments @param **connkw: ... (see: 'BTCEConnection' class)""" <|body_0|> ...
stack_v2_sparse_classes_75kplus_train_066668
12,827
permissive
[ { "docstring": "Initialization of the BTC-E Public API v3. @param *pairs: [btc_usd[-btc_rur[-...]]] or arguments @param **connkw: ... (see: 'BTCEConnection' class)", "name": "__init__", "signature": "def __init__(self, *pairs, **connkw)" }, { "docstring": "Create query to the BTC-E Public API v3...
2
stack_v2_sparse_classes_30k_train_007536
Implement the Python class `PublicAPIv3` described below. Class description: BTC-E Public API v3 <https://btc-e.com/api/3/docs>. Method signatures and docstrings: - def __init__(self, *pairs, **connkw): Initialization of the BTC-E Public API v3. @param *pairs: [btc_usd[-btc_rur[-...]]] or arguments @param **connkw: ....
Implement the Python class `PublicAPIv3` described below. Class description: BTC-E Public API v3 <https://btc-e.com/api/3/docs>. Method signatures and docstrings: - def __init__(self, *pairs, **connkw): Initialization of the BTC-E Public API v3. @param *pairs: [btc_usd[-btc_rur[-...]]] or arguments @param **connkw: ....
b4910e26abe849b42ab932af805d01ee435320fa
<|skeleton|> class PublicAPIv3: """BTC-E Public API v3 <https://btc-e.com/api/3/docs>.""" def __init__(self, *pairs, **connkw): """Initialization of the BTC-E Public API v3. @param *pairs: [btc_usd[-btc_rur[-...]]] or arguments @param **connkw: ... (see: 'BTCEConnection' class)""" <|body_0|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PublicAPIv3: """BTC-E Public API v3 <https://btc-e.com/api/3/docs>.""" def __init__(self, *pairs, **connkw): """Initialization of the BTC-E Public API v3. @param *pairs: [btc_usd[-btc_rur[-...]]] or arguments @param **connkw: ... (see: 'BTCEConnection' class)""" super(PublicAPIv3, self)._...
the_stack_v2_python_sparse
server/btcelib.py
ErDmKo/trade-bot
train
1
8540a210be87afc9bdffa6fc858fdf078ac941c5
[ "if img.ndim == 5:\n img = img.view(-1, *img.shape[2:])\n gt_label = gt_label.view(-1)\nx = self.extract_feat(img)\nhead_outputs = self.head.forward_train(x[0])\nlosses = dict()\nreid_loss = self.head.loss(gt_label, *head_outputs)\nlosses.update(reid_loss)\nreturn losses", "if img.nelement() > 0:\n x = s...
<|body_start_0|> if img.ndim == 5: img = img.view(-1, *img.shape[2:]) gt_label = gt_label.view(-1) x = self.extract_feat(img) head_outputs = self.head.forward_train(x[0]) losses = dict() reid_loss = self.head.loss(gt_label, *head_outputs) losses.up...
Base class for re-identification.
BaseReID
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseReID: """Base class for re-identification.""" def forward_train(self, img, gt_label, **kwargs): """"Training forward function.""" <|body_0|> def simple_test(self, img, **kwargs): """Test without augmentation.""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_75kplus_train_066669
1,292
permissive
[ { "docstring": "\"Training forward function.", "name": "forward_train", "signature": "def forward_train(self, img, gt_label, **kwargs)" }, { "docstring": "Test without augmentation.", "name": "simple_test", "signature": "def simple_test(self, img, **kwargs)" } ]
2
null
Implement the Python class `BaseReID` described below. Class description: Base class for re-identification. Method signatures and docstrings: - def forward_train(self, img, gt_label, **kwargs): "Training forward function. - def simple_test(self, img, **kwargs): Test without augmentation.
Implement the Python class `BaseReID` described below. Class description: Base class for re-identification. Method signatures and docstrings: - def forward_train(self, img, gt_label, **kwargs): "Training forward function. - def simple_test(self, img, **kwargs): Test without augmentation. <|skeleton|> class BaseReID:...
e79491ec8f0b8c86fda947fbaaa824c66ab2a991
<|skeleton|> class BaseReID: """Base class for re-identification.""" def forward_train(self, img, gt_label, **kwargs): """"Training forward function.""" <|body_0|> def simple_test(self, img, **kwargs): """Test without augmentation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BaseReID: """Base class for re-identification.""" def forward_train(self, img, gt_label, **kwargs): """"Training forward function.""" if img.ndim == 5: img = img.view(-1, *img.shape[2:]) gt_label = gt_label.view(-1) x = self.extract_feat(img) head_o...
the_stack_v2_python_sparse
mmtrack/models/reid/base_reid.py
open-mmlab/mmtracking
train
3,263
67347296046b45bd31aeaef3c0ca45b1f6fb8ec3
[ "self.model = model\nself.beta = beta\nself.S0 = S0\nself.iso = iso", "odf_matrix = self.model.cache_get('odf_matrix', key=sphere)\nif odf_matrix is None:\n odf_matrix = sfm_design_matrix(sphere, self.model.sphere, self.model.response, mode='odf')\n self.model.cache_set('odf_matrix', key=sphere, value=odf_m...
<|body_start_0|> self.model = model self.beta = beta self.S0 = S0 self.iso = iso <|end_body_0|> <|body_start_1|> odf_matrix = self.model.cache_get('odf_matrix', key=sphere) if odf_matrix is None: odf_matrix = sfm_design_matrix(sphere, self.model.sphere, self....
SparseFascicleFit
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseFascicleFit: def __init__(self, model, beta, S0, iso): """Initalize a SparseFascicleFit class instance Parameters ---------- model : a SparseFascicleModel object. beta : ndarray The parameters of fit to data. S0 : ndarray The mean non-diffusion-weighted signal. iso : IsotropicFit c...
stack_v2_sparse_classes_75kplus_train_066670
20,499
permissive
[ { "docstring": "Initalize a SparseFascicleFit class instance Parameters ---------- model : a SparseFascicleModel object. beta : ndarray The parameters of fit to data. S0 : ndarray The mean non-diffusion-weighted signal. iso : IsotropicFit class instance A representation of the isotropic signal, together with pa...
3
stack_v2_sparse_classes_30k_test_002887
Implement the Python class `SparseFascicleFit` described below. Class description: Implement the SparseFascicleFit class. Method signatures and docstrings: - def __init__(self, model, beta, S0, iso): Initalize a SparseFascicleFit class instance Parameters ---------- model : a SparseFascicleModel object. beta : ndarra...
Implement the Python class `SparseFascicleFit` described below. Class description: Implement the SparseFascicleFit class. Method signatures and docstrings: - def __init__(self, model, beta, S0, iso): Initalize a SparseFascicleFit class instance Parameters ---------- model : a SparseFascicleModel object. beta : ndarra...
3c3acc55de8ba741e673063378e6cbaf10b64c7a
<|skeleton|> class SparseFascicleFit: def __init__(self, model, beta, S0, iso): """Initalize a SparseFascicleFit class instance Parameters ---------- model : a SparseFascicleModel object. beta : ndarray The parameters of fit to data. S0 : ndarray The mean non-diffusion-weighted signal. iso : IsotropicFit c...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SparseFascicleFit: def __init__(self, model, beta, S0, iso): """Initalize a SparseFascicleFit class instance Parameters ---------- model : a SparseFascicleModel object. beta : ndarray The parameters of fit to data. S0 : ndarray The mean non-diffusion-weighted signal. iso : IsotropicFit class instance ...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/dipy/reconst/sfm.py
Raniac/NEURO-LEARN
train
9
53bb256c7a103a37a3425c7143ff2715d3936639
[ "content_type = ContentType.objects.get_for_model(model_admin.model)\ntags = TaggedItem.objects.filter(content_type=content_type).values('tag__name').distinct().order_by('tag__name')\ntags_list = []\nfor tag in tags:\n tags_list.append((tag['tag__name'], tag['tag__name']))\nreturn tuple(tags_list)", "if self.v...
<|body_start_0|> content_type = ContentType.objects.get_for_model(model_admin.model) tags = TaggedItem.objects.filter(content_type=content_type).values('tag__name').distinct().order_by('tag__name') tags_list = [] for tag in tags: tags_list.append((tag['tag__name'], tag['tag__...
TagsFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagsFilter: def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.""" ...
stack_v2_sparse_classes_75kplus_train_066671
9,844
no_license
[ { "docstring": "Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.", "name": "lookups", "signature": "def lookups(self, request,...
2
stack_v2_sparse_classes_30k_train_004643
Implement the Python class `TagsFilter` described below. Class description: Implement the TagsFilter class. Method signatures and docstrings: - def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The se...
Implement the Python class `TagsFilter` described below. Class description: Implement the TagsFilter class. Method signatures and docstrings: - def lookups(self, request, model_admin): Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The se...
f2ac4ecc076b223c262f2cde4fa3b35b4a5cd54e
<|skeleton|> class TagsFilter: def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TagsFilter: def lookups(self, request, model_admin): """Returns a list of tuples. The first element in each tuple is the coded value for the option that will appear in the URL query. The second element is the human-readable name for the option that will appear in the right sidebar.""" content_...
the_stack_v2_python_sparse
tendenci/apps/perms/admin.py
chendong0444/ams
train
0
9200670f5aa145cdfc3e09ac977d446ec918501e
[ "if CustomerLogic.is_customer(request) and request.method == 'GET':\n return True\nif obj.stylist == request.user:\n return True\nelse:\n return False", "if CustomerLogic.is_customer(request) and request.method != 'GET':\n return False\nif request.user.is_anonymous:\n return False\nelse:\n retur...
<|body_start_0|> if CustomerLogic.is_customer(request) and request.method == 'GET': return True if obj.stylist == request.user: return True else: return False <|end_body_0|> <|body_start_1|> if CustomerLogic.is_customer(request) and request.method != ...
Permission for Haircut View - checks for the owner of the haircut.
IsOwnerOfHaircut
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsOwnerOfHaircut: """Permission for Haircut View - checks for the owner of the haircut.""" def has_object_permission(self, request, view, obj): """Returns True if the Stylist is the owner of the haircut. Or if the method is GET and the user is a customer.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus_train_066672
4,431
no_license
[ { "docstring": "Returns True if the Stylist is the owner of the haircut. Or if the method is GET and the user is a customer.", "name": "has_object_permission", "signature": "def has_object_permission(self, request, view, obj)" }, { "docstring": "Returns True if the user is not anonymous.", "...
2
null
Implement the Python class `IsOwnerOfHaircut` described below. Class description: Permission for Haircut View - checks for the owner of the haircut. Method signatures and docstrings: - def has_object_permission(self, request, view, obj): Returns True if the Stylist is the owner of the haircut. Or if the method is GET...
Implement the Python class `IsOwnerOfHaircut` described below. Class description: Permission for Haircut View - checks for the owner of the haircut. Method signatures and docstrings: - def has_object_permission(self, request, view, obj): Returns True if the Stylist is the owner of the haircut. Or if the method is GET...
a3d5f0b83afa1b66ad3c3d7665088c88f6f7eb9d
<|skeleton|> class IsOwnerOfHaircut: """Permission for Haircut View - checks for the owner of the haircut.""" def has_object_permission(self, request, view, obj): """Returns True if the Stylist is the owner of the haircut. Or if the method is GET and the user is a customer.""" <|body_0|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IsOwnerOfHaircut: """Permission for Haircut View - checks for the owner of the haircut.""" def has_object_permission(self, request, view, obj): """Returns True if the Stylist is the owner of the haircut. Or if the method is GET and the user is a customer.""" if CustomerLogic.is_customer(r...
the_stack_v2_python_sparse
api/permissions.py
eric85254/Clippr
train
1
1d5f1f9def0a3fd4e2a88bb517d31e4cd5c6e885
[ "dt = self.timestep\nif agent.isCar:\n lon_controller = PIDLongitudinalController(K_P=0.5, K_D=0.1, K_I=0.7, dt=dt)\n lat_controller = PIDLateralController(K_P=0.2, K_D=0.1, K_I=0.0, dt=dt)\nelse:\n lon_controller = PIDLongitudinalController(K_P=0.25, K_D=0.025, K_I=0.0, dt=dt)\n lat_controller = PIDLat...
<|body_start_0|> dt = self.timestep if agent.isCar: lon_controller = PIDLongitudinalController(K_P=0.5, K_D=0.1, K_I=0.7, dt=dt) lat_controller = PIDLateralController(K_P=0.2, K_D=0.1, K_I=0.0, dt=dt) else: lon_controller = PIDLongitudinalController(K_P=0.25, ...
A `Simulation` with a simulator supporting the driving domain. This subclass of `Simulation` provides no special behavior by itself; it just provides convenience methods for creating controllers to be used by `FollowLaneBehavior` and related behaviors, so that the parameters of these controllers can be customized for d...
DrivingSimulation
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DrivingSimulation: """A `Simulation` with a simulator supporting the driving domain. This subclass of `Simulation` provides no special behavior by itself; it just provides convenience methods for creating controllers to be used by `FollowLaneBehavior` and related behaviors, so that the parameters...
stack_v2_sparse_classes_75kplus_train_066673
3,017
permissive
[ { "docstring": "Get longitudinal and lateral controllers for lane following. The default controllers are simple PID controllers with parameters that work reasonably well for cars in simulators with realistic physics. See the classes `PIDLongitudinalController` and `PIDLateralController` for details, and `Newton...
3
stack_v2_sparse_classes_30k_train_028503
Implement the Python class `DrivingSimulation` described below. Class description: A `Simulation` with a simulator supporting the driving domain. This subclass of `Simulation` provides no special behavior by itself; it just provides convenience methods for creating controllers to be used by `FollowLaneBehavior` and re...
Implement the Python class `DrivingSimulation` described below. Class description: A `Simulation` with a simulator supporting the driving domain. This subclass of `Simulation` provides no special behavior by itself; it just provides convenience methods for creating controllers to be used by `FollowLaneBehavior` and re...
b397042601218ee77c82e3e835fa26820184245e
<|skeleton|> class DrivingSimulation: """A `Simulation` with a simulator supporting the driving domain. This subclass of `Simulation` provides no special behavior by itself; it just provides convenience methods for creating controllers to be used by `FollowLaneBehavior` and related behaviors, so that the parameters...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DrivingSimulation: """A `Simulation` with a simulator supporting the driving domain. This subclass of `Simulation` provides no special behavior by itself; it just provides convenience methods for creating controllers to be used by `FollowLaneBehavior` and related behaviors, so that the parameters of these con...
the_stack_v2_python_sparse
src/scenic/domains/driving/simulators.py
BerkeleyLearnVerify/Scenic
train
207
69d86528506dcd6bd4ba6c8b111bf7c5bcc68e39
[ "self.criteria = got3.manager.TweetCriteria()\nself.manager = got3.manager.TweetManager()\nself.helper = Utility.Helper(rootPath)", "if username:\n criteria = self.criteria.setUsername(username)\nelse:\n criteria = self.criteria.setQuerySearch(query).setSince(start).setUntil(end).setMaxTweets(maxTweets)\nre...
<|body_start_0|> self.criteria = got3.manager.TweetCriteria() self.manager = got3.manager.TweetManager() self.helper = Utility.Helper(rootPath) <|end_body_0|> <|body_start_1|> if username: criteria = self.criteria.setUsername(username) else: criteria = se...
Use GetOldTweets-python to crawl the Twitter data.
GetTwitterData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetTwitterData: """Use GetOldTweets-python to crawl the Twitter data.""" def __init__(self, rootPath): """Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manager object for got module helper (object): the helper objec...
stack_v2_sparse_classes_75kplus_train_066674
2,216
no_license
[ { "docstring": "Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manager object for got module helper (object): the helper object for Utility.Helper module", "name": "__init__", "signature": "def __init__(self, rootPath)" }, { "do...
3
stack_v2_sparse_classes_30k_train_051592
Implement the Python class `GetTwitterData` described below. Class description: Use GetOldTweets-python to crawl the Twitter data. Method signatures and docstrings: - def __init__(self, rootPath): Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manage...
Implement the Python class `GetTwitterData` described below. Class description: Use GetOldTweets-python to crawl the Twitter data. Method signatures and docstrings: - def __init__(self, rootPath): Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manage...
e2cdf786fd11f0fc3dbd393cad02383d3a206bf7
<|skeleton|> class GetTwitterData: """Use GetOldTweets-python to crawl the Twitter data.""" def __init__(self, rootPath): """Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manager object for got module helper (object): the helper objec...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GetTwitterData: """Use GetOldTweets-python to crawl the Twitter data.""" def __init__(self, rootPath): """Initialize the Parameters. Parameters: criteria (object): the criteria object for got module manager (object): the manager object for got module helper (object): the helper object for Utility...
the_stack_v2_python_sparse
Twitter/GetTwitterData.py
sxhmilyoyo/Rudetect34
train
0
4ce2032791c170146566e578e657e4795bf4e126
[ "if id is not None:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects", "if list_dictionaries is None or list_dictionaries == {}:\n return '[]'\nelse:\n return json.dumps(list_dictionaries)", "file = cls.__name__ + '.json'\nwith open(file, 'w') as ofile:\n if list_ob...
<|body_start_0|> if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects <|end_body_0|> <|body_start_1|> if list_dictionaries is None or list_dictionaries == {}: return '[]' else: return json.du...
Base class for other classes in project
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """Base class for other classes in project""" def __init__(self, id=None): """Initializer for Base class""" <|body_0|> def to_json_string(list_dictionaries): """Method that returns JSON string representation of dictionary""" <|body_1|> def save...
stack_v2_sparse_classes_75kplus_train_066675
1,920
no_license
[ { "docstring": "Initializer for Base class", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "Method that returns JSON string representation of dictionary", "name": "to_json_string", "signature": "def to_json_string(list_dictionaries)" }, { "docst...
6
stack_v2_sparse_classes_30k_train_000292
Implement the Python class `Base` described below. Class description: Base class for other classes in project Method signatures and docstrings: - def __init__(self, id=None): Initializer for Base class - def to_json_string(list_dictionaries): Method that returns JSON string representation of dictionary - def save_to_...
Implement the Python class `Base` described below. Class description: Base class for other classes in project Method signatures and docstrings: - def __init__(self, id=None): Initializer for Base class - def to_json_string(list_dictionaries): Method that returns JSON string representation of dictionary - def save_to_...
10b97c5a938747bbb3df10fd057863c7889415db
<|skeleton|> class Base: """Base class for other classes in project""" def __init__(self, id=None): """Initializer for Base class""" <|body_0|> def to_json_string(list_dictionaries): """Method that returns JSON string representation of dictionary""" <|body_1|> def save...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Base: """Base class for other classes in project""" def __init__(self, id=None): """Initializer for Base class""" if id is not None: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects def to_json_string(list_dictionaries)...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
ranicholson/holbertonschool-higher_level_programming
train
0
decfd7ec78ab4e5082a1b1d29fa2585ce8da4bb1
[ "domain = domains.FixedLengthDiscreteDomain(vocab=domains.Vocabulary(tokens=range(3), include_bos=True), length=2)\ntrain_data = np.array([[0, 1], [1, 0]])\ntrain_ds = tf.data.Dataset.from_tensor_slices((train_data,))\neb = evaluation.EmpiricalBaseline(domain, train_ds, alpha=0)\nself.assertAllEqual(eb._empirical_d...
<|body_start_0|> domain = domains.FixedLengthDiscreteDomain(vocab=domains.Vocabulary(tokens=range(3), include_bos=True), length=2) train_data = np.array([[0, 1], [1, 0]]) train_ds = tf.data.Dataset.from_tensor_slices((train_data,)) eb = evaluation.EmpiricalBaseline(domain, train_ds, alph...
EvaluationTest
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EvaluationTest: def test_empirical_baseline_construction(self): """Tests that EmpiricalBaseline construction is correct.""" <|body_0|> def test_empirical_baseline_evaluation(self): """Tests that EmpiricalBaseline evaluation is correct.""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus_train_066676
2,681
permissive
[ { "docstring": "Tests that EmpiricalBaseline construction is correct.", "name": "test_empirical_baseline_construction", "signature": "def test_empirical_baseline_construction(self)" }, { "docstring": "Tests that EmpiricalBaseline evaluation is correct.", "name": "test_empirical_baseline_eval...
3
stack_v2_sparse_classes_30k_train_027926
Implement the Python class `EvaluationTest` described below. Class description: Implement the EvaluationTest class. Method signatures and docstrings: - def test_empirical_baseline_construction(self): Tests that EmpiricalBaseline construction is correct. - def test_empirical_baseline_evaluation(self): Tests that Empir...
Implement the Python class `EvaluationTest` described below. Class description: Implement the EvaluationTest class. Method signatures and docstrings: - def test_empirical_baseline_construction(self): Tests that EmpiricalBaseline construction is correct. - def test_empirical_baseline_evaluation(self): Tests that Empir...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class EvaluationTest: def test_empirical_baseline_construction(self): """Tests that EmpiricalBaseline construction is correct.""" <|body_0|> def test_empirical_baseline_evaluation(self): """Tests that EmpiricalBaseline evaluation is correct.""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EvaluationTest: def test_empirical_baseline_construction(self): """Tests that EmpiricalBaseline construction is correct.""" domain = domains.FixedLengthDiscreteDomain(vocab=domains.Vocabulary(tokens=range(3), include_bos=True), length=2) train_data = np.array([[0, 1], [1, 0]]) ...
the_stack_v2_python_sparse
protein_lm/evaluation_test.py
Jimmy-INL/google-research
train
1
653e5f4e373186ad630615eb450ef9685c6732e5
[ "left = 0\nright = len(nums) - 1\nwhile left <= right:\n if nums[left] + nums[right] > target:\n right -= 1\n elif nums[left] + nums[right] < target:\n left += 1\n elif nums[left] + nums[right] == target:\n return [nums[left], nums[right]]\nreturn []", "num_tar = {target - i for i in...
<|body_start_0|> left = 0 right = len(nums) - 1 while left <= right: if nums[left] + nums[right] > target: right -= 1 elif nums[left] + nums[right] < target: left += 1 elif nums[left] + nums[right] == target: ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target: int): """双指针方法,利用有序特性,分别从前后扫描""" <|body_0|> def twoSum_hash(self, nums, target: int): """利用哈希表复杂度O(n)空间复杂度O(n)""" <|body_1|> def twoSum_bin(self, nums, target: int): """二分查找解法,复杂度O(nlogn)会超时""" <|b...
stack_v2_sparse_classes_75kplus_train_066677
2,505
no_license
[ { "docstring": "双指针方法,利用有序特性,分别从前后扫描", "name": "twoSum", "signature": "def twoSum(self, nums, target: int)" }, { "docstring": "利用哈希表复杂度O(n)空间复杂度O(n)", "name": "twoSum_hash", "signature": "def twoSum_hash(self, nums, target: int)" }, { "docstring": "二分查找解法,复杂度O(nlogn)会超时", "na...
4
stack_v2_sparse_classes_30k_train_034701
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target: int): 双指针方法,利用有序特性,分别从前后扫描 - def twoSum_hash(self, nums, target: int): 利用哈希表复杂度O(n)空间复杂度O(n) - def twoSum_bin(self, nums, target: int): 二分查找解法,复杂度O...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target: int): 双指针方法,利用有序特性,分别从前后扫描 - def twoSum_hash(self, nums, target: int): 利用哈希表复杂度O(n)空间复杂度O(n) - def twoSum_bin(self, nums, target: int): 二分查找解法,复杂度O...
c9eed637887753eb28d78cf252ea3763231e23a2
<|skeleton|> class Solution: def twoSum(self, nums, target: int): """双指针方法,利用有序特性,分别从前后扫描""" <|body_0|> def twoSum_hash(self, nums, target: int): """利用哈希表复杂度O(n)空间复杂度O(n)""" <|body_1|> def twoSum_bin(self, nums, target: int): """二分查找解法,复杂度O(nlogn)会超时""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum(self, nums, target: int): """双指针方法,利用有序特性,分别从前后扫描""" left = 0 right = len(nums) - 1 while left <= right: if nums[left] + nums[right] > target: right -= 1 elif nums[left] + nums[right] < target: left +=...
the_stack_v2_python_sparse
CODE/剑指 Offer 57. 和为s的两个数字.py
moshlwx/leetcode
train
5
a28dc7f61ec7a6be90ac4aaacef76a6046b7000a
[ "super(EncoderRNN, self).__init__()\nself.hidden_size = hidden_size\nself.input_size = input_size\nself.num_directions = 1\nif bidirectional:\n self.num_directions = 2\nself.num_layers = n_layers\nself.batch_size = batch_size\nself.embedding = backend.nn.Embedding(input_size, hidden_size, padding_idx=padding_ind...
<|body_start_0|> super(EncoderRNN, self).__init__() self.hidden_size = hidden_size self.input_size = input_size self.num_directions = 1 if bidirectional: self.num_directions = 2 self.num_layers = n_layers self.batch_size = batch_size self.embed...
EncoderRNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderRNN: def __init__(self, input_size: int, hidden_size: int, bidirectional: bool, n_layers: int=1, batch_size: int=1, padding_index=-1): """:param input_size: the input size of the encoder which is expected to be the size of the source vocabulary :param hidden_size: the output size ...
stack_v2_sparse_classes_75kplus_train_066678
2,681
permissive
[ { "docstring": ":param input_size: the input size of the encoder which is expected to be the size of the source vocabulary :param hidden_size: the output size of the encoder hidden layer which is used as input in the decoder :param bidirectional: a flag indicating whether the encoder has been operating bidirect...
3
stack_v2_sparse_classes_30k_train_038475
Implement the Python class `EncoderRNN` described below. Class description: Implement the EncoderRNN class. Method signatures and docstrings: - def __init__(self, input_size: int, hidden_size: int, bidirectional: bool, n_layers: int=1, batch_size: int=1, padding_index=-1): :param input_size: the input size of the enc...
Implement the Python class `EncoderRNN` described below. Class description: Implement the EncoderRNN class. Method signatures and docstrings: - def __init__(self, input_size: int, hidden_size: int, bidirectional: bool, n_layers: int=1, batch_size: int=1, padding_index=-1): :param input_size: the input size of the enc...
0f61fac7a8decccd30c622b2080961ed7fec733f
<|skeleton|> class EncoderRNN: def __init__(self, input_size: int, hidden_size: int, bidirectional: bool, n_layers: int=1, batch_size: int=1, padding_index=-1): """:param input_size: the input size of the encoder which is expected to be the size of the source vocabulary :param hidden_size: the output size ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EncoderRNN: def __init__(self, input_size: int, hidden_size: int, bidirectional: bool, n_layers: int=1, batch_size: int=1, padding_index=-1): """:param input_size: the input size of the encoder which is expected to be the size of the source vocabulary :param hidden_size: the output size of the encoder...
the_stack_v2_python_sparse
src/translate/learning/modules/rnn/encoder.py
py4/SFUTranslate
train
0
292cc44589b94002f3d30c5cbac43bd23454bdfe
[ "N = len(points)\nans = float('-inf')\nq = deque()\nfor xj, yj in points:\n while q and xj - q[0][1] > k:\n q.popleft()\n if q:\n ans = max(ans, q[0][0] + yj + xj)\n while q and q[-1][0] < yj - xj:\n q.pop()\n q.append((yj - xj, xj))\nreturn ans", "ans = float('-inf')\nN = len(poi...
<|body_start_0|> N = len(points) ans = float('-inf') q = deque() for xj, yj in points: while q and xj - q[0][1] > k: q.popleft() if q: ans = max(ans, q[0][0] + yj + xj) while q and q[-1][0] < yj - xj: q.p...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxValueOfEquation(self, points: List[List[int]], k: int) -> int: """yi + yj + |xi - xj| = (yi - xi) + (yj + xj) stack를 쓰면서 yi - xi 값을 작아지는 값만 저장해나아가고, 큰값은 이전값들을 덮어버림. 비교는 맨앞에 값과만 비교함. # O(N) / O(N) REMIND: Trapping rain water 방법을 쓰는 문제.""" <|body_0|> def f...
stack_v2_sparse_classes_75kplus_train_066679
1,404
no_license
[ { "docstring": "yi + yj + |xi - xj| = (yi - xi) + (yj + xj) stack를 쓰면서 yi - xi 값을 작아지는 값만 저장해나아가고, 큰값은 이전값들을 덮어버림. 비교는 맨앞에 값과만 비교함. # O(N) / O(N) REMIND: Trapping rain water 방법을 쓰는 문제.", "name": "findMaxValueOfEquation", "signature": "def findMaxValueOfEquation(self, points: List[List[int]], k: int) -> ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxValueOfEquation(self, points: List[List[int]], k: int) -> int: yi + yj + |xi - xj| = (yi - xi) + (yj + xj) stack를 쓰면서 yi - xi 값을 작아지는 값만 저장해나아가고, 큰값은 이전값들을 덮어버림. 비교는 맨...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxValueOfEquation(self, points: List[List[int]], k: int) -> int: yi + yj + |xi - xj| = (yi - xi) + (yj + xj) stack를 쓰면서 yi - xi 값을 작아지는 값만 저장해나아가고, 큰값은 이전값들을 덮어버림. 비교는 맨...
c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1
<|skeleton|> class Solution: def findMaxValueOfEquation(self, points: List[List[int]], k: int) -> int: """yi + yj + |xi - xj| = (yi - xi) + (yj + xj) stack를 쓰면서 yi - xi 값을 작아지는 값만 저장해나아가고, 큰값은 이전값들을 덮어버림. 비교는 맨앞에 값과만 비교함. # O(N) / O(N) REMIND: Trapping rain water 방법을 쓰는 문제.""" <|body_0|> def f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findMaxValueOfEquation(self, points: List[List[int]], k: int) -> int: """yi + yj + |xi - xj| = (yi - xi) + (yj + xj) stack를 쓰면서 yi - xi 값을 작아지는 값만 저장해나아가고, 큰값은 이전값들을 덮어버림. 비교는 맨앞에 값과만 비교함. # O(N) / O(N) REMIND: Trapping rain water 방법을 쓰는 문제.""" N = len(points) ans = float...
the_stack_v2_python_sparse
Leetcode/1499.py
hanwgyu/algorithm_problem_solving
train
5
dc7c082da76ead298ccbcb1cac104e2f0ae5a092
[ "if not a:\n return 0\np = deque()\nq = deque()\nt = float('-inf')\nm = float('-inf')\nn = len(a)\nfor i in range(0, n, 1):\n if not q or a[i] > q[-1]:\n p.append(i)\n q.append(a[i])\n elif a[i] < q[-1]:\n while q and a[i] < q[-1]:\n x = p.pop()\n y = q.pop()\n ...
<|body_start_0|> if not a: return 0 p = deque() q = deque() t = float('-inf') m = float('-inf') n = len(a) for i in range(0, n, 1): if not q or a[i] > q[-1]: p.append(i) q.append(a[i]) elif a[i] <...
Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized collect all array elements and indicies in stacks
Solution
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized collect all array elements and indicies...
stack_v2_sparse_classes_75kplus_train_066680
4,337
permissive
[ { "docstring": "Determines area of maximum rectangle in histogram. :param list[int] a: list of height values in histogram :return: area of maximum rectangle :rtype: int", "name": "largest_rectangle_area", "signature": "def largest_rectangle_area(self, a)" }, { "docstring": "Calculates maximum ar...
2
stack_v2_sparse_classes_30k_train_039213
Implement the Python class `Solution` described below. Class description: Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized ...
Implement the Python class `Solution` described below. Class description: Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized ...
69f90877c5466927e8b081c4268cbcda074813ec
<|skeleton|> class Solution: """Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized collect all array elements and indicies...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized collect all array elements and indicies in stacks"""...
the_stack_v2_python_sparse
0084_largest_rectangle_histogram/python_source.py
arthurdysart/LeetCode
train
0
fb03ecb94a86755265923fb1638a6c57a51e1b70
[ "for filepaths in trainfiles:\n with open(filepaths, 'r') as text:\n sent_list = tokenize_sentence(text.read())\n for sentences in sent_list:\n word_list = sentence_to_word(sentences)\n for index, words in enumerate(word_list):\n if words not in self.token_list:...
<|body_start_0|> for filepaths in trainfiles: with open(filepaths, 'r') as text: sent_list = tokenize_sentence(text.read()) for sentences in sent_list: word_list = sentence_to_word(sentences) for index, words in enumerate(word_l...
BigramModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BigramModel: def init(self, trainfiles): """builds a bigram language model from the text found in a list of plain text files specified in trainfiles. :param trainfiles: list of filenames, given with absolute paths.""" <|body_0|> def logprob(self, prior_context, target_word):...
stack_v2_sparse_classes_75kplus_train_066681
2,815
no_license
[ { "docstring": "builds a bigram language model from the text found in a list of plain text files specified in trainfiles. :param trainfiles: list of filenames, given with absolute paths.", "name": "init", "signature": "def init(self, trainfiles)" }, { "docstring": "returns the base-2 log probabi...
2
stack_v2_sparse_classes_30k_train_038019
Implement the Python class `BigramModel` described below. Class description: Implement the BigramModel class. Method signatures and docstrings: - def init(self, trainfiles): builds a bigram language model from the text found in a list of plain text files specified in trainfiles. :param trainfiles: list of filenames, ...
Implement the Python class `BigramModel` described below. Class description: Implement the BigramModel class. Method signatures and docstrings: - def init(self, trainfiles): builds a bigram language model from the text found in a list of plain text files specified in trainfiles. :param trainfiles: list of filenames, ...
a6e81e33f966a629df6eab3258603a027035db80
<|skeleton|> class BigramModel: def init(self, trainfiles): """builds a bigram language model from the text found in a list of plain text files specified in trainfiles. :param trainfiles: list of filenames, given with absolute paths.""" <|body_0|> def logprob(self, prior_context, target_word):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BigramModel: def init(self, trainfiles): """builds a bigram language model from the text found in a list of plain text files specified in trainfiles. :param trainfiles: list of filenames, given with absolute paths.""" for filepaths in trainfiles: with open(filepaths, 'r') as text: ...
the_stack_v2_python_sparse
Language-Model/build_language_model.py
qiburger/Natural-Language-Processing
train
1
aec969b731903727efc45465d9e924c0b693a11f
[ "stretch = ell - control_input\nFs = self.params['k'] * stretch\nFd = self.params['c'] * dot_ell\nF = Fs + Fd\nF_rect = F if np.greater_equal(F, 0) else 0\nreturn F_rect", "stretch = self.get_length(point_pos) - control_input\nif stretch <= 0:\n raise Exception('Negative stretch length, Uf is undefined, exitin...
<|body_start_0|> stretch = ell - control_input Fs = self.params['k'] * stretch Fd = self.params['c'] * dot_ell F = Fs + Fd F_rect = F if np.greater_equal(F, 0) else 0 return F_rect <|end_body_0|> <|body_start_1|> stretch = self.get_length(point_pos) - control_inp...
PiecewiseLinearCable3D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PiecewiseLinearCable3D: def scalar_force(self, ell, dot_ell, control_input): """linear spring force, linear damping force. Input is rest length. But, passed through max(force, 0) to rectify the (final) output force.""" <|body_0|> def get_Uf(self, point_pos, control_input): ...
stack_v2_sparse_classes_75kplus_train_066682
3,747
no_license
[ { "docstring": "linear spring force, linear damping force. Input is rest length. But, passed through max(force, 0) to rectify the (final) output force.", "name": "scalar_force", "signature": "def scalar_force(self, ell, dot_ell, control_input)" }, { "docstring": "It would be hard to implement th...
4
null
Implement the Python class `PiecewiseLinearCable3D` described below. Class description: Implement the PiecewiseLinearCable3D class. Method signatures and docstrings: - def scalar_force(self, ell, dot_ell, control_input): linear spring force, linear damping force. Input is rest length. But, passed through max(force, 0...
Implement the Python class `PiecewiseLinearCable3D` described below. Class description: Implement the PiecewiseLinearCable3D class. Method signatures and docstrings: - def scalar_force(self, ell, dot_ell, control_input): linear spring force, linear damping force. Input is rest length. But, passed through max(force, 0...
06f13008c4415e348b4500373152221a2bdc1adf
<|skeleton|> class PiecewiseLinearCable3D: def scalar_force(self, ell, dot_ell, control_input): """linear spring force, linear damping force. Input is rest length. But, passed through max(force, 0) to rectify the (final) output force.""" <|body_0|> def get_Uf(self, point_pos, control_input): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PiecewiseLinearCable3D: def scalar_force(self, ell, dot_ell, control_input): """linear spring force, linear damping force. Input is rest length. But, passed through max(force, 0) to rectify the (final) output force.""" stretch = ell - control_input Fs = self.params['k'] * stretch ...
the_stack_v2_python_sparse
python/cable_models/cable_piecewise3D.py
apsabelhaus/cable-slackness-dynamics
train
0
a9dce177d3cd3af959eb9335d171e07a4e86adef
[ "self._engine = create_engine('sqlite:///a.db')\nBase.metadata.drop_all(self._engine)\nBase.metadata.create_all(self._engine)\nself.__session = None", "if self.__session is None:\n DBSession = sessionmaker(bind=self._engine)\n self.__session = DBSession()\nreturn self.__session", "n_user = User(email=emai...
<|body_start_0|> self._engine = create_engine('sqlite:///a.db') Base.metadata.drop_all(self._engine) Base.metadata.create_all(self._engine) self.__session = None <|end_body_0|> <|body_start_1|> if self.__session is None: DBSession = sessionmaker(bind=self._engine) ...
Data Base with SQLAlchemy
DB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DB: """Data Base with SQLAlchemy""" def __init__(self): """auto call""" <|body_0|> def _session(self): """Create session""" <|body_1|> def add_user(self, email: str, hashed_password: str) -> User: """Add a user instance to the session DB""" ...
stack_v2_sparse_classes_75kplus_train_066683
1,908
no_license
[ { "docstring": "auto call", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Create session", "name": "_session", "signature": "def _session(self)" }, { "docstring": "Add a user instance to the session DB", "name": "add_user", "signature": "def add...
5
stack_v2_sparse_classes_30k_train_032737
Implement the Python class `DB` described below. Class description: Data Base with SQLAlchemy Method signatures and docstrings: - def __init__(self): auto call - def _session(self): Create session - def add_user(self, email: str, hashed_password: str) -> User: Add a user instance to the session DB - def find_user_by(...
Implement the Python class `DB` described below. Class description: Data Base with SQLAlchemy Method signatures and docstrings: - def __init__(self): auto call - def _session(self): Create session - def add_user(self, email: str, hashed_password: str) -> User: Add a user instance to the session DB - def find_user_by(...
251d28c9b555096c61a7112ada43dc65576d03c5
<|skeleton|> class DB: """Data Base with SQLAlchemy""" def __init__(self): """auto call""" <|body_0|> def _session(self): """Create session""" <|body_1|> def add_user(self, email: str, hashed_password: str) -> User: """Add a user instance to the session DB""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DB: """Data Base with SQLAlchemy""" def __init__(self): """auto call""" self._engine = create_engine('sqlite:///a.db') Base.metadata.drop_all(self._engine) Base.metadata.create_all(self._engine) self.__session = None def _session(self): """Create sessi...
the_stack_v2_python_sparse
0x08-user_authentication_service/db.py
dgquintero/holbertonschool-web_back_end
train
0
3850c0b40115edd2a99b20cc72cda902cdab49b7
[ "DBFormatter.__init__(self, logger, dbi)\nself.logger = logger\nself.owner = '%s.' % owner if not owner in ('', '__MYSQL__') else ''\nself.sql = 'UPDATE %sBLOCKS SET OPEN_FOR_WRITING = :open_for_writing , LAST_MODIFIED_BY=:myuser,\\nLAST_MODIFICATION_DATE = :ltime where BLOCK_NAME = :block_name' % self.owner", "i...
<|body_start_0|> DBFormatter.__init__(self, logger, dbi) self.logger = logger self.owner = '%s.' % owner if not owner in ('', '__MYSQL__') else '' self.sql = 'UPDATE %sBLOCKS SET OPEN_FOR_WRITING = :open_for_writing , LAST_MODIFIED_BY=:myuser,\nLAST_MODIFICATION_DATE = :ltime where BLOCK...
Block Update Status DAO class.
UpdateStatus
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateStatus: """Block Update Status DAO class.""" def __init__(self, logger, dbi, owner): """Add schema owner and sql.""" <|body_0|> def execute(self, conn, block_name, open_for_writing, ltime, transaction=False): """for a given file""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus_train_066684
1,356
permissive
[ { "docstring": "Add schema owner and sql.", "name": "__init__", "signature": "def __init__(self, logger, dbi, owner)" }, { "docstring": "for a given file", "name": "execute", "signature": "def execute(self, conn, block_name, open_for_writing, ltime, transaction=False)" } ]
2
stack_v2_sparse_classes_30k_train_044296
Implement the Python class `UpdateStatus` described below. Class description: Block Update Status DAO class. Method signatures and docstrings: - def __init__(self, logger, dbi, owner): Add schema owner and sql. - def execute(self, conn, block_name, open_for_writing, ltime, transaction=False): for a given file
Implement the Python class `UpdateStatus` described below. Class description: Block Update Status DAO class. Method signatures and docstrings: - def __init__(self, logger, dbi, owner): Add schema owner and sql. - def execute(self, conn, block_name, open_for_writing, ltime, transaction=False): for a given file <|skel...
14df8bbe8ee8f874fe423399b18afef911fe78c7
<|skeleton|> class UpdateStatus: """Block Update Status DAO class.""" def __init__(self, logger, dbi, owner): """Add schema owner and sql.""" <|body_0|> def execute(self, conn, block_name, open_for_writing, ltime, transaction=False): """for a given file""" <|body_1|> <|end...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateStatus: """Block Update Status DAO class.""" def __init__(self, logger, dbi, owner): """Add schema owner and sql.""" DBFormatter.__init__(self, logger, dbi) self.logger = logger self.owner = '%s.' % owner if not owner in ('', '__MYSQL__') else '' self.sql = '...
the_stack_v2_python_sparse
Server/Python/src/dbs/dao/Oracle/Block/UpdateStatus.py
vkuznet/DBS
train
0
8117d728d2792f5e316aaffed7e09c5954657638
[ "def bsearch(wanted):\n start = 0\n end = len(numbers) - 1\n while start + 1 < end:\n mid = start + (end - start) / 2\n if numbers[mid] == wanted:\n return mid\n elif numbers[mid] > wanted:\n end = mid\n else:\n start = mid\n if numbers[start]...
<|body_start_0|> def bsearch(wanted): start = 0 end = len(numbers) - 1 while start + 1 < end: mid = start + (end - start) / 2 if numbers[mid] == wanted: return mid elif numbers[mid] > wanted: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSumBinarySearch(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_75kplus_train_066685
2,237
no_license
[ { "docstring": ":type numbers: List[int] :type target: int :rtype: List[int]", "name": "twoSumBinarySearch", "signature": "def twoSumBinarySearch(self, numbers, target)" }, { "docstring": ":type numbers: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_014841
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSumBinarySearch(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] - def twoSum(self, numbers, target): :type numbers: List[int] :type ta...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSumBinarySearch(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] - def twoSum(self, numbers, target): :type numbers: List[int] :type ta...
d1666d44226274f13af25cf878cd63a24e1c5528
<|skeleton|> class Solution: def twoSumBinarySearch(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSumBinarySearch(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" def bsearch(wanted): start = 0 end = len(numbers) - 1 while start + 1 < end: mid = start + (end - start) / 2 ...
the_stack_v2_python_sparse
DP/LeetCode167_TwoSumII_InputArrayIsSorted.py
rexhzhang/LeetCodeProbelms
train
0
88aed54edc0b139701b0940f0d2a45156f248298
[ "article = self.get_object()\narticle.like(request.user)\nreturn Response(self.get_response('You like this article.'), status=status.HTTP_201_CREATED)", "article = self.get_object()\narticle.un_like(request.user)\nreturn Response(self.get_response('You no longer like this article.'), status=status.HTTP_200_OK)" ]
<|body_start_0|> article = self.get_object() article.like(request.user) return Response(self.get_response('You like this article.'), status=status.HTTP_201_CREATED) <|end_body_0|> <|body_start_1|> article = self.get_object() article.un_like(request.user) return Response(...
This view enables liking and un-liking articles.
LikeAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LikeAPIView: """This view enables liking and un-liking articles.""" def post(self, request, **kwargs): """Like an article.""" <|body_0|> def delete(self, request, **kwargs): """Un-like an article.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_066686
34,279
permissive
[ { "docstring": "Like an article.", "name": "post", "signature": "def post(self, request, **kwargs)" }, { "docstring": "Un-like an article.", "name": "delete", "signature": "def delete(self, request, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_048927
Implement the Python class `LikeAPIView` described below. Class description: This view enables liking and un-liking articles. Method signatures and docstrings: - def post(self, request, **kwargs): Like an article. - def delete(self, request, **kwargs): Un-like an article.
Implement the Python class `LikeAPIView` described below. Class description: This view enables liking and un-liking articles. Method signatures and docstrings: - def post(self, request, **kwargs): Like an article. - def delete(self, request, **kwargs): Un-like an article. <|skeleton|> class LikeAPIView: """This ...
20993253c2fb72608f21e2a19e999fbd85db904d
<|skeleton|> class LikeAPIView: """This view enables liking and un-liking articles.""" def post(self, request, **kwargs): """Like an article.""" <|body_0|> def delete(self, request, **kwargs): """Un-like an article.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LikeAPIView: """This view enables liking and un-liking articles.""" def post(self, request, **kwargs): """Like an article.""" article = self.get_object() article.like(request.user) return Response(self.get_response('You like this article.'), status=status.HTTP_201_CREATED)...
the_stack_v2_python_sparse
authors/apps/articles/views.py
andela/ah-code-blooded
train
3
c39c395f30e35b9fa92d1dd9c556153e9b8ddf5c
[ "NamedObject.__init__(self, root, definitions)\npmd = Metadata()\npmd.wrappers = dict(element=repr, type=repr)\nself.__metadata__.__print__ = pmd\ntns = definitions.tns\nself.element = self.__getref('element', tns)\nself.type = self.__getref('type', tns)", "s = self.root.get(a)\nif s is None:\n return s\nelse:...
<|body_start_0|> NamedObject.__init__(self, root, definitions) pmd = Metadata() pmd.wrappers = dict(element=repr, type=repr) self.__metadata__.__print__ = pmd tns = definitions.tns self.element = self.__getref('element', tns) self.type = self.__getref('type', tns)...
Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type type: str
Part
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Part: """Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type type: str"...
stack_v2_sparse_classes_75kplus_train_066687
30,914
permissive
[ { "docstring": "@param root: An XML root element. @type root: L{Element} @param definitions: A definitions object. @type definitions: L{Definitions}", "name": "__init__", "signature": "def __init__(self, root, definitions)" }, { "docstring": "Get the qualified value of attribute named 'a'.", ...
2
stack_v2_sparse_classes_30k_train_022345
Implement the Python class `Part` described below. Class description: Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted b...
Implement the Python class `Part` described below. Class description: Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted b...
7d8843fcdfe179f018af2038f813795f7182b714
<|skeleton|> class Part: """Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type type: str"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Part: """Represents <message><part/></message>. @ivar element: The value of the {element} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type element: str @ivar type: The value of the {type} attribute. Stored as a I{qref} as converted by L{suds.xsd.qualify}. @type type: str""" def _...
the_stack_v2_python_sparse
suds/wsdl.py
CybernetiX-S3C/interactive-tutorials
train
1
b7d8de726930c839831a25cec79986f0d595a689
[ "_ = ax.hist(self.d_ij, **kwargs)\nax.set_ylabel('Num. pairs')\nax.set_xlabel('Separation distance')", "_ = ax.hist(self.C_ij, **kwargs)\nax.set_ylabel('Num. pairs')\nax.set_xlabel('Fluctuation')", "d = self.d_ij\nC = self.C_ij\nif null_model:\n d = np.random.choice(d, self.num_fluctuations, replace=False)\n...
<|body_start_0|> _ = ax.hist(self.d_ij, **kwargs) ax.set_ylabel('Num. pairs') ax.set_xlabel('Separation distance') <|end_body_0|> <|body_start_1|> _ = ax.hist(self.C_ij, **kwargs) ax.set_ylabel('Num. pairs') ax.set_xlabel('Fluctuation') <|end_body_1|> <|body_start_2|> ...
Visualization methods for SpatialCorrelation.
CorrelationVisualization
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CorrelationVisualization: """Visualization methods for SpatialCorrelation.""" def histogram_distances(self, ax=None, **kwargs): """Plot histogram of pairwise distances between measurements.""" <|body_0|> def histogram_fluctuations(self, ax=None, **kwargs): """Plo...
stack_v2_sparse_classes_75kplus_train_066688
8,963
permissive
[ { "docstring": "Plot histogram of pairwise distances between measurements.", "name": "histogram_distances", "signature": "def histogram_distances(self, ax=None, **kwargs)" }, { "docstring": "Plot histogram of pairwise fluctuations between measurements.", "name": "histogram_fluctuations", ...
3
stack_v2_sparse_classes_30k_train_049688
Implement the Python class `CorrelationVisualization` described below. Class description: Visualization methods for SpatialCorrelation. Method signatures and docstrings: - def histogram_distances(self, ax=None, **kwargs): Plot histogram of pairwise distances between measurements. - def histogram_fluctuations(self, ax...
Implement the Python class `CorrelationVisualization` described below. Class description: Visualization methods for SpatialCorrelation. Method signatures and docstrings: - def histogram_distances(self, ax=None, **kwargs): Plot histogram of pairwise distances between measurements. - def histogram_fluctuations(self, ax...
4a622c3f5fed4456c3b9240f5a96428789fde9bd
<|skeleton|> class CorrelationVisualization: """Visualization methods for SpatialCorrelation.""" def histogram_distances(self, ax=None, **kwargs): """Plot histogram of pairwise distances between measurements.""" <|body_0|> def histogram_fluctuations(self, ax=None, **kwargs): """Plo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CorrelationVisualization: """Visualization methods for SpatialCorrelation.""" def histogram_distances(self, ax=None, **kwargs): """Plot histogram of pairwise distances between measurements.""" _ = ax.hist(self.d_ij, **kwargs) ax.set_ylabel('Num. pairs') ax.set_xlabel('Sepa...
the_stack_v2_python_sparse
flyqma/annotation/spatial/correlation.py
sbernasek/flyqma
train
1
5ae89a8fa0c4cba15798460fb6ed0a0dc5b31505
[ "def in_order(root):\n if not root:\n return []\n return in_order(root.left) + [root.val] + in_order(root.right)\nvals = in_order(root)\nres = 0\nflag = False\nfor i in vals:\n if flag:\n res += i\n if i == R:\n break\n elif i == L:\n res += i\n flag = True\...
<|body_start_0|> def in_order(root): if not root: return [] return in_order(root.left) + [root.val] + in_order(root.right) vals = in_order(root) res = 0 flag = False for i in vals: if flag: res += i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rangeSumBST(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: int 460ms, beats: 5.62%""" <|body_0|> def rangeSumBST2(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: int 384ms, beats: 34.83%""" ...
stack_v2_sparse_classes_75kplus_train_066689
1,274
no_license
[ { "docstring": ":type root: TreeNode :type L: int :type R: int :rtype: int 460ms, beats: 5.62%", "name": "rangeSumBST", "signature": "def rangeSumBST(self, root, L, R)" }, { "docstring": ":type root: TreeNode :type L: int :type R: int :rtype: int 384ms, beats: 34.83%", "name": "rangeSumBST2"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeSumBST(self, root, L, R): :type root: TreeNode :type L: int :type R: int :rtype: int 460ms, beats: 5.62% - def rangeSumBST2(self, root, L, R): :type root: TreeNode :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rangeSumBST(self, root, L, R): :type root: TreeNode :type L: int :type R: int :rtype: int 460ms, beats: 5.62% - def rangeSumBST2(self, root, L, R): :type root: TreeNode :type...
624975f767f6efa1d7361cc077eaebc344d57210
<|skeleton|> class Solution: def rangeSumBST(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: int 460ms, beats: 5.62%""" <|body_0|> def rangeSumBST2(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: int 384ms, beats: 34.83%""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rangeSumBST(self, root, L, R): """:type root: TreeNode :type L: int :type R: int :rtype: int 460ms, beats: 5.62%""" def in_order(root): if not root: return [] return in_order(root.left) + [root.val] + in_order(root.right) vals = in_...
the_stack_v2_python_sparse
938. 二叉搜索树的范围和.py
dx19910707/LeetCode
train
0
4cde60505d4564395914d09667c851ff3c4de3fe
[ "super().__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)\nself.linear = tf.keras.layers.Dense(target_vocab)", "enco_output = self.encoder(inputs, training, encoder_mask)\ndeco_output = se...
<|body_start_0|> super().__init__() self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate) self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate) self.linear = tf.keras.layers.Dense(target_vocab) <|end_body_0|> <|body_start_1|> ...
transformer network
Transformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformer: """transformer network""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """N - the number of blocks in the encoder and decoder dm - the dimensionality of the model h - the number of heads hidden - the numbe...
stack_v2_sparse_classes_75kplus_train_066690
1,678
no_license
[ { "docstring": "N - the number of blocks in the encoder and decoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected layers input_vocab - the size of the input vocabulary target_vocab - the size of the target vocabulary max_seq_input - the m...
2
stack_v2_sparse_classes_30k_val_000643
Implement the Python class `Transformer` described below. Class description: transformer network Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): N - the number of blocks in the encoder and decoder dm - the dimensionalit...
Implement the Python class `Transformer` described below. Class description: transformer network Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): N - the number of blocks in the encoder and decoder dm - the dimensionalit...
b0c18df889d8bd0c24d4bdbbd69be06bc5c0a918
<|skeleton|> class Transformer: """transformer network""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """N - the number of blocks in the encoder and decoder dm - the dimensionality of the model h - the number of heads hidden - the numbe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Transformer: """transformer network""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """N - the number of blocks in the encoder and decoder dm - the dimensionality of the model h - the number of heads hidden - the number of hidden u...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/11-transformer.py
Gaspela/holbertonschool-machine_learning
train
0
5a3594c6ce1d9e8d2b27284ac945c75270e9c50a
[ "if not issubclass(type(pins), list):\n pins = [pins]\nsuper(DLGMLayer, self).__init__()\nself.hidden_module = MLP.get_hidden_layers(pins, phidden=phidden, nn_lin=nn_lin, name=name)\nif issubclass(type(pouts), list):\n self.out_module = nn.ModuleList()\n self.cov_module = nn.ModuleList()\n for pout in p...
<|body_start_0|> if not issubclass(type(pins), list): pins = [pins] super(DLGMLayer, self).__init__() self.hidden_module = MLP.get_hidden_layers(pins, phidden=phidden, nn_lin=nn_lin, name=name) if issubclass(type(pouts), list): self.out_module = nn.ModuleList() ...
Specific decoding module for Deep Latent Gaussian Models
DLGMLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DLGMLayer: """Specific decoding module for Deep Latent Gaussian Models""" def __init__(self, pins, pouts, phidden={'dim': 800, 'nlayers': 2}, nn_lin='ReLU', name=''): """:param pins: parameters of the above layer :type pins: dict :param pouts: parameters of the ouput distribution :ty...
stack_v2_sparse_classes_75kplus_train_066691
10,368
no_license
[ { "docstring": ":param pins: parameters of the above layer :type pins: dict :param pouts: parameters of the ouput distribution :type pouts: dict :param phidden: parameters of the hidden layer(s) :type phidden: dict :param nn_lin: non-linearity name :type nn_lin: str :param name: name of module :type name: str",...
2
stack_v2_sparse_classes_30k_train_006672
Implement the Python class `DLGMLayer` described below. Class description: Specific decoding module for Deep Latent Gaussian Models Method signatures and docstrings: - def __init__(self, pins, pouts, phidden={'dim': 800, 'nlayers': 2}, nn_lin='ReLU', name=''): :param pins: parameters of the above layer :type pins: di...
Implement the Python class `DLGMLayer` described below. Class description: Specific decoding module for Deep Latent Gaussian Models Method signatures and docstrings: - def __init__(self, pins, pouts, phidden={'dim': 800, 'nlayers': 2}, nn_lin='ReLU', name=''): :param pins: parameters of the above layer :type pins: di...
b1894f1a3bb9368c266c86666c62d94cf26d9a61
<|skeleton|> class DLGMLayer: """Specific decoding module for Deep Latent Gaussian Models""" def __init__(self, pins, pouts, phidden={'dim': 800, 'nlayers': 2}, nn_lin='ReLU', name=''): """:param pins: parameters of the above layer :type pins: dict :param pouts: parameters of the ouput distribution :ty...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DLGMLayer: """Specific decoding module for Deep Latent Gaussian Models""" def __init__(self, pins, pouts, phidden={'dim': 800, 'nlayers': 2}, nn_lin='ReLU', name=''): """:param pins: parameters of the above layer :type pins: dict :param pouts: parameters of the ouput distribution :type pouts: dic...
the_stack_v2_python_sparse
models/modules/modules_bottleneck.py
dhockaday/variational-timbre
train
0
80e645d717c6819b5ce1d03dc638fa7acb73cf42
[ "result = _parseIso8601(input)\nif not result:\n result = _parseSimple(input)\nif result is not None:\n return result\nelse:\n raise ParameterError('Invalid time delta - could not parse %s' % input)", "weeks = x.days // 7\ndays = x.days % 7\nhours = x.seconds // 3600\nminutes = x.seconds % 3600 // 60\nse...
<|body_start_0|> result = _parseIso8601(input) if not result: result = _parseSimple(input) if result is not None: return result else: raise ParameterError('Invalid time delta - could not parse %s' % input) <|end_body_0|> <|body_start_1|> weeks...
Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest unit order * ISO 8601 duration ``PnDTnHnMnS`` (each field optional, years and months n...
TimeDeltaValueType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeDeltaValueType: """Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest unit order * ISO 8601 duration ``PnDTnHn...
stack_v2_sparse_classes_75kplus_train_066692
4,446
permissive
[ { "docstring": "Parses a time delta from the input. See :py:class:`TimeDeltaValueType` for details on supported formats.", "name": "parse_from_str", "signature": "def parse_from_str(self, input)" }, { "docstring": "Converts datetime.timedelta to a string :param x: the value to serialize.", "...
2
stack_v2_sparse_classes_30k_train_046306
Implement the Python class `TimeDeltaValueType` described below. Class description: Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest u...
Implement the Python class `TimeDeltaValueType` described below. Class description: Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest u...
d59c99dcdcd280d7eec36a693dd80f8c8c831ea2
<|skeleton|> class TimeDeltaValueType: """Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest unit order * ISO 8601 duration ``PnDTnHn...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimeDeltaValueType: """Class that maps to timedelta using strings in any of the following forms: * ``n {w[eek[s]]|d[ay[s]]|h[our[s]]|m[inute[s]|s[second[s]]}`` (e.g. "1 week 2 days" or "1 h") Note: multiple arguments must be supplied in longest to shortest unit order * ISO 8601 duration ``PnDTnHnMnS`` (each f...
the_stack_v2_python_sparse
modules/dbnd/src/targets/values/timedelta_value.py
databand-ai/dbnd
train
257
f45d61edd358166da0202b1464d5b7afba4c6e40
[ "i_begin = 0\nhkl_ref = reflections[0].get('miller_index_asymmetric')\nfor i in range(len(reflections)):\n hkl = reflections[i].get('miller_index_asymmetric')\n if hkl == hkl_ref:\n continue\n else:\n yield reflections[i_begin:i]\n i_begin = i\n hkl_ref = hkl\nyield reflections[...
<|body_start_0|> i_begin = 0 hkl_ref = reflections[0].get('miller_index_asymmetric') for i in range(len(reflections)): hkl = reflections[i].get('miller_index_asymmetric') if hkl == hkl_ref: continue else: yield reflections[i_beg...
reflection_table_utils
[ "BSD-3-Clause-LBNL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class reflection_table_utils: def get_next_hkl_reflection_table(reflections): """Generate asu hkl slices from an asu hkl-sorted reflection table""" <|body_0|> def select_odd_experiment_reflections(reflections): """Select reflections from experiments with odd ids. An experi...
stack_v2_sparse_classes_75kplus_train_066693
1,280
permissive
[ { "docstring": "Generate asu hkl slices from an asu hkl-sorted reflection table", "name": "get_next_hkl_reflection_table", "signature": "def get_next_hkl_reflection_table(reflections)" }, { "docstring": "Select reflections from experiments with odd ids. An experiment id must be a string represen...
3
stack_v2_sparse_classes_30k_train_017474
Implement the Python class `reflection_table_utils` described below. Class description: Implement the reflection_table_utils class. Method signatures and docstrings: - def get_next_hkl_reflection_table(reflections): Generate asu hkl slices from an asu hkl-sorted reflection table - def select_odd_experiment_reflection...
Implement the Python class `reflection_table_utils` described below. Class description: Implement the reflection_table_utils class. Method signatures and docstrings: - def get_next_hkl_reflection_table(reflections): Generate asu hkl slices from an asu hkl-sorted reflection table - def select_odd_experiment_reflection...
644090f9432d9afc22cfb542fc3ab78ca8e15e5d
<|skeleton|> class reflection_table_utils: def get_next_hkl_reflection_table(reflections): """Generate asu hkl slices from an asu hkl-sorted reflection table""" <|body_0|> def select_odd_experiment_reflections(reflections): """Select reflections from experiments with odd ids. An experi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class reflection_table_utils: def get_next_hkl_reflection_table(reflections): """Generate asu hkl slices from an asu hkl-sorted reflection table""" i_begin = 0 hkl_ref = reflections[0].get('miller_index_asymmetric') for i in range(len(reflections)): hkl = reflections[i].g...
the_stack_v2_python_sparse
xfel/merging/application/reflection_table_utils.py
rimmartin/cctbx_project
train
0
93146077f13d0a2bce212592ae6c1f5250a085d6
[ "self.time = collections.defaultdict(list)\nself.value = collections.defaultdict(list)\nself.max = collections.defaultdict(int)", "self.time[key].append(timestamp)\nself.value[key].append(value)\nself.max[key] = max(self.max[key], timestamp)", "if key not in self.time:\n return ''\nif timestamp >= self.max[k...
<|body_start_0|> self.time = collections.defaultdict(list) self.value = collections.defaultdict(list) self.max = collections.defaultdict(int) <|end_body_0|> <|body_start_1|> self.time[key].append(timestamp) self.value[key].append(value) self.max[key] = max(self.max[key],...
TimeMap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def set(self, key, value, timestamp): """:type key: str :type value: str :type timestamp: int :rtype: None""" <|body_1|> def get(self, key, timestamp): """:type ke...
stack_v2_sparse_classes_75kplus_train_066694
1,146
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type key: str :type value: str :type timestamp: int :rtype: None", "name": "set", "signature": "def set(self, key, value, timestamp)" }, { "docstring":...
3
stack_v2_sparse_classes_30k_train_048110
Implement the Python class `TimeMap` described below. Class description: Implement the TimeMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def set(self, key, value, timestamp): :type key: str :type value: str :type timestamp: int :rtype: None - def get(self, k...
Implement the Python class `TimeMap` described below. Class description: Implement the TimeMap class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def set(self, key, value, timestamp): :type key: str :type value: str :type timestamp: int :rtype: None - def get(self, k...
8cdb97bc7588b96b91b1c550afd84e976c1926e0
<|skeleton|> class TimeMap: def __init__(self): """Initialize your data structure here.""" <|body_0|> def set(self, key, value, timestamp): """:type key: str :type value: str :type timestamp: int :rtype: None""" <|body_1|> def get(self, key, timestamp): """:type ke...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimeMap: def __init__(self): """Initialize your data structure here.""" self.time = collections.defaultdict(list) self.value = collections.defaultdict(list) self.max = collections.defaultdict(int) def set(self, key, value, timestamp): """:type key: str :type value:...
the_stack_v2_python_sparse
BinarySearch/981_BS_TImeBasedKeyValueStore.py
ZhengLiangliang1996/Leetcode_ML_Daily
train
1
e48765a96366f7dc03be40cc294177f215eb3ff4
[ "VDriveCommand.__init__(self, controller, command_args)\nself.check_command_arguments(self.SupportedArgs)\nreturn", "input_args = self._commandArgsDict.keys()\nfor arg_key in input_args:\n if arg_key not in RunsInfoQuery.SupportedArgs:\n raise KeyError('INFO argument {} is not recognized. Supported arg...
<|body_start_0|> VDriveCommand.__init__(self, controller, command_args) self.check_command_arguments(self.SupportedArgs) return <|end_body_0|> <|body_start_1|> input_args = self._commandArgsDict.keys() for arg_key in input_args: if arg_key not in RunsInfoQuery.Suppor...
Process command MERGE
RunsInfoQuery
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunsInfoQuery: """Process command MERGE""" def __init__(self, controller, command_args): """Initialization""" <|body_0|> def exec_cmd(self): """Execute input command""" <|body_1|> def format_list_to_str(info_dict_list, keys): """format the ru...
stack_v2_sparse_classes_75kplus_train_066695
5,215
no_license
[ { "docstring": "Initialization", "name": "__init__", "signature": "def __init__(self, controller, command_args)" }, { "docstring": "Execute input command", "name": "exec_cmd", "signature": "def exec_cmd(self)" }, { "docstring": "format the run information dictionary list into nic...
4
stack_v2_sparse_classes_30k_train_009846
Implement the Python class `RunsInfoQuery` described below. Class description: Process command MERGE Method signatures and docstrings: - def __init__(self, controller, command_args): Initialization - def exec_cmd(self): Execute input command - def format_list_to_str(info_dict_list, keys): format the run information d...
Implement the Python class `RunsInfoQuery` described below. Class description: Process command MERGE Method signatures and docstrings: - def __init__(self, controller, command_args): Initialization - def exec_cmd(self): Execute input command - def format_list_to_str(info_dict_list, keys): format the run information d...
875a5b99a7a6f51129844bf8052fc6f231497d71
<|skeleton|> class RunsInfoQuery: """Process command MERGE""" def __init__(self, controller, command_args): """Initialization""" <|body_0|> def exec_cmd(self): """Execute input command""" <|body_1|> def format_list_to_str(info_dict_list, keys): """format the ru...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RunsInfoQuery: """Process command MERGE""" def __init__(self, controller, command_args): """Initialization""" VDriveCommand.__init__(self, controller, command_args) self.check_command_arguments(self.SupportedArgs) return def exec_cmd(self): """Execute input co...
the_stack_v2_python_sparse
pyvdrive/interface/vdrive_commands/show_info.py
neutrons/PyVDrive
train
2
f65c362b60fea43c304948dc4fdb6578b7b99b1b
[ "self.adj_list: List[List[Tuple[int, int]]] = [[] for _ in range(n)]\nself.adj_list_creator(mat)\nself.visited: List[bool] = [False] * n\nself.q: List[Tuple[int, int]] = []\nself.src: int = src\nself.D: List[int] = [MAXINT] * n", "for i in range(len(mat)):\n v1, v2 = mat[i]\n self.adj_list[v1].append(v2)\n ...
<|body_start_0|> self.adj_list: List[List[Tuple[int, int]]] = [[] for _ in range(n)] self.adj_list_creator(mat) self.visited: List[bool] = [False] * n self.q: List[Tuple[int, int]] = [] self.src: int = src self.D: List[int] = [MAXINT] * n <|end_body_0|> <|body_start_1|> ...
Graph
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Graph: def __init__(self, n: int, mat: List[List[int]], src: int=0): """Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3)""" <|body_0|> def adj_list_creator(self, mat: List[List[int]]): """Creates the adjacency list...
stack_v2_sparse_classes_75kplus_train_066696
1,956
permissive
[ { "docstring": "Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3)", "name": "__init__", "signature": "def __init__(self, n: int, mat: List[List[int]], src: int=0)" }, { "docstring": "Creates the adjacency list for given matrix in the format: [[...
3
stack_v2_sparse_classes_30k_train_022913
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def __init__(self, n: int, mat: List[List[int]], src: int=0): Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3) - def adj_list_creat...
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def __init__(self, n: int, mat: List[List[int]], src: int=0): Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3) - def adj_list_creat...
92543c954801e5006a5059c1213d7b833b290e2e
<|skeleton|> class Graph: def __init__(self, n: int, mat: List[List[int]], src: int=0): """Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3)""" <|body_0|> def adj_list_creator(self, mat: List[List[int]]): """Creates the adjacency list...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Graph: def __init__(self, n: int, mat: List[List[int]], src: int=0): """Create the adjacency list for the given matrix :param n: no of nodes :param mat: given matrix (m x 3)""" self.adj_list: List[List[Tuple[int, int]]] = [[] for _ in range(n)] self.adj_list_creator(mat) self.v...
the_stack_v2_python_sparse
Graphs/bfs.py
shreykhare/LeetCodeSolutions
train
0
2a6364254e39dea44a5ab33903969832729834b3
[ "if request.session.uid:\n request.session.uid = False\nif request.session.login:\n request.session.login = False\ndata = {'code_maxlength': 6}\nreturn request.render('sms_base.sms_login_signup', data)", "values = request.params.copy()\nuser_phone = values.get('user_phone')\nif not user_phone:\n return j...
<|body_start_0|> if request.session.uid: request.session.uid = False if request.session.login: request.session.login = False data = {'code_maxlength': 6} return request.render('sms_base.sms_login_signup', data) <|end_body_0|> <|body_start_1|> values = req...
OAuthController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OAuthController: def web_odoo_sms_login(self, **kw): """短信登录入口,点击后返回到验证码界面 :param kw: :return:""" <|body_0|> def web_sms_send_code(self, **kw): """发送验证码 :param kw: :return:""" <|body_1|> def web_sms_user_login(self, **kw): """验证登录验证码 :param kw: :...
stack_v2_sparse_classes_75kplus_train_066697
5,794
permissive
[ { "docstring": "短信登录入口,点击后返回到验证码界面 :param kw: :return:", "name": "web_odoo_sms_login", "signature": "def web_odoo_sms_login(self, **kw)" }, { "docstring": "发送验证码 :param kw: :return:", "name": "web_sms_send_code", "signature": "def web_sms_send_code(self, **kw)" }, { "docstring": ...
4
null
Implement the Python class `OAuthController` described below. Class description: Implement the OAuthController class. Method signatures and docstrings: - def web_odoo_sms_login(self, **kw): 短信登录入口,点击后返回到验证码界面 :param kw: :return: - def web_sms_send_code(self, **kw): 发送验证码 :param kw: :return: - def web_sms_user_login(s...
Implement the Python class `OAuthController` described below. Class description: Implement the OAuthController class. Method signatures and docstrings: - def web_odoo_sms_login(self, **kw): 短信登录入口,点击后返回到验证码界面 :param kw: :return: - def web_sms_send_code(self, **kw): 发送验证码 :param kw: :return: - def web_sms_user_login(s...
8608aaeae7a8c86d53b68ce26b7b308f779c3dd8
<|skeleton|> class OAuthController: def web_odoo_sms_login(self, **kw): """短信登录入口,点击后返回到验证码界面 :param kw: :return:""" <|body_0|> def web_sms_send_code(self, **kw): """发送验证码 :param kw: :return:""" <|body_1|> def web_sms_user_login(self, **kw): """验证登录验证码 :param kw: :...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OAuthController: def web_odoo_sms_login(self, **kw): """短信登录入口,点击后返回到验证码界面 :param kw: :return:""" if request.session.uid: request.session.uid = False if request.session.login: request.session.login = False data = {'code_maxlength': 6} return requ...
the_stack_v2_python_sparse
sms_base/controllers/sms_controller.py
niulinlnc/odooExtModel
train
4
61f61444cc0309097ced00faefc503d3a7bd51c2
[ "self.vehtype = vehtype\nself.speed = speed\nself.acce = acce\nself.weight = weight\nself.space = space\nself.datetime = datetime\nif lane == 1:\n self.x = 90\n self.y = 720\nelse:\n self.x = 960 - 90 - 345\n self.y = -100\nself.color = (255, 255, 255)", "self.str1 = u'车型: {0}轴车 时间: {1}'.format(self.v...
<|body_start_0|> self.vehtype = vehtype self.speed = speed self.acce = acce self.weight = weight self.space = space self.datetime = datetime if lane == 1: self.x = 90 self.y = 720 else: self.x = 960 - 90 - 345 ...
Veh class, each will print a veh's info
Veh
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Veh: """Veh class, each will print a veh's info""" def __init__(self, vehtype, speed, acce, lane, weight, space, datetime): """Init object A para's expamle: vehtype: 1 (int) speed: 65 (int) acce: 939 (int) lane: 1 (int) weight: (790, 770) (tuple of int) space: 2564 (int) datetime: (a...
stack_v2_sparse_classes_75kplus_train_066698
3,873
no_license
[ { "docstring": "Init object A para's expamle: vehtype: 1 (int) speed: 65 (int) acce: 939 (int) lane: 1 (int) weight: (790, 770) (tuple of int) space: 2564 (int) datetime: (a standard datetime object)", "name": "__init__", "signature": "def __init__(self, vehtype, speed, acce, lane, weight, space, dateti...
5
stack_v2_sparse_classes_30k_train_022089
Implement the Python class `Veh` described below. Class description: Veh class, each will print a veh's info Method signatures and docstrings: - def __init__(self, vehtype, speed, acce, lane, weight, space, datetime): Init object A para's expamle: vehtype: 1 (int) speed: 65 (int) acce: 939 (int) lane: 1 (int) weight:...
Implement the Python class `Veh` described below. Class description: Veh class, each will print a veh's info Method signatures and docstrings: - def __init__(self, vehtype, speed, acce, lane, weight, space, datetime): Init object A para's expamle: vehtype: 1 (int) speed: 65 (int) acce: 939 (int) lane: 1 (int) weight:...
038497eb9b2119769ecb85e023156eeff375d0e3
<|skeleton|> class Veh: """Veh class, each will print a veh's info""" def __init__(self, vehtype, speed, acce, lane, weight, space, datetime): """Init object A para's expamle: vehtype: 1 (int) speed: 65 (int) acce: 939 (int) lane: 1 (int) weight: (790, 770) (tuple of int) space: 2564 (int) datetime: (a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Veh: """Veh class, each will print a veh's info""" def __init__(self, vehtype, speed, acce, lane, weight, space, datetime): """Init object A para's expamle: vehtype: 1 (int) speed: 65 (int) acce: 939 (int) lane: 1 (int) weight: (790, 770) (tuple of int) space: 2564 (int) datetime: (a standard dat...
the_stack_v2_python_sparse
Veh.py
MatheMatrix/realtimewatcher
train
1
dbd69a82dbca2f03b73915a09b6563b00224e8b5
[ "self.p1 = p1\nself.p2 = p2\nself.width = width\nself.centervalx = (p1.x + p2.x) / 2\nself.centervaly = (p1.y + p2.y) / 2\nself.center = Point(self.centervalx, self.centervaly)\nself.area = self.width / 2\nif self.centervaly == self.p1.y:\n self.b = math.sqrt(math.pow(self.area, 2) - math.pow(self.p1.x - self.ce...
<|body_start_0|> self.p1 = p1 self.p2 = p2 self.width = width self.centervalx = (p1.x + p2.x) / 2 self.centervaly = (p1.y + p2.y) / 2 self.center = Point(self.centervalx, self.centervaly) self.area = self.width / 2 if self.centervaly == self.p1.y: ...
Create an ellipse class
Ellipse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ellipse: """Create an ellipse class""" def __init__(self, p1, p2, width): """A constructore class of ellipse class initializing values""" <|body_0|> def valueinellipse(self, point): """Fucntion to check if the point is in the ellipse""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus_train_066699
8,980
no_license
[ { "docstring": "A constructore class of ellipse class initializing values", "name": "__init__", "signature": "def __init__(self, p1, p2, width)" }, { "docstring": "Fucntion to check if the point is in the ellipse", "name": "valueinellipse", "signature": "def valueinellipse(self, point)" ...
2
stack_v2_sparse_classes_30k_test_000999
Implement the Python class `Ellipse` described below. Class description: Create an ellipse class Method signatures and docstrings: - def __init__(self, p1, p2, width): A constructore class of ellipse class initializing values - def valueinellipse(self, point): Fucntion to check if the point is in the ellipse
Implement the Python class `Ellipse` described below. Class description: Create an ellipse class Method signatures and docstrings: - def __init__(self, p1, p2, width): A constructore class of ellipse class initializing values - def valueinellipse(self, point): Fucntion to check if the point is in the ellipse <|skele...
2c06bf5c11452b9f16b5ef96d0e8d106534035b0
<|skeleton|> class Ellipse: """Create an ellipse class""" def __init__(self, p1, p2, width): """A constructore class of ellipse class initializing values""" <|body_0|> def valueinellipse(self, point): """Fucntion to check if the point is in the ellipse""" <|body_1|> <|end_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Ellipse: """Create an ellipse class""" def __init__(self, p1, p2, width): """A constructore class of ellipse class initializing values""" self.p1 = p1 self.p2 = p2 self.width = width self.centervalx = (p1.x + p2.x) / 2 self.centervaly = (p1.y + p2.y) / 2 ...
the_stack_v2_python_sparse
overlapEllipses.py
monishgowda77/PythonPrograms
train
1