blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
a16403fcf0714da7e9242cdb04eeba1445888cdb
[ "if n < 0:\n n = -n\n x = 1 / x\nres = 1\nwhile n:\n if n & 1:\n res *= x\n x *= x\n n >>= 1\nreturn res", "if n == 0:\n return 1\nif n < 0:\n return 1 / self.myPow1(x, -n)\nif n & 1:\n return x * self.myPow1(x * x, n >> 1)\nelse:\n return self.myPow1(x * x, n >> 1)" ]
<|body_start_0|> if n < 0: n = -n x = 1 / x res = 1 while n: if n & 1: res *= x x *= x n >>= 1 return res <|end_body_0|> <|body_start_1|> if n == 0: return 1 if n < 0: ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def myPow(self, x, n): """:type x: float :type n: int :rtype: float""" <|body_0|> def myPow1(self, x, n): """:type x: float :type n: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 0: n = -n ...
stack_v2_sparse_classes_36k_train_022400
714
no_license
[ { "docstring": ":type x: float :type n: int :rtype: float", "name": "myPow", "signature": "def myPow(self, x, n)" }, { "docstring": ":type x: float :type n: int :rtype: float", "name": "myPow1", "signature": "def myPow1(self, x, n)" } ]
2
stack_v2_sparse_classes_30k_test_000603
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myPow(self, x, n): :type x: float :type n: int :rtype: float - def myPow1(self, x, n): :type x: float :type n: int :rtype: float
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def myPow(self, x, n): :type x: float :type n: int :rtype: float - def myPow1(self, x, n): :type x: float :type n: int :rtype: float <|skeleton|> class Solution: def myPow(...
f1d780b7e8b91b4df704651514018143c6931f9d
<|skeleton|> class Solution: def myPow(self, x, n): """:type x: float :type n: int :rtype: float""" <|body_0|> def myPow1(self, x, n): """:type x: float :type n: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def myPow(self, x, n): """:type x: float :type n: int :rtype: float""" if n < 0: n = -n x = 1 / x res = 1 while n: if n & 1: res *= x x *= x n >>= 1 return res def myPow1(self, x,...
the_stack_v2_python_sparse
ProgramForLeetCode/LeetCode/50_myPow.py
DQDH/Algorithm_Code
train
0
b80a62e3d9cf9b64f7eea7804561c77a30029a91
[ "result = [0 for _ in range(len(nums))]\nlow = 0\nhigh = len(result) - 1\nfor x in nums:\n if x & 1 == 1:\n result[low] = x\n low += 1\n else:\n result[high] = x\n high -= 1\nreturn result", "low = 0\nhigh = len(nums) - 1\nwhile low < high:\n if nums[low] & 1 == 0 and nums[hig...
<|body_start_0|> result = [0 for _ in range(len(nums))] low = 0 high = len(result) - 1 for x in nums: if x & 1 == 1: result[low] = x low += 1 else: result[high] = x high -= 1 return result <|e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def exchange(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def exchange2(self, nums): """双端指针""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = [0 for _ in range(len(nums))] low = 0 high = len...
stack_v2_sparse_classes_36k_train_022401
1,548
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "exchange", "signature": "def exchange(self, nums)" }, { "docstring": "双端指针", "name": "exchange2", "signature": "def exchange2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_000656
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exchange(self, nums): :type nums: List[int] :rtype: List[int] - def exchange2(self, nums): 双端指针
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exchange(self, nums): :type nums: List[int] :rtype: List[int] - def exchange2(self, nums): 双端指针 <|skeleton|> class Solution: def exchange(self, nums): """:type ...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class Solution: def exchange(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def exchange2(self, nums): """双端指针""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def exchange(self, nums): """:type nums: List[int] :rtype: List[int]""" result = [0 for _ in range(len(nums))] low = 0 high = len(result) - 1 for x in nums: if x & 1 == 1: result[low] = x low += 1 else: ...
the_stack_v2_python_sparse
剑指/二刷/调整数组顺序使奇数位于偶数前面_S.py
2226171237/Algorithmpractice
train
0
e24f77a7ec4c63a0c1ac7d553b9bc43a5beba174
[ "b = x.max()\ny = np.exp(x - b)\nx = (y.T / y.sum(axis=1)).T\nself.x = x\nreturn x", "dx = np.zeros(dout.shape, dtype=np.float64)\nfor i in range(0, dout.shape[0]):\n delta = self.x[i, :].reshape(-1, 1)\n delta = np.diagflat(delta) - np.dot(delta, delta.T)\n dx[i, :] = np.dot(delta, dout[i, :])\nreturn d...
<|body_start_0|> b = x.max() y = np.exp(x - b) x = (y.T / y.sum(axis=1)).T self.x = x return x <|end_body_0|> <|body_start_1|> dx = np.zeros(dout.shape, dtype=np.float64) for i in range(0, dout.shape[0]): delta = self.x[i, :].reshape(-1, 1) ...
Softmax activation module.
SoftMaxModule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftMaxModule: """Softmax activation module.""" def forward(self, x): """Forward pass. Args: x: input to the module Returns: out: output of the module""" <|body_0|> def backward(self, dout): """Backward pass. Args: dout: gradients of the previous modul Returns: d...
stack_v2_sparse_classes_36k_train_022402
3,644
no_license
[ { "docstring": "Forward pass. Args: x: input to the module Returns: out: output of the module", "name": "forward", "signature": "def forward(self, x)" }, { "docstring": "Backward pass. Args: dout: gradients of the previous modul Returns: dx: gradients with respect to the input of the module", ...
2
stack_v2_sparse_classes_30k_train_001182
Implement the Python class `SoftMaxModule` described below. Class description: Softmax activation module. Method signatures and docstrings: - def forward(self, x): Forward pass. Args: x: input to the module Returns: out: output of the module - def backward(self, dout): Backward pass. Args: dout: gradients of the prev...
Implement the Python class `SoftMaxModule` described below. Class description: Softmax activation module. Method signatures and docstrings: - def forward(self, x): Forward pass. Args: x: input to the module Returns: out: output of the module - def backward(self, dout): Backward pass. Args: dout: gradients of the prev...
19e8ac762cedda82410a0dda676edaf659c55d6a
<|skeleton|> class SoftMaxModule: """Softmax activation module.""" def forward(self, x): """Forward pass. Args: x: input to the module Returns: out: output of the module""" <|body_0|> def backward(self, dout): """Backward pass. Args: dout: gradients of the previous modul Returns: d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SoftMaxModule: """Softmax activation module.""" def forward(self, x): """Forward pass. Args: x: input to the module Returns: out: output of the module""" b = x.max() y = np.exp(x - b) x = (y.T / y.sum(axis=1)).T self.x = x return x def backward(self, d...
the_stack_v2_python_sparse
assignment_1/code/modules.py
RancyChepchirchir/dl-assignments
train
0
f148e743bb4383215204e8589fc5d3e0870ec399
[ "company = ShopCompanyService.get_by_id(id)\ncontact_list = ShopCompanyContactService.get_by_company_id(id)\ncompany['contact_list'] = contact_list\nreturn api_response(data=company)", "parsed_data = self.parsed_data\ntry:\n ShopCompanyService.update_shop_company_by_id(id, **parsed_data)\nexcept ClientError as...
<|body_start_0|> company = ShopCompanyService.get_by_id(id) contact_list = ShopCompanyContactService.get_by_company_id(id) company['contact_list'] = contact_list return api_response(data=company) <|end_body_0|> <|body_start_1|> parsed_data = self.parsed_data try: ...
ShopCompanyApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShopCompanyApi: def get(self, id): """根据ID查询公司""" <|body_0|> def put(self, id): """根据ID修改公司信息""" <|body_1|> def delete(self, id): """根据ID删除公司""" <|body_2|> <|end_skeleton|> <|body_start_0|> company = ShopCompanyService.get_by_id...
stack_v2_sparse_classes_36k_train_022403
8,580
no_license
[ { "docstring": "根据ID查询公司", "name": "get", "signature": "def get(self, id)" }, { "docstring": "根据ID修改公司信息", "name": "put", "signature": "def put(self, id)" }, { "docstring": "根据ID删除公司", "name": "delete", "signature": "def delete(self, id)" } ]
3
stack_v2_sparse_classes_30k_train_000446
Implement the Python class `ShopCompanyApi` described below. Class description: Implement the ShopCompanyApi class. Method signatures and docstrings: - def get(self, id): 根据ID查询公司 - def put(self, id): 根据ID修改公司信息 - def delete(self, id): 根据ID删除公司
Implement the Python class `ShopCompanyApi` described below. Class description: Implement the ShopCompanyApi class. Method signatures and docstrings: - def get(self, id): 根据ID查询公司 - def put(self, id): 根据ID修改公司信息 - def delete(self, id): 根据ID删除公司 <|skeleton|> class ShopCompanyApi: def get(self, id): """根据...
e87f98f5fbe42c465473d83cb2a535209a8e8287
<|skeleton|> class ShopCompanyApi: def get(self, id): """根据ID查询公司""" <|body_0|> def put(self, id): """根据ID修改公司信息""" <|body_1|> def delete(self, id): """根据ID删除公司""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShopCompanyApi: def get(self, id): """根据ID查询公司""" company = ShopCompanyService.get_by_id(id) contact_list = ShopCompanyContactService.get_by_company_id(id) company['contact_list'] = contact_list return api_response(data=company) def put(self, id): """根据ID修改...
the_stack_v2_python_sparse
creole/wsgi/api/v1/endpoint/shop.py
Creoles/creole
train
0
2838e391f1189495be50e9eade0a4e7cb23b20d4
[ "QTreeWidgetItem.__init__(self, parent)\nself.siz = len(key)\nself.setText(0, unicode(key, 'utf8'))\nself.setKeyFont(type=type)", "font = QFont()\nif type == 2:\n font.setItalic(True)\n self.setFont(0, font)\nelif type == 0 and self.siz > 0:\n self.setForeground(0, QColor(Qt.darkBlue))\n self.setIcon(...
<|body_start_0|> QTreeWidgetItem.__init__(self, parent) self.siz = len(key) self.setText(0, unicode(key, 'utf8')) self.setKeyFont(type=type) <|end_body_0|> <|body_start_1|> font = QFont() if type == 2: font.setItalic(True) self.setFont(0, font) ...
Treewidget item for key
KeyItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KeyItem: """Treewidget item for key""" def __init__(self, key, parent=None, type=None): """Constructs KeyItem widget item @param key: @type key: @param parent: @type parent: @param type: @type type:""" <|body_0|> def setKeyFont(self, type): """Set the font of the...
stack_v2_sparse_classes_36k_train_022404
9,389
permissive
[ { "docstring": "Constructs KeyItem widget item @param key: @type key: @param parent: @type parent: @param type: @type type:", "name": "__init__", "signature": "def __init__(self, key, parent=None, type=None)" }, { "docstring": "Set the font of the key @param type: @type type:", "name": "setK...
2
null
Implement the Python class `KeyItem` described below. Class description: Treewidget item for key Method signatures and docstrings: - def __init__(self, key, parent=None, type=None): Constructs KeyItem widget item @param key: @type key: @param parent: @type parent: @param type: @type type: - def setKeyFont(self, type)...
Implement the Python class `KeyItem` described below. Class description: Treewidget item for key Method signatures and docstrings: - def __init__(self, key, parent=None, type=None): Constructs KeyItem widget item @param key: @type key: @param parent: @type parent: @param type: @type type: - def setKeyFont(self, type)...
66f65dd6e4a48909120f63239f630147c733df3f
<|skeleton|> class KeyItem: """Treewidget item for key""" def __init__(self, key, parent=None, type=None): """Constructs KeyItem widget item @param key: @type key: @param parent: @type parent: @param type: @type type:""" <|body_0|> def setKeyFont(self, type): """Set the font of the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KeyItem: """Treewidget item for key""" def __init__(self, key, parent=None, type=None): """Constructs KeyItem widget item @param key: @type key: @param parent: @type parent: @param type: @type type:""" QTreeWidgetItem.__init__(self, parent) self.siz = len(key) self.setText...
the_stack_v2_python_sparse
ServerExplorer/ReleaseNotes.py
ExtensiveAutomation/extensiveautomation-appclient
train
2
dc8c925bad73a2b18c14df33c8f168e8f0e51155
[ "rc_mock = cros_build_lib_unittest.RunCommandMock()\nnoarch = 'target=foo\\ncategory=bla\\n'\nrc_mock.SetDefaultCmdResult(output=noarch)\nwith rc_mock:\n self.assertEqual(None, toolchain.GetArchForTarget('fake_target'))\namd64arch = 'arch=amd64\\ntarget=foo\\n'\nrc_mock.SetDefaultCmdResult(output=amd64arch)\nwit...
<|body_start_0|> rc_mock = cros_build_lib_unittest.RunCommandMock() noarch = 'target=foo\ncategory=bla\n' rc_mock.SetDefaultCmdResult(output=noarch) with rc_mock: self.assertEqual(None, toolchain.GetArchForTarget('fake_target')) amd64arch = 'arch=amd64\ntarget=foo\n' ...
Tests for lib.toolchain.
ToolchainTest
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ToolchainTest: """Tests for lib.toolchain.""" def testArchForToolchain(self): """Tests that we correctly parse crossdev's output.""" <|body_0|> def testReadsBoardToolchains(self, find_overlays_mock): """Tests that we correctly parse toolchain configs for an overl...
stack_v2_sparse_classes_36k_train_022405
2,556
permissive
[ { "docstring": "Tests that we correctly parse crossdev's output.", "name": "testArchForToolchain", "signature": "def testArchForToolchain(self)" }, { "docstring": "Tests that we correctly parse toolchain configs for an overlay stack.", "name": "testReadsBoardToolchains", "signature": "de...
2
null
Implement the Python class `ToolchainTest` described below. Class description: Tests for lib.toolchain. Method signatures and docstrings: - def testArchForToolchain(self): Tests that we correctly parse crossdev's output. - def testReadsBoardToolchains(self, find_overlays_mock): Tests that we correctly parse toolchain...
Implement the Python class `ToolchainTest` described below. Class description: Tests for lib.toolchain. Method signatures and docstrings: - def testArchForToolchain(self): Tests that we correctly parse crossdev's output. - def testReadsBoardToolchains(self, find_overlays_mock): Tests that we correctly parse toolchain...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class ToolchainTest: """Tests for lib.toolchain.""" def testArchForToolchain(self): """Tests that we correctly parse crossdev's output.""" <|body_0|> def testReadsBoardToolchains(self, find_overlays_mock): """Tests that we correctly parse toolchain configs for an overl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ToolchainTest: """Tests for lib.toolchain.""" def testArchForToolchain(self): """Tests that we correctly parse crossdev's output.""" rc_mock = cros_build_lib_unittest.RunCommandMock() noarch = 'target=foo\ncategory=bla\n' rc_mock.SetDefaultCmdResult(output=noarch) ...
the_stack_v2_python_sparse
third_party/chromite/lib/toolchain_unittest.py
metux/chromium-suckless
train
5
619f2cff6e97da7a8707040c73527b2da13c2190
[ "if len(xcols) == 0 or xcols is None:\n return 0.0\nsample_size = len(df.index)\ndf1 = df.copy()\ndf1 = df1.groupby(xcols)[xcols].size()\ndf1 = df1.apply(lambda x: x / sample_size)\nlocal_ent = -df1 * np.log(df1 + 1e-07)\nall_ent = local_ent.sum()\nif verbose:\n print('\\nprobs for ', xcols)\n print(df1)\n...
<|body_start_0|> if len(xcols) == 0 or xcols is None: return 0.0 sample_size = len(df.index) df1 = df.copy() df1 = df1.groupby(xcols)[xcols].size() df1 = df1.apply(lambda x: x / sample_size) local_ent = -df1 * np.log(df1 + 1e-07) all_ent = local_ent.su...
This class calculates classical (not quantum yet) entropy, conditional information (CI), mutual information (MI) and conditional mutual info ( CMI) from a dataframe (hence, from empirical data, not from the true distributions of a bnet). logs's in entropies are base e, natural logs Error in entropy is ln(n+1) - ln(n) ...
DataEntropy
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataEntropy: """This class calculates classical (not quantum yet) entropy, conditional information (CI), mutual information (MI) and conditional mutual info ( CMI) from a dataframe (hence, from empirical data, not from the true distributions of a bnet). logs's in entropies are base e, natural log...
stack_v2_sparse_classes_36k_train_022406
5,703
permissive
[ { "docstring": "Returns the entropy H(x) where x is given by the list of columns xcols in the dataframe df. Parameters ---------- df : pandas.DataFrame dataframe for which entropy is calculated xcols : list[str] list of column names in df. The x in H(x) verbose : bool If True, print extra info in console. Retur...
4
stack_v2_sparse_classes_30k_train_007065
Implement the Python class `DataEntropy` described below. Class description: This class calculates classical (not quantum yet) entropy, conditional information (CI), mutual information (MI) and conditional mutual info ( CMI) from a dataframe (hence, from empirical data, not from the true distributions of a bnet). logs...
Implement the Python class `DataEntropy` described below. Class description: This class calculates classical (not quantum yet) entropy, conditional information (CI), mutual information (MI) and conditional mutual info ( CMI) from a dataframe (hence, from empirical data, not from the true distributions of a bnet). logs...
5b4a3055ea14c2ee9c80c339f759fe2b9c8c51e2
<|skeleton|> class DataEntropy: """This class calculates classical (not quantum yet) entropy, conditional information (CI), mutual information (MI) and conditional mutual info ( CMI) from a dataframe (hence, from empirical data, not from the true distributions of a bnet). logs's in entropies are base e, natural log...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataEntropy: """This class calculates classical (not quantum yet) entropy, conditional information (CI), mutual information (MI) and conditional mutual info ( CMI) from a dataframe (hence, from empirical data, not from the true distributions of a bnet). logs's in entropies are base e, natural logs Error in en...
the_stack_v2_python_sparse
shannon_info_theory/DataEntropy.py
artiste-qb-net/quantum-fog
train
95
b19efcf993d2b8a09d399f1690d2f8a72a300d54
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DeviceEnrollmentWindowsHelloForBusinessConfiguration()", "from .device_enrollment_configuration import DeviceEnrollmentConfiguration\nfrom .enablement import Enablement\nfrom .windows_hello_for_business_pin_usage import WindowsHelloFor...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return DeviceEnrollmentWindowsHelloForBusinessConfiguration() <|end_body_0|> <|body_start_1|> from .device_enrollment_configuration import DeviceEnrollmentConfiguration from .enablement import ...
Windows Hello for Business settings lets users access their devices using a gesture, such as biometric authentication, or a PIN. Configure settings for enrolled Windows 10, Windows 10 Mobile and later.
DeviceEnrollmentWindowsHelloForBusinessConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceEnrollmentWindowsHelloForBusinessConfiguration: """Windows Hello for Business settings lets users access their devices using a gesture, such as biometric authentication, or a PIN. Configure settings for enrolled Windows 10, Windows 10 Mobile and later.""" def create_from_discriminator_...
stack_v2_sparse_classes_36k_train_022407
7,971
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: DeviceEnrollmentWindowsHelloForBusinessConfiguration", "name": "create_from_discriminator_value", "signature...
3
null
Implement the Python class `DeviceEnrollmentWindowsHelloForBusinessConfiguration` described below. Class description: Windows Hello for Business settings lets users access their devices using a gesture, such as biometric authentication, or a PIN. Configure settings for enrolled Windows 10, Windows 10 Mobile and later....
Implement the Python class `DeviceEnrollmentWindowsHelloForBusinessConfiguration` described below. Class description: Windows Hello for Business settings lets users access their devices using a gesture, such as biometric authentication, or a PIN. Configure settings for enrolled Windows 10, Windows 10 Mobile and later....
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class DeviceEnrollmentWindowsHelloForBusinessConfiguration: """Windows Hello for Business settings lets users access their devices using a gesture, such as biometric authentication, or a PIN. Configure settings for enrolled Windows 10, Windows 10 Mobile and later.""" def create_from_discriminator_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DeviceEnrollmentWindowsHelloForBusinessConfiguration: """Windows Hello for Business settings lets users access their devices using a gesture, such as biometric authentication, or a PIN. Configure settings for enrolled Windows 10, Windows 10 Mobile and later.""" def create_from_discriminator_value(parse_n...
the_stack_v2_python_sparse
msgraph/generated/models/device_enrollment_windows_hello_for_business_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
9d103301eba188e9e5902485ef494b2c32d4e38e
[ "if not RUNNING_TESTS:\n print(f'Instantiating a FalseCeleryApp for {an_function.__name__}.')\nself.an_function = an_function", "if not RUNNING_TESTS:\n print(f'task declared, args: {args}, kwargs:{kwargs}')\nreturn FalseCeleryApp", "if not RUNNING_TESTS:\n print(f'apply_async running, args:{args}, kwa...
<|body_start_0|> if not RUNNING_TESTS: print(f'Instantiating a FalseCeleryApp for {an_function.__name__}.') self.an_function = an_function <|end_body_0|> <|body_start_1|> if not RUNNING_TESTS: print(f'task declared, args: {args}, kwargs:{kwargs}') return FalseCel...
Class that mimics enough functionality of a Celery app for us to be able to execute our celery infrastructure from the shell, single-threaded, without queuing.
FalseCeleryApp
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FalseCeleryApp: """Class that mimics enough functionality of a Celery app for us to be able to execute our celery infrastructure from the shell, single-threaded, without queuing.""" def __init__(self, an_function: callable): """at instantiation (aka when used as a decorator) stash th...
stack_v2_sparse_classes_36k_train_022408
9,856
permissive
[ { "docstring": "at instantiation (aka when used as a decorator) stash the function we wrap", "name": "__init__", "signature": "def __init__(self, an_function: callable)" }, { "docstring": "Our pattern is that we wrap our celery functions in the task decorator. This function executes at-import-ti...
3
stack_v2_sparse_classes_30k_train_010862
Implement the Python class `FalseCeleryApp` described below. Class description: Class that mimics enough functionality of a Celery app for us to be able to execute our celery infrastructure from the shell, single-threaded, without queuing. Method signatures and docstrings: - def __init__(self, an_function: callable):...
Implement the Python class `FalseCeleryApp` described below. Class description: Class that mimics enough functionality of a Celery app for us to be able to execute our celery infrastructure from the shell, single-threaded, without queuing. Method signatures and docstrings: - def __init__(self, an_function: callable):...
cc25a60bfa8ccab953c55ac82f68d160ab00652a
<|skeleton|> class FalseCeleryApp: """Class that mimics enough functionality of a Celery app for us to be able to execute our celery infrastructure from the shell, single-threaded, without queuing.""" def __init__(self, an_function: callable): """at instantiation (aka when used as a decorator) stash th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FalseCeleryApp: """Class that mimics enough functionality of a Celery app for us to be able to execute our celery infrastructure from the shell, single-threaded, without queuing.""" def __init__(self, an_function: callable): """at instantiation (aka when used as a decorator) stash the function we...
the_stack_v2_python_sparse
libs/celery_control.py
onnela-lab/beiwe-backend
train
68
4d620b8a55919ed2257ee6eaca57727c67c037ec
[ "if not root:\n return 'null,'\nstack = [root]\nss = [str(root.val) + ',']\ns = ''\nwhile stack:\n p = stack.pop()\n s += ss.pop()\n if p:\n if p.right:\n stack.append(p.right)\n ss.append(str(p.right.val) + ',')\n else:\n stack.append(None)\n ss...
<|body_start_0|> if not root: return 'null,' stack = [root] ss = [str(root.val) + ','] s = '' while stack: p = stack.pop() s += ss.pop() if p: if p.right: stack.append(p.right) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_36k_train_022409
2,873
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
276d2137a929e41120c2e8a3a8e4d09023a2abd5
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if not root: return 'null,' stack = [root] ss = [str(root.val) + ','] s = '' while stack: p = stack.pop() s += ss.pop() if...
the_stack_v2_python_sparse
449.序列化和反序列化二叉搜索树.py
kangkang59812/LeetCode-python
train
0
f6c7c3f08e3e0cae17e1175d5f664ee3ee17ca5c
[ "super().__init__(parent)\nself._entry = entry\nself._log_entry_available_signal = log_entry_available_signal\nobserver = _TesterListener(entry=entry, log_entry_available_signal=log_entry_available_signal)\nself._tester = Tester(configuration=cast(RootConfiguration, entry.configuration), yes_we_hack_api_clients_fac...
<|body_start_0|> super().__init__(parent) self._entry = entry self._log_entry_available_signal = log_entry_available_signal observer = _TesterListener(entry=entry, log_entry_available_signal=log_entry_available_signal) self._tester = Tester(configuration=cast(RootConfiguration, e...
A thread for testing configuration.
TesterThread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TesterThread: """A thread for testing configuration.""" def __init__(self, parent: QObject, entry: RootConfigurationEntry, log_entry_available_signal: SignalInstance): """Initialize self. Args: parent: a parent widget entry: a root configuration entry log_entry_available_signal: a si...
stack_v2_sparse_classes_36k_train_022410
5,260
no_license
[ { "docstring": "Initialize self. Args: parent: a parent widget entry: a root configuration entry log_entry_available_signal: a signal that receive events from the thread", "name": "__init__", "signature": "def __init__(self, parent: QObject, entry: RootConfigurationEntry, log_entry_available_signal: Sig...
2
stack_v2_sparse_classes_30k_train_005288
Implement the Python class `TesterThread` described below. Class description: A thread for testing configuration. Method signatures and docstrings: - def __init__(self, parent: QObject, entry: RootConfigurationEntry, log_entry_available_signal: SignalInstance): Initialize self. Args: parent: a parent widget entry: a ...
Implement the Python class `TesterThread` described below. Class description: A thread for testing configuration. Method signatures and docstrings: - def __init__(self, parent: QObject, entry: RootConfigurationEntry, log_entry_available_signal: SignalInstance): Initialize self. Args: parent: a parent widget entry: a ...
3da2161c3c9e0652c2cfc78ab514359bcf2e436b
<|skeleton|> class TesterThread: """A thread for testing configuration.""" def __init__(self, parent: QObject, entry: RootConfigurationEntry, log_entry_available_signal: SignalInstance): """Initialize self. Args: parent: a parent widget entry: a root configuration entry log_entry_available_signal: a si...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TesterThread: """A thread for testing configuration.""" def __init__(self, parent: QObject, entry: RootConfigurationEntry, log_entry_available_signal: SignalInstance): """Initialize self. Args: parent: a parent widget entry: a root configuration entry log_entry_available_signal: a signal that rec...
the_stack_v2_python_sparse
ywh2bt/gui/widgets/thread/tester.py
yeswehack/ywh2bugtracker
train
10
6c6ac057635eebd1df8111204b50153a6dd79733
[ "n = len(heights)\nif n == 0:\n return 0\narea = 0\nfor i in range(n):\n curr_height = heights[i]\n left = i\n while left > 0 and heights[left - 1] >= curr_height:\n left -= 1\n right = i\n while right < n - 1 and heights[right + 1] >= curr_height:\n right += 1\n curr_area = (righ...
<|body_start_0|> n = len(heights) if n == 0: return 0 area = 0 for i in range(n): curr_height = heights[i] left = i while left > 0 and heights[left - 1] >= curr_height: left -= 1 right = i while right...
OfficialSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfficialSolution: def largest_rectangle_area(self, heights: List[int]) -> int: """暴力解法(两边扩散)。""" <|body_0|> def largest_rectangle_area_2(self, heights: List[int]) -> int: """单调栈(递增)。""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(heights) ...
stack_v2_sparse_classes_36k_train_022411
4,345
no_license
[ { "docstring": "暴力解法(两边扩散)。", "name": "largest_rectangle_area", "signature": "def largest_rectangle_area(self, heights: List[int]) -> int" }, { "docstring": "单调栈(递增)。", "name": "largest_rectangle_area_2", "signature": "def largest_rectangle_area_2(self, heights: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_009508
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def largest_rectangle_area(self, heights: List[int]) -> int: 暴力解法(两边扩散)。 - def largest_rectangle_area_2(self, heights: List[int]) -> int: 单调栈(递增)。
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def largest_rectangle_area(self, heights: List[int]) -> int: 暴力解法(两边扩散)。 - def largest_rectangle_area_2(self, heights: List[int]) -> int: 单调栈(递增)。 <|skeleton|> c...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class OfficialSolution: def largest_rectangle_area(self, heights: List[int]) -> int: """暴力解法(两边扩散)。""" <|body_0|> def largest_rectangle_area_2(self, heights: List[int]) -> int: """单调栈(递增)。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfficialSolution: def largest_rectangle_area(self, heights: List[int]) -> int: """暴力解法(两边扩散)。""" n = len(heights) if n == 0: return 0 area = 0 for i in range(n): curr_height = heights[i] left = i while left > 0 and heights...
the_stack_v2_python_sparse
0084_largest-rectangle-in-histogram.py
Nigirimeshi/leetcode
train
0
a3f22992479fd8bb4c69e2294966637bbf79436c
[ "self.id = id\nif id:\n self.id = id\nelse:\n Base.__nb_objects += 1\n self.id = Base.__nb_objects", "if list_dictionaries:\n dict = json.dumps(list_dictionaries)\n return dict\nreturn '[]'", "new = []\nopen_name = cls.__name__ + '.json'\nif list_objs is not None:\n for obj in list_objs:\n ...
<|body_start_0|> self.id = id if id: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects <|end_body_0|> <|body_start_1|> if list_dictionaries: dict = json.dumps(list_dictionaries) return dict return '[...
First class
Base
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Base: """First class""" def __init__(self, id=None): """class constructor""" <|body_0|> def to_json_string(list_dictionaries): """sharing data representation""" <|body_1|> def save_to_file(cls, list_objs): """writes the JSON string representa...
stack_v2_sparse_classes_36k_train_022412
1,660
no_license
[ { "docstring": "class constructor", "name": "__init__", "signature": "def __init__(self, id=None)" }, { "docstring": "sharing data representation", "name": "to_json_string", "signature": "def to_json_string(list_dictionaries)" }, { "docstring": "writes the JSON string representat...
5
stack_v2_sparse_classes_30k_train_007514
Implement the Python class `Base` described below. Class description: First class Method signatures and docstrings: - def __init__(self, id=None): class constructor - def to_json_string(list_dictionaries): sharing data representation - def save_to_file(cls, list_objs): writes the JSON string representation of list_ob...
Implement the Python class `Base` described below. Class description: First class Method signatures and docstrings: - def __init__(self, id=None): class constructor - def to_json_string(list_dictionaries): sharing data representation - def save_to_file(cls, list_objs): writes the JSON string representation of list_ob...
46c04cdc7b76afbd79c650ff258f85aef7d2d5fe
<|skeleton|> class Base: """First class""" def __init__(self, id=None): """class constructor""" <|body_0|> def to_json_string(list_dictionaries): """sharing data representation""" <|body_1|> def save_to_file(cls, list_objs): """writes the JSON string representa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Base: """First class""" def __init__(self, id=None): """class constructor""" self.id = id if id: self.id = id else: Base.__nb_objects += 1 self.id = Base.__nb_objects def to_json_string(list_dictionaries): """sharing data re...
the_stack_v2_python_sparse
0x0C-python-almost_a_circle/models/base.py
Leidysalda/holbertonschool-higher_level_programming
train
0
82bb39dbb7391161dd61f37312a2e56b4923b0f9
[ "if self.request.get('continue') != '' and self.request.get('commit') == 'Yes':\n self.redirect(self.request.get('continue').encode('ascii', 'ignore'), self.response)\nelse:\n self.redirect('/', self.response)", "continue_url = urllib.unquote(self.request.get('continue'))\nurl_match = re.search(self.CONTINU...
<|body_start_0|> if self.request.get('continue') != '' and self.request.get('commit') == 'Yes': self.redirect(self.request.get('continue').encode('ascii', 'ignore'), self.response) else: self.redirect('/', self.response) <|end_body_0|> <|body_start_1|> continue_url = url...
Class to handle requests to /users/confirm and /users/verify pages.
LoginVerify
[ "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginVerify: """Class to handle requests to /users/confirm and /users/verify pages.""" def post(self): """Handler for POST requests.""" <|body_0|> def get(self): """Handler for GET requests.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if sel...
stack_v2_sparse_classes_36k_train_022413
37,207
permissive
[ { "docstring": "Handler for POST requests.", "name": "post", "signature": "def post(self)" }, { "docstring": "Handler for GET requests.", "name": "get", "signature": "def get(self)" } ]
2
stack_v2_sparse_classes_30k_train_012960
Implement the Python class `LoginVerify` described below. Class description: Class to handle requests to /users/confirm and /users/verify pages. Method signatures and docstrings: - def post(self): Handler for POST requests. - def get(self): Handler for GET requests.
Implement the Python class `LoginVerify` described below. Class description: Class to handle requests to /users/confirm and /users/verify pages. Method signatures and docstrings: - def post(self): Handler for POST requests. - def get(self): Handler for GET requests. <|skeleton|> class LoginVerify: """Class to ha...
aa36e8dfaa295d53bec616ed07f91ec8c02fa4e1
<|skeleton|> class LoginVerify: """Class to handle requests to /users/confirm and /users/verify pages.""" def post(self): """Handler for POST requests.""" <|body_0|> def get(self): """Handler for GET requests.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginVerify: """Class to handle requests to /users/confirm and /users/verify pages.""" def post(self): """Handler for POST requests.""" if self.request.get('continue') != '' and self.request.get('commit') == 'Yes': self.redirect(self.request.get('continue').encode('ascii', 'ig...
the_stack_v2_python_sparse
AppDashboard/dashboard.py
shatterednirvana/appscale
train
6
00994d2f261e4ddc3044ce0393f2d3aff7762dee
[ "u_id = self.token_data.get('userId')\ntry:\n nickname = self.parse_body('nickname', '')\n company = self.parse_body('company', '')\n customer_type = self.parse_body('customerType', 0)\n contact = self.parse_body('contact', '')\n contact_type = self.parse_body('contactType', 1)\nexcept ValueError:\n ...
<|body_start_0|> u_id = self.token_data.get('userId') try: nickname = self.parse_body('nickname', '') company = self.parse_body('company', '') customer_type = self.parse_body('customerType', 0) contact = self.parse_body('contact', '') contact_t...
用户基本资料
InfoHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InfoHandler: """用户基本资料""" def post(self, *args, **kwargs): """更新""" <|body_0|> def get(self, *args, **kwargs): """获取""" <|body_1|> <|end_skeleton|> <|body_start_0|> u_id = self.token_data.get('userId') try: nickname = self.pa...
stack_v2_sparse_classes_36k_train_022414
18,392
no_license
[ { "docstring": "更新", "name": "post", "signature": "def post(self, *args, **kwargs)" }, { "docstring": "获取", "name": "get", "signature": "def get(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_017553
Implement the Python class `InfoHandler` described below. Class description: 用户基本资料 Method signatures and docstrings: - def post(self, *args, **kwargs): 更新 - def get(self, *args, **kwargs): 获取
Implement the Python class `InfoHandler` described below. Class description: 用户基本资料 Method signatures and docstrings: - def post(self, *args, **kwargs): 更新 - def get(self, *args, **kwargs): 获取 <|skeleton|> class InfoHandler: """用户基本资料""" def post(self, *args, **kwargs): """更新""" <|body_0|> ...
e31b674d38ce62c0ee30bf3dda4462060631974e
<|skeleton|> class InfoHandler: """用户基本资料""" def post(self, *args, **kwargs): """更新""" <|body_0|> def get(self, *args, **kwargs): """获取""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InfoHandler: """用户基本资料""" def post(self, *args, **kwargs): """更新""" u_id = self.token_data.get('userId') try: nickname = self.parse_body('nickname', '') company = self.parse_body('company', '') customer_type = self.parse_body('customerType', 0) ...
the_stack_v2_python_sparse
taotao/api/handlers/operateHandler.py
leolinf/tornado-demo
train
3
e69a253017953ed1d8f8f62ad2bb5d04f8c3b6e5
[ "if rest_filter is None:\n rest_filter = dict()\nrest_filter['genepanel_name', 'genepanel_version'] = [(gp.name, gp.version) for gp in user.group.genepanels]\nreturn self.list_query(session, annotationjob.AnnotationJob, schemas.AnnotationJobSchema(), rest_filter=rest_filter, order_by=annotationjob.AnnotationJob....
<|body_start_0|> if rest_filter is None: rest_filter = dict() rest_filter['genepanel_name', 'genepanel_version'] = [(gp.name, gp.version) for gp in user.group.genepanels] return self.list_query(session, annotationjob.AnnotationJob, schemas.AnnotationJobSchema(), rest_filter=rest_filt...
AnnotationJobList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnnotationJobList: def get(self, session, rest_filter=None, page=None, per_page=None, user=None): """Lists annotation jobs in the system. --- summary: List annotation jobs tags: - Import""" <|body_0|> def post(self, session, data=None, user=None): """Creates an annot...
stack_v2_sparse_classes_36k_train_022415
3,720
permissive
[ { "docstring": "Lists annotation jobs in the system. --- summary: List annotation jobs tags: - Import", "name": "get", "signature": "def get(self, session, rest_filter=None, page=None, per_page=None, user=None)" }, { "docstring": "Creates an annotation job in the system. --- summary: Create anno...
2
null
Implement the Python class `AnnotationJobList` described below. Class description: Implement the AnnotationJobList class. Method signatures and docstrings: - def get(self, session, rest_filter=None, page=None, per_page=None, user=None): Lists annotation jobs in the system. --- summary: List annotation jobs tags: - Im...
Implement the Python class `AnnotationJobList` described below. Class description: Implement the AnnotationJobList class. Method signatures and docstrings: - def get(self, session, rest_filter=None, page=None, per_page=None, user=None): Lists annotation jobs in the system. --- summary: List annotation jobs tags: - Im...
e38631d302611a143c9baaa684bcbd014d9734e4
<|skeleton|> class AnnotationJobList: def get(self, session, rest_filter=None, page=None, per_page=None, user=None): """Lists annotation jobs in the system. --- summary: List annotation jobs tags: - Import""" <|body_0|> def post(self, session, data=None, user=None): """Creates an annot...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnnotationJobList: def get(self, session, rest_filter=None, page=None, per_page=None, user=None): """Lists annotation jobs in the system. --- summary: List annotation jobs tags: - Import""" if rest_filter is None: rest_filter = dict() rest_filter['genepanel_name', 'genepane...
the_stack_v2_python_sparse
src/api/v1/resources/annotationjob.py
dabble-of-devops-consulting/ella
train
0
e58cd79f1d25175c204ec9244c29c2bf0ebdf6da
[ "self.index = index\nself.source_name = source_name\nself.file_extension = file_extension\nself.sourcetype = sourcetype\nself.host = host", "fields_str = None\nfor field_name, field_value in fields_dict.items():\n if fields_str is None:\n fields_str = ''\n elif fields_str is not None:\n fields...
<|body_start_0|> self.index = index self.source_name = source_name self.file_extension = file_extension self.sourcetype = sourcetype self.host = host <|end_body_0|> <|body_start_1|> fields_str = None for field_name, field_value in fields_dict.items(): ...
The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly).
StashNewWriter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StashNewWriter: """The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly).""" def __init__(self, index, source_name, file_extension='.stash_new', sourcetype=None, host=None): """Constructor...
stack_v2_sparse_classes_36k_train_022416
13,683
permissive
[ { "docstring": "Constructor for the stash writer,=. Arguments: index -- the index to send the events to source_name -- the search that is being used to generate the results file_extension -- the extension of the stash file (usually .stash_new) sourcetype -- the sourcetype to use for the event host -- the host t...
5
stack_v2_sparse_classes_30k_train_006502
Implement the Python class `StashNewWriter` described below. Class description: The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly). Method signatures and docstrings: - def __init__(self, index, source_name, file_extensi...
Implement the Python class `StashNewWriter` described below. Class description: The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly). Method signatures and docstrings: - def __init__(self, index, source_name, file_extensi...
9c1027f1b1a58d30973256412fb72a6fe6bf029c
<|skeleton|> class StashNewWriter: """The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly).""" def __init__(self, index, source_name, file_extension='.stash_new', sourcetype=None, host=None): """Constructor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StashNewWriter: """The Stash writer class provides a mechanism for writing out events that will be processed by Splunk as stash events (and summary indexed accordingly).""" def __init__(self, index, source_name, file_extension='.stash_new', sourcetype=None, host=None): """Constructor for the stas...
the_stack_v2_python_sparse
src/bin/network_tools_app/event_writer.py
LukeMurphey/splunk-network-tools
train
6
31f8d6cc31229840b78f926eafbc35ca467ac21e
[ "model = getattr(self, '_model', None)\nif model is None:\n raise RuntimeError('Model is not set. Please call set_model() first.')\nreturn model", "if not isinstance(model, nn.Module):\n raise TypeError('model must be an instance of nn.Module')\nself._model = model" ]
<|body_start_0|> model = getattr(self, '_model', None) if model is None: raise RuntimeError('Model is not set. Please call set_model() first.') return model <|end_body_0|> <|body_start_1|> if not isinstance(model, nn.Module): raise TypeError('model must be an ins...
Basic wrapper of generated model. Lightning modules used in NNI should inherit this class. It's a subclass of ``pytorch_lightning.LightningModule``. See https://pytorch-lightning.readthedocs.io/en/stable/common/lightning_module.html See :class:`SupervisedLearningModule` as an example.
LightningModule
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LightningModule: """Basic wrapper of generated model. Lightning modules used in NNI should inherit this class. It's a subclass of ``pytorch_lightning.LightningModule``. See https://pytorch-lightning.readthedocs.io/en/stable/common/lightning_module.html See :class:`SupervisedLearningModule` as an ...
stack_v2_sparse_classes_36k_train_022417
22,209
permissive
[ { "docstring": "The inner model (architecture) to train / evaluate. It will be only available after calling :meth:`set_model`.", "name": "model", "signature": "def model(self) -> nn.Module" }, { "docstring": "Set the inner model (architecture) to train / evaluate. As there is no explicit method ...
2
null
Implement the Python class `LightningModule` described below. Class description: Basic wrapper of generated model. Lightning modules used in NNI should inherit this class. It's a subclass of ``pytorch_lightning.LightningModule``. See https://pytorch-lightning.readthedocs.io/en/stable/common/lightning_module.html See :...
Implement the Python class `LightningModule` described below. Class description: Basic wrapper of generated model. Lightning modules used in NNI should inherit this class. It's a subclass of ``pytorch_lightning.LightningModule``. See https://pytorch-lightning.readthedocs.io/en/stable/common/lightning_module.html See :...
b84d25bec15ece54bf1703b1acb15d9f8919f656
<|skeleton|> class LightningModule: """Basic wrapper of generated model. Lightning modules used in NNI should inherit this class. It's a subclass of ``pytorch_lightning.LightningModule``. See https://pytorch-lightning.readthedocs.io/en/stable/common/lightning_module.html See :class:`SupervisedLearningModule` as an ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LightningModule: """Basic wrapper of generated model. Lightning modules used in NNI should inherit this class. It's a subclass of ``pytorch_lightning.LightningModule``. See https://pytorch-lightning.readthedocs.io/en/stable/common/lightning_module.html See :class:`SupervisedLearningModule` as an example.""" ...
the_stack_v2_python_sparse
nni/nas/evaluator/pytorch/lightning.py
Eurus-Holmes/nni
train
3
b99ef3f10853928c3655a3ac4350334d6f6eb16b
[ "self.CHC = Abstract_Channel_Creator\nself.em_gain = ccd_operation_mode['em_gain']\nself.binn = ccd_operation_mode['binn']\nself.t_exp = ccd_operation_mode['t_exp']\nself.image_size = ccd_operation_mode['image_size']\nself.ccd_gain = ccd_gain", "t_exp = self.t_exp\nem_gain = self.em_gain\nccd_gain = self.ccd_gain...
<|body_start_0|> self.CHC = Abstract_Channel_Creator self.em_gain = ccd_operation_mode['em_gain'] self.binn = ccd_operation_mode['binn'] self.t_exp = ccd_operation_mode['t_exp'] self.image_size = ccd_operation_mode['image_size'] self.ccd_gain = ccd_gain <|end_body_0|> <|...
Point Spread Function Class. This class creates the image of the star. The PSF of the object is based on a 2D gaussian distribution. Initially, the star flux is calculated using the library Flux_Calculation. Over this flux, the contribution of the atmosphere, the telescope, and the SPARC4 are considered as a function o...
Point_Spread_Function
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Point_Spread_Function: """Point Spread Function Class. This class creates the image of the star. The PSF of the object is based on a 2D gaussian distribution. Initially, the star flux is calculated using the library Flux_Calculation. Over this flux, the contribution of the atmosphere, the telesco...
stack_v2_sparse_classes_36k_train_022418
3,709
permissive
[ { "docstring": "Initialize the class.", "name": "__init__", "signature": "def __init__(self, Abstract_Channel_Creator, ccd_operation_mode, ccd_gain)" }, { "docstring": "Create the star point spread function. Parameters ---------- star_coordinates: tuple XY star coordinates in the image. gaussian...
2
stack_v2_sparse_classes_30k_train_011865
Implement the Python class `Point_Spread_Function` described below. Class description: Point Spread Function Class. This class creates the image of the star. The PSF of the object is based on a 2D gaussian distribution. Initially, the star flux is calculated using the library Flux_Calculation. Over this flux, the cont...
Implement the Python class `Point_Spread_Function` described below. Class description: Point Spread Function Class. This class creates the image of the star. The PSF of the object is based on a 2D gaussian distribution. Initially, the star flux is calculated using the library Flux_Calculation. Over this flux, the cont...
6f75bbfd52a7b6684ad04002f9818b4d8e7d2c96
<|skeleton|> class Point_Spread_Function: """Point Spread Function Class. This class creates the image of the star. The PSF of the object is based on a 2D gaussian distribution. Initially, the star flux is calculated using the library Flux_Calculation. Over this flux, the contribution of the atmosphere, the telesco...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Point_Spread_Function: """Point Spread Function Class. This class creates the image of the star. The PSF of the object is based on a 2D gaussian distribution. Initially, the star flux is calculated using the library Flux_Calculation. Over this flux, the contribution of the atmosphere, the telescope, and the S...
the_stack_v2_python_sparse
AIS/Point_Spread_Function/point_spread_function.py
juliotux/AIS
train
0
a7f2cfc2a00feec3a4656898afc46df083090709
[ "self.clerk = clerk\nself.name = atr\nself.fkey = fkey\nself.linksetAttr = linksetAttr", "if name == self.name:\n box.removeInjector(self.inject)\n box.removeObserver(self.inject)\n childType = self.linksetAttr.type\n backName = self.linksetAttr.back\n theLinkSet = getattr(box.private, name)\n i...
<|body_start_0|> self.clerk = clerk self.name = atr self.fkey = fkey self.linksetAttr = linksetAttr <|end_body_0|> <|body_start_1|> if name == self.name: box.removeInjector(self.inject) box.removeObserver(self.inject) childType = self.linksetA...
LinkSetInjector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkSetInjector: def __init__(self, atr, clerk, linksetAttr, fkey): """atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the foreign key that points back to the parent""" <|body_0|> def inject(self, box, name, value=U...
stack_v2_sparse_classes_36k_train_022419
20,272
no_license
[ { "docstring": "atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the foreign key that points back to the parent", "name": "__init__", "signature": "def __init__(self, atr, clerk, linksetAttr, fkey)" }, { "docstring": "box: the Strongbox ...
2
stack_v2_sparse_classes_30k_train_006896
Implement the Python class `LinkSetInjector` described below. Class description: Implement the LinkSetInjector class. Method signatures and docstrings: - def __init__(self, atr, clerk, linksetAttr, fkey): atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the f...
Implement the Python class `LinkSetInjector` described below. Class description: Implement the LinkSetInjector class. Method signatures and docstrings: - def __init__(self, atr, clerk, linksetAttr, fkey): atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the f...
1ea55a754a7568b8df2bab297a8036c0b3a671e0
<|skeleton|> class LinkSetInjector: def __init__(self, atr, clerk, linksetAttr, fkey): """atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the foreign key that points back to the parent""" <|body_0|> def inject(self, box, name, value=U...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkSetInjector: def __init__(self, atr, clerk, linksetAttr, fkey): """atr: the attribute name for the linkset clerk: a clerk fclass: the type of the linkset fkey: column name of the foreign key that points back to the parent""" self.clerk = clerk self.name = atr self.fkey = fk...
the_stack_v2_python_sparse
code/clerks.py
tangentstorm/workshop
train
0
6c952ce6ef498b3213542d60cb26c72a2df90e6d
[ "self.x = x\nself.fs = fs\nself.N = len(self.x)\nself.K = K", "X = np.zeros(self.N, dtype=np.complex)\nE = np.zeros(self.N)\nX_K = np.zeros(self.K, dtype=np.complex)\nindex = np.zeros(self.K)\nfor k in range(self.N):\n for n in range(self.N):\n X[k] = X[k] + 1 / np.sqrt(self.N) * self.x[n] * np.exp(-1j ...
<|body_start_0|> self.x = x self.fs = fs self.N = len(self.x) self.K = K <|end_body_0|> <|body_start_1|> X = np.zeros(self.N, dtype=np.complex) E = np.zeros(self.N) X_K = np.zeros(self.K, dtype=np.complex) index = np.zeros(self.K) for k in range(s...
idft Inverse Discrete Fourier transform.
dft_K_q16
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dft_K_q16: """idft Inverse Discrete Fourier transform.""" def __init__(self, x, fs, K): """:param X: Input DFT X :param fs: Input integer fs contains the sample frequency :param K: Input positive integer that determines the number of coeffients used to calculate the iDFT.""" ...
stack_v2_sparse_classes_36k_train_022420
25,417
no_license
[ { "docstring": ":param X: Input DFT X :param fs: Input integer fs contains the sample frequency :param K: Input positive integer that determines the number of coeffients used to calculate the iDFT.", "name": "__init__", "signature": "def __init__(self, x, fs, K)" }, { "docstring": "\\\\\\\\\\\\ ...
2
stack_v2_sparse_classes_30k_train_016995
Implement the Python class `dft_K_q16` described below. Class description: idft Inverse Discrete Fourier transform. Method signatures and docstrings: - def __init__(self, x, fs, K): :param X: Input DFT X :param fs: Input integer fs contains the sample frequency :param K: Input positive integer that determines the num...
Implement the Python class `dft_K_q16` described below. Class description: idft Inverse Discrete Fourier transform. Method signatures and docstrings: - def __init__(self, x, fs, K): :param X: Input DFT X :param fs: Input integer fs contains the sample frequency :param K: Input positive integer that determines the num...
b72322cfc6d81c996117cea2160ee312da62d3ed
<|skeleton|> class dft_K_q16: """idft Inverse Discrete Fourier transform.""" def __init__(self, x, fs, K): """:param X: Input DFT X :param fs: Input integer fs contains the sample frequency :param K: Input positive integer that determines the number of coeffients used to calculate the iDFT.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class dft_K_q16: """idft Inverse Discrete Fourier transform.""" def __init__(self, x, fs, K): """:param X: Input DFT X :param fs: Input integer fs contains the sample frequency :param K: Input positive integer that determines the number of coeffients used to calculate the iDFT.""" self.x = x ...
the_stack_v2_python_sparse
Inverse Discrete Fourier Transform/iDFT_main.py
FG-14/Signals-and-Information-Processing-DSP-
train
0
db6c850e25ed5f3dbe5e6da7f7a36fc517ab6936
[ "self.left = left\nself.right = right\nself.data = data", "if self.data is None:\n self.data = val\n return\nif val <= self.data:\n if self.left is None:\n self.left = BinaryTreeNode(data=val)\n else:\n self.left.insert(val)\nelif self.right is None:\n self.right = BinaryTreeNode(data...
<|body_start_0|> self.left = left self.right = right self.data = data <|end_body_0|> <|body_start_1|> if self.data is None: self.data = val return if val <= self.data: if self.left is None: self.left = BinaryTreeNode(data=val) ...
A class representation of binary tree node
BinaryTreeNode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTreeNode: """A class representation of binary tree node""" def __init__(self, left=None, right=None, data=None): """Initializes a binary tree""" <|body_0|> def insert(self, val): """Inserts a value (data in Node object) in order""" <|body_1|> d...
stack_v2_sparse_classes_36k_train_022421
2,378
no_license
[ { "docstring": "Initializes a binary tree", "name": "__init__", "signature": "def __init__(self, left=None, right=None, data=None)" }, { "docstring": "Inserts a value (data in Node object) in order", "name": "insert", "signature": "def insert(self, val)" }, { "docstring": "Checks...
6
stack_v2_sparse_classes_30k_train_001612
Implement the Python class `BinaryTreeNode` described below. Class description: A class representation of binary tree node Method signatures and docstrings: - def __init__(self, left=None, right=None, data=None): Initializes a binary tree - def insert(self, val): Inserts a value (data in Node object) in order - def c...
Implement the Python class `BinaryTreeNode` described below. Class description: A class representation of binary tree node Method signatures and docstrings: - def __init__(self, left=None, right=None, data=None): Initializes a binary tree - def insert(self, val): Inserts a value (data in Node object) in order - def c...
0e8b528207faa44977f5b9d446d45d13c4fb430d
<|skeleton|> class BinaryTreeNode: """A class representation of binary tree node""" def __init__(self, left=None, right=None, data=None): """Initializes a binary tree""" <|body_0|> def insert(self, val): """Inserts a value (data in Node object) in order""" <|body_1|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryTreeNode: """A class representation of binary tree node""" def __init__(self, left=None, right=None, data=None): """Initializes a binary tree""" self.left = left self.right = right self.data = data def insert(self, val): """Inserts a value (data in Node ...
the_stack_v2_python_sparse
data_structures/tree/binary_tree_node.py
marcus-grant/python-cs
train
0
a07b79b600b6f5af6a7b3d446c8dcc03234771a0
[ "if not prices:\n return 0\nmaxValue = 0\nfor i in range(1, len(prices)):\n num = prices[-i]\n validScope = prices[:len(prices) - i]\n if num - min(validScope) > 0:\n maxValue = max(maxValue, num - min(validScope))\nreturn maxValue", "if not prices or len(prices) == 1:\n return 0\ndif_list =...
<|body_start_0|> if not prices: return 0 maxValue = 0 for i in range(1, len(prices)): num = prices[-i] validScope = prices[:len(prices) - i] if num - min(validScope) > 0: maxValue = max(maxValue, num - min(validScope)) retur...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit_TLE(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices): """transfer the question to max subarray :type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022422
1,028
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit_TLE", "signature": "def maxProfit_TLE(self, prices)" }, { "docstring": "transfer the question to max subarray :type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }...
2
stack_v2_sparse_classes_30k_train_021460
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit_TLE(self, prices): :type prices: List[int] :rtype: int - def maxProfit(self, prices): transfer the question to max subarray :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit_TLE(self, prices): :type prices: List[int] :rtype: int - def maxProfit(self, prices): transfer the question to max subarray :type prices: List[int] :rtype: int <|s...
5436c2e67a80a58021eab309704e3fc2ba9755b5
<|skeleton|> class Solution: def maxProfit_TLE(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit(self, prices): """transfer the question to max subarray :type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit_TLE(self, prices): """:type prices: List[int] :rtype: int""" if not prices: return 0 maxValue = 0 for i in range(1, len(prices)): num = prices[-i] validScope = prices[:len(prices) - i] if num - min(validSco...
the_stack_v2_python_sparse
121. Best Time to Buy and Sell Stock.py
sheldonzhao/LeetCodeFighting
train
0
edea30083027e1b0df41cf9d3ffffe637b3b5c65
[ "QObject.__init__(self, ui)\nself.__ui = ui\nself.__action = None\nself.__translator = None\nself.__loadTranslator()\nself.__initAction()", "e5App().getObject('ToolbarManager').addAction(self.__action, 'Tools')\nmenu = self.__ui.getMenu('extras')\nmenu.addAction(self.__action)\nreturn (None, True)", "e5App().ge...
<|body_start_0|> QObject.__init__(self, ui) self.__ui = ui self.__action = None self.__translator = None self.__loadTranslator() self.__initAction() <|end_body_0|> <|body_start_1|> e5App().getObject('ToolbarManager').addAction(self.__action, 'Tools') menu...
Class implementing the virtualenv wizard plug-in.
WizardVirtualenvPlugin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WizardVirtualenvPlugin: """Class implementing the virtualenv wizard plug-in.""" def __init__(self, ui): """Constructor @param ui reference to the user interface object (UI.UserInterface)""" <|body_0|> def activate(self): """Public method to activate this plug-in....
stack_v2_sparse_classes_36k_train_022423
4,443
no_license
[ { "docstring": "Constructor @param ui reference to the user interface object (UI.UserInterface)", "name": "__init__", "signature": "def __init__(self, ui)" }, { "docstring": "Public method to activate this plug-in. @return tuple of None and activation status (boolean)", "name": "activate", ...
6
null
Implement the Python class `WizardVirtualenvPlugin` described below. Class description: Class implementing the virtualenv wizard plug-in. Method signatures and docstrings: - def __init__(self, ui): Constructor @param ui reference to the user interface object (UI.UserInterface) - def activate(self): Public method to a...
Implement the Python class `WizardVirtualenvPlugin` described below. Class description: Class implementing the virtualenv wizard plug-in. Method signatures and docstrings: - def __init__(self, ui): Constructor @param ui reference to the user interface object (UI.UserInterface) - def activate(self): Public method to a...
3df0c805225a8d4f2709565d7eda4e07a050c986
<|skeleton|> class WizardVirtualenvPlugin: """Class implementing the virtualenv wizard plug-in.""" def __init__(self, ui): """Constructor @param ui reference to the user interface object (UI.UserInterface)""" <|body_0|> def activate(self): """Public method to activate this plug-in....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WizardVirtualenvPlugin: """Class implementing the virtualenv wizard plug-in.""" def __init__(self, ui): """Constructor @param ui reference to the user interface object (UI.UserInterface)""" QObject.__init__(self, ui) self.__ui = ui self.__action = None self.__trans...
the_stack_v2_python_sparse
eric6/.eric6/eric6plugins/PluginWizardVirtualenv.py
metamarcdw/.dotfiles
train
0
1a1419043d1ebd510aa252d4ce92c044319aa886
[ "if self.mode in (EFFECT_AUTO, EFFECT_EXPERT):\n if self.style in ('FOLLOW_VIDEO', 'FOLLOW_AUDIO'):\n return powerstate in ('On', None)\n if self.style == 'OFF':\n return False\n return True\nif self.mode == EFFECT_MODE:\n if self.style == 'internal':\n return powerstate in ('On', N...
<|body_start_0|> if self.mode in (EFFECT_AUTO, EFFECT_EXPERT): if self.style in ('FOLLOW_VIDEO', 'FOLLOW_AUDIO'): return powerstate in ('On', None) if self.style == 'OFF': return False return True if self.mode == EFFECT_MODE: ...
Data class describing the ambilight effect.
AmbilightEffect
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AmbilightEffect: """Data class describing the ambilight effect.""" def is_on(self, powerstate) -> bool: """Check whether the ambilight is considered on.""" <|body_0|> def is_valid(self) -> bool: """Validate the effect configuration.""" <|body_1|> def...
stack_v2_sparse_classes_36k_train_022424
13,195
permissive
[ { "docstring": "Check whether the ambilight is considered on.", "name": "is_on", "signature": "def is_on(self, powerstate) -> bool" }, { "docstring": "Validate the effect configuration.", "name": "is_valid", "signature": "def is_valid(self) -> bool" }, { "docstring": "Create Ambi...
4
null
Implement the Python class `AmbilightEffect` described below. Class description: Data class describing the ambilight effect. Method signatures and docstrings: - def is_on(self, powerstate) -> bool: Check whether the ambilight is considered on. - def is_valid(self) -> bool: Validate the effect configuration. - def fro...
Implement the Python class `AmbilightEffect` described below. Class description: Data class describing the ambilight effect. Method signatures and docstrings: - def is_on(self, powerstate) -> bool: Check whether the ambilight is considered on. - def is_valid(self) -> bool: Validate the effect configuration. - def fro...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AmbilightEffect: """Data class describing the ambilight effect.""" def is_on(self, powerstate) -> bool: """Check whether the ambilight is considered on.""" <|body_0|> def is_valid(self) -> bool: """Validate the effect configuration.""" <|body_1|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AmbilightEffect: """Data class describing the ambilight effect.""" def is_on(self, powerstate) -> bool: """Check whether the ambilight is considered on.""" if self.mode in (EFFECT_AUTO, EFFECT_EXPERT): if self.style in ('FOLLOW_VIDEO', 'FOLLOW_AUDIO'): return p...
the_stack_v2_python_sparse
homeassistant/components/philips_js/light.py
home-assistant/core
train
35,501
b1b1579a8d77c0e7385b02f61a623292f6ebc4ef
[ "n = len(s)\nvisited, res = (set(), set())\nfor i in range(n - 9):\n tmp = s[i:i + 10]\n if tmp in visited:\n res.add(tmp)\n visited.add(tmp)\nreturn list(res)", "L, n = (10, len(s))\nif n <= L:\n return []\ndic = {'A': 0, 'C': 1, 'G': 2, 'T': 3}\nnums = [dic[s[i]] for i in range(n)]\nvisited, ...
<|body_start_0|> n = len(s) visited, res = (set(), set()) for i in range(n - 9): tmp = s[i:i + 10] if tmp in visited: res.add(tmp) visited.add(tmp) return list(res) <|end_body_0|> <|body_start_1|> L, n = (10, len(s)) if...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findRepeatedDnaSequences1(self, s: str) -> List[str]: """思路:hash @param s: @return:""" <|body_0|> def findRepeatedDnaSequences2(self, s: str) -> List[str]: """思路:Rabin-Karp @param s: @return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022425
2,391
no_license
[ { "docstring": "思路:hash @param s: @return:", "name": "findRepeatedDnaSequences1", "signature": "def findRepeatedDnaSequences1(self, s: str) -> List[str]" }, { "docstring": "思路:Rabin-Karp @param s: @return:", "name": "findRepeatedDnaSequences2", "signature": "def findRepeatedDnaSequences2...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRepeatedDnaSequences1(self, s: str) -> List[str]: 思路:hash @param s: @return: - def findRepeatedDnaSequences2(self, s: str) -> List[str]: 思路:Rabin-Karp @param s: @return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRepeatedDnaSequences1(self, s: str) -> List[str]: 思路:hash @param s: @return: - def findRepeatedDnaSequences2(self, s: str) -> List[str]: 思路:Rabin-Karp @param s: @return: ...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def findRepeatedDnaSequences1(self, s: str) -> List[str]: """思路:hash @param s: @return:""" <|body_0|> def findRepeatedDnaSequences2(self, s: str) -> List[str]: """思路:Rabin-Karp @param s: @return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findRepeatedDnaSequences1(self, s: str) -> List[str]: """思路:hash @param s: @return:""" n = len(s) visited, res = (set(), set()) for i in range(n - 9): tmp = s[i:i + 10] if tmp in visited: res.add(tmp) visited.add...
the_stack_v2_python_sparse
LeetCode/字符串/Rabin-Karp/187. 重复的DNA序列.py
yiming1012/MyLeetCode
train
2
558d56f7b12cc69848044feba82b7a4fb63f1586
[ "self.attrs = {'history': '2018-12-10Z: StaGE Decoupler', 'title': 'Temperature on UK 2 km Standard Grid', 'source': 'Met Office Unified Model'}\nself.cube = set_up_variable_cube(np.ones((3, 11, 11), dtype=np.float32), spatial_grid='equalarea', standard_grid_metadata='uk_det', attributes=self.attrs)\nself.cube_1d =...
<|body_start_0|> self.attrs = {'history': '2018-12-10Z: StaGE Decoupler', 'title': 'Temperature on UK 2 km Standard Grid', 'source': 'Met Office Unified Model'} self.cube = set_up_variable_cube(np.ones((3, 11, 11), dtype=np.float32), spatial_grid='equalarea', standard_grid_metadata='uk_det', attributes=...
Tests for the remove_cube_halo function
Test_remove_cube_halo
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_remove_cube_halo: """Tests for the remove_cube_halo function""" def setUp(self): """Set up a realistic input cube with lots of metadata. Input cube grid is 1000x1000 km with points spaced 100 km apart.""" <|body_0|> def test_basic(self): """Test function ret...
stack_v2_sparse_classes_36k_train_022426
25,212
permissive
[ { "docstring": "Set up a realistic input cube with lots of metadata. Input cube grid is 1000x1000 km with points spaced 100 km apart.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test function returns a cube with expected attributes and shape", "name": "test_basic", ...
3
null
Implement the Python class `Test_remove_cube_halo` described below. Class description: Tests for the remove_cube_halo function Method signatures and docstrings: - def setUp(self): Set up a realistic input cube with lots of metadata. Input cube grid is 1000x1000 km with points spaced 100 km apart. - def test_basic(sel...
Implement the Python class `Test_remove_cube_halo` described below. Class description: Tests for the remove_cube_halo function Method signatures and docstrings: - def setUp(self): Set up a realistic input cube with lots of metadata. Input cube grid is 1000x1000 km with points spaced 100 km apart. - def test_basic(sel...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_remove_cube_halo: """Tests for the remove_cube_halo function""" def setUp(self): """Set up a realistic input cube with lots of metadata. Input cube grid is 1000x1000 km with points spaced 100 km apart.""" <|body_0|> def test_basic(self): """Test function ret...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_remove_cube_halo: """Tests for the remove_cube_halo function""" def setUp(self): """Set up a realistic input cube with lots of metadata. Input cube grid is 1000x1000 km with points spaced 100 km apart.""" self.attrs = {'history': '2018-12-10Z: StaGE Decoupler', 'title': 'Temperature ...
the_stack_v2_python_sparse
improver_tests/utilities/test_pad_spatial.py
metoppv/improver
train
101
668caf3beee50d8e05323253dd442794bc8ac9e5
[ "url = '/api/itsystems/'\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 200)\nself.assertNotContains(response, self.it2.name)\nself.assertNotContains(response, self.it_dec.name)", "url = '/api/itsystems/?all'\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 200)\n...
<|body_start_0|> url = '/api/itsystems/' response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertNotContains(response, self.it2.name) self.assertNotContains(response, self.it_dec.name) <|end_body_0|> <|body_start_1|> url = '/api/itsystems/?...
ITSystemResourceTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ITSystemResourceTestCase: def test_list(self): """Test the ITSystemResource list response""" <|body_0|> def test_list_all(self): """Test the ITSystemResource list response with all param""" <|body_1|> def test_list_filter(self): """Test the ITSys...
stack_v2_sparse_classes_36k_train_022427
2,926
permissive
[ { "docstring": "Test the ITSystemResource list response", "name": "test_list", "signature": "def test_list(self)" }, { "docstring": "Test the ITSystemResource list response with all param", "name": "test_list_all", "signature": "def test_list_all(self)" }, { "docstring": "Test th...
3
null
Implement the Python class `ITSystemResourceTestCase` described below. Class description: Implement the ITSystemResourceTestCase class. Method signatures and docstrings: - def test_list(self): Test the ITSystemResource list response - def test_list_all(self): Test the ITSystemResource list response with all param - d...
Implement the Python class `ITSystemResourceTestCase` described below. Class description: Implement the ITSystemResourceTestCase class. Method signatures and docstrings: - def test_list(self): Test the ITSystemResource list response - def test_list_all(self): Test the ITSystemResource list response with all param - d...
4d5caceba69cac7f59b63745a0f52322004df2eb
<|skeleton|> class ITSystemResourceTestCase: def test_list(self): """Test the ITSystemResource list response""" <|body_0|> def test_list_all(self): """Test the ITSystemResource list response with all param""" <|body_1|> def test_list_filter(self): """Test the ITSys...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ITSystemResourceTestCase: def test_list(self): """Test the ITSystemResource list response""" url = '/api/itsystems/' response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertNotContains(response, self.it2.name) self.assertNotContain...
the_stack_v2_python_sparse
registers/test_api.py
bryceprince0/it-assets
train
0
3940690f65fb79bd3277b1d959e6c57abed7ff3e
[ "deq = collections.deque()\nif root is None:\n return ''\nelse:\n deq.appendleft(root)\n s = ''\n while deq:\n curoot = deq.popleft()\n s = s + '*' + str(curoot.val)\n if curoot.left:\n deq.append(curoot.left)\n if curoot.right:\n deq.append(curoot.right...
<|body_start_0|> deq = collections.deque() if root is None: return '' else: deq.appendleft(root) s = '' while deq: curoot = deq.popleft() s = s + '*' + str(curoot.val) if curoot.left: ...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> deq = collecti...
stack_v2_sparse_classes_36k_train_022428
1,832
permissive
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_012425
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
f828642d01a708515fbc0b6fc38d01251db36dd3
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" deq = collections.deque() if root is None: return '' else: deq.appendleft(root) s = '' while deq: curoot = deq.popleft() ...
the_stack_v2_python_sparse
Medium/Serialize and Deserialize BST.py
KoushikDeb007/LeetCode
train
0
c5fbdbd6432380ce8f71c5e2cd5716f6a17a6263
[ "super(Up, self).__init__()\nself.in_ch = in_ch\nself.out_ch = out_ch\nself.up = nn.ConvTranspose2d(in_ch, in_ch // 2, 2, stride=2)\nself.conv = DoubleConv(in_ch, out_ch)", "x1 = self.up(x1)\ndiff_y = x2.size()[2] - x1.size()[2]\ndiff_x = x2.size()[3] - x1.size()[3]\nx1 = F.pad(x1, (diff_x // 2, diff_x - diff_x /...
<|body_start_0|> super(Up, self).__init__() self.in_ch = in_ch self.out_ch = out_ch self.up = nn.ConvTranspose2d(in_ch, in_ch // 2, 2, stride=2) self.conv = DoubleConv(in_ch, out_ch) <|end_body_0|> <|body_start_1|> x1 = self.up(x1) diff_y = x2.size()[2] - x1.size...
UNet upscaling.
Up
[ "LicenseRef-scancode-protobuf", "MPL-2.0", "MIT", "BSD-3-Clause", "Apache-2.0", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Up: """UNet upscaling.""" def __init__(self, in_ch, out_ch): """Initialize. Args: in_ch: number of input channels out_ch: number of output channels""" <|body_0|> def forward(self, x1, x2): """Run forward.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022429
2,875
permissive
[ { "docstring": "Initialize. Args: in_ch: number of input channels out_ch: number of output channels", "name": "__init__", "signature": "def __init__(self, in_ch, out_ch)" }, { "docstring": "Run forward.", "name": "forward", "signature": "def forward(self, x1, x2)" } ]
2
null
Implement the Python class `Up` described below. Class description: UNet upscaling. Method signatures and docstrings: - def __init__(self, in_ch, out_ch): Initialize. Args: in_ch: number of input channels out_ch: number of output channels - def forward(self, x1, x2): Run forward.
Implement the Python class `Up` described below. Class description: UNet upscaling. Method signatures and docstrings: - def __init__(self, in_ch, out_ch): Initialize. Args: in_ch: number of input channels out_ch: number of output channels - def forward(self, x1, x2): Run forward. <|skeleton|> class Up: """UNet u...
bd73b749a9ea1b92dbcdd07e639752101d769fc0
<|skeleton|> class Up: """UNet upscaling.""" def __init__(self, in_ch, out_ch): """Initialize. Args: in_ch: number of input channels out_ch: number of output channels""" <|body_0|> def forward(self, x1, x2): """Run forward.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Up: """UNet upscaling.""" def __init__(self, in_ch, out_ch): """Initialize. Args: in_ch: number of input channels out_ch: number of output channels""" super(Up, self).__init__() self.in_ch = in_ch self.out_ch = out_ch self.up = nn.ConvTranspose2d(in_ch, in_ch // 2,...
the_stack_v2_python_sparse
openfl-workspace/torch_unet_kvasir/src/pt_unet_parts.py
PDuckworth/openfl
train
0
70aea394f0fb3011e15cedd38e33307cf82c6e89
[ "dico = {'dir': directory}\nmagic.log.info(_(u'create remote directory %(dir)s...') % dico)\ncmd = 'mkdir -p %(dir)s' % dico\nres = self._exec_command(cmd)\ncmd = 'chmod 0700 %(dir)s' % dico\nres = self._exec_command(cmd)\nmagic.log.info(_(u'returns %s'), res[0])\nreturn res", "cmd = 'rm -rf %s' % self.proxy_dir\...
<|body_start_0|> dico = {'dir': directory} magic.log.info(_(u'create remote directory %(dir)s...') % dico) cmd = 'mkdir -p %(dir)s' % dico res = self._exec_command(cmd) cmd = 'chmod 0700 %(dir)s' % dico res = self._exec_command(cmd) magic.log.info(_(u'returns %s')...
Definition of a RCP server.
RCPServer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RCPServer: """Definition of a RCP server.""" def _create_dir(self, directory): """Create a directory on the server.""" <|body_0|> def delete_proxy_dir(self): """Erase the proxy_dir directory on the server.""" <|body_1|> def _copyoneto(self, src, conv...
stack_v2_sparse_classes_36k_train_022430
4,960
no_license
[ { "docstring": "Create a directory on the server.", "name": "_create_dir", "signature": "def _create_dir(self, directory)" }, { "docstring": "Erase the proxy_dir directory on the server.", "name": "delete_proxy_dir", "signature": "def delete_proxy_dir(self)" }, { "docstring": "Co...
4
null
Implement the Python class `RCPServer` described below. Class description: Definition of a RCP server. Method signatures and docstrings: - def _create_dir(self, directory): Create a directory on the server. - def delete_proxy_dir(self): Erase the proxy_dir directory on the server. - def _copyoneto(self, src, convert=...
Implement the Python class `RCPServer` described below. Class description: Definition of a RCP server. Method signatures and docstrings: - def _create_dir(self, directory): Create a directory on the server. - def delete_proxy_dir(self): Erase the proxy_dir directory on the server. - def _copyoneto(self, src, convert=...
62592c0f17be823caad8ea71cd52841acbab6185
<|skeleton|> class RCPServer: """Definition of a RCP server.""" def _create_dir(self, directory): """Create a directory on the server.""" <|body_0|> def delete_proxy_dir(self): """Erase the proxy_dir directory on the server.""" <|body_1|> def _copyoneto(self, src, conv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RCPServer: """Definition of a RCP server.""" def _create_dir(self, directory): """Create a directory on the server.""" dico = {'dir': directory} magic.log.info(_(u'create remote directory %(dir)s...') % dico) cmd = 'mkdir -p %(dir)s' % dico res = self._exec_command...
the_stack_v2_python_sparse
asrun/plugins/rsh_server.py
zhanxiangqian/salome
train
1
0a62250b1f1415545f2e037195970fd73d8e591a
[ "iri = annotation.get('id')\nif not iri:\n abort(400, 'Invalid Annotation passed in request')\nreturn unquote(iri).rstrip('/').split('/')[-1]", "if not request.data:\n abort(400)\njson_data = json.loads(request.data.decode('utf8'))\nif type(json_data) != list:\n abort(400)\nannotation_ids = [self._get_ba...
<|body_start_0|> iri = annotation.get('id') if not iri: abort(400, 'Invalid Annotation passed in request') return unquote(iri).rstrip('/').split('/')[-1] <|end_body_0|> <|body_start_1|> if not request.data: abort(400) json_data = json.loads(request.data.d...
Batch API class.
BatchAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchAPI: """Batch API class.""" def _get_base_id(self, annotation): """Return the base ID extracted from the full IRI.""" <|body_0|> def delete(self): """Batch delete items.""" <|body_1|> <|end_skeleton|> <|body_start_0|> iri = annotation.get('...
stack_v2_sparse_classes_36k_train_022431
1,384
permissive
[ { "docstring": "Return the base ID extracted from the full IRI.", "name": "_get_base_id", "signature": "def _get_base_id(self, annotation)" }, { "docstring": "Batch delete items.", "name": "delete", "signature": "def delete(self)" } ]
2
stack_v2_sparse_classes_30k_train_017687
Implement the Python class `BatchAPI` described below. Class description: Batch API class. Method signatures and docstrings: - def _get_base_id(self, annotation): Return the base ID extracted from the full IRI. - def delete(self): Batch delete items.
Implement the Python class `BatchAPI` described below. Class description: Batch API class. Method signatures and docstrings: - def _get_base_id(self, annotation): Return the base ID extracted from the full IRI. - def delete(self): Batch delete items. <|skeleton|> class BatchAPI: """Batch API class.""" def _...
bc504498ef330fab46f2334f96631457d520ec90
<|skeleton|> class BatchAPI: """Batch API class.""" def _get_base_id(self, annotation): """Return the base ID extracted from the full IRI.""" <|body_0|> def delete(self): """Batch delete items.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatchAPI: """Batch API class.""" def _get_base_id(self, annotation): """Return the base ID extracted from the full IRI.""" iri = annotation.get('id') if not iri: abort(400, 'Invalid Annotation passed in request') return unquote(iri).rstrip('/').split('/')[-1] ...
the_stack_v2_python_sparse
explicates/api/batch.py
alexandermendes/explicates
train
8
3ff36a6b3da7b14c44d0deebb97a1cfbc57cbceb
[ "self.title = title\nself.fail_jobs = fail_jobs\nself.job_display = 'none'\nself.fail_job_content = ''\nself.env_content = ''\nself.alarm_info = ''\nself.log_path = log_path\nself.__construct_mail_env(env)\nself.__construct_alarm_info(results)\nself.__construct_fail_job(fail_jobs)", "if isinstance(env, dict):\n ...
<|body_start_0|> self.title = title self.fail_jobs = fail_jobs self.job_display = 'none' self.fail_job_content = '' self.env_content = '' self.alarm_info = '' self.log_path = log_path self.__construct_mail_env(env) self.__construct_alarm_info(resul...
construct email for benchmark result.
EmailTemplate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailTemplate: """construct email for benchmark result.""" def __init__(self, title, env, results, log_path, fail_jobs=[]): """Args: title(str): benchmark | op_benchmark | benchmark_distribute env(dict): running environment. results(dict): {"Speed": {"header": [table_header0, table_h...
stack_v2_sparse_classes_36k_train_022432
5,907
no_license
[ { "docstring": "Args: title(str): benchmark | op_benchmark | benchmark_distribute env(dict): running environment. results(dict): {\"Speed\": {\"header\": [table_header0, table_header1, table_header2,] \"data\": [[{'value':, 'color':, }, {'value':, 'color':, }, {'value':, 'color':, }] ...]} \"Mem\": {\"header\":...
5
stack_v2_sparse_classes_30k_train_019823
Implement the Python class `EmailTemplate` described below. Class description: construct email for benchmark result. Method signatures and docstrings: - def __init__(self, title, env, results, log_path, fail_jobs=[]): Args: title(str): benchmark | op_benchmark | benchmark_distribute env(dict): running environment. re...
Implement the Python class `EmailTemplate` described below. Class description: construct email for benchmark result. Method signatures and docstrings: - def __init__(self, title, env, results, log_path, fail_jobs=[]): Args: title(str): benchmark | op_benchmark | benchmark_distribute env(dict): running environment. re...
f0e0a303e9af29abb2e86e8918c102b152a37883
<|skeleton|> class EmailTemplate: """construct email for benchmark result.""" def __init__(self, title, env, results, log_path, fail_jobs=[]): """Args: title(str): benchmark | op_benchmark | benchmark_distribute env(dict): running environment. results(dict): {"Speed": {"header": [table_header0, table_h...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailTemplate: """construct email for benchmark result.""" def __init__(self, title, env, results, log_path, fail_jobs=[]): """Args: title(str): benchmark | op_benchmark | benchmark_distribute env(dict): running environment. results(dict): {"Speed": {"header": [table_header0, table_header1, table...
the_stack_v2_python_sparse
scripts/template.py
PaddlePaddle/benchmark
train
78
27a9995676b055c0fdbef5c2fb8df0007d6e5e67
[ "super().__init__()\nassert len(rnns) == len(convrelus)\nself.blocks = len(rnns)\nfor index, (rnn, convrelu) in enumerate(zip(rnns, convrelus), 1):\n setattr(self, 'rnn' + str(index), rnn)\n setattr(self, 'convrelu' + str(index), convrelu)", "T = inputs.size(1)\nhidden_states = []\nif len(initial_state) == ...
<|body_start_0|> super().__init__() assert len(rnns) == len(convrelus) self.blocks = len(rnns) for index, (rnn, convrelu) in enumerate(zip(rnns, convrelus), 1): setattr(self, 'rnn' + str(index), rnn) setattr(self, 'convrelu' + str(index), convrelu) <|end_body_0|> ...
encoding a certain length of sequence The Encoder network consists of multiple pairs of (ConvRelu, CLSTM) cells. The input will first go through a convrelu cell, and then to a convlstm cell, and then to another convrelu cell, so on and so forth.
Encoder_pro
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder_pro: """encoding a certain length of sequence The Encoder network consists of multiple pairs of (ConvRelu, CLSTM) cells. The input will first go through a convrelu cell, and then to a convlstm cell, and then to another convrelu cell, so on and so forth.""" def __init__(self, rnns, co...
stack_v2_sparse_classes_36k_train_022433
41,120
no_license
[ { "docstring": "rnns are a list of convlstm cells, convrelus are a list of convrelu cells", "name": "__init__", "signature": "def __init__(self, rnns, convrelus)" }, { "docstring": "forward pass of the encoder :param inputs: a tensor of shape (B, S, C, H, W) :param initial_state: Either a list c...
2
stack_v2_sparse_classes_30k_train_004234
Implement the Python class `Encoder_pro` described below. Class description: encoding a certain length of sequence The Encoder network consists of multiple pairs of (ConvRelu, CLSTM) cells. The input will first go through a convrelu cell, and then to a convlstm cell, and then to another convrelu cell, so on and so for...
Implement the Python class `Encoder_pro` described below. Class description: encoding a certain length of sequence The Encoder network consists of multiple pairs of (ConvRelu, CLSTM) cells. The input will first go through a convrelu cell, and then to a convlstm cell, and then to another convrelu cell, so on and so for...
b6a3161635bfa3b5da8ec871e1025e01f878e732
<|skeleton|> class Encoder_pro: """encoding a certain length of sequence The Encoder network consists of multiple pairs of (ConvRelu, CLSTM) cells. The input will first go through a convrelu cell, and then to a convlstm cell, and then to another convrelu cell, so on and so forth.""" def __init__(self, rnns, co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder_pro: """encoding a certain length of sequence The Encoder network consists of multiple pairs of (ConvRelu, CLSTM) cells. The input will first go through a convrelu cell, and then to a convlstm cell, and then to another convrelu cell, so on and so forth.""" def __init__(self, rnns, convrelus): ...
the_stack_v2_python_sparse
src/bayesian_neural_net.py
KEHUIYAO/BCLS
train
0
c338681e887f5d89c6f5acf9a6c60e67f63a2c69
[ "self.center = center\nself.blocks = []\nself.kind = ''\nself.block_control = None\nself.color = ''", "piece = Piece(center)\npiece.kind = kind\npiece.blocks = cls.kinds[kind]\npiece.color = cls.colors[kind]\npiece.block_control = copy.copy(Piece.blocks_controls[kind])\nreturn piece", "new_blocks = []\ncoef = n...
<|body_start_0|> self.center = center self.blocks = [] self.kind = '' self.block_control = None self.color = '' <|end_body_0|> <|body_start_1|> piece = Piece(center) piece.kind = kind piece.blocks = cls.kinds[kind] piece.color = cls.colors[kind] ...
Défini chacune des différentes pièces qui peuvent être jouer dans le tetris : O, I, L, T, S, Z, J
Piece
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Piece: """Défini chacune des différentes pièces qui peuvent être jouer dans le tetris : O, I, L, T, S, Z, J""" def __init__(self, center): """Créer une pièce, centrée en center. Attributs : - center : tableau 2D de coordonnée, généralement égale à Piece.centers_init[kind] Retour : - ...
stack_v2_sparse_classes_36k_train_022434
4,438
no_license
[ { "docstring": "Créer une pièce, centrée en center. Attributs : - center : tableau 2D de coordonnée, généralement égale à Piece.centers_init[kind] Retour : - piece : instance Piece / nouvelle piece", "name": "__init__", "signature": "def __init__(self, center)" }, { "docstring": "Méthode de clas...
4
stack_v2_sparse_classes_30k_train_010803
Implement the Python class `Piece` described below. Class description: Défini chacune des différentes pièces qui peuvent être jouer dans le tetris : O, I, L, T, S, Z, J Method signatures and docstrings: - def __init__(self, center): Créer une pièce, centrée en center. Attributs : - center : tableau 2D de coordonnée, ...
Implement the Python class `Piece` described below. Class description: Défini chacune des différentes pièces qui peuvent être jouer dans le tetris : O, I, L, T, S, Z, J Method signatures and docstrings: - def __init__(self, center): Créer une pièce, centrée en center. Attributs : - center : tableau 2D de coordonnée, ...
bd6591d25a978d8889e56cdb394e01560f5b8ac3
<|skeleton|> class Piece: """Défini chacune des différentes pièces qui peuvent être jouer dans le tetris : O, I, L, T, S, Z, J""" def __init__(self, center): """Créer une pièce, centrée en center. Attributs : - center : tableau 2D de coordonnée, généralement égale à Piece.centers_init[kind] Retour : - ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Piece: """Défini chacune des différentes pièces qui peuvent être jouer dans le tetris : O, I, L, T, S, Z, J""" def __init__(self, center): """Créer une pièce, centrée en center. Attributs : - center : tableau 2D de coordonnée, généralement égale à Piece.centers_init[kind] Retour : - piece : insta...
the_stack_v2_python_sparse
tetris/Jeu/Piece.py
Naowak/projet_nao
train
0
eb86da42e35090952e8c205885c9fd6b3f4df7c2
[ "if self.request.method == 'GET':\n return (IsInActiveCommunity(), IsAbleToRetrieveAlbumImage())\nelif self.request.method == 'POST':\n return (permissions.IsAuthenticated(),)\nelif self.request.method == 'DELETE':\n return (permissions.IsAuthenticated(), IsInActiveCommunity(), IsStaffOfCommunity())\nretur...
<|body_start_0|> if self.request.method == 'GET': return (IsInActiveCommunity(), IsAbleToRetrieveAlbumImage()) elif self.request.method == 'POST': return (permissions.IsAuthenticated(),) elif self.request.method == 'DELETE': return (permissions.IsAuthenticated...
Album image view set
AlbumImageViewSet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlbumImageViewSet: """Album image view set""" def get_permissions(self): """Get permissions""" <|body_0|> def list(self, request, *args, **kwargs): """List album images""" <|body_1|> def create(self, request, *args, **kwargs): """Create album...
stack_v2_sparse_classes_36k_train_022435
8,383
permissive
[ { "docstring": "Get permissions", "name": "get_permissions", "signature": "def get_permissions(self)" }, { "docstring": "List album images", "name": "list", "signature": "def list(self, request, *args, **kwargs)" }, { "docstring": "Create album image", "name": "create", "...
4
null
Implement the Python class `AlbumImageViewSet` described below. Class description: Album image view set Method signatures and docstrings: - def get_permissions(self): Get permissions - def list(self, request, *args, **kwargs): List album images - def create(self, request, *args, **kwargs): Create album image - def de...
Implement the Python class `AlbumImageViewSet` described below. Class description: Album image view set Method signatures and docstrings: - def get_permissions(self): Get permissions - def list(self, request, *args, **kwargs): List album images - def create(self, request, *args, **kwargs): Create album image - def de...
cf429f43251ad7e77c0d9bc9fe91bb030ca8bae8
<|skeleton|> class AlbumImageViewSet: """Album image view set""" def get_permissions(self): """Get permissions""" <|body_0|> def list(self, request, *args, **kwargs): """List album images""" <|body_1|> def create(self, request, *args, **kwargs): """Create album...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlbumImageViewSet: """Album image view set""" def get_permissions(self): """Get permissions""" if self.request.method == 'GET': return (IsInActiveCommunity(), IsAbleToRetrieveAlbumImage()) elif self.request.method == 'POST': return (permissions.IsAuthentica...
the_stack_v2_python_sparse
asset/views.py
810Teams/clubs-and-events-backend
train
3
d8a06be246e308f5c1ff503bc83a9e40eb19be3b
[ "tdc_Fields_Plotter.__init__(self, (f_e, f_p), xlabel, ylabel, idlabel)\nif not ylabel:\n self.plot_ylabel = '$\\\\eta_{\\\\pm}$'\nif not idlabel:\n self.plot_idlabel = 'N_{e,p}:' + self.data[0].calc_id\nif e_density_negative:\n self.e_sign = -1\nelse:\n self.e_sign = 1", "self.lines[0], = ax.plot(sel...
<|body_start_0|> tdc_Fields_Plotter.__init__(self, (f_e, f_p), xlabel, ylabel, idlabel) if not ylabel: self.plot_ylabel = '$\\eta_{\\pm}$' if not idlabel: self.plot_idlabel = 'N_{e,p}:' + self.data[0].calc_id if e_density_negative: self.e_sign = -1 ...
This class is plotter for (e)lectron, (p)ositron number densities =========== - it implements plot() function fron tdc_Fields_Plotter - sets plot label
tdc_EP_Density_Plotter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class tdc_EP_Density_Plotter: """This class is plotter for (e)lectron, (p)ositron number densities =========== - it implements plot() function fron tdc_Fields_Plotter - sets plot label""" def __init__(self, f_e, f_p, e_density_negative=True, xlabel=None, ylabel=None, idlabel=None): """f_e ...
stack_v2_sparse_classes_36k_train_022436
5,286
no_license
[ { "docstring": "f_e -- field with electron number density f_p -- field with positron number density e_density_negative -- <True> if true Electron density is negative", "name": "__init__", "signature": "def __init__(self, f_e, f_p, e_density_negative=True, xlabel=None, ylabel=None, idlabel=None)" }, ...
3
null
Implement the Python class `tdc_EP_Density_Plotter` described below. Class description: This class is plotter for (e)lectron, (p)ositron number densities =========== - it implements plot() function fron tdc_Fields_Plotter - sets plot label Method signatures and docstrings: - def __init__(self, f_e, f_p, e_density_neg...
Implement the Python class `tdc_EP_Density_Plotter` described below. Class description: This class is plotter for (e)lectron, (p)ositron number densities =========== - it implements plot() function fron tdc_Fields_Plotter - sets plot label Method signatures and docstrings: - def __init__(self, f_e, f_p, e_density_neg...
775dc841b1d8538584c8c68a5f75ae997191e685
<|skeleton|> class tdc_EP_Density_Plotter: """This class is plotter for (e)lectron, (p)ositron number densities =========== - it implements plot() function fron tdc_Fields_Plotter - sets plot label""" def __init__(self, f_e, f_p, e_density_negative=True, xlabel=None, ylabel=None, idlabel=None): """f_e ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class tdc_EP_Density_Plotter: """This class is plotter for (e)lectron, (p)ositron number densities =========== - it implements plot() function fron tdc_Fields_Plotter - sets plot label""" def __init__(self, f_e, f_p, e_density_negative=True, xlabel=None, ylabel=None, idlabel=None): """f_e -- field with...
the_stack_v2_python_sparse
Fields/tdc_ep_density_plotter.py
atimokhin/tdc_vis
train
0
e51fe33231fa32c8eb804eedd0e2ddebe14c80ca
[ "self._maxsize = maxsize\nself._queue = collections.deque()\nself._closed = False\nself._mutex = threading.Lock()\nself._not_empty = threading.Condition(self._mutex)\nself._not_full = threading.Condition(self._mutex)", "with self._not_empty:\n while not self._queue:\n self._not_empty.wait()\n item = ...
<|body_start_0|> self._maxsize = maxsize self._queue = collections.deque() self._closed = False self._mutex = threading.Lock() self._not_empty = threading.Condition(self._mutex) self._not_full = threading.Condition(self._mutex) <|end_body_0|> <|body_start_1|> wit...
Stripped-down fork of the standard library Queue that is closeable.
CloseableQueue
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloseableQueue: """Stripped-down fork of the standard library Queue that is closeable.""" def __init__(self, maxsize=0): """Create a queue object with a given maximum size. Args: maxsize: int size of queue. If <= 0, the queue size is infinite.""" <|body_0|> def get(self)...
stack_v2_sparse_classes_36k_train_022437
10,399
permissive
[ { "docstring": "Create a queue object with a given maximum size. Args: maxsize: int size of queue. If <= 0, the queue size is infinite.", "name": "__init__", "signature": "def __init__(self, maxsize=0)" }, { "docstring": "Remove and return an item from the queue. If the queue is empty, blocks un...
4
null
Implement the Python class `CloseableQueue` described below. Class description: Stripped-down fork of the standard library Queue that is closeable. Method signatures and docstrings: - def __init__(self, maxsize=0): Create a queue object with a given maximum size. Args: maxsize: int size of queue. If <= 0, the queue s...
Implement the Python class `CloseableQueue` described below. Class description: Stripped-down fork of the standard library Queue that is closeable. Method signatures and docstrings: - def __init__(self, maxsize=0): Create a queue object with a given maximum size. Args: maxsize: int size of queue. If <= 0, the queue s...
a7f3934a67900720af3d3b15389551483bee50b8
<|skeleton|> class CloseableQueue: """Stripped-down fork of the standard library Queue that is closeable.""" def __init__(self, maxsize=0): """Create a queue object with a given maximum size. Args: maxsize: int size of queue. If <= 0, the queue size is infinite.""" <|body_0|> def get(self)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CloseableQueue: """Stripped-down fork of the standard library Queue that is closeable.""" def __init__(self, maxsize=0): """Create a queue object with a given maximum size. Args: maxsize: int size of queue. If <= 0, the queue size is infinite.""" self._maxsize = maxsize self._queu...
the_stack_v2_python_sparse
tensorflow/python/summary/writer/event_file_writer.py
tensorflow/tensorflow
train
208,740
9c375b26c59ee3b8feacbe911cd5934fd9d5ed71
[ "def winner(nums, s, e, turn):\n if s == e:\n return turn * nums[s]\n a = turn * nums[s] + winner(nums, s + 1, e, -turn)\n b = turn * nums[e] + winner(nums, s, e - 1, -turn)\n return turn * max(turn * a, turn * b)\nreturn winner(nums, 0, len(nums) - 1, 1) >= 0", "n = len(nums)\ndp = [[0 for i i...
<|body_start_0|> def winner(nums, s, e, turn): if s == e: return turn * nums[s] a = turn * nums[s] + winner(nums, s + 1, e, -turn) b = turn * nums[e] + winner(nums, s, e - 1, -turn) return turn * max(turn * a, turn * b) return winner(nums, ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def PredictTheWinner1(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def PredictTheWinner(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> def winner(nums, s, e, turn): ...
stack_v2_sparse_classes_36k_train_022438
923
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "PredictTheWinner1", "signature": "def PredictTheWinner1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "PredictTheWinner", "signature": "def PredictTheWinner(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def PredictTheWinner1(self, nums): :type nums: List[int] :rtype: bool - def PredictTheWinner(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 PredictTheWinner1(self, nums): :type nums: List[int] :rtype: bool - def PredictTheWinner(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: de...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def PredictTheWinner1(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def PredictTheWinner(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def PredictTheWinner1(self, nums): """:type nums: List[int] :rtype: bool""" def winner(nums, s, e, turn): if s == e: return turn * nums[s] a = turn * nums[s] + winner(nums, s + 1, e, -turn) b = turn * nums[e] + winner(nums, s, e - 1...
the_stack_v2_python_sparse
py/leetcode/486.py
wfeng1991/learnpy
train
0
b18cb7257fdbe56ffa350f031633452a4354cc28
[ "headers = self._get_default_headers()\ntry:\n if self.request_validator.client_authentication_required(request):\n log.debug('Authenticating client, %r.', request)\n if not self.request_validator.authenticate_client(request):\n log.debug('Client authentication failed, %r.', request)\n ...
<|body_start_0|> headers = self._get_default_headers() try: if self.request_validator.client_authentication_required(request): log.debug('Authenticating client, %r.', request) if not self.request_validator.authenticate_client(request): log....
`Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application. The authorization server should take special care when enabling ...
ResourceOwnerPasswordCredentialsGrant
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResourceOwnerPasswordCredentialsGrant: """`Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application....
stack_v2_sparse_classes_36k_train_022439
8,484
permissive
[ { "docstring": "Return token or error in json format. :param request: OAuthlib request. :type request: oauthlib.common.Request :param token_handler: A token handler instance, for example of type oauthlib.oauth2.BearerToken. If the access token request is valid and authorized, the authorization server issues an ...
2
stack_v2_sparse_classes_30k_train_006756
Implement the Python class `ResourceOwnerPasswordCredentialsGrant` described below. Class description: `Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating sys...
Implement the Python class `ResourceOwnerPasswordCredentialsGrant` described below. Class description: `Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating sys...
00f9a212004a80df790ed071a59af53a05f5e3f2
<|skeleton|> class ResourceOwnerPasswordCredentialsGrant: """`Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResourceOwnerPasswordCredentialsGrant: """`Resource Owner Password Credentials Grant`_ The resource owner password credentials grant type is suitable in cases where the resource owner has a trust relationship with the client, such as the device operating system or a highly privileged application. The authoriz...
the_stack_v2_python_sparse
oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py
oauthlib/oauthlib
train
1,223
eb1a6b62d61c5ed5fdedb3ca32ae7f3ff57eebec
[ "MenuEntryWidget.__init__(self, entry, fontSize=28, width=width, height=height)\nself.entry = entry\nattack = self.entry.attack\nself.typeImage = TypeImage(attack.type)\nself.ppTextLabel = Label('PP', size=18)\nself.ppValuesLabel = Label('{0}/{1}'.format(attack.currPowerPoints, attack.powerPoints), size=18)", "se...
<|body_start_0|> MenuEntryWidget.__init__(self, entry, fontSize=28, width=width, height=height) self.entry = entry attack = self.entry.attack self.typeImage = TypeImage(attack.type) self.ppTextLabel = Label('PP', size=18) self.ppValuesLabel = Label('{0}/{1}'.format(attack...
Represents the widget for an Attack Menu Entry
AttackMenuEntryWidget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttackMenuEntryWidget: """Represents the widget for an Attack Menu Entry""" def __init__(self, entry, width, height): """Initialize the widget""" <|body_0|> def drawSurface(self): """Draw the Widget""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022440
1,224
no_license
[ { "docstring": "Initialize the widget", "name": "__init__", "signature": "def __init__(self, entry, width, height)" }, { "docstring": "Draw the Widget", "name": "drawSurface", "signature": "def drawSurface(self)" } ]
2
stack_v2_sparse_classes_30k_train_017564
Implement the Python class `AttackMenuEntryWidget` described below. Class description: Represents the widget for an Attack Menu Entry Method signatures and docstrings: - def __init__(self, entry, width, height): Initialize the widget - def drawSurface(self): Draw the Widget
Implement the Python class `AttackMenuEntryWidget` described below. Class description: Represents the widget for an Attack Menu Entry Method signatures and docstrings: - def __init__(self, entry, width, height): Initialize the widget - def drawSurface(self): Draw the Widget <|skeleton|> class AttackMenuEntryWidget: ...
3931eee5fd04e18bb1738a0b27a4c6979dc4db01
<|skeleton|> class AttackMenuEntryWidget: """Represents the widget for an Attack Menu Entry""" def __init__(self, entry, width, height): """Initialize the widget""" <|body_0|> def drawSurface(self): """Draw the Widget""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttackMenuEntryWidget: """Represents the widget for an Attack Menu Entry""" def __init__(self, entry, width, height): """Initialize the widget""" MenuEntryWidget.__init__(self, entry, fontSize=28, width=width, height=height) self.entry = entry attack = self.entry.attack ...
the_stack_v2_python_sparse
src/Screen/Pygame/Menu/ActionMenu/AttackMenu/attack_menu_entry_widget.py
sgtnourry/Pokemon-Project
train
0
9a53d11f715febef8cf7c0128aedcd37925eb383
[ "max_area = 0\nn = len(height)\nfor i in range(n):\n for j in range(i + 1, n):\n area = (j - i) * min(height[i], height[j])\n max_area = max(max_area, area)\nprint(max_area)\nreturn max_area", "max_area = 0\nn = len(height)\ni = 0\nj = n - 1\nwhile i < j:\n if height[i] < height[j]:\n a...
<|body_start_0|> max_area = 0 n = len(height) for i in range(n): for j in range(i + 1, n): area = (j - i) * min(height[i], height[j]) max_area = max(max_area, area) print(max_area) return max_area <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def max_area(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def max_area2(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> max_area = 0 n = len(height) ...
stack_v2_sparse_classes_36k_train_022441
1,597
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "max_area", "signature": "def max_area(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "max_area2", "signature": "def max_area2(self, height)" } ]
2
stack_v2_sparse_classes_30k_train_005457
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def max_area(self, height): :type height: List[int] :rtype: int - def max_area2(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def max_area(self, height): :type height: List[int] :rtype: int - def max_area2(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def max_area...
3b13b36f37eb364410b3b5b4f10a1808d8b1111e
<|skeleton|> class Solution: def max_area(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def max_area2(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def max_area(self, height): """:type height: List[int] :rtype: int""" max_area = 0 n = len(height) for i in range(n): for j in range(i + 1, n): area = (j - i) * min(height[i], height[j]) max_area = max(max_area, area) ...
the_stack_v2_python_sparse
leetcode/11.py
yanggelinux/algorithm-data-structure
train
0
5a2e57b60a6b5d2016d3e5711de1276e0fc493eb
[ "if not self._dapver or parse(self._dapver) < self.__min_dapall_version__:\n raise MarvinError('DAPall is not available for versions before MPL-6.')\nif hasattr(self, '_dapall') and self._dapall is not None:\n return self._dapall\nif self.data_origin == 'file':\n try:\n dapall_data = self._get_dapal...
<|body_start_0|> if not self._dapver or parse(self._dapver) < self.__min_dapall_version__: raise MarvinError('DAPall is not available for versions before MPL-6.') if hasattr(self, '_dapall') and self._dapall is not None: return self._dapall if self.data_origin == 'file': ...
A mixin that provides access to DAPall paremeters. Must be used in combination with `.MarvinToolsClass` and initialised before `~.DAPallMixIn.dapall` can be called. `DAPallMixIn` uses the `.MarvinToolsClass.data_origin` of the object to determine how to obtain the DAPall information. However, if the object contains a `...
DAPallMixIn
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DAPallMixIn: """A mixin that provides access to DAPall paremeters. Must be used in combination with `.MarvinToolsClass` and initialised before `~.DAPallMixIn.dapall` can be called. `DAPallMixIn` uses the `.MarvinToolsClass.data_origin` of the object to determine how to obtain the DAPall informati...
stack_v2_sparse_classes_36k_train_022442
4,554
permissive
[ { "docstring": "Returns the contents of the DAPall data for this target.", "name": "dapall", "signature": "def dapall(self)" }, { "docstring": "Uses DAPAll file to retrieve information.", "name": "_get_dapall_from_file", "signature": "def _get_dapall_from_file(self)" }, { "docstr...
4
stack_v2_sparse_classes_30k_train_018759
Implement the Python class `DAPallMixIn` described below. Class description: A mixin that provides access to DAPall paremeters. Must be used in combination with `.MarvinToolsClass` and initialised before `~.DAPallMixIn.dapall` can be called. `DAPallMixIn` uses the `.MarvinToolsClass.data_origin` of the object to deter...
Implement the Python class `DAPallMixIn` described below. Class description: A mixin that provides access to DAPall paremeters. Must be used in combination with `.MarvinToolsClass` and initialised before `~.DAPallMixIn.dapall` can be called. `DAPallMixIn` uses the `.MarvinToolsClass.data_origin` of the object to deter...
db4c536a65fb2f16fee05a4f34996a7fd35f0527
<|skeleton|> class DAPallMixIn: """A mixin that provides access to DAPall paremeters. Must be used in combination with `.MarvinToolsClass` and initialised before `~.DAPallMixIn.dapall` can be called. `DAPallMixIn` uses the `.MarvinToolsClass.data_origin` of the object to determine how to obtain the DAPall informati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DAPallMixIn: """A mixin that provides access to DAPall paremeters. Must be used in combination with `.MarvinToolsClass` and initialised before `~.DAPallMixIn.dapall` can be called. `DAPallMixIn` uses the `.MarvinToolsClass.data_origin` of the object to determine how to obtain the DAPall information. However, ...
the_stack_v2_python_sparse
python/marvin/tools/mixins/dapall.py
sdss/marvin
train
56
6ae0fb393a980ccb01cf42cf091fb1cb562bcc5d
[ "self.tags = tags\nself.attachments = attachments\nself.required_signatures = required_signatures\nself.created_by_application = created_by_application\nself.get_social_security_number = get_social_security_number\nself.extra_info = extra_info\nself.security = security\nself.time_to_live = time_to_live\nself.depart...
<|body_start_0|> self.tags = tags self.attachments = attachments self.required_signatures = required_signatures self.created_by_application = created_by_application self.get_social_security_number = get_social_security_number self.extra_info = extra_info self.secu...
Implementation of the 'Advanced' model. TODO: type model description here. Attributes: tags (list of string): Mark the document with tags, these tags can be used to query for document data / events at a later time. attachments (int): Set how many attachments this signjob should have, when the document is created you ca...
Advanced
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Advanced: """Implementation of the 'Advanced' model. TODO: type model description here. Attributes: tags (list of string): Mark the document with tags, these tags can be used to query for document data / events at a later time. attachments (int): Set how many attachments this signjob should have,...
stack_v2_sparse_classes_36k_train_022443
5,427
permissive
[ { "docstring": "Constructor for the Advanced class", "name": "__init__", "signature": "def __init__(self, tags=None, attachments=None, required_signatures=None, created_by_application=None, get_social_security_number=None, extra_info=None, security=None, time_to_live=None, department_id=None, additional...
2
stack_v2_sparse_classes_30k_train_007251
Implement the Python class `Advanced` described below. Class description: Implementation of the 'Advanced' model. TODO: type model description here. Attributes: tags (list of string): Mark the document with tags, these tags can be used to query for document data / events at a later time. attachments (int): Set how man...
Implement the Python class `Advanced` described below. Class description: Implementation of the 'Advanced' model. TODO: type model description here. Attributes: tags (list of string): Mark the document with tags, these tags can be used to query for document data / events at a later time. attachments (int): Set how man...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class Advanced: """Implementation of the 'Advanced' model. TODO: type model description here. Attributes: tags (list of string): Mark the document with tags, these tags can be used to query for document data / events at a later time. attachments (int): Set how many attachments this signjob should have,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Advanced: """Implementation of the 'Advanced' model. TODO: type model description here. Attributes: tags (list of string): Mark the document with tags, these tags can be used to query for document data / events at a later time. attachments (int): Set how many attachments this signjob should have, when the doc...
the_stack_v2_python_sparse
idfy_rest_client/models/advanced.py
dealflowteam/Idfy
train
0
d142100cc4b2d4577aec3c84b23455009d27ac43
[ "rows = self._parse_int_lines(data)\nwhile len(rows) > 0:\n first = rows.pop()\n if first > self._limit:\n continue\n for second in rows:\n if first + second == self._limit:\n return first * second\nreturn 0", "rows = self._parse_int_lines(data)\nwhile len(rows) > 0:\n first =...
<|body_start_0|> rows = self._parse_int_lines(data) while len(rows) > 0: first = rows.pop() if first > self._limit: continue for second in rows: if first + second == self._limit: return first * second return ...
Solver for day 1, 2020.
Solver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solver: """Solver for day 1, 2020.""" def part_one(self, data: str) -> int: """Solve part one.""" <|body_0|> def part_two(self, data: str) -> int: """Solve part two.""" <|body_1|> <|end_skeleton|> <|body_start_0|> rows = self._parse_int_lines(da...
stack_v2_sparse_classes_36k_train_022444
1,146
no_license
[ { "docstring": "Solve part one.", "name": "part_one", "signature": "def part_one(self, data: str) -> int" }, { "docstring": "Solve part two.", "name": "part_two", "signature": "def part_two(self, data: str) -> int" } ]
2
stack_v2_sparse_classes_30k_test_001143
Implement the Python class `Solver` described below. Class description: Solver for day 1, 2020. Method signatures and docstrings: - def part_one(self, data: str) -> int: Solve part one. - def part_two(self, data: str) -> int: Solve part two.
Implement the Python class `Solver` described below. Class description: Solver for day 1, 2020. Method signatures and docstrings: - def part_one(self, data: str) -> int: Solve part one. - def part_two(self, data: str) -> int: Solve part two. <|skeleton|> class Solver: """Solver for day 1, 2020.""" def part_...
b1e7f12318c5bd642dfe29f862680f51c0f66bb5
<|skeleton|> class Solver: """Solver for day 1, 2020.""" def part_one(self, data: str) -> int: """Solve part one.""" <|body_0|> def part_two(self, data: str) -> int: """Solve part two.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solver: """Solver for day 1, 2020.""" def part_one(self, data: str) -> int: """Solve part one.""" rows = self._parse_int_lines(data) while len(rows) > 0: first = rows.pop() if first > self._limit: continue for second in rows: ...
the_stack_v2_python_sparse
app/y2020/d01_report_repair.py
bolmstedt/advent-of-code-python
train
0
1156dae05e641403082e891e000e447d1090a9b7
[ "self.key2node = {}\nself.freq2list = defaultdict(OrderedDict)\nself.capacity = capacity\nself.minf = 0", "if key not in self.key2node:\n return -1\nkey, value, freq = self.key2node[key]\nself.freq2list[freq].pop(key)\nself.key2node.pop(key)\nif not self.freq2list[freq] and freq == self.minf:\n self.minf +=...
<|body_start_0|> self.key2node = {} self.freq2list = defaultdict(OrderedDict) self.capacity = capacity self.minf = 0 <|end_body_0|> <|body_start_1|> if key not in self.key2node: return -1 key, value, freq = self.key2node[key] self.freq2list[freq].pop(...
LFUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_022445
2,950
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
stack_v2_sparse_classes_30k_train_014668
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
547cdc7365716660a9d9590c1cc97d95bc38d315
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.key2node = {} self.freq2list = defaultdict(OrderedDict) self.capacity = capacity self.minf = 0 def get(self, key): """:type key: int :rtype: int""" if key not in self.key2node: ...
the_stack_v2_python_sparse
460.lfu-cache.py
zhch-sun/leetcode_szc
train
0
98814a0f204e4c9f69dd359e1e92974fbc51e5d9
[ "super(RestDataCollection, self).__init__()\nself.ResourceModel = kwargs['RestResourceModel']\nself.Database = self.ResourceModel.Database\nself.dbTable = self.ResourceModel.Table\nself.CollectionTitle = self.ResourceModel.CollectionTitle\nself.SingleElementTitle = self.ResourceModel.SingleElementTitle\nself.Displa...
<|body_start_0|> super(RestDataCollection, self).__init__() self.ResourceModel = kwargs['RestResourceModel'] self.Database = self.ResourceModel.Database self.dbTable = self.ResourceModel.Table self.CollectionTitle = self.ResourceModel.CollectionTitle self.SingleElementTit...
RestDataCollection: Manage with REST a collection of elements : - POST : is allowing to add an element to the collection - GET : is allowing to display all elements of the collection
RestDataCollection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RestDataCollection: """RestDataCollection: Manage with REST a collection of elements : - POST : is allowing to add an element to the collection - GET : is allowing to display all elements of the collection""" def __init__(self, **kwargs): """RestDataCollection constructor: - RestReso...
stack_v2_sparse_classes_36k_train_022446
5,412
no_license
[ { "docstring": "RestDataCollection constructor: - RestResourceModel : REST Resource description (data model, display format, put and post parser)", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "Manage ParentKey filtering for GET method appied on Childs", ...
5
null
Implement the Python class `RestDataCollection` described below. Class description: RestDataCollection: Manage with REST a collection of elements : - POST : is allowing to add an element to the collection - GET : is allowing to display all elements of the collection Method signatures and docstrings: - def __init__(se...
Implement the Python class `RestDataCollection` described below. Class description: RestDataCollection: Manage with REST a collection of elements : - POST : is allowing to add an element to the collection - GET : is allowing to display all elements of the collection Method signatures and docstrings: - def __init__(se...
8f107644a74fe46827ec5ed53d0457022bd1608b
<|skeleton|> class RestDataCollection: """RestDataCollection: Manage with REST a collection of elements : - POST : is allowing to add an element to the collection - GET : is allowing to display all elements of the collection""" def __init__(self, **kwargs): """RestDataCollection constructor: - RestReso...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RestDataCollection: """RestDataCollection: Manage with REST a collection of elements : - POST : is allowing to add an element to the collection - GET : is allowing to display all elements of the collection""" def __init__(self, **kwargs): """RestDataCollection constructor: - RestResourceModel : R...
the_stack_v2_python_sparse
restapp/view_RestDataCollection_v3.py
ldurandadomia/Flask-Restful
train
0
9faf15f211e4b8f520e45e2b4ed51621461bd23e
[ "properties = {'env_vars': {}, 'inputs': [], 'outputs': []}\nreader = self._get_reader(filepath)\nparser = self._get_parser(reader.language)\nif not parser:\n return properties\nfor chunk in reader.read_next_code_chunk():\n if chunk:\n for line in chunk:\n matches = parser.parse_environment_...
<|body_start_0|> properties = {'env_vars': {}, 'inputs': [], 'outputs': []} reader = self._get_reader(filepath) parser = self._get_parser(reader.language) if not parser: return properties for chunk in reader.read_next_code_chunk(): if chunk: ...
ContentParser
[ "Apache-2.0", "CC-BY-4.0", "LicenseRef-scancode-unknown-license-reference", "CC-BY-SA-4.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContentParser: def parse(self, filepath: str) -> dict: """Returns a model dictionary of all the regex matches for each key in the regex dictionary""" <|body_0|> def _validate_file(self, filepath: str): """Validate file exists and is file (e.g. not a directory)""" ...
stack_v2_sparse_classes_36k_train_022447
7,437
permissive
[ { "docstring": "Returns a model dictionary of all the regex matches for each key in the regex dictionary", "name": "parse", "signature": "def parse(self, filepath: str) -> dict" }, { "docstring": "Validate file exists and is file (e.g. not a directory)", "name": "_validate_file", "signat...
4
stack_v2_sparse_classes_30k_train_001495
Implement the Python class `ContentParser` described below. Class description: Implement the ContentParser class. Method signatures and docstrings: - def parse(self, filepath: str) -> dict: Returns a model dictionary of all the regex matches for each key in the regex dictionary - def _validate_file(self, filepath: st...
Implement the Python class `ContentParser` described below. Class description: Implement the ContentParser class. Method signatures and docstrings: - def parse(self, filepath: str) -> dict: Returns a model dictionary of all the regex matches for each key in the regex dictionary - def _validate_file(self, filepath: st...
3c27ada25a27b719529e88268bed38d135e40805
<|skeleton|> class ContentParser: def parse(self, filepath: str) -> dict: """Returns a model dictionary of all the regex matches for each key in the regex dictionary""" <|body_0|> def _validate_file(self, filepath: str): """Validate file exists and is file (e.g. not a directory)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContentParser: def parse(self, filepath: str) -> dict: """Returns a model dictionary of all the regex matches for each key in the regex dictionary""" properties = {'env_vars': {}, 'inputs': [], 'outputs': []} reader = self._get_reader(filepath) parser = self._get_parser(reader....
the_stack_v2_python_sparse
elyra/contents/parser.py
elyra-ai/elyra
train
1,707
50fa9c31970a6943b86f2a1025687b143816f900
[ "super(Encoder, self).__init__()\nself.dm = dm\nself.N = N\nself.embedding = tf.keras.layers.Embedding(input_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, self.dm)\nself.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)",...
<|body_start_0|> super(Encoder, self).__init__() self.dm = dm self.N = N self.embedding = tf.keras.layers.Embedding(input_vocab, dm) self.positional_encoding = positional_encoding(max_seq_len, self.dm) self.blocks = [EncoderBlock(dm, h, hidden, drop_rate) for _ in range(N...
to encoder for machine translation
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """to encoder for machine translation""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @i...
stack_v2_sparse_classes_36k_train_022448
2,368
no_license
[ { "docstring": "constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @input_vocab: size of input vocabulary @max_seq_len: maximum sequence length possible @drop_rate: dropout rate *Sets following public instance att...
2
null
Implement the Python class `Encoder` described below. Class description: to encoder for machine translation Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @h...
Implement the Python class `Encoder` described below. Class description: to encoder for machine translation Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @h...
e20b284d5f1841952104d7d9a0274cff80eb304d
<|skeleton|> class Encoder: """to encoder for machine translation""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """to encoder for machine translation""" def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): """constructor @N: number of blocks in encoder @dm: dimensionality of model @h: number of heads @hidden: number of hidden units in fully connected layer @input_vocab: s...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/9-transformer_encoder.py
jgadelugo/holbertonschool-machine_learning
train
1
7178b04f118b7a96827146d612776936e49a22cb
[ "self.driver = driver\nself.comp_name = comp_name\nself.element = self.get_component()", "elem = self.find_element('[name=\"' + compname + '\"]')\ndiscript = elem.get_attribute('data-discription')\ndps = self.find_elements('div.formfield-wrap>label')\nfor dp in dps:\n if dp.text == discript:\n return Tr...
<|body_start_0|> self.driver = driver self.comp_name = comp_name self.element = self.get_component() <|end_body_0|> <|body_start_1|> elem = self.find_element('[name="' + compname + '"]') discript = elem.get_attribute('data-discription') dps = self.find_elements('div.form...
微信录音控件
RecordPhonePage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecordPhonePage: """微信录音控件""" def __init__(self, driver, comp_name): """类初始化执行""" <|body_0|> def is_desription_effect(self, compname): """判断描述是否生效""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.driver = driver self.comp_name = comp...
stack_v2_sparse_classes_36k_train_022449
3,115
no_license
[ { "docstring": "类初始化执行", "name": "__init__", "signature": "def __init__(self, driver, comp_name)" }, { "docstring": "判断描述是否生效", "name": "is_desription_effect", "signature": "def is_desription_effect(self, compname)" } ]
2
null
Implement the Python class `RecordPhonePage` described below. Class description: 微信录音控件 Method signatures and docstrings: - def __init__(self, driver, comp_name): 类初始化执行 - def is_desription_effect(self, compname): 判断描述是否生效
Implement the Python class `RecordPhonePage` described below. Class description: 微信录音控件 Method signatures and docstrings: - def __init__(self, driver, comp_name): 类初始化执行 - def is_desription_effect(self, compname): 判断描述是否生效 <|skeleton|> class RecordPhonePage: """微信录音控件""" def __init__(self, driver, comp_name...
78768989a79a14013b983024cf6e4838d51ed595
<|skeleton|> class RecordPhonePage: """微信录音控件""" def __init__(self, driver, comp_name): """类初始化执行""" <|body_0|> def is_desription_effect(self, compname): """判断描述是否生效""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecordPhonePage: """微信录音控件""" def __init__(self, driver, comp_name): """类初始化执行""" self.driver = driver self.comp_name = comp_name self.element = self.get_component() def is_desription_effect(self, compname): """判断描述是否生效""" elem = self.find_element('[na...
the_stack_v2_python_sparse
test_case/page_obj/form/record_page.py
pylk/pythonSelenium
train
0
a8fd8388eb5c14ea67d0fab815be2483836985ff
[ "self.aDJM = aDJM\nself.order = len(aDJM)\nself.vs = [Graph.Vertex(self, i, self.no_labeling_num) for i in range(self.order)]", "result = []\nfor v in vs:\n if v.label == self.no_labeling_num:\n result.append(v)\nreturn result", "label = 0\nv = self.vs[0]\nv.label = label\nif v.adjacentVs() == []:\n ...
<|body_start_0|> self.aDJM = aDJM self.order = len(aDJM) self.vs = [Graph.Vertex(self, i, self.no_labeling_num) for i in range(self.order)] <|end_body_0|> <|body_start_1|> result = [] for v in vs: if v.label == self.no_labeling_num: result.append(v) ...
Graph
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Graph: def __init__(self, aDJM): """:param aDJM:隣接行列""" <|body_0|> def no_labelingVs(self, vs): """渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return:""" <|body_1|> def isconnected(self): """このグラフが連結グラフであるかどうかを判定する :return:""" <|body_2|> <|end...
stack_v2_sparse_classes_36k_train_022450
4,624
permissive
[ { "docstring": ":param aDJM:隣接行列", "name": "__init__", "signature": "def __init__(self, aDJM)" }, { "docstring": "渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return:", "name": "no_labelingVs", "signature": "def no_labelingVs(self, vs)" }, { "docstring": "このグラフが連結グラフであるかどうかを判定する :return...
3
null
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def __init__(self, aDJM): :param aDJM:隣接行列 - def no_labelingVs(self, vs): 渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return: - def isconnected(self): このグラフが連結グラフであるかどうかを判定する :return:
Implement the Python class `Graph` described below. Class description: Implement the Graph class. Method signatures and docstrings: - def __init__(self, aDJM): :param aDJM:隣接行列 - def no_labelingVs(self, vs): 渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return: - def isconnected(self): このグラフが連結グラフであるかどうかを判定する :return: <|ske...
50f6d5c92a01792552c31ac912ce1cd557b06fb0
<|skeleton|> class Graph: def __init__(self, aDJM): """:param aDJM:隣接行列""" <|body_0|> def no_labelingVs(self, vs): """渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return:""" <|body_1|> def isconnected(self): """このグラフが連結グラフであるかどうかを判定する :return:""" <|body_2|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Graph: def __init__(self, aDJM): """:param aDJM:隣接行列""" self.aDJM = aDJM self.order = len(aDJM) self.vs = [Graph.Vertex(self, i, self.no_labeling_num) for i in range(self.order)] def no_labelingVs(self, vs): """渡された頂点リストにおいてlabelingされていない頂点のリストを返す :return:""" ...
the_stack_v2_python_sparse
airoiro/iro4.py
yosho-18/AtCoder
train
0
43637705175d3e7cbb33ea7c17e2058772e23e7e
[ "errors = {}\nif user_input is not None:\n if user_input[CONF_GATEWAY]:\n return await self.async_step_gateway()\n errors['base'] = 'no_device_selected'\nreturn self.async_show_form(step_id='user', data_schema=CONFIG_SCHEMA, errors=errors)", "errors = {}\nif user_input is not None:\n host = user_i...
<|body_start_0|> errors = {} if user_input is not None: if user_input[CONF_GATEWAY]: return await self.async_step_gateway() errors['base'] = 'no_device_selected' return self.async_show_form(step_id='user', data_schema=CONFIG_SCHEMA, errors=errors) <|end_bo...
Handle a Xiaomi Miio config flow.
XiaomiMiioFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XiaomiMiioFlowHandler: """Handle a Xiaomi Miio config flow.""" async def async_step_user(self, user_input=None): """Handle a flow initialized by the user.""" <|body_0|> async def async_step_gateway(self, user_input=None): """Handle a flow initialized by the user ...
stack_v2_sparse_classes_36k_train_022451
2,817
permissive
[ { "docstring": "Handle a flow initialized by the user.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input=None)" }, { "docstring": "Handle a flow initialized by the user to configure a gateway.", "name": "async_step_gateway", "signature": "async def asy...
2
stack_v2_sparse_classes_30k_train_015909
Implement the Python class `XiaomiMiioFlowHandler` described below. Class description: Handle a Xiaomi Miio config flow. Method signatures and docstrings: - async def async_step_user(self, user_input=None): Handle a flow initialized by the user. - async def async_step_gateway(self, user_input=None): Handle a flow ini...
Implement the Python class `XiaomiMiioFlowHandler` described below. Class description: Handle a Xiaomi Miio config flow. Method signatures and docstrings: - async def async_step_user(self, user_input=None): Handle a flow initialized by the user. - async def async_step_gateway(self, user_input=None): Handle a flow ini...
ecdcfb835dc708aa8cd035adbe41dfb104203586
<|skeleton|> class XiaomiMiioFlowHandler: """Handle a Xiaomi Miio config flow.""" async def async_step_user(self, user_input=None): """Handle a flow initialized by the user.""" <|body_0|> async def async_step_gateway(self, user_input=None): """Handle a flow initialized by the user ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XiaomiMiioFlowHandler: """Handle a Xiaomi Miio config flow.""" async def async_step_user(self, user_input=None): """Handle a flow initialized by the user.""" errors = {} if user_input is not None: if user_input[CONF_GATEWAY]: return await self.async_ste...
the_stack_v2_python_sparse
homeassistant/components/xiaomi_miio/config_flow.py
callsSolve/core
train
1
bc8d8c344fede5ed0c5737dec5870c3cd46f1a53
[ "mock_get_root.return_value = 'a/b'\nvscode_workspace_file_gen.generate_code_workspace_file(['a/b/path_to_project1', 'a/b/path_to_project2'])\nself.assertTrue(mock_get_root.called)\nself.assertTrue(mock_ws_content.called)\nself.assertTrue(mock_get_unique.called)", "abs_path = 'a/b'\nfolder_name = 'Settings'\nres ...
<|body_start_0|> mock_get_root.return_value = 'a/b' vscode_workspace_file_gen.generate_code_workspace_file(['a/b/path_to_project1', 'a/b/path_to_project2']) self.assertTrue(mock_get_root.called) self.assertTrue(mock_ws_content.called) self.assertTrue(mock_get_unique.called) <|end...
Unit tests for ide_util.py.
WorkspaceProjectFileGenUnittests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkspaceProjectFileGenUnittests: """Unit tests for ide_util.py.""" def test_vdcode_apply_optional_config(self, mock_get_root, mock_ws_content, mock_get_unique): """Test IdeVSCode's apply_optional_config method.""" <|body_0|> def test_create_code_workspace_file_content(s...
stack_v2_sparse_classes_36k_train_022452
2,875
no_license
[ { "docstring": "Test IdeVSCode's apply_optional_config method.", "name": "test_vdcode_apply_optional_config", "signature": "def test_vdcode_apply_optional_config(self, mock_get_root, mock_ws_content, mock_get_unique)" }, { "docstring": "Test _create_code_workspace_file_content function.", "n...
3
null
Implement the Python class `WorkspaceProjectFileGenUnittests` described below. Class description: Unit tests for ide_util.py. Method signatures and docstrings: - def test_vdcode_apply_optional_config(self, mock_get_root, mock_ws_content, mock_get_unique): Test IdeVSCode's apply_optional_config method. - def test_crea...
Implement the Python class `WorkspaceProjectFileGenUnittests` described below. Class description: Unit tests for ide_util.py. Method signatures and docstrings: - def test_vdcode_apply_optional_config(self, mock_get_root, mock_ws_content, mock_get_unique): Test IdeVSCode's apply_optional_config method. - def test_crea...
78a61ca023cbf1a0cecfef8b97df2b274ac3a988
<|skeleton|> class WorkspaceProjectFileGenUnittests: """Unit tests for ide_util.py.""" def test_vdcode_apply_optional_config(self, mock_get_root, mock_ws_content, mock_get_unique): """Test IdeVSCode's apply_optional_config method.""" <|body_0|> def test_create_code_workspace_file_content(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkspaceProjectFileGenUnittests: """Unit tests for ide_util.py.""" def test_vdcode_apply_optional_config(self, mock_get_root, mock_ws_content, mock_get_unique): """Test IdeVSCode's apply_optional_config method.""" mock_get_root.return_value = 'a/b' vscode_workspace_file_gen.gener...
the_stack_v2_python_sparse
tools/asuite/aidegen/vscode/vscode_workspace_file_gen_unittest.py
ZYHGOD-1/Aosp11
train
0
9a902a69e308a9068ac7806a347d715ab2e2e75d
[ "self.microphys_data = microphysdata\nself.basemap = basemap\nself.fields = microphys_data['fields']\nif lon_name is None:\n self.longitude = self.microphys_data['longitude']\nelse:\n self.longitude = self.microphys_data[lon_name]\nif lat_name is None:\n self.latitude = self.microphys_data['latitude']\nels...
<|body_start_0|> self.microphys_data = microphysdata self.basemap = basemap self.fields = microphys_data['fields'] if lon_name is None: self.longitude = self.microphys_data['longitude'] else: self.longitude = self.microphys_data[lon_name] if lat_na...
Create a vertical plot of microphysical data. This class was created for microphysical retrievals from radar systems, for example the LATMOS French Falcon.
MicrophysicalVerticalPlot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MicrophysicalVerticalPlot: """Create a vertical plot of microphysical data. This class was created for microphysical retrievals from radar systems, for example the LATMOS French Falcon.""" def __init__(self, microphysdata, basemap=None, lon_name=None, lat_name=None, height_name=None, time_na...
stack_v2_sparse_classes_36k_train_022453
31,840
no_license
[ { "docstring": "Intitialize the class to create plots Parameters ---------- radar : dict AWOT radar instance. basemap : basemap instance lon_name : str Key in radar instance for longitude variable. None uses AWOT default. lat_name : str Key in radar instance for latitude variable. None uses AWOT default. height...
5
stack_v2_sparse_classes_30k_train_001790
Implement the Python class `MicrophysicalVerticalPlot` described below. Class description: Create a vertical plot of microphysical data. This class was created for microphysical retrievals from radar systems, for example the LATMOS French Falcon. Method signatures and docstrings: - def __init__(self, microphysdata, b...
Implement the Python class `MicrophysicalVerticalPlot` described below. Class description: Create a vertical plot of microphysical data. This class was created for microphysical retrievals from radar systems, for example the LATMOS French Falcon. Method signatures and docstrings: - def __init__(self, microphysdata, b...
0be59e6d8e500767634551c11d876252190111ac
<|skeleton|> class MicrophysicalVerticalPlot: """Create a vertical plot of microphysical data. This class was created for microphysical retrievals from radar systems, for example the LATMOS French Falcon.""" def __init__(self, microphysdata, basemap=None, lon_name=None, lat_name=None, height_name=None, time_na...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MicrophysicalVerticalPlot: """Create a vertical plot of microphysical data. This class was created for microphysical retrievals from radar systems, for example the LATMOS French Falcon.""" def __init__(self, microphysdata, basemap=None, lon_name=None, lat_name=None, height_name=None, time_name=None): ...
the_stack_v2_python_sparse
awot/graph/radar_vertical.py
tjlang/AWOT
train
0
706903ab7fc75bee1dbf4feabb11a502f0c2182e
[ "self.data = data\nif instruments is None:\n self.instruments = []\nelif set.intersection(set(exog), set(instruments)) != set([]):\n raise ValueError(\"Don't put cols in exog and instruments.\")\nelse:\n self.instruments = list(instruments)\nself.endog = endog\nself.exog = list(exog)\nself.n_moms = len(sel...
<|body_start_0|> self.data = data if instruments is None: self.instruments = [] elif set.intersection(set(exog), set(instruments)) != set([]): raise ValueError("Don't put cols in exog and instruments.") else: self.instruments = list(instruments) ...
Earns a class. example endog = ['hhninc'] exog = ['const', 'age', 'educ', 'female'] instruments = ['hsat', 'married'] obj = GMM(dta_gmm, endog, exog, instruments) res = obj.fit([-1, 1, .1, .2])
GMM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GMM: """Earns a class. example endog = ['hhninc'] exog = ['const', 'age', 'educ', 'female'] instruments = ['hsat', 'married'] obj = GMM(dta_gmm, endog, exog, instruments) res = obj.fit([-1, 1, .1, .2])""" def __init__(self, data, endog, exog, instruments=None, form='linear'): """data...
stack_v2_sparse_classes_36k_train_022454
3,058
no_license
[ { "docstring": "data: An entire dataframe endog: Str. Column name. exog: List: exogenous variables. instruments: list. Doesn't include exog. Probably want to add a formula option and integrate with patsy.", "name": "__init__", "signature": "def __init__(self, data, endog, exog, instruments=None, form='l...
3
stack_v2_sparse_classes_30k_train_008542
Implement the Python class `GMM` described below. Class description: Earns a class. example endog = ['hhninc'] exog = ['const', 'age', 'educ', 'female'] instruments = ['hsat', 'married'] obj = GMM(dta_gmm, endog, exog, instruments) res = obj.fit([-1, 1, .1, .2]) Method signatures and docstrings: - def __init__(self, ...
Implement the Python class `GMM` described below. Class description: Earns a class. example endog = ['hhninc'] exog = ['const', 'age', 'educ', 'female'] instruments = ['hsat', 'married'] obj = GMM(dta_gmm, endog, exog, instruments) res = obj.fit([-1, 1, .1, .2]) Method signatures and docstrings: - def __init__(self, ...
c987277e1eee12c17aa2febdc63a21dc587d9792
<|skeleton|> class GMM: """Earns a class. example endog = ['hhninc'] exog = ['const', 'age', 'educ', 'female'] instruments = ['hsat', 'married'] obj = GMM(dta_gmm, endog, exog, instruments) res = obj.fit([-1, 1, .1, .2])""" def __init__(self, data, endog, exog, instruments=None, form='linear'): """data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GMM: """Earns a class. example endog = ['hhninc'] exog = ['const', 'age', 'educ', 'female'] instruments = ['hsat', 'married'] obj = GMM(dta_gmm, endog, exog, instruments) res = obj.fit([-1, 1, .1, .2])""" def __init__(self, data, endog, exog, instruments=None, form='linear'): """data: An entire d...
the_stack_v2_python_sparse
new_start/GMM.py
TomAugspurger/data-wrangling
train
0
d9e557ec3e189281715e55d81fa18c5f3dcfe623
[ "B, C = features.shape[:2]\nfeatures = features.contiguous()\ncoords = coords.contiguous()\nouts, inds, wgts = trilinear_devoxelize_forward(resolution, is_training, coords, features)\nif is_training:\n ctx.save_for_backward(inds, wgts)\n ctx.r = resolution\nreturn outs", "inds, wgts = ctx.saved_tensors\ngra...
<|body_start_0|> B, C = features.shape[:2] features = features.contiguous() coords = coords.contiguous() outs, inds, wgts = trilinear_devoxelize_forward(resolution, is_training, coords, features) if is_training: ctx.save_for_backward(inds, wgts) ctx.r = re...
TrilinearDevoxelization
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrilinearDevoxelization: def forward(ctx, features, coords, resolution, is_training=True): """Forward pass for the Op. Args: ctx: torch Autograd context. coords: the coordinates of points, FloatTensor[B, 3, N] features: FloatTensor[B, C, R, R, R] resolution: int, the voxel resolution. is...
stack_v2_sparse_classes_36k_train_022455
22,879
permissive
[ { "docstring": "Forward pass for the Op. Args: ctx: torch Autograd context. coords: the coordinates of points, FloatTensor[B, 3, N] features: FloatTensor[B, C, R, R, R] resolution: int, the voxel resolution. is_training: bool, training mode. Returns: torch.FloatTensor: devoxelized features (B, C, N)", "name...
2
stack_v2_sparse_classes_30k_train_013063
Implement the Python class `TrilinearDevoxelization` described below. Class description: Implement the TrilinearDevoxelization class. Method signatures and docstrings: - def forward(ctx, features, coords, resolution, is_training=True): Forward pass for the Op. Args: ctx: torch Autograd context. coords: the coordinate...
Implement the Python class `TrilinearDevoxelization` described below. Class description: Implement the TrilinearDevoxelization class. Method signatures and docstrings: - def forward(ctx, features, coords, resolution, is_training=True): Forward pass for the Op. Args: ctx: torch Autograd context. coords: the coordinate...
51482281dc180786e7563c73c12ac5df89289748
<|skeleton|> class TrilinearDevoxelization: def forward(ctx, features, coords, resolution, is_training=True): """Forward pass for the Op. Args: ctx: torch Autograd context. coords: the coordinates of points, FloatTensor[B, 3, N] features: FloatTensor[B, C, R, R, R] resolution: int, the voxel resolution. is...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrilinearDevoxelization: def forward(ctx, features, coords, resolution, is_training=True): """Forward pass for the Op. Args: ctx: torch Autograd context. coords: the coordinates of points, FloatTensor[B, 3, N] features: FloatTensor[B, C, R, R, R] resolution: int, the voxel resolution. is_training: boo...
the_stack_v2_python_sparse
ml3d/torch/models/pvcnn.py
CosmosHua/Open3D-ML
train
0
608eda567b1c98079ef6384daee47e21bb89f84b
[ "writer = KvDbWriter(KvDbClient(**config))\nfor configured_stream in configured_catalog.streams:\n if configured_stream.destination_sync_mode == DestinationSyncMode.overwrite:\n writer.delete_stream_entries(configured_stream.stream.name)\nfor message in input_messages:\n if message.type == Type.STATE:\...
<|body_start_0|> writer = KvDbWriter(KvDbClient(**config)) for configured_stream in configured_catalog.streams: if configured_stream.destination_sync_mode == DestinationSyncMode.overwrite: writer.delete_stream_entries(configured_stream.stream.name) for message in inpu...
DestinationKvdb
[ "MIT", "Apache-2.0", "BSD-3-Clause", "Elastic-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DestinationKvdb: def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: """Reads the input stream of messages, config, and catalog to write data to the destination. This method return...
stack_v2_sparse_classes_36k_train_022456
3,439
permissive
[ { "docstring": "Reads the input stream of messages, config, and catalog to write data to the destination. This method returns an iterable (typically a generator of AirbyteMessages via yield) containing state messages received in the input message stream. Outputting a state message means that every AirbyteRecord...
2
stack_v2_sparse_classes_30k_train_013932
Implement the Python class `DestinationKvdb` described below. Class description: Implement the DestinationKvdb class. Method signatures and docstrings: - def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: Read...
Implement the Python class `DestinationKvdb` described below. Class description: Implement the DestinationKvdb class. Method signatures and docstrings: - def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: Read...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class DestinationKvdb: def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: """Reads the input stream of messages, config, and catalog to write data to the destination. This method return...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DestinationKvdb: def write(self, config: Mapping[str, Any], configured_catalog: ConfiguredAirbyteCatalog, input_messages: Iterable[AirbyteMessage]) -> Iterable[AirbyteMessage]: """Reads the input stream of messages, config, and catalog to write data to the destination. This method returns an iterable ...
the_stack_v2_python_sparse
dts/airbyte/airbyte-integrations/connectors/destination-kvdb/destination_kvdb/destination.py
alldatacenter/alldata
train
774
15707efd7e60e88e0f8a7fed6443b354c96b9833
[ "self.archive_log_enabled = archive_log_enabled\nself.bct_enabled = bct_enabled\nself.container_database_info = container_database_info\nself.data_guard_info = data_guard_info\nself.database_unique_name = database_unique_name\nself.db_type = db_type\nself.domain = domain\nself.fra_size = fra_size\nself.hosts = host...
<|body_start_0|> self.archive_log_enabled = archive_log_enabled self.bct_enabled = bct_enabled self.container_database_info = container_database_info self.data_guard_info = data_guard_info self.database_unique_name = database_unique_name self.db_type = db_type sel...
Implementation of the 'OracleProtectionSource' model. Specifies an Object representing one Oracle database. Attributes: archive_log_enabled (bool): Specifies whether the database is running in ARCHIVELOG mode. It enables the redo of log files into archived redo log files. bct_enabled (bool): Specifies whether the Block...
OracleProtectionSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OracleProtectionSource: """Implementation of the 'OracleProtectionSource' model. Specifies an Object representing one Oracle database. Attributes: archive_log_enabled (bool): Specifies whether the database is running in ARCHIVELOG mode. It enables the redo of log files into archived redo log file...
stack_v2_sparse_classes_36k_train_022457
8,462
permissive
[ { "docstring": "Constructor for the OracleProtectionSource class", "name": "__init__", "signature": "def __init__(self, archive_log_enabled=None, bct_enabled=None, container_database_info=None, data_guard_info=None, database_unique_name=None, db_type=None, domain=None, fra_size=None, hosts=None, name=No...
2
null
Implement the Python class `OracleProtectionSource` described below. Class description: Implementation of the 'OracleProtectionSource' model. Specifies an Object representing one Oracle database. Attributes: archive_log_enabled (bool): Specifies whether the database is running in ARCHIVELOG mode. It enables the redo o...
Implement the Python class `OracleProtectionSource` described below. Class description: Implementation of the 'OracleProtectionSource' model. Specifies an Object representing one Oracle database. Attributes: archive_log_enabled (bool): Specifies whether the database is running in ARCHIVELOG mode. It enables the redo o...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class OracleProtectionSource: """Implementation of the 'OracleProtectionSource' model. Specifies an Object representing one Oracle database. Attributes: archive_log_enabled (bool): Specifies whether the database is running in ARCHIVELOG mode. It enables the redo of log files into archived redo log file...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OracleProtectionSource: """Implementation of the 'OracleProtectionSource' model. Specifies an Object representing one Oracle database. Attributes: archive_log_enabled (bool): Specifies whether the database is running in ARCHIVELOG mode. It enables the redo of log files into archived redo log files. bct_enable...
the_stack_v2_python_sparse
cohesity_management_sdk/models/oracle_protection_source.py
cohesity/management-sdk-python
train
24
b38a14bc6c01abfa6d91e42a678285ac9adef3dc
[ "self.url: str | None = None\nself.token: str | None = None\nself.uuid: str | None = None", "errors = {}\nplaceholders = {'local_token': '/112f7a4a-0051-cc2b-3b61-1898181b9950', 'find_token': '0481effe8a5c6f757b455babb678dc0e764feae279/112f7a4a-0051-cc2b-3b61-1898181b9950', 'local_url': 'ws://192.168.1.39:8083', ...
<|body_start_0|> self.url: str | None = None self.token: str | None = None self.uuid: str | None = None <|end_body_0|> <|body_start_1|> errors = {} placeholders = {'local_token': '/112f7a4a-0051-cc2b-3b61-1898181b9950', 'find_token': '0481effe8a5c6f757b455babb678dc0e764feae279/1...
ZWaveMe integration config flow.
ZWaveMeConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZWaveMeConfigFlow: """ZWaveMe integration config flow.""" def __init__(self) -> None: """Initialize flow.""" <|body_0|> async def async_step_user(self, user_input: dict[str, str] | None=None) -> FlowResult: """Handle a flow initialized by the user or started with...
stack_v2_sparse_classes_36k_train_022458
3,507
permissive
[ { "docstring": "Initialize flow.", "name": "__init__", "signature": "def __init__(self) -> None" }, { "docstring": "Handle a flow initialized by the user or started with zeroconf.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input: dict[str, str] | None...
3
null
Implement the Python class `ZWaveMeConfigFlow` described below. Class description: ZWaveMe integration config flow. Method signatures and docstrings: - def __init__(self) -> None: Initialize flow. - async def async_step_user(self, user_input: dict[str, str] | None=None) -> FlowResult: Handle a flow initialized by the...
Implement the Python class `ZWaveMeConfigFlow` described below. Class description: ZWaveMe integration config flow. Method signatures and docstrings: - def __init__(self) -> None: Initialize flow. - async def async_step_user(self, user_input: dict[str, str] | None=None) -> FlowResult: Handle a flow initialized by the...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ZWaveMeConfigFlow: """ZWaveMe integration config flow.""" def __init__(self) -> None: """Initialize flow.""" <|body_0|> async def async_step_user(self, user_input: dict[str, str] | None=None) -> FlowResult: """Handle a flow initialized by the user or started with...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZWaveMeConfigFlow: """ZWaveMe integration config flow.""" def __init__(self) -> None: """Initialize flow.""" self.url: str | None = None self.token: str | None = None self.uuid: str | None = None async def async_step_user(self, user_input: dict[str, str] | None=None) ...
the_stack_v2_python_sparse
homeassistant/components/zwave_me/config_flow.py
home-assistant/core
train
35,501
ffbcf06dfb4ca6f267808f4235baf87d86dcaf11
[ "E0 = a0 * m_e * c ** 2 * k0 / e\nzr = 0.5 * k0 * waist ** 2\nself.m = m\nself.n = n\nself.k0 = k0\nself.waist = waist\nself.zr = zr\nself.inv_tau = 1.0 / tau\nself.t_peak = t_peak\nself.E0 = E0\nself.v_antenna = source_v\nself.focal_length = focal_length\nself.boost = boost\nself.temporal_order = temporal_order\ns...
<|body_start_0|> E0 = a0 * m_e * c ** 2 * k0 / e zr = 0.5 * k0 * waist ** 2 self.m = m self.n = n self.k0 = k0 self.waist = waist self.zr = zr self.inv_tau = 1.0 / tau self.t_peak = t_peak self.E0 = E0 self.v_antenna = source_v ...
Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2)^(1/2) and \\phi = arctan(y/x). n and m are specific parameters to calculate the Laguerre...
LaguerreGaussianProfile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LaguerreGaussianProfile: """Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2)^(1/2) and \\phi = arctan(y/x). n and ...
stack_v2_sparse_classes_36k_train_022459
34,589
permissive
[ { "docstring": "Define a Laguerre-Gaussian laser profile. (Laguerre-Gaussian transversally, hypergaussian longitudinally) This object can then be passed to the `EM3D` class, as the argument `laser_func`, in order to have a LG laser emitted by the antenna. Parameters: ----------- m, n: integer (dimensionless) La...
2
null
Implement the Python class `LaguerreGaussianProfile` described below. Class description: Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2...
Implement the Python class `LaguerreGaussianProfile` described below. Class description: Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2...
091c982f82788209017315e13eb7d0e743687d46
<|skeleton|> class LaguerreGaussianProfile: """Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2)^(1/2) and \\phi = arctan(y/x). n and ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LaguerreGaussianProfile: """Class that calculates a Laguerre-Gaussian laser pulse. A typical LG pulse is defined as : E(x,y,z) = \\left( rac{r \\sqrt{2}}{w} ight)^n L_{mn} \\left[ rac{2 r^2}{w^2} ight] e^{- i n arphi} \\; GaussianProfile where r = (x^2 + y^2)^(1/2) and \\phi = arctan(y/x). n and m are specifi...
the_stack_v2_python_sparse
scripts/field_solvers/laser/laser_profiles.py
giadarol/warp
train
0
809e0ddfe452d0539740c3110e4a7058ae5de761
[ "user_events = self.user_events(user_obj)\nsubmitted_cases = set()\nfor event in user_events:\n if event.get('verb') != 'mme_add':\n continue\n case_obj = self.case(case_id=event.get('case'))\n if case_obj is None:\n continue\n if case_obj.get('mme_submission') is None or case_obj['mme_sub...
<|body_start_0|> user_events = self.user_events(user_obj) submitted_cases = set() for event in user_events: if event.get('verb') != 'mme_add': continue case_obj = self.case(case_id=event.get('case')) if case_obj is None: continu...
Class to handle case submissions to MatchMaker Exchange
MMEHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MMEHandler: """Class to handle case submissions to MatchMaker Exchange""" def user_mme_submissions(self, user_obj): """Return a set of all case _ids submitted to the Matchmaker Exchange by a user. Args: user_obj(dict): a scout user object Returns: submitted_cases(set); a set of case ...
stack_v2_sparse_classes_36k_train_022460
6,236
permissive
[ { "docstring": "Return a set of all case _ids submitted to the Matchmaker Exchange by a user. Args: user_obj(dict): a scout user object Returns: submitted_cases(set); a set of case _ids", "name": "user_mme_submissions", "signature": "def user_mme_submissions(self, user_obj)" }, { "docstring": "R...
4
null
Implement the Python class `MMEHandler` described below. Class description: Class to handle case submissions to MatchMaker Exchange Method signatures and docstrings: - def user_mme_submissions(self, user_obj): Return a set of all case _ids submitted to the Matchmaker Exchange by a user. Args: user_obj(dict): a scout ...
Implement the Python class `MMEHandler` described below. Class description: Class to handle case submissions to MatchMaker Exchange Method signatures and docstrings: - def user_mme_submissions(self, user_obj): Return a set of all case _ids submitted to the Matchmaker Exchange by a user. Args: user_obj(dict): a scout ...
1e6a633ba0a83495047ee7b66db1ebf690ee465f
<|skeleton|> class MMEHandler: """Class to handle case submissions to MatchMaker Exchange""" def user_mme_submissions(self, user_obj): """Return a set of all case _ids submitted to the Matchmaker Exchange by a user. Args: user_obj(dict): a scout user object Returns: submitted_cases(set); a set of case ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MMEHandler: """Class to handle case submissions to MatchMaker Exchange""" def user_mme_submissions(self, user_obj): """Return a set of all case _ids submitted to the Matchmaker Exchange by a user. Args: user_obj(dict): a scout user object Returns: submitted_cases(set); a set of case _ids""" ...
the_stack_v2_python_sparse
scout/adapter/mongo/matchmaker.py
Clinical-Genomics/scout
train
143
2526648dfc1c8c959ea71e3f19dddf33015f6782
[ "parsed = item.parsed\nstatus_list = ['HPR status = %s' % self.DecodeChar(parsed.flag, self.decoder.GBS_FLAG_DECODE)]\nself.FormatGBS(item, extra=status_list)", "parsed = item.parsed\ndecoded = item.decoded\ntime_list = ['SBAS status for GPS week/second %s/%s' % (parsed.week, parsed.second)]\nif decoded.dtime:\n ...
<|body_start_0|> parsed = item.parsed status_list = ['HPR status = %s' % self.DecodeChar(parsed.flag, self.decoder.GBS_FLAG_DECODE)] self.FormatGBS(item, extra=status_list) <|end_body_0|> <|body_start_1|> parsed = item.parsed decoded = item.decoded time_list = ['SBAS sta...
Class for Hemisphere/Geneq NMEA formatter objects.
NmeaFormatter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NmeaFormatter: """Class for Hemisphere/Geneq NMEA formatter objects.""" def FormatPSAT_GBS(self, item): """Format a PSAT,GBS sentence.""" <|body_0|> def FormatRD1(self, item): """Format an RD1 sentence.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022461
23,235
no_license
[ { "docstring": "Format a PSAT,GBS sentence.", "name": "FormatPSAT_GBS", "signature": "def FormatPSAT_GBS(self, item)" }, { "docstring": "Format an RD1 sentence.", "name": "FormatRD1", "signature": "def FormatRD1(self, item)" } ]
2
null
Implement the Python class `NmeaFormatter` described below. Class description: Class for Hemisphere/Geneq NMEA formatter objects. Method signatures and docstrings: - def FormatPSAT_GBS(self, item): Format a PSAT,GBS sentence. - def FormatRD1(self, item): Format an RD1 sentence.
Implement the Python class `NmeaFormatter` described below. Class description: Class for Hemisphere/Geneq NMEA formatter objects. Method signatures and docstrings: - def FormatPSAT_GBS(self, item): Format a PSAT,GBS sentence. - def FormatRD1(self, item): Format an RD1 sentence. <|skeleton|> class NmeaFormatter: ...
1a6471dfbd7ec27f3d9f42b49173d18761a8f5aa
<|skeleton|> class NmeaFormatter: """Class for Hemisphere/Geneq NMEA formatter objects.""" def FormatPSAT_GBS(self, item): """Format a PSAT,GBS sentence.""" <|body_0|> def FormatRD1(self, item): """Format an RD1 sentence.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NmeaFormatter: """Class for Hemisphere/Geneq NMEA formatter objects.""" def FormatPSAT_GBS(self, item): """Format a PSAT,GBS sentence.""" parsed = item.parsed status_list = ['HPR status = %s' % self.DecodeChar(parsed.flag, self.decoder.GBS_FLAG_DECODE)] self.FormatGBS(item...
the_stack_v2_python_sparse
fwgnss/format/hemisphere.py
fhgwright/fwgnss
train
2
347742d07c623bc4c91b6d8fa90d2bb14ae0ee3b
[ "super().__init__(config, global_config, parent)\nself._temp_dir = self.config.get('temp_dir')\nself.register([self.temp_dir_context])", "if path is None and self._temp_dir is None:\n return TemporaryDirectory()\nreturn nullcontext(path or self._temp_dir)" ]
<|body_start_0|> super().__init__(config, global_config, parent) self._temp_dir = self.config.get('temp_dir') self.register([self.temp_dir_context]) <|end_body_0|> <|body_start_1|> if path is None and self._temp_dir is None: return TemporaryDirectory() return nullcon...
A *base* service class that provides a method to create a temporary directory context for local scripts. It is inherited by LocalExecService and MockLocalExecService. This class is not supposed to be used as a standalone service.
TempDirContextService
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempDirContextService: """A *base* service class that provides a method to create a temporary directory context for local scripts. It is inherited by LocalExecService and MockLocalExecService. This class is not supposed to be used as a standalone service.""" def __init__(self, config: Option...
stack_v2_sparse_classes_36k_train_022462
2,199
permissive
[ { "docstring": "Create a new instance of a service that provides temporary directory context for local exec service. Parameters ---------- config : dict Free-format dictionary that contains parameters for the service. (E.g., root path for config files, etc.) global_config : dict Free-format dictionary of global...
2
stack_v2_sparse_classes_30k_train_008572
Implement the Python class `TempDirContextService` described below. Class description: A *base* service class that provides a method to create a temporary directory context for local scripts. It is inherited by LocalExecService and MockLocalExecService. This class is not supposed to be used as a standalone service. M...
Implement the Python class `TempDirContextService` described below. Class description: A *base* service class that provides a method to create a temporary directory context for local scripts. It is inherited by LocalExecService and MockLocalExecService. This class is not supposed to be used as a standalone service. M...
0db80043dad256d77dc4c2b4fc54aa0b0aa2597f
<|skeleton|> class TempDirContextService: """A *base* service class that provides a method to create a temporary directory context for local scripts. It is inherited by LocalExecService and MockLocalExecService. This class is not supposed to be used as a standalone service.""" def __init__(self, config: Option...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TempDirContextService: """A *base* service class that provides a method to create a temporary directory context for local scripts. It is inherited by LocalExecService and MockLocalExecService. This class is not supposed to be used as a standalone service.""" def __init__(self, config: Optional[Dict[str, ...
the_stack_v2_python_sparse
mlos_bench/mlos_bench/services/local/temp_dir_context.py
microsoft/MLOS
train
109
9e3e9c30f9b8440388e8e6677e1d7cc7b14c7f91
[ "e = Inventory('test product code', 'test description', 'test market price', 'test rental price')\nself.assertEqual(e.product_code, 'test product code')\nself.assertEqual(e.description, 'test description')\nself.assertEqual(e.market_price, 'test market price')\nself.assertEqual(e.rental_price, 'test rental price')"...
<|body_start_0|> e = Inventory('test product code', 'test description', 'test market price', 'test rental price') self.assertEqual(e.product_code, 'test product code') self.assertEqual(e.description, 'test description') self.assertEqual(e.market_price, 'test market price') self.a...
InventoryTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InventoryTest: def test_inventory_init(self): """Tests that Inventory can be initiated""" <|body_0|> def test_inventory_return(self): """Tests Inventory return_as_dictionary""" <|body_1|> <|end_skeleton|> <|body_start_0|> e = Inventory('test product...
stack_v2_sparse_classes_36k_train_022463
9,076
no_license
[ { "docstring": "Tests that Inventory can be initiated", "name": "test_inventory_init", "signature": "def test_inventory_init(self)" }, { "docstring": "Tests Inventory return_as_dictionary", "name": "test_inventory_return", "signature": "def test_inventory_return(self)" } ]
2
stack_v2_sparse_classes_30k_train_010590
Implement the Python class `InventoryTest` described below. Class description: Implement the InventoryTest class. Method signatures and docstrings: - def test_inventory_init(self): Tests that Inventory can be initiated - def test_inventory_return(self): Tests Inventory return_as_dictionary
Implement the Python class `InventoryTest` described below. Class description: Implement the InventoryTest class. Method signatures and docstrings: - def test_inventory_init(self): Tests that Inventory can be initiated - def test_inventory_return(self): Tests Inventory return_as_dictionary <|skeleton|> class Invento...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class InventoryTest: def test_inventory_init(self): """Tests that Inventory can be initiated""" <|body_0|> def test_inventory_return(self): """Tests Inventory return_as_dictionary""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InventoryTest: def test_inventory_init(self): """Tests that Inventory can be initiated""" e = Inventory('test product code', 'test description', 'test market price', 'test rental price') self.assertEqual(e.product_code, 'test product code') self.assertEqual(e.description, 'test...
the_stack_v2_python_sparse
students/kyle_lehning/Lesson01/test_unit.py
JavaRod/SP_Python220B_2019
train
1
f41d9aa5ce5dcd04cc01b1109a73dcee668ac3df
[ "super(Decoder, self).__init__()\nself.batch_size = batch_size\nself.dec_units = dec_units\nself.embedding = tf.keras.layers.Embedding(input_dim=vocab_size, output_dim=embedding_dim)\nself.gru = tf.keras.layers.GRU(units=self.dec_units, return_sequences=True, return_state=True, recurrent_initializer='glorot_uniform...
<|body_start_0|> super(Decoder, self).__init__() self.batch_size = batch_size self.dec_units = dec_units self.embedding = tf.keras.layers.Embedding(input_dim=vocab_size, output_dim=embedding_dim) self.gru = tf.keras.layers.GRU(units=self.dec_units, return_sequences=True, return_s...
The decoder model.
Decoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """The decoder model.""" def __init__(self, vocab_size, embedding_dim, dec_units, batch_size): """The structure function. Args: vocab_size: The target language vocabulary size. embedding_dim: The embedding dimension. dec_units: The decoder hidden units. batch_size: The batch...
stack_v2_sparse_classes_36k_train_022464
20,417
no_license
[ { "docstring": "The structure function. Args: vocab_size: The target language vocabulary size. embedding_dim: The embedding dimension. dec_units: The decoder hidden units. batch_size: The batch size.", "name": "__init__", "signature": "def __init__(self, vocab_size, embedding_dim, dec_units, batch_size)...
2
stack_v2_sparse_classes_30k_train_018424
Implement the Python class `Decoder` described below. Class description: The decoder model. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_dim, dec_units, batch_size): The structure function. Args: vocab_size: The target language vocabulary size. embedding_dim: The embedding dimension. d...
Implement the Python class `Decoder` described below. Class description: The decoder model. Method signatures and docstrings: - def __init__(self, vocab_size, embedding_dim, dec_units, batch_size): The structure function. Args: vocab_size: The target language vocabulary size. embedding_dim: The embedding dimension. d...
d1b70b2a954f4665b628ba252b03c1a74b95559f
<|skeleton|> class Decoder: """The decoder model.""" def __init__(self, vocab_size, embedding_dim, dec_units, batch_size): """The structure function. Args: vocab_size: The target language vocabulary size. embedding_dim: The embedding dimension. dec_units: The decoder hidden units. batch_size: The batch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder: """The decoder model.""" def __init__(self, vocab_size, embedding_dim, dec_units, batch_size): """The structure function. Args: vocab_size: The target language vocabulary size. embedding_dim: The embedding dimension. dec_units: The decoder hidden units. batch_size: The batch size.""" ...
the_stack_v2_python_sparse
NeuralNetworks-tensorflow/RNN/nmt_with_attention/nmt.py
zhaocc1106/machine_learn
train
15
435f48322403ca8e571f3bccfe8cc3a0a1677b7e
[ "super().__init__()\ncheck_boundaries(boundaries)\nself.boundaries = boundaries", "self.randomize(None)\nself.magnitude = self.R.uniform(low=self.boundaries[0], high=self.boundaries[1])\nsignal = convert_to_tensor(self.magnitude * signal)\nreturn signal" ]
<|body_start_0|> super().__init__() check_boundaries(boundaries) self.boundaries = boundaries <|end_body_0|> <|body_start_1|> self.randomize(None) self.magnitude = self.R.uniform(low=self.boundaries[0], high=self.boundaries[1]) signal = convert_to_tensor(self.magnitude *...
Apply a random rescaling on a signal
SignalRandScale
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignalRandScale: """Apply a random rescaling on a signal""" def __init__(self, boundaries: Sequence[float]=(-1.0, 1.0)) -> None: """Args: boundaries: list defining lower and upper boundaries for the signal scaling, default : ``[-1.0, 1.0]``""" <|body_0|> def __call__(sel...
stack_v2_sparse_classes_36k_train_022465
16,322
permissive
[ { "docstring": "Args: boundaries: list defining lower and upper boundaries for the signal scaling, default : ``[-1.0, 1.0]``", "name": "__init__", "signature": "def __init__(self, boundaries: Sequence[float]=(-1.0, 1.0)) -> None" }, { "docstring": "Args: signal: input 1 dimension signal to be sc...
2
stack_v2_sparse_classes_30k_val_001174
Implement the Python class `SignalRandScale` described below. Class description: Apply a random rescaling on a signal Method signatures and docstrings: - def __init__(self, boundaries: Sequence[float]=(-1.0, 1.0)) -> None: Args: boundaries: list defining lower and upper boundaries for the signal scaling, default : ``...
Implement the Python class `SignalRandScale` described below. Class description: Apply a random rescaling on a signal Method signatures and docstrings: - def __init__(self, boundaries: Sequence[float]=(-1.0, 1.0)) -> None: Args: boundaries: list defining lower and upper boundaries for the signal scaling, default : ``...
e48c3e2c741fa3fc705c4425d17ac4a5afac6c47
<|skeleton|> class SignalRandScale: """Apply a random rescaling on a signal""" def __init__(self, boundaries: Sequence[float]=(-1.0, 1.0)) -> None: """Args: boundaries: list defining lower and upper boundaries for the signal scaling, default : ``[-1.0, 1.0]``""" <|body_0|> def __call__(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignalRandScale: """Apply a random rescaling on a signal""" def __init__(self, boundaries: Sequence[float]=(-1.0, 1.0)) -> None: """Args: boundaries: list defining lower and upper boundaries for the signal scaling, default : ``[-1.0, 1.0]``""" super().__init__() check_boundaries(b...
the_stack_v2_python_sparse
monai/transforms/signal/array.py
Project-MONAI/MONAI
train
4,805
d45c0a98cf5d1ee7a2f539e6448716fb3487232a
[ "out_module_path = self.path + module_name + '/' + self.outpath_foldername + '/' + project_name + '/' + self.map_outputpath_folder[self.projects[project_name]['by']] + '/'\nif not os.path.exists(out_module_path):\n os.makedirs(out_module_path)\nreturn out_module_path", "res_module_path = self.path + module_nam...
<|body_start_0|> out_module_path = self.path + module_name + '/' + self.outpath_foldername + '/' + project_name + '/' + self.map_outputpath_folder[self.projects[project_name]['by']] + '/' if not os.path.exists(out_module_path): os.makedirs(out_module_path) return out_module_path <|en...
Framework
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Framework: def get_outfolder_path(self, project_name, module_name): """Get the output folder path :param project_name: :param module_name: :return:""" <|body_0|> def get_resfolder_path(self, project_name, module_name): """Get the output folder path :param project_nam...
stack_v2_sparse_classes_36k_train_022466
1,538
no_license
[ { "docstring": "Get the output folder path :param project_name: :param module_name: :return:", "name": "get_outfolder_path", "signature": "def get_outfolder_path(self, project_name, module_name)" }, { "docstring": "Get the output folder path :param project_name: :param module_name: :return:", ...
2
null
Implement the Python class `Framework` described below. Class description: Implement the Framework class. Method signatures and docstrings: - def get_outfolder_path(self, project_name, module_name): Get the output folder path :param project_name: :param module_name: :return: - def get_resfolder_path(self, project_nam...
Implement the Python class `Framework` described below. Class description: Implement the Framework class. Method signatures and docstrings: - def get_outfolder_path(self, project_name, module_name): Get the output folder path :param project_name: :param module_name: :return: - def get_resfolder_path(self, project_nam...
f434776eb5966f706e6190b8ab576bf98229715f
<|skeleton|> class Framework: def get_outfolder_path(self, project_name, module_name): """Get the output folder path :param project_name: :param module_name: :return:""" <|body_0|> def get_resfolder_path(self, project_name, module_name): """Get the output folder path :param project_nam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Framework: def get_outfolder_path(self, project_name, module_name): """Get the output folder path :param project_name: :param module_name: :return:""" out_module_path = self.path + module_name + '/' + self.outpath_foldername + '/' + project_name + '/' + self.map_outputpath_folder[self.projects...
the_stack_v2_python_sparse
mailib/workflow/workflow.py
TomCMM/sib2_reg_lcb
train
0
601b34671aee6f548308167563fc3ef7fa7b2aeb
[ "if 'username' in request.COOKIES:\n username = request.COOKIES.get('username')\n checked = 'checked'\nelse:\n username = ''\n checked = ''\nreturn render(request, 'login.html', {'username': username, 'checked': checked})", "username = request.POST.get('username')\npassword = request.POST.get('pwd')\n...
<|body_start_0|> if 'username' in request.COOKIES: username = request.COOKIES.get('username') checked = 'checked' else: username = '' checked = '' return render(request, 'login.html', {'username': username, 'checked': checked}) <|end_body_0|> <|bo...
登录
LoginView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginView: """登录""" def get(self, request): """显示登录页面""" <|body_0|> def post(self, request): """登录校验""" <|body_1|> <|end_skeleton|> <|body_start_0|> if 'username' in request.COOKIES: username = request.COOKIES.get('username') ...
stack_v2_sparse_classes_36k_train_022467
12,479
no_license
[ { "docstring": "显示登录页面", "name": "get", "signature": "def get(self, request)" }, { "docstring": "登录校验", "name": "post", "signature": "def post(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_007048
Implement the Python class `LoginView` described below. Class description: 登录 Method signatures and docstrings: - def get(self, request): 显示登录页面 - def post(self, request): 登录校验
Implement the Python class `LoginView` described below. Class description: 登录 Method signatures and docstrings: - def get(self, request): 显示登录页面 - def post(self, request): 登录校验 <|skeleton|> class LoginView: """登录""" def get(self, request): """显示登录页面""" <|body_0|> def post(self, request)...
e19d2aee1aa9433598ac3c0a2a73b0c1e8fa6dc2
<|skeleton|> class LoginView: """登录""" def get(self, request): """显示登录页面""" <|body_0|> def post(self, request): """登录校验""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginView: """登录""" def get(self, request): """显示登录页面""" if 'username' in request.COOKIES: username = request.COOKIES.get('username') checked = 'checked' else: username = '' checked = '' return render(request, 'login.html', {...
the_stack_v2_python_sparse
Django天天生鲜项目/dailyfresh/apps/user/views.py
sunday2146/notes-python
train
0
2aca7201a16cc48e3c2f8c1e1c24ab5e6ea33946
[ "if analysis == 'default':\n analysis = ProcessTomographyAnalysis()\nsuper().__init__(circuit, backend=backend, physical_qubits=physical_qubits, measurement_basis=measurement_basis, measurement_indices=measurement_indices, preparation_basis=preparation_basis, preparation_indices=preparation_indices, basis_indice...
<|body_start_0|> if analysis == 'default': analysis = ProcessTomographyAnalysis() super().__init__(circuit, backend=backend, physical_qubits=physical_qubits, measurement_basis=measurement_basis, measurement_indices=measurement_indices, preparation_basis=preparation_basis, preparation_indices...
An experiment to reconstruct the quantum channel from measurement data. # section: overview Quantum process tomography (QPT) is a method for experimentally reconstructing the quantum channel from measurement data. A QPT experiment prepares multiple input states, evolves them by the circuit, then performs multiple measu...
ProcessTomography
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessTomography: """An experiment to reconstruct the quantum channel from measurement data. # section: overview Quantum process tomography (QPT) is a method for experimentally reconstructing the quantum channel from measurement data. A QPT experiment prepares multiple input states, evolves them...
stack_v2_sparse_classes_36k_train_022468
8,445
permissive
[ { "docstring": "Initialize a quantum process tomography experiment. Args: circuit: the quantum process circuit. If not a quantum circuit it must be a class that can be appended to a quantum circuit. backend: The backend to run the experiment on. physical_qubits: Optional, the physical qubits for the initial sta...
2
null
Implement the Python class `ProcessTomography` described below. Class description: An experiment to reconstruct the quantum channel from measurement data. # section: overview Quantum process tomography (QPT) is a method for experimentally reconstructing the quantum channel from measurement data. A QPT experiment prepa...
Implement the Python class `ProcessTomography` described below. Class description: An experiment to reconstruct the quantum channel from measurement data. # section: overview Quantum process tomography (QPT) is a method for experimentally reconstructing the quantum channel from measurement data. A QPT experiment prepa...
a387675a3fe817cef05b968bbf3e05799a09aaae
<|skeleton|> class ProcessTomography: """An experiment to reconstruct the quantum channel from measurement data. # section: overview Quantum process tomography (QPT) is a method for experimentally reconstructing the quantum channel from measurement data. A QPT experiment prepares multiple input states, evolves them...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProcessTomography: """An experiment to reconstruct the quantum channel from measurement data. # section: overview Quantum process tomography (QPT) is a method for experimentally reconstructing the quantum channel from measurement data. A QPT experiment prepares multiple input states, evolves them by the circu...
the_stack_v2_python_sparse
qiskit_experiments/library/tomography/qpt_experiment.py
oliverdial/qiskit-experiments
train
0
53973b6b80f6edba5b116abe619814ed25b840bd
[ "self.time_horizon = 6 * 3600\nlength_scale = np.array([_DISTANCE_SCALING, _DISTANCE_SCALING, _PRESSURE_SCALING, _TIME_SCALING])\nself.kernel = _SIGMA_EXP_SQUARED * gaussian_process.kernels.Matern(length_scale=length_scale, length_scale_bounds='fixed', nu=0.5)\nself.model = gaussian_process.GaussianProcessRegressor...
<|body_start_0|> self.time_horizon = 6 * 3600 length_scale = np.array([_DISTANCE_SCALING, _DISTANCE_SCALING, _PRESSURE_SCALING, _TIME_SCALING]) self.kernel = _SIGMA_EXP_SQUARED * gaussian_process.kernels.Matern(length_scale=length_scale, length_scale_bounds='fixed', nu=0.5) self.model = ...
Wrapper around a Gaussian Process that handles wind measurements. This object models deviations from the forecast ("errors") using a Gaussian process over the 4-dimensional space (x, y, pressure, time). New measurements are integrated into the GP. Queries return the GP's prediction regarding particular 4D location's wi...
WindGP
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WindGP: """Wrapper around a Gaussian Process that handles wind measurements. This object models deviations from the forecast ("errors") using a Gaussian process over the 4-dimensional space (x, y, pressure, time). New measurements are integrated into the GP. Queries return the GP's prediction reg...
stack_v2_sparse_classes_36k_train_022469
9,541
permissive
[ { "docstring": "Constructor for the WindGP. TODO(bellemare): Currently a forecast is required. This simplifies the code somewhat. Whether we keep this depends on a design choice: is a new environment built up and torn down per episode, or do we instead use reset() functions to reuse objects? Args: forecast: the...
6
null
Implement the Python class `WindGP` described below. Class description: Wrapper around a Gaussian Process that handles wind measurements. This object models deviations from the forecast ("errors") using a Gaussian process over the 4-dimensional space (x, y, pressure, time). New measurements are integrated into the GP....
Implement the Python class `WindGP` described below. Class description: Wrapper around a Gaussian Process that handles wind measurements. This object models deviations from the forecast ("errors") using a Gaussian process over the 4-dimensional space (x, y, pressure, time). New measurements are integrated into the GP....
72082feccf404e5bf946e513e4f6c0ae8fb279ad
<|skeleton|> class WindGP: """Wrapper around a Gaussian Process that handles wind measurements. This object models deviations from the forecast ("errors") using a Gaussian process over the 4-dimensional space (x, y, pressure, time). New measurements are integrated into the GP. Queries return the GP's prediction reg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WindGP: """Wrapper around a Gaussian Process that handles wind measurements. This object models deviations from the forecast ("errors") using a Gaussian process over the 4-dimensional space (x, y, pressure, time). New measurements are integrated into the GP. Queries return the GP's prediction regarding partic...
the_stack_v2_python_sparse
balloon_learning_environment/env/wind_gp.py
google/balloon-learning-environment
train
108
02210bcca96804748a836b6cc4f8043162ef4535
[ "try:\n db_creds = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../config/db_creds.json')\n user_creds = json.load(open(db_creds, 'r'))['elastic'][access]\n hosts = user_creds['hosts']\n http_auth = (user_creds['user'], user_creds['pass'])\nexcept:\n env_vars = ['ELASTIC_HOST', 'ELASTIC_...
<|body_start_0|> try: db_creds = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../config/db_creds.json') user_creds = json.load(open(db_creds, 'r'))['elastic'][access] hosts = user_creds['hosts'] http_auth = (user_creds['user'], user_creds['pass']) ...
Class representing a connection to the Elastic Cloud cluster (ElasticSearch)
ElasticConnection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElasticConnection: """Class representing a connection to the Elastic Cloud cluster (ElasticSearch)""" def __init__(self, local=local, access='read_only'): """Args: local (bool): True to use local config file, False for environment variables. Default: False access (str): Level of acce...
stack_v2_sparse_classes_36k_train_022470
6,259
no_license
[ { "docstring": "Args: local (bool): True to use local config file, False for environment variables. Default: False access (str): Level of access. e.g. \"admin\", \"read_only\", or \"annotator\" db (str): Desired database. e.g. \"test\" or \"production\" Returns: pymongo Client.", "name": "__init__", "si...
2
stack_v2_sparse_classes_30k_train_009533
Implement the Python class `ElasticConnection` described below. Class description: Class representing a connection to the Elastic Cloud cluster (ElasticSearch) Method signatures and docstrings: - def __init__(self, local=local, access='read_only'): Args: local (bool): True to use local config file, False for environm...
Implement the Python class `ElasticConnection` described below. Class description: Class representing a connection to the Elastic Cloud cluster (ElasticSearch) Method signatures and docstrings: - def __init__(self, local=local, access='read_only'): Args: local (bool): True to use local config file, False for environm...
b10cd933cbfaa969e00f68ad7a895be447472163
<|skeleton|> class ElasticConnection: """Class representing a connection to the Elastic Cloud cluster (ElasticSearch)""" def __init__(self, local=local, access='read_only'): """Args: local (bool): True to use local config file, False for environment variables. Default: False access (str): Level of acce...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElasticConnection: """Class representing a connection to the Elastic Cloud cluster (ElasticSearch)""" def __init__(self, local=local, access='read_only'): """Args: local (bool): True to use local config file, False for environment variables. Default: False access (str): Level of access. e.g. "adm...
the_stack_v2_python_sparse
matstract/models/database.py
abhinavwidak/matstract
train
0
fa5ebecb56a13ae944e4edc225880237395e5342
[ "if isinstance(init, type(self)):\n self.elec = fields.electric(init.elec)\n self.magn = fields.magnetic(init.magn)\nelif isinstance(init, tuple) and (init[1] is None or isinstance(init[1], MPI.Intracomm)) and isinstance(init[2], np.dtype):\n if isinstance(val, int) or isinstance(val, float) or val is None...
<|body_start_0|> if isinstance(init, type(self)): self.elec = fields.electric(init.elec) self.magn = fields.magnetic(init.magn) elif isinstance(init, tuple) and (init[1] is None or isinstance(init[1], MPI.Intracomm)) and isinstance(init[2], np.dtype): if isinstance(va...
Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field
fields
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class fields: """Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field""" def __init__(self, init=None, val=None): """Initialization routine Args: init: ca...
stack_v2_sparse_classes_36k_train_022471
10,653
permissive
[ { "docstring": "Initialization routine Args: init: can either be a number or another fields object val: initial tuple of values for electric and magnetic (default: (None,None)) Raises: DataError: if init is none of the types above", "name": "__init__", "signature": "def __init__(self, init=None, val=Non...
4
stack_v2_sparse_classes_30k_train_000949
Implement the Python class `fields` described below. Class description: Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field Method signatures and docstrings: - def __init__(self, in...
Implement the Python class `fields` described below. Class description: Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field Method signatures and docstrings: - def __init__(self, in...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class fields: """Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field""" def __init__(self, init=None, val=None): """Initialization routine Args: init: ca...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class fields: """Field data type for 3 dimensions This data type can be used for electric and magnetic fields in 3 dimensions Attributes: elec: contains the electric field magn: contains the magnetic field""" def __init__(self, init=None, val=None): """Initialization routine Args: init: can either be a...
the_stack_v2_python_sparse
pySDC/implementations/datatype_classes/particles.py
Parallel-in-Time/pySDC
train
30
a15b47281b8f27ebdee044ce287707f5ccb39a37
[ "self.Whf = np.random.normal(size=(h + i, h))\nself.Whb = np.random.normal(size=(h + i, h))\nself.Wy = np.random.normal(size=(2 * h, o))\nself.bhf = np.zeros((1, h))\nself.bhb = np.zeros((1, h))\nself.by = np.zeros((1, o))", "h_x = np.concatenate((h_prev, x_t), axis=1)\nh_next = np.tanh(np.matmul(h_x, self.Whf) +...
<|body_start_0|> self.Whf = np.random.normal(size=(h + i, h)) self.Whb = np.random.normal(size=(h + i, h)) self.Wy = np.random.normal(size=(2 * h, o)) self.bhf = np.zeros((1, h)) self.bhb = np.zeros((1, h)) self.by = np.zeros((1, o)) <|end_body_0|> <|body_start_1|> ...
epresents a bidirectional cell of an RNN
BidirectionalCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BidirectionalCell: """epresents a bidirectional cell of an RNN""" def __init__(self, i, h, o): """- i is the dimensionality of the data - h is the dimensionality of the hidden states - o is the dimensionality of the outputs Creates the public instance attributes Whf, Whb, Wy, bhf, bh...
stack_v2_sparse_classes_36k_train_022472
1,728
no_license
[ { "docstring": "- i is the dimensionality of the data - h is the dimensionality of the hidden states - o is the dimensionality of the outputs Creates the public instance attributes Whf, Whb, Wy, bhf, bhb, by that represent the weights and biases of the cell Whf and bhfare for the hidden states in the forward di...
2
null
Implement the Python class `BidirectionalCell` described below. Class description: epresents a bidirectional cell of an RNN Method signatures and docstrings: - def __init__(self, i, h, o): - i is the dimensionality of the data - h is the dimensionality of the hidden states - o is the dimensionality of the outputs Cre...
Implement the Python class `BidirectionalCell` described below. Class description: epresents a bidirectional cell of an RNN Method signatures and docstrings: - def __init__(self, i, h, o): - i is the dimensionality of the data - h is the dimensionality of the hidden states - o is the dimensionality of the outputs Cre...
e10b4e9b6f3fa00639e6e9e5b35f0cdb43a339a3
<|skeleton|> class BidirectionalCell: """epresents a bidirectional cell of an RNN""" def __init__(self, i, h, o): """- i is the dimensionality of the data - h is the dimensionality of the hidden states - o is the dimensionality of the outputs Creates the public instance attributes Whf, Whb, Wy, bhf, bh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BidirectionalCell: """epresents a bidirectional cell of an RNN""" def __init__(self, i, h, o): """- i is the dimensionality of the data - h is the dimensionality of the hidden states - o is the dimensionality of the outputs Creates the public instance attributes Whf, Whb, Wy, bhf, bhb, by that re...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/5-bi_forward.py
HeimerR/holbertonschool-machine_learning
train
0
b2a38b71e2e525ef5c9add99e4db7dae4daf715a
[ "try:\n selected_uuid = UUID(hex=LEGACY_CONF.get_val('Last_Selected', 'palette_uuid', ''))\nexcept ValueError:\n selected_uuid = UUID_PORTAL2\nreturn {'': cls(selected_uuid, LEGACY_CONF.get_bool('General', 'palette_save_settings'), frozenset())}", "assert version == 1\nhidden = {UUID(hex=prop.value) for pro...
<|body_start_0|> try: selected_uuid = UUID(hex=LEGACY_CONF.get_val('Last_Selected', 'palette_uuid', '')) except ValueError: selected_uuid = UUID_PORTAL2 return {'': cls(selected_uuid, LEGACY_CONF.get_bool('General', 'palette_save_settings'), frozenset())} <|end_body_0|> ...
Data related to palettes which is restored next run. Since we don't store in the palette, we don't need to register the UI callback.
PaletteState
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaletteState: """Data related to palettes which is restored next run. Since we don't store in the palette, we don't need to register the UI callback.""" def parse_legacy(cls, conf: Property) -> dict[str, PaletteState]: """Convert the legacy config options to the new format.""" ...
stack_v2_sparse_classes_36k_train_022473
3,247
no_license
[ { "docstring": "Convert the legacy config options to the new format.", "name": "parse_legacy", "signature": "def parse_legacy(cls, conf: Property) -> dict[str, PaletteState]" }, { "docstring": "Parse Keyvalues data.", "name": "parse_kv1", "signature": "def parse_kv1(cls, data: Property, ...
5
null
Implement the Python class `PaletteState` described below. Class description: Data related to palettes which is restored next run. Since we don't store in the palette, we don't need to register the UI callback. Method signatures and docstrings: - def parse_legacy(cls, conf: Property) -> dict[str, PaletteState]: Conve...
Implement the Python class `PaletteState` described below. Class description: Data related to palettes which is restored next run. Since we don't store in the palette, we don't need to register the UI callback. Method signatures and docstrings: - def parse_legacy(cls, conf: Property) -> dict[str, PaletteState]: Conve...
9f9219934b8f4af3c03d0080fad6078a18f3d530
<|skeleton|> class PaletteState: """Data related to palettes which is restored next run. Since we don't store in the palette, we don't need to register the UI callback.""" def parse_legacy(cls, conf: Property) -> dict[str, PaletteState]: """Convert the legacy config options to the new format.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PaletteState: """Data related to palettes which is restored next run. Since we don't store in the palette, we don't need to register the UI callback.""" def parse_legacy(cls, conf: Property) -> dict[str, PaletteState]: """Convert the legacy config options to the new format.""" try: ...
the_stack_v2_python_sparse
src/config/palette.py
BEEmod/BEE2.4
train
276
f202d324831654600cd27d22b6b610efccfe9cf5
[ "super(_RFCN_header, self).__init__(input_dim, n_classes, class_ag)\nself.position_sensitive_score_map = nn.Conv2d(input_dim, k ** 2 * n_classes, kernel_size=1)\nif class_ag:\n self.position_sensitive_bbox_map = nn.Conv2d(input_dim, k ** 2 * 4, kernel_size=1)\nelse:\n self.position_sensitive_bbox_map = nn.Con...
<|body_start_0|> super(_RFCN_header, self).__init__(input_dim, n_classes, class_ag) self.position_sensitive_score_map = nn.Conv2d(input_dim, k ** 2 * n_classes, kernel_size=1) if class_ag: self.position_sensitive_bbox_map = nn.Conv2d(input_dim, k ** 2 * 4, kernel_size=1) else...
_RFCN_header
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _RFCN_header: def __init__(self, input_dim, n_classes, class_ag, k=3): """:param input_dim: feature map channel number :param n_classes: :param class_ag: :param k: grid size""" <|body_0|> def forward(self, x): """:param feat: [batch_size, channel, H, W] :param rois: ...
stack_v2_sparse_classes_36k_train_022474
1,501
permissive
[ { "docstring": ":param input_dim: feature map channel number :param n_classes: :param class_ag: :param k: grid size", "name": "__init__", "signature": "def __init__(self, input_dim, n_classes, class_ag, k=3)" }, { "docstring": ":param feat: [batch_size, channel, H, W] :param rois: [batch_size, n...
2
stack_v2_sparse_classes_30k_train_019695
Implement the Python class `_RFCN_header` described below. Class description: Implement the _RFCN_header class. Method signatures and docstrings: - def __init__(self, input_dim, n_classes, class_ag, k=3): :param input_dim: feature map channel number :param n_classes: :param class_ag: :param k: grid size - def forward...
Implement the Python class `_RFCN_header` described below. Class description: Implement the _RFCN_header class. Method signatures and docstrings: - def __init__(self, input_dim, n_classes, class_ag, k=3): :param input_dim: feature map channel number :param n_classes: :param class_ag: :param k: grid size - def forward...
f66c38c00405b22cb746cc3f5c38d2b49f77d854
<|skeleton|> class _RFCN_header: def __init__(self, input_dim, n_classes, class_ag, k=3): """:param input_dim: feature map channel number :param n_classes: :param class_ag: :param k: grid size""" <|body_0|> def forward(self, x): """:param feat: [batch_size, channel, H, W] :param rois: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _RFCN_header: def __init__(self, input_dim, n_classes, class_ag, k=3): """:param input_dim: feature map channel number :param n_classes: :param class_ag: :param k: grid size""" super(_RFCN_header, self).__init__(input_dim, n_classes, class_ag) self.position_sensitive_score_map = nn.Con...
the_stack_v2_python_sparse
build/lib.linux-x86_64-3.5/model/header/RFCN.py
moli1026/regrad
train
1
d89d7b64e2a21d4d476940eb8daf9eee316de910
[ "self.m = {}\nself.q = []\nself.cap = capacity", "if key not in self.m:\n return -1\nval = self.m[key]\ndel self.m[key]\nself.q.remove(key)\nself.put(key, val)\nreturn val", "if key in self.m:\n self.q.remove(key)\nself.q.append(key)\nself.m[key] = value\nif len(self.q) > self.cap:\n expire_key = self....
<|body_start_0|> self.m = {} self.q = [] self.cap = capacity <|end_body_0|> <|body_start_1|> if key not in self.m: return -1 val = self.m[key] del self.m[key] self.q.remove(key) self.put(key, val) return val <|end_body_1|> <|body_star...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_022475
876
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
stack_v2_sparse_classes_30k_train_016029
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
c1f22911ae9b441b2d2646dc6a209880a761c9cb
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.m = {} self.q = [] self.cap = capacity def get(self, key): """:type key: int :rtype: int""" if key not in self.m: return -1 val = self.m[key] del self.m[key] ...
the_stack_v2_python_sparse
external/LRU缓存机制/solution.py
u2386/leet
train
0
255d4f94087b86f574f047e44430680b0291aa2d
[ "super(ReignitionCallback, self).__init__()\nself.priority = 100\nself.desc_copy = None", "logging.info('Start SPNas Reigniting.')\nself.desc_copy = copy.deepcopy(self.trainer.model_desc)\nbackbone = self.desc_copy.get('backbone')\ncode = backbone.get('code')\nself.trainer.model_desc = dict(type='SerialClassifica...
<|body_start_0|> super(ReignitionCallback, self).__init__() self.priority = 100 self.desc_copy = None <|end_body_0|> <|body_start_1|> logging.info('Start SPNas Reigniting.') self.desc_copy = copy.deepcopy(self.trainer.model_desc) backbone = self.desc_copy.get('backbone')...
Reignition callback.
ReignitionCallback
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReignitionCallback: """Reignition callback.""" def __init__(self): """Initialize callback.""" <|body_0|> def init_trainer(self, logs=None): """Be called before train.""" <|body_1|> def after_epoch(self, epoch, logs=None): """Save desc into Fa...
stack_v2_sparse_classes_36k_train_022476
1,801
permissive
[ { "docstring": "Initialize callback.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Be called before train.", "name": "init_trainer", "signature": "def init_trainer(self, logs=None)" }, { "docstring": "Save desc into FasterRCNN.", "name": "after_ep...
3
stack_v2_sparse_classes_30k_test_000412
Implement the Python class `ReignitionCallback` described below. Class description: Reignition callback. Method signatures and docstrings: - def __init__(self): Initialize callback. - def init_trainer(self, logs=None): Be called before train. - def after_epoch(self, epoch, logs=None): Save desc into FasterRCNN.
Implement the Python class `ReignitionCallback` described below. Class description: Reignition callback. Method signatures and docstrings: - def __init__(self): Initialize callback. - def init_trainer(self, logs=None): Be called before train. - def after_epoch(self, epoch, logs=None): Save desc into FasterRCNN. <|sk...
12e37a1991eb6771a2999fe0a46ddda920c47948
<|skeleton|> class ReignitionCallback: """Reignition callback.""" def __init__(self): """Initialize callback.""" <|body_0|> def init_trainer(self, logs=None): """Be called before train.""" <|body_1|> def after_epoch(self, epoch, logs=None): """Save desc into Fa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReignitionCallback: """Reignition callback.""" def __init__(self): """Initialize callback.""" super(ReignitionCallback, self).__init__() self.priority = 100 self.desc_copy = None def init_trainer(self, logs=None): """Be called before train.""" logging....
the_stack_v2_python_sparse
vega/algorithms/nas/sp_nas/reignition.py
huawei-noah/vega
train
850
f3be8920ef40662d10f611768573385163ffc4c2
[ "if not os.path.exists(ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME):\n logger.critical('缺失公交数据库,请检查!')\n pass\nself.data_path = ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME\nself._bus_data = self._busStop_Load_Data()\nself._busStop_Remove_Duplication()\nself._busStop_Structu...
<|body_start_0|> if not os.path.exists(ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME): logger.critical('缺失公交数据库,请检查!') pass self.data_path = ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME self._bus_data = self._busStop_Load_Data() se...
busStop
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class busStop: def __init__(self): """读入数据""" <|body_0|> def _busStop_Load_Data(self): """从源文件中读取公交站原始数据 :return:""" <|body_1|> def _busStop_Remove_Duplication(self): """清洗数据,去掉重复项,去掉不符合要求的项目 :return:""" <|body_2|> def _busStop_Structure(s...
stack_v2_sparse_classes_36k_train_022477
5,440
no_license
[ { "docstring": "读入数据", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "从源文件中读取公交站原始数据 :return:", "name": "_busStop_Load_Data", "signature": "def _busStop_Load_Data(self)" }, { "docstring": "清洗数据,去掉重复项,去掉不符合要求的项目 :return:", "name": "_busStop_Remove_Dup...
5
null
Implement the Python class `busStop` described below. Class description: Implement the busStop class. Method signatures and docstrings: - def __init__(self): 读入数据 - def _busStop_Load_Data(self): 从源文件中读取公交站原始数据 :return: - def _busStop_Remove_Duplication(self): 清洗数据,去掉重复项,去掉不符合要求的项目 :return: - def _busStop_Structure(se...
Implement the Python class `busStop` described below. Class description: Implement the busStop class. Method signatures and docstrings: - def __init__(self): 读入数据 - def _busStop_Load_Data(self): 从源文件中读取公交站原始数据 :return: - def _busStop_Remove_Duplication(self): 清洗数据,去掉重复项,去掉不符合要求的项目 :return: - def _busStop_Structure(se...
c24d149287697f8fcb26eddce479f37b664ef04c
<|skeleton|> class busStop: def __init__(self): """读入数据""" <|body_0|> def _busStop_Load_Data(self): """从源文件中读取公交站原始数据 :return:""" <|body_1|> def _busStop_Remove_Duplication(self): """清洗数据,去掉重复项,去掉不符合要求的项目 :return:""" <|body_2|> def _busStop_Structure(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class busStop: def __init__(self): """读入数据""" if not os.path.exists(ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME): logger.critical('缺失公交数据库,请检查!') pass self.data_path = ss.PREDICTION_BUSSTOP_PATH + '/' + ss.PREDICTION_BUSSTOP_NAME self._bus_da...
the_stack_v2_python_sparse
Server/TransportationPredict_Tradition/BusStop.py
Kuailun/TransportTradition
train
0
d4017458ff2330ae832679fd0779d14daecf3bb1
[ "if data is not None:\n if type(data) != list:\n raise TypeError('data must be a list')\n if len(data) < 2:\n raise ValueError('data must contain multiple values')\n mean = 0.0\n count = 0\n for element in data:\n if type(element) not in {int, float}:\n raise TypeError...
<|body_start_0|> if data is not None: if type(data) != list: raise TypeError('data must be a list') if len(data) < 2: raise ValueError('data must contain multiple values') mean = 0.0 count = 0 for element in data: ...
Class that represents a poisson distribution.
Poisson
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Poisson: """Class that represents a poisson distribution.""" def __init__(self, data=None, lambtha=1.0): """Constructor of the class. Sets the instance attribute lambtha as float. data is a list of the data to be used to estimate the distribution. lambtha is the expected number of oc...
stack_v2_sparse_classes_36k_train_022478
2,052
no_license
[ { "docstring": "Constructor of the class. Sets the instance attribute lambtha as float. data is a list of the data to be used to estimate the distribution. lambtha is the expected number of occurences in a given time frame.", "name": "__init__", "signature": "def __init__(self, data=None, lambtha=1.0)" ...
4
stack_v2_sparse_classes_30k_train_013044
Implement the Python class `Poisson` described below. Class description: Class that represents a poisson distribution. Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Constructor of the class. Sets the instance attribute lambtha as float. data is a list of the data to be used to estima...
Implement the Python class `Poisson` described below. Class description: Class that represents a poisson distribution. Method signatures and docstrings: - def __init__(self, data=None, lambtha=1.0): Constructor of the class. Sets the instance attribute lambtha as float. data is a list of the data to be used to estima...
1e7cd1589e6e4896ee48a24b9ca85595e16e929d
<|skeleton|> class Poisson: """Class that represents a poisson distribution.""" def __init__(self, data=None, lambtha=1.0): """Constructor of the class. Sets the instance attribute lambtha as float. data is a list of the data to be used to estimate the distribution. lambtha is the expected number of oc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Poisson: """Class that represents a poisson distribution.""" def __init__(self, data=None, lambtha=1.0): """Constructor of the class. Sets the instance attribute lambtha as float. data is a list of the data to be used to estimate the distribution. lambtha is the expected number of occurences in a...
the_stack_v2_python_sparse
math/0x03-probability/poisson.py
Daransoto/holbertonschool-machine_learning
train
0
cf326196c90ebb500cf30a9fcec9302babace189
[ "if threshold is None or rows < 1 or cols < 1:\n return 0\nvisits = [0] * (rows * cols)\ncounts = self.moving_count_core(threshold, rows, cols, 0, 0, visits)\nreturn counts", "moving_count = 0\nif self.check(threshold, rows, cols, row, col, visits):\n visits[row * cols + col] = 1\n moving_count = 1 + sel...
<|body_start_0|> if threshold is None or rows < 1 or cols < 1: return 0 visits = [0] * (rows * cols) counts = self.moving_count_core(threshold, rows, cols, 0, 0, visits) return counts <|end_body_0|> <|body_start_1|> moving_count = 0 if self.check(threshold, r...
计算机器人行走范围
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """计算机器人行走范围""" def moving_count(self, threshold, rows, cols): """主函数,调用递归计算函数 :param threshold: 坐标数位之和的阈值 :param rows: 坐标行数 :param cols: 坐标列数 :return: 机器人行走范围之和""" <|body_0|> def moving_count_core(self, threshold, rows, cols, row, col, visits): """递归计算...
stack_v2_sparse_classes_36k_train_022479
4,600
no_license
[ { "docstring": "主函数,调用递归计算函数 :param threshold: 坐标数位之和的阈值 :param rows: 坐标行数 :param cols: 坐标列数 :return: 机器人行走范围之和", "name": "moving_count", "signature": "def moving_count(self, threshold, rows, cols)" }, { "docstring": "递归计算机器人行走范围 :param threshold: 坐标数位之和的阈值 :param rows: 行数 :param cols: 列数 :param...
4
null
Implement the Python class `Solution` described below. Class description: 计算机器人行走范围 Method signatures and docstrings: - def moving_count(self, threshold, rows, cols): 主函数,调用递归计算函数 :param threshold: 坐标数位之和的阈值 :param rows: 坐标行数 :param cols: 坐标列数 :return: 机器人行走范围之和 - def moving_count_core(self, threshold, rows, cols, ro...
Implement the Python class `Solution` described below. Class description: 计算机器人行走范围 Method signatures and docstrings: - def moving_count(self, threshold, rows, cols): 主函数,调用递归计算函数 :param threshold: 坐标数位之和的阈值 :param rows: 坐标行数 :param cols: 坐标列数 :return: 机器人行走范围之和 - def moving_count_core(self, threshold, rows, cols, ro...
9fdc4b1a2b59b7aed22ddfe92aade487b4c19b71
<|skeleton|> class Solution: """计算机器人行走范围""" def moving_count(self, threshold, rows, cols): """主函数,调用递归计算函数 :param threshold: 坐标数位之和的阈值 :param rows: 坐标行数 :param cols: 坐标列数 :return: 机器人行走范围之和""" <|body_0|> def moving_count_core(self, threshold, rows, cols, row, col, visits): """递归计算...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """计算机器人行走范围""" def moving_count(self, threshold, rows, cols): """主函数,调用递归计算函数 :param threshold: 坐标数位之和的阈值 :param rows: 坐标行数 :param cols: 坐标列数 :return: 机器人行走范围之和""" if threshold is None or rows < 1 or cols < 1: return 0 visits = [0] * (rows * cols) co...
the_stack_v2_python_sparse
my_target_offer/13_robot_run_range.py
MemoryForSky/Data-Structures-and-Algorithms
train
0
fd4eb81128d522b1d27391cf3f3994a53b74282d
[ "self.idItem = itemId\nself.nombreCampo = nombreCampo\nself.tipoPrimario = tp", "self.idItem = itemId\nself.nombreCampo = nombreCampo\nself.tipoPrimario = tp" ]
<|body_start_0|> self.idItem = itemId self.nombreCampo = nombreCampo self.tipoPrimario = tp <|end_body_0|> <|body_start_1|> self.idItem = itemId self.nombreCampo = nombreCampo self.tipoPrimario = tp <|end_body_1|>
Esta clase se utiliza para mapear a sus instancias con la tabla de instancia_tipo_item Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla.
InstanciaTipoItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstanciaTipoItem: """Esta clase se utiliza para mapear a sus instancias con la tabla de instancia_tipo_item Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla.""" def setValues(self, itemId, nombreCampo, tp): """Metodo para estable...
stack_v2_sparse_classes_36k_train_022480
6,497
no_license
[ { "docstring": "Metodo para establecer valores de atributos de la clase. @type idItem : Integer @param idItem : id del item @type nombreCampo : string @param nombreCampo : nombre del campo @type tp : string @param tp : Tipo primario asociado", "name": "setValues", "signature": "def setValues(self, itemI...
2
null
Implement the Python class `InstanciaTipoItem` described below. Class description: Esta clase se utiliza para mapear a sus instancias con la tabla de instancia_tipo_item Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla. Method signatures and docstrings: - def setV...
Implement the Python class `InstanciaTipoItem` described below. Class description: Esta clase se utiliza para mapear a sus instancias con la tabla de instancia_tipo_item Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla. Method signatures and docstrings: - def setV...
9262320d4ff52bd3592365cd232f8dedff4f64da
<|skeleton|> class InstanciaTipoItem: """Esta clase se utiliza para mapear a sus instancias con la tabla de instancia_tipo_item Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla.""" def setValues(self, itemId, nombreCampo, tp): """Metodo para estable...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InstanciaTipoItem: """Esta clase se utiliza para mapear a sus instancias con la tabla de instancia_tipo_item Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla.""" def setValues(self, itemId, nombreCampo, tp): """Metodo para establecer valores d...
the_stack_v2_python_sparse
models/instanciaAtributos.py
jemaromaster/WAPM
train
0
466ada61405a6edf974e20b13cc429a2f225a04e
[ "sucursal_id = self.kwargs['pk']\nsucursal = Sucursal.objects.get(id=sucursal_id)\nsucursal_repuestos = SucursalRepuesto.objects.filter(sucursal=sucursal)\nreturn sucursal_repuestos", "context = super(RepuestoSucursalListView, self).get_context_data(**kwargs)\nsucursal_id = self.kwargs['pk']\nsucursal = Sucursal....
<|body_start_0|> sucursal_id = self.kwargs['pk'] sucursal = Sucursal.objects.get(id=sucursal_id) sucursal_repuestos = SucursalRepuesto.objects.filter(sucursal=sucursal) return sucursal_repuestos <|end_body_0|> <|body_start_1|> context = super(RepuestoSucursalListView, self).get_...
Lista los vehiculos por sucursal.
RepuestoSucursalListView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RepuestoSucursalListView: """Lista los vehiculos por sucursal.""" def get_queryset(self): """Permite filtrar los vehiculos que seran mostrados. Dada la pk de la sucursal se sobre escribe el metodo para que se listen los vehiculos que pertenecen a una sucursal dada.""" <|body_...
stack_v2_sparse_classes_36k_train_022481
2,026
no_license
[ { "docstring": "Permite filtrar los vehiculos que seran mostrados. Dada la pk de la sucursal se sobre escribe el metodo para que se listen los vehiculos que pertenecen a una sucursal dada.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Perime agregar al contex...
2
null
Implement the Python class `RepuestoSucursalListView` described below. Class description: Lista los vehiculos por sucursal. Method signatures and docstrings: - def get_queryset(self): Permite filtrar los vehiculos que seran mostrados. Dada la pk de la sucursal se sobre escribe el metodo para que se listen los vehicul...
Implement the Python class `RepuestoSucursalListView` described below. Class description: Lista los vehiculos por sucursal. Method signatures and docstrings: - def get_queryset(self): Permite filtrar los vehiculos que seran mostrados. Dada la pk de la sucursal se sobre escribe el metodo para que se listen los vehicul...
3e74310b47c82d2dc420e6aaa743a2bc077fd635
<|skeleton|> class RepuestoSucursalListView: """Lista los vehiculos por sucursal.""" def get_queryset(self): """Permite filtrar los vehiculos que seran mostrados. Dada la pk de la sucursal se sobre escribe el metodo para que se listen los vehiculos que pertenecen a una sucursal dada.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RepuestoSucursalListView: """Lista los vehiculos por sucursal.""" def get_queryset(self): """Permite filtrar los vehiculos que seran mostrados. Dada la pk de la sucursal se sobre escribe el metodo para que se listen los vehiculos que pertenecen a una sucursal dada.""" sucursal_id = self.k...
the_stack_v2_python_sparse
concesionario/apps/repuesto/views.py
DonAurelio/SIGIA
train
2
084457662be19fa87d2cc684957f2775cb8e1c20
[ "self.ref = defaults['ref']\nself.protocol = defaults['protocol']\nself.remote = defaults['remote']\nself.source = defaults['source']\nself.depth = defaults.get('depth', 0)\nself.recursive = defaults.get('recursive', False)\nself.timestamp_author = defaults.get('timestamp_author', None)", "defaults = {'ref': self...
<|body_start_0|> self.ref = defaults['ref'] self.protocol = defaults['protocol'] self.remote = defaults['remote'] self.source = defaults['source'] self.depth = defaults.get('depth', 0) self.recursive = defaults.get('recursive', False) self.timestamp_author = defau...
clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recursive value :ivar str timestamp_author: Default timestamp author
Defaults
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Defaults: """clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recursive value :ivar str timestamp_author: D...
stack_v2_sparse_classes_36k_train_022482
1,522
permissive
[ { "docstring": "Defaults __init__ :param dict defaults: Parsed YAML python object for defaults", "name": "__init__", "signature": "def __init__(self, defaults)" }, { "docstring": "Return python object representation for saving yaml :return: YAML python object :rtype: dict", "name": "get_yaml...
2
stack_v2_sparse_classes_30k_train_010449
Implement the Python class `Defaults` described below. Class description: clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recurs...
Implement the Python class `Defaults` described below. Class description: clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recurs...
5e3920a386229cb143271655d5046dfda2ea3009
<|skeleton|> class Defaults: """clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recursive value :ivar str timestamp_author: D...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Defaults: """clowder.yaml Defaults model class :ivar str ref: Default ref :ivar str remote: Default remote name :ivar str source: Default source name :ivar str protocol: Default git protocol :ivar int depth: Default depth :ivar bool recursive: Default recursive value :ivar str timestamp_author: Default timest...
the_stack_v2_python_sparse
src/clowder/model/defaults.py
reidab/clowder
train
0
d611e45d78aa1ba92ad8ee76474e008b6ac425fc
[ "email_regex = '^\\\\w+([\\\\.-]?\\\\w+)*@\\\\w+([\\\\.-]?\\\\w+)*(\\\\.\\\\w{2,3})+$'\nif 'email' not in login_request:\n raise ValidationError('Missing email!')\nif not re.search(email_regex, login_request['email']):\n raise ValidationError('Email is not valid!')\nCredentialView.validate_credential_request(...
<|body_start_0|> email_regex = '^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$' if 'email' not in login_request: raise ValidationError('Missing email!') if not re.search(email_regex, login_request['email']): raise ValidationError('Email is not valid!') Cred...
Login endpoint and validator
AuthLoginView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthLoginView: """Login endpoint and validator""" def validate_login_request(login_request): """Validates the login information received in the request body :param login_request: Login information received in the request""" <|body_0|> def post(request): """Action...
stack_v2_sparse_classes_36k_train_022483
3,191
no_license
[ { "docstring": "Validates the login information received in the request body :param login_request: Login information received in the request", "name": "validate_login_request", "signature": "def validate_login_request(login_request)" }, { "docstring": "Action when calling the endpoint with POST ...
2
stack_v2_sparse_classes_30k_train_015228
Implement the Python class `AuthLoginView` described below. Class description: Login endpoint and validator Method signatures and docstrings: - def validate_login_request(login_request): Validates the login information received in the request body :param login_request: Login information received in the request - def ...
Implement the Python class `AuthLoginView` described below. Class description: Login endpoint and validator Method signatures and docstrings: - def validate_login_request(login_request): Validates the login information received in the request body :param login_request: Login information received in the request - def ...
941e8b2870f8724db3d5103dda5157fd597cfcc7
<|skeleton|> class AuthLoginView: """Login endpoint and validator""" def validate_login_request(login_request): """Validates the login information received in the request body :param login_request: Login information received in the request""" <|body_0|> def post(request): """Action...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthLoginView: """Login endpoint and validator""" def validate_login_request(login_request): """Validates the login information received in the request body :param login_request: Login information received in the request""" email_regex = '^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3}...
the_stack_v2_python_sparse
backend/martin_helder/views/auth_login_view.py
JoaoAlvaroFerreira/FEUP-LGP
train
1
dd4df4ff767c5a03d051126ee78c222817264f53
[ "component_spc = kwargs['spc'] if 'spc' in kwargs else spc.SPC\nobject_proto.iqObject.__init__(self, parent=parent, resource=resource, spc=component_spc, context=context)\ndbf_readonly.iqDBFReadOnlyFile.__init__(self, dbf_filename=self.getDBFFileName())", "if self._dbf_file_name is None:\n self._dbf_file_name ...
<|body_start_0|> component_spc = kwargs['spc'] if 'spc' in kwargs else spc.SPC object_proto.iqObject.__init__(self, parent=parent, resource=resource, spc=component_spc, context=context) dbf_readonly.iqDBFReadOnlyFile.__init__(self, dbf_filename=self.getDBFFileName()) <|end_body_0|> <|body_start...
DBF readonly file component.
iqDBFReadOnlyFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iqDBFReadOnlyFile: """DBF readonly file component.""" def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): """Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictionary.""" ...
stack_v2_sparse_classes_36k_train_022484
1,140
no_license
[ { "docstring": "Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictionary.", "name": "__init__", "signature": "def __init__(self, parent=None, resource=None, context=None, *args, **kwargs)" }, { "docstring": "Get...
2
stack_v2_sparse_classes_30k_train_005773
Implement the Python class `iqDBFReadOnlyFile` described below. Class description: DBF readonly file component. Method signatures and docstrings: - def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): Standard component constructor. :param parent: Parent object. :param resource: Object resou...
Implement the Python class `iqDBFReadOnlyFile` described below. Class description: DBF readonly file component. Method signatures and docstrings: - def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): Standard component constructor. :param parent: Parent object. :param resource: Object resou...
7550e242746cb2fb1219474463f8db21f8e3e114
<|skeleton|> class iqDBFReadOnlyFile: """DBF readonly file component.""" def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): """Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictionary.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class iqDBFReadOnlyFile: """DBF readonly file component.""" def __init__(self, parent=None, resource=None, context=None, *args, **kwargs): """Standard component constructor. :param parent: Parent object. :param resource: Object resource dictionary. :param context: Context dictionary.""" compone...
the_stack_v2_python_sparse
iq/components/dbf_readonly_file/component.py
XHermitOne/iq_framework
train
1
9c7cd047a99ca1fbb533633b29eccb858c6298cc
[ "l = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]\nresult = snail(l)\nself.assertEqual(result, [1, 2, 3, 6, 9, 8, 7, 4, 5])", "l = [[3, 78, 45, 12, 5, 3], [7, 4, 345, 76, 12, 4], [0, 0, 0, 0, 0, 0], [5456, 123, 6345, 123, 5435, 1], [1, 2, 3, 4, 5, 6], [678, 45, 12, 54, 123, 2]]\nresult = snail(l)\nself.assertEqual(result, [...
<|body_start_0|> l = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] result = snail(l) self.assertEqual(result, [1, 2, 3, 6, 9, 8, 7, 4, 5]) <|end_body_0|> <|body_start_1|> l = [[3, 78, 45, 12, 5, 3], [7, 4, 345, 76, 12, 4], [0, 0, 0, 0, 0, 0], [5456, 123, 6345, 123, 5435, 1], [1, 2, 3, 4, 5, 6], [67...
TestSnail
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestSnail: def test_snail_sort_small_list(self): """Tests that the snail sort algorithm returns a small list path sorted in winding snail order""" <|body_0|> def test_snail_sort_large_list(self): """Tests that the snail sort alrogrithm returns a large list path sorte...
stack_v2_sparse_classes_36k_train_022485
1,516
permissive
[ { "docstring": "Tests that the snail sort algorithm returns a small list path sorted in winding snail order", "name": "test_snail_sort_small_list", "signature": "def test_snail_sort_small_list(self)" }, { "docstring": "Tests that the snail sort alrogrithm returns a large list path sorted in wind...
3
null
Implement the Python class `TestSnail` described below. Class description: Implement the TestSnail class. Method signatures and docstrings: - def test_snail_sort_small_list(self): Tests that the snail sort algorithm returns a small list path sorted in winding snail order - def test_snail_sort_large_list(self): Tests ...
Implement the Python class `TestSnail` described below. Class description: Implement the TestSnail class. Method signatures and docstrings: - def test_snail_sort_small_list(self): Tests that the snail sort algorithm returns a small list path sorted in winding snail order - def test_snail_sort_large_list(self): Tests ...
27ffb6b32d6d18d279c51cfa45bf305a409be5c2
<|skeleton|> class TestSnail: def test_snail_sort_small_list(self): """Tests that the snail sort algorithm returns a small list path sorted in winding snail order""" <|body_0|> def test_snail_sort_large_list(self): """Tests that the snail sort alrogrithm returns a large list path sorte...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestSnail: def test_snail_sort_small_list(self): """Tests that the snail sort algorithm returns a small list path sorted in winding snail order""" l = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] result = snail(l) self.assertEqual(result, [1, 2, 3, 6, 9, 8, 7, 4, 5]) def test_snail_s...
the_stack_v2_python_sparse
src/codewars/4-kyu/snail/test_snail.py
nwthomas/code-challenges
train
2
90250727cacb00c40031fbd09f5ec3a28491c75b
[ "Block.__init__(self, scenario, args)\nif self.language is None:\n raise LoadingException('Language must be defined!')", "anode = tnode.lex_anode\nif not anode:\n return\nif tnode.nodetype in ['coap', 'atom', 'dphr']:\n anode.morphcat_pos = '!'\n return\nanode.morphcat_pos = tnode.mlayer_pos or '.'\ni...
<|body_start_0|> Block.__init__(self, scenario, args) if self.language is None: raise LoadingException('Language must be defined!') <|end_body_0|> <|body_start_1|> anode = tnode.lex_anode if not anode: return if tnode.nodetype in ['coap', 'atom', 'dphr']:...
According to t-layer grammatemes, this initializes the morphcat structure at the a-layer that is the basis for a later POS tag limiting in the word form generation. Arguments: language: the language of the target tree selector: the selector of the target tree
InitMorphcat
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InitMorphcat: """According to t-layer grammatemes, this initializes the morphcat structure at the a-layer that is the basis for a later POS tag limiting in the word form generation. Arguments: language: the language of the target tree selector: the selector of the target tree""" def __init__...
stack_v2_sparse_classes_36k_train_022486
5,591
permissive
[ { "docstring": "Constructor, checking the argument values", "name": "__init__", "signature": "def __init__(self, scenario, args)" }, { "docstring": "Initialize the morphcat structure in the given node", "name": "process_tnode", "signature": "def process_tnode(self, tnode)" }, { "...
4
stack_v2_sparse_classes_30k_train_013921
Implement the Python class `InitMorphcat` described below. Class description: According to t-layer grammatemes, this initializes the morphcat structure at the a-layer that is the basis for a later POS tag limiting in the word form generation. Arguments: language: the language of the target tree selector: the selector ...
Implement the Python class `InitMorphcat` described below. Class description: According to t-layer grammatemes, this initializes the morphcat structure at the a-layer that is the basis for a later POS tag limiting in the word form generation. Arguments: language: the language of the target tree selector: the selector ...
73af644ec35c8a1cd0c37cd478c2afc1db717e0b
<|skeleton|> class InitMorphcat: """According to t-layer grammatemes, this initializes the morphcat structure at the a-layer that is the basis for a later POS tag limiting in the word form generation. Arguments: language: the language of the target tree selector: the selector of the target tree""" def __init__...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InitMorphcat: """According to t-layer grammatemes, this initializes the morphcat structure at the a-layer that is the basis for a later POS tag limiting in the word form generation. Arguments: language: the language of the target tree selector: the selector of the target tree""" def __init__(self, scenar...
the_stack_v2_python_sparse
alex/components/nlg/tectotpl/block/t2a/cs/initmorphcat.py
oplatek/alex
train
0
defb7cf565746bf541b9015b8475cbacb7423027
[ "if self.file_file:\n try:\n return re.search('([^\\\\/]+)$', self.file_file).groups()[0]\n except AttributeError:\n pass\nreturn None", "if self.file_name:\n return self.file_name\nreturn self.get_filename()" ]
<|body_start_0|> if self.file_file: try: return re.search('([^\\/]+)$', self.file_file).groups()[0] except AttributeError: pass return None <|end_body_0|> <|body_start_1|> if self.file_name: return self.file_name return...
Post type for a downloadable file
File
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class File: """Post type for a downloadable file""" def get_filename(self): """Returns the filename of the uploaded file""" <|body_0|> def file_link_text(self): """Returns text to be used for a download link""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_022487
2,384
permissive
[ { "docstring": "Returns the filename of the uploaded file", "name": "get_filename", "signature": "def get_filename(self)" }, { "docstring": "Returns text to be used for a download link", "name": "file_link_text", "signature": "def file_link_text(self)" } ]
2
stack_v2_sparse_classes_30k_val_000017
Implement the Python class `File` described below. Class description: Post type for a downloadable file Method signatures and docstrings: - def get_filename(self): Returns the filename of the uploaded file - def file_link_text(self): Returns text to be used for a download link
Implement the Python class `File` described below. Class description: Post type for a downloadable file Method signatures and docstrings: - def get_filename(self): Returns the filename of the uploaded file - def file_link_text(self): Returns text to be used for a download link <|skeleton|> class File: """Post ty...
d5582c0e511d56998e19efa07db1e4badfec483b
<|skeleton|> class File: """Post type for a downloadable file""" def get_filename(self): """Returns the filename of the uploaded file""" <|body_0|> def file_link_text(self): """Returns text to be used for a download link""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class File: """Post type for a downloadable file""" def get_filename(self): """Returns the filename of the uploaded file""" if self.file_file: try: return re.search('([^\\/]+)$', self.file_file).groups()[0] except AttributeError: pass ...
the_stack_v2_python_sparse
tumblelog/models/contrib/file.py
registerguard/django-tumblelog
train
0
63470cd7369db83d4f1c3d3fd78267ac9b5e2f14
[ "if path.endswith('/'):\n path = path[:-1]\nreturn path", "if not path.endswith('/'):\n path = path + '/'\nreturn path" ]
<|body_start_0|> if path.endswith('/'): path = path[:-1] return path <|end_body_0|> <|body_start_1|> if not path.endswith('/'): path = path + '/' return path <|end_body_1|>
PathConvertor
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PathConvertor: def build_path_without_trailing_slash(path: str) -> str: """Build source path without trailing '/'. Args: path (str): Original path. Returns: str: Reformatted path.""" <|body_0|> def build_path_with_trailing_slash(path: str) -> str: """Build reformatte...
stack_v2_sparse_classes_36k_train_022488
766
permissive
[ { "docstring": "Build source path without trailing '/'. Args: path (str): Original path. Returns: str: Reformatted path.", "name": "build_path_without_trailing_slash", "signature": "def build_path_without_trailing_slash(path: str) -> str" }, { "docstring": "Build reformatted target dir with trai...
2
null
Implement the Python class `PathConvertor` described below. Class description: Implement the PathConvertor class. Method signatures and docstrings: - def build_path_without_trailing_slash(path: str) -> str: Build source path without trailing '/'. Args: path (str): Original path. Returns: str: Reformatted path. - def ...
Implement the Python class `PathConvertor` described below. Class description: Implement the PathConvertor class. Method signatures and docstrings: - def build_path_without_trailing_slash(path: str) -> str: Build source path without trailing '/'. Args: path (str): Original path. Returns: str: Reformatted path. - def ...
b3c6a589ad9036b03221e776a6929b2bc1eb4680
<|skeleton|> class PathConvertor: def build_path_without_trailing_slash(path: str) -> str: """Build source path without trailing '/'. Args: path (str): Original path. Returns: str: Reformatted path.""" <|body_0|> def build_path_with_trailing_slash(path: str) -> str: """Build reformatte...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PathConvertor: def build_path_without_trailing_slash(path: str) -> str: """Build source path without trailing '/'. Args: path (str): Original path. Returns: str: Reformatted path.""" if path.endswith('/'): path = path[:-1] return path def build_path_with_trailing_slash...
the_stack_v2_python_sparse
maro/cli/utils/path_convertor.py
microsoft/maro
train
764
bde617e1b5e17160041b334e5b1c5d0319731dde
[ "res = []\n\ndef dfs(root):\n if not root:\n return\n res.append(root.val)\n for child in root.children:\n dfs(child)\ndfs(root)\nreturn res", "stack = [root]\nres = []\nif not root:\n return []\nwhile stack:\n root = stack.pop()\n res.append(root.val)\n stack.extend(root.childr...
<|body_start_0|> res = [] def dfs(root): if not root: return res.append(root.val) for child in root.children: dfs(child) dfs(root) return res <|end_body_0|> <|body_start_1|> stack = [root] res = [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preorder(self, root: 'Node') -> List[int]: """简单的递归遍历 :param root: :return:""" <|body_0|> def preorder1(self, root: 'Node') -> List[int]: """使用迭代的方式,自己维护一个栈 :param root: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = []...
stack_v2_sparse_classes_36k_train_022489
1,129
no_license
[ { "docstring": "简单的递归遍历 :param root: :return:", "name": "preorder", "signature": "def preorder(self, root: 'Node') -> List[int]" }, { "docstring": "使用迭代的方式,自己维护一个栈 :param root: :return:", "name": "preorder1", "signature": "def preorder1(self, root: 'Node') -> List[int]" } ]
2
stack_v2_sparse_classes_30k_train_010662
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorder(self, root: 'Node') -> List[int]: 简单的递归遍历 :param root: :return: - def preorder1(self, root: 'Node') -> List[int]: 使用迭代的方式,自己维护一个栈 :param root: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preorder(self, root: 'Node') -> List[int]: 简单的递归遍历 :param root: :return: - def preorder1(self, root: 'Node') -> List[int]: 使用迭代的方式,自己维护一个栈 :param root: :return: <|skeleton|>...
578cacff5851c5c2522981693c34e3c318002d30
<|skeleton|> class Solution: def preorder(self, root: 'Node') -> List[int]: """简单的递归遍历 :param root: :return:""" <|body_0|> def preorder1(self, root: 'Node') -> List[int]: """使用迭代的方式,自己维护一个栈 :param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def preorder(self, root: 'Node') -> List[int]: """简单的递归遍历 :param root: :return:""" res = [] def dfs(root): if not root: return res.append(root.val) for child in root.children: dfs(child) dfs(root) ...
the_stack_v2_python_sparse
N叉树的前序遍历.py
cjrzs/MyLeetCode
train
8
b8ea05e8f4d788fde8f1d24e3bbeb991b634c448
[ "for i in range(1, len(arr) - 1):\n if arr[i - 1] < arr[i] > arr[i + 1]:\n return i", "n = len(arr)\nleft, right, ans = (1, n - 2, 0)\nwhile left <= right:\n mid = (left + right) // 2\n if arr[mid] > arr[mid + 1]:\n ans = mid\n right = mid - 1\n else:\n left = mid + 1\nretu...
<|body_start_0|> for i in range(1, len(arr) - 1): if arr[i - 1] < arr[i] > arr[i + 1]: return i <|end_body_0|> <|body_start_1|> n = len(arr) left, right, ans = (1, n - 2, 0) while left <= right: mid = (left + right) // 2 if arr[mid] > ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def peakIndexInMountainArray(self, arr: List[int]) -> int: """遍历, :param arr: :return:""" <|body_0|> def peakIndexInMountainArray1(self, arr: List[int]) -> int: """二分查找 :param arr: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> f...
stack_v2_sparse_classes_36k_train_022490
1,539
no_license
[ { "docstring": "遍历, :param arr: :return:", "name": "peakIndexInMountainArray", "signature": "def peakIndexInMountainArray(self, arr: List[int]) -> int" }, { "docstring": "二分查找 :param arr: :return:", "name": "peakIndexInMountainArray1", "signature": "def peakIndexInMountainArray1(self, ar...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def peakIndexInMountainArray(self, arr: List[int]) -> int: 遍历, :param arr: :return: - def peakIndexInMountainArray1(self, arr: List[int]) -> int: 二分查找 :param arr: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def peakIndexInMountainArray(self, arr: List[int]) -> int: 遍历, :param arr: :return: - def peakIndexInMountainArray1(self, arr: List[int]) -> int: 二分查找 :param arr: :return: <|ske...
9acba92695c06406f12f997a720bfe1deb9464a8
<|skeleton|> class Solution: def peakIndexInMountainArray(self, arr: List[int]) -> int: """遍历, :param arr: :return:""" <|body_0|> def peakIndexInMountainArray1(self, arr: List[int]) -> int: """二分查找 :param arr: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def peakIndexInMountainArray(self, arr: List[int]) -> int: """遍历, :param arr: :return:""" for i in range(1, len(arr) - 1): if arr[i - 1] < arr[i] > arr[i + 1]: return i def peakIndexInMountainArray1(self, arr: List[int]) -> int: """二分查找 :param...
the_stack_v2_python_sparse
datastructure/binary_array/PeakIndexInMountainArray.py
yinhuax/leet_code
train
0
9bd2da744ef351f2627f43339abd16cfebaae8b9
[ "self.depth = depth\nself.otu_table = self.getBiomData(otu_path)\nself.max_num_taxa = -1\nfor val in self.otu_table.iterObservationData():\n self.max_num_taxa = max(self.max_num_taxa, val.sum())", "if not include_lineages:\n for val, id, meta in self.otu_table.iterObservations():\n del meta['taxonomy...
<|body_start_0|> self.depth = depth self.otu_table = self.getBiomData(otu_path) self.max_num_taxa = -1 for val in self.otu_table.iterObservationData(): self.max_num_taxa = max(self.max_num_taxa, val.sum()) <|end_body_0|> <|body_start_1|> if not include_lineages: ...
SingleRarefactionMaker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SingleRarefactionMaker: def __init__(self, otu_path, depth): """init a singlerarefactionmaker otu_path has to be parseable when opened by parse_biom_table, we just ignore any rarefaction levels beyond any sample in the data""" <|body_0|> def rarefy_to_file(self, output_fname...
stack_v2_sparse_classes_36k_train_022491
7,880
no_license
[ { "docstring": "init a singlerarefactionmaker otu_path has to be parseable when opened by parse_biom_table, we just ignore any rarefaction levels beyond any sample in the data", "name": "__init__", "signature": "def __init__(self, otu_path, depth)" }, { "docstring": "computes rarefied otu tables...
3
stack_v2_sparse_classes_30k_train_013749
Implement the Python class `SingleRarefactionMaker` described below. Class description: Implement the SingleRarefactionMaker class. Method signatures and docstrings: - def __init__(self, otu_path, depth): init a singlerarefactionmaker otu_path has to be parseable when opened by parse_biom_table, we just ignore any ra...
Implement the Python class `SingleRarefactionMaker` described below. Class description: Implement the SingleRarefactionMaker class. Method signatures and docstrings: - def __init__(self, otu_path, depth): init a singlerarefactionmaker otu_path has to be parseable when opened by parse_biom_table, we just ignore any ra...
afb3eb6531badeb74fc69ae4c9e698d3e9cbe70e
<|skeleton|> class SingleRarefactionMaker: def __init__(self, otu_path, depth): """init a singlerarefactionmaker otu_path has to be parseable when opened by parse_biom_table, we just ignore any rarefaction levels beyond any sample in the data""" <|body_0|> def rarefy_to_file(self, output_fname...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SingleRarefactionMaker: def __init__(self, otu_path, depth): """init a singlerarefactionmaker otu_path has to be parseable when opened by parse_biom_table, we just ignore any rarefaction levels beyond any sample in the data""" self.depth = depth self.otu_table = self.getBiomData(otu_pa...
the_stack_v2_python_sparse
qiime/rarefaction.py
rob-knight/qiime
train
2
79f72871b84abe662d35840e1283341206ecc088
[ "self.acno = int(raw_input('enter accont no : '))\nself.acname = raw_input('enter accont h name : ')\nself.acbal = float(raw_input('enter accont blance : '))", "self.acno = int(raw_input('enter accont no : '))\nself.acname = raw_input('enter accont h name : ')\nself.acbal = float(raw_input('enter accont blance : ...
<|body_start_0|> self.acno = int(raw_input('enter accont no : ')) self.acname = raw_input('enter accont h name : ') self.acbal = float(raw_input('enter accont blance : ')) <|end_body_0|> <|body_start_1|> self.acno = int(raw_input('enter accont no : ')) self.acname = raw_input('e...
to define account class woth account info and operations
account
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class account: """to define account class woth account info and operations""" def __init__(self): """to initialise instance variables""" <|body_0|> def setaccountinfo(self): """to initialise account info""" <|body_1|> def getaccountinfo(self): """t...
stack_v2_sparse_classes_36k_train_022492
1,448
no_license
[ { "docstring": "to initialise instance variables", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "to initialise account info", "name": "setaccountinfo", "signature": "def setaccountinfo(self)" }, { "docstring": "to display account detail", "name": "g...
4
stack_v2_sparse_classes_30k_train_009413
Implement the Python class `account` described below. Class description: to define account class woth account info and operations Method signatures and docstrings: - def __init__(self): to initialise instance variables - def setaccountinfo(self): to initialise account info - def getaccountinfo(self): to display accou...
Implement the Python class `account` described below. Class description: to define account class woth account info and operations Method signatures and docstrings: - def __init__(self): to initialise instance variables - def setaccountinfo(self): to initialise account info - def getaccountinfo(self): to display accou...
a2c3cbbfa740dc39944d8a7e4ca0eaad07f44316
<|skeleton|> class account: """to define account class woth account info and operations""" def __init__(self): """to initialise instance variables""" <|body_0|> def setaccountinfo(self): """to initialise account info""" <|body_1|> def getaccountinfo(self): """t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class account: """to define account class woth account info and operations""" def __init__(self): """to initialise instance variables""" self.acno = int(raw_input('enter accont no : ')) self.acname = raw_input('enter accont h name : ') self.acbal = float(raw_input('enter accont ...
the_stack_v2_python_sparse
class/act2.py
kajal241199/PYTraining
train
0
b7fceb47ed14d9dae30104162af0d7f20e2dec4a
[ "self.count = 0\nself.res = []\nstack = []\nwhile root or stack:\n if root:\n stack.append(root)\n root = root.left\n else:\n root = stack.pop()\n self.res.append(root.val)\n root = root.right", "if self.count < len(self.res):\n return True\nreturn False", "res = self...
<|body_start_0|> self.count = 0 self.res = [] stack = [] while root or stack: if root: stack.append(root) root = root.left else: root = stack.pop() self.res.append(root.val) root = roo...
BSTIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def hasNext(self): """:rtype: bool""" <|body_1|> def next(self): """:rtype: int""" <|body_2|> <|end_skeleton|> <|body_start_0|> self.count = 0 ...
stack_v2_sparse_classes_36k_train_022493
1,954
no_license
[ { "docstring": ":type root: TreeNode", "name": "__init__", "signature": "def __init__(self, root)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasNext(self)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" } ]
3
null
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def hasNext(self): :rtype: bool - def next(self): :rtype: int
Implement the Python class `BSTIterator` described below. Class description: Implement the BSTIterator class. Method signatures and docstrings: - def __init__(self, root): :type root: TreeNode - def hasNext(self): :rtype: bool - def next(self): :rtype: int <|skeleton|> class BSTIterator: def __init__(self, root...
07b8c34b12d05413466119a82247d7ee5cc34318
<|skeleton|> class BSTIterator: def __init__(self, root): """:type root: TreeNode""" <|body_0|> def hasNext(self): """:rtype: bool""" <|body_1|> def next(self): """:rtype: int""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BSTIterator: def __init__(self, root): """:type root: TreeNode""" self.count = 0 self.res = [] stack = [] while root or stack: if root: stack.append(root) root = root.left else: root = stack.pop() ...
the_stack_v2_python_sparse
173. Binary Search Tree Iterator.py
bryantbyr/LeetCode-solutions
train
1
84447019b5b794c28c1d56a95ccd8bf8e9605986
[ "heapq.heapify(nums)\nwhile len(nums) > k:\n heapq.heappop(nums)\nself.k = k\nself.nums = nums", "if len(self.nums) == self.k and val <= self.nums[0]:\n return self.nums[0]\nheapq.heappush(self.nums, val)\nif len(self.nums) > self.k:\n heapq.heappop(self.nums)\nreturn self.nums[0]" ]
<|body_start_0|> heapq.heapify(nums) while len(nums) > k: heapq.heappop(nums) self.k = k self.nums = nums <|end_body_0|> <|body_start_1|> if len(self.nums) == self.k and val <= self.nums[0]: return self.nums[0] heapq.heappush(self.nums, val) ...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> heapq.heapify(nums) while len(nums) > k: ...
stack_v2_sparse_classes_36k_train_022494
1,582
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
null
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
05e0beff0047f0ad399d0b46d625bb8d3459814e
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" heapq.heapify(nums) while len(nums) > k: heapq.heappop(nums) self.k = k self.nums = nums def add(self, val): """:type val: int :rtype: int""" if len(self.n...
the_stack_v2_python_sparse
python_1_to_1000/703_Kth_Largest_Element_in_a_Stream.py
jakehoare/leetcode
train
58
39adad70f87fcde5a6fa3503fa58835bcf195f43
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
A set of methods for managing access keys.
AccessKeyServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccessKeyServiceServicer: """A set of methods for managing access keys.""" def List(self, request, context): """Retrieves the list of access keys for the specified service account.""" <|body_0|> def Get(self, request, context): """Returns the specified access key...
stack_v2_sparse_classes_36k_train_022495
13,154
permissive
[ { "docstring": "Retrieves the list of access keys for the specified service account.", "name": "List", "signature": "def List(self, request, context)" }, { "docstring": "Returns the specified access key. To get the list of available access keys, make a [List] request.", "name": "Get", "s...
6
stack_v2_sparse_classes_30k_test_000386
Implement the Python class `AccessKeyServiceServicer` described below. Class description: A set of methods for managing access keys. Method signatures and docstrings: - def List(self, request, context): Retrieves the list of access keys for the specified service account. - def Get(self, request, context): Returns the...
Implement the Python class `AccessKeyServiceServicer` described below. Class description: A set of methods for managing access keys. Method signatures and docstrings: - def List(self, request, context): Retrieves the list of access keys for the specified service account. - def Get(self, request, context): Returns the...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class AccessKeyServiceServicer: """A set of methods for managing access keys.""" def List(self, request, context): """Retrieves the list of access keys for the specified service account.""" <|body_0|> def Get(self, request, context): """Returns the specified access key...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccessKeyServiceServicer: """A set of methods for managing access keys.""" def List(self, request, context): """Retrieves the list of access keys for the specified service account.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') ...
the_stack_v2_python_sparse
yandex/cloud/iam/v1/awscompatibility/access_key_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
56364556a08b8fef01cc57e249ddc6f3b584acd4
[ "binning = config['binning']\nbinsz = binning['binsz']\ncoordsys = binning.get('coordsys', 'GAL')\nroiwidth = binning['roiwidth']\nproj = binning.get('proj', 'AIT')\nra = config['selection']['ra']\ndec = config['selection']['dec']\nnpix = int(np.round(roiwidth / binsz))\nskydir = SkyCoord(ra * u.deg, dec * u.deg)\n...
<|body_start_0|> binning = config['binning'] binsz = binning['binsz'] coordsys = binning.get('coordsys', 'GAL') roiwidth = binning['roiwidth'] proj = binning.get('proj', 'AIT') ra = config['selection']['ra'] dec = config['selection']['dec'] npix = int(np.r...
Small class to generate random sky directions inside an ROI This is useful for parallelizing analysis using the fermipy.jobs module.
RandomDirGen
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomDirGen: """Small class to generate random sky directions inside an ROI This is useful for parallelizing analysis using the fermipy.jobs module.""" def _make_wcsgeom_from_config(config): """Build a `WCS.Geom` object from a fermipy coniguration file""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_022496
21,082
permissive
[ { "docstring": "Build a `WCS.Geom` object from a fermipy coniguration file", "name": "_make_wcsgeom_from_config", "signature": "def _make_wcsgeom_from_config(config)" }, { "docstring": "Build a dictionary of random directions", "name": "_build_skydir_dict", "signature": "def _build_skydi...
3
null
Implement the Python class `RandomDirGen` described below. Class description: Small class to generate random sky directions inside an ROI This is useful for parallelizing analysis using the fermipy.jobs module. Method signatures and docstrings: - def _make_wcsgeom_from_config(config): Build a `WCS.Geom` object from a...
Implement the Python class `RandomDirGen` described below. Class description: Small class to generate random sky directions inside an ROI This is useful for parallelizing analysis using the fermipy.jobs module. Method signatures and docstrings: - def _make_wcsgeom_from_config(config): Build a `WCS.Geom` object from a...
fbd4c95ffadbff31cbb9cc862ff84a78dc734ef5
<|skeleton|> class RandomDirGen: """Small class to generate random sky directions inside an ROI This is useful for parallelizing analysis using the fermipy.jobs module.""" def _make_wcsgeom_from_config(config): """Build a `WCS.Geom` object from a fermipy coniguration file""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RandomDirGen: """Small class to generate random sky directions inside an ROI This is useful for parallelizing analysis using the fermipy.jobs module.""" def _make_wcsgeom_from_config(config): """Build a `WCS.Geom` object from a fermipy coniguration file""" binning = config['binning'] ...
the_stack_v2_python_sparse
fermipy/jobs/target_sim.py
fermiPy/fermipy
train
51
ccfde77d5ec110f6d84c901f2e79471f6983d23f
[ "verified_data = InterfaceSerializers.InterfaceSerializers(data=request.data)\nif verified_data.is_valid():\n verified_data.save(user=request.user)\n return Response(status=status.HTTP_201_CREATED, data=verified_data.data)\nreturn Response(status=status.HTTP_400_BAD_REQUEST, data=verified_data.errors)", "qu...
<|body_start_0|> verified_data = InterfaceSerializers.InterfaceSerializers(data=request.data) if verified_data.is_valid(): verified_data.save(user=request.user) return Response(status=status.HTTP_201_CREATED, data=verified_data.data) return Response(status=status.HTTP_400...
UserApiInfoView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserApiInfoView: def api_save(self, request, *args, **kwargs): """保存接口""" <|body_0|> def update_api(self, request, *args, **kwargs): """更新api""" <|body_1|> def delete_api(self, request, *args, **kwargs): """删除api""" <|body_2|> <|end_skel...
stack_v2_sparse_classes_36k_train_022497
1,672
no_license
[ { "docstring": "保存接口", "name": "api_save", "signature": "def api_save(self, request, *args, **kwargs)" }, { "docstring": "更新api", "name": "update_api", "signature": "def update_api(self, request, *args, **kwargs)" }, { "docstring": "删除api", "name": "delete_api", "signatur...
3
stack_v2_sparse_classes_30k_train_015760
Implement the Python class `UserApiInfoView` described below. Class description: Implement the UserApiInfoView class. Method signatures and docstrings: - def api_save(self, request, *args, **kwargs): 保存接口 - def update_api(self, request, *args, **kwargs): 更新api - def delete_api(self, request, *args, **kwargs): 删除api
Implement the Python class `UserApiInfoView` described below. Class description: Implement the UserApiInfoView class. Method signatures and docstrings: - def api_save(self, request, *args, **kwargs): 保存接口 - def update_api(self, request, *args, **kwargs): 更新api - def delete_api(self, request, *args, **kwargs): 删除api ...
1c90b78a2cec1abb712b20dfed249041e45bcd36
<|skeleton|> class UserApiInfoView: def api_save(self, request, *args, **kwargs): """保存接口""" <|body_0|> def update_api(self, request, *args, **kwargs): """更新api""" <|body_1|> def delete_api(self, request, *args, **kwargs): """删除api""" <|body_2|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserApiInfoView: def api_save(self, request, *args, **kwargs): """保存接口""" verified_data = InterfaceSerializers.InterfaceSerializers(data=request.data) if verified_data.is_valid(): verified_data.save(user=request.user) return Response(status=status.HTTP_201_CREAT...
the_stack_v2_python_sparse
DjangoRESTFramework/RestFrameworkUser/InterfaceApi.py
AutomatedTestingChiefSoftwareArchitect/AutomationPlatform
train
0
798a6cefbbec2da6e0fe37f56d93a35a131dcef2
[ "if block_range is None:\n latest = SystemStatus.get_latest_block()\n if not latest:\n return None\n block_range = [latest - 28800, latest]\nquery = f\"\"\"\\n SELECT * \\n FROM (\\n SELECT req_posting_auths,\\n op_json -> 1 -> 'following'::te...
<|body_start_0|> if block_range is None: latest = SystemStatus.get_latest_block() if not latest: return None block_range = [latest - 28800, latest] query = f"""\n SELECT * \n FROM (\n SELECT req_posting_auths,\n ...
SearchOps
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchOps: def follow(cls, follower_account=None, followed_account=None, block_range=None): """"follow" | {"follower":"idwritershive","following":"olgavita","what":["blog"]}""" <|body_0|> def reblog(cls, reblog_account=None, blog_author=None, blog_permlink=None, block_range=...
stack_v2_sparse_classes_36k_train_022498
2,841
permissive
[ { "docstring": "\"follow\" | {\"follower\":\"idwritershive\",\"following\":\"olgavita\",\"what\":[\"blog\"]}", "name": "follow", "signature": "def follow(cls, follower_account=None, followed_account=None, block_range=None)" }, { "docstring": "\"reblog\" | { \"account\":\"nataly2317\", \"author\"...
2
stack_v2_sparse_classes_30k_train_017806
Implement the Python class `SearchOps` described below. Class description: Implement the SearchOps class. Method signatures and docstrings: - def follow(cls, follower_account=None, followed_account=None, block_range=None): "follow" | {"follower":"idwritershive","following":"olgavita","what":["blog"]} - def reblog(cls...
Implement the Python class `SearchOps` described below. Class description: Implement the SearchOps class. Method signatures and docstrings: - def follow(cls, follower_account=None, followed_account=None, block_range=None): "follow" | {"follower":"idwritershive","following":"olgavita","what":["blog"]} - def reblog(cls...
db801ff856bf2feb68580317e79cfd6006053e2c
<|skeleton|> class SearchOps: def follow(cls, follower_account=None, followed_account=None, block_range=None): """"follow" | {"follower":"idwritershive","following":"olgavita","what":["blog"]}""" <|body_0|> def reblog(cls, reblog_account=None, blog_author=None, blog_permlink=None, block_range=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SearchOps: def follow(cls, follower_account=None, followed_account=None, block_range=None): """"follow" | {"follower":"idwritershive","following":"olgavita","what":["blog"]}""" if block_range is None: latest = SystemStatus.get_latest_block() if not latest: ...
the_stack_v2_python_sparse
hive_plug_play/engine/plugs/follow.py
imwatsi/hive-plug-play
train
3
69f577738cfbf130400e4845012d5fefb446e338
[ "super(TextInput, self).__init__(attrs)\nif source is None:\n raise ValueError('A source url should be given')\nself.source = source\nself.min_length = int(min_length)\nself.result_limit = result_limit\nself.force_check = force_check", "if value is None:\n value = ''\nattrs['type'] = 'text'\nattrs['name'] =...
<|body_start_0|> super(TextInput, self).__init__(attrs) if source is None: raise ValueError('A source url should be given') self.source = source self.min_length = int(min_length) self.result_limit = result_limit self.force_check = force_check <|end_body_0|> <...
A text input that autocompletes getting a json list
AutocompleteTextMultiInput
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutocompleteTextMultiInput: """A text input that autocompletes getting a json list""" def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True): """It inits the widget. A source url for the json list should be given.""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_022499
7,303
no_license
[ { "docstring": "It inits the widget. A source url for the json list should be given.", "name": "__init__", "signature": "def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True)" }, { "docstring": "It renders the html and the javascript", "name": "render"...
3
null
Implement the Python class `AutocompleteTextMultiInput` described below. Class description: A text input that autocompletes getting a json list Method signatures and docstrings: - def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True): It inits the widget. A source url for the j...
Implement the Python class `AutocompleteTextMultiInput` described below. Class description: A text input that autocompletes getting a json list Method signatures and docstrings: - def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True): It inits the widget. A source url for the j...
46364a9b82bee21444acf343f7f543b28a71f616
<|skeleton|> class AutocompleteTextMultiInput: """A text input that autocompletes getting a json list""" def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True): """It inits the widget. A source url for the json list should be given.""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutocompleteTextMultiInput: """A text input that autocompletes getting a json list""" def __init__(self, attrs=None, source=None, min_length=3, result_limit=100, force_check=True): """It inits the widget. A source url for the json list should be given.""" super(TextInput, self).__init__(a...
the_stack_v2_python_sparse
vavilov/forms/widgets.py
pziarsolo/vavilov2
train
0