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
37781832e950f7d78955f2a4db41b365f957cbdf
[ "self.model_func = model_func\nself.cmd_args = cmd_args\nself.settings = settings\nself.input_specs = input_specs\nself.write_path = write_path", "val_arry = np.sort(np.array(list(data.keys())))\nnp.random.shuffle(val_arry)\nslice_idx = np.tile(np.arange(0, k), ceil(len(val_arry) / k))[:len(val_arry)]\nself.folds...
<|body_start_0|> self.model_func = model_func self.cmd_args = cmd_args self.settings = settings self.input_specs = input_specs self.write_path = write_path <|end_body_0|> <|body_start_1|> val_arry = np.sort(np.array(list(data.keys()))) np.random.shuffle(val_arry)...
CrossValidation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrossValidation: def __init__(self, model_func, cmd_args, settings, input_specs, write_path): """INPUTS: model_func: the model function to return the current model cmd_args: the command line arguements settings: the ai settings file input_specs: the input specifications from data process...
stack_v2_sparse_classes_75kplus_train_068700
5,002
no_license
[ { "docstring": "INPUTS: model_func: the model function to return the current model cmd_args: the command line arguements settings: the ai settings file input_specs: the input specifications from data processing write_path: the path to write out to EFFECT: initializes the cross validation to run KxK cross fold v...
4
stack_v2_sparse_classes_30k_train_037743
Implement the Python class `CrossValidation` described below. Class description: Implement the CrossValidation class. Method signatures and docstrings: - def __init__(self, model_func, cmd_args, settings, input_specs, write_path): INPUTS: model_func: the model function to return the current model cmd_args: the comman...
Implement the Python class `CrossValidation` described below. Class description: Implement the CrossValidation class. Method signatures and docstrings: - def __init__(self, model_func, cmd_args, settings, input_specs, write_path): INPUTS: model_func: the model function to return the current model cmd_args: the comman...
a2f567650776dde8aa71c77d9bde6dc95fe4d418
<|skeleton|> class CrossValidation: def __init__(self, model_func, cmd_args, settings, input_specs, write_path): """INPUTS: model_func: the model function to return the current model cmd_args: the command line arguements settings: the ai settings file input_specs: the input specifications from data process...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CrossValidation: def __init__(self, model_func, cmd_args, settings, input_specs, write_path): """INPUTS: model_func: the model function to return the current model cmd_args: the command line arguements settings: the ai settings file input_specs: the input specifications from data processing write_path...
the_stack_v2_python_sparse
src/cross_validation.py
wwlaoxi/mri_liver_seg
train
1
e40f5025c78cf16e3e0fae8e3f3c588fc5fe2a36
[ "self.active_sessions = active_sessions\nself.file_path = file_path\nself.view_id = view_id\nself.view_name = view_name", "if dictionary is None:\n return None\nactive_sessions = None\nif dictionary.get('activeSessions') != None:\n active_sessions = list()\n for structure in dictionary.get('activeSession...
<|body_start_0|> self.active_sessions = active_sessions self.file_path = file_path self.view_id = view_id self.view_name = view_name <|end_body_0|> <|body_start_1|> if dictionary is None: return None active_sessions = None if dictionary.get('activeSes...
Implementation of the 'SmbActiveFilePath' model. Specifies a file path in an SMB view that has active sessions and opens. Attributes: active_sessions (list of SmbActiveSession): Specifies the sessions where the file is open. file_path (string): Specifies the filepath in the view. view_id (long|int): Specifies the id of...
SmbActiveFilePath
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmbActiveFilePath: """Implementation of the 'SmbActiveFilePath' model. Specifies a file path in an SMB view that has active sessions and opens. Attributes: active_sessions (list of SmbActiveSession): Specifies the sessions where the file is open. file_path (string): Specifies the filepath in the ...
stack_v2_sparse_classes_75kplus_train_068701
2,539
permissive
[ { "docstring": "Constructor for the SmbActiveFilePath class", "name": "__init__", "signature": "def __init__(self, active_sessions=None, file_path=None, view_id=None, view_name=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictiona...
2
stack_v2_sparse_classes_30k_train_034891
Implement the Python class `SmbActiveFilePath` described below. Class description: Implementation of the 'SmbActiveFilePath' model. Specifies a file path in an SMB view that has active sessions and opens. Attributes: active_sessions (list of SmbActiveSession): Specifies the sessions where the file is open. file_path (...
Implement the Python class `SmbActiveFilePath` described below. Class description: Implementation of the 'SmbActiveFilePath' model. Specifies a file path in an SMB view that has active sessions and opens. Attributes: active_sessions (list of SmbActiveSession): Specifies the sessions where the file is open. file_path (...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SmbActiveFilePath: """Implementation of the 'SmbActiveFilePath' model. Specifies a file path in an SMB view that has active sessions and opens. Attributes: active_sessions (list of SmbActiveSession): Specifies the sessions where the file is open. file_path (string): Specifies the filepath in the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SmbActiveFilePath: """Implementation of the 'SmbActiveFilePath' model. Specifies a file path in an SMB view that has active sessions and opens. Attributes: active_sessions (list of SmbActiveSession): Specifies the sessions where the file is open. file_path (string): Specifies the filepath in the view. view_id...
the_stack_v2_python_sparse
cohesity_management_sdk/models/smb_active_file_path.py
cohesity/management-sdk-python
train
24
ff9ddca5f5fcae922243d5a07ca737197b28eb38
[ "self.bridgeRotation = None\nself.rotatedLoopLayers = []\nself.sliceDictionary = None\nself.stopProcessing = False\nself.z = 0.0", "for loop in rotatedLoopLayer.loops:\n for pointIndex, point in enumerate(loop):\n loop[pointIndex] = complex(point.real, -point.imag)\ntriangle_mesh.sortLoopsInOrderOfArea(...
<|body_start_0|> self.bridgeRotation = None self.rotatedLoopLayers = [] self.sliceDictionary = None self.stopProcessing = False self.z = 0.0 <|end_body_0|> <|body_start_1|> for loop in rotatedLoopLayer.loops: for pointIndex, point in enumerate(loop): ...
An svg carving.
SVGReader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SVGReader: """An svg carving.""" def __init__(self): """Add empty lists.""" <|body_0|> def flipDirectLayer(self, rotatedLoopLayer): """Flip the y coordinate of the layer and direct the loops.""" <|body_1|> def getRotatedLoopLayer(self): """Re...
stack_v2_sparse_classes_75kplus_train_068702
39,231
no_license
[ { "docstring": "Add empty lists.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Flip the y coordinate of the layer and direct the loops.", "name": "flipDirectLayer", "signature": "def flipDirectLayer(self, rotatedLoopLayer)" }, { "docstring": "Return t...
6
stack_v2_sparse_classes_30k_train_024975
Implement the Python class `SVGReader` described below. Class description: An svg carving. Method signatures and docstrings: - def __init__(self): Add empty lists. - def flipDirectLayer(self, rotatedLoopLayer): Flip the y coordinate of the layer and direct the loops. - def getRotatedLoopLayer(self): Return the rotate...
Implement the Python class `SVGReader` described below. Class description: An svg carving. Method signatures and docstrings: - def __init__(self): Add empty lists. - def flipDirectLayer(self, rotatedLoopLayer): Flip the y coordinate of the layer and direct the loops. - def getRotatedLoopLayer(self): Return the rotate...
c1b00a76f1550df2cbb457248205159e51fd4308
<|skeleton|> class SVGReader: """An svg carving.""" def __init__(self): """Add empty lists.""" <|body_0|> def flipDirectLayer(self, rotatedLoopLayer): """Flip the y coordinate of the layer and direct the loops.""" <|body_1|> def getRotatedLoopLayer(self): """Re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SVGReader: """An svg carving.""" def __init__(self): """Add empty lists.""" self.bridgeRotation = None self.rotatedLoopLayers = [] self.sliceDictionary = None self.stopProcessing = False self.z = 0.0 def flipDirectLayer(self, rotatedLoopLayer): ...
the_stack_v2_python_sparse
fabmetheus_utilities/svg_reader.py
amsler/skeinforge
train
10
980de806b394bb46849606d7e27fdf360354e87e
[ "super().setUpTestData()\ncompanies = [Company(name=f'Company {idx}', description='Some company') for idx in range(3)]\nCompany.objects.bulk_create(companies)\ncontacts = []\nfor cmp in Company.objects.all():\n contacts += [Contact(company=cmp, name=f'My name {idx}') for idx in range(3)]\nContact.objects.bulk_cr...
<|body_start_0|> super().setUpTestData() companies = [Company(name=f'Company {idx}', description='Some company') for idx in range(3)] Company.objects.bulk_create(companies) contacts = [] for cmp in Company.objects.all(): contacts += [Contact(company=cmp, name=f'My nam...
Tests for the Contact models
ContactTest
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContactTest: """Tests for the Contact models""" def setUpTestData(cls): """Perform init for this test class""" <|body_0|> def test_list(self): """Test company list API endpoint""" <|body_1|> def test_create(self): """Test that we can create a...
stack_v2_sparse_classes_75kplus_train_068703
19,439
permissive
[ { "docstring": "Perform init for this test class", "name": "setUpTestData", "signature": "def setUpTestData(cls)" }, { "docstring": "Test company list API endpoint", "name": "test_list", "signature": "def test_list(self)" }, { "docstring": "Test that we can create a new Contact o...
5
stack_v2_sparse_classes_30k_train_026626
Implement the Python class `ContactTest` described below. Class description: Tests for the Contact models Method signatures and docstrings: - def setUpTestData(cls): Perform init for this test class - def test_list(self): Test company list API endpoint - def test_create(self): Test that we can create a new Contact ob...
Implement the Python class `ContactTest` described below. Class description: Tests for the Contact models Method signatures and docstrings: - def setUpTestData(cls): Perform init for this test class - def test_list(self): Test company list API endpoint - def test_create(self): Test that we can create a new Contact ob...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class ContactTest: """Tests for the Contact models""" def setUpTestData(cls): """Perform init for this test class""" <|body_0|> def test_list(self): """Test company list API endpoint""" <|body_1|> def test_create(self): """Test that we can create a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContactTest: """Tests for the Contact models""" def setUpTestData(cls): """Perform init for this test class""" super().setUpTestData() companies = [Company(name=f'Company {idx}', description='Some company') for idx in range(3)] Company.objects.bulk_create(companies) ...
the_stack_v2_python_sparse
InvenTree/company/test_api.py
inventree/InvenTree
train
3,077
9a6151d186696ce2c674c5597b0de29485b97c3a
[ "vir_head = ListNode(0)\nvir_head.next = head\npre = vir_head\ncur = pre.next\nwhile cur != None:\n if cur.val == val:\n pre.next = cur.next\n cur = cur.next\n else:\n pre.next = cur\n pre = cur\n cur = cur.next\nreturn vir_head.next", "vir_head = ListNode(0)\nvir_head.nex...
<|body_start_0|> vir_head = ListNode(0) vir_head.next = head pre = vir_head cur = pre.next while cur != None: if cur.val == val: pre.next = cur.next cur = cur.next else: pre.next = cur pre = c...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_0|> def removeElements_2(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_068704
1,299
permissive
[ { "docstring": ":type head: ListNode :type val: int :rtype: ListNode", "name": "removeElements", "signature": "def removeElements(self, head, val)" }, { "docstring": ":type head: ListNode :type val: int :rtype: ListNode", "name": "removeElements_2", "signature": "def removeElements_2(sel...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements(self, head, val): :type head: ListNode :type val: int :rtype: ListNode - def removeElements_2(self, head, val): :type head: ListNode :type val: int :rtype: Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElements(self, head, val): :type head: ListNode :type val: int :rtype: ListNode - def removeElements_2(self, head, val): :type head: ListNode :type val: int :rtype: Lis...
c06f3c86703b5ff7fd3e91e278ac69887a61eb66
<|skeleton|> class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_0|> def removeElements_2(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def removeElements(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" vir_head = ListNode(0) vir_head.next = head pre = vir_head cur = pre.next while cur != None: if cur.val == val: pre.next = cur.n...
the_stack_v2_python_sparse
05-linkedlist/leetcode_203.py
xiaolinzi-xl/Algorithm-Interview-Study
train
1
72630f0529a1064ca5f967a8b222bb8e1b0a9f9c
[ "res = ApiResponse('Error in getting anomalies')\nanomalies = Anomaly.objects.all()\ndata = AnomalySerializer(anomalies, many=True).data\nres.update(True, 'Successfully retrieved anomalies', data)\nreturn res", "res = ApiResponse('Error in getting specified anomaly')\nanomalyObj = Anomaly.objects.get(id=anomalyId...
<|body_start_0|> res = ApiResponse('Error in getting anomalies') anomalies = Anomaly.objects.all() data = AnomalySerializer(anomalies, many=True).data res.update(True, 'Successfully retrieved anomalies', data) return res <|end_body_0|> <|body_start_1|> res = ApiResponse(...
Class to deal with functionalities related to anomaly model
Anomalys
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Anomalys: """Class to deal with functionalities related to anomaly model""" def getAnomalys(): """Gets anomalys""" <|body_0|> def getAnomaly(anomalyId: int): """Gets anomaly :param anomalyId: id of anomaly to fetch""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_068705
1,562
permissive
[ { "docstring": "Gets anomalys", "name": "getAnomalys", "signature": "def getAnomalys()" }, { "docstring": "Gets anomaly :param anomalyId: id of anomaly to fetch", "name": "getAnomaly", "signature": "def getAnomaly(anomalyId: int)" } ]
2
stack_v2_sparse_classes_30k_train_015533
Implement the Python class `Anomalys` described below. Class description: Class to deal with functionalities related to anomaly model Method signatures and docstrings: - def getAnomalys(): Gets anomalys - def getAnomaly(anomalyId: int): Gets anomaly :param anomalyId: id of anomaly to fetch
Implement the Python class `Anomalys` described below. Class description: Class to deal with functionalities related to anomaly model Method signatures and docstrings: - def getAnomalys(): Gets anomalys - def getAnomaly(anomalyId: int): Gets anomaly :param anomalyId: id of anomaly to fetch <|skeleton|> class Anomaly...
a85a9f731442accefda8ae3e7f9fdf6304d0dc28
<|skeleton|> class Anomalys: """Class to deal with functionalities related to anomaly model""" def getAnomalys(): """Gets anomalys""" <|body_0|> def getAnomaly(anomalyId: int): """Gets anomaly :param anomalyId: id of anomaly to fetch""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Anomalys: """Class to deal with functionalities related to anomaly model""" def getAnomalys(): """Gets anomalys""" res = ApiResponse('Error in getting anomalies') anomalies = Anomaly.objects.all() data = AnomalySerializer(anomalies, many=True).data res.update(True,...
the_stack_v2_python_sparse
api/anomaly/services/anomalys.py
SHARANTANGEDA/CueObserve
train
0
ff6868c40b4bd30e0e3d2654f6f0ff7f5eb29cda
[ "try:\n dhcpController = DhcpController()\n json_data = json.dumps(dhcpController.get_dhcp_server_configuration_dns_domain_name())\n resp = Response(json_data, status=200, mimetype='application/json')\n return resp\nexcept ValueError as ve:\n return Response(json.dumps(str(ve)), status=404, mimetype=...
<|body_start_0|> try: dhcpController = DhcpController() json_data = json.dumps(dhcpController.get_dhcp_server_configuration_dns_domain_name()) resp = Response(json_data, status=200, mimetype='application/json') return resp except ValueError as ve: ...
DhcpServer_Configuration_Dns_DomainName
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DhcpServer_Configuration_Dns_DomainName: def get(self): """Gets the dns domain name parameter""" <|body_0|> def put(self): """Update the dns domain name parameter""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: dhcpController = Dhcp...
stack_v2_sparse_classes_75kplus_train_068706
20,424
no_license
[ { "docstring": "Gets the dns domain name parameter", "name": "get", "signature": "def get(self)" }, { "docstring": "Update the dns domain name parameter", "name": "put", "signature": "def put(self)" } ]
2
null
Implement the Python class `DhcpServer_Configuration_Dns_DomainName` described below. Class description: Implement the DhcpServer_Configuration_Dns_DomainName class. Method signatures and docstrings: - def get(self): Gets the dns domain name parameter - def put(self): Update the dns domain name parameter
Implement the Python class `DhcpServer_Configuration_Dns_DomainName` described below. Class description: Implement the DhcpServer_Configuration_Dns_DomainName class. Method signatures and docstrings: - def get(self): Gets the dns domain name parameter - def put(self): Update the dns domain name parameter <|skeleton|...
6070e3cb6bf957e04f5d8267db11f3296410e18e
<|skeleton|> class DhcpServer_Configuration_Dns_DomainName: def get(self): """Gets the dns domain name parameter""" <|body_0|> def put(self): """Update the dns domain name parameter""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DhcpServer_Configuration_Dns_DomainName: def get(self): """Gets the dns domain name parameter""" try: dhcpController = DhcpController() json_data = json.dumps(dhcpController.get_dhcp_server_configuration_dns_domain_name()) resp = Response(json_data, status=2...
the_stack_v2_python_sparse
configuration-agent/dhcp/rest_api/resources/dhcp_server.py
ReliableLion/frog4-configurable-vnf
train
0
10a599f1047d645372cff39a354fdff3e6ccd0ba
[ "@lru_cache(None)\ndef dfs(remain: int) -> int:\n if remain < 0:\n return INF\n if remain == 0:\n return 0\n res = INF\n for select in nums:\n if remain - select < 0:\n break\n res = min(res, 1 + dfs(remain - select))\n return res\nnums = []\nfor v in range(k, n...
<|body_start_0|> @lru_cache(None) def dfs(remain: int) -> int: if remain < 0: return INF if remain == 0: return 0 res = INF for select in nums: if remain - select < 0: break ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumNumbers(self, num: int, k: int) -> int: """完全背包""" <|body_0|> def minimumNumbers2(self, num: int, k: int) -> int: """枚举+数学 若多重集里有 n 个整数,那么这些整数之和为 (10*∑ai + n*k) 只要 (num - nk) 能被 10 整除且大等于 0,就存在一个大小为 n 的集合。返回最小的符合要求的 n 即可""" <|body_1|> <|...
stack_v2_sparse_classes_75kplus_train_068707
1,774
no_license
[ { "docstring": "完全背包", "name": "minimumNumbers", "signature": "def minimumNumbers(self, num: int, k: int) -> int" }, { "docstring": "枚举+数学 若多重集里有 n 个整数,那么这些整数之和为 (10*∑ai + n*k) 只要 (num - nk) 能被 10 整除且大等于 0,就存在一个大小为 n 的集合。返回最小的符合要求的 n 即可", "name": "minimumNumbers2", "signature": "def mini...
2
stack_v2_sparse_classes_30k_test_001662
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumNumbers(self, num: int, k: int) -> int: 完全背包 - def minimumNumbers2(self, num: int, k: int) -> int: 枚举+数学 若多重集里有 n 个整数,那么这些整数之和为 (10*∑ai + n*k) 只要 (num - nk) 能被 10 整除且大...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumNumbers(self, num: int, k: int) -> int: 完全背包 - def minimumNumbers2(self, num: int, k: int) -> int: 枚举+数学 若多重集里有 n 个整数,那么这些整数之和为 (10*∑ai + n*k) 只要 (num - nk) 能被 10 整除且大...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def minimumNumbers(self, num: int, k: int) -> int: """完全背包""" <|body_0|> def minimumNumbers2(self, num: int, k: int) -> int: """枚举+数学 若多重集里有 n 个整数,那么这些整数之和为 (10*∑ai + n*k) 只要 (num - nk) 能被 10 整除且大等于 0,就存在一个大小为 n 的集合。返回最小的符合要求的 n 即可""" <|body_1|> <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minimumNumbers(self, num: int, k: int) -> int: """完全背包""" @lru_cache(None) def dfs(remain: int) -> int: if remain < 0: return INF if remain == 0: return 0 res = INF for select in nums: ...
the_stack_v2_python_sparse
11_动态规划/背包问题/完全背包/5218. 个位数字为 K 的整数之和.py
981377660LMT/algorithm-study
train
225
2bac6ed7ad5e6163816a4eff3c7e019e96447a1e
[ "p, sk = ([0] * len(s), [])\nfor i, c in enumerate(s):\n if c == '(':\n sk.append(i)\n elif c == ')' and len(sk) > 0:\n p[sk.pop()] = 1\n p[i] = 1\ntmp, result = (0, 0)\nfor i in p:\n if i == 1:\n tmp += 1\n result = max(result, tmp)\n else:\n tmp = 0\nreturn re...
<|body_start_0|> p, sk = ([0] * len(s), []) for i, c in enumerate(s): if c == '(': sk.append(i) elif c == ')' and len(sk) > 0: p[sk.pop()] = 1 p[i] = 1 tmp, result = (0, 0) for i in p: if i == 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestValidParentheses(self, s: str) -> int: """1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度""" <|body_0|> def longestValidParentheses2(self, s: str) -> int: """1. 从左检索有效括号长度,当左括号等于右括号时,记录长度 2. 从右向左重复检索,避免出现()(()()这样的情况,导致误...
stack_v2_sparse_classes_75kplus_train_068708
2,505
no_license
[ { "docstring": "1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度", "name": "longestValidParentheses", "signature": "def longestValidParentheses(self, s: str) -> int" }, { "docstring": "1. 从左检索有效括号长度,当左括号等于右括号时,记录长度 2. 从右向左重复检索,避免出现()(()()这样的情况,导致误判", "name": "longest...
3
stack_v2_sparse_classes_30k_val_002273
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s: str) -> int: 1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度 - def longestValidParentheses2(self, s: str) -> int: 1...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s: str) -> int: 1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度 - def longestValidParentheses2(self, s: str) -> int: 1...
2e4edf7aa23eb094d713756a1ab53162ed467291
<|skeleton|> class Solution: def longestValidParentheses(self, s: str) -> int: """1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度""" <|body_0|> def longestValidParentheses2(self, s: str) -> int: """1. 从左检索有效括号长度,当左括号等于右括号时,记录长度 2. 从右向左重复检索,避免出现()(()()这样的情况,导致误...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestValidParentheses(self, s: str) -> int: """1. 将每个合理的括号标为1 a. 将每个(的位置加入栈 b. 如果)出现时,栈不为空,则栈顶取出位置和当前位置设为1 2. 寻找连续1的最大长度""" p, sk = ([0] * len(s), []) for i, c in enumerate(s): if c == '(': sk.append(i) elif c == ')' and len(sk) >...
the_stack_v2_python_sparse
dp/32-Longest_Valid_Parentheses.py
wangluolin/Algorithm-Everyday
train
0
7071b78909904506b624b084d9f2081fa9e30553
[ "name = data_utils.rand_name(self.__class__.__name__ + '-group-type')\ndescription = data_utils.rand_name('group-type-description')\ngroup_specs = {'consistent_group_snapshot_enabled': '<is> False'}\nparams = {'name': name, 'description': description, 'group_specs': group_specs, 'is_public': True}\nbody = self.admi...
<|body_start_0|> name = data_utils.rand_name(self.__class__.__name__ + '-group-type') description = data_utils.rand_name('group-type-description') group_specs = {'consistent_group_snapshot_enabled': '<is> False'} params = {'name': name, 'description': description, 'group_specs': group_sp...
Test group types
GroupTypesTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupTypesTest: """Test group types""" def test_group_type_create_list_update_show_delete(self): """Test create/list/update/show/delete group type""" <|body_0|> def test_group_type_list_by_optional_params(self): """Test list group type sort/public""" <|bo...
stack_v2_sparse_classes_75kplus_train_068709
4,922
permissive
[ { "docstring": "Test create/list/update/show/delete group type", "name": "test_group_type_create_list_update_show_delete", "signature": "def test_group_type_create_list_update_show_delete(self)" }, { "docstring": "Test list group type sort/public", "name": "test_group_type_list_by_optional_p...
2
stack_v2_sparse_classes_30k_train_001850
Implement the Python class `GroupTypesTest` described below. Class description: Test group types Method signatures and docstrings: - def test_group_type_create_list_update_show_delete(self): Test create/list/update/show/delete group type - def test_group_type_list_by_optional_params(self): Test list group type sort/p...
Implement the Python class `GroupTypesTest` described below. Class description: Test group types Method signatures and docstrings: - def test_group_type_create_list_update_show_delete(self): Test create/list/update/show/delete group type - def test_group_type_list_by_optional_params(self): Test list group type sort/p...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class GroupTypesTest: """Test group types""" def test_group_type_create_list_update_show_delete(self): """Test create/list/update/show/delete group type""" <|body_0|> def test_group_type_list_by_optional_params(self): """Test list group type sort/public""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GroupTypesTest: """Test group types""" def test_group_type_create_list_update_show_delete(self): """Test create/list/update/show/delete group type""" name = data_utils.rand_name(self.__class__.__name__ + '-group-type') description = data_utils.rand_name('group-type-description') ...
the_stack_v2_python_sparse
tempest/api/volume/admin/test_group_types.py
openstack/tempest
train
270
84d433b6dc3fd54d5577ab5a26ae6b174090334f
[ "iocs = OrderedDict()\nif os.path.isfile(path):\n root = parse_xml_removing_namespace(path)\n OptionsLoader._options_from_xml(root, iocs)\nelse:\n print_and_log('Cannot find config path: ' + str(path), 'MINOR')\nreturn iocs", "for ioc in root_xml.findall('./' + TAG_IOC_CONFIG):\n name = ioc.attrib[TAG...
<|body_start_0|> iocs = OrderedDict() if os.path.isfile(path): root = parse_xml_removing_namespace(path) OptionsLoader._options_from_xml(root, iocs) else: print_and_log('Cannot find config path: ' + str(path), 'MINOR') return iocs <|end_body_0|> <|bod...
OptionsLoader
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionsLoader: def get_options(path: str) -> OrderedDict: """Loads the IOC options from file and converts them into IocOptions objects Args: path: The path to the xml file to be loaded Returns: An ordered dict of IOCs and their associated options""" <|body_0|> def _options_f...
stack_v2_sparse_classes_75kplus_train_068710
3,596
permissive
[ { "docstring": "Loads the IOC options from file and converts them into IocOptions objects Args: path: The path to the xml file to be loaded Returns: An ordered dict of IOCs and their associated options", "name": "get_options", "signature": "def get_options(path: str) -> OrderedDict" }, { "docstr...
2
stack_v2_sparse_classes_30k_train_015381
Implement the Python class `OptionsLoader` described below. Class description: Implement the OptionsLoader class. Method signatures and docstrings: - def get_options(path: str) -> OrderedDict: Loads the IOC options from file and converts them into IocOptions objects Args: path: The path to the xml file to be loaded R...
Implement the Python class `OptionsLoader` described below. Class description: Implement the OptionsLoader class. Method signatures and docstrings: - def get_options(path: str) -> OrderedDict: Loads the IOC options from file and converts them into IocOptions objects Args: path: The path to the xml file to be loaded R...
2e605cbff1cfe071571a64bed61708d8c92dc204
<|skeleton|> class OptionsLoader: def get_options(path: str) -> OrderedDict: """Loads the IOC options from file and converts them into IocOptions objects Args: path: The path to the xml file to be loaded Returns: An ordered dict of IOCs and their associated options""" <|body_0|> def _options_f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OptionsLoader: def get_options(path: str) -> OrderedDict: """Loads the IOC options from file and converts them into IocOptions objects Args: path: The path to the xml file to be loaded Returns: An ordered dict of IOCs and their associated options""" iocs = OrderedDict() if os.path.isfi...
the_stack_v2_python_sparse
DatabaseServer/options_loader.py
ISISComputingGroup/EPICS-inst_servers
train
1
385ed474b5b4d52ee05209b2dd9b62718e81d358
[ "self.label = label\nself.subsample_factor = 1 if subsample_factor is None else subsample_factor\nself.items = []\nself.i = 0", "item = (self.i, x)\nif self.subsample_factor == 1 or self.i % self.subsample_factor == 1 or (not self.items):\n self.items.append(item)\nelse:\n self.items[-1] = item\nself.i += 1...
<|body_start_0|> self.label = label self.subsample_factor = 1 if subsample_factor is None else subsample_factor self.items = [] self.i = 0 <|end_body_0|> <|body_start_1|> item = (self.i, x) if self.subsample_factor == 1 or self.i % self.subsample_factor == 1 or (not self...
A section in the Logging structure.
_Section
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Section: """A section in the Logging structure.""" def __init__(self, label, subsample_factor=None): """Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample logging in this section.""" <|body_0|> def log(...
stack_v2_sparse_classes_75kplus_train_068711
3,542
permissive
[ { "docstring": "Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample logging in this section.", "name": "__init__", "signature": "def __init__(self, label, subsample_factor=None)" }, { "docstring": "Add a record to the log.", ...
2
stack_v2_sparse_classes_30k_train_022298
Implement the Python class `_Section` described below. Class description: A section in the Logging structure. Method signatures and docstrings: - def __init__(self, label, subsample_factor=None): Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample log...
Implement the Python class `_Section` described below. Class description: A section in the Logging structure. Method signatures and docstrings: - def __init__(self, label, subsample_factor=None): Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample log...
548dc4e2e6a8e3ac65e1921bd94fe589d661d47b
<|skeleton|> class _Section: """A section in the Logging structure.""" def __init__(self, label, subsample_factor=None): """Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample logging in this section.""" <|body_0|> def log(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _Section: """A section in the Logging structure.""" def __init__(self, label, subsample_factor=None): """Initialize a Section instance. Args: label: A short name for the section. subsample_factor: Rate at which to subsample logging in this section.""" self.label = label self.subsa...
the_stack_v2_python_sparse
magenta/models/coconet/lib_logging.py
magenta/magenta
train
4,142
31cfea88cf842b76a0821c4ce248d64a3db93cdd
[ "p = Path(basepath)\npairs = [(f, p / target_dir / f.name) for f in chain(*((p / source_dir).glob(pattern) for source_dir in source_dirs))]\nlen(pairs) > 0 or _raise(FileNotFoundError(\"Didn't find any images.\"))\nconsume((t.exists() or _raise(FileNotFoundError(t)) for s, t in pairs))\naxes = axes_check_and_normal...
<|body_start_0|> p = Path(basepath) pairs = [(f, p / target_dir / f.name) for f in chain(*((p / source_dir).glob(pattern) for source_dir in source_dirs))] len(pairs) > 0 or _raise(FileNotFoundError("Didn't find any images.")) consume((t.exists() or _raise(FileNotFoundError(t)) for s, t i...
:func:`collections.namedtuple` with three fields: `generator`, `size`, and `description`. Parameters ---------- generator : function Function without arguments that returns a generator that yields tuples `(x,y,axes,mask)`, where `x` is a source image (e.g., with low SNR) with `y` being the corresponding target image (e...
RawData
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RawData: """:func:`collections.namedtuple` with three fields: `generator`, `size`, and `description`. Parameters ---------- generator : function Function without arguments that returns a generator that yields tuples `(x,y,axes,mask)`, where `x` is a source image (e.g., with low SNR) with `y` bein...
stack_v2_sparse_classes_75kplus_train_068712
4,548
permissive
[ { "docstring": "Get pairs of corresponding TIFF images read from folders. Two images correspond to each other if they have the same file name, but are located in different folders. Parameters ---------- basepath : str Base folder that contains sub-folders with images. source_dirs : list or tuple List of folder ...
2
stack_v2_sparse_classes_30k_train_048224
Implement the Python class `RawData` described below. Class description: :func:`collections.namedtuple` with three fields: `generator`, `size`, and `description`. Parameters ---------- generator : function Function without arguments that returns a generator that yields tuples `(x,y,axes,mask)`, where `x` is a source i...
Implement the Python class `RawData` described below. Class description: :func:`collections.namedtuple` with three fields: `generator`, `size`, and `description`. Parameters ---------- generator : function Function without arguments that returns a generator that yields tuples `(x,y,axes,mask)`, where `x` is a source i...
f95b1c5e7da326d21ad7ee50ccd306a98d23f718
<|skeleton|> class RawData: """:func:`collections.namedtuple` with three fields: `generator`, `size`, and `description`. Parameters ---------- generator : function Function without arguments that returns a generator that yields tuples `(x,y,axes,mask)`, where `x` is a source image (e.g., with low SNR) with `y` bein...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RawData: """:func:`collections.namedtuple` with three fields: `generator`, `size`, and `description`. Parameters ---------- generator : function Function without arguments that returns a generator that yields tuples `(x,y,axes,mask)`, where `x` is a source image (e.g., with low SNR) with `y` being the corresp...
the_stack_v2_python_sparse
csbdeep/data/rawdata.py
CSBDeep/CSBDeep
train
250
8131dbb87c711c96a17da98b9d6f4f43683d7d40
[ "super(MudderyEquipment, self).after_data_loaded()\nself.load_custom_attributes(EQUIPMENT_ATTRIBUTES_INFO)\nself.type = getattr(self.dfield, 'type', '')\nself.position = getattr(self.dfield, 'position', '')", "if not user:\n return\nfor key in self.custom_attributes_handler.all():\n if hasattr(user, key):\n...
<|body_start_0|> super(MudderyEquipment, self).after_data_loaded() self.load_custom_attributes(EQUIPMENT_ATTRIBUTES_INFO) self.type = getattr(self.dfield, 'type', '') self.position = getattr(self.dfield, 'position', '') <|end_body_0|> <|body_start_1|> if not user: re...
This is a equipment. Players can equip it to change their properties, such as attack, defence, etc.
MudderyEquipment
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MudderyEquipment: """This is a equipment. Players can equip it to change their properties, such as attack, defence, etc.""" def after_data_loaded(self): """Load equipments data.""" <|body_0|> def equip_to(self, user): """Equip this equipment to the user. It is ca...
stack_v2_sparse_classes_75kplus_train_068713
9,598
permissive
[ { "docstring": "Load equipments data.", "name": "after_data_loaded", "signature": "def after_data_loaded(self)" }, { "docstring": "Equip this equipment to the user. It is called when a character equip this equipment. This implementation uses the simplest way to add equipment effects to the user....
3
stack_v2_sparse_classes_30k_train_011673
Implement the Python class `MudderyEquipment` described below. Class description: This is a equipment. Players can equip it to change their properties, such as attack, defence, etc. Method signatures and docstrings: - def after_data_loaded(self): Load equipments data. - def equip_to(self, user): Equip this equipment ...
Implement the Python class `MudderyEquipment` described below. Class description: This is a equipment. Players can equip it to change their properties, such as attack, defence, etc. Method signatures and docstrings: - def after_data_loaded(self): Load equipments data. - def equip_to(self, user): Equip this equipment ...
a915e2700bfa5f5142818402825f6791cd50fac1
<|skeleton|> class MudderyEquipment: """This is a equipment. Players can equip it to change their properties, such as attack, defence, etc.""" def after_data_loaded(self): """Load equipments data.""" <|body_0|> def equip_to(self, user): """Equip this equipment to the user. It is ca...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MudderyEquipment: """This is a equipment. Players can equip it to change their properties, such as attack, defence, etc.""" def after_data_loaded(self): """Load equipments data.""" super(MudderyEquipment, self).after_data_loaded() self.load_custom_attributes(EQUIPMENT_ATTRIBUTES_I...
the_stack_v2_python_sparse
muddery/typeclasses/common_objects.py
blongz/muddery
train
1
17d6169090f2bcd7b73f08bb21894e3c940a14ee
[ "nodes_used_final = 0\ncores_used = gpus_used = nodes_used = 0\nfor nsets, tasks, cpus_per_task, gpus in resource_sets:\n if not parallel:\n cores_used = gpus_used = nodes_used = 0\n for _ in range(nsets):\n cores_used += tasks * cpus_per_task\n gpus_used += gpus\n while cores_used...
<|body_start_0|> nodes_used_final = 0 cores_used = gpus_used = nodes_used = 0 for nsets, tasks, cpus_per_task, gpus in resource_sets: if not parallel: cores_used = gpus_used = nodes_used = 0 for _ in range(nsets): cores_used += tasks * cpus...
Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args": '--smpiargs="-gpu"', # extra jsrun arguments }) def my_operation(job): ... https:/...
SummitEnvironment
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SummitEnvironment: """Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args": '--smpiargs="-gpu"', # extra jsrun ar...
stack_v2_sparse_classes_75kplus_train_068714
10,994
permissive
[ { "docstring": "Compute the number of nodes needed. Parameters ---------- resource_sets : iterable of tuples Resource sets for each operation, as a sequence of tuples of *(Number of resource sets, tasks (MPI Ranks) per resource set, physical cores (CPUs) per resource set, GPUs per resource set)*. parallel : boo...
4
stack_v2_sparse_classes_30k_train_019562
Implement the Python class `SummitEnvironment` described below. Class description: Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args"...
Implement the Python class `SummitEnvironment` described below. Class description: Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args"...
845865c5f34135243ac21800495c46c915662c64
<|skeleton|> class SummitEnvironment: """Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args": '--smpiargs="-gpu"', # extra jsrun ar...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SummitEnvironment: """Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args": '--smpiargs="-gpu"', # extra jsrun arguments }) de...
the_stack_v2_python_sparse
flow/environments/incite.py
glotzerlab/signac-flow
train
54
98b0eabfdfaea3681517952221d7304c61f69421
[ "in_ports = [IOPort('opcode', 'address', 'in', 8, False)]\nreg_w_port = IOPort('reg-w-con', 'control', 'out', 1, False)\nwrt_src_port = IOPort('wrt-src', 'control', 'out', 1, False)\nbranch_port = IOPort('branch', 'control', 'out', 1, False)\nmem_w_port = IOPort('mem-w', 'control', 'out', 1, False)\nalu_a_port = IO...
<|body_start_0|> in_ports = [IOPort('opcode', 'address', 'in', 8, False)] reg_w_port = IOPort('reg-w-con', 'control', 'out', 1, False) wrt_src_port = IOPort('wrt-src', 'control', 'out', 1, False) branch_port = IOPort('branch', 'control', 'out', 1, False) mem_w_port = IOPort('mem-...
A class to represent a control unit that extends Component. This class is a functional logic component that splits an opcode into its control bits. Attributes: data (List[Signal]): the control bits corresponding to each opcode
ControlUnit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControlUnit: """A class to represent a control unit that extends Component. This class is a functional logic component that splits an opcode into its control bits. Attributes: data (List[Signal]): the control bits corresponding to each opcode""" def __init__(self): """Initialize Cont...
stack_v2_sparse_classes_75kplus_train_068715
2,656
no_license
[ { "docstring": "Initialize ControlUnit object and extend Component.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Execute the control unit's function logic. The control unit splits an opcode into its control bits.", "name": "_execute", "signature": "def _exec...
2
null
Implement the Python class `ControlUnit` described below. Class description: A class to represent a control unit that extends Component. This class is a functional logic component that splits an opcode into its control bits. Attributes: data (List[Signal]): the control bits corresponding to each opcode Method signatu...
Implement the Python class `ControlUnit` described below. Class description: A class to represent a control unit that extends Component. This class is a functional logic component that splits an opcode into its control bits. Attributes: data (List[Signal]): the control bits corresponding to each opcode Method signatu...
0b360801545e459d616b35435788fddbb958a626
<|skeleton|> class ControlUnit: """A class to represent a control unit that extends Component. This class is a functional logic component that splits an opcode into its control bits. Attributes: data (List[Signal]): the control bits corresponding to each opcode""" def __init__(self): """Initialize Cont...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ControlUnit: """A class to represent a control unit that extends Component. This class is a functional logic component that splits an opcode into its control bits. Attributes: data (List[Signal]): the control bits corresponding to each opcode""" def __init__(self): """Initialize ControlUnit objec...
the_stack_v2_python_sparse
components/controlunit.py
bwiswell/py-virpu
train
1
8cd74387efc4f22d2f87d593f76d5ba5800143fe
[ "self.filters = filters\nself.sdb = search_db\nself.atomate_collection = getattr(search_db.database, task_collection)\nself.raw_documents = []\nif extra_projections is None:\n extra_projections = []\nself.projection = list(self.BASE_PROJECTION)\nself.projection.extend(extra_projections)", "records = []\nat_col...
<|body_start_0|> self.filters = filters self.sdb = search_db self.atomate_collection = getattr(search_db.database, task_collection) self.raw_documents = [] if extra_projections is None: extra_projections = [] self.projection = list(self.BASE_PROJECTION) ...
Collect the useful data from atomate task document into a dataframe
DataCollector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataCollector: """Collect the useful data from atomate task document into a dataframe""" def __init__(self, search_db: SearchDB, filters: dict, extra_projections=None, task_collection='atomate_tasks'): """Instantiate a data collector object. Args: search_db (SearchDB): A `SearchDB` i...
stack_v2_sparse_classes_75kplus_train_068716
9,330
permissive
[ { "docstring": "Instantiate a data collector object. Args: search_db (SearchDB): A `SearchDB` instance filters (dict): filters to be used for the `find` method. projection (optional, list): A list of properties to be projected", "name": "__init__", "signature": "def __init__(self, search_db: SearchDB, f...
2
stack_v2_sparse_classes_30k_val_001453
Implement the Python class `DataCollector` described below. Class description: Collect the useful data from atomate task document into a dataframe Method signatures and docstrings: - def __init__(self, search_db: SearchDB, filters: dict, extra_projections=None, task_collection='atomate_tasks'): Instantiate a data col...
Implement the Python class `DataCollector` described below. Class description: Collect the useful data from atomate task document into a dataframe Method signatures and docstrings: - def __init__(self, search_db: SearchDB, filters: dict, extra_projections=None, task_collection='atomate_tasks'): Instantiate a data col...
eb0338f5e326a41ed9aa944ee25c283fa99afa02
<|skeleton|> class DataCollector: """Collect the useful data from atomate task document into a dataframe""" def __init__(self, search_db: SearchDB, filters: dict, extra_projections=None, task_collection='atomate_tasks'): """Instantiate a data collector object. Args: search_db (SearchDB): A `SearchDB` i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataCollector: """Collect the useful data from atomate task document into a dataframe""" def __init__(self, search_db: SearchDB, filters: dict, extra_projections=None, task_collection='atomate_tasks'): """Instantiate a data collector object. Args: search_db (SearchDB): A `SearchDB` instance filte...
the_stack_v2_python_sparse
disp/analysis/gather.py
zhubonan/disp
train
3
a02132ea93d5fbe5b78ae5edef17ec9ee8b2ab7b
[ "super().__init__(*args, category=CATEGORY_ALARM_SYSTEM)\nstate = self.hass.states.get(self.entity_id)\nself._alarm_code = self.config.get(ATTR_CODE)\nsupported_states = state.attributes.get(ATTR_SUPPORTED_FEATURES, AlarmControlPanelEntityFeature.ARM_HOME | AlarmControlPanelEntityFeature.ARM_VACATION | AlarmControl...
<|body_start_0|> super().__init__(*args, category=CATEGORY_ALARM_SYSTEM) state = self.hass.states.get(self.entity_id) self._alarm_code = self.config.get(ATTR_CODE) supported_states = state.attributes.get(ATTR_SUPPORTED_FEATURES, AlarmControlPanelEntityFeature.ARM_HOME | AlarmControlPanel...
Generate an SecuritySystem accessory for an alarm control panel.
SecuritySystem
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SecuritySystem: """Generate an SecuritySystem accessory for an alarm control panel.""" def __init__(self, *args): """Initialize a SecuritySystem accessory object.""" <|body_0|> def set_security_state(self, value): """Move security state to value if call came from...
stack_v2_sparse_classes_75kplus_train_068717
6,124
permissive
[ { "docstring": "Initialize a SecuritySystem accessory object.", "name": "__init__", "signature": "def __init__(self, *args)" }, { "docstring": "Move security state to value if call came from HomeKit.", "name": "set_security_state", "signature": "def set_security_state(self, value)" }, ...
3
stack_v2_sparse_classes_30k_train_052564
Implement the Python class `SecuritySystem` described below. Class description: Generate an SecuritySystem accessory for an alarm control panel. Method signatures and docstrings: - def __init__(self, *args): Initialize a SecuritySystem accessory object. - def set_security_state(self, value): Move security state to va...
Implement the Python class `SecuritySystem` described below. Class description: Generate an SecuritySystem accessory for an alarm control panel. Method signatures and docstrings: - def __init__(self, *args): Initialize a SecuritySystem accessory object. - def set_security_state(self, value): Move security state to va...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SecuritySystem: """Generate an SecuritySystem accessory for an alarm control panel.""" def __init__(self, *args): """Initialize a SecuritySystem accessory object.""" <|body_0|> def set_security_state(self, value): """Move security state to value if call came from...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SecuritySystem: """Generate an SecuritySystem accessory for an alarm control panel.""" def __init__(self, *args): """Initialize a SecuritySystem accessory object.""" super().__init__(*args, category=CATEGORY_ALARM_SYSTEM) state = self.hass.states.get(self.entity_id) self._...
the_stack_v2_python_sparse
homeassistant/components/homekit/type_security_systems.py
home-assistant/core
train
35,501
7bd26e1eee0aa33a2e1b1d73f082b456d2cd8963
[ "self.xls_name = xls_name\nself.sheet_name = sheet_name\nself.path = path", "index = len(title)\nworkbook = xlwt.Workbook()\nsheet = workbook.add_sheet(self.sheet_name)\nfor i in range(0, index):\n for j in range(0, len(title[i])):\n sheet.write(i, j, title[i][j])\nworkbook.save(self.path)\nprint('表格模板创...
<|body_start_0|> self.xls_name = xls_name self.sheet_name = sheet_name self.path = path <|end_body_0|> <|body_start_1|> index = len(title) workbook = xlwt.Workbook() sheet = workbook.add_sheet(self.sheet_name) for i in range(0, index): for j in range(...
MakeExcel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MakeExcel: def __init__(self, xls_name, sheet_name, path): """实例化接收三个参数 :param xls_name: 字符串,excel文件的名称 :param sheet_name: 字符串,sheet表格的名称 :param path: 字符串,操作路径""" <|body_0|> def make_base_excel(self, title): """创建一个空表格模板并保存到excel文件中 :param title: 只接收列表嵌套列表,表格字段名称 :re...
stack_v2_sparse_classes_75kplus_train_068718
2,962
no_license
[ { "docstring": "实例化接收三个参数 :param xls_name: 字符串,excel文件的名称 :param sheet_name: 字符串,sheet表格的名称 :param path: 字符串,操作路径", "name": "__init__", "signature": "def __init__(self, xls_name, sheet_name, path)" }, { "docstring": "创建一个空表格模板并保存到excel文件中 :param title: 只接收列表嵌套列表,表格字段名称 :return: None", "name"...
5
stack_v2_sparse_classes_30k_train_006525
Implement the Python class `MakeExcel` described below. Class description: Implement the MakeExcel class. Method signatures and docstrings: - def __init__(self, xls_name, sheet_name, path): 实例化接收三个参数 :param xls_name: 字符串,excel文件的名称 :param sheet_name: 字符串,sheet表格的名称 :param path: 字符串,操作路径 - def make_base_excel(self, ti...
Implement the Python class `MakeExcel` described below. Class description: Implement the MakeExcel class. Method signatures and docstrings: - def __init__(self, xls_name, sheet_name, path): 实例化接收三个参数 :param xls_name: 字符串,excel文件的名称 :param sheet_name: 字符串,sheet表格的名称 :param path: 字符串,操作路径 - def make_base_excel(self, ti...
686032a9faac846530655ddf3cb90121d0ebe7a0
<|skeleton|> class MakeExcel: def __init__(self, xls_name, sheet_name, path): """实例化接收三个参数 :param xls_name: 字符串,excel文件的名称 :param sheet_name: 字符串,sheet表格的名称 :param path: 字符串,操作路径""" <|body_0|> def make_base_excel(self, title): """创建一个空表格模板并保存到excel文件中 :param title: 只接收列表嵌套列表,表格字段名称 :re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MakeExcel: def __init__(self, xls_name, sheet_name, path): """实例化接收三个参数 :param xls_name: 字符串,excel文件的名称 :param sheet_name: 字符串,sheet表格的名称 :param path: 字符串,操作路径""" self.xls_name = xls_name self.sheet_name = sheet_name self.path = path def make_base_excel(self, title): ...
the_stack_v2_python_sparse
存储模块封装_1.0/utils/excel.py
xuxh21/demo
train
0
230d9e790fa1a4451b9f05311212c422ba79189b
[ "self.warmup_epochs = warmup_epochs\nself.max_epochs = max_epochs\nself.warmup_start_lr = warmup_start_lr\nself.eta_min = eta_min\nsuper().__init__(optimizer, last_epoch)", "if not self._get_lr_called_within_step:\n warnings.warn('To get the last learning rate computed by the scheduler, please use `get_last_lr...
<|body_start_0|> self.warmup_epochs = warmup_epochs self.max_epochs = max_epochs self.warmup_start_lr = warmup_start_lr self.eta_min = eta_min super().__init__(optimizer, last_epoch) <|end_body_0|> <|body_start_1|> if not self._get_lr_called_within_step: warn...
Sets the learning rate of each parameter group to follow a linear warmup schedule between warmup_start_lr and base_lr followed by a cosine annealing schedule between base_lr and eta_min.
LinearWarmupCosineAnnealingLR
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinearWarmupCosineAnnealingLR: """Sets the learning rate of each parameter group to follow a linear warmup schedule between warmup_start_lr and base_lr followed by a cosine annealing schedule between base_lr and eta_min.""" def __init__(self, optimizer: Optimizer, warmup_epochs: int, max_epo...
stack_v2_sparse_classes_75kplus_train_068719
3,997
permissive
[ { "docstring": "Args: optimizer (Optimizer): Wrapped optimizer. warmup_epochs (int): Maximum number of iterations for linear warmup max_epochs (int): Maximum number of iterations warmup_start_lr (float): Learning rate to start the linear warmup. Default: 0. eta_min (float): Minimum learning rate. Default: 0. la...
3
stack_v2_sparse_classes_30k_train_022119
Implement the Python class `LinearWarmupCosineAnnealingLR` described below. Class description: Sets the learning rate of each parameter group to follow a linear warmup schedule between warmup_start_lr and base_lr followed by a cosine annealing schedule between base_lr and eta_min. Method signatures and docstrings: - ...
Implement the Python class `LinearWarmupCosineAnnealingLR` described below. Class description: Sets the learning rate of each parameter group to follow a linear warmup schedule between warmup_start_lr and base_lr followed by a cosine annealing schedule between base_lr and eta_min. Method signatures and docstrings: - ...
b199b45fbd895e254cedfb0d3572661f32bf1cff
<|skeleton|> class LinearWarmupCosineAnnealingLR: """Sets the learning rate of each parameter group to follow a linear warmup schedule between warmup_start_lr and base_lr followed by a cosine annealing schedule between base_lr and eta_min.""" def __init__(self, optimizer: Optimizer, warmup_epochs: int, max_epo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LinearWarmupCosineAnnealingLR: """Sets the learning rate of each parameter group to follow a linear warmup schedule between warmup_start_lr and base_lr followed by a cosine annealing schedule between base_lr and eta_min.""" def __init__(self, optimizer: Optimizer, warmup_epochs: int, max_epochs: int, war...
the_stack_v2_python_sparse
src/climate_learn/models/lr_scheduler.py
aditya-grover/climate-learn
train
232
9ab1cfe79d6bc45b22124f9e4e3451b5fec51767
[ "self.auctioneer = Auctioneer()\nfor bidder in bidders:\n self.auctioneer.register_bidder(bidder)", "print(f'Auctioning {item} starting at {start_price}')\nself.auctioneer.set_highest_bid(start_price)\nself.auctioneer.begin_auction()\nauction_result = {x.get_name(): x.get_highest_bid() for x in self.auctioneer...
<|body_start_0|> self.auctioneer = Auctioneer() for bidder in bidders: self.auctioneer.register_bidder(bidder) <|end_body_0|> <|body_start_1|> print(f'Auctioning {item} starting at {start_price}') self.auctioneer.set_highest_bid(start_price) self.auctioneer.begin_auc...
Simulates an auction. Is responsible for driving the auctioneer and the bidders.
Auction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Auction: """Simulates an auction. Is responsible for driving the auctioneer and the bidders.""" def __init__(self, bidders): """Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence type of objects of type Bidder""" ...
stack_v2_sparse_classes_75kplus_train_068720
8,798
no_license
[ { "docstring": "Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence type of objects of type Bidder", "name": "__init__", "signature": "def __init__(self, bidders)" }, { "docstring": "Starts the auction for the given item at the g...
2
stack_v2_sparse_classes_30k_train_034312
Implement the Python class `Auction` described below. Class description: Simulates an auction. Is responsible for driving the auctioneer and the bidders. Method signatures and docstrings: - def __init__(self, bidders): Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :para...
Implement the Python class `Auction` described below. Class description: Simulates an auction. Is responsible for driving the auctioneer and the bidders. Method signatures and docstrings: - def __init__(self, bidders): Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :para...
c25009c0dd19de18706ff21fe5610c77c5cd89cf
<|skeleton|> class Auction: """Simulates an auction. Is responsible for driving the auctioneer and the bidders.""" def __init__(self, bidders): """Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence type of objects of type Bidder""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Auction: """Simulates an auction. Is responsible for driving the auctioneer and the bidders.""" def __init__(self, bidders): """Initialize an auction. Requires a list of bidders that are attending the auction and can bid. :param bidders: sequence type of objects of type Bidder""" self.auc...
the_stack_v2_python_sparse
Labs/Lab6/auction_simulator.py
gonuxxiv/3522_A01200216
train
0
adbf410bd5c87415c82ffabead0805a0846f1089
[ "d = set()\nfor i in nums:\n if i in d:\n return True\n else:\n d.add(i)\nreturn False", "if len(nums) == 0:\n return False\nnums.sort()\nfor i in range(0, len(nums) - 1):\n if nums[i] == nums[i + 1]:\n return True\nreturn False" ]
<|body_start_0|> d = set() for i in nums: if i in d: return True else: d.add(i) return False <|end_body_0|> <|body_start_1|> if len(nums) == 0: return False nums.sort() for i in range(0, len(nums) - 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def containsDuplicate2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = set() for i in num...
stack_v2_sparse_classes_75kplus_train_068721
1,137
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "containsDuplicate", "signature": "def containsDuplicate(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "containsDuplicate2", "signature": "def containsDuplicate2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_025987
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate(self, nums): :type nums: List[int] :rtype: bool - def containsDuplicate2(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsDuplicate(self, nums): :type nums: List[int] :rtype: bool - def containsDuplicate2(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: ...
813235789ce422a3bab198317aafc46fbc61625e
<|skeleton|> class Solution: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def containsDuplicate2(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def containsDuplicate(self, nums): """:type nums: List[int] :rtype: bool""" d = set() for i in nums: if i in d: return True else: d.add(i) return False def containsDuplicate2(self, nums): """:type nu...
the_stack_v2_python_sparse
2.SET/e217_contains_duplicate/solution.py
kimmyoo/python_leetcode
train
1
121b8270efe1f92749162bc7dec3322a14edca88
[ "product = self.getProduct()\nif product:\n return product.Title()\nelse:\n return ''", "price = self.getPrice()\nif price:\n return self.getPrice() * self.getQuantity()\nelse:\n return 0", "price = self.getPrice()\nquantity = self.getQuantity()\nvat = self.getVAT()\nif price and quantity and vat:\n...
<|body_start_0|> product = self.getProduct() if product: return product.Title() else: return '' <|end_body_0|> <|body_start_1|> price = self.getPrice() if price: return self.getPrice() * self.getQuantity() else: return 0 <|...
SupplyOrderItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SupplyOrderItem: def Title(self): """Return the Product as title""" <|body_0|> def getTotal(self): """compute total excluding VAT""" <|body_1|> def getTotalIncludingVAT(self): """Compute Total including VAT""" <|body_2|> <|end_skeleton|>...
stack_v2_sparse_classes_75kplus_train_068722
2,229
no_license
[ { "docstring": "Return the Product as title", "name": "Title", "signature": "def Title(self)" }, { "docstring": "compute total excluding VAT", "name": "getTotal", "signature": "def getTotal(self)" }, { "docstring": "Compute Total including VAT", "name": "getTotalIncludingVAT"...
3
stack_v2_sparse_classes_30k_test_002804
Implement the Python class `SupplyOrderItem` described below. Class description: Implement the SupplyOrderItem class. Method signatures and docstrings: - def Title(self): Return the Product as title - def getTotal(self): compute total excluding VAT - def getTotalIncludingVAT(self): Compute Total including VAT
Implement the Python class `SupplyOrderItem` described below. Class description: Implement the SupplyOrderItem class. Method signatures and docstrings: - def Title(self): Return the Product as title - def getTotal(self): compute total excluding VAT - def getTotalIncludingVAT(self): Compute Total including VAT <|skel...
5516a36dbbc5578d4a9160c5023db12f58807609
<|skeleton|> class SupplyOrderItem: def Title(self): """Return the Product as title""" <|body_0|> def getTotal(self): """compute total excluding VAT""" <|body_1|> def getTotalIncludingVAT(self): """Compute Total including VAT""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SupplyOrderItem: def Title(self): """Return the Product as title""" product = self.getProduct() if product: return product.Title() else: return '' def getTotal(self): """compute total excluding VAT""" price = self.getPrice() ...
the_stack_v2_python_sparse
bika/lims/content/supplyorderitem.py
lemoene/Bika-LIMS
train
1
bcc6401a6c5c35880da58fa9adb58accfcc0368a
[ "context = super().get_context_data()\ncontext['is_edit'] = False\ncontext['course_form'] = context['form']\nreturn context", "if '_mark_updated' in self.request.POST:\n form.instance.updated_associations = True\nform.save(commit=True)\nstudy = Study.objects.get(pk=self.kwargs['pk'])\ncourse = Course.objects.g...
<|body_start_0|> context = super().get_context_data() context['is_edit'] = False context['course_form'] = context['form'] return context <|end_body_0|> <|body_start_1|> if '_mark_updated' in self.request.POST: form.instance.updated_associations = True form.sa...
Class for the creation of Courses, this view automatically ties the course to the study it was called from
CourseCreateView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CourseCreateView: """Class for the creation of Courses, this view automatically ties the course to the study it was called from""" def get_context_data(self, **kwargs: Dict[str, Any]) -> Dict[str, Any]: """Gets a bit extra context data because form-template is shared with update view...
stack_v2_sparse_classes_75kplus_train_068723
31,122
permissive
[ { "docstring": "Gets a bit extra context data because form-template is shared with update view. Extra parts: context['is_edit'] -> Bool, always False in this view context['course_form'] -> Rename of form, prevents confusion :param kwargs: Kwargs as given by URL, see URL Listing :return: context dictionary", ...
2
stack_v2_sparse_classes_30k_train_011662
Implement the Python class `CourseCreateView` described below. Class description: Class for the creation of Courses, this view automatically ties the course to the study it was called from Method signatures and docstrings: - def get_context_data(self, **kwargs: Dict[str, Any]) -> Dict[str, Any]: Gets a bit extra cont...
Implement the Python class `CourseCreateView` described below. Class description: Class for the creation of Courses, this view automatically ties the course to the study it was called from Method signatures and docstrings: - def get_context_data(self, **kwargs: Dict[str, Any]) -> Dict[str, Any]: Gets a bit extra cont...
a08d70e7fa47247bffd3f816adaadf86219c4df8
<|skeleton|> class CourseCreateView: """Class for the creation of Courses, this view automatically ties the course to the study it was called from""" def get_context_data(self, **kwargs: Dict[str, Any]) -> Dict[str, Any]: """Gets a bit extra context data because form-template is shared with update view...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CourseCreateView: """Class for the creation of Courses, this view automatically ties the course to the study it was called from""" def get_context_data(self, **kwargs: Dict[str, Any]) -> Dict[str, Any]: """Gets a bit extra context data because form-template is shared with update view. Extra parts...
the_stack_v2_python_sparse
steambird/boecie/views.py
StichtingIAPC/SteamBird
train
0
b82bdafd7a5ad6ee1cf69b3eb8d2c08d04369e79
[ "self.in_column = in_column\nself.strategy = ImputerMode(strategy)\nself.window = window\nself.fill_value: Optional[int] = None\nself.nan_timestamps = None", "self.nan_timestamps = df[df[self.in_column].isna()].index\nif self.strategy == ImputerMode.zero:\n self.fill_value = 0\nelif self.strategy == ImputerMod...
<|body_start_0|> self.in_column = in_column self.strategy = ImputerMode(strategy) self.window = window self.fill_value: Optional[int] = None self.nan_timestamps = None <|end_body_0|> <|body_start_1|> self.nan_timestamps = df[df[self.in_column].isna()].index if se...
Fills Nans in series of DataFrame with zeros, previous value, average or moving average.
_OneSegmentTimeSeriesImputerTransform
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _OneSegmentTimeSeriesImputerTransform: """Fills Nans in series of DataFrame with zeros, previous value, average or moving average.""" def __init__(self, in_column: str='target', strategy: str=ImputerMode.zero, window: int=-1): """Create instance of _OneSegmentTimeSeriesImputerTransfo...
stack_v2_sparse_classes_75kplus_train_068724
5,793
permissive
[ { "docstring": "Create instance of _OneSegmentTimeSeriesImputerTransform. Parameters ---------- in_column: name of processed column strategy: filling value in missed dates: - If \"zero\", then replace missing dates with zeros - If \"mean\", then replace missing dates using the mean in fit stage. - If \"running_...
5
stack_v2_sparse_classes_30k_train_029977
Implement the Python class `_OneSegmentTimeSeriesImputerTransform` described below. Class description: Fills Nans in series of DataFrame with zeros, previous value, average or moving average. Method signatures and docstrings: - def __init__(self, in_column: str='target', strategy: str=ImputerMode.zero, window: int=-1...
Implement the Python class `_OneSegmentTimeSeriesImputerTransform` described below. Class description: Fills Nans in series of DataFrame with zeros, previous value, average or moving average. Method signatures and docstrings: - def __init__(self, in_column: str='target', strategy: str=ImputerMode.zero, window: int=-1...
b2453671b00affe2af23c4b10f556f6fb5d7d602
<|skeleton|> class _OneSegmentTimeSeriesImputerTransform: """Fills Nans in series of DataFrame with zeros, previous value, average or moving average.""" def __init__(self, in_column: str='target', strategy: str=ImputerMode.zero, window: int=-1): """Create instance of _OneSegmentTimeSeriesImputerTransfo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _OneSegmentTimeSeriesImputerTransform: """Fills Nans in series of DataFrame with zeros, previous value, average or moving average.""" def __init__(self, in_column: str='target', strategy: str=ImputerMode.zero, window: int=-1): """Create instance of _OneSegmentTimeSeriesImputerTransform. Parameter...
the_stack_v2_python_sparse
etna/transforms/imputation.py
jingmouren/etna-ts
train
0
9679ebb1b84cad8d29a331c9a491b56605cfa660
[ "if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=HMUserManager.normalize_email(email))\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email, password=password)\nuser.is_admin = True\nuser.save(using=self._db)\nreturn...
<|body_start_0|> if not email: raise ValueError('Users must have an email address') user = self.model(email=HMUserManager.normalize_email(email)) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.cre...
HMUserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HMUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email, date of birth a...
stack_v2_sparse_classes_75kplus_train_068725
5,784
no_license
[ { "docstring": "Creates and saves a User with the given email, date of birth and password.", "name": "create_user", "signature": "def create_user(self, email, password=None)" }, { "docstring": "Creates and saves a superuser with the given email, date of birth and password.", "name": "create_...
2
stack_v2_sparse_classes_30k_train_003010
Implement the Python class `HMUserManager` described below. Class description: Implement the HMUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, email, password): C...
Implement the Python class `HMUserManager` described below. Class description: Implement the HMUserManager class. Method signatures and docstrings: - def create_user(self, email, password=None): Creates and saves a User with the given email, date of birth and password. - def create_superuser(self, email, password): C...
17f97f390154c4c9f201d9c0bea2b61c0ecbd022
<|skeleton|> class HMUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" <|body_0|> def create_superuser(self, email, password): """Creates and saves a superuser with the given email, date of birth a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HMUserManager: def create_user(self, email, password=None): """Creates and saves a User with the given email, date of birth and password.""" if not email: raise ValueError('Users must have an email address') user = self.model(email=HMUserManager.normalize_email(email)) ...
the_stack_v2_python_sparse
core/models.py
Mortoc/HealthfullyMe
train
0
b4ae0a6c69199782afe5338eca431dd407af6c1b
[ "self.norms = np.zeros(num_imus)\nfor i in range(1, num_imus):\n rospy.Subscriber('imu_data{}'.format(i), Imu, self.imu_callback)", "A = data.linear_acceleration\nnorm = np.linalg.norm([A.x, A.y, A.z])\ni = int(data.header.frame_id[-1])\nself.norms[i] = norm" ]
<|body_start_0|> self.norms = np.zeros(num_imus) for i in range(1, num_imus): rospy.Subscriber('imu_data{}'.format(i), Imu, self.imu_callback) <|end_body_0|> <|body_start_1|> A = data.linear_acceleration norm = np.linalg.norm([A.x, A.y, A.z]) i = int(data.header.fram...
ImuListener
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImuListener: def __init__(self, num_imus): """ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amount of IMUs on the robot `acc_thresh`: `float` The default threshold used to determine the minimal differen...
stack_v2_sparse_classes_75kplus_train_068726
1,932
no_license
[ { "docstring": "ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amount of IMUs on the robot `acc_thresh`: `float` The default threshold used to determine the minimal difference between two consecutive IMU readings to constitute ...
2
stack_v2_sparse_classes_30k_train_002717
Implement the Python class `ImuListener` described below. Class description: Implement the ImuListener class. Method signatures and docstrings: - def __init__(self, num_imus): ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amount of ...
Implement the Python class `ImuListener` described below. Class description: Implement the ImuListener class. Method signatures and docstrings: - def __init__(self, num_imus): ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amount of ...
ef4c115fc42de4c992281bc800064abf0f494b72
<|skeleton|> class ImuListener: def __init__(self, num_imus): """ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amount of IMUs on the robot `acc_thresh`: `float` The default threshold used to determine the minimal differen...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImuListener: def __init__(self, num_imus): """ImuListener class for registering when IMUs are activated; that is, the IMU is moved enough. Arguments ---------- `num_imus`: `int` Amount of IMUs on the robot `acc_thresh`: `float` The default threshold used to determine the minimal difference between two...
the_stack_v2_python_sparse
scripts/utils/imu_norms.py
HIRO-group/ros_robotic_skin
train
3
cb4b23c483aa85ace41821f37df3857508b6cf8b
[ "type_option = validate_type_option(request.GET.get('type'))\nv2_format = request.GET.get('v2') == '1'\nnotification_preferences = serialize(user, request.user, NotificationSettingsSerializer(), type=type_option)\nif v2_format:\n return Response({'providers': list(map(lambda x: x.name, get_providers_for_recipien...
<|body_start_0|> type_option = validate_type_option(request.GET.get('type')) v2_format = request.GET.get('v2') == '1' notification_preferences = serialize(user, request.user, NotificationSettingsSerializer(), type=type_option) if v2_format: return Response({'providers': list(...
This Notification Settings endpoint is the generic way to interact with the NotificationSettings table via the API. TODO(mgaeta): If this is going to replace the UserNotificationDetailsEndpoint and UserNotificationFineTuningEndpoint endpoints, then it should probably be able to translate legacy values from UserOptions.
UserNotificationSettingsDetailsEndpoint
[ "Apache-2.0", "BUSL-1.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserNotificationSettingsDetailsEndpoint: """This Notification Settings endpoint is the generic way to interact with the NotificationSettings table via the API. TODO(mgaeta): If this is going to replace the UserNotificationDetailsEndpoint and UserNotificationFineTuningEndpoint endpoints, then it s...
stack_v2_sparse_classes_75kplus_train_068727
3,499
permissive
[ { "docstring": "Get the Notification Settings for a given User. ```````````````````````````````` :pparam string user_id: A User's `user_id` or \"me\" for current user. :qparam string type: If set, filter the NotificationSettings to this type. :auth required:", "name": "get", "signature": "def get(self, ...
2
stack_v2_sparse_classes_30k_train_029423
Implement the Python class `UserNotificationSettingsDetailsEndpoint` described below. Class description: This Notification Settings endpoint is the generic way to interact with the NotificationSettings table via the API. TODO(mgaeta): If this is going to replace the UserNotificationDetailsEndpoint and UserNotification...
Implement the Python class `UserNotificationSettingsDetailsEndpoint` described below. Class description: This Notification Settings endpoint is the generic way to interact with the NotificationSettings table via the API. TODO(mgaeta): If this is going to replace the UserNotificationDetailsEndpoint and UserNotification...
d9dd4f382f96b5c4576b64cbf015db651556c18b
<|skeleton|> class UserNotificationSettingsDetailsEndpoint: """This Notification Settings endpoint is the generic way to interact with the NotificationSettings table via the API. TODO(mgaeta): If this is going to replace the UserNotificationDetailsEndpoint and UserNotificationFineTuningEndpoint endpoints, then it s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserNotificationSettingsDetailsEndpoint: """This Notification Settings endpoint is the generic way to interact with the NotificationSettings table via the API. TODO(mgaeta): If this is going to replace the UserNotificationDetailsEndpoint and UserNotificationFineTuningEndpoint endpoints, then it should probabl...
the_stack_v2_python_sparse
src/sentry/api/endpoints/user_notification_settings_details.py
nagyist/sentry
train
0
783bb874b4ecd2f7c2c7a7242707af2a213a46c3
[ "if pt in self.possibles:\n self.pt = pt\nelse:\n raise ValueError('in CompassPt.__init__')", "if self.pt == 'N':\n return (0, dist)\nelif self.pt == 'S':\n return (0, -dist)\nelif self.pt == 'E':\n return (dist, 0)\nelif self.pt == 'W':\n return (-dist, 0)\nelse:\n raise ValueError('in Compa...
<|body_start_0|> if pt in self.possibles: self.pt = pt else: raise ValueError('in CompassPt.__init__') <|end_body_0|> <|body_start_1|> if self.pt == 'N': return (0, dist) elif self.pt == 'S': return (0, -dist) elif self.pt == 'E': ...
Creates and manages the compass direction for movements.
CompassPt
[ "Giftware" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompassPt: """Creates and manages the compass direction for movements.""" def __init__(self, pt): """Creates a compass direction variable for the instance(object), based on a correct input.""" <|body_0|> def move(self, dist): """Sets and returns the direction of ...
stack_v2_sparse_classes_75kplus_train_068728
5,808
permissive
[ { "docstring": "Creates a compass direction variable for the instance(object), based on a correct input.", "name": "__init__", "signature": "def __init__(self, pt)" }, { "docstring": "Sets and returns the direction of movement in x, y form based on the compass direction variable in the instance....
2
stack_v2_sparse_classes_30k_train_049456
Implement the Python class `CompassPt` described below. Class description: Creates and manages the compass direction for movements. Method signatures and docstrings: - def __init__(self, pt): Creates a compass direction variable for the instance(object), based on a correct input. - def move(self, dist): Sets and retu...
Implement the Python class `CompassPt` described below. Class description: Creates and manages the compass direction for movements. Method signatures and docstrings: - def __init__(self, pt): Creates a compass direction variable for the instance(object), based on a correct input. - def move(self, dist): Sets and retu...
a51ff7e59a4e6ffa924db59a482a43e413644ce0
<|skeleton|> class CompassPt: """Creates and manages the compass direction for movements.""" def __init__(self, pt): """Creates a compass direction variable for the instance(object), based on a correct input.""" <|body_0|> def move(self, dist): """Sets and returns the direction of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CompassPt: """Creates and manages the compass direction for movements.""" def __init__(self, pt): """Creates a compass direction variable for the instance(object), based on a correct input.""" if pt in self.possibles: self.pt = pt else: raise ValueError('in...
the_stack_v2_python_sparse
RandWalk_SimExample.py
animformed/problem-sets-mit-ocw-6
train
0
4eb0a1256a31a9eab15f14ce2179a1dc1d8e8502
[ "rel_list = []\ntry:\n rel_list = super().get()\nexcept AttributeError:\n rel_list = None\nif not rel_list:\n return []\nresolved_list = []\nfor rel in rel_list:\n if rel.isBroken():\n continue\n resolved_list.append(rel.to_object)\nreturn resolved_list", "try:\n return self.get()\nexcept...
<|body_start_0|> rel_list = [] try: rel_list = super().get() except AttributeError: rel_list = None if not rel_list: return [] resolved_list = [] for rel in rel_list: if rel.isBroken(): continue r...
A data manager which sets a list of relations on dictionary
RelationListDictDataManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelationListDictDataManager: """A data manager which sets a list of relations on dictionary""" def get(self): """Gets the target""" <|body_0|> def query(self, default=NO_VALUE): """See z3c.form.interfaces.IDataManager""" <|body_1|> def set(self, valu...
stack_v2_sparse_classes_75kplus_train_068729
5,571
no_license
[ { "docstring": "Gets the target", "name": "get", "signature": "def get(self)" }, { "docstring": "See z3c.form.interfaces.IDataManager", "name": "query", "signature": "def query(self, default=NO_VALUE)" }, { "docstring": "Sets the relationship target", "name": "set", "sign...
3
stack_v2_sparse_classes_30k_train_051576
Implement the Python class `RelationListDictDataManager` described below. Class description: A data manager which sets a list of relations on dictionary Method signatures and docstrings: - def get(self): Gets the target - def query(self, default=NO_VALUE): See z3c.form.interfaces.IDataManager - def set(self, value): ...
Implement the Python class `RelationListDictDataManager` described below. Class description: A data manager which sets a list of relations on dictionary Method signatures and docstrings: - def get(self): Gets the target - def query(self, default=NO_VALUE): See z3c.form.interfaces.IDataManager - def set(self, value): ...
a19f109ad36ddae983b14b4245ac1a8cab50512c
<|skeleton|> class RelationListDictDataManager: """A data manager which sets a list of relations on dictionary""" def get(self): """Gets the target""" <|body_0|> def query(self, default=NO_VALUE): """See z3c.form.interfaces.IDataManager""" <|body_1|> def set(self, valu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RelationListDictDataManager: """A data manager which sets a list of relations on dictionary""" def get(self): """Gets the target""" rel_list = [] try: rel_list = super().get() except AttributeError: rel_list = None if not rel_list: ...
the_stack_v2_python_sparse
plone/app/relationfield/widget.py
plone/plone.app.relationfield
train
1
1d598bb4e169b13c03127d02d3e642989f60c466
[ "res, self.target = ([], target)\nfor i in range(1, len(num) + 1):\n if i == 1 or (i > 1 and num[0] != '0'):\n self.dfs(num[i:], num[:i], int(num[:i]), int(num[:i]), res)\nreturn res", "if not num:\n if cur == self.target:\n res.append(temp)\n return\nfor i in range(1, len(num) + 1):\n v...
<|body_start_0|> res, self.target = ([], target) for i in range(1, len(num) + 1): if i == 1 or (i > 1 and num[0] != '0'): self.dfs(num[i:], num[:i], int(num[:i]), int(num[:i]), res) return res <|end_body_0|> <|body_start_1|> if not num: if cur == ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addOperators(self, num, target): """:type num: str :type target: int :rtype: List[str] beats 36.86%""" <|body_0|> def dfs(self, num, temp, cur, last, res): """:param num: :param temp: :param cur: :param last: :param res: :return: dfs() parameters: num: ...
stack_v2_sparse_classes_75kplus_train_068730
1,487
no_license
[ { "docstring": ":type num: str :type target: int :rtype: List[str] beats 36.86%", "name": "addOperators", "signature": "def addOperators(self, num, target)" }, { "docstring": ":param num: :param temp: :param cur: :param last: :param res: :return: dfs() parameters: num: remaining num string temp:...
2
stack_v2_sparse_classes_30k_train_023840
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addOperators(self, num, target): :type num: str :type target: int :rtype: List[str] beats 36.86% - def dfs(self, num, temp, cur, last, res): :param num: :param temp: :param c...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addOperators(self, num, target): :type num: str :type target: int :rtype: List[str] beats 36.86% - def dfs(self, num, temp, cur, last, res): :param num: :param temp: :param c...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def addOperators(self, num, target): """:type num: str :type target: int :rtype: List[str] beats 36.86%""" <|body_0|> def dfs(self, num, temp, cur, last, res): """:param num: :param temp: :param cur: :param last: :param res: :return: dfs() parameters: num: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def addOperators(self, num, target): """:type num: str :type target: int :rtype: List[str] beats 36.86%""" res, self.target = ([], target) for i in range(1, len(num) + 1): if i == 1 or (i > 1 and num[0] != '0'): self.dfs(num[i:], num[:i], int(num[:...
the_stack_v2_python_sparse
LeetCode/282_expression_add_operators.py
yao23/Machine_Learning_Playground
train
12
7541d4ba7f8e616093e12d9439bae3d0b0018afb
[ "super(Seq2Seq, self).__init__()\nself.src_vocab_size = src_vocab_size\nself.trg_vocab_size = trg_vocab_size\nself.src_emb_dim = src_emb_dim\nself.trg_emb_dim = trg_emb_dim\nself.src_hidden_dim = src_hidden_dim\nself.trg_hidden_dim = trg_hidden_dim\nself.batch_size = batch_size\nself.bidirectional = bidirectional\n...
<|body_start_0|> super(Seq2Seq, self).__init__() self.src_vocab_size = src_vocab_size self.trg_vocab_size = trg_vocab_size self.src_emb_dim = src_emb_dim self.trg_emb_dim = trg_emb_dim self.src_hidden_dim = src_hidden_dim self.trg_hidden_dim = trg_hidden_dim ...
Container module with an encoder, deocder, embeddings.
Seq2Seq
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Seq2Seq: """Container module with an encoder, deocder, embeddings.""" def __init__(self, src_emb_dim, trg_emb_dim, src_vocab_size, trg_vocab_size, src_hidden_dim, trg_hidden_dim, batch_size, pad_token_src, pad_token_trg, bidirectional=True, nlayers=2, nlayers_trg=1, dropout=0.0): """...
stack_v2_sparse_classes_75kplus_train_068731
9,651
no_license
[ { "docstring": "Initialize model.", "name": "__init__", "signature": "def __init__(self, src_emb_dim, trg_emb_dim, src_vocab_size, trg_vocab_size, src_hidden_dim, trg_hidden_dim, batch_size, pad_token_src, pad_token_trg, bidirectional=True, nlayers=2, nlayers_trg=1, dropout=0.0)" }, { "docstring...
5
stack_v2_sparse_classes_30k_train_048182
Implement the Python class `Seq2Seq` described below. Class description: Container module with an encoder, deocder, embeddings. Method signatures and docstrings: - def __init__(self, src_emb_dim, trg_emb_dim, src_vocab_size, trg_vocab_size, src_hidden_dim, trg_hidden_dim, batch_size, pad_token_src, pad_token_trg, bid...
Implement the Python class `Seq2Seq` described below. Class description: Container module with an encoder, deocder, embeddings. Method signatures and docstrings: - def __init__(self, src_emb_dim, trg_emb_dim, src_vocab_size, trg_vocab_size, src_hidden_dim, trg_hidden_dim, batch_size, pad_token_src, pad_token_trg, bid...
c99027db35e3435c8e0270580d67b6481ac236e9
<|skeleton|> class Seq2Seq: """Container module with an encoder, deocder, embeddings.""" def __init__(self, src_emb_dim, trg_emb_dim, src_vocab_size, trg_vocab_size, src_hidden_dim, trg_hidden_dim, batch_size, pad_token_src, pad_token_trg, bidirectional=True, nlayers=2, nlayers_trg=1, dropout=0.0): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Seq2Seq: """Container module with an encoder, deocder, embeddings.""" def __init__(self, src_emb_dim, trg_emb_dim, src_vocab_size, trg_vocab_size, src_hidden_dim, trg_hidden_dim, batch_size, pad_token_src, pad_token_trg, bidirectional=True, nlayers=2, nlayers_trg=1, dropout=0.0): """Initialize mo...
the_stack_v2_python_sparse
nlg/model.py
henryyang42/NTU-Course-Bot
train
12
2121b8177cdb8cea3502d73a936cfce37826daf8
[ "self.after = after\nself.before = before\nself.changes = changes", "if dictionary is None:\n return None\nafter = cohesity_management_sdk.models.protection_job.ProtectionJob.from_dictionary(dictionary.get('after')) if dictionary.get('after') else None\nbefore = cohesity_management_sdk.models.protection_job.Pr...
<|body_start_0|> self.after = after self.before = before self.changes = changes <|end_body_0|> <|body_start_1|> if dictionary is None: return None after = cohesity_management_sdk.models.protection_job.ProtectionJob.from_dictionary(dictionary.get('after')) if dictiona...
Implementation of the 'ProtectionJobAuditTrail' model. Specifies the fields for Protection job audit Response. Attributes: after (ProtectionJob): Specifies the audit logs for Protection Job after change. before (ProtectionJob): Specifies the audit logs for Protection Job before change. changes (list of ChangesEnum): Sp...
ProtectionJobAuditTrail
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionJobAuditTrail: """Implementation of the 'ProtectionJobAuditTrail' model. Specifies the fields for Protection job audit Response. Attributes: after (ProtectionJob): Specifies the audit logs for Protection Job after change. before (ProtectionJob): Specifies the audit logs for Protection J...
stack_v2_sparse_classes_75kplus_train_068732
4,155
permissive
[ { "docstring": "Constructor for the ProtectionJobAuditTrail class", "name": "__init__", "signature": "def __init__(self, after=None, before=None, changes=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of th...
2
stack_v2_sparse_classes_30k_train_054328
Implement the Python class `ProtectionJobAuditTrail` described below. Class description: Implementation of the 'ProtectionJobAuditTrail' model. Specifies the fields for Protection job audit Response. Attributes: after (ProtectionJob): Specifies the audit logs for Protection Job after change. before (ProtectionJob): Sp...
Implement the Python class `ProtectionJobAuditTrail` described below. Class description: Implementation of the 'ProtectionJobAuditTrail' model. Specifies the fields for Protection job audit Response. Attributes: after (ProtectionJob): Specifies the audit logs for Protection Job after change. before (ProtectionJob): Sp...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ProtectionJobAuditTrail: """Implementation of the 'ProtectionJobAuditTrail' model. Specifies the fields for Protection job audit Response. Attributes: after (ProtectionJob): Specifies the audit logs for Protection Job after change. before (ProtectionJob): Specifies the audit logs for Protection J...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProtectionJobAuditTrail: """Implementation of the 'ProtectionJobAuditTrail' model. Specifies the fields for Protection job audit Response. Attributes: after (ProtectionJob): Specifies the audit logs for Protection Job after change. before (ProtectionJob): Specifies the audit logs for Protection Job before cha...
the_stack_v2_python_sparse
cohesity_management_sdk/models/protection_job_audit_trail.py
cohesity/management-sdk-python
train
24
a19d2b8620633ba201d2865c70bd729533dbeff0
[ "self.cohorts_df = cohorts_df\nself.cohort_arr = np.asarray(cohort_arr)\nself.num_cohorts = len(cohort_arr)", "center_index = cohort\nif self.num_cohorts >= 3:\n crange = sub_range(center_index, self.cohort_arr, self.num_cohorts)\n df = self.cohorts_df.ix[crange]\n ax = histogram_subplots(crange, df, log...
<|body_start_0|> self.cohorts_df = cohorts_df self.cohort_arr = np.asarray(cohort_arr) self.num_cohorts = len(cohort_arr) <|end_body_0|> <|body_start_1|> center_index = cohort if self.num_cohorts >= 3: crange = sub_range(center_index, self.cohort_arr, self.num_cohort...
represents Engagement of the cohorts on the social network
RetentionIndex
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetentionIndex: """represents Engagement of the cohorts on the social network""" def __init__(self, cohorts_df, cohort_arr): """initialize class instance Input: cohorts, Cohorts class instance cohort_arr, np.array of datetime.date objects representing the cohorts of interest.""" ...
stack_v2_sparse_classes_75kplus_train_068733
3,832
no_license
[ { "docstring": "initialize class instance Input: cohorts, Cohorts class instance cohort_arr, np.array of datetime.date objects representing the cohorts of interest.", "name": "__init__", "signature": "def __init__(self, cohorts_df, cohort_arr)" }, { "docstring": "****Bug in IPython that does not...
2
null
Implement the Python class `RetentionIndex` described below. Class description: represents Engagement of the cohorts on the social network Method signatures and docstrings: - def __init__(self, cohorts_df, cohort_arr): initialize class instance Input: cohorts, Cohorts class instance cohort_arr, np.array of datetime.d...
Implement the Python class `RetentionIndex` described below. Class description: represents Engagement of the cohorts on the social network Method signatures and docstrings: - def __init__(self, cohorts_df, cohort_arr): initialize class instance Input: cohorts, Cohorts class instance cohort_arr, np.array of datetime.d...
580265c41de9f2145fec02df17af01245fbeaed6
<|skeleton|> class RetentionIndex: """represents Engagement of the cohorts on the social network""" def __init__(self, cohorts_df, cohort_arr): """initialize class instance Input: cohorts, Cohorts class instance cohort_arr, np.array of datetime.date objects representing the cohorts of interest.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RetentionIndex: """represents Engagement of the cohorts on the social network""" def __init__(self, cohorts_df, cohort_arr): """initialize class instance Input: cohorts, Cohorts class instance cohort_arr, np.array of datetime.date objects representing the cohorts of interest.""" self.coho...
the_stack_v2_python_sparse
code/retention_index.py
nicolasgo/_pmx
train
0
d4ba13de3f572778d6e6658310ab8ce208ee13d0
[ "args = self.theses_filter.parse_args()\nitems_per_page = 20\npage_number = args['page']\nif page_number < 1:\n return abort(HTTPStatus.BAD_REQUEST, message=\"'page' must be > 0\")\nitems_query = Thesis.query.join(Thesis.argument_thesis).filter(ArgumentThesis.argument_id == argument_id, not_(Thesis.is_comment))....
<|body_start_0|> args = self.theses_filter.parse_args() items_per_page = 20 page_number = args['page'] if page_number < 1: return abort(HTTPStatus.BAD_REQUEST, message="'page' must be > 0") items_query = Thesis.query.join(Thesis.argument_thesis).filter(ArgumentThesis....
ArgumentThesesResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArgumentThesesResource: def get(self, argument_id): """Get all argument theses * User can view theses of argument * View with pagination""" <|body_0|> def post(self, argument_id): """Create a new argument thesis * User with permission to **"create theses"** can creat...
stack_v2_sparse_classes_75kplus_train_068734
2,961
permissive
[ { "docstring": "Get all argument theses * User can view theses of argument * View with pagination", "name": "get", "signature": "def get(self, argument_id)" }, { "docstring": "Create a new argument thesis * User with permission to **\"create theses\"** can create a new thesis (in argument of not...
2
stack_v2_sparse_classes_30k_train_026039
Implement the Python class `ArgumentThesesResource` described below. Class description: Implement the ArgumentThesesResource class. Method signatures and docstrings: - def get(self, argument_id): Get all argument theses * User can view theses of argument * View with pagination - def post(self, argument_id): Create a ...
Implement the Python class `ArgumentThesesResource` described below. Class description: Implement the ArgumentThesesResource class. Method signatures and docstrings: - def get(self, argument_id): Get all argument theses * User can view theses of argument * View with pagination - def post(self, argument_id): Create a ...
dce87ffe395ae4bd08b47f28e07594e1889da819
<|skeleton|> class ArgumentThesesResource: def get(self, argument_id): """Get all argument theses * User can view theses of argument * View with pagination""" <|body_0|> def post(self, argument_id): """Create a new argument thesis * User with permission to **"create theses"** can creat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ArgumentThesesResource: def get(self, argument_id): """Get all argument theses * User can view theses of argument * View with pagination""" args = self.theses_filter.parse_args() items_per_page = 20 page_number = args['page'] if page_number < 1: return abort...
the_stack_v2_python_sparse
src/backend/app/api/public/arguments/argument/argument_theses.py
aimanow/sft
train
0
1eeed0ac1c93e1a36c75a1ff5d56c65dae791608
[ "variable_values = {'urn': urn, 'sourceType': source_type, 'operationType': operation_type, 'numAffectedRows': num_affected_rows}\nif partition is not None:\n variable_values['partition'] = partition\nif num_affected_rows is not None:\n variable_values['numAffectedRows'] = num_affected_rows\nif custom_propert...
<|body_start_0|> variable_values = {'urn': urn, 'sourceType': source_type, 'operationType': operation_type, 'numAffectedRows': num_affected_rows} if partition is not None: variable_values['partition'] = partition if num_affected_rows is not None: variable_values['numAffec...
Operation
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Operation: def report_operation(self, urn: str, source_type: str='DATA_PROCESS', operation_type: str='UPDATE', partition: Optional[str]=None, num_affected_rows: int=0, custom_properties: Optional[Dict[str, str]]=None) -> str: """Report operation metadata for a dataset. :param source_type...
stack_v2_sparse_classes_75kplus_train_068735
5,116
permissive
[ { "docstring": "Report operation metadata for a dataset. :param source_type: The source type to filter on. If not set it will accept any source type. Default value: DATA_PROCESS See valid types here: https://datahubproject.io/docs/graphql/enums#operationsourcetype :param operation_type: The operation type to fi...
2
stack_v2_sparse_classes_30k_train_036935
Implement the Python class `Operation` described below. Class description: Implement the Operation class. Method signatures and docstrings: - def report_operation(self, urn: str, source_type: str='DATA_PROCESS', operation_type: str='UPDATE', partition: Optional[str]=None, num_affected_rows: int=0, custom_properties: ...
Implement the Python class `Operation` described below. Class description: Implement the Operation class. Method signatures and docstrings: - def report_operation(self, urn: str, source_type: str='DATA_PROCESS', operation_type: str='UPDATE', partition: Optional[str]=None, num_affected_rows: int=0, custom_properties: ...
8cf299aeb43fa95afb22fefbc7728117c727f0b3
<|skeleton|> class Operation: def report_operation(self, urn: str, source_type: str='DATA_PROCESS', operation_type: str='UPDATE', partition: Optional[str]=None, num_affected_rows: int=0, custom_properties: Optional[Dict[str, str]]=None) -> str: """Report operation metadata for a dataset. :param source_type...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Operation: def report_operation(self, urn: str, source_type: str='DATA_PROCESS', operation_type: str='UPDATE', partition: Optional[str]=None, num_affected_rows: int=0, custom_properties: Optional[Dict[str, str]]=None) -> str: """Report operation metadata for a dataset. :param source_type: The source t...
the_stack_v2_python_sparse
metadata-ingestion/src/datahub/api/graphql/operation.py
RyanHolstien/datahub
train
0
8f46a27f7c83bc18231870f1e29ea4b45f935519
[ "db_api = DataBaseAPI(NotificationDB).session\nnote = NotificationDB()\nnote.sender = sender\nnote.receiver = receiver\nnote.msg_type = msg_type\nnote.message = message\nnote.read = 0\ndb_api.add(note)\ndb_api.commit()\ndb_api.close()\nqueue.put({'user_id': receiver, 'msg': message, 'msg_type': msg_type})\nlog.debu...
<|body_start_0|> db_api = DataBaseAPI(NotificationDB).session note = NotificationDB() note.sender = sender note.receiver = receiver note.msg_type = msg_type note.message = message note.read = 0 db_api.add(note) db_api.commit() db_api.close(...
Implemented notification api
NotificationAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationAPI: """Implemented notification api""" def send(sender, receiver, msg_type, message): """Add notification""" <|body_0|> def read(msg_id): """Read message""" <|body_1|> def get(get_by=None): """Get notification: all, by sender, by...
stack_v2_sparse_classes_75kplus_train_068736
1,653
no_license
[ { "docstring": "Add notification", "name": "send", "signature": "def send(sender, receiver, msg_type, message)" }, { "docstring": "Read message", "name": "read", "signature": "def read(msg_id)" }, { "docstring": "Get notification: all, by sender, by receiver get_by = ('sender/rec...
3
stack_v2_sparse_classes_30k_train_042936
Implement the Python class `NotificationAPI` described below. Class description: Implemented notification api Method signatures and docstrings: - def send(sender, receiver, msg_type, message): Add notification - def read(msg_id): Read message - def get(get_by=None): Get notification: all, by sender, by receiver get_b...
Implement the Python class `NotificationAPI` described below. Class description: Implemented notification api Method signatures and docstrings: - def send(sender, receiver, msg_type, message): Add notification - def read(msg_id): Read message - def get(get_by=None): Get notification: all, by sender, by receiver get_b...
a14a5160e78c3d2ebf86a2eb91b13ae6f38ac32a
<|skeleton|> class NotificationAPI: """Implemented notification api""" def send(sender, receiver, msg_type, message): """Add notification""" <|body_0|> def read(msg_id): """Read message""" <|body_1|> def get(get_by=None): """Get notification: all, by sender, by...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NotificationAPI: """Implemented notification api""" def send(sender, receiver, msg_type, message): """Add notification""" db_api = DataBaseAPI(NotificationDB).session note = NotificationDB() note.sender = sender note.receiver = receiver note.msg_type = msg_...
the_stack_v2_python_sparse
libs/user/notification_api.py
yacneyac/fportal
train
0
d15f23e7277b36f8ddd0e4335835359cb4619a02
[ "created_before = check_date(created_before)\ncreated_after = check_date(created_after)\nif created_before or created_after:\n self['date'] = dict()\n if created_before:\n self['date']['createdBefore'] = created_before\n if created_after:\n self['date'].update(createdAfter=created_after)\nret...
<|body_start_0|> created_before = check_date(created_before) created_after = check_date(created_after) if created_before or created_after: self['date'] = dict() if created_before: self['date']['createdBefore'] = created_before if created_after:...
Field used to build all date related parameters in the payload data
DateMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateMixin: """Field used to build all date related parameters in the payload data""" def creation_date(self, created_before=None, created_after=None): """Restricts using indexation date""" <|body_0|> def publication_date(self, start=None, end=None): """Restricts ...
stack_v2_sparse_classes_75kplus_train_068737
17,302
permissive
[ { "docstring": "Restricts using indexation date", "name": "creation_date", "signature": "def creation_date(self, created_before=None, created_after=None)" }, { "docstring": "Restricts using publication date", "name": "publication_date", "signature": "def publication_date(self, start=None...
2
stack_v2_sparse_classes_30k_train_022738
Implement the Python class `DateMixin` described below. Class description: Field used to build all date related parameters in the payload data Method signatures and docstrings: - def creation_date(self, created_before=None, created_after=None): Restricts using indexation date - def publication_date(self, start=None, ...
Implement the Python class `DateMixin` described below. Class description: Field used to build all date related parameters in the payload data Method signatures and docstrings: - def creation_date(self, created_before=None, created_after=None): Restricts using indexation date - def publication_date(self, start=None, ...
47d3cac71d2b4128e6cb1be1ef142ff3fbb95f4e
<|skeleton|> class DateMixin: """Field used to build all date related parameters in the payload data""" def creation_date(self, created_before=None, created_after=None): """Restricts using indexation date""" <|body_0|> def publication_date(self, start=None, end=None): """Restricts ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DateMixin: """Field used to build all date related parameters in the payload data""" def creation_date(self, created_before=None, created_after=None): """Restricts using indexation date""" created_before = check_date(created_before) created_after = check_date(created_after) ...
the_stack_v2_python_sparse
radarly/parameters/field.py
linkfluence/radarly-py
train
9
45523495bc3da9db151001805a1b8bcced3de2da
[ "mn = float('inf')\n\ndef dfs(d, i, cur):\n nonlocal mn\n if d == len(triangle):\n mn = min(mn, cur)\n return\n cur += triangle[d][i]\n dfs(d + 1, i, cur)\n dfs(d + 1, i + 1, cur)\ndfs(0, 0, 0)\nreturn mn", "@lru_cache(None)\ndef dp(d, i):\n if d == 0:\n assert i == 0\n ...
<|body_start_0|> mn = float('inf') def dfs(d, i, cur): nonlocal mn if d == len(triangle): mn = min(mn, cur) return cur += triangle[d][i] dfs(d + 1, i, cur) dfs(d + 1, i + 1, cur) dfs(0, 0, 0) ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: """Bruteforce dfs Time complexity: O(n!) Space complexity: O(n) # callstack""" <|body_0|> def minimumTotal(self, triangle: List[List[int]]) -> int: """Recursive DP Time complexity: O(n^2) Space compl...
stack_v2_sparse_classes_75kplus_train_068738
3,847
no_license
[ { "docstring": "Bruteforce dfs Time complexity: O(n!) Space complexity: O(n) # callstack", "name": "minimumTotal", "signature": "def minimumTotal(self, triangle: List[List[int]]) -> int" }, { "docstring": "Recursive DP Time complexity: O(n^2) Space complexity: O(n^2)", "name": "minimumTotal"...
5
stack_v2_sparse_classes_30k_train_034167
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle: List[List[int]]) -> int: Bruteforce dfs Time complexity: O(n!) Space complexity: O(n) # callstack - def minimumTotal(self, triangle: List[List[in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumTotal(self, triangle: List[List[int]]) -> int: Bruteforce dfs Time complexity: O(n!) Space complexity: O(n) # callstack - def minimumTotal(self, triangle: List[List[in...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: """Bruteforce dfs Time complexity: O(n!) Space complexity: O(n) # callstack""" <|body_0|> def minimumTotal(self, triangle: List[List[int]]) -> int: """Recursive DP Time complexity: O(n^2) Space compl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minimumTotal(self, triangle: List[List[int]]) -> int: """Bruteforce dfs Time complexity: O(n!) Space complexity: O(n) # callstack""" mn = float('inf') def dfs(d, i, cur): nonlocal mn if d == len(triangle): mn = min(mn, cur) ...
the_stack_v2_python_sparse
leetcode/solved/120_Triangle/solution.py
sungminoh/algorithms
train
0
951f2b0b8b4381811225ab016442870605bb31c6
[ "self._quality = {'raw': 1, 'low': 800, 'med': 500, 'high': 200}\nself.openedWave = wave.open('new.wav', 'r')\nself.signal = self.openedWave.readframes(-1)\nself.signal = numpy.fromstring(self.signal)\nself.framerate = self.openedWave.getframerate()\nself._bufferedIMG = StringIO()", "plot.figure(1, figsize=(width...
<|body_start_0|> self._quality = {'raw': 1, 'low': 800, 'med': 500, 'high': 200} self.openedWave = wave.open('new.wav', 'r') self.signal = self.openedWave.readframes(-1) self.signal = numpy.fromstring(self.signal) self.framerate = self.openedWave.getframerate() self._buff...
AudioWaveFormDisplay
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AudioWaveFormDisplay: def __init__(self, *args, **kwargs): """Constructor of the DrawWave class. Responsible for taking WAVE data and turning it into a PNG that is then passed to a buffer object. This buffer object can then be read from for the purposes of redrawing wavedata (waveform)."...
stack_v2_sparse_classes_75kplus_train_068739
5,275
no_license
[ { "docstring": "Constructor of the DrawWave class. Responsible for taking WAVE data and turning it into a PNG that is then passed to a buffer object. This buffer object can then be read from for the purposes of redrawing wavedata (waveform).", "name": "__init__", "signature": "def __init__(self, *args, ...
2
null
Implement the Python class `AudioWaveFormDisplay` described below. Class description: Implement the AudioWaveFormDisplay class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructor of the DrawWave class. Responsible for taking WAVE data and turning it into a PNG that is then passed to ...
Implement the Python class `AudioWaveFormDisplay` described below. Class description: Implement the AudioWaveFormDisplay class. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Constructor of the DrawWave class. Responsible for taking WAVE data and turning it into a PNG that is then passed to ...
63240c5779330c09bbe831a20c3e7638166b4904
<|skeleton|> class AudioWaveFormDisplay: def __init__(self, *args, **kwargs): """Constructor of the DrawWave class. Responsible for taking WAVE data and turning it into a PNG that is then passed to a buffer object. This buffer object can then be read from for the purposes of redrawing wavedata (waveform)."...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AudioWaveFormDisplay: def __init__(self, *args, **kwargs): """Constructor of the DrawWave class. Responsible for taking WAVE data and turning it into a PNG that is then passed to a buffer object. This buffer object can then be read from for the purposes of redrawing wavedata (waveform).""" sel...
the_stack_v2_python_sparse
audiodisplay.py
JR-Carroll/llaml
train
0
b74c1eb029b2b949c0d0c191add6be15953a24aa
[ "model_dct = {}\nfor key, value in self.__dict__.items():\n new_value = self.__process_json_value(value)\n model_dct[key] = new_value\nreturn model_dct", "if isinstance(value, SerializableStat):\n return value.to_json()\nelif isinstance(value, (str, int, float)):\n return value\nelif isinstance(value,...
<|body_start_0|> model_dct = {} for key, value in self.__dict__.items(): new_value = self.__process_json_value(value) model_dct[key] = new_value return model_dct <|end_body_0|> <|body_start_1|> if isinstance(value, SerializableStat): return value.to_j...
Classes which inherit from SerializableStat can be serialized as JSON output. Usage ----- ``` import m5.pystats.gem5stats as gem5stats simstat = gem5stats.get_simstat(root) print(simstat.dumps()) ```
SerializableStat
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license", "LGPL-2.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SerializableStat: """Classes which inherit from SerializableStat can be serialized as JSON output. Usage ----- ``` import m5.pystats.gem5stats as gem5stats simstat = gem5stats.get_simstat(root) print(simstat.dumps()) ```""" def to_json(self) -> Dict: """Translates the current object ...
stack_v2_sparse_classes_75kplus_train_068740
5,382
permissive
[ { "docstring": "Translates the current object into a JSON dictionary. Returns ------- Dict The JSON dictionary.", "name": "to_json", "signature": "def to_json(self) -> Dict" }, { "docstring": "Translate values into a value which can be handled by the Python stdlib JSON package. Parameters ------...
4
null
Implement the Python class `SerializableStat` described below. Class description: Classes which inherit from SerializableStat can be serialized as JSON output. Usage ----- ``` import m5.pystats.gem5stats as gem5stats simstat = gem5stats.get_simstat(root) print(simstat.dumps()) ``` Method signatures and docstrings: - ...
Implement the Python class `SerializableStat` described below. Class description: Classes which inherit from SerializableStat can be serialized as JSON output. Usage ----- ``` import m5.pystats.gem5stats as gem5stats simstat = gem5stats.get_simstat(root) print(simstat.dumps()) ``` Method signatures and docstrings: - ...
48a40cf2f5182a82de360b7efa497d82e06b1631
<|skeleton|> class SerializableStat: """Classes which inherit from SerializableStat can be serialized as JSON output. Usage ----- ``` import m5.pystats.gem5stats as gem5stats simstat = gem5stats.get_simstat(root) print(simstat.dumps()) ```""" def to_json(self) -> Dict: """Translates the current object ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SerializableStat: """Classes which inherit from SerializableStat can be serialized as JSON output. Usage ----- ``` import m5.pystats.gem5stats as gem5stats simstat = gem5stats.get_simstat(root) print(simstat.dumps()) ```""" def to_json(self) -> Dict: """Translates the current object into a JSON d...
the_stack_v2_python_sparse
src/python/m5/ext/pystats/serializable_stat.py
gem5/gem5
train
1,185
73d9d4ad90f1e10842340b3b5a48c17960c883d8
[ "self.height = config.HEIGHT\nself.width = config.WIDTH\nself.display = np.full((self.height, self.width), ' ')\nself.color = np.full((self.height, self.width, 2), '', dtype=object)\nself.clear()", "utils.reset_screen()\nself.display[:] = ' '\nself.color[:, :, 0] = config.BG_COLOR\nself.color[:, :, 1] = config.FG...
<|body_start_0|> self.height = config.HEIGHT self.width = config.WIDTH self.display = np.full((self.height, self.width), ' ') self.color = np.full((self.height, self.width, 2), '', dtype=object) self.clear() <|end_body_0|> <|body_start_1|> utils.reset_screen() se...
Class for screen of the game
Screen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Screen: """Class for screen of the game""" def __init__(self): """Init calls""" <|body_0|> def clear(self): """Clears the whole display""" <|body_1|> def draw(self, obj: GameObject): """Puts an object on screen :param obj: the obj to put""" ...
stack_v2_sparse_classes_75kplus_train_068741
1,429
no_license
[ { "docstring": "Init calls", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Clears the whole display", "name": "clear", "signature": "def clear(self)" }, { "docstring": "Puts an object on screen :param obj: the obj to put", "name": "draw", "signa...
4
null
Implement the Python class `Screen` described below. Class description: Class for screen of the game Method signatures and docstrings: - def __init__(self): Init calls - def clear(self): Clears the whole display - def draw(self, obj: GameObject): Puts an object on screen :param obj: the obj to put - def show(self): S...
Implement the Python class `Screen` described below. Class description: Class for screen of the game Method signatures and docstrings: - def __init__(self): Init calls - def clear(self): Clears the whole display - def draw(self, obj: GameObject): Puts an object on screen :param obj: the obj to put - def show(self): S...
816e3c75e833f844dd80f5395801ea286fe3bbd2
<|skeleton|> class Screen: """Class for screen of the game""" def __init__(self): """Init calls""" <|body_0|> def clear(self): """Clears the whole display""" <|body_1|> def draw(self, obj: GameObject): """Puts an object on screen :param obj: the obj to put""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Screen: """Class for screen of the game""" def __init__(self): """Init calls""" self.height = config.HEIGHT self.width = config.WIDTH self.display = np.full((self.height, self.width), ' ') self.color = np.full((self.height, self.width, 2), '', dtype=object) ...
the_stack_v2_python_sparse
break_brick/screen.py
gsc2001/breakBrick
train
1
2e15561c381df2c7cea833256eea7e0e80a66a3a
[ "if isinstance(text, unicode):\n return text\nreturn unicode(text, encoding, errors=errors)", "if isinstance(text, unicode):\n return text.encode('utf8')\nreturn unicode(text, encoding, errors=errors).encode('utf8')" ]
<|body_start_0|> if isinstance(text, unicode): return text return unicode(text, encoding, errors=errors) <|end_body_0|> <|body_start_1|> if isinstance(text, unicode): return text.encode('utf8') return unicode(text, encoding, errors=errors).encode('utf8') <|end_bo...
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: def str2uni(text, encoding='utf8', errors='strict'): """Convert `text` to unicode. Parameters ---------- text : str Input text. errors : str, optional Error handling behaviour, used as parameter for `unicode` function (python2 only). encoding : str, optional Encoding of `text` f...
stack_v2_sparse_classes_75kplus_train_068742
9,000
no_license
[ { "docstring": "Convert `text` to unicode. Parameters ---------- text : str Input text. errors : str, optional Error handling behaviour, used as parameter for `unicode` function (python2 only). encoding : str, optional Encoding of `text` for `unicode` function (python2 only). Returns ------- str Unicode version...
2
stack_v2_sparse_classes_30k_train_041864
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def str2uni(text, encoding='utf8', errors='strict'): Convert `text` to unicode. Parameters ---------- text : str Input text. errors : str, optional Error handling behaviour, used a...
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def str2uni(text, encoding='utf8', errors='strict'): Convert `text` to unicode. Parameters ---------- text : str Input text. errors : str, optional Error handling behaviour, used a...
b798e7b1286e043c5685aa8375022ee50f91024a
<|skeleton|> class Encoder: def str2uni(text, encoding='utf8', errors='strict'): """Convert `text` to unicode. Parameters ---------- text : str Input text. errors : str, optional Error handling behaviour, used as parameter for `unicode` function (python2 only). encoding : str, optional Encoding of `text` f...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Encoder: def str2uni(text, encoding='utf8', errors='strict'): """Convert `text` to unicode. Parameters ---------- text : str Input text. errors : str, optional Error handling behaviour, used as parameter for `unicode` function (python2 only). encoding : str, optional Encoding of `text` for `unicode` f...
the_stack_v2_python_sparse
utils/other_utils.py
duytinvo/sequence_labeller
train
3
669ba5d3ddcb833f1e01465ccec198b7daee4b80
[ "super(PosOutputLayer, self).__init__()\nself.linear_1 = Linear(linear_weight_shape=linear_weight_shape, linear_bias_shape=linear_bias_shape)\nself.bert_layer_norm = BertLayerNorm(bert_layer_norm_weight_shape=bert_layer_norm_weight_shape, bert_layer_norm_bias_shape=bert_layer_norm_bias_shape)\nself.matmul = nn.MatM...
<|body_start_0|> super(PosOutputLayer, self).__init__() self.linear_1 = Linear(linear_weight_shape=linear_weight_shape, linear_bias_shape=linear_bias_shape) self.bert_layer_norm = BertLayerNorm(bert_layer_norm_weight_shape=bert_layer_norm_weight_shape, bert_layer_norm_bias_shape=bert_layer_norm_...
module of reader downstream
PosOutputLayer
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PosOutputLayer: """module of reader downstream""" def __init__(self, linear_weight_shape, linear_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): """init function""" <|body_0|> def construct(self, state): """construct function""" <|b...
stack_v2_sparse_classes_75kplus_train_068743
9,011
permissive
[ { "docstring": "init function", "name": "__init__", "signature": "def __init__(self, linear_weight_shape, linear_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape)" }, { "docstring": "construct function", "name": "construct", "signature": "def construct(self, state)" ...
2
stack_v2_sparse_classes_30k_train_053780
Implement the Python class `PosOutputLayer` described below. Class description: module of reader downstream Method signatures and docstrings: - def __init__(self, linear_weight_shape, linear_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): init function - def construct(self, state): construct fu...
Implement the Python class `PosOutputLayer` described below. Class description: module of reader downstream Method signatures and docstrings: - def __init__(self, linear_weight_shape, linear_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): init function - def construct(self, state): construct fu...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class PosOutputLayer: """module of reader downstream""" def __init__(self, linear_weight_shape, linear_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): """init function""" <|body_0|> def construct(self, state): """construct function""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PosOutputLayer: """module of reader downstream""" def __init__(self, linear_weight_shape, linear_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): """init function""" super(PosOutputLayer, self).__init__() self.linear_1 = Linear(linear_weight_shape=linear_weig...
the_stack_v2_python_sparse
research/nlp/tprr/src/reader_downstream.py
mindspore-ai/models
train
301
a2ae62da708caf560f1a73ce788a40621a367e47
[ "username = self.cleaned_data.get('username')\nif User.objects.filter(username__iexact=username).exists():\n raise forms.ValidationError('An account with this Username already exists.')\nreturn username", "email1 = self.cleaned_data.get('email')\nemail2 = self.cleaned_data.get('email2')\nif email1 != email2:\n...
<|body_start_0|> username = self.cleaned_data.get('username') if User.objects.filter(username__iexact=username).exists(): raise forms.ValidationError('An account with this Username already exists.') return username <|end_body_0|> <|body_start_1|> email1 = self.cleaned_data.g...
User creation form class.
UserRegisterForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserRegisterForm: """User creation form class.""" def clean_username(self): """Validate username.""" <|body_0|> def clean_email2(self): """Validate email 2.""" <|body_1|> <|end_skeleton|> <|body_start_0|> username = self.cleaned_data.get('userna...
stack_v2_sparse_classes_75kplus_train_068744
5,003
no_license
[ { "docstring": "Validate username.", "name": "clean_username", "signature": "def clean_username(self)" }, { "docstring": "Validate email 2.", "name": "clean_email2", "signature": "def clean_email2(self)" } ]
2
stack_v2_sparse_classes_30k_train_017051
Implement the Python class `UserRegisterForm` described below. Class description: User creation form class. Method signatures and docstrings: - def clean_username(self): Validate username. - def clean_email2(self): Validate email 2.
Implement the Python class `UserRegisterForm` described below. Class description: User creation form class. Method signatures and docstrings: - def clean_username(self): Validate username. - def clean_email2(self): Validate email 2. <|skeleton|> class UserRegisterForm: """User creation form class.""" def cl...
e8e8087e89b12899acb267d432301aa547821cc1
<|skeleton|> class UserRegisterForm: """User creation form class.""" def clean_username(self): """Validate username.""" <|body_0|> def clean_email2(self): """Validate email 2.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserRegisterForm: """User creation form class.""" def clean_username(self): """Validate username.""" username = self.cleaned_data.get('username') if User.objects.filter(username__iexact=username).exists(): raise forms.ValidationError('An account with this Username alre...
the_stack_v2_python_sparse
accounts/forms.py
OmarFateh/Instagram-Clone
train
0
9fd857ae3baeb7d62cca08f1a8a1332dbdc17563
[ "super(IpsManager, self).__init__(ctx, IpsMeta)\nself.log = logging.getLogger('ipsv.downloader.ips')\nself.license = license\nself.path = os.path.join(self.path, 'ips')\nself.dev_path = os.path.join(self.path, 'dev')\nself.dev_version = None\nself._setup()", "if self.license is None:\n self.log.debug('No licen...
<|body_start_0|> super(IpsManager, self).__init__(ctx, IpsMeta) self.log = logging.getLogger('ipsv.downloader.ips') self.license = license self.path = os.path.join(self.path, 'ips') self.dev_path = os.path.join(self.path, 'dev') self.dev_version = None self._setup...
IPS Versions Manager
IpsManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IpsManager: """IPS Versions Manager""" def __init__(self, ctx, license=None): """@type ctx: ips_vagrant.cli.Context @type license: ips_vagrant.scraper.licenses.LicenseMeta or None""" <|body_0|> def _populate_latest(self): """Popular version data for the latest re...
stack_v2_sparse_classes_75kplus_train_068745
4,122
permissive
[ { "docstring": "@type ctx: ips_vagrant.cli.Context @type license: ips_vagrant.scraper.licenses.LicenseMeta or None", "name": "__init__", "signature": "def __init__(self, ctx, license=None)" }, { "docstring": "Popular version data for the latest release available for download", "name": "_popu...
3
null
Implement the Python class `IpsManager` described below. Class description: IPS Versions Manager Method signatures and docstrings: - def __init__(self, ctx, license=None): @type ctx: ips_vagrant.cli.Context @type license: ips_vagrant.scraper.licenses.LicenseMeta or None - def _populate_latest(self): Popular version d...
Implement the Python class `IpsManager` described below. Class description: IPS Versions Manager Method signatures and docstrings: - def __init__(self, ctx, license=None): @type ctx: ips_vagrant.cli.Context @type license: ips_vagrant.scraper.licenses.LicenseMeta or None - def _populate_latest(self): Popular version d...
b34fa3ef38f788229d8b26f8914935508fea1d2c
<|skeleton|> class IpsManager: """IPS Versions Manager""" def __init__(self, ctx, license=None): """@type ctx: ips_vagrant.cli.Context @type license: ips_vagrant.scraper.licenses.LicenseMeta or None""" <|body_0|> def _populate_latest(self): """Popular version data for the latest re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IpsManager: """IPS Versions Manager""" def __init__(self, ctx, license=None): """@type ctx: ips_vagrant.cli.Context @type license: ips_vagrant.scraper.licenses.LicenseMeta or None""" super(IpsManager, self).__init__(ctx, IpsMeta) self.log = logging.getLogger('ipsv.downloader.ips')...
the_stack_v2_python_sparse
ips_vagrant/downloaders/ips.py
Python3pkg/IPS-Vagrant
train
0
5e3d5733a007c29f4ea22ec6da02350f01a2671f
[ "self._collector = htcondor.Collector(collector)\nlogger.debug('Finding schedds reporting to collector %s', collector)\nattempt = 0\nwhile True:\n try:\n schedd_ads = self._collector.query(htcondor.AdTypes.Schedd, schedd_constraint, ['MyAddress'])\n break\n except IOError:\n attempt += 1\...
<|body_start_0|> self._collector = htcondor.Collector(collector) logger.debug('Finding schedds reporting to collector %s', collector) attempt = 0 while True: try: schedd_ads = self._collector.query(htcondor.AdTypes.Schedd, schedd_constraint, ['MyAddress']) ...
HTCondor interface.
HTCondor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTCondor: """HTCondor interface.""" def __init__(self, collector, schedd_constraint=''): """@param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection.""" <|body_0|> def find_jobs(self, constraint...
stack_v2_sparse_classes_75kplus_train_068746
4,001
no_license
[ { "docstring": "@param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection.", "name": "__init__", "signature": "def __init__(self, collector, schedd_constraint='')" }, { "docstring": "Return ClassAds for jobs matching the...
2
stack_v2_sparse_classes_30k_train_032716
Implement the Python class `HTCondor` described below. Class description: HTCondor interface. Method signatures and docstrings: - def __init__(self, collector, schedd_constraint=''): @param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection. ...
Implement the Python class `HTCondor` described below. Class description: HTCondor interface. Method signatures and docstrings: - def __init__(self, collector, schedd_constraint=''): @param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection. ...
d6c2bfa2946edc8b0a293ae4aaa10d56d62e8bd9
<|skeleton|> class HTCondor: """HTCondor interface.""" def __init__(self, collector, schedd_constraint=''): """@param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection.""" <|body_0|> def find_jobs(self, constraint...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HTCondor: """HTCondor interface.""" def __init__(self, collector, schedd_constraint=''): """@param collector host:port of the Collector instance. @param schedd_constraint classad expression to narrow down the schedd selection.""" self._collector = htcondor.Collector(collector) log...
the_stack_v2_python_sparse
lib/common/interface/htc.py
ClydeHuibregtse/dynamo
train
0
6f363fcea379bc017766ffa027cc5e60cd7f15b3
[ "group = group_service.get(id=request.data.get('group_id', None))\ninvitee_phone = request.data.get('invitee', None)\nrole = request.data.get('role', None)\nmessage = request.data.get('message', None)\nerror, status_code = (None, status.HTTP_200_OK)\nif not group or not group_service.consist_member(group.id, id=req...
<|body_start_0|> group = group_service.get(id=request.data.get('group_id', None)) invitee_phone = request.data.get('invitee', None) role = request.data.get('role', None) message = request.data.get('message', None) error, status_code = (None, status.HTTP_200_OK) if not gro...
麦粒邀请相关API. ### Resource Description
InvitationViewSet
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvitationViewSet: """麦粒邀请相关API. ### Resource Description""" def create(self, request): """Invite user into group. 该接口所需的group_id 请在/api/0.1/users/{id}/home 进行获取 !注意: 测试该接口前 请先登录 ### 目前支持的关系: { 'm-grandfather': u'外公', 'm-grandmother': u'外婆', 'f-grandfather': u'爷爷', 'f-grandmother': u...
stack_v2_sparse_classes_75kplus_train_068747
4,368
permissive
[ { "docstring": "Invite user into group. 该接口所需的group_id 请在/api/0.1/users/{id}/home 进行获取 !注意: 测试该接口前 请先登录 ### 目前支持的关系: { 'm-grandfather': u'外公', 'm-grandmother': u'外婆', 'f-grandfather': u'爷爷', 'f-grandmother': u'奶奶', 'father': u'爸爸', 'mother': u'妈妈', 'child': u'孩子', 'wife': u'老婆', 'husband': u'老公', 'son': u'儿子', ...
2
stack_v2_sparse_classes_30k_train_020686
Implement the Python class `InvitationViewSet` described below. Class description: 麦粒邀请相关API. ### Resource Description Method signatures and docstrings: - def create(self, request): Invite user into group. 该接口所需的group_id 请在/api/0.1/users/{id}/home 进行获取 !注意: 测试该接口前 请先登录 ### 目前支持的关系: { 'm-grandfather': u'外公', 'm-grandm...
Implement the Python class `InvitationViewSet` described below. Class description: 麦粒邀请相关API. ### Resource Description Method signatures and docstrings: - def create(self, request): Invite user into group. 该接口所需的group_id 请在/api/0.1/users/{id}/home 进行获取 !注意: 测试该接口前 请先登录 ### 目前支持的关系: { 'm-grandfather': u'外公', 'm-grandm...
31ac08148fbe67ab166faa897c0cbe72cd7f62db
<|skeleton|> class InvitationViewSet: """麦粒邀请相关API. ### Resource Description""" def create(self, request): """Invite user into group. 该接口所需的group_id 请在/api/0.1/users/{id}/home 进行获取 !注意: 测试该接口前 请先登录 ### 目前支持的关系: { 'm-grandfather': u'外公', 'm-grandmother': u'外婆', 'f-grandfather': u'爷爷', 'f-grandmother': u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InvitationViewSet: """麦粒邀请相关API. ### Resource Description""" def create(self, request): """Invite user into group. 该接口所需的group_id 请在/api/0.1/users/{id}/home 进行获取 !注意: 测试该接口前 请先登录 ### 目前支持的关系: { 'm-grandfather': u'外公', 'm-grandmother': u'外婆', 'f-grandfather': u'爷爷', 'f-grandmother': u'奶奶', 'father...
the_stack_v2_python_sparse
wheat/apps/group/apis.py
fortyMiles/moment-note
train
2
82ea83c99624aeffada1a6a97090639a5114306c
[ "res = []\ncurr = root\nstack = []\nwhile curr or stack:\n while curr:\n stack.append(curr)\n res.append(str(curr.val))\n curr = curr.right\n curr = stack.pop()\n curr = curr.left\nreturn ';'.join(res[::-1])", "if not data:\n return None\ndata = list(map(int, data.split(';')))\nse...
<|body_start_0|> res = [] curr = root stack = [] while curr or stack: while curr: stack.append(curr) res.append(str(curr.val)) curr = curr.right curr = stack.pop() curr = curr.left return ';'.join...
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_068748
1,447
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_014526
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:...
8a82905d40b882b20a9b6f862942f8f3e4bebcf0
<|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""" res = [] curr = root stack = [] while curr or stack: while curr: stack.append(curr) res.append(str(curr.val)) ...
the_stack_v2_python_sparse
ByTags/Tree/449. Serialize and Deserialize BST.py
lynkeib/LeetCode
train
0
fdb6820433a14baf06aadc4c8b1a8c2a9d54a1a4
[ "if user_id is None:\n return None\nif not isinstance(user_id, str):\n return None\nsession_id = str(uuid.uuid4())\nself.user_id_by_session_id[session_id] = user_id\nreturn session_id", "if session_id is None or type(session_id) != str:\n return None\nvalue = self.user_id_by_session_id.get(session_id)\nr...
<|body_start_0|> if user_id is None: return None if not isinstance(user_id, str): return None session_id = str(uuid.uuid4()) self.user_id_by_session_id[session_id] = user_id return session_id <|end_body_0|> <|body_start_1|> if session_id is None o...
session authentication class, inherits from Auth
SessionAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionAuth: """session authentication class, inherits from Auth""" def create_session(self, user_id: str=None) -> str: """creates a Session ID for a user_id""" <|body_0|> def user_id_for_session_id(self, session_id: str=None) -> str: """returns a user ID based o...
stack_v2_sparse_classes_75kplus_train_068749
1,717
no_license
[ { "docstring": "creates a Session ID for a user_id", "name": "create_session", "signature": "def create_session(self, user_id: str=None) -> str" }, { "docstring": "returns a user ID based on session ID", "name": "user_id_for_session_id", "signature": "def user_id_for_session_id(self, ses...
4
stack_v2_sparse_classes_30k_train_010778
Implement the Python class `SessionAuth` described below. Class description: session authentication class, inherits from Auth Method signatures and docstrings: - def create_session(self, user_id: str=None) -> str: creates a Session ID for a user_id - def user_id_for_session_id(self, session_id: str=None) -> str: retu...
Implement the Python class `SessionAuth` described below. Class description: session authentication class, inherits from Auth Method signatures and docstrings: - def create_session(self, user_id: str=None) -> str: creates a Session ID for a user_id - def user_id_for_session_id(self, session_id: str=None) -> str: retu...
664fba60c37e2bfffd062e93cbe42f188d57354a
<|skeleton|> class SessionAuth: """session authentication class, inherits from Auth""" def create_session(self, user_id: str=None) -> str: """creates a Session ID for a user_id""" <|body_0|> def user_id_for_session_id(self, session_id: str=None) -> str: """returns a user ID based o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SessionAuth: """session authentication class, inherits from Auth""" def create_session(self, user_id: str=None) -> str: """creates a Session ID for a user_id""" if user_id is None: return None if not isinstance(user_id, str): return None session_id ...
the_stack_v2_python_sparse
0x07-Session_authentication/api/v1/auth/session_auth.py
haggaingosamwape/backend
train
0
95c6adab8521e2afe072897e167315599fa7cb00
[ "self.store = {}\nself.random_set = set()\nself.random_store = {}\nself.count = 1", "if self.store.get(val):\n return False\nself.store[val] = self.count\nself.random_store[self.count] = val\nself.count += 1\nreturn True", "if not val in self.store:\n return False\ncount = self.store[val]\ndel self.store[...
<|body_start_0|> self.store = {} self.random_set = set() self.random_store = {} self.count = 1 <|end_body_0|> <|body_start_1|> if self.store.get(val): return False self.store[val] = self.count self.random_store[self.count] = val self.count += ...
RandomizedSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element.""" <|body_1|> def remove(se...
stack_v2_sparse_classes_75kplus_train_068750
1,387
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element.", "name": "insert", "signature": "def insert(self, val: int) ...
4
stack_v2_sparse_classes_30k_train_041120
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta...
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val: int) -> bool: Inserts a value to the set. Returns true if the set did not already conta...
ddef96b5ecc699a590376a892a804c143fe18034
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not already contain the specified element.""" <|body_1|> def remove(se...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomizedSet: def __init__(self): """Initialize your data structure here.""" self.store = {} self.random_set = set() self.random_store = {} self.count = 1 def insert(self, val: int) -> bool: """Inserts a value to the set. Returns true if the set did not al...
the_stack_v2_python_sparse
leetcode/medium/insert-delete-getrandom-o1.py
vtemian/interviews-prep
train
8
738285b76f2397bdec9ae34f59a8bc0dc360fc2a
[ "user_ids = ['1087770692']\nfor user_id in user_ids:\n url = f'https://weibo.com/ajax/statuses/mymblog?uid={user_id}&page=1'\n yield Request(url, callback=self.parse, meta={'user_id': user_id, 'page_num': 1})", "data = json.loads(response.text)\ntweets = data['data']['list']\nfor tweet in tweets:\n item ...
<|body_start_0|> user_ids = ['1087770692'] for user_id in user_ids: url = f'https://weibo.com/ajax/statuses/mymblog?uid={user_id}&page=1' yield Request(url, callback=self.parse, meta={'user_id': user_id, 'page_num': 1}) <|end_body_0|> <|body_start_1|> data = json.loads(r...
用户推文数据采集
TweetSpiderByUserID
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TweetSpiderByUserID: """用户推文数据采集""" def start_requests(self): """爬虫入口""" <|body_0|> def parse(self, response, **kwargs): """网页解析""" <|body_1|> <|end_skeleton|> <|body_start_0|> user_ids = ['1087770692'] for user_id in user_ids: ...
stack_v2_sparse_classes_75kplus_train_068751
1,615
permissive
[ { "docstring": "爬虫入口", "name": "start_requests", "signature": "def start_requests(self)" }, { "docstring": "网页解析", "name": "parse", "signature": "def parse(self, response, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_040048
Implement the Python class `TweetSpiderByUserID` described below. Class description: 用户推文数据采集 Method signatures and docstrings: - def start_requests(self): 爬虫入口 - def parse(self, response, **kwargs): 网页解析
Implement the Python class `TweetSpiderByUserID` described below. Class description: 用户推文数据采集 Method signatures and docstrings: - def start_requests(self): 爬虫入口 - def parse(self, response, **kwargs): 网页解析 <|skeleton|> class TweetSpiderByUserID: """用户推文数据采集""" def start_requests(self): """爬虫入口""" ...
5e2d807e043e29f9eca226d6a36a031a406c4235
<|skeleton|> class TweetSpiderByUserID: """用户推文数据采集""" def start_requests(self): """爬虫入口""" <|body_0|> def parse(self, response, **kwargs): """网页解析""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TweetSpiderByUserID: """用户推文数据采集""" def start_requests(self): """爬虫入口""" user_ids = ['1087770692'] for user_id in user_ids: url = f'https://weibo.com/ajax/statuses/mymblog?uid={user_id}&page=1' yield Request(url, callback=self.parse, meta={'user_id': user_i...
the_stack_v2_python_sparse
weibospider/spiders/tweet_by_user_id.py
nghuyong/WeiboSpider
train
3,433
4b67050e5fb141c49bb81764757cfae646fdb1be
[ "sleep(1)\nself.user_info = str(uuid.uuid1()).split('-')[0]\npost_data = {'user_name': self.user_info, 'password1': 'pineapple', 'password2': 'pineapple', 'email': self.user_info + '@gmail.com'}\nresponse = self.client.post('/profile_page/api/register', post_data)\nself.assertEqual(response.status_code, 200, msg=f'...
<|body_start_0|> sleep(1) self.user_info = str(uuid.uuid1()).split('-')[0] post_data = {'user_name': self.user_info, 'password1': 'pineapple', 'password2': 'pineapple', 'email': self.user_info + '@gmail.com'} response = self.client.post('/profile_page/api/register', post_data) se...
Tests the API calls that is related to deleting user account.
Delete
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Delete: """Tests the API calls that is related to deleting user account.""" def setUp(self): """Create an account.""" <|body_0|> def test_delete(self): """Tests account deleting by checking if it is still in the database.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_068752
42,352
permissive
[ { "docstring": "Create an account.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests account deleting by checking if it is still in the database.", "name": "test_delete", "signature": "def test_delete(self)" } ]
2
null
Implement the Python class `Delete` described below. Class description: Tests the API calls that is related to deleting user account. Method signatures and docstrings: - def setUp(self): Create an account. - def test_delete(self): Tests account deleting by checking if it is still in the database.
Implement the Python class `Delete` described below. Class description: Tests the API calls that is related to deleting user account. Method signatures and docstrings: - def setUp(self): Create an account. - def test_delete(self): Tests account deleting by checking if it is still in the database. <|skeleton|> class ...
a47c849ea97763eff1005273a58aa3d8ab663ff2
<|skeleton|> class Delete: """Tests the API calls that is related to deleting user account.""" def setUp(self): """Create an account.""" <|body_0|> def test_delete(self): """Tests account deleting by checking if it is still in the database.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Delete: """Tests the API calls that is related to deleting user account.""" def setUp(self): """Create an account.""" sleep(1) self.user_info = str(uuid.uuid1()).split('-')[0] post_data = {'user_name': self.user_info, 'password1': 'pineapple', 'password2': 'pineapple', 'em...
the_stack_v2_python_sparse
profile_page/api/tests_api.py
Plongesam/data-structures-game
train
2
a46c009c543e5be55ab11710f479c242db23127c
[ "def app_fn1(request):\n return str(request.params.get('foo'))\napp = makeapp({'': app_fn1})\nr = simulate_post(app, '/', {'foo': 'some data'})\nself.assertEqual(r.status, u'200 OK')\nself.assertEqual(dict(r.headers)[u'Content-Type'], u'text/plain')\nself.assertEqual(r.body, u\"['some data']\")", "@wsgiwapi.js...
<|body_start_0|> def app_fn1(request): return str(request.params.get('foo')) app = makeapp({'': app_fn1}) r = simulate_post(app, '/', {'foo': 'some data'}) self.assertEqual(r.status, u'200 OK') self.assertEqual(dict(r.headers)[u'Content-Type'], u'text/plain') ...
Test validation support.
PostdataTest
[ "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostdataTest: """Test validation support.""" def test_default(self): """Test basic use of the default postdata handler.""" <|body_0|> def test_json(self): """Test use of the default postdata handler with JSON body.""" <|body_1|> def test_stream(self)...
stack_v2_sparse_classes_75kplus_train_068753
2,940
permissive
[ { "docstring": "Test basic use of the default postdata handler.", "name": "test_default", "signature": "def test_default(self)" }, { "docstring": "Test use of the default postdata handler with JSON body.", "name": "test_json", "signature": "def test_json(self)" }, { "docstring": ...
3
stack_v2_sparse_classes_30k_train_052515
Implement the Python class `PostdataTest` described below. Class description: Test validation support. Method signatures and docstrings: - def test_default(self): Test basic use of the default postdata handler. - def test_json(self): Test use of the default postdata handler with JSON body. - def test_stream(self): Te...
Implement the Python class `PostdataTest` described below. Class description: Test validation support. Method signatures and docstrings: - def test_default(self): Test basic use of the default postdata handler. - def test_json(self): Test use of the default postdata handler with JSON body. - def test_stream(self): Te...
040acfcc9fa724707a88e685dcd092e0606d05a3
<|skeleton|> class PostdataTest: """Test validation support.""" def test_default(self): """Test basic use of the default postdata handler.""" <|body_0|> def test_json(self): """Test use of the default postdata handler with JSON body.""" <|body_1|> def test_stream(self)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PostdataTest: """Test validation support.""" def test_default(self): """Test basic use of the default postdata handler.""" def app_fn1(request): return str(request.params.get('foo')) app = makeapp({'': app_fn1}) r = simulate_post(app, '/', {'foo': 'some data'})...
the_stack_v2_python_sparse
wsgiwapi/unittests/postdata.py
rboulton/wsgiwapi
train
0
0a5719a282e9565d8b7f113a09f5b3a5c2a9aa1d
[ "self.user1 = User.objects.create_user('test_user1', 'test_user1@email.com', 'password')\nself.user2 = User.objects.create_user('test_user2', 'test_user2@email.com', 'password')\nself.feed1 = Feed.objects.get(user=self.user1)\nself.post_sample = Post.objects.create(owner=self.user2, text='hello world')\nself.feedit...
<|body_start_0|> self.user1 = User.objects.create_user('test_user1', 'test_user1@email.com', 'password') self.user2 = User.objects.create_user('test_user2', 'test_user2@email.com', 'password') self.feed1 = Feed.objects.get(user=self.user1) self.post_sample = Post.objects.create(owner=sel...
FeedItemTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeedItemTestCase: def setUp(self): """Data setup for the test.""" <|body_0|> def test_create_feeditem(self): """Ensure an user can not create a feeditem.""" <|body_1|> def test_delete_feeditem(self): """Ensure an user can not delete a feeditem.""...
stack_v2_sparse_classes_75kplus_train_068754
6,168
no_license
[ { "docstring": "Data setup for the test.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Ensure an user can not create a feeditem.", "name": "test_create_feeditem", "signature": "def test_create_feeditem(self)" }, { "docstring": "Ensure an user can not delete...
6
stack_v2_sparse_classes_30k_train_000403
Implement the Python class `FeedItemTestCase` described below. Class description: Implement the FeedItemTestCase class. Method signatures and docstrings: - def setUp(self): Data setup for the test. - def test_create_feeditem(self): Ensure an user can not create a feeditem. - def test_delete_feeditem(self): Ensure an ...
Implement the Python class `FeedItemTestCase` described below. Class description: Implement the FeedItemTestCase class. Method signatures and docstrings: - def setUp(self): Data setup for the test. - def test_create_feeditem(self): Ensure an user can not create a feeditem. - def test_delete_feeditem(self): Ensure an ...
49cf4d521797ae81dcffaf88a6695b35eb6c682a
<|skeleton|> class FeedItemTestCase: def setUp(self): """Data setup for the test.""" <|body_0|> def test_create_feeditem(self): """Ensure an user can not create a feeditem.""" <|body_1|> def test_delete_feeditem(self): """Ensure an user can not delete a feeditem.""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeedItemTestCase: def setUp(self): """Data setup for the test.""" self.user1 = User.objects.create_user('test_user1', 'test_user1@email.com', 'password') self.user2 = User.objects.create_user('test_user2', 'test_user2@email.com', 'password') self.feed1 = Feed.objects.get(user=s...
the_stack_v2_python_sparse
FacebookCloneWebService/feed/tests.py
toddlamb/Academic_Projects
train
0
ab42996ddb20e7f3cb844b531d8d995d301333be
[ "permission = AdministerOrganizationPermission(orgname)\nif permission.can() or allow_if_superuser():\n try:\n org = model.organization.get_organization(orgname)\n except model.InvalidOrganizationException:\n raise NotFound()\n applications = model.oauth.list_applications_for_org(org)\n re...
<|body_start_0|> permission = AdministerOrganizationPermission(orgname) if permission.can() or allow_if_superuser(): try: org = model.organization.get_organization(orgname) except model.InvalidOrganizationException: raise NotFound() app...
Resource for managing applications defined by an organization.
OrganizationApplications
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationApplications: """Resource for managing applications defined by an organization.""" def get(self, orgname): """List the applications for the specified organization.""" <|body_0|> def post(self, orgname): """Creates a new application under this organiza...
stack_v2_sparse_classes_75kplus_train_068755
37,715
permissive
[ { "docstring": "List the applications for the specified organization.", "name": "get", "signature": "def get(self, orgname)" }, { "docstring": "Creates a new application under this organization.", "name": "post", "signature": "def post(self, orgname)" } ]
2
stack_v2_sparse_classes_30k_train_017837
Implement the Python class `OrganizationApplications` described below. Class description: Resource for managing applications defined by an organization. Method signatures and docstrings: - def get(self, orgname): List the applications for the specified organization. - def post(self, orgname): Creates a new applicatio...
Implement the Python class `OrganizationApplications` described below. Class description: Resource for managing applications defined by an organization. Method signatures and docstrings: - def get(self, orgname): List the applications for the specified organization. - def post(self, orgname): Creates a new applicatio...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class OrganizationApplications: """Resource for managing applications defined by an organization.""" def get(self, orgname): """List the applications for the specified organization.""" <|body_0|> def post(self, orgname): """Creates a new application under this organiza...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrganizationApplications: """Resource for managing applications defined by an organization.""" def get(self, orgname): """List the applications for the specified organization.""" permission = AdministerOrganizationPermission(orgname) if permission.can() or allow_if_superuser(): ...
the_stack_v2_python_sparse
endpoints/api/organization.py
quay/quay
train
2,363
de8e396c74f36961c56945098dd57b8590f0f332
[ "with open(triplets_path) as file:\n reader = csv.reader(file)\n self.triplets = [triplet for triplet in reader]\nself.loader = LoadImage()\nself.transformer = TransformImage(network_type=network_type)", "q = torch.autograd.Variable(self.transformer(self.loader(self.triplets[index][0]))).unsqueeze(0)\np = t...
<|body_start_0|> with open(triplets_path) as file: reader = csv.reader(file) self.triplets = [triplet for triplet in reader] self.loader = LoadImage() self.transformer = TransformImage(network_type=network_type) <|end_body_0|> <|body_start_1|> q = torch.autograd....
TripletDataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TripletDataset: def __init__(self, triplets_path, network_type): """:param triplets_file: List of lists containing all the triplets and corresponding image paths. e.g [[q1_path, p1_path, n1_path], [q2_path, p2_path, n2_path] ...]""" <|body_0|> def load_single_triplet(self, i...
stack_v2_sparse_classes_75kplus_train_068756
15,368
no_license
[ { "docstring": ":param triplets_file: List of lists containing all the triplets and corresponding image paths. e.g [[q1_path, p1_path, n1_path], [q2_path, p2_path, n2_path] ...]", "name": "__init__", "signature": "def __init__(self, triplets_path, network_type)" }, { "docstring": "Returns proces...
3
stack_v2_sparse_classes_30k_test_000311
Implement the Python class `TripletDataset` described below. Class description: Implement the TripletDataset class. Method signatures and docstrings: - def __init__(self, triplets_path, network_type): :param triplets_file: List of lists containing all the triplets and corresponding image paths. e.g [[q1_path, p1_path...
Implement the Python class `TripletDataset` described below. Class description: Implement the TripletDataset class. Method signatures and docstrings: - def __init__(self, triplets_path, network_type): :param triplets_file: List of lists containing all the triplets and corresponding image paths. e.g [[q1_path, p1_path...
ae0067133c0a4275d16fa603ac68a3c821d1e83e
<|skeleton|> class TripletDataset: def __init__(self, triplets_path, network_type): """:param triplets_file: List of lists containing all the triplets and corresponding image paths. e.g [[q1_path, p1_path, n1_path], [q2_path, p2_path, n2_path] ...]""" <|body_0|> def load_single_triplet(self, i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TripletDataset: def __init__(self, triplets_path, network_type): """:param triplets_file: List of lists containing all the triplets and corresponding image paths. e.g [[q1_path, p1_path, n1_path], [q2_path, p2_path, n2_path] ...]""" with open(triplets_path) as file: reader = csv.re...
the_stack_v2_python_sparse
src/NetworkUtils.py
berkkov/netkov
train
1
53b2cf8dc191e6617c049c03477302e35774566e
[ "if not HAS_PYQT5:\n raise ImportError('PyQt5 package is required for Redux GUI.')\nsuper().__init__(configuration)\nself.app = None", "self.app = QtWidgets.QApplication(sys.argv)\nicon = QtGui.QIcon()\nicon.addPixmap(QtGui.QPixmap(':/icons/redux_icon.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off)\nself.app.setWi...
<|body_start_0|> if not HAS_PYQT5: raise ImportError('PyQt5 package is required for Redux GUI.') super().__init__(configuration) self.app = None <|end_body_0|> <|body_start_1|> self.app = QtWidgets.QApplication(sys.argv) icon = QtGui.QIcon() icon.addPixmap(Qt...
Graphical interface to Redux reduction objects. This class provides a Qt5 GUI that allows interactive parameter setting and reduction step running. Intermediate data viewers are also supported. Most functionality is inherited from the `Interface` class. Attributes ---------- app: QApplication A top-level Qt widget.
Application
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Application: """Graphical interface to Redux reduction objects. This class provides a Qt5 GUI that allows interactive parameter setting and reduction step running. Intermediate data viewers are also supported. Most functionality is inherited from the `Interface` class. Attributes ---------- app: ...
stack_v2_sparse_classes_75kplus_train_068757
2,239
permissive
[ { "docstring": "Initialize the application, with an optional configuration. Parameters ---------- configuration : `Configuration`, optional Configuration items to be used for all reductions", "name": "__init__", "signature": "def __init__(self, configuration=None)" }, { "docstring": "Start up th...
2
stack_v2_sparse_classes_30k_train_024083
Implement the Python class `Application` described below. Class description: Graphical interface to Redux reduction objects. This class provides a Qt5 GUI that allows interactive parameter setting and reduction step running. Intermediate data viewers are also supported. Most functionality is inherited from the `Interf...
Implement the Python class `Application` described below. Class description: Graphical interface to Redux reduction objects. This class provides a Qt5 GUI that allows interactive parameter setting and reduction step running. Intermediate data viewers are also supported. Most functionality is inherited from the `Interf...
493700340cd34d5f319af6f3a562a82135bb30dd
<|skeleton|> class Application: """Graphical interface to Redux reduction objects. This class provides a Qt5 GUI that allows interactive parameter setting and reduction step running. Intermediate data viewers are also supported. Most functionality is inherited from the `Interface` class. Attributes ---------- app: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Application: """Graphical interface to Redux reduction objects. This class provides a Qt5 GUI that allows interactive parameter setting and reduction step running. Intermediate data viewers are also supported. Most functionality is inherited from the `Interface` class. Attributes ---------- app: QApplication ...
the_stack_v2_python_sparse
sofia_redux/pipeline/application.py
SOFIA-USRA/sofia_redux
train
12
e61f3bf58c7816b9f347806696b8ae06278cdac5
[ "scheduler = opt.GammaBetaDecreasingStep()\nwith self.assertRaisesRegexp(Exception, err_msg):\n scheduler(1)", "beta = _ops.convert_to_tensor_v2(2, dtype=tf.float32)\ngamma = _ops.convert_to_tensor_v2(1, dtype=tf.float32)\nscheduler = opt.GammaBetaDecreasingStep()\nscheduler.initialize(beta, gamma)\nstep = _op...
<|body_start_0|> scheduler = opt.GammaBetaDecreasingStep() with self.assertRaisesRegexp(Exception, err_msg): scheduler(1) <|end_body_0|> <|body_start_1|> beta = _ops.convert_to_tensor_v2(2, dtype=tf.float32) gamma = _ops.convert_to_tensor_v2(1, dtype=tf.float32) sche...
GammaBeta Scheduler tests.
SchedulerTest
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SchedulerTest: """GammaBeta Scheduler tests.""" def test_bad_call(self, err_msg): """Test attribute of internal opt correctly rerouted to the internal opt. Args: err_msg: The expected error message from the scheduler bad call.""" <|body_0|> def test_call(self, step, res)...
stack_v2_sparse_classes_75kplus_train_068758
18,768
permissive
[ { "docstring": "Test attribute of internal opt correctly rerouted to the internal opt. Args: err_msg: The expected error message from the scheduler bad call.", "name": "test_bad_call", "signature": "def test_bad_call(self, err_msg)" }, { "docstring": "Test call. Test that attribute of internal o...
2
stack_v2_sparse_classes_30k_train_006828
Implement the Python class `SchedulerTest` described below. Class description: GammaBeta Scheduler tests. Method signatures and docstrings: - def test_bad_call(self, err_msg): Test attribute of internal opt correctly rerouted to the internal opt. Args: err_msg: The expected error message from the scheduler bad call. ...
Implement the Python class `SchedulerTest` described below. Class description: GammaBeta Scheduler tests. Method signatures and docstrings: - def test_bad_call(self, err_msg): Test attribute of internal opt correctly rerouted to the internal opt. Args: err_msg: The expected error message from the scheduler bad call. ...
c92610e37aa340932ed2d963813e0890035a22bc
<|skeleton|> class SchedulerTest: """GammaBeta Scheduler tests.""" def test_bad_call(self, err_msg): """Test attribute of internal opt correctly rerouted to the internal opt. Args: err_msg: The expected error message from the scheduler bad call.""" <|body_0|> def test_call(self, step, res)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SchedulerTest: """GammaBeta Scheduler tests.""" def test_bad_call(self, err_msg): """Test attribute of internal opt correctly rerouted to the internal opt. Args: err_msg: The expected error message from the scheduler bad call.""" scheduler = opt.GammaBetaDecreasingStep() with self...
the_stack_v2_python_sparse
tensorflow_privacy/privacy/bolt_on/optimizers_test.py
tensorflow/privacy
train
1,881
f9c66ef088765e4a26a1a7640b3d4c757a79722a
[ "instance = self.get_object()\ncode = instance.code\noutput = self.run_code(code)\nreturn self.response(output=output, status='Successfully Run')", "code = self.request.POST.get('code')\nsave = self.request.GET.get('save') == 'true'\nname = self.request.POST.get('name')\noutput = self.run_code(code)\nif save:\n ...
<|body_start_0|> instance = self.get_object() code = instance.code output = self.run_code(code) return self.response(output=output, status='Successfully Run') <|end_body_0|> <|body_start_1|> code = self.request.POST.get('code') save = self.request.GET.get('save') == 'tru...
APIRunCodeView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APIRunCodeView: def get(self, request, *args, **kwargs): """GET 请求仅对能获取到 pk 值的 url 响应 :param request: 请求对象 :param args: 位置参数 :param kwargs: 关键字参数 :return: JsonResponse""" <|body_0|> def post(self, request, *args, **kwargs): """POST 请求可以被任意访问,并会检查 url 参数中的 save 值,如果 s...
stack_v2_sparse_classes_75kplus_train_068759
6,283
no_license
[ { "docstring": "GET 请求仅对能获取到 pk 值的 url 响应 :param request: 请求对象 :param args: 位置参数 :param kwargs: 关键字参数 :return: JsonResponse", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "POST 请求可以被任意访问,并会检查 url 参数中的 save 值,如果 save 为 true 则会 保存上传代码。 :param request: 请求对...
3
null
Implement the Python class `APIRunCodeView` described below. Class description: Implement the APIRunCodeView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET 请求仅对能获取到 pk 值的 url 响应 :param request: 请求对象 :param args: 位置参数 :param kwargs: 关键字参数 :return: JsonResponse - def post(self, ...
Implement the Python class `APIRunCodeView` described below. Class description: Implement the APIRunCodeView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): GET 请求仅对能获取到 pk 值的 url 响应 :param request: 请求对象 :param args: 位置参数 :param kwargs: 关键字参数 :return: JsonResponse - def post(self, ...
9821516dc739a1fdeca688454831728b64461999
<|skeleton|> class APIRunCodeView: def get(self, request, *args, **kwargs): """GET 请求仅对能获取到 pk 值的 url 响应 :param request: 请求对象 :param args: 位置参数 :param kwargs: 关键字参数 :return: JsonResponse""" <|body_0|> def post(self, request, *args, **kwargs): """POST 请求可以被任意访问,并会检查 url 参数中的 save 值,如果 s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class APIRunCodeView: def get(self, request, *args, **kwargs): """GET 请求仅对能获取到 pk 值的 url 响应 :param request: 请求对象 :param args: 位置参数 :param kwargs: 关键字参数 :return: JsonResponse""" instance = self.get_object() code = instance.code output = self.run_code(code) return self.response...
the_stack_v2_python_sparse
online_intepreter/views.py
Arithmeticjia/MyBlog
train
5
d5d5a5ef94395dafa56ab9300a52d0266ad518f7
[ "super().__init__()\nself._dfetcher1 = BaselineDirectoryFetcher(dpath1)\nself._dfetcher2 = BaselineDirectoryFetcher(dpath2)\nself._tests = tests\nself._kernels = kernels\nself._codenames = codenames", "result = {'source': self._dfetcher1.dpath, 'target': self._dfetcher2.dpath}\nfor test in self._tests:\n for k...
<|body_start_0|> super().__init__() self._dfetcher1 = BaselineDirectoryFetcher(dpath1) self._dfetcher2 = BaselineDirectoryFetcher(dpath2) self._tests = tests self._kernels = kernels self._codenames = codenames <|end_body_0|> <|body_start_1|> result = {'source': s...
Class for comparing baselines between directories
DirectoryComparator
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DirectoryComparator: """Class for comparing baselines between directories""" def __init__(self, dpath1, dpath2, tests, kernels, codenames): """Initialize 2 BaselineDirectoryFetcher""" <|body_0|> def compare(self, auxiliary=False): """Compare data between director...
stack_v2_sparse_classes_75kplus_train_068760
10,002
permissive
[ { "docstring": "Initialize 2 BaselineDirectoryFetcher", "name": "__init__", "signature": "def __init__(self, dpath1, dpath2, tests, kernels, codenames)" }, { "docstring": "Compare data between directories", "name": "compare", "signature": "def compare(self, auxiliary=False)" } ]
2
stack_v2_sparse_classes_30k_test_001603
Implement the Python class `DirectoryComparator` described below. Class description: Class for comparing baselines between directories Method signatures and docstrings: - def __init__(self, dpath1, dpath2, tests, kernels, codenames): Initialize 2 BaselineDirectoryFetcher - def compare(self, auxiliary=False): Compare ...
Implement the Python class `DirectoryComparator` described below. Class description: Class for comparing baselines between directories Method signatures and docstrings: - def __init__(self, dpath1, dpath2, tests, kernels, codenames): Initialize 2 BaselineDirectoryFetcher - def compare(self, auxiliary=False): Compare ...
028ace17e73dabb40601ecca95fea28bb6da4b4a
<|skeleton|> class DirectoryComparator: """Class for comparing baselines between directories""" def __init__(self, dpath1, dpath2, tests, kernels, codenames): """Initialize 2 BaselineDirectoryFetcher""" <|body_0|> def compare(self, auxiliary=False): """Compare data between director...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DirectoryComparator: """Class for comparing baselines between directories""" def __init__(self, dpath1, dpath2, tests, kernels, codenames): """Initialize 2 BaselineDirectoryFetcher""" super().__init__() self._dfetcher1 = BaselineDirectoryFetcher(dpath1) self._dfetcher2 = B...
the_stack_v2_python_sparse
tools/compare_baselines/utils/comparator.py
firecracker-microvm/firecracker
train
22,629
0bd07892af01dfa2c0e72ee019825ff9705261da
[ "self.value = value\nself.left = left\nself.right = right", "children = []\nif self.left:\n children.append(self.left)\nif self.right:\n children.append(self.right)\nchild_strings = [str(child).split('\\n') for child in children]\nmax_lines = 0\nif child_strings:\n max_lines = max([len(child) for child i...
<|body_start_0|> self.value = value self.left = left self.right = right <|end_body_0|> <|body_start_1|> children = [] if self.left: children.append(self.left) if self.right: children.append(self.right) child_strings = [str(child).split('\n...
A class representing a BinaryTree. value - The value of the BinaryTree's root left - The root node of this BinaryTree's left subtree. right - The root node of this BinaryTree's right subtree.
BinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTree: """A class representing a BinaryTree. value - The value of the BinaryTree's root left - The root node of this BinaryTree's left subtree. right - The root node of this BinaryTree's right subtree.""" def __init__(self, value: Any, left: 'BinaryTree'=None, right: 'BinaryTree'=None) ...
stack_v2_sparse_classes_75kplus_train_068761
6,409
no_license
[ { "docstring": "Initialize this BinaryTree with the root value value, left subtree left, and right subtree right.", "name": "__init__", "signature": "def __init__(self, value: Any, left: 'BinaryTree'=None, right: 'BinaryTree'=None) -> None" }, { "docstring": "Return the string representation of ...
4
stack_v2_sparse_classes_30k_train_042830
Implement the Python class `BinaryTree` described below. Class description: A class representing a BinaryTree. value - The value of the BinaryTree's root left - The root node of this BinaryTree's left subtree. right - The root node of this BinaryTree's right subtree. Method signatures and docstrings: - def __init__(s...
Implement the Python class `BinaryTree` described below. Class description: A class representing a BinaryTree. value - The value of the BinaryTree's root left - The root node of this BinaryTree's left subtree. right - The root node of this BinaryTree's right subtree. Method signatures and docstrings: - def __init__(s...
556c5485e38ad81dae7bb14e312f2b081100245d
<|skeleton|> class BinaryTree: """A class representing a BinaryTree. value - The value of the BinaryTree's root left - The root node of this BinaryTree's left subtree. right - The root node of this BinaryTree's right subtree.""" def __init__(self, value: Any, left: 'BinaryTree'=None, right: 'BinaryTree'=None) ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BinaryTree: """A class representing a BinaryTree. value - The value of the BinaryTree's root left - The root node of this BinaryTree's left subtree. right - The root node of this BinaryTree's right subtree.""" def __init__(self, value: Any, left: 'BinaryTree'=None, right: 'BinaryTree'=None) -> None: ...
the_stack_v2_python_sparse
pyta/Week11_summer/lab7.py
Kevintjy/Python-Beginner
train
1
3542928cdcce0ee823a24dd67bbada7a0e56f37f
[ "shares = Shares.objects.all()\nserializer = SharesSerializer(shares, many=True)\nreturn Response(serializer.data)", "serializer = SharesSerializer(data=request.DATA)\nif serializer.is_valid:\n serializer.save()\n return Response(serializer.data, status=status.HTTP_201_CREATED)\nreturn Response(serializer.e...
<|body_start_0|> shares = Shares.objects.all() serializer = SharesSerializer(shares, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> serializer = SharesSerializer(data=request.DATA) if serializer.is_valid: serializer.save() ret...
ShareList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShareList: def get(self, request, format=None): """Show a list of shares""" <|body_0|> def post(self, request, pk, format=None): """Add new share""" <|body_1|> <|end_skeleton|> <|body_start_0|> shares = Shares.objects.all() serializer = Shar...
stack_v2_sparse_classes_75kplus_train_068762
7,352
no_license
[ { "docstring": "Show a list of shares", "name": "get", "signature": "def get(self, request, format=None)" }, { "docstring": "Add new share", "name": "post", "signature": "def post(self, request, pk, format=None)" } ]
2
null
Implement the Python class `ShareList` described below. Class description: Implement the ShareList class. Method signatures and docstrings: - def get(self, request, format=None): Show a list of shares - def post(self, request, pk, format=None): Add new share
Implement the Python class `ShareList` described below. Class description: Implement the ShareList class. Method signatures and docstrings: - def get(self, request, format=None): Show a list of shares - def post(self, request, pk, format=None): Add new share <|skeleton|> class ShareList: def get(self, request, ...
c5ac11e40a628c93c3865363e97b4f255a104ca8
<|skeleton|> class ShareList: def get(self, request, format=None): """Show a list of shares""" <|body_0|> def post(self, request, pk, format=None): """Add new share""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ShareList: def get(self, request, format=None): """Show a list of shares""" shares = Shares.objects.all() serializer = SharesSerializer(shares, many=True) return Response(serializer.data) def post(self, request, pk, format=None): """Add new share""" seriali...
the_stack_v2_python_sparse
shares/views.py
lubegamark/gosacco
train
2
f6bbcf5045d5fa31d858a8a296e25d7313779112
[ "super().__init__()\nimport sklearn\nimport sklearn.naive_bayes\nself.model = sklearn.naive_bayes.MultinomialNB", "specs = super(MultinomialNB, cls).getInputSpecification()\nspecs.description = 'The \\\\\\\\textit{MultinomialNB} classifier implements the naive Bayes algorithm for\\n multino...
<|body_start_0|> super().__init__() import sklearn import sklearn.naive_bayes self.model = sklearn.naive_bayes.MultinomialNB <|end_body_0|> <|body_start_1|> specs = super(MultinomialNB, cls).getInputSpecification() specs.description = 'The \\\\textit{MultinomialNB} class...
MultinomialNBClassifier Naive Bayes classifier for multinomial models
MultinomialNB
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultinomialNB: """MultinomialNBClassifier Naive Bayes classifier for multinomial models""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """M...
stack_v2_sparse_classes_75kplus_train_068763
5,834
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
3
stack_v2_sparse_classes_30k_train_046118
Implement the Python class `MultinomialNB` described below. Class description: MultinomialNBClassifier Naive Bayes classifier for multinomial models Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInput...
Implement the Python class `MultinomialNB` described below. Class description: MultinomialNBClassifier Naive Bayes classifier for multinomial models Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInput...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class MultinomialNB: """MultinomialNBClassifier Naive Bayes classifier for multinomial models""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """M...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultinomialNB: """MultinomialNBClassifier Naive Bayes classifier for multinomial models""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" super().__init__() import sklearn import sklearn.naive_ba...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/NaiveBayes/MultinomialNBClassifier.py
idaholab/raven
train
201
55ddffee0e8cc76d352b5e963279581590c82422
[ "MainClass.__init__(self)\nself.log_path = './work'\nself.log_to_screen = True\nself.config_path = './config.json'", "self.logger.info('==WorkClass开始==')\nfor key in self.config.keys():\n print('self.config[{}] = {}'.format(key, self.config[key]))\nfor key in self.argv.keys():\n print('self.argv[{}] = {}'.f...
<|body_start_0|> MainClass.__init__(self) self.log_path = './work' self.log_to_screen = True self.config_path = './config.json' <|end_body_0|> <|body_start_1|> self.logger.info('==WorkClass开始==') for key in self.config.keys(): print('self.config[{}] = {}'.for...
工作类
WorkClass
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkClass: """工作类""" def __init__(self): """初始化""" <|body_0|> def work(self): """实际工作逻辑 覆盖父类""" <|body_1|> <|end_skeleton|> <|body_start_0|> MainClass.__init__(self) self.log_path = './work' self.log_to_screen = True self...
stack_v2_sparse_classes_75kplus_train_068764
1,334
no_license
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "实际工作逻辑 覆盖父类", "name": "work", "signature": "def work(self)" } ]
2
stack_v2_sparse_classes_30k_train_008698
Implement the Python class `WorkClass` described below. Class description: 工作类 Method signatures and docstrings: - def __init__(self): 初始化 - def work(self): 实际工作逻辑 覆盖父类
Implement the Python class `WorkClass` described below. Class description: 工作类 Method signatures and docstrings: - def __init__(self): 初始化 - def work(self): 实际工作逻辑 覆盖父类 <|skeleton|> class WorkClass: """工作类""" def __init__(self): """初始化""" <|body_0|> def work(self): """实际工作逻辑 覆盖父...
866b0ca5eadcc7b7390dc1654d71c58234314efb
<|skeleton|> class WorkClass: """工作类""" def __init__(self): """初始化""" <|body_0|> def work(self): """实际工作逻辑 覆盖父类""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WorkClass: """工作类""" def __init__(self): """初始化""" MainClass.__init__(self) self.log_path = './work' self.log_to_screen = True self.config_path = './config.json' def work(self): """实际工作逻辑 覆盖父类""" self.logger.info('==WorkClass开始==') for ...
the_stack_v2_python_sparse
package_mgr/work^k1-v1^k2-v2.py
laijingfeng/PythonScripts
train
1
da94aa150dea8c2040627e6afe4dea2410ac3735
[ "df = self.read_pdf()\nresult = {}\nfor item in df.to_dicts():\n key = item['dwd_id']\n value = item\n result[key] = value\nreturn result", "import tabula\ndf = tabula.read_pdf(self.url, multiple_tables=False, pages=1)[0]\ndf = pl.from_pandas(df)\ndf.columns = ['name', 'dwd_id', 'wmo_id', 'coordinates_wg...
<|body_start_0|> df = self.read_pdf() result = {} for item in df.to_dicts(): key = item['dwd_id'] value = item result[key] = value return result <|end_body_0|> <|body_start_1|> import tabula df = tabula.read_pdf(self.url, multiple_tabl...
Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile [2] https://www.dwd.de/DE/leistungen/radolan/radolan_info/radolan_radvor_op_komposit_format_pdf.pd...
DwdRadarSitesGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DwdRadarSitesGenerator: """Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile [2] https://www.dwd.de/DE/leistungen/radolan/rad...
stack_v2_sparse_classes_75kplus_train_068765
4,243
permissive
[ { "docstring": "Build dictionary from DataFrame containing radar site information.", "name": "all", "signature": "def all(self) -> Dict" }, { "docstring": "Parse PDF file and build DataFrame containing radar site information.", "name": "read_pdf", "signature": "def read_pdf(self) -> pl.D...
2
null
Implement the Python class `DwdRadarSitesGenerator` described below. Class description: Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile [2] https...
Implement the Python class `DwdRadarSitesGenerator` described below. Class description: Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile [2] https...
448fbd56b67978cf8f4215dedc02a11b89f66b01
<|skeleton|> class DwdRadarSitesGenerator: """Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile [2] https://www.dwd.de/DE/leistungen/radolan/rad...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DwdRadarSitesGenerator: """Parse list of sites from PDF documents [1,2] and output as Python dictionary. [1] https://www.dwd.de/DE/derdwd/messnetz/atmosphaerenbeobachtung/_functions/HaeufigGesucht/koordinaten-radarverbund.pdf?__blob=publicationFile [2] https://www.dwd.de/DE/leistungen/radolan/radolan_info/rad...
the_stack_v2_python_sparse
wetterdienst/provider/dwd/radar/sites.py
earthobservations/wetterdienst
train
283
c44a8969aa528e1ed7199439dc037e57cd7f53eb
[ "\"\"\"For Frequency Prescalar-0\"\"\"\nbus.write_byte_data(PCA9530_2C_1_DEFAULT_ADDRESS, PCA9530_2C_1_REG_PSC0, PCA9530_2C_1_PSC0_USERDEFINED)\n'For Frequency Prescalar-1'\nbus.write_byte_data(PCA9530_2C_1_DEFAULT_ADDRESS, PCA9530_2C_1_REG_PSC1, PCA9530_2C_1_PSC1_USERDEFINED)", "\"\"\"For PWM Register-0\"\"\"\nb...
<|body_start_0|> """For Frequency Prescalar-0""" bus.write_byte_data(PCA9530_2C_1_DEFAULT_ADDRESS, PCA9530_2C_1_REG_PSC0, PCA9530_2C_1_PSC0_USERDEFINED) 'For Frequency Prescalar-1' bus.write_byte_data(PCA9530_2C_1_DEFAULT_ADDRESS, PCA9530_2C_1_REG_PSC1, PCA9530_2C_1_PSC1_USERDEFINED) <|e...
PCA9530_2C_1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PCA9530_2C_1: def set_frequency(self): """Select the Frequency Prescalar Configuration from the given provided value""" <|body_0|> def set_pulse_width(self): """Select the PWM Register Configuration from the given provided value""" <|body_1|> def set_led...
stack_v2_sparse_classes_75kplus_train_068766
3,054
no_license
[ { "docstring": "Select the Frequency Prescalar Configuration from the given provided value", "name": "set_frequency", "signature": "def set_frequency(self)" }, { "docstring": "Select the PWM Register Configuration from the given provided value", "name": "set_pulse_width", "signature": "d...
3
stack_v2_sparse_classes_30k_train_034205
Implement the Python class `PCA9530_2C_1` described below. Class description: Implement the PCA9530_2C_1 class. Method signatures and docstrings: - def set_frequency(self): Select the Frequency Prescalar Configuration from the given provided value - def set_pulse_width(self): Select the PWM Register Configuration fro...
Implement the Python class `PCA9530_2C_1` described below. Class description: Implement the PCA9530_2C_1 class. Method signatures and docstrings: - def set_frequency(self): Select the Frequency Prescalar Configuration from the given provided value - def set_pulse_width(self): Select the PWM Register Configuration fro...
736b29434a451a384c2f52490c849239c3190951
<|skeleton|> class PCA9530_2C_1: def set_frequency(self): """Select the Frequency Prescalar Configuration from the given provided value""" <|body_0|> def set_pulse_width(self): """Select the PWM Register Configuration from the given provided value""" <|body_1|> def set_led...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PCA9530_2C_1: def set_frequency(self): """Select the Frequency Prescalar Configuration from the given provided value""" """For Frequency Prescalar-0""" bus.write_byte_data(PCA9530_2C_1_DEFAULT_ADDRESS, PCA9530_2C_1_REG_PSC0, PCA9530_2C_1_PSC0_USERDEFINED) 'For Frequency Prescal...
the_stack_v2_python_sparse
PCA9530_2C_1.py
ControlEverythingCommunity/CE_PYTHON_LIB
train
7
0d8eec432e6978f5607a4047912dfc2665ca436e
[ "index = {}\nfor i in xrange(len(nums)):\n a = nums[i]\n b = target - a\n if b in index:\n return [index[b], i]\n index[a] = i", "size = len(nums)\nfor i in xrange(size):\n for j in xrange(i + 1, size):\n if nums[i] + nums[j] == target:\n return [i, j]" ]
<|body_start_0|> index = {} for i in xrange(len(nums)): a = nums[i] b = target - a if b in index: return [index[b], i] index[a] = i <|end_body_0|> <|body_start_1|> size = len(nums) for i in xrange(size): for j i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_1(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0...
stack_v2_sparse_classes_75kplus_train_068767
1,008
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum_1", "signature": "def twoSum_1(self, nums, target)" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum_1(self, nums, target): :type nums: List[int] :type target: int :rtype: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] - def twoSum_1(self, nums, target): :type nums: List[int] :type target: int :rtype: List...
e6ba90501482e0d86d0b135979d8a132eaa0941e
<|skeleton|> class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum_1(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def twoSum(self, nums, target): """:type nums: List[int] :type target: int :rtype: List[int]""" index = {} for i in xrange(len(nums)): a = nums[i] b = target - a if b in index: return [index[b], i] index[a] = i ...
the_stack_v2_python_sparse
001_Two_Sum.py
lostarray/LeetCode
train
0
2ca8b52e3f9e8f2192f8b33935f2d363cd13fc38
[ "connection = pymysql.connect(host='31.31.196.245', user='u0981115', password='qwert5656', database='u0981115_itsunrise', charset='utf8mb4')\ncursor = connection.cursor()\ncursor.execute(self)\nOTV = cursor.fetchall()\nreturn OTV", "connection = pymysql.connect(host='31.31.196.245', user='u0981115', password='qwe...
<|body_start_0|> connection = pymysql.connect(host='31.31.196.245', user='u0981115', password='qwert5656', database='u0981115_itsunrise', charset='utf8mb4') cursor = connection.cursor() cursor.execute(self) OTV = cursor.fetchall() return OTV <|end_body_0|> <|body_start_1|> ...
Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL')
DB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DB: """Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL')""" def GET(self): """Получает данные с Базы данных""" <|body_0|> def POST(self): """Отправляет данные в Базу данных""" <|body_1|> <...
stack_v2_sparse_classes_75kplus_train_068768
8,580
no_license
[ { "docstring": "Получает данные с Базы данных", "name": "GET", "signature": "def GET(self)" }, { "docstring": "Отправляет данные в Базу данных", "name": "POST", "signature": "def POST(self)" } ]
2
stack_v2_sparse_classes_30k_train_013159
Implement the Python class `DB` described below. Class description: Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL') Method signatures and docstrings: - def GET(self): Получает данные с Базы данных - def POST(self): Отправляет данные в Базу данных
Implement the Python class `DB` described below. Class description: Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL') Method signatures and docstrings: - def GET(self): Получает данные с Базы данных - def POST(self): Отправляет данные в Базу данных <|...
0b9727d2c7ef8b76d4ed5a3344f17bfb215f9c73
<|skeleton|> class DB: """Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL')""" def GET(self): """Получает данные с Базы данных""" <|body_0|> def POST(self): """Отправляет данные в Базу данных""" <|body_1|> <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DB: """Работа с Базой данных получить данные:: DB.GET('Текст запроса SQL') отправить данные:: DB.POST('Текст запроса SQL')""" def GET(self): """Получает данные с Базы данных""" connection = pymysql.connect(host='31.31.196.245', user='u0981115', password='qwert5656', database='u0981115_its...
the_stack_v2_python_sparse
site/site.py
WTTeneger/ITSunrise_MCH
train
0
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace
[ "super(TriggerVelocity, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor\nself._target_velocity = target_velocity", "new_status = py_trees.common.Status.RUNNING\ndelta_velocity = self._target_velocity - CarlaDataProvider.get_velocity(self._actor)\nif delta_ve...
<|body_start_0|> super(TriggerVelocity, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._actor = actor self._target_velocity = target_velocity <|end_body_0|> <|body_start_1|> new_status = py_trees.common.Status.RUNNING delta_velocit...
This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as fast as target_velocity in m/s The condition terminates with SUCCESS, when the ac...
TriggerVelocity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriggerVelocity: """This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as fast as target_velocity in m/s The con...
stack_v2_sparse_classes_75kplus_train_068769
18,494
permissive
[ { "docstring": "Setup trigger velocity", "name": "__init__", "signature": "def __init__(self, actor, target_velocity, name='TriggerVelocity')" }, { "docstring": "Check if the actor has the trigger velocity", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_val_000596
Implement the Python class `TriggerVelocity` described below. Class description: This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as...
Implement the Python class `TriggerVelocity` described below. Class description: This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class TriggerVelocity: """This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as fast as target_velocity in m/s The con...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TriggerVelocity: """This class contains the trigger velocity (condition) of a scenario Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - target_velocity: The behavior is successful, if the actor is at least as fast as target_velocity in m/s The condition termin...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py
TinaMenke/Deep-Reinforcement-Learning
train
9
6f5789fc1afc8f280a81adefc1eee623bda2d679
[ "errors = []\nif len(player.getNume()) == 0:\n errors.append('Numele nu poate fi vid')\nif len(player.getPrenume()) == 0:\n errors.append('Prenumele nu poate fi vid')\nif self.__isInt(player.getInaltime()):\n if int(player.getInaltime()) <= 0:\n errors.append('Inaltimea trebuie sa fie un numar pozit...
<|body_start_0|> errors = [] if len(player.getNume()) == 0: errors.append('Numele nu poate fi vid') if len(player.getPrenume()) == 0: errors.append('Prenumele nu poate fi vid') if self.__isInt(player.getInaltime()): if int(player.getInaltime()) <= 0: ...
Validator Class
Validator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Validator: """Validator Class""" def validateJucator(self, player): """Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot, Extrema Daca exista exceptii se vor arunca :param player...
stack_v2_sparse_classes_75kplus_train_068770
1,386
no_license
[ { "docstring": "Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot, Extrema Daca exista exceptii se vor arunca :param player: :return: None", "name": "validateJucator", "signature": "def validateJuca...
2
stack_v2_sparse_classes_30k_train_043610
Implement the Python class `Validator` described below. Class description: Validator Class Method signatures and docstrings: - def validateJucator(self, player): Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot,...
Implement the Python class `Validator` described below. Class description: Validator Class Method signatures and docstrings: - def validateJucator(self, player): Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot,...
57c96f9c9c83a63c57f6c2d003ac0409dd8f068f
<|skeleton|> class Validator: """Validator Class""" def validateJucator(self, player): """Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot, Extrema Daca exista exceptii se vor arunca :param player...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Validator: """Validator Class""" def validateJucator(self, player): """Valideaza un jucator astfel : - numele si prenumele sa nu fie vide - inaltimea sa fie un numar pozitiv - postul sa fie unul din urmatoarele : Fundas, Pivot, Extrema Daca exista exceptii se vor arunca :param player: :return: No...
the_stack_v2_python_sparse
Examen Fp/Domain/Validator.py
alexvasiu/FP-Labs
train
0
207bb69045f73e966d7436909a7f8fb141aaafb7
[ "Executor.__init__(self, executor_options, debug)\nself.__proving_key_path = executor_options['proving_key_path']\nself.__abi_path = executor_options['abi_path']\nself.__code_path = executor_options['code_path']\nself.__working_folder_path = executor_options['working_path']\nself.__zokrates_path = executor_options[...
<|body_start_0|> Executor.__init__(self, executor_options, debug) self.__proving_key_path = executor_options['proving_key_path'] self.__abi_path = executor_options['abi_path'] self.__code_path = executor_options['code_path'] self.__working_folder_path = executor_options['working_...
File based executor, i.e. some of the steps among contract execution, proof generation and so on depend on data on the file system.
ZokratesEthExecutor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZokratesEthExecutor: """File based executor, i.e. some of the steps among contract execution, proof generation and so on depend on data on the file system.""" def __init__(self, executor_options, debug=False): """Init file based Executor. Args: executor_options: dictionary, for confi...
stack_v2_sparse_classes_75kplus_train_068771
4,955
no_license
[ { "docstring": "Init file based Executor. Args: executor_options: dictionary, for configuration usage. debug: boolean, whether enable debug mode.", "name": "__init__", "signature": "def __init__(self, executor_options, debug=False)" }, { "docstring": "Check the input options are valid. Args: opt...
5
null
Implement the Python class `ZokratesEthExecutor` described below. Class description: File based executor, i.e. some of the steps among contract execution, proof generation and so on depend on data on the file system. Method signatures and docstrings: - def __init__(self, executor_options, debug=False): Init file base...
Implement the Python class `ZokratesEthExecutor` described below. Class description: File based executor, i.e. some of the steps among contract execution, proof generation and so on depend on data on the file system. Method signatures and docstrings: - def __init__(self, executor_options, debug=False): Init file base...
8fa211c55132d290f73d48564cecf6e50c2955da
<|skeleton|> class ZokratesEthExecutor: """File based executor, i.e. some of the steps among contract execution, proof generation and so on depend on data on the file system.""" def __init__(self, executor_options, debug=False): """Init file based Executor. Args: executor_options: dictionary, for confi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ZokratesEthExecutor: """File based executor, i.e. some of the steps among contract execution, proof generation and so on depend on data on the file system.""" def __init__(self, executor_options, debug=False): """Init file based Executor. Args: executor_options: dictionary, for configuration usag...
the_stack_v2_python_sparse
origo-executor/executor/zokrates_eth_executor.py
origolab/origo-executor-example
train
0
faa6a68eb25b27fb83e4b8c7b2215723bdf9bf3c
[ "self.height = FLAGS.height\nself.width = FLAGS.width\nself.queues = display_queues", "not_found = True\nwhile not_found:\n if True in [q.empty() for q in self.queues]:\n continue\n else:\n latest = [q.get() for q in self.queues]\n combined = np.concatenate(latest, axis=1)\n not_foun...
<|body_start_0|> self.height = FLAGS.height self.width = FLAGS.width self.queues = display_queues <|end_body_0|> <|body_start_1|> not_found = True while not_found: if True in [q.empty() for q in self.queues]: continue else: ...
A class which displays a live stream from the webcams.
WebcamViewer
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebcamViewer: """A class which displays a live stream from the webcams.""" def __init__(self, display_queues): """Create a WebcamViewer instance.""" <|body_0|> def _get_next_images(self): """Gets the next image to display.""" <|body_1|> def run(self)...
stack_v2_sparse_classes_75kplus_train_068772
16,225
permissive
[ { "docstring": "Create a WebcamViewer instance.", "name": "__init__", "signature": "def __init__(self, display_queues)" }, { "docstring": "Gets the next image to display.", "name": "_get_next_images", "signature": "def _get_next_images(self)" }, { "docstring": "Displays the Kcam ...
3
null
Implement the Python class `WebcamViewer` described below. Class description: A class which displays a live stream from the webcams. Method signatures and docstrings: - def __init__(self, display_queues): Create a WebcamViewer instance. - def _get_next_images(self): Gets the next image to display. - def run(self): Di...
Implement the Python class `WebcamViewer` described below. Class description: A class which displays a live stream from the webcams. Method signatures and docstrings: - def __init__(self, display_queues): Create a WebcamViewer instance. - def _get_next_images(self): Gets the next image to display. - def run(self): Di...
a115d918f6894a69586174653172be0b5d1de952
<|skeleton|> class WebcamViewer: """A class which displays a live stream from the webcams.""" def __init__(self, display_queues): """Create a WebcamViewer instance.""" <|body_0|> def _get_next_images(self): """Gets the next image to display.""" <|body_1|> def run(self)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WebcamViewer: """A class which displays a live stream from the webcams.""" def __init__(self, display_queues): """Create a WebcamViewer instance.""" self.height = FLAGS.height self.width = FLAGS.width self.queues = display_queues def _get_next_images(self): ""...
the_stack_v2_python_sparse
models/research/tcn/dataset/webcam.py
finnickniu/tensorflow_object_detection_tflite
train
60
87a368408756c0dfec2f5f4fd0813045dbd19d0b
[ "self.num_units = num_units\nself.activation_fn = activation_fn\nself.linear_out_flag = linear_out_flag", "with tf.variable_scope(scope or type(self).__name__):\n if self.linear_out_flag:\n rnn_cell_type = rnn_cell.RNNCellLinearOut\n else:\n rnn_cell_type = tf.contrib.rnn.BasicRNNCell\n rnn...
<|body_start_0|> self.num_units = num_units self.activation_fn = activation_fn self.linear_out_flag = linear_out_flag <|end_body_0|> <|body_start_1|> with tf.variable_scope(scope or type(self).__name__): if self.linear_out_flag: rnn_cell_type = rnn_cell.RNNCe...
a BRNN layer
BRNNLayer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BRNNLayer: """a BRNN layer""" def __init__(self, num_units, activation_fn=tf.nn.tanh, linear_out_flag=False): """BRNNLayer constructor Args: num_units: The number of units in the one directon activation_fn: activation function linear_out_flag: if set to True, activation function will...
stack_v2_sparse_classes_75kplus_train_068773
49,091
permissive
[ { "docstring": "BRNNLayer constructor Args: num_units: The number of units in the one directon activation_fn: activation function linear_out_flag: if set to True, activation function will only be applied to the recurrent output.", "name": "__init__", "signature": "def __init__(self, num_units, activatio...
2
null
Implement the Python class `BRNNLayer` described below. Class description: a BRNN layer Method signatures and docstrings: - def __init__(self, num_units, activation_fn=tf.nn.tanh, linear_out_flag=False): BRNNLayer constructor Args: num_units: The number of units in the one directon activation_fn: activation function ...
Implement the Python class `BRNNLayer` described below. Class description: a BRNN layer Method signatures and docstrings: - def __init__(self, num_units, activation_fn=tf.nn.tanh, linear_out_flag=False): BRNNLayer constructor Args: num_units: The number of units in the one directon activation_fn: activation function ...
5e862cbf846d45b8a317f87588533f3fde9f0726
<|skeleton|> class BRNNLayer: """a BRNN layer""" def __init__(self, num_units, activation_fn=tf.nn.tanh, linear_out_flag=False): """BRNNLayer constructor Args: num_units: The number of units in the one directon activation_fn: activation function linear_out_flag: if set to True, activation function will...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BRNNLayer: """a BRNN layer""" def __init__(self, num_units, activation_fn=tf.nn.tanh, linear_out_flag=False): """BRNNLayer constructor Args: num_units: The number of units in the one directon activation_fn: activation function linear_out_flag: if set to True, activation function will only be appl...
the_stack_v2_python_sparse
nabu/neuralnetworks/components/layer.py
JeroenZegers/Nabu-MSSS
train
19
a38c3cf7e7be6eedd83fdabd9db652cdf3a7fbce
[ "self.executor_anl = executor_anl\nself.executor_fft = executor_fft\nself.task_config_list = task_config_list\nself.ecei_config = ecei_config\nself.storage_config = storage_config\nself.logger = logging.getLogger('simple')\nself.task_list = []\nfor task_cfg in self.task_config_list:\n self.task_list.append(task_...
<|body_start_0|> self.executor_anl = executor_anl self.executor_fft = executor_fft self.task_config_list = task_config_list self.ecei_config = ecei_config self.storage_config = storage_config self.logger = logging.getLogger('simple') self.task_list = [] fo...
Defines a group of analysis that, together with an FFT, are performed on a PEP-3148 exeecutor
task_list_spectral
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class task_list_spectral: """Defines a group of analysis that, together with an FFT, are performed on a PEP-3148 exeecutor""" def __init__(self, executor_anl, executor_fft, task_config_list, fft_config, ecei_config, storage_config): """Initialize the object with a list of tasks to be perfo...
stack_v2_sparse_classes_75kplus_train_068774
12,280
no_license
[ { "docstring": "Initialize the object with a list of tasks to be performed. These tasks share a common channel list. Inputs: ======= executor_anl: PEP-3148 executor for running analysis executor_fft: PEP-3148 executor to execute FFTs on. task_list: dict, defines parameters of the analysis to be performed fft_co...
2
stack_v2_sparse_classes_30k_train_010498
Implement the Python class `task_list_spectral` described below. Class description: Defines a group of analysis that, together with an FFT, are performed on a PEP-3148 exeecutor Method signatures and docstrings: - def __init__(self, executor_anl, executor_fft, task_config_list, fft_config, ecei_config, storage_config...
Implement the Python class `task_list_spectral` described below. Class description: Defines a group of analysis that, together with an FFT, are performed on a PEP-3148 exeecutor Method signatures and docstrings: - def __init__(self, executor_anl, executor_fft, task_config_list, fft_config, ecei_config, storage_config...
a6bde82bcadd53a79751a9d9982df61f353d6028
<|skeleton|> class task_list_spectral: """Defines a group of analysis that, together with an FFT, are performed on a PEP-3148 exeecutor""" def __init__(self, executor_anl, executor_fft, task_config_list, fft_config, ecei_config, storage_config): """Initialize the object with a list of tasks to be perfo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class task_list_spectral: """Defines a group of analysis that, together with an FFT, are performed on a PEP-3148 exeecutor""" def __init__(self, executor_anl, executor_fft, task_config_list, fft_config, ecei_config, storage_config): """Initialize the object with a list of tasks to be performed. These t...
the_stack_v2_python_sparse
analysis/tasks_mpi.py
rmchurch/delta
train
0
53f7697d2d5ee9e5ca10b61993dd606ee8920eb9
[ "oauth = OAuth1Session(api_key, client_secret=shared_secret, callback_uri=callback_uri)\npermissions = ' '.join(permission_scopes)\nrequest_token_url = etsy_env.request_token_url + '?scope=' + quote(permissions)\nrequest_token_response = oauth.fetch_request_token(request_token_url)\nlogin_url = request_token_respon...
<|body_start_0|> oauth = OAuth1Session(api_key, client_secret=shared_secret, callback_uri=callback_uri) permissions = ' '.join(permission_scopes) request_token_url = etsy_env.request_token_url + '?scope=' + quote(permissions) request_token_response = oauth.fetch_request_token(request_tok...
Used to get the oauth token for the user you want to make requests with. TODO there might be a good way to make a class out of this, but because the methods are called in separate http requests the state would be lost in between calls.
EtsyOAuthHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EtsyOAuthHelper: """Used to get the oauth token for the user you want to make requests with. TODO there might be a good way to make a class out of this, but because the methods are called in separate http requests the state would be lost in between calls.""" def get_request_url_and_token_sec...
stack_v2_sparse_classes_75kplus_train_068775
5,111
no_license
[ { "docstring": "This method implements the first step of the Oauth1.0 3-legged work flow. Returns the the login_url for the user you wish to authenticate with your app and the oauth_token_secret which must be passed to the get_oauth_token method (the next step in the oauth_workflow). You probably want to redire...
2
stack_v2_sparse_classes_30k_train_035918
Implement the Python class `EtsyOAuthHelper` described below. Class description: Used to get the oauth token for the user you want to make requests with. TODO there might be a good way to make a class out of this, but because the methods are called in separate http requests the state would be lost in between calls. M...
Implement the Python class `EtsyOAuthHelper` described below. Class description: Used to get the oauth token for the user you want to make requests with. TODO there might be a good way to make a class out of this, but because the methods are called in separate http requests the state would be lost in between calls. M...
fe0dadab705c4127fb1ecd059bd01088da0e974b
<|skeleton|> class EtsyOAuthHelper: """Used to get the oauth token for the user you want to make requests with. TODO there might be a good way to make a class out of this, but because the methods are called in separate http requests the state would be lost in between calls.""" def get_request_url_and_token_sec...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EtsyOAuthHelper: """Used to get the oauth token for the user you want to make requests with. TODO there might be a good way to make a class out of this, but because the methods are called in separate http requests the state would be lost in between calls.""" def get_request_url_and_token_secret(api_key, ...
the_stack_v2_python_sparse
venv/Lib/site-packages/etsy/oauth.py
zachsperry666/etsy
train
0
ee7b9a5d70f529cf10799604b4860d09d3292ac7
[ "fake_cfg = mock.MagicMock()\nfake_cfg.ssh_public_key_path = self.SSH_PUBLIC_KEY_PATH\nfake_cfg.machine_type = self.MACHINE_TYPE\nfake_cfg.network = self.NETWORK\nfake_cfg.zone = self.ZONE\nfake_cfg.resolution = '{x}x{y}x32x{dpi}'.format(x=self.X_RES, y=self.Y_RES, dpi=self.DPI)\nfake_cfg.metadata_variable = self.M...
<|body_start_0|> fake_cfg = mock.MagicMock() fake_cfg.ssh_public_key_path = self.SSH_PUBLIC_KEY_PATH fake_cfg.machine_type = self.MACHINE_TYPE fake_cfg.network = self.NETWORK fake_cfg.zone = self.ZONE fake_cfg.resolution = '{x}x{y}x32x{dpi}'.format(x=self.X_RES, y=self.Y_...
Test CheepsComputeClient.
CheepsComputeClientTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CheepsComputeClientTest: """Test CheepsComputeClient.""" def _GetFakeConfig(self): """Create a fake configuration object. Returns: A fake configuration mock object.""" <|body_0|> def setUp(self): """Set up the test.""" <|body_1|> def testCreateInstan...
stack_v2_sparse_classes_75kplus_train_068776
6,492
permissive
[ { "docstring": "Create a fake configuration object. Returns: A fake configuration mock object.", "name": "_GetFakeConfig", "signature": "def _GetFakeConfig(self)" }, { "docstring": "Set up the test.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test CreateI...
4
stack_v2_sparse_classes_30k_train_004440
Implement the Python class `CheepsComputeClientTest` described below. Class description: Test CheepsComputeClient. Method signatures and docstrings: - def _GetFakeConfig(self): Create a fake configuration object. Returns: A fake configuration mock object. - def setUp(self): Set up the test. - def testCreateInstance(s...
Implement the Python class `CheepsComputeClientTest` described below. Class description: Test CheepsComputeClient. Method signatures and docstrings: - def _GetFakeConfig(self): Create a fake configuration object. Returns: A fake configuration mock object. - def setUp(self): Set up the test. - def testCreateInstance(s...
78a61ca023cbf1a0cecfef8b97df2b274ac3a988
<|skeleton|> class CheepsComputeClientTest: """Test CheepsComputeClient.""" def _GetFakeConfig(self): """Create a fake configuration object. Returns: A fake configuration mock object.""" <|body_0|> def setUp(self): """Set up the test.""" <|body_1|> def testCreateInstan...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CheepsComputeClientTest: """Test CheepsComputeClient.""" def _GetFakeConfig(self): """Create a fake configuration object. Returns: A fake configuration mock object.""" fake_cfg = mock.MagicMock() fake_cfg.ssh_public_key_path = self.SSH_PUBLIC_KEY_PATH fake_cfg.machine_type...
the_stack_v2_python_sparse
tools/acloud/internal/lib/cheeps_compute_client_test.py
ZYHGOD-1/Aosp11
train
0
e68a41a02b731f3c39305802929f9dd6fc686f1e
[ "myg = myd.grid\ngrav = self.rp.get_param('compressible.grav')\ndens = myd.get_var('density')\nymom = myd.get_var('y-momentum')\nymom_src = myg.scratch_array()\nymom_src.v()[:, :] = dens.v()[:, :] * grav\nE_src = myg.scratch_array()\nE_src.v()[:, :] = ymom.v()[:, :] * grav\nk = myg.scratch_array(nvar=self.ivars.nva...
<|body_start_0|> myg = myd.grid grav = self.rp.get_param('compressible.grav') dens = myd.get_var('density') ymom = myd.get_var('y-momentum') ymom_src = myg.scratch_array() ymom_src.v()[:, :] = dens.v()[:, :] * grav E_src = myg.scratch_array() E_src.v()[:, ...
The main simulation class for the method of lines compressible hydrodynamics solver
Simulation
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Simulation: """The main simulation class for the method of lines compressible hydrodynamics solver""" def substep(self, myd): """take a single substep in the RK timestepping starting with the conservative state defined as part of myd""" <|body_0|> def method_compute_time...
stack_v2_sparse_classes_75kplus_train_068777
2,853
permissive
[ { "docstring": "take a single substep in the RK timestepping starting with the conservative state defined as part of myd", "name": "substep", "signature": "def substep(self, myd)" }, { "docstring": "The timestep function computes the advective timestep (CFL) constraint. The CFL constraint says t...
3
stack_v2_sparse_classes_30k_train_053253
Implement the Python class `Simulation` described below. Class description: The main simulation class for the method of lines compressible hydrodynamics solver Method signatures and docstrings: - def substep(self, myd): take a single substep in the RK timestepping starting with the conservative state defined as part ...
Implement the Python class `Simulation` described below. Class description: The main simulation class for the method of lines compressible hydrodynamics solver Method signatures and docstrings: - def substep(self, myd): take a single substep in the RK timestepping starting with the conservative state defined as part ...
f91789a319caa98dfbc3f496e9953756e6ee3ca9
<|skeleton|> class Simulation: """The main simulation class for the method of lines compressible hydrodynamics solver""" def substep(self, myd): """take a single substep in the RK timestepping starting with the conservative state defined as part of myd""" <|body_0|> def method_compute_time...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Simulation: """The main simulation class for the method of lines compressible hydrodynamics solver""" def substep(self, myd): """take a single substep in the RK timestepping starting with the conservative state defined as part of myd""" myg = myd.grid grav = self.rp.get_param('com...
the_stack_v2_python_sparse
pyro/compressible_rk/simulation.py
python-hydro/pyro2
train
202
ae0a61107fd9475b4573f074a62a37b22765108a
[ "self.definition_body = definition_body\nself.definition_uri = definition_uri\nself.working_dir = working_dir\nif not self.definition_body and (not self.definition_uri):\n raise ValueError('Require value for either DefinitionBody or DefinitionUri')", "swagger = None\nif self.definition_body:\n swagger = sel...
<|body_start_0|> self.definition_body = definition_body self.definition_uri = definition_uri self.working_dir = working_dir if not self.definition_body and (not self.definition_uri): raise ValueError('Require value for either DefinitionBody or DefinitionUri') <|end_body_0|> ...
Class to read and parse Swagger document from a variety of sources. This class accepts the same data formats as available in Serverless::Api SAM resource
SwaggerReader
[ "Apache-2.0", "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwaggerReader: """Class to read and parse Swagger document from a variety of sources. This class accepts the same data formats as available in Serverless::Api SAM resource""" def __init__(self, definition_body=None, definition_uri=None, working_dir=None): """Initialize the class with...
stack_v2_sparse_classes_75kplus_train_068778
9,397
permissive
[ { "docstring": "Initialize the class with swagger location Parameters ---------- definition_body : dict Swagger document as a dictionary directly or inlined using AWS::Include transform. definition_uri : str or dict Location of the Swagger file. Supports three formats: - S3 URI Ex: ``s3://mybucket/swagger.yaml`...
6
stack_v2_sparse_classes_30k_train_041573
Implement the Python class `SwaggerReader` described below. Class description: Class to read and parse Swagger document from a variety of sources. This class accepts the same data formats as available in Serverless::Api SAM resource Method signatures and docstrings: - def __init__(self, definition_body=None, definiti...
Implement the Python class `SwaggerReader` described below. Class description: Class to read and parse Swagger document from a variety of sources. This class accepts the same data formats as available in Serverless::Api SAM resource Method signatures and docstrings: - def __init__(self, definition_body=None, definiti...
b297ff015f2b69d7c74059c2d42ece1c29ea73ee
<|skeleton|> class SwaggerReader: """Class to read and parse Swagger document from a variety of sources. This class accepts the same data formats as available in Serverless::Api SAM resource""" def __init__(self, definition_body=None, definition_uri=None, working_dir=None): """Initialize the class with...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SwaggerReader: """Class to read and parse Swagger document from a variety of sources. This class accepts the same data formats as available in Serverless::Api SAM resource""" def __init__(self, definition_body=None, definition_uri=None, working_dir=None): """Initialize the class with swagger loca...
the_stack_v2_python_sparse
samcli/commands/local/lib/swagger/reader.py
aws/aws-sam-cli
train
1,402
85961012b7f49355528df1eabfc720cf321ae6d0
[ "Report.__init__(self, database, options, user)\nmenu = options.menu\npid = menu.get_option_by_name('pid').get_value()\nself.center_person = database.get_person_from_gramps_id(pid)\nif self.center_person == None:\n raise ReportError(_('Person %s is not in the Database') % pid)\nself.set_locale(menu.get_option_by...
<|body_start_0|> Report.__init__(self, database, options, user) menu = options.menu pid = menu.get_option_by_name('pid').get_value() self.center_person = database.get_person_from_gramps_id(pid) if self.center_person == None: raise ReportError(_('Person %s is not in th...
EndOfLineReport
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EndOfLineReport: def __init__(self, database, options, user): """Create the EndOfLineReport object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for this report user - a gen.user.User() instance This report ne...
stack_v2_sparse_classes_75kplus_train_068779
12,659
no_license
[ { "docstring": "Create the EndOfLineReport object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for this report user - a gen.user.User() instance This report needs the following parameters (class variables) that come in the options c...
6
stack_v2_sparse_classes_30k_val_002756
Implement the Python class `EndOfLineReport` described below. Class description: Implement the EndOfLineReport class. Method signatures and docstrings: - def __init__(self, database, options, user): Create the EndOfLineReport object that produces the report. The arguments are: database - the GRAMPS database instance ...
Implement the Python class `EndOfLineReport` described below. Class description: Implement the EndOfLineReport class. Method signatures and docstrings: - def __init__(self, database, options, user): Create the EndOfLineReport object that produces the report. The arguments are: database - the GRAMPS database instance ...
0c79561bed7ff42c88714edbc85197fa9235e188
<|skeleton|> class EndOfLineReport: def __init__(self, database, options, user): """Create the EndOfLineReport object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for this report user - a gen.user.User() instance This report ne...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EndOfLineReport: def __init__(self, database, options, user): """Create the EndOfLineReport object that produces the report. The arguments are: database - the GRAMPS database instance options - instance of the Options class for this report user - a gen.user.User() instance This report needs the follow...
the_stack_v2_python_sparse
plugins/textreport/endoflinereport.py
balrok/gramps_addon
train
2
81d5db8a0a780bde548e2ffd96bb277224830dea
[ "x = 2\nit = power_of(x)\nfor index in xrange(101):\n self.assertEqual(it.next(), pow(x, index))", "x = 3\nit = power_of(x)\nfor index in xrange(1001):\n self.assertEqual(it.next(), pow(x, index))", "x = 7\nit = power_of(x)\nfor index in xrange(10001):\n self.assertEqual(it.next(), pow(x, index))" ]
<|body_start_0|> x = 2 it = power_of(x) for index in xrange(101): self.assertEqual(it.next(), pow(x, index)) <|end_body_0|> <|body_start_1|> x = 3 it = power_of(x) for index in xrange(1001): self.assertEqual(it.next(), pow(x, index)) <|end_body_1|...
TestPowerOf
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPowerOf: def test_power_of_2(self): """Test power_of(2) until 100""" <|body_0|> def test_power_of_3(self): """Test power_of(3) until 1000""" <|body_1|> def test_power_of_7(self): """Test power_of(7) until 10000""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_75kplus_train_068780
1,221
no_license
[ { "docstring": "Test power_of(2) until 100", "name": "test_power_of_2", "signature": "def test_power_of_2(self)" }, { "docstring": "Test power_of(3) until 1000", "name": "test_power_of_3", "signature": "def test_power_of_3(self)" }, { "docstring": "Test power_of(7) until 10000", ...
3
stack_v2_sparse_classes_30k_train_021001
Implement the Python class `TestPowerOf` described below. Class description: Implement the TestPowerOf class. Method signatures and docstrings: - def test_power_of_2(self): Test power_of(2) until 100 - def test_power_of_3(self): Test power_of(3) until 1000 - def test_power_of_7(self): Test power_of(7) until 10000
Implement the Python class `TestPowerOf` described below. Class description: Implement the TestPowerOf class. Method signatures and docstrings: - def test_power_of_2(self): Test power_of(2) until 100 - def test_power_of_3(self): Test power_of(3) until 1000 - def test_power_of_7(self): Test power_of(7) until 10000 <|...
8f082201e24f0f2b991d9388500fdbf95d6f073d
<|skeleton|> class TestPowerOf: def test_power_of_2(self): """Test power_of(2) until 100""" <|body_0|> def test_power_of_3(self): """Test power_of(3) until 1000""" <|body_1|> def test_power_of_7(self): """Test power_of(7) until 10000""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestPowerOf: def test_power_of_2(self): """Test power_of(2) until 100""" x = 2 it = power_of(x) for index in xrange(101): self.assertEqual(it.next(), pow(x, index)) def test_power_of_3(self): """Test power_of(3) until 1000""" x = 3 it = ...
the_stack_v2_python_sparse
advanced/exercises/mod_05_functools/tests_mod_05.py
garciacastano09/pycourse
train
0
cd3e8572e1e7bfc4607a40f4198109b33d10a843
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\noffset = request.args.get('offset', '0')\nlimit = request.args.get('limit', '10')\norder_by = request.args.get('order_by', 'id')\norder = request.args.get('order', 'ASC')\nper_page = request.args.get('per_page', '10'...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) offset = request.args.get('offset', '0') limit = request.args.get('limit', '10') order_by = request.args.get('order_by', 'id') order = request.a...
ObservacionPreAsfList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ObservacionPreAsfList: def get(self): """To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" <|body_0|> def post(self): """To create an observation (preliminar de la ASF).""" ...
stack_v2_sparse_classes_75kplus_train_068781
13,540
no_license
[ { "docstring": "To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages", "name": "get", "signature": "def get(self)" }, { "docstring": "To create an observation (preliminar de la ASF).", "name": "post", "sign...
2
stack_v2_sparse_classes_30k_train_027575
Implement the Python class `ObservacionPreAsfList` described below. Class description: Implement the ObservacionPreAsfList class. Method signatures and docstrings: - def get(self): To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages - ...
Implement the Python class `ObservacionPreAsfList` described below. Class description: Implement the ObservacionPreAsfList class. Method signatures and docstrings: - def get(self): To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages - ...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class ObservacionPreAsfList: def get(self): """To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" <|body_0|> def post(self): """To create an observation (preliminar de la ASF).""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ObservacionPreAsfList: def get(self): """To fetch several observations (preliminares de la ASF). On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=e...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/observaciones_pre_asf.py
Telematica/knight-rider
train
1
6fc65ffd5d0fffc67d1404693d6c601dedca93ce
[ "self.left_pq = []\nself.right_pq = []\nself.l = 0", "self.l += 1\nif len(self.right_pq) > len(self.left_pq):\n rightmin = heappop(self.right_pq)\n heappush(self.left_pq, -min(num, rightmin))\n heappush(self.right_pq, max(num, rightmin))\n return\nheappush(self.left_pq, -num)\nheappush(self.right_pq, ...
<|body_start_0|> self.left_pq = [] self.right_pq = [] self.l = 0 <|end_body_0|> <|body_start_1|> self.l += 1 if len(self.right_pq) > len(self.left_pq): rightmin = heappop(self.right_pq) heappush(self.left_pq, -min(num, rightmin)) heappush(self...
MedianFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_75kplus_train_068782
1,282
no_license
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: void", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
stack_v2_sparse_classes_30k_train_038983
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float <|skeleton|> class Me...
b0ce69985c51a9a794397cd98a996fca0e91d7d1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MedianFinder: def __init__(self): """initialize your data structure here.""" self.left_pq = [] self.right_pq = [] self.l = 0 def addNum(self, num): """:type num: int :rtype: void""" self.l += 1 if len(self.right_pq) > len(self.left_pq): ...
the_stack_v2_python_sparse
Solutions/295-Find-Median-from-Data-Stream/python.py
JerryHu1994/LeetCode-Practice
train
0
1fe4ee608bf52605ef473a5755ed5edb60835790
[ "self.diaphragmPeriod = preferences.IntPreference().getFromValue('Diaphragm Period (layers):', 29)\nself.diaphragmThickness = preferences.IntPreference().getFromValue('Diaphragm Thickness (layers):', 3)\nself.extraShellsBase = preferences.IntPreference().getFromValue('Extra Shells on Base (layers):', 0)\nself.extra...
<|body_start_0|> self.diaphragmPeriod = preferences.IntPreference().getFromValue('Diaphragm Period (layers):', 29) self.diaphragmThickness = preferences.IntPreference().getFromValue('Diaphragm Thickness (layers):', 3) self.extraShellsBase = preferences.IntPreference().getFromValue('Extra Shells ...
A class to handle the fill preferences.
FillPreferences
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FillPreferences: """A class to handle the fill preferences.""" def __init__(self): """Set the default preferences, execute title & preferences filename.""" <|body_0|> def execute(self): """Fill button has been clicked.""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_75kplus_train_068783
35,226
no_license
[ { "docstring": "Set the default preferences, execute title & preferences filename.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Fill button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_train_030862
Implement the Python class `FillPreferences` described below. Class description: A class to handle the fill preferences. Method signatures and docstrings: - def __init__(self): Set the default preferences, execute title & preferences filename. - def execute(self): Fill button has been clicked.
Implement the Python class `FillPreferences` described below. Class description: A class to handle the fill preferences. Method signatures and docstrings: - def __init__(self): Set the default preferences, execute title & preferences filename. - def execute(self): Fill button has been clicked. <|skeleton|> class Fil...
e9c79463de7d4230a440f2ab1700dd89411db0e9
<|skeleton|> class FillPreferences: """A class to handle the fill preferences.""" def __init__(self): """Set the default preferences, execute title & preferences filename.""" <|body_0|> def execute(self): """Fill button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FillPreferences: """A class to handle the fill preferences.""" def __init__(self): """Set the default preferences, execute title & preferences filename.""" self.diaphragmPeriod = preferences.IntPreference().getFromValue('Diaphragm Period (layers):', 29) self.diaphragmThickness = p...
the_stack_v2_python_sparse
Toolchain/fill.py
dmstan/linuxCNC_to_3DPrinter
train
0
a3dba5a6068a7641578a97a6e32cc81ac73c0779
[ "for i, t in enumerate(tree):\n if isinstance(t, list):\n root = t[0]\n if root == tag:\n yield t\n else:\n for t1 in self.collect_list(t, tag):\n yield t1\n elif t == tag:\n yield i", "for i, t in enumerate(tree):\n if isinstance(t, list):...
<|body_start_0|> for i, t in enumerate(tree): if isinstance(t, list): root = t[0] if root == tag: yield t else: for t1 in self.collect_list(t, tag): yield t1 elif t == tag: ...
TagListGen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagListGen: def collect_list(self, tree, tag): """找到所有包含标签的list,如果不是list返回索引""" <|body_0|> def collect_list_deep(self, tree, tag): """找到所有包含标签的list,若果返回的list也包含标签也返回,如果不是list返回索引""" <|body_1|> <|end_skeleton|> <|body_start_0|> for i, t in enumerate(...
stack_v2_sparse_classes_75kplus_train_068784
26,948
no_license
[ { "docstring": "找到所有包含标签的list,如果不是list返回索引", "name": "collect_list", "signature": "def collect_list(self, tree, tag)" }, { "docstring": "找到所有包含标签的list,若果返回的list也包含标签也返回,如果不是list返回索引", "name": "collect_list_deep", "signature": "def collect_list_deep(self, tree, tag)" } ]
2
null
Implement the Python class `TagListGen` described below. Class description: Implement the TagListGen class. Method signatures and docstrings: - def collect_list(self, tree, tag): 找到所有包含标签的list,如果不是list返回索引 - def collect_list_deep(self, tree, tag): 找到所有包含标签的list,若果返回的list也包含标签也返回,如果不是list返回索引
Implement the Python class `TagListGen` described below. Class description: Implement the TagListGen class. Method signatures and docstrings: - def collect_list(self, tree, tag): 找到所有包含标签的list,如果不是list返回索引 - def collect_list_deep(self, tree, tag): 找到所有包含标签的list,若果返回的list也包含标签也返回,如果不是list返回索引 <|skeleton|> class TagLi...
bcac0a1eaf200700b69a0a179e5561bf7e73dcce
<|skeleton|> class TagListGen: def collect_list(self, tree, tag): """找到所有包含标签的list,如果不是list返回索引""" <|body_0|> def collect_list_deep(self, tree, tag): """找到所有包含标签的list,若果返回的list也包含标签也返回,如果不是list返回索引""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TagListGen: def collect_list(self, tree, tag): """找到所有包含标签的list,如果不是list返回索引""" for i, t in enumerate(tree): if isinstance(t, list): root = t[0] if root == tag: yield t else: for t1 in self.coll...
the_stack_v2_python_sparse
RS/Design_Computer_Programs/homework/tools/unparse.py
GameAIMaster/RSClass
train
1
b0097f8c7c50f1f2c852f612e3ad08f171c752af
[ "app.config['TESTING'] = True\nself.client = app.test_client()\nconnect_to_db(app, 'postgresql:///testdb')\ndb.drop_all()\ndb.create_all()\ncreate_test_data()", "db.session.remove()\ndb.drop_all()\ndb.engine.dispose()", "result = self.client.get('/')\nself.assertIn(b'IM_Melon', result.data)\nself.assertEqual(re...
<|body_start_0|> app.config['TESTING'] = True self.client = app.test_client() connect_to_db(app, 'postgresql:///testdb') db.drop_all() db.create_all() create_test_data() <|end_body_0|> <|body_start_1|> db.session.remove() db.drop_all() db.engine.d...
Flask tests.
FlaskTestBasic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlaskTestBasic: """Flask tests.""" def setUp(self): """Run code before every test""" <|body_0|> def tearDown(self): """Run this at the end of every test.""" <|body_1|> def test_index(self): """Test homepage""" <|body_2|> def test...
stack_v2_sparse_classes_75kplus_train_068785
4,379
no_license
[ { "docstring": "Run code before every test", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Run this at the end of every test.", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "Test homepage", "name": "test_index", "signature":...
4
stack_v2_sparse_classes_30k_train_039438
Implement the Python class `FlaskTestBasic` described below. Class description: Flask tests. Method signatures and docstrings: - def setUp(self): Run code before every test - def tearDown(self): Run this at the end of every test. - def test_index(self): Test homepage - def test_addnewmelon(self): Test add new melon p...
Implement the Python class `FlaskTestBasic` described below. Class description: Flask tests. Method signatures and docstrings: - def setUp(self): Run code before every test - def tearDown(self): Run this at the end of every test. - def test_index(self): Test homepage - def test_addnewmelon(self): Test add new melon p...
81f76323e660a97e46b479099ab02591be6ce4e4
<|skeleton|> class FlaskTestBasic: """Flask tests.""" def setUp(self): """Run code before every test""" <|body_0|> def tearDown(self): """Run this at the end of every test.""" <|body_1|> def test_index(self): """Test homepage""" <|body_2|> def test...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FlaskTestBasic: """Flask tests.""" def setUp(self): """Run code before every test""" app.config['TESTING'] = True self.client = app.test_client() connect_to_db(app, 'postgresql:///testdb') db.drop_all() db.create_all() create_test_data() def te...
the_stack_v2_python_sparse
test.py
kioshi87/IM_Melon
train
6
3b7c93c3a43b06788ad7170711f4e6d8c207adcf
[ "self.value = value\nself.left = None\nself.right = None", "if val <= self.value:\n if self.left:\n self.left.add(val)\n else:\n self.left = BinaryNode(val)\nelif self.right:\n self.right.add(val)\nelse:\n self.right = BinaryNode(val)", "if self.left:\n for n in self.left.inorder():...
<|body_start_0|> self.value = value self.left = None self.right = None <|end_body_0|> <|body_start_1|> if val <= self.value: if self.left: self.left.add(val) else: self.left = BinaryNode(val) elif self.right: se...
BinaryNode
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryNode: def __init__(self, value=None): """Create binary Node""" <|body_0|> def add(self, val): """Add a new node to BST with this value""" <|body_1|> def inorder(self): """In order traversal of tree rooted at given node.""" <|body_2|...
stack_v2_sparse_classes_75kplus_train_068786
1,947
permissive
[ { "docstring": "Create binary Node", "name": "__init__", "signature": "def __init__(self, value=None)" }, { "docstring": "Add a new node to BST with this value", "name": "add", "signature": "def add(self, val)" }, { "docstring": "In order traversal of tree rooted at given node.",...
3
stack_v2_sparse_classes_30k_train_033493
Implement the Python class `BinaryNode` described below. Class description: Implement the BinaryNode class. Method signatures and docstrings: - def __init__(self, value=None): Create binary Node - def add(self, val): Add a new node to BST with this value - def inorder(self): In order traversal of tree rooted at given...
Implement the Python class `BinaryNode` described below. Class description: Implement the BinaryNode class. Method signatures and docstrings: - def __init__(self, value=None): Create binary Node - def add(self, val): Add a new node to BST with this value - def inorder(self): In order traversal of tree rooted at given...
6bdaf7ee2878f69a2df00ae7a3274f5d43d24605
<|skeleton|> class BinaryNode: def __init__(self, value=None): """Create binary Node""" <|body_0|> def add(self, val): """Add a new node to BST with this value""" <|body_1|> def inorder(self): """In order traversal of tree rooted at given node.""" <|body_2|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BinaryNode: def __init__(self, value=None): """Create binary Node""" self.value = value self.left = None self.right = None def add(self, val): """Add a new node to BST with this value""" if val <= self.value: if self.left: self.l...
the_stack_v2_python_sparse
PythonCode/adk/bst.py
heineman/algorithms-nutshell-2ed
train
577
3e27e0984e50521d1ba70d64316544584cbfe75b
[ "self.pce_object = pce_object\nself.first_order_indices = None\n'PCE estimates for the first order Sobol indices'\nself.total_order_indices = None\n'PCE estimates for the total order Sobol indices'\nself.generalized_first_order_indices = None\n'PCE estimates of generalized first order Sobol indices, which character...
<|body_start_0|> self.pce_object = pce_object self.first_order_indices = None 'PCE estimates for the first order Sobol indices' self.total_order_indices = None 'PCE estimates for the total order Sobol indices' self.generalized_first_order_indices = None 'PCE estim...
PceSensitivity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PceSensitivity: def __init__(self, pce_object: FittedPce): """Compute Sobol sensitivity indices based on a PCE surrogate approximation of the QoI. :param pce_object: Polynomial Chaos Expansion surrogate.""" <|body_0|> def run(self): """This method calculates and save...
stack_v2_sparse_classes_75kplus_train_068787
5,812
permissive
[ { "docstring": "Compute Sobol sensitivity indices based on a PCE surrogate approximation of the QoI. :param pce_object: Polynomial Chaos Expansion surrogate.", "name": "__init__", "signature": "def __init__(self, pce_object: FittedPce)" }, { "docstring": "This method calculates and saves as attr...
6
stack_v2_sparse_classes_30k_train_051508
Implement the Python class `PceSensitivity` described below. Class description: Implement the PceSensitivity class. Method signatures and docstrings: - def __init__(self, pce_object: FittedPce): Compute Sobol sensitivity indices based on a PCE surrogate approximation of the QoI. :param pce_object: Polynomial Chaos Ex...
Implement the Python class `PceSensitivity` described below. Class description: Implement the PceSensitivity class. Method signatures and docstrings: - def __init__(self, pce_object: FittedPce): Compute Sobol sensitivity indices based on a PCE surrogate approximation of the QoI. :param pce_object: Polynomial Chaos Ex...
9e98a6279aa5a2ec2d6d4c61226c34712547bcc6
<|skeleton|> class PceSensitivity: def __init__(self, pce_object: FittedPce): """Compute Sobol sensitivity indices based on a PCE surrogate approximation of the QoI. :param pce_object: Polynomial Chaos Expansion surrogate.""" <|body_0|> def run(self): """This method calculates and save...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PceSensitivity: def __init__(self, pce_object: FittedPce): """Compute Sobol sensitivity indices based on a PCE surrogate approximation of the QoI. :param pce_object: Polynomial Chaos Expansion surrogate.""" self.pce_object = pce_object self.first_order_indices = None 'PCE estim...
the_stack_v2_python_sparse
src/UQpy/sensitivity/PceSensitivity.py
SURGroup/UQpy
train
215
83d9ef59e70f14a7f6f1ed9fbf3a6412f8ad5ec2
[ "H = len(wall)\nWall = [[] for _ in range(H)]\nfor i, onelayer in enumerate(wall):\n k = 1\n for w in onelayer:\n while w:\n Wall[i].append(k)\n w -= 1\n k += 1\nif len(Wall[0]) == 1:\n return H\nCrossNums = [0 for _ in range(len(Wall[0]) - 1)]\nfor i in range(H):\n f...
<|body_start_0|> H = len(wall) Wall = [[] for _ in range(H)] for i, onelayer in enumerate(wall): k = 1 for w in onelayer: while w: Wall[i].append(k) w -= 1 k += 1 if len(Wall[0]) == 1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def leastBricks(self, wall) -> int: """差分,超时了 :param list[list[int]] wall: :return:""" <|body_0|> def leastBricks2(self, wall) -> int: """哈希表 :param wall: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> H = len(wall) Wall ...
stack_v2_sparse_classes_75kplus_train_068788
2,218
no_license
[ { "docstring": "差分,超时了 :param list[list[int]] wall: :return:", "name": "leastBricks", "signature": "def leastBricks(self, wall) -> int" }, { "docstring": "哈希表 :param wall: :return:", "name": "leastBricks2", "signature": "def leastBricks2(self, wall) -> int" } ]
2
stack_v2_sparse_classes_30k_train_001031
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def leastBricks(self, wall) -> int: 差分,超时了 :param list[list[int]] wall: :return: - def leastBricks2(self, wall) -> int: 哈希表 :param wall: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def leastBricks(self, wall) -> int: 差分,超时了 :param list[list[int]] wall: :return: - def leastBricks2(self, wall) -> int: 哈希表 :param wall: :return: <|skeleton|> class Solution: ...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class Solution: def leastBricks(self, wall) -> int: """差分,超时了 :param list[list[int]] wall: :return:""" <|body_0|> def leastBricks2(self, wall) -> int: """哈希表 :param wall: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def leastBricks(self, wall) -> int: """差分,超时了 :param list[list[int]] wall: :return:""" H = len(wall) Wall = [[] for _ in range(H)] for i, onelayer in enumerate(wall): k = 1 for w in onelayer: while w: Wall[i]...
the_stack_v2_python_sparse
华为题库/砖墙.py
2226171237/Algorithmpractice
train
0
05c271c59b11f13d22069922b876f8fff0a89df9
[ "app = CavaticaApp.query.get(kf_id)\nif app is None:\n abort(404, 'could not find {} `{}`'.format('cavatica_app', kf_id))\nreturn CavaticaAppSchema().jsonify(app)", "app = CavaticaApp.query.get(kf_id)\nif app is None:\n abort(404, 'could not find {} `{}`'.format('cavatica_app', kf_id))\nbody = request.get_j...
<|body_start_0|> app = CavaticaApp.query.get(kf_id) if app is None: abort(404, 'could not find {} `{}`'.format('cavatica_app', kf_id)) return CavaticaAppSchema().jsonify(app) <|end_body_0|> <|body_start_1|> app = CavaticaApp.query.get(kf_id) if app is None: ...
CavaticaApp API
CavaticaAppAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CavaticaAppAPI: """CavaticaApp API""" def get(self, kf_id): """Get a cavatica_app by id --- template: path: get_by_id.yml properties: resource: CavaticaApp""" <|body_0|> def patch(self, kf_id): """Update an existing cavatica_app. Allows partial update --- templat...
stack_v2_sparse_classes_75kplus_train_068789
5,131
permissive
[ { "docstring": "Get a cavatica_app by id --- template: path: get_by_id.yml properties: resource: CavaticaApp", "name": "get", "signature": "def get(self, kf_id)" }, { "docstring": "Update an existing cavatica_app. Allows partial update --- template: path: update_by_id.yml properties: resource: C...
3
stack_v2_sparse_classes_30k_train_050917
Implement the Python class `CavaticaAppAPI` described below. Class description: CavaticaApp API Method signatures and docstrings: - def get(self, kf_id): Get a cavatica_app by id --- template: path: get_by_id.yml properties: resource: CavaticaApp - def patch(self, kf_id): Update an existing cavatica_app. Allows parti...
Implement the Python class `CavaticaAppAPI` described below. Class description: CavaticaApp API Method signatures and docstrings: - def get(self, kf_id): Get a cavatica_app by id --- template: path: get_by_id.yml properties: resource: CavaticaApp - def patch(self, kf_id): Update an existing cavatica_app. Allows parti...
36ee3fc3d1ba9d1a177274d051fb175c56dd898e
<|skeleton|> class CavaticaAppAPI: """CavaticaApp API""" def get(self, kf_id): """Get a cavatica_app by id --- template: path: get_by_id.yml properties: resource: CavaticaApp""" <|body_0|> def patch(self, kf_id): """Update an existing cavatica_app. Allows partial update --- templat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CavaticaAppAPI: """CavaticaApp API""" def get(self, kf_id): """Get a cavatica_app by id --- template: path: get_by_id.yml properties: resource: CavaticaApp""" app = CavaticaApp.query.get(kf_id) if app is None: abort(404, 'could not find {} `{}`'.format('cavatica_app', ...
the_stack_v2_python_sparse
dataservice/api/cavatica_app/resources.py
kids-first/kf-api-dataservice
train
9
1451ccf5ff0951b9c8a222db4384a22ec0166fec
[ "self.pos_enc_type = pos_enc_type\nsuper(ConformerEncoderLayer, self).__init__()\nself.ffn1 = FeedForwardModule(embed_dim, ffn_embed_dim, dropout, dropout)\nself.self_attn_layer_norm = LayerNorm(embed_dim, export=False)\nself.self_attn_dropout = torch.nn.Dropout(dropout)\nif attn_type == 'espnet':\n if self.pos_...
<|body_start_0|> self.pos_enc_type = pos_enc_type super(ConformerEncoderLayer, self).__init__() self.ffn1 = FeedForwardModule(embed_dim, ffn_embed_dim, dropout, dropout) self.self_attn_layer_norm = LayerNorm(embed_dim, export=False) self.self_attn_dropout = torch.nn.Dropout(dropo...
Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA
ConformerEncoderLayer
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "LGPL-2.1-or-later", "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConformerEncoderLayer: """Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA""" def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, use_fp16, depthwise_conv_kernel_size=31, activation_fn='swish', attn_t...
stack_v2_sparse_classes_75kplus_train_068790
9,087
permissive
[ { "docstring": "Args: embed_dim: Input embedding dimension ffn_embed_dim: FFN layer dimension attention_heads: Number of attention heads in MHA dropout: dropout value depthwise_conv_kernel_size: Size of kernel in depthwise conv layer in convolution module activation_fn: Activation function name to use in convul...
2
stack_v2_sparse_classes_30k_test_000180
Implement the Python class `ConformerEncoderLayer` described below. Class description: Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA Method signatures and docstrings: - def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, us...
Implement the Python class `ConformerEncoderLayer` described below. Class description: Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA Method signatures and docstrings: - def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, us...
b60c741f746877293bb85eed6806736fc8fa0ffd
<|skeleton|> class ConformerEncoderLayer: """Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA""" def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, use_fp16, depthwise_conv_kernel_size=31, activation_fn='swish', attn_t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConformerEncoderLayer: """Conformer block based on https://arxiv.org/abs/2005.08100. We currently don't support relative positional encoding in MHA""" def __init__(self, embed_dim, ffn_embed_dim, attention_heads, dropout, use_fp16, depthwise_conv_kernel_size=31, activation_fn='swish', attn_type=None, pos...
the_stack_v2_python_sparse
kosmos-2/fairseq/fairseq/modules/conformer_layer.py
microsoft/unilm
train
15,313
010f676de97393e181c85dcb7317391b3f7f3f25
[ "if not isinstance(op_types, (list, tuple)):\n op_types = [op_types]\nself._op_types = op_types", "if not callable(f):\n raise TypeError('conversion_func must be callable.')\nfor op_type in self._op_types:\n _node_converter_registry.register(f, op_type)\nreturn f" ]
<|body_start_0|> if not isinstance(op_types, (list, tuple)): op_types = [op_types] self._op_types = op_types <|end_body_0|> <|body_start_1|> if not callable(f): raise TypeError('conversion_func must be callable.') for op_type in self._op_types: _node_...
A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` is the string type of an op which corresponds to the `NodeDef.op` field in the proto def...
RegisterNodeConverter
[ "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterNodeConverter: """A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` is the string type of an op which corre...
stack_v2_sparse_classes_75kplus_train_068791
15,998
permissive
[ { "docstring": "Creates a new decorator with `op_type` as the Operation type. Args: op_type: The type of an framework operation. Raises: TypeError: If `op_type` is not string or `f` is not callable.", "name": "__init__", "signature": "def __init__(self, op_types)" }, { "docstring": "Registers th...
2
stack_v2_sparse_classes_30k_train_030983
Implement the Python class `RegisterNodeConverter` described below. Class description: A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` ...
Implement the Python class `RegisterNodeConverter` described below. Class description: A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` ...
6248d10ad8a304c8eb0ac21d6b817b901e59bcf6
<|skeleton|> class RegisterNodeConverter: """A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` is the string type of an op which corre...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RegisterNodeConverter: """A decorator for registering the convertion function that converts the framework's op to NNDCT's op. For example: ```python @RegisterNodeConverter("Conv2D") def parse_conv2d(attrs): ... return op ``` The decorator argument `op_type` is the string type of an op which corresponds to the...
the_stack_v2_python_sparse
src/RNN/rnn_quantizer/tensorflow/tf_nndct/graph/converter.py
zwxb/Vitis-AI
train
0
ea3f3eaec893a324aea469678def793c22ab8495
[ "self.parser = templateparser.Parser()\nself.parse = self.parser.ParseString\nself.tmpl = templateparser.Template", "inline = '<li>Hello [name]</li>'\nself.parser['name'] = self.tmpl(inline)\ntemplate = '{{ for name in [names] }}{{ inline name }}{{ endfor }}'\nresult = self.parse(template, names=('John', 'Eric'))...
<|body_start_0|> self.parser = templateparser.Parser() self.parse = self.parser.ParseString self.tmpl = templateparser.Template <|end_body_0|> <|body_start_1|> inline = '<li>Hello [name]</li>' self.parser['name'] = self.tmpl(inline) template = '{{ for name in [names] }}{...
Test cases for nested function scopes.
TemplateNestedScopes
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateNestedScopes: """Test cases for nested function scopes.""" def setUp(self): """Sets up a testbed.""" <|body_0|> def testLoopWithInline(self): """{{ nested }} Loops can contain an {{ inline }} section""" <|body_1|> def testLoopWithInlineLoop(s...
stack_v2_sparse_classes_75kplus_train_068792
37,443
permissive
[ { "docstring": "Sets up a testbed.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "{{ nested }} Loops can contain an {{ inline }} section", "name": "testLoopWithInline", "signature": "def testLoopWithInline(self)" }, { "docstring": "{{ nested }} Loops can con...
4
stack_v2_sparse_classes_30k_train_015997
Implement the Python class `TemplateNestedScopes` described below. Class description: Test cases for nested function scopes. Method signatures and docstrings: - def setUp(self): Sets up a testbed. - def testLoopWithInline(self): {{ nested }} Loops can contain an {{ inline }} section - def testLoopWithInlineLoop(self)...
Implement the Python class `TemplateNestedScopes` described below. Class description: Test cases for nested function scopes. Method signatures and docstrings: - def setUp(self): Sets up a testbed. - def testLoopWithInline(self): {{ nested }} Loops can contain an {{ inline }} section - def testLoopWithInlineLoop(self)...
6ee9b512b9a42ef313032e7b79f779b44da3c319
<|skeleton|> class TemplateNestedScopes: """Test cases for nested function scopes.""" def setUp(self): """Sets up a testbed.""" <|body_0|> def testLoopWithInline(self): """{{ nested }} Loops can contain an {{ inline }} section""" <|body_1|> def testLoopWithInlineLoop(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TemplateNestedScopes: """Test cases for nested function scopes.""" def setUp(self): """Sets up a testbed.""" self.parser = templateparser.Parser() self.parse = self.parser.ParseString self.tmpl = templateparser.Template def testLoopWithInline(self): """{{ nest...
the_stack_v2_python_sparse
newweb/test_templateparser.py
edelooff/newWeb
train
0
587fcc5493081aa26787413f58e6f8e5d8782256
[ "projekt_id = request.args.get('projekt_id')\nmodule = json.loads(request.args.get('module'))\nadm = ProjektAdministration()\nadm.update_projekte_hat_module(projekt_id, module)", "projekt_id = request.args.get('projekt_id')\nmodule = json.loads(request.args.get('module'))\nadm = ProjektAdministration()\nadm.creat...
<|body_start_0|> projekt_id = request.args.get('projekt_id') module = json.loads(request.args.get('module')) adm = ProjektAdministration() adm.update_projekte_hat_module(projekt_id, module) <|end_body_0|> <|body_start_1|> projekt_id = request.args.get('projekt_id') modul...
ProjektehatModuleOperationen
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjektehatModuleOperationen: def put(self): """Update von wählbaren Modulen eines bestimmten Projektes.""" <|body_0|> def post(self): """Anlegen der wählbaren Module für ein bestimmtes Projekt.""" <|body_1|> <|end_skeleton|> <|body_start_0|> projek...
stack_v2_sparse_classes_75kplus_train_068793
29,521
no_license
[ { "docstring": "Update von wählbaren Modulen eines bestimmten Projektes.", "name": "put", "signature": "def put(self)" }, { "docstring": "Anlegen der wählbaren Module für ein bestimmtes Projekt.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_047560
Implement the Python class `ProjektehatModuleOperationen` described below. Class description: Implement the ProjektehatModuleOperationen class. Method signatures and docstrings: - def put(self): Update von wählbaren Modulen eines bestimmten Projektes. - def post(self): Anlegen der wählbaren Module für ein bestimmtes ...
Implement the Python class `ProjektehatModuleOperationen` described below. Class description: Implement the ProjektehatModuleOperationen class. Method signatures and docstrings: - def put(self): Update von wählbaren Modulen eines bestimmten Projektes. - def post(self): Anlegen der wählbaren Module für ein bestimmtes ...
9014f16fed08956bd28216e1373b60139e5caea1
<|skeleton|> class ProjektehatModuleOperationen: def put(self): """Update von wählbaren Modulen eines bestimmten Projektes.""" <|body_0|> def post(self): """Anlegen der wählbaren Module für ein bestimmtes Projekt.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProjektehatModuleOperationen: def put(self): """Update von wählbaren Modulen eines bestimmten Projektes.""" projekt_id = request.args.get('projekt_id') module = json.loads(request.args.get('module')) adm = ProjektAdministration() adm.update_projekte_hat_module(projekt_i...
the_stack_v2_python_sparse
src/main.py
leanderpeter/university_project_selector
train
3
3aa632159cd2cf3a485c376f9ec4ad529a6a2e09
[ "actions = {'buy': [OP_BUY_LIMIT, OP_BUY_STOP], 'sell': [OP_SELL_LIMIT, OP_SELL_STOP]}\nstop_loss_pips = pips.pips_between(entry, stop_loss)\ntake_profit_pips = pips.pips_between(entry, take_profit)\nfor action in actions[trade_type]:\n self.order(action, symbol, entry, lots, stop_loss_pips, take_profit_pips)", ...
<|body_start_0|> actions = {'buy': [OP_BUY_LIMIT, OP_BUY_STOP], 'sell': [OP_SELL_LIMIT, OP_SELL_STOP]} stop_loss_pips = pips.pips_between(entry, stop_loss) take_profit_pips = pips.pips_between(entry, take_profit) for action in actions[trade_type]: self.order(action, symbol, e...
MT4
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MT4: def both_pending_orders(self, trade_type, lots, symbol, entry, stop_loss, take_profit): """Enter both a LIMIT and STOP order for a symbol. This is done because the signals that I get could be above or below market price and the broker will only honor one or the other. So instead of ...
stack_v2_sparse_classes_75kplus_train_068794
2,664
permissive
[ { "docstring": "Enter both a LIMIT and STOP order for a symbol. This is done because the signals that I get could be above or below market price and the broker will only honor one or the other. So instead of me trying to figure out which one will fly, just send both! :param trade_type: should be either 'buy' or...
2
stack_v2_sparse_classes_30k_train_040536
Implement the Python class `MT4` described below. Class description: Implement the MT4 class. Method signatures and docstrings: - def both_pending_orders(self, trade_type, lots, symbol, entry, stop_loss, take_profit): Enter both a LIMIT and STOP order for a symbol. This is done because the signals that I get could be...
Implement the Python class `MT4` described below. Class description: Implement the MT4 class. Method signatures and docstrings: - def both_pending_orders(self, trade_type, lots, symbol, entry, stop_loss, take_profit): Enter both a LIMIT and STOP order for a symbol. This is done because the signals that I get could be...
4ea04c4bea0f933351d0e6b1592ce41d415f0227
<|skeleton|> class MT4: def both_pending_orders(self, trade_type, lots, symbol, entry, stop_loss, take_profit): """Enter both a LIMIT and STOP order for a symbol. This is done because the signals that I get could be above or below market price and the broker will only honor one or the other. So instead of ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MT4: def both_pending_orders(self, trade_type, lots, symbol, entry, stop_loss, take_profit): """Enter both a LIMIT and STOP order for a symbol. This is done because the signals that I get could be above or below market price and the broker will only honor one or the other. So instead of me trying to f...
the_stack_v2_python_sparse
src/mt4.py
metaperl/telegram-autotrader
train
4
565d4fda42a0dbf85b06a4a6be4028f3097c6cef
[ "w.start()\nself.pt = pt\nself.rpt_date = rpt_date\nself.bi = base_index", "data = w.wset('allfundhelddetail', f\"rptdate={self.rpt_date.strftime('%Y%m%d')};windcode={windcode};field=stock_code,proportiontototalstockinvestments\")\ndata = pd.DataFrame(data.Data, index=['stock_code', 'i_weight'], columns=data.Code...
<|body_start_0|> w.start() self.pt = pt self.rpt_date = rpt_date self.bi = base_index <|end_body_0|> <|body_start_1|> data = w.wset('allfundhelddetail', f"rptdate={self.rpt_date.strftime('%Y%m%d')};windcode={windcode};field=stock_code,proportiontototalstockinvestments") ...
PrepareData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrepareData: def __init__(self, pt: dict, rpt_date, base_index=base_index): """组合内部股票配置,单一基金采用如下方式{'000001.OF': 1.0}""" <|body_0|> def stock_allocate(self, windcode): """基金股票配置,获取单个基金在个股上的配置 :return:""" <|body_1|> def stock_industry(self, data): ...
stack_v2_sparse_classes_75kplus_train_068795
3,205
no_license
[ { "docstring": "组合内部股票配置,单一基金采用如下方式{'000001.OF': 1.0}", "name": "__init__", "signature": "def __init__(self, pt: dict, rpt_date, base_index=base_index)" }, { "docstring": "基金股票配置,获取单个基金在个股上的配置 :return:", "name": "stock_allocate", "signature": "def stock_allocate(self, windcode)" }, {...
6
null
Implement the Python class `PrepareData` described below. Class description: Implement the PrepareData class. Method signatures and docstrings: - def __init__(self, pt: dict, rpt_date, base_index=base_index): 组合内部股票配置,单一基金采用如下方式{'000001.OF': 1.0} - def stock_allocate(self, windcode): 基金股票配置,获取单个基金在个股上的配置 :return: - d...
Implement the Python class `PrepareData` described below. Class description: Implement the PrepareData class. Method signatures and docstrings: - def __init__(self, pt: dict, rpt_date, base_index=base_index): 组合内部股票配置,单一基金采用如下方式{'000001.OF': 1.0} - def stock_allocate(self, windcode): 基金股票配置,获取单个基金在个股上的配置 :return: - d...
7cf0b8dc5ddc1e1a4711362662d3844baec3ef31
<|skeleton|> class PrepareData: def __init__(self, pt: dict, rpt_date, base_index=base_index): """组合内部股票配置,单一基金采用如下方式{'000001.OF': 1.0}""" <|body_0|> def stock_allocate(self, windcode): """基金股票配置,获取单个基金在个股上的配置 :return:""" <|body_1|> def stock_industry(self, data): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PrepareData: def __init__(self, pt: dict, rpt_date, base_index=base_index): """组合内部股票配置,单一基金采用如下方式{'000001.OF': 1.0}""" w.start() self.pt = pt self.rpt_date = rpt_date self.bi = base_index def stock_allocate(self, windcode): """基金股票配置,获取单个基金在个股上的配置 :return:...
the_stack_v2_python_sparse
analysis/brinson/brinson_data.py
PengchuanC/analysis
train
2
bccae5614247f49da1b5231b6325c11f03d59ebf
[ "self.relations = relations\nself.relations_func = relations_func\nself.pgm_type = pgm_type\nself.working_dir = working_dir + str(uuid.uuid4()) + '/'\nif os.path.exists(self.working_dir):\n shutil.rmtree(self.working_dir)\nos.makedirs(self.working_dir)", "pgm_class = PSL if self.pgm_type == 'psl' else MRF\npgm...
<|body_start_0|> self.relations = relations self.relations_func = relations_func self.pgm_type = pgm_type self.working_dir = working_dir + str(uuid.uuid4()) + '/' if os.path.exists(self.working_dir): shutil.rmtree(self.working_dir) os.makedirs(self.working_dir...
High-level class with multiple pgm implementations.
Joint
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Joint: """High-level class with multiple pgm implementations.""" def __init__(self, relations, relations_func, pgm_type='psl', working_dir='.temp/'): """Initialization of joint inference class. Parameters ---------- relations : list (default=None) Relations to use for relational mode...
stack_v2_sparse_classes_75kplus_train_068796
2,186
no_license
[ { "docstring": "Initialization of joint inference class. Parameters ---------- relations : list (default=None) Relations to use for relational modeling. relations_func : func (default=None) Domain-dependent helper method to generate pgm files. pgm_type : str (default='psl') {'psl', 'mrf'} Type of PGM to use for...
3
stack_v2_sparse_classes_30k_train_033158
Implement the Python class `Joint` described below. Class description: High-level class with multiple pgm implementations. Method signatures and docstrings: - def __init__(self, relations, relations_func, pgm_type='psl', working_dir='.temp/'): Initialization of joint inference class. Parameters ---------- relations :...
Implement the Python class `Joint` described below. Class description: High-level class with multiple pgm implementations. Method signatures and docstrings: - def __init__(self, relations, relations_func, pgm_type='psl', working_dir='.temp/'): Initialization of joint inference class. Parameters ---------- relations :...
e47d2e080edbbb7f8508acc9d7885eebf6f61bd6
<|skeleton|> class Joint: """High-level class with multiple pgm implementations.""" def __init__(self, relations, relations_func, pgm_type='psl', working_dir='.temp/'): """Initialization of joint inference class. Parameters ---------- relations : list (default=None) Relations to use for relational mode...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Joint: """High-level class with multiple pgm implementations.""" def __init__(self, relations, relations_func, pgm_type='psl', working_dir='.temp/'): """Initialization of joint inference class. Parameters ---------- relations : list (default=None) Relations to use for relational modeling. relatio...
the_stack_v2_python_sparse
EGGS/joint.py
anonymous78023/snspam
train
0
154bdce6df436a843f694684544506452b113bc2
[ "self.B = vectors.Vector(B[0], B[1], B[2])\nself.E = vectors.Vector(E[0], E[1], E[2])\nself.change = False\nself.dir = 'u'\nself.field_type = True", "local = bullets\nfor body in local:\n body.force = 0 * body.force\n body.force = body.force + body.m_c * body.vel @ self.E\n body.force = body.force - body...
<|body_start_0|> self.B = vectors.Vector(B[0], B[1], B[2]) self.E = vectors.Vector(E[0], E[1], E[2]) self.change = False self.dir = 'u' self.field_type = True <|end_body_0|> <|body_start_1|> local = bullets for body in local: body.force = 0 * body.for...
Field
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Field: def __init__(self, B, E): """Magnetic and electric fields class. Parametrs: **B** - Magnetic component of the field **E** - Electric component of the field""" <|body_0|> def calculate_force(self, bullets): """A function that calculates the force from the field...
stack_v2_sparse_classes_75kplus_train_068797
3,443
no_license
[ { "docstring": "Magnetic and electric fields class. Parametrs: **B** - Magnetic component of the field **E** - Electric component of the field", "name": "__init__", "signature": "def __init__(self, B, E)" }, { "docstring": "A function that calculates the force from the field on the bullet. Param...
4
stack_v2_sparse_classes_30k_train_031414
Implement the Python class `Field` described below. Class description: Implement the Field class. Method signatures and docstrings: - def __init__(self, B, E): Magnetic and electric fields class. Parametrs: **B** - Magnetic component of the field **E** - Electric component of the field - def calculate_force(self, bul...
Implement the Python class `Field` described below. Class description: Implement the Field class. Method signatures and docstrings: - def __init__(self, B, E): Magnetic and electric fields class. Parametrs: **B** - Magnetic component of the field **E** - Electric component of the field - def calculate_force(self, bul...
9d813cfb7995f47953d653f9c450f7921dc26fe5
<|skeleton|> class Field: def __init__(self, B, E): """Magnetic and electric fields class. Parametrs: **B** - Magnetic component of the field **E** - Electric component of the field""" <|body_0|> def calculate_force(self, bullets): """A function that calculates the force from the field...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Field: def __init__(self, B, E): """Magnetic and electric fields class. Parametrs: **B** - Magnetic component of the field **E** - Electric component of the field""" self.B = vectors.Vector(B[0], B[1], B[2]) self.E = vectors.Vector(E[0], E[1], E[2]) self.change = False ...
the_stack_v2_python_sparse
duel_ily_zassal/modules/fields.py
python-practice-b02-006/Power.Rangers
train
0
b248759d30b7f77a4ff4a8eb3e34c1f3bdc098eb
[ "self.role = role\nself.host = host\nself.decode_responses = decode_responses", "if sys.argv[0] == 'python -m unittest':\n self.r = fakeredis.FakeStrictRedis(decode_responses=True, charset='utf-8')\n return self.r\nelse:\n if self.host == 'pubsub':\n host = os.getenv('REDIS_PUBSUB_MASTER_HOSTNAME'...
<|body_start_0|> self.role = role self.host = host self.decode_responses = decode_responses <|end_body_0|> <|body_start_1|> if sys.argv[0] == 'python -m unittest': self.r = fakeredis.FakeStrictRedis(decode_responses=True, charset='utf-8') return self.r el...
Redisとの接続に関する処理
Connect
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Connect: """Redisとの接続に関する処理""" def __init__(self, host='api', role='master', decode_responses=True): """@param str host You can set 'api' or 'pubsub' default is 'api' @param str role default is 'master' @param bool decode_responses""" <|body_0|> def open(self): "...
stack_v2_sparse_classes_75kplus_train_068798
2,835
no_license
[ { "docstring": "@param str host You can set 'api' or 'pubsub' default is 'api' @param str role default is 'master' @param bool decode_responses", "name": "__init__", "signature": "def __init__(self, host='api', role='master', decode_responses=True)" }, { "docstring": "decode_responsesをtrueにしないと、...
3
stack_v2_sparse_classes_30k_train_007166
Implement the Python class `Connect` described below. Class description: Redisとの接続に関する処理 Method signatures and docstrings: - def __init__(self, host='api', role='master', decode_responses=True): @param str host You can set 'api' or 'pubsub' default is 'api' @param str role default is 'master' @param bool decode_respo...
Implement the Python class `Connect` described below. Class description: Redisとの接続に関する処理 Method signatures and docstrings: - def __init__(self, host='api', role='master', decode_responses=True): @param str host You can set 'api' or 'pubsub' default is 'api' @param str role default is 'master' @param bool decode_respo...
bece2666c0f769b861ad5ef354055b40da3ed39a
<|skeleton|> class Connect: """Redisとの接続に関する処理""" def __init__(self, host='api', role='master', decode_responses=True): """@param str host You can set 'api' or 'pubsub' default is 'api' @param str role default is 'master' @param bool decode_responses""" <|body_0|> def open(self): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Connect: """Redisとの接続に関する処理""" def __init__(self, host='api', role='master', decode_responses=True): """@param str host You can set 'api' or 'pubsub' default is 'api' @param str role default is 'master' @param bool decode_responses""" self.role = role self.host = host self...
the_stack_v2_python_sparse
app/redis/connect.py
jasonsmithj/spam_public
train
0
010a5eda3d42169112042145140e28c0d5d19a12
[ "accountInfo = {'username': request.user.username, 'email': request.user.email, 'phone': request.user.phone, 'wechat': request.user.wechat}\naccountForm = AccountForm(accountInfo)\nreturn render(request, 'usermgr/user/account.html', locals())", "if request.is_ajax():\n resultData = {'ret': None}\n accountFo...
<|body_start_0|> accountInfo = {'username': request.user.username, 'email': request.user.email, 'phone': request.user.phone, 'wechat': request.user.wechat} accountForm = AccountForm(accountInfo) return render(request, 'usermgr/user/account.html', locals()) <|end_body_0|> <|body_start_1|> ...
处理用户帐号相关请求
Account
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Account: """处理用户帐号相关请求""" def get(self, request): """处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面""" <|body_0|> def post(self, request): """处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回帐号处理结果""" <|body_1|> d...
stack_v2_sparse_classes_75kplus_train_068799
12,349
no_license
[ { "docstring": "处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面", "name": "get", "signature": "def get(self, request)" }, { "docstring": "处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回帐号处理结果", "name": "post", "signature": "def post(self, request)" ...
3
stack_v2_sparse_classes_30k_train_004562
Implement the Python class `Account` described below. Class description: 处理用户帐号相关请求 Method signatures and docstrings: - def get(self, request): 处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面 - def post(self, request): 处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回帐号处理结果 - def d...
Implement the Python class `Account` described below. Class description: 处理用户帐号相关请求 Method signatures and docstrings: - def get(self, request): 处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面 - def post(self, request): 处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回帐号处理结果 - def d...
26c49e8f525ca57dca27f8de53d15bcab24d00e4
<|skeleton|> class Account: """处理用户帐号相关请求""" def get(self, request): """处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面""" <|body_0|> def post(self, request): """处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回帐号处理结果""" <|body_1|> d...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Account: """处理用户帐号相关请求""" def get(self, request): """处理用户帐号相关请求 :param request: django路由响应默认携带request对象 :return: 返回用户帐号管理界面""" accountInfo = {'username': request.user.username, 'email': request.user.email, 'phone': request.user.phone, 'wechat': request.user.wechat} accountForm = A...
the_stack_v2_python_sparse
iframe_api/views.py
A35-Zhou/Rental-House-Manager
train
0