blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
0a78dbd276f421b761245e918da2c394cde1c727
[ "q = Q()\nfor field in search_fields:\n kwargs = {field: search_key}\n q = q | Q(**kwargs)\nreturn q", "q = Q()\nif search:\n searches = search.split()\n for search_key in searches:\n q = q & self.q_for_search_field(search_key, search_fields)\nreturn q", "if not search_fields:\n search_fie...
<|body_start_0|> q = Q() for field in search_fields: kwargs = {field: search_key} q = q | Q(**kwargs) return q <|end_body_0|> <|body_start_1|> q = Q() if search: searches = search.split() for search_key in searches: ...
This will be subclassed by both the Object Manager and the QuerySet. By doing it this way, you can chain these functions, along with filter(). A simpler approach would define these in MyClassManager(models.Manager), but won't let you chain them, as the result of each is a QuerySet, not a Manager. See http://stackoverfl...
SearchMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchMixin: """This will be subclassed by both the Object Manager and the QuerySet. By doing it this way, you can chain these functions, along with filter(). A simpler approach would define these in MyClassManager(models.Manager), but won't let you chain them, as the result of each is a QuerySet...
stack_v2_sparse_classes_75kplus_train_065700
12,516
permissive
[ { "docstring": "Given a search key from the search text, return the Q object which you can filter on, to show only objects containing this key.", "name": "q_for_search_field", "signature": "def q_for_search_field(self, search_key, search_fields)" }, { "docstring": "Given the text from the search...
3
stack_v2_sparse_classes_30k_train_041215
Implement the Python class `SearchMixin` described below. Class description: This will be subclassed by both the Object Manager and the QuerySet. By doing it this way, you can chain these functions, along with filter(). A simpler approach would define these in MyClassManager(models.Manager), but won't let you chain th...
Implement the Python class `SearchMixin` described below. Class description: This will be subclassed by both the Object Manager and the QuerySet. By doing it this way, you can chain these functions, along with filter(). A simpler approach would define these in MyClassManager(models.Manager), but won't let you chain th...
3d3f5a53efe32c721c34d7e48267328a4e9e8402
<|skeleton|> class SearchMixin: """This will be subclassed by both the Object Manager and the QuerySet. By doing it this way, you can chain these functions, along with filter(). A simpler approach would define these in MyClassManager(models.Manager), but won't let you chain them, as the result of each is a QuerySet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SearchMixin: """This will be subclassed by both the Object Manager and the QuerySet. By doing it this way, you can chain these functions, along with filter(). A simpler approach would define these in MyClassManager(models.Manager), but won't let you chain them, as the result of each is a QuerySet, not a Manag...
the_stack_v2_python_sparse
draalcore/models/base_manager.py
jojanper/draalcore
train
1
bcd0383301565e06aa7b8b40ba1362564f2951d3
[ "if not legacy_pyroot:\n scatteringPoint = TGLVertex3(2.0, 3.0, 0.2)\n glvec3 = TGLVector3(1, 2, 3)\n vertexEnd = scatteringPoint + glvec3\n vertexEnd = scatteringPoint + glvec3", "if not legacy_pyroot:\n trackAfterScattering = TGLLine3(TGLVertex3(2.0, 3.0, 0.2), TGLVector3(0.0, 0.0, -20.0))\n s...
<|body_start_0|> if not legacy_pyroot: scatteringPoint = TGLVertex3(2.0, 3.0, 0.2) glvec3 = TGLVector3(1, 2, 3) vertexEnd = scatteringPoint + glvec3 vertexEnd = scatteringPoint + glvec3 <|end_body_0|> <|body_start_1|> if not legacy_pyroot: tra...
Regression19TGL
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Regression19TGL: def test1TGLVertex3OperatorPlus(self): """Try invoking TGLVertex3::operator+ twice""" <|body_0|> def test2TGLLine3Constructor(self): """Check that the right constructor of TGLLine3 is called""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_065701
29,305
no_license
[ { "docstring": "Try invoking TGLVertex3::operator+ twice", "name": "test1TGLVertex3OperatorPlus", "signature": "def test1TGLVertex3OperatorPlus(self)" }, { "docstring": "Check that the right constructor of TGLLine3 is called", "name": "test2TGLLine3Constructor", "signature": "def test2TG...
2
stack_v2_sparse_classes_30k_train_019010
Implement the Python class `Regression19TGL` described below. Class description: Implement the Regression19TGL class. Method signatures and docstrings: - def test1TGLVertex3OperatorPlus(self): Try invoking TGLVertex3::operator+ twice - def test2TGLLine3Constructor(self): Check that the right constructor of TGLLine3 i...
Implement the Python class `Regression19TGL` described below. Class description: Implement the Regression19TGL class. Method signatures and docstrings: - def test1TGLVertex3OperatorPlus(self): Try invoking TGLVertex3::operator+ twice - def test2TGLLine3Constructor(self): Check that the right constructor of TGLLine3 i...
134508460915282a5d82d6cbbb6e6afa14653413
<|skeleton|> class Regression19TGL: def test1TGLVertex3OperatorPlus(self): """Try invoking TGLVertex3::operator+ twice""" <|body_0|> def test2TGLLine3Constructor(self): """Check that the right constructor of TGLLine3 is called""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Regression19TGL: def test1TGLVertex3OperatorPlus(self): """Try invoking TGLVertex3::operator+ twice""" if not legacy_pyroot: scatteringPoint = TGLVertex3(2.0, 3.0, 0.2) glvec3 = TGLVector3(1, 2, 3) vertexEnd = scatteringPoint + glvec3 vertexEnd =...
the_stack_v2_python_sparse
python/regression/PyROOT_regressiontests.py
root-project/roottest
train
41
78d5677e32e6b588b32f33b38158759f6a2a96bf
[ "if dispositivo_id:\n dispositivo = Dispositivo.objects.get(pk=dispositivo_id)\n form = FormDispositivo(instance=dispositivo)\nelse:\n form = FormDispositivo()\nreturn render(request, self.template, {'form': form})", "if dispositivo_id:\n dispositivo = Dispositivo.objects.get(pk=dispositivo_id)\n f...
<|body_start_0|> if dispositivo_id: dispositivo = Dispositivo.objects.get(pk=dispositivo_id) form = FormDispositivo(instance=dispositivo) else: form = FormDispositivo() return render(request, self.template, {'form': form}) <|end_body_0|> <|body_start_1|> ...
Cadastra os dispositivos
CadastroDispositivoView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CadastroDispositivoView: """Cadastra os dispositivos""" def get(self, request, dispositivo_id=None): """Cria um formulário para cadastrar o dispositivo""" <|body_0|> def post(self, request, dispositivo_id=None): """Envia para o servidor os dispositivos cadastrado...
stack_v2_sparse_classes_75kplus_train_065702
5,983
no_license
[ { "docstring": "Cria um formulário para cadastrar o dispositivo", "name": "get", "signature": "def get(self, request, dispositivo_id=None)" }, { "docstring": "Envia para o servidor os dispositivos cadastrados", "name": "post", "signature": "def post(self, request, dispositivo_id=None)" ...
2
stack_v2_sparse_classes_30k_train_048754
Implement the Python class `CadastroDispositivoView` described below. Class description: Cadastra os dispositivos Method signatures and docstrings: - def get(self, request, dispositivo_id=None): Cria um formulário para cadastrar o dispositivo - def post(self, request, dispositivo_id=None): Envia para o servidor os di...
Implement the Python class `CadastroDispositivoView` described below. Class description: Cadastra os dispositivos Method signatures and docstrings: - def get(self, request, dispositivo_id=None): Cria um formulário para cadastrar o dispositivo - def post(self, request, dispositivo_id=None): Envia para o servidor os di...
7b799a71380aca342e879c5556cc24fcebdac1ca
<|skeleton|> class CadastroDispositivoView: """Cadastra os dispositivos""" def get(self, request, dispositivo_id=None): """Cria um formulário para cadastrar o dispositivo""" <|body_0|> def post(self, request, dispositivo_id=None): """Envia para o servidor os dispositivos cadastrado...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CadastroDispositivoView: """Cadastra os dispositivos""" def get(self, request, dispositivo_id=None): """Cria um formulário para cadastrar o dispositivo""" if dispositivo_id: dispositivo = Dispositivo.objects.get(pk=dispositivo_id) form = FormDispositivo(instance=di...
the_stack_v2_python_sparse
detransapp/views/dispositivo.py
brunowber/transnote2
train
0
14c22047a04b3ec9cac12a21dd33cb0eec3d29f7
[ "for event in events:\n queue.get()\n print(event)", "events = ['operation: creating base image', 'Total: 1 packages', 'Fetched ', 'Completed ', 'operation: done creating base image', 'operation: creating developer image', 'operation: done creating developer image', 'operation: creating test image', 'operat...
<|body_start_0|> for event in events: queue.get() print(event) <|end_body_0|> <|body_start_1|> events = ['operation: creating base image', 'Total: 1 packages', 'Fetched ', 'Completed ', 'operation: done creating base image', 'operation: creating developer image', 'operation: don...
Test class for image_lib.BrilloImageOperation.
BrilloImageOperationTest
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BrilloImageOperationTest: """Test class for image_lib.BrilloImageOperation.""" def BrilloImageFake(self, events, queue): """Test function to emulate brillo image.""" <|body_0|> def testParseOutputBaseImageStage(self): """Test Base Image Creation Stage.""" ...
stack_v2_sparse_classes_75kplus_train_065703
14,494
permissive
[ { "docstring": "Test function to emulate brillo image.", "name": "BrilloImageFake", "signature": "def BrilloImageFake(self, events, queue)" }, { "docstring": "Test Base Image Creation Stage.", "name": "testParseOutputBaseImageStage", "signature": "def testParseOutputBaseImageStage(self)"...
6
stack_v2_sparse_classes_30k_train_048714
Implement the Python class `BrilloImageOperationTest` described below. Class description: Test class for image_lib.BrilloImageOperation. Method signatures and docstrings: - def BrilloImageFake(self, events, queue): Test function to emulate brillo image. - def testParseOutputBaseImageStage(self): Test Base Image Creat...
Implement the Python class `BrilloImageOperationTest` described below. Class description: Test class for image_lib.BrilloImageOperation. Method signatures and docstrings: - def BrilloImageFake(self, events, queue): Test function to emulate brillo image. - def testParseOutputBaseImageStage(self): Test Base Image Creat...
e71f21b9b4b9b839f5093301974a45545dad2691
<|skeleton|> class BrilloImageOperationTest: """Test class for image_lib.BrilloImageOperation.""" def BrilloImageFake(self, events, queue): """Test function to emulate brillo image.""" <|body_0|> def testParseOutputBaseImageStage(self): """Test Base Image Creation Stage.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BrilloImageOperationTest: """Test class for image_lib.BrilloImageOperation.""" def BrilloImageFake(self, events, queue): """Test function to emulate brillo image.""" for event in events: queue.get() print(event) def testParseOutputBaseImageStage(self): ...
the_stack_v2_python_sparse
third_party/chromite/lib/image_lib_unittest.py
zenoalbisser/chromium
train
0
abd3c58f36126962cba2e37147fd986969b8c24e
[ "g1 = GeoIP()\npath = settings.GEOIP_PATH\ng2 = GeoIP(path, 0)\ng3 = GeoIP.open(path, 0)\nfor g in (g1, g2, g3):\n self.assertEqual(True, bool(g._country))\n self.assertEqual(True, bool(g._city))\ncity = os.path.join(path, 'GeoLiteCity.dat')\ncntry = os.path.join(path, 'GeoIP.dat')\ng4 = GeoIP(city, country='...
<|body_start_0|> g1 = GeoIP() path = settings.GEOIP_PATH g2 = GeoIP(path, 0) g3 = GeoIP.open(path, 0) for g in (g1, g2, g3): self.assertEqual(True, bool(g._country)) self.assertEqual(True, bool(g._city)) city = os.path.join(path, 'GeoLiteCity.dat')...
GeoIPTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeoIPTest: def test01_init(self): """Testing GeoIP initialization.""" <|body_0|> def test02_bad_query(self): """Testing GeoIP query parameter checking.""" <|body_1|> def test03_country(self): """Testing GeoIP country querying methods.""" ...
stack_v2_sparse_classes_75kplus_train_065704
4,706
permissive
[ { "docstring": "Testing GeoIP initialization.", "name": "test01_init", "signature": "def test01_init(self)" }, { "docstring": "Testing GeoIP query parameter checking.", "name": "test02_bad_query", "signature": "def test02_bad_query(self)" }, { "docstring": "Testing GeoIP country ...
6
stack_v2_sparse_classes_30k_train_028204
Implement the Python class `GeoIPTest` described below. Class description: Implement the GeoIPTest class. Method signatures and docstrings: - def test01_init(self): Testing GeoIP initialization. - def test02_bad_query(self): Testing GeoIP query parameter checking. - def test03_country(self): Testing GeoIP country que...
Implement the Python class `GeoIPTest` described below. Class description: Implement the GeoIPTest class. Method signatures and docstrings: - def test01_init(self): Testing GeoIP initialization. - def test02_bad_query(self): Testing GeoIP query parameter checking. - def test03_country(self): Testing GeoIP country que...
fa182e8ae82f33764d5e1f70bcd45899e1bf17e6
<|skeleton|> class GeoIPTest: def test01_init(self): """Testing GeoIP initialization.""" <|body_0|> def test02_bad_query(self): """Testing GeoIP query parameter checking.""" <|body_1|> def test03_country(self): """Testing GeoIP country querying methods.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GeoIPTest: def test01_init(self): """Testing GeoIP initialization.""" g1 = GeoIP() path = settings.GEOIP_PATH g2 = GeoIP(path, 0) g3 = GeoIP.open(path, 0) for g in (g1, g2, g3): self.assertEqual(True, bool(g._country)) self.assertEqual(Tr...
the_stack_v2_python_sparse
django/contrib/gis/geoip/tests.py
gregmuellegger/django
train
22
e38ac1555e6368c5013ba8e44c7063a0bc4e51d5
[ "self.box_pgap = PT2CM(1.25 * normal_font.get_size())\nself.box_mgap = self.box_pgap / 2\nself.box_shadow = PT2CM(normal_font.get_size()) * 0.6\nself.spouse_offset = PT2CM(doc.string_width(normal_font, '0'))\nself.col_width = PT2CM(doc.string_width(normal_font, '(000,0)'))\nself.littleoffset = PT2CM(1)\nself.x_cm_c...
<|body_start_0|> self.box_pgap = PT2CM(1.25 * normal_font.get_size()) self.box_mgap = self.box_pgap / 2 self.box_shadow = PT2CM(normal_font.get_size()) * 0.6 self.spouse_offset = PT2CM(doc.string_width(normal_font, '0')) self.col_width = PT2CM(doc.string_width(normal_font, '(000,...
A simple class to hold various report information Calculates the gap between persons, the column width, for lines, the left hand spacing for spouses (Descendant report only)
ReportOptions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReportOptions: """A simple class to hold various report information Calculates the gap between persons, the column width, for lines, the left hand spacing for spouses (Descendant report only)""" def __init__(self, doc, normal_font, normal_line): """initialize various report variables...
stack_v2_sparse_classes_75kplus_train_065705
35,846
no_license
[ { "docstring": "initialize various report variables that are used", "name": "__init__", "signature": "def __init__(self, doc, normal_font, normal_line)" }, { "docstring": "Scale the amounts that are needed to generate a report", "name": "scale_everything", "signature": "def scale_everyth...
2
stack_v2_sparse_classes_30k_train_009521
Implement the Python class `ReportOptions` described below. Class description: A simple class to hold various report information Calculates the gap between persons, the column width, for lines, the left hand spacing for spouses (Descendant report only) Method signatures and docstrings: - def __init__(self, doc, norma...
Implement the Python class `ReportOptions` described below. Class description: A simple class to hold various report information Calculates the gap between persons, the column width, for lines, the left hand spacing for spouses (Descendant report only) Method signatures and docstrings: - def __init__(self, doc, norma...
0c79561bed7ff42c88714edbc85197fa9235e188
<|skeleton|> class ReportOptions: """A simple class to hold various report information Calculates the gap between persons, the column width, for lines, the left hand spacing for spouses (Descendant report only)""" def __init__(self, doc, normal_font, normal_line): """initialize various report variables...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReportOptions: """A simple class to hold various report information Calculates the gap between persons, the column width, for lines, the left hand spacing for spouses (Descendant report only)""" def __init__(self, doc, normal_font, normal_line): """initialize various report variables that are use...
the_stack_v2_python_sparse
plugins/lib/libtreebase.py
balrok/gramps_addon
train
2
cc042f5895b5497943cc2cb4b3933ba4675477cf
[ "super(Obstacle, self).__init__(*groups)\nself.ani = SpritesheetAnimation(0.5, preloaded_ani)\nself.image = self.ani.next(0)\nself.rect = self.image.get_rect()\nself.rect.x, self.rect.y = location\nself.speed = spd\n'\\n if vertical:\\n self.xspeed = 0\\n self.yspeed = spd\\n els...
<|body_start_0|> super(Obstacle, self).__init__(*groups) self.ani = SpritesheetAnimation(0.5, preloaded_ani) self.image = self.ani.next(0) self.rect = self.image.get_rect() self.rect.x, self.rect.y = location self.speed = spd '\n if vertical:\n s...
Represents a mobile enemy that kills the player on touch
Obstacle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Obstacle: """Represents a mobile enemy that kills the player on touch""" def __init__(self, location, vertical, spd, image, *groups, preloaded_ani): """Default constructor Keyword Arguments: - location: A 2-tuple (x,y) representing the item location - vertical: Boolean representing i...
stack_v2_sparse_classes_75kplus_train_065706
3,008
permissive
[ { "docstring": "Default constructor Keyword Arguments: - location: A 2-tuple (x,y) representing the item location - vertical: Boolean representing if the item moves vertically - spd: The movement speed - image: A surface representing the image of the item - *groups: A collection of sprite groups to add the item...
2
null
Implement the Python class `Obstacle` described below. Class description: Represents a mobile enemy that kills the player on touch Method signatures and docstrings: - def __init__(self, location, vertical, spd, image, *groups, preloaded_ani): Default constructor Keyword Arguments: - location: A 2-tuple (x,y) represen...
Implement the Python class `Obstacle` described below. Class description: Represents a mobile enemy that kills the player on touch Method signatures and docstrings: - def __init__(self, location, vertical, spd, image, *groups, preloaded_ani): Default constructor Keyword Arguments: - location: A 2-tuple (x,y) represen...
0363fc368af205d1e829b2556ad70797930c10bd
<|skeleton|> class Obstacle: """Represents a mobile enemy that kills the player on touch""" def __init__(self, location, vertical, spd, image, *groups, preloaded_ani): """Default constructor Keyword Arguments: - location: A 2-tuple (x,y) representing the item location - vertical: Boolean representing i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Obstacle: """Represents a mobile enemy that kills the player on touch""" def __init__(self, location, vertical, spd, image, *groups, preloaded_ani): """Default constructor Keyword Arguments: - location: A 2-tuple (x,y) representing the item location - vertical: Boolean representing if the item mo...
the_stack_v2_python_sparse
Game/components/mobileobstacle.py
Penaz91/Glitch_Heaven
train
2
db850dce1434fbda4029a0abd7125d55d2935a6e
[ "def _isValidBST(root, minNode, maxNode):\n if not root:\n return True\n if minNode and root.val <= minNode.val or (maxNode and root.val >= maxNode.val):\n return False\n return _isValidBST(root.left, minNode, root) and _isValidBST(root.right, root, maxNode)\nreturn _isValidBST(root, None, No...
<|body_start_0|> def _isValidBST(root, minNode, maxNode): if not root: return True if minNode and root.val <= minNode.val or (maxNode and root.val >= maxNode.val): return False return _isValidBST(root.left, minNode, root) and _isValidBST(root.r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST1(self, root: TreeNode) -> bool: """递归 ~~左树存在一个上界,右树存在一个下界~~ 每个节点都存在一个上下界 空间复杂度:O(lgn)~O(n) 时间复杂度:O(n) :param root: :return:""" <|body_0|> def isValidBST2(self, root: TreeNode) -> bool: """中序遍历,如果非严格递增则return False 空间复杂度:O(n) 时间复杂度:O(n) :param...
stack_v2_sparse_classes_75kplus_train_065707
1,685
no_license
[ { "docstring": "递归 ~~左树存在一个上界,右树存在一个下界~~ 每个节点都存在一个上下界 空间复杂度:O(lgn)~O(n) 时间复杂度:O(n) :param root: :return:", "name": "isValidBST1", "signature": "def isValidBST1(self, root: TreeNode) -> bool" }, { "docstring": "中序遍历,如果非严格递增则return False 空间复杂度:O(n) 时间复杂度:O(n) :param root: :return:", "name": "i...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST1(self, root: TreeNode) -> bool: 递归 ~~左树存在一个上界,右树存在一个下界~~ 每个节点都存在一个上下界 空间复杂度:O(lgn)~O(n) 时间复杂度:O(n) :param root: :return: - def isValidBST2(self, root: TreeNode) ->...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST1(self, root: TreeNode) -> bool: 递归 ~~左树存在一个上界,右树存在一个下界~~ 每个节点都存在一个上下界 空间复杂度:O(lgn)~O(n) 时间复杂度:O(n) :param root: :return: - def isValidBST2(self, root: TreeNode) ->...
25f2795b6e7f9f68833f2fddc6cc4f4d977121a6
<|skeleton|> class Solution: def isValidBST1(self, root: TreeNode) -> bool: """递归 ~~左树存在一个上界,右树存在一个下界~~ 每个节点都存在一个上下界 空间复杂度:O(lgn)~O(n) 时间复杂度:O(n) :param root: :return:""" <|body_0|> def isValidBST2(self, root: TreeNode) -> bool: """中序遍历,如果非严格递增则return False 空间复杂度:O(n) 时间复杂度:O(n) :param...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isValidBST1(self, root: TreeNode) -> bool: """递归 ~~左树存在一个上界,右树存在一个下界~~ 每个节点都存在一个上下界 空间复杂度:O(lgn)~O(n) 时间复杂度:O(n) :param root: :return:""" def _isValidBST(root, minNode, maxNode): if not root: return True if minNode and root.val <= minNode.v...
the_stack_v2_python_sparse
98.py
Darkxiete/leetcode_python
train
0
1fa29a1c7b0f32a23a98940da7bc7c58fc5a0ab6
[ "def build(nums, current):\n if not nums:\n output.append(list(current))\n return\n for i, n in enumerate(nums):\n current.append(n)\n build(nums[:i] + nums[i + 1:], current)\n current.pop()\noutput = []\nbuild(nums, [])\nreturn output", "output = [[]]\nfor n in nums:\n ...
<|body_start_0|> def build(nums, current): if not nums: output.append(list(current)) return for i, n in enumerate(nums): current.append(n) build(nums[:i] + nums[i + 1:], current) current.pop() output ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permute_iterative(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> def permute_recursive(self, nums): """:type nums: ...
stack_v2_sparse_classes_75kplus_train_065708
2,697
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permute", "signature": "def permute(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permute_iterative", "signature": "def permute_iterative(self, nums)" }, { "docstri...
4
stack_v2_sparse_classes_30k_train_024368
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permute_iterative(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permute_recursive(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permute_iterative(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permute_recursive(...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permute_iterative(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> def permute_recursive(self, nums): """:type nums: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" def build(nums, current): if not nums: output.append(list(current)) return for i, n in enumerate(nums): current.append(n) ...
the_stack_v2_python_sparse
src/lt_46.py
oxhead/CodingYourWay
train
0
94ea513c1ef7d351589fd2502b6663ef99d5abe9
[ "if self.context:\n return '{0} ({1})'.format(self.text, self.context.name)\nreturn self.text", "events = session.happened.all()\nrequirement = self.requirements.exclude(event__in=events).first()\nif requirement:\n output = requirement.fail\nelif self.once and self in session.executed.all():\n output = '...
<|body_start_0|> if self.context: return '{0} ({1})'.format(self.text, self.context.name) return self.text <|end_body_0|> <|body_start_1|> events = session.happened.all() requirement = self.requirements.exclude(event__in=events).first() if requirement: ou...
Players action.
Command
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Command: """Players action.""" def __str__(self): """Mainly for editor. Returns: string""" <|body_0|> def execute(self, session): """Execute a command specified by player. Args: session: Session instance Returns: text about results of execution""" <|body_...
stack_v2_sparse_classes_75kplus_train_065709
2,282
no_license
[ { "docstring": "Mainly for editor. Returns: string", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": "Execute a command specified by player. Args: session: Session instance Returns: text about results of execution", "name": "execute", "signature": "def execute(self,...
2
null
Implement the Python class `Command` described below. Class description: Players action. Method signatures and docstrings: - def __str__(self): Mainly for editor. Returns: string - def execute(self, session): Execute a command specified by player. Args: session: Session instance Returns: text about results of executi...
Implement the Python class `Command` described below. Class description: Players action. Method signatures and docstrings: - def __str__(self): Mainly for editor. Returns: string - def execute(self, session): Execute a command specified by player. Args: session: Session instance Returns: text about results of executi...
6633c4ed55b8d893941571f94b46636f2e46e0f9
<|skeleton|> class Command: """Players action.""" def __str__(self): """Mainly for editor. Returns: string""" <|body_0|> def execute(self, session): """Execute a command specified by player. Args: session: Session instance Returns: text about results of execution""" <|body_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Command: """Players action.""" def __str__(self): """Mainly for editor. Returns: string""" if self.context: return '{0} ({1})'.format(self.text, self.context.name) return self.text def execute(self, session): """Execute a command specified by player. Args:...
the_stack_v2_python_sparse
command/models.py
Reno-Greenleaf/interactive_story
train
0
edfbe6b6ab689aa7951ba75ad55bd8fd474d8711
[ "ans = nums[0]\nlength = len(nums)\nif len(nums) == 1:\n return nums[0]\nsum1 = nums[0]\nfor i in range(1, length):\n if nums[i - 1] >= 0:\n nums[i] += nums[i - 1]\n if ans < nums[i]:\n ans = nums[i]\nreturn nums", "ans = nums[0]\nlength = len(nums)\nleft = 0\nright = 0\nresleft = 0\nresrig...
<|body_start_0|> ans = nums[0] length = len(nums) if len(nums) == 1: return nums[0] sum1 = nums[0] for i in range(1, length): if nums[i - 1] >= 0: nums[i] += nums[i - 1] if ans < nums[i]: ans = nums[i] re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1] :param nums: :return:""" <|body_0|> def maxSubArray2(self, nums): """这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1]找出其序列 :param nums: :return:""" <|body_1|> <|end_skeleton|> <|bo...
stack_v2_sparse_classes_75kplus_train_065710
1,353
no_license
[ { "docstring": "这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1] :param nums: :return:", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": "这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1]找出其序列 :param nums: :return:", "name": "maxSubArray2", "signature": "def maxSubAr...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): 这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1] :param nums: :return: - def maxSubArray2(self, nums): 这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1]找出其序列 :param...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): 这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1] :param nums: :return: - def maxSubArray2(self, nums): 这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1]找出其序列 :param...
d8ad2da776066ac3fd99f246cb2b41a921c21a73
<|skeleton|> class Solution: def maxSubArray(self, nums): """这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1] :param nums: :return:""" <|body_0|> def maxSubArray2(self, nums): """这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1]找出其序列 :param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxSubArray(self, nums): """这种方法用的是动态规划,主要参考值不能是nums[i] 而应该是nums[i-1] :param nums: :return:""" ans = nums[0] length = len(nums) if len(nums) == 1: return nums[0] sum1 = nums[0] for i in range(1, length): if nums[i - 1] >= 0:...
the_stack_v2_python_sparse
Python/LeetCode/LeetCode53maxSubArray.py
540928898/LeetCodeMe
train
0
8fc54190a636f5f51631eed96cf4ed1e74d5792e
[ "try:\n return int(re.match('[0-9]+', str(v)).group())\nexcept:\n return None", "b = AuditUtil.regex_match_digits(b)\nif b:\n return b / 1024 / 1024\nreturn None", "k = AuditUtil.regex_match_digits(k)\nif k:\n return k / 1024\nreturn None" ]
<|body_start_0|> try: return int(re.match('[0-9]+', str(v)).group()) except: return None <|end_body_0|> <|body_start_1|> b = AuditUtil.regex_match_digits(b) if b: return b / 1024 / 1024 return None <|end_body_1|> <|body_start_2|> k = ...
Contains helper methods for normalization of node audit data.
AuditUtil
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuditUtil: """Contains helper methods for normalization of node audit data.""" def regex_match_digits(v): """Extract the digits from an alphanumeric string. Parameters ---------- v : basestring alphanumeric input e.g. '1024kB' Returns ------- int the extracted numeric digits, or None...
stack_v2_sparse_classes_75kplus_train_065711
10,487
no_license
[ { "docstring": "Extract the digits from an alphanumeric string. Parameters ---------- v : basestring alphanumeric input e.g. '1024kB' Returns ------- int the extracted numeric digits, or None", "name": "regex_match_digits", "signature": "def regex_match_digits(v)" }, { "docstring": "Converts byt...
3
null
Implement the Python class `AuditUtil` described below. Class description: Contains helper methods for normalization of node audit data. Method signatures and docstrings: - def regex_match_digits(v): Extract the digits from an alphanumeric string. Parameters ---------- v : basestring alphanumeric input e.g. '1024kB' ...
Implement the Python class `AuditUtil` described below. Class description: Contains helper methods for normalization of node audit data. Method signatures and docstrings: - def regex_match_digits(v): Extract the digits from an alphanumeric string. Parameters ---------- v : basestring alphanumeric input e.g. '1024kB' ...
f855bd449bf09240151ddc7b6ded3673bd92e2d6
<|skeleton|> class AuditUtil: """Contains helper methods for normalization of node audit data.""" def regex_match_digits(v): """Extract the digits from an alphanumeric string. Parameters ---------- v : basestring alphanumeric input e.g. '1024kB' Returns ------- int the extracted numeric digits, or None...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuditUtil: """Contains helper methods for normalization of node audit data.""" def regex_match_digits(v): """Extract the digits from an alphanumeric string. Parameters ---------- v : basestring alphanumeric input e.g. '1024kB' Returns ------- int the extracted numeric digits, or None""" t...
the_stack_v2_python_sparse
connectors/chef.py
Oomnitza/oomnitza-connector
train
21
4af4026b5d14414378628687e31adb1d9150f501
[ "left, right = (0, len(nums) - 1)\nwhile left <= right:\n mid = left + (right - left) // 2\n if nums[mid] == target:\n return True\n elif nums[mid] > target:\n right = mid - 1\n else:\n left = mid + 1\nreturn False", "nums = []\nfor mtx in matrix:\n nums.extend(mtx)\nreturn sel...
<|body_start_0|> left, right = (0, len(nums) - 1) while left <= right: mid = left + (right - left) // 2 if nums[mid] == target: return True elif nums[mid] > target: right = mid - 1 else: left = mid + 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def binary_search(self, nums, target): """二分查找 :param nums: :return:""" <|body_0|> def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> left...
stack_v2_sparse_classes_75kplus_train_065712
1,434
no_license
[ { "docstring": "二分查找 :param nums: :return:", "name": "binary_search", "signature": "def binary_search(self, nums, target)" }, { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" } ]
2
stack_v2_sparse_classes_30k_train_015027
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binary_search(self, nums, target): 二分查找 :param nums: :return: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binary_search(self, nums, target): 二分查找 :param nums: :return: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool <|skelet...
f564806bd8e18831eeb20f2fd4bdd2d4aaa829ce
<|skeleton|> class Solution: def binary_search(self, nums, target): """二分查找 :param nums: :return:""" <|body_0|> def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def binary_search(self, nums, target): """二分查找 :param nums: :return:""" left, right = (0, len(nums) - 1) while left <= right: mid = left + (right - left) // 2 if nums[mid] == target: return True elif nums[mid] > target: ...
the_stack_v2_python_sparse
Week 03/id_684/LeetCode_74_684.py
cboopen/algorithm004-04
train
2
12b648353c300bfc08a9c48bcb92840c713a56e8
[ "super().__init__()\nself.node = node\nself.field = field\nself.titleCellRef = titleCellRef\nself.typeCellRef = typeCellRef\nself.idCellRef = idCellRef\nself.errorFlag = False\nself.doc = QtGui.QTextDocument()\nself.doc.setDefaultFont(defaultFont)\nself.doc.setDocumentMargin(6)\nself.updateText()", "self.errorFla...
<|body_start_0|> super().__init__() self.node = node self.field = field self.titleCellRef = titleCellRef self.typeCellRef = typeCellRef self.idCellRef = idCellRef self.errorFlag = False self.doc = QtGui.QTextDocument() self.doc.setDefaultFont(defau...
Class override for data edit view cells. Used for the cells with editable content.
DataEditCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataEditCell: """Class override for data edit view cells. Used for the cells with editable content.""" def __init__(self, node, field, titleCellRef, typeCellRef, idCellRef=None): """Initialize the editable cells in the data edit view. Arguments: node -- the node referenced by this ce...
stack_v2_sparse_classes_75kplus_train_065713
30,573
no_license
[ { "docstring": "Initialize the editable cells in the data edit view. Arguments: node -- the node referenced by this cell field -- the field object referenced by this cell titleCellRef -- the title cell to update based on data changes typeCellRef -- the format type cell to update based on type changes idCellRef ...
2
stack_v2_sparse_classes_30k_train_003924
Implement the Python class `DataEditCell` described below. Class description: Class override for data edit view cells. Used for the cells with editable content. Method signatures and docstrings: - def __init__(self, node, field, titleCellRef, typeCellRef, idCellRef=None): Initialize the editable cells in the data edi...
Implement the Python class `DataEditCell` described below. Class description: Class override for data edit view cells. Used for the cells with editable content. Method signatures and docstrings: - def __init__(self, node, field, titleCellRef, typeCellRef, idCellRef=None): Initialize the editable cells in the data edi...
5d818d85e87b1780e760b0dd023861daa6e9181a
<|skeleton|> class DataEditCell: """Class override for data edit view cells. Used for the cells with editable content.""" def __init__(self, node, field, titleCellRef, typeCellRef, idCellRef=None): """Initialize the editable cells in the data edit view. Arguments: node -- the node referenced by this ce...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataEditCell: """Class override for data edit view cells. Used for the cells with editable content.""" def __init__(self, node, field, titleCellRef, typeCellRef, idCellRef=None): """Initialize the editable cells in the data edit view. Arguments: node -- the node referenced by this cell field -- t...
the_stack_v2_python_sparse
TreeLine/source/dataeditview.py
priendeau/Treeline-encryption
train
0
3ac608bfd94df299e5db69490b343ffb65b62e61
[ "dp = [float('inf')] * (n + 1)\ndp[0] = 0\nfor i in range(1, n + 1):\n for j in range(1, int(i ** 0.5) + 1):\n dp[i] = min(dp[i], dp[i - j * j] + 1)\nreturn dp[n]", "queue = [node(n)]\nvisited = set([node(n).value])\nwhile queue:\n vertex = queue.pop(0)\n residuals = [vertex.value - n * n for n in...
<|body_start_0|> dp = [float('inf')] * (n + 1) dp[0] = 0 for i in range(1, n + 1): for j in range(1, int(i ** 0.5) + 1): dp[i] = min(dp[i], dp[i - j * j] + 1) return dp[n] <|end_body_0|> <|body_start_1|> queue = [node(n)] visited = set([node(n...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares_dp(self, n): """:type n: int :rtype: int dp[i]代表到数字i组成最少完全平方个数 动态转移方程:dp[i] = min(dp[i], dp[i - j * j] + 1), j <= sqrt{i} + 1""" <|body_0|> def numSquares_bfs(self, n): """:type n: int :rtype: int BFS 其实是很简单的基础算法,抓住如下几点即可轻松写出不易错的 baseline: BF...
stack_v2_sparse_classes_75kplus_train_065714
2,613
no_license
[ { "docstring": ":type n: int :rtype: int dp[i]代表到数字i组成最少完全平方个数 动态转移方程:dp[i] = min(dp[i], dp[i - j * j] + 1), j <= sqrt{i} + 1", "name": "numSquares_dp", "signature": "def numSquares_dp(self, n)" }, { "docstring": ":type n: int :rtype: int BFS 其实是很简单的基础算法,抓住如下几点即可轻松写出不易错的 baseline: BFS 算法组成的 3 元素...
2
stack_v2_sparse_classes_30k_train_052206
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares_dp(self, n): :type n: int :rtype: int dp[i]代表到数字i组成最少完全平方个数 动态转移方程:dp[i] = min(dp[i], dp[i - j * j] + 1), j <= sqrt{i} + 1 - def numSquares_bfs(self, n): :type n: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares_dp(self, n): :type n: int :rtype: int dp[i]代表到数字i组成最少完全平方个数 动态转移方程:dp[i] = min(dp[i], dp[i - j * j] + 1), j <= sqrt{i} + 1 - def numSquares_bfs(self, n): :type n: ...
3f4284330f9771037ca59e2e6a94122e51e58540
<|skeleton|> class Solution: def numSquares_dp(self, n): """:type n: int :rtype: int dp[i]代表到数字i组成最少完全平方个数 动态转移方程:dp[i] = min(dp[i], dp[i - j * j] + 1), j <= sqrt{i} + 1""" <|body_0|> def numSquares_bfs(self, n): """:type n: int :rtype: int BFS 其实是很简单的基础算法,抓住如下几点即可轻松写出不易错的 baseline: BF...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numSquares_dp(self, n): """:type n: int :rtype: int dp[i]代表到数字i组成最少完全平方个数 动态转移方程:dp[i] = min(dp[i], dp[i - j * j] + 1), j <= sqrt{i} + 1""" dp = [float('inf')] * (n + 1) dp[0] = 0 for i in range(1, n + 1): for j in range(1, int(i ** 0.5) + 1): ...
the_stack_v2_python_sparse
Leetcode/279.完全平方数.py
myf-algorithm/Leetcode
train
1
ae1a6bcfaf6dbd3b67fb56ef61fa3da33ad7db40
[ "super().__init__(models)\nif y_best is not None:\n self.y_best = y_best\nelse:\n self.y_best = self.models[0].y.max()", "m, n = (self.n_models, X.shape[0])\nmeans, sds, gammas = (np.zeros((m, n)), np.zeros((m, n)), np.zeros((m, n)))\nfor i, mod in enumerate(self.models):\n means[i], var = mod.predict(X,...
<|body_start_0|> super().__init__(models) if y_best is not None: self.y_best = y_best else: self.y_best = self.models[0].y.max() <|end_body_0|> <|body_start_1|> m, n = (self.n_models, X.shape[0]) means, sds, gammas = (np.zeros((m, n)), np.zeros((m, n)), n...
Improvement-Based Acquisition Function Class Common acquisition function can be interpreted as improvements over the best seen observation so far. In particular, Thor implements the probability of improvement and expected improvement acquisition function, which measures the probability that an input will result in an i...
ImprovementAcquisitionFunction
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImprovementAcquisitionFunction: """Improvement-Based Acquisition Function Class Common acquisition function can be interpreted as improvements over the best seen observation so far. In particular, Thor implements the probability of improvement and expected improvement acquisition function, which ...
stack_v2_sparse_classes_75kplus_train_065715
3,387
permissive
[ { "docstring": "Initialize parameters of the improvement-based acquisition function.", "name": "__init__", "signature": "def __init__(self, models, y_best=None)" }, { "docstring": "Compute a z-score quantity for the prediction at a given input. This allows us to balance improvement over the curr...
2
stack_v2_sparse_classes_30k_train_046170
Implement the Python class `ImprovementAcquisitionFunction` described below. Class description: Improvement-Based Acquisition Function Class Common acquisition function can be interpreted as improvements over the best seen observation so far. In particular, Thor implements the probability of improvement and expected i...
Implement the Python class `ImprovementAcquisitionFunction` described below. Class description: Improvement-Based Acquisition Function Class Common acquisition function can be interpreted as improvements over the best seen observation so far. In particular, Thor implements the probability of improvement and expected i...
cb63d6dd476eba7dfe701643dc21694089ed881b
<|skeleton|> class ImprovementAcquisitionFunction: """Improvement-Based Acquisition Function Class Common acquisition function can be interpreted as improvements over the best seen observation so far. In particular, Thor implements the probability of improvement and expected improvement acquisition function, which ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ImprovementAcquisitionFunction: """Improvement-Based Acquisition Function Class Common acquisition function can be interpreted as improvements over the best seen observation so far. In particular, Thor implements the probability of improvement and expected improvement acquisition function, which measures the ...
the_stack_v2_python_sparse
sif/acquisitions/improvement_acquisition.py
afcarl/Sif-1
train
0
e2836bb170d2c5542e59a996e007076ced1df078
[ "self.resource = resource\nself.operation = operation\nself.body = body", "if dictionary is None:\n return None\nresource = dictionary.get('resource')\noperation = dictionary.get('operation')\nbody = dictionary.get('body')\nreturn cls(resource, operation, body)" ]
<|body_start_0|> self.resource = resource self.operation = operation self.body = body <|end_body_0|> <|body_start_1|> if dictionary is None: return None resource = dictionary.get('resource') operation = dictionary.get('operation') body = dictionary.ge...
Implementation of the 'Action' model. TODO: type model description here. Attributes: resource (string): Unique identifier for the resource to be acted on operation (string): The operation to be used body (object): The body of the action
ActionModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActionModel: """Implementation of the 'Action' model. TODO: type model description here. Attributes: resource (string): Unique identifier for the resource to be acted on operation (string): The operation to be used body (object): The body of the action""" def __init__(self, resource=None, op...
stack_v2_sparse_classes_75kplus_train_065716
1,855
permissive
[ { "docstring": "Constructor for the ActionModel class", "name": "__init__", "signature": "def __init__(self, resource=None, operation=None, body=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object ...
2
stack_v2_sparse_classes_30k_train_038466
Implement the Python class `ActionModel` described below. Class description: Implementation of the 'Action' model. TODO: type model description here. Attributes: resource (string): Unique identifier for the resource to be acted on operation (string): The operation to be used body (object): The body of the action Meth...
Implement the Python class `ActionModel` described below. Class description: Implementation of the 'Action' model. TODO: type model description here. Attributes: resource (string): Unique identifier for the resource to be acted on operation (string): The operation to be used body (object): The body of the action Meth...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class ActionModel: """Implementation of the 'Action' model. TODO: type model description here. Attributes: resource (string): Unique identifier for the resource to be acted on operation (string): The operation to be used body (object): The body of the action""" def __init__(self, resource=None, op...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ActionModel: """Implementation of the 'Action' model. TODO: type model description here. Attributes: resource (string): Unique identifier for the resource to be acted on operation (string): The operation to be used body (object): The body of the action""" def __init__(self, resource=None, operation=None,...
the_stack_v2_python_sparse
meraki_sdk/models/action_model.py
RaulCatalano/meraki-python-sdk
train
1
eb741835f9be1c52d54f8f1a0abe90e43b480d39
[ "tf.enable_eager_execution()\nif not isinstance(style_image, np.ndarray) or len(style_image.shape) != 3 or style_image.shape[2] != 3:\n raise TypeError('style_image must be a numpy.ndarray with shape (h, w, 3)')\nif not isinstance(content_image, np.ndarray) or len(content_image.shape) != 3 or content_image.shape...
<|body_start_0|> tf.enable_eager_execution() if not isinstance(style_image, np.ndarray) or len(style_image.shape) != 3 or style_image.shape[2] != 3: raise TypeError('style_image must be a numpy.ndarray with shape (h, w, 3)') if not isinstance(content_image, np.ndarray) or len(content...
A class including model designed to do style transfer between two images
NST
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NST: """A class including model designed to do style transfer between two images""" def __init__(self, style_image, content_image, alpha=10000.0, beta=1): """Initialize the class. @style_image: image for style to mimic @content_image: image we're modifying to match style @alpha: lear...
stack_v2_sparse_classes_75kplus_train_065717
2,225
no_license
[ { "docstring": "Initialize the class. @style_image: image for style to mimic @content_image: image we're modifying to match style @alpha: learning rate for content @beta: learning rate for style", "name": "__init__", "signature": "def __init__(self, style_image, content_image, alpha=10000.0, beta=1)" ...
2
stack_v2_sparse_classes_30k_train_053714
Implement the Python class `NST` described below. Class description: A class including model designed to do style transfer between two images Method signatures and docstrings: - def __init__(self, style_image, content_image, alpha=10000.0, beta=1): Initialize the class. @style_image: image for style to mimic @content...
Implement the Python class `NST` described below. Class description: A class including model designed to do style transfer between two images Method signatures and docstrings: - def __init__(self, style_image, content_image, alpha=10000.0, beta=1): Initialize the class. @style_image: image for style to mimic @content...
56356c56297d8391bad8a1607eb226489766bc63
<|skeleton|> class NST: """A class including model designed to do style transfer between two images""" def __init__(self, style_image, content_image, alpha=10000.0, beta=1): """Initialize the class. @style_image: image for style to mimic @content_image: image we're modifying to match style @alpha: lear...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NST: """A class including model designed to do style transfer between two images""" def __init__(self, style_image, content_image, alpha=10000.0, beta=1): """Initialize the class. @style_image: image for style to mimic @content_image: image we're modifying to match style @alpha: learning rate for...
the_stack_v2_python_sparse
supervised_learning/0x0C-neural_style_transfer/0-neural_style.py
sidneyriffic/holbertonschool-machine_learning
train
1
0b0c1e8a86731cba2b2a2f1bbf78b24f0e618973
[ "env_id = requests.GET.get('env_id')\nenv = Environment.objects.get(env_id=env_id)\ncontent = {'env': env, 'projrcts': Project.objects.all()}\nreturn render(requests, 'project_env/env_update.html', content)", "env_id = requests.GET.get('env_id')\nenv_info = Environment.objects.filter(env_id=env_id)\nenv_url = req...
<|body_start_0|> env_id = requests.GET.get('env_id') env = Environment.objects.get(env_id=env_id) content = {'env': env, 'projrcts': Project.objects.all()} return render(requests, 'project_env/env_update.html', content) <|end_body_0|> <|body_start_1|> env_id = requests.GET.get('...
update_env
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class update_env: def get(self, requests): """获取编辑页面""" <|body_0|> def post(self, requests): """进行编辑接口操作""" <|body_1|> <|end_skeleton|> <|body_start_0|> env_id = requests.GET.get('env_id') env = Environment.objects.get(env_id=env_id) conte...
stack_v2_sparse_classes_75kplus_train_065718
10,476
no_license
[ { "docstring": "获取编辑页面", "name": "get", "signature": "def get(self, requests)" }, { "docstring": "进行编辑接口操作", "name": "post", "signature": "def post(self, requests)" } ]
2
stack_v2_sparse_classes_30k_train_033169
Implement the Python class `update_env` described below. Class description: Implement the update_env class. Method signatures and docstrings: - def get(self, requests): 获取编辑页面 - def post(self, requests): 进行编辑接口操作
Implement the Python class `update_env` described below. Class description: Implement the update_env class. Method signatures and docstrings: - def get(self, requests): 获取编辑页面 - def post(self, requests): 进行编辑接口操作 <|skeleton|> class update_env: def get(self, requests): """获取编辑页面""" <|body_0|> ...
c26d8a49bdcc309cca377639a72c67d5ff06b67e
<|skeleton|> class update_env: def get(self, requests): """获取编辑页面""" <|body_0|> def post(self, requests): """进行编辑接口操作""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class update_env: def get(self, requests): """获取编辑页面""" env_id = requests.GET.get('env_id') env = Environment.objects.get(env_id=env_id) content = {'env': env, 'projrcts': Project.objects.all()} return render(requests, 'project_env/env_update.html', content) def post(sel...
the_stack_v2_python_sparse
apps/project_env/views.py
wanyafei/AutoTestform
train
1
81d9751b6730413d8536bab2e33e8aedf599c535
[ "row = 3\nglobal cookies\ncookies = cookies\nurl = self.obj.get_value(row, self.obj.get_host()) + self.obj.get_value(row, self.obj.get_urlxpath())\ndata = eval(self.obj.get_value(row, self.obj.get_params()))\nobj = requests.request(method=self.obj.get_value(row, self.obj.get_method()), url=url, data=data, cookies=c...
<|body_start_0|> row = 3 global cookies cookies = cookies url = self.obj.get_value(row, self.obj.get_host()) + self.obj.get_value(row, self.obj.get_urlxpath()) data = eval(self.obj.get_value(row, self.obj.get_params())) obj = requests.request(method=self.obj.get_value(row...
Testalterpwd
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Testalterpwd: def test_case1(self): """设置支付密码失败,密码不一致""" <|body_0|> def test_case2(self): """设置支付密码失败,请输入新密码""" <|body_1|> def test_case3(self): """设置支付密码失败,请确认新密码""" <|body_2|> def test_case4(self): """设置支付密码失败,请输入新密码""" ...
stack_v2_sparse_classes_75kplus_train_065719
3,539
no_license
[ { "docstring": "设置支付密码失败,密码不一致", "name": "test_case1", "signature": "def test_case1(self)" }, { "docstring": "设置支付密码失败,请输入新密码", "name": "test_case2", "signature": "def test_case2(self)" }, { "docstring": "设置支付密码失败,请确认新密码", "name": "test_case3", "signature": "def test_case...
5
stack_v2_sparse_classes_30k_train_004424
Implement the Python class `Testalterpwd` described below. Class description: Implement the Testalterpwd class. Method signatures and docstrings: - def test_case1(self): 设置支付密码失败,密码不一致 - def test_case2(self): 设置支付密码失败,请输入新密码 - def test_case3(self): 设置支付密码失败,请确认新密码 - def test_case4(self): 设置支付密码失败,请输入新密码 - def test_ca...
Implement the Python class `Testalterpwd` described below. Class description: Implement the Testalterpwd class. Method signatures and docstrings: - def test_case1(self): 设置支付密码失败,密码不一致 - def test_case2(self): 设置支付密码失败,请输入新密码 - def test_case3(self): 设置支付密码失败,请确认新密码 - def test_case4(self): 设置支付密码失败,请输入新密码 - def test_ca...
f073c1539c4e77fbf093b2fe6b5de6a1c3727e47
<|skeleton|> class Testalterpwd: def test_case1(self): """设置支付密码失败,密码不一致""" <|body_0|> def test_case2(self): """设置支付密码失败,请输入新密码""" <|body_1|> def test_case3(self): """设置支付密码失败,请确认新密码""" <|body_2|> def test_case4(self): """设置支付密码失败,请输入新密码""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Testalterpwd: def test_case1(self): """设置支付密码失败,密码不一致""" row = 3 global cookies cookies = cookies url = self.obj.get_value(row, self.obj.get_host()) + self.obj.get_value(row, self.obj.get_urlxpath()) data = eval(self.obj.get_value(row, self.obj.get_params())) ...
the_stack_v2_python_sparse
Project/test_res/test_alterpwd.py
xiaotiankeyi/portTest
train
0
8d8cbc2d7d526ef646f3a236d44f9af1bd7ead27
[ "self.window_size = window_size\nself.history_size = history_size\nself.msgs = dict()\nself.history = [[] for _ in range(history_size)]", "mid: Tuple[bytes, bytes] = (msg.seqno, msg.from_id)\nself.msgs[mid] = msg\nself.history[0].append(CacheEntry(mid, msg.topicIDs))", "if mid in self.msgs:\n return self.msg...
<|body_start_0|> self.window_size = window_size self.history_size = history_size self.msgs = dict() self.history = [[] for _ in range(history_size)] <|end_body_0|> <|body_start_1|> mid: Tuple[bytes, bytes] = (msg.seqno, msg.from_id) self.msgs[mid] = msg self.hist...
MessageCache
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessageCache: def __init__(self, window_size: int, history_size: int) -> None: """Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history desired. :return: the MessageCache""" <|body_0|> def put(self, msg: rpc_pb2.Message) -> Non...
stack_v2_sparse_classes_75kplus_train_065720
2,953
permissive
[ { "docstring": "Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history desired. :return: the MessageCache", "name": "__init__", "signature": "def __init__(self, window_size: int, history_size: int) -> None" }, { "docstring": "Put a message into the ...
5
stack_v2_sparse_classes_30k_train_021921
Implement the Python class `MessageCache` described below. Class description: Implement the MessageCache class. Method signatures and docstrings: - def __init__(self, window_size: int, history_size: int) -> None: Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history des...
Implement the Python class `MessageCache` described below. Class description: Implement the MessageCache class. Method signatures and docstrings: - def __init__(self, window_size: int, history_size: int) -> None: Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history des...
b38b36862f44421aec998e438b668cff265de75c
<|skeleton|> class MessageCache: def __init__(self, window_size: int, history_size: int) -> None: """Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history desired. :return: the MessageCache""" <|body_0|> def put(self, msg: rpc_pb2.Message) -> Non...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MessageCache: def __init__(self, window_size: int, history_size: int) -> None: """Constructor. :param window_size: Size of the window desired. :param history_size: Size of the history desired. :return: the MessageCache""" self.window_size = window_size self.history_size = history_size ...
the_stack_v2_python_sparse
libp2p/pubsub/mcache.py
libp2p/py-libp2p
train
399
e76ea67c34129393b23335ae1ab31ba755bc250f
[ "try:\n run_permission_hooks('clone', obj)\nexcept PermissionDenied:\n return False\nelse:\n perm_codename = self.get_perm_codename('add')\n return self.user_has_specific_permission(user, perm_codename)", "try:\n run_permission_hooks('update', obj)\nexcept PermissionDenied:\n return False\nelse:...
<|body_start_0|> try: run_permission_hooks('clone', obj) except PermissionDenied: return False else: perm_codename = self.get_perm_codename('add') return self.user_has_specific_permission(user, perm_codename) <|end_body_0|> <|body_start_1|> ...
Custom permission helper class for Wagtail Omni forms
WagtailOmniFormPermissionHelper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WagtailOmniFormPermissionHelper: """Custom permission helper class for Wagtail Omni forms""" def user_can_clone_obj(self, user, obj): """Checks that the user has permission to clone a form in the system :param user: Logged in user instance :param obj: OmniForm model instance :return:...
stack_v2_sparse_classes_75kplus_train_065721
22,300
permissive
[ { "docstring": "Checks that the user has permission to clone a form in the system :param user: Logged in user instance :param obj: OmniForm model instance :return: bool - True if the user can create a form instance, otherwise false", "name": "user_can_clone_obj", "signature": "def user_can_clone_obj(sel...
3
stack_v2_sparse_classes_30k_test_001098
Implement the Python class `WagtailOmniFormPermissionHelper` described below. Class description: Custom permission helper class for Wagtail Omni forms Method signatures and docstrings: - def user_can_clone_obj(self, user, obj): Checks that the user has permission to clone a form in the system :param user: Logged in u...
Implement the Python class `WagtailOmniFormPermissionHelper` described below. Class description: Custom permission helper class for Wagtail Omni forms Method signatures and docstrings: - def user_can_clone_obj(self, user, obj): Checks that the user has permission to clone a form in the system :param user: Logged in u...
0c96162445f8b5ddf7f326f6b0a2e6ec239c4bd5
<|skeleton|> class WagtailOmniFormPermissionHelper: """Custom permission helper class for Wagtail Omni forms""" def user_can_clone_obj(self, user, obj): """Checks that the user has permission to clone a form in the system :param user: Logged in user instance :param obj: OmniForm model instance :return:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WagtailOmniFormPermissionHelper: """Custom permission helper class for Wagtail Omni forms""" def user_can_clone_obj(self, user, obj): """Checks that the user has permission to clone a form in the system :param user: Logged in user instance :param obj: OmniForm model instance :return: bool - True ...
the_stack_v2_python_sparse
omniforms/wagtail/wagtail_hooks.py
omni-digital/omni-forms
train
6
d3481ff3f0b77030941a8c44e56588e4a624f161
[ "self.__host = host\nself.__port = port\nhttplib.HTTPSConnection.__init__(self, host=self.__host, port=self.__port, strict=strict)\nif HttpsConnectionHandler.debug:\n self.set_debuglevel(1)", "if not HttpsConnectionHandler.compress or (data.find('Host:') > -1 and data.find('Accept-Encoding:') > -1 and (data.fi...
<|body_start_0|> self.__host = host self.__port = port httplib.HTTPSConnection.__init__(self, host=self.__host, port=self.__port, strict=strict) if HttpsConnectionHandler.debug: self.set_debuglevel(1) <|end_body_0|> <|body_start_1|> if not HttpsConnectionHandler.comp...
Implements HttpsConnectionHandler. Responsible for creating custom HTTPS connection object to intercept ZSI's implementation. Provides support for sending and recieving compressed data. Overwrites httplib's send(), putrequest(), putheader(), endheaders(), and getresponse().
HttpsConnectionHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HttpsConnectionHandler: """Implements HttpsConnectionHandler. Responsible for creating custom HTTPS connection object to intercept ZSI's implementation. Provides support for sending and recieving compressed data. Overwrites httplib's send(), putrequest(), putheader(), endheaders(), and getrespons...
stack_v2_sparse_classes_75kplus_train_065722
5,569
permissive
[ { "docstring": "Inits HttpsConnectionHandler with host and port. Args: host: str HTTPS host or combined form of host:port. [optional] port: int HTTPS port number. strict: bool if True, causes BadStatusLine to be raised if the status line can't be parsed as a valid HTTP/1.0 or 1.1 status line.", "name": "__i...
6
null
Implement the Python class `HttpsConnectionHandler` described below. Class description: Implements HttpsConnectionHandler. Responsible for creating custom HTTPS connection object to intercept ZSI's implementation. Provides support for sending and recieving compressed data. Overwrites httplib's send(), putrequest(), pu...
Implement the Python class `HttpsConnectionHandler` described below. Class description: Implements HttpsConnectionHandler. Responsible for creating custom HTTPS connection object to intercept ZSI's implementation. Provides support for sending and recieving compressed data. Overwrites httplib's send(), putrequest(), pu...
34197dfbdb01479f288611a0cb700e925c4e56ce
<|skeleton|> class HttpsConnectionHandler: """Implements HttpsConnectionHandler. Responsible for creating custom HTTPS connection object to intercept ZSI's implementation. Provides support for sending and recieving compressed data. Overwrites httplib's send(), putrequest(), putheader(), endheaders(), and getrespons...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HttpsConnectionHandler: """Implements HttpsConnectionHandler. Responsible for creating custom HTTPS connection object to intercept ZSI's implementation. Provides support for sending and recieving compressed data. Overwrites httplib's send(), putrequest(), putheader(), endheaders(), and getresponse().""" ...
the_stack_v2_python_sparse
keygrabber/adwords/adwords_api_python_14.2.1/adspygoogle/common/zsi/HttpsConnectionHandler.py
MujaahidSalie/aranciulla
train
0
99b8b7a834c0de135f3388ed0c0a0380c1937ac5
[ "print('-- DGC.convert')\nprint('1- Depth gradient estimator: estimating Gx, Gy using the given databaseFeatures')\nDGC.DepthGradientEstimator(image, conversionParam, databaseFeatures)\nprint('2- Depth reconstructor: estimating the depth map')\nDGC.DepthConstructor(image, conversionParam)\nprint('3- Stereo creator ...
<|body_start_0|> print('-- DGC.convert') print('1- Depth gradient estimator: estimating Gx, Gy using the given databaseFeatures') DGC.DepthGradientEstimator(image, conversionParam, databaseFeatures) print('2- Depth reconstructor: estimating the depth map') DGC.DepthConstructor(im...
Depth Gradient Converter class, a child from Basic Converter class to handle medium and close shots
DGC
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DGC: """Depth Gradient Converter class, a child from Basic Converter class to handle medium and close shots""" def convert(image, conversionParam, databaseFeatures): """DGC Conversion consists of 3 sequential steps: 1) Depth gradient estimator: estimating Gx, Gy using the given datab...
stack_v2_sparse_classes_75kplus_train_065723
3,727
no_license
[ { "docstring": "DGC Conversion consists of 3 sequential steps: 1) Depth gradient estimator: estimating Gx, Gy using the given databaseFeatures 2) Depth reconstructor: estimating the depth map 3) Stereo creator from V+D: creating the leftImage, rightImage, and sideBySide It changes the leftImage and rightImage a...
4
null
Implement the Python class `DGC` described below. Class description: Depth Gradient Converter class, a child from Basic Converter class to handle medium and close shots Method signatures and docstrings: - def convert(image, conversionParam, databaseFeatures): DGC Conversion consists of 3 sequential steps: 1) Depth gr...
Implement the Python class `DGC` described below. Class description: Depth Gradient Converter class, a child from Basic Converter class to handle medium and close shots Method signatures and docstrings: - def convert(image, conversionParam, databaseFeatures): DGC Conversion consists of 3 sequential steps: 1) Depth gr...
6763c61c25157ca8fa842e7147636b50fc298071
<|skeleton|> class DGC: """Depth Gradient Converter class, a child from Basic Converter class to handle medium and close shots""" def convert(image, conversionParam, databaseFeatures): """DGC Conversion consists of 3 sequential steps: 1) Depth gradient estimator: estimating Gx, Gy using the given datab...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DGC: """Depth Gradient Converter class, a child from Basic Converter class to handle medium and close shots""" def convert(image, conversionParam, databaseFeatures): """DGC Conversion consists of 3 sequential steps: 1) Depth gradient estimator: estimating Gx, Gy using the given databaseFeatures 2...
the_stack_v2_python_sparse
V3VCore/Converter/DGC.py
atroudi/V3V_2
train
0
7003682d90ec26c166df8169eea50dbc48029d8e
[ "super(CatDbConnection, self).connect()\nschs = self.fetchall('SELECT current_schemas(false)')\naddschs = [sch for sch in schs[0]['current_schemas'] if sch != 'public']\nsrch_path = 'pg_catalog'\nif addschs:\n srch_path += ', ' + ', '.join(addschs)\nself.execute('set search_path to %s' % srch_path)\nself.commit(...
<|body_start_0|> super(CatDbConnection, self).connect() schs = self.fetchall('SELECT current_schemas(false)') addschs = [sch for sch in schs[0]['current_schemas'] if sch != 'public'] srch_path = 'pg_catalog' if addschs: srch_path += ', ' + ', '.join(addschs) s...
A database connection, specialized for querying catalogs
CatDbConnection
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CatDbConnection: """A database connection, specialized for querying catalogs""" def connect(self): """Connect to the database""" <|body_0|> def version(self): """The server's version number""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(C...
stack_v2_sparse_classes_75kplus_train_065724
26,796
permissive
[ { "docstring": "Connect to the database", "name": "connect", "signature": "def connect(self)" }, { "docstring": "The server's version number", "name": "version", "signature": "def version(self)" } ]
2
null
Implement the Python class `CatDbConnection` described below. Class description: A database connection, specialized for querying catalogs Method signatures and docstrings: - def connect(self): Connect to the database - def version(self): The server's version number
Implement the Python class `CatDbConnection` described below. Class description: A database connection, specialized for querying catalogs Method signatures and docstrings: - def connect(self): Connect to the database - def version(self): The server's version number <|skeleton|> class CatDbConnection: """A databa...
ec682513d5256e383647f38f7fba29530cfb9fbe
<|skeleton|> class CatDbConnection: """A database connection, specialized for querying catalogs""" def connect(self): """Connect to the database""" <|body_0|> def version(self): """The server's version number""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CatDbConnection: """A database connection, specialized for querying catalogs""" def connect(self): """Connect to the database""" super(CatDbConnection, self).connect() schs = self.fetchall('SELECT current_schemas(false)') addschs = [sch for sch in schs[0]['current_schemas'...
the_stack_v2_python_sparse
pyrseas/database.py
perseas/Pyrseas
train
323
4565c7b8b4dbc2832519dd865eb1f6c386495adb
[ "if applyTransform:\n boundPts = [obj.matrix_world * Vector(corner) for corner in obj.bound_box]\nelse:\n boundPts = obj.bound_box\nxmin = min([pt[0] for pt in boundPts])\nxmax = max([pt[0] for pt in boundPts])\nymin = min([pt[1] for pt in boundPts])\nymax = max([pt[1] for pt in boundPts])\nzmin = min([pt[2] ...
<|body_start_0|> if applyTransform: boundPts = [obj.matrix_world * Vector(corner) for corner in obj.bound_box] else: boundPts = obj.bound_box xmin = min([pt[0] for pt in boundPts]) xmax = max([pt[0] for pt in boundPts]) ymin = min([pt[1] for pt in boundPts...
Utilities to build BBOX object from various Blender context
getBBOX
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class getBBOX: """Utilities to build BBOX object from various Blender context""" def fromObj(obj, applyTransform=True): """Create a 3D BBOX from Blender object""" <|body_0|> def fromScn(cls, scn): """Create a 3D BBOX from Blender Scene union of bounding box of all obje...
stack_v2_sparse_classes_75kplus_train_065725
7,516
no_license
[ { "docstring": "Create a 3D BBOX from Blender object", "name": "fromObj", "signature": "def fromObj(obj, applyTransform=True)" }, { "docstring": "Create a 3D BBOX from Blender Scene union of bounding box of all objects containing in the scene", "name": "fromScn", "signature": "def fromSc...
4
stack_v2_sparse_classes_30k_train_026177
Implement the Python class `getBBOX` described below. Class description: Utilities to build BBOX object from various Blender context Method signatures and docstrings: - def fromObj(obj, applyTransform=True): Create a 3D BBOX from Blender object - def fromScn(cls, scn): Create a 3D BBOX from Blender Scene union of bou...
Implement the Python class `getBBOX` described below. Class description: Utilities to build BBOX object from various Blender context Method signatures and docstrings: - def fromObj(obj, applyTransform=True): Create a 3D BBOX from Blender object - def fromScn(cls, scn): Create a 3D BBOX from Blender Scene union of bou...
c3469272f0775ca8c9ad98e74465e16610ef0983
<|skeleton|> class getBBOX: """Utilities to build BBOX object from various Blender context""" def fromObj(obj, applyTransform=True): """Create a 3D BBOX from Blender object""" <|body_0|> def fromScn(cls, scn): """Create a 3D BBOX from Blender Scene union of bounding box of all obje...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class getBBOX: """Utilities to build BBOX object from various Blender context""" def fromObj(obj, applyTransform=True): """Create a 3D BBOX from Blender object""" if applyTransform: boundPts = [obj.matrix_world * Vector(corner) for corner in obj.bound_box] else: ...
the_stack_v2_python_sparse
operators/utils/bgis_utils.py
blendergis/BlenderGIS
train
3
ba8ed6bab97d79e5110c1a1bd21897e61461a7c3
[ "distro = remote.get_os_distrib()\nif distro in cls._NFS_CHECKS:\n command = cls._NFS_CHECKS[distro]\n remote.execute_command(command, run_as_root=True)\nelse:\n LOG.warning('Cannot verify installation of NFS mount tools for unknown distro {distro}.'.format(distro=distro))", "local_path = self._get_path(...
<|body_start_0|> distro = remote.get_os_distrib() if distro in cls._NFS_CHECKS: command = cls._NFS_CHECKS[distro] remote.execute_command(command, run_as_root=True) else: LOG.warning('Cannot verify installation of NFS mount tools for unknown distro {distro}.'.f...
Handles mounting of a single NFS share to any number of instances.
_NFSMounter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _NFSMounter: """Handles mounting of a single NFS share to any number of instances.""" def setup_instance(cls, remote): """Prepares an instance to mount this type of share.""" <|body_0|> def mount_to_instance(self, remote, share_info): """Mounts the share to the i...
stack_v2_sparse_classes_75kplus_train_065726
11,562
permissive
[ { "docstring": "Prepares an instance to mount this type of share.", "name": "setup_instance", "signature": "def setup_instance(cls, remote)" }, { "docstring": "Mounts the share to the instance as configured.", "name": "mount_to_instance", "signature": "def mount_to_instance(self, remote,...
3
stack_v2_sparse_classes_30k_val_001506
Implement the Python class `_NFSMounter` described below. Class description: Handles mounting of a single NFS share to any number of instances. Method signatures and docstrings: - def setup_instance(cls, remote): Prepares an instance to mount this type of share. - def mount_to_instance(self, remote, share_info): Moun...
Implement the Python class `_NFSMounter` described below. Class description: Handles mounting of a single NFS share to any number of instances. Method signatures and docstrings: - def setup_instance(cls, remote): Prepares an instance to mount this type of share. - def mount_to_instance(self, remote, share_info): Moun...
a806a536b623b4ce1a345d5718505a5f04c987f4
<|skeleton|> class _NFSMounter: """Handles mounting of a single NFS share to any number of instances.""" def setup_instance(cls, remote): """Prepares an instance to mount this type of share.""" <|body_0|> def mount_to_instance(self, remote, share_info): """Mounts the share to the i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _NFSMounter: """Handles mounting of a single NFS share to any number of instances.""" def setup_instance(cls, remote): """Prepares an instance to mount this type of share.""" distro = remote.get_os_distrib() if distro in cls._NFS_CHECKS: command = cls._NFS_CHECKS[distr...
the_stack_v2_python_sparse
sahara/service/edp/shares.py
openstack/sahara
train
165
1f3b385394e5ff2251ba972809e2e2b06b9b0a1e
[ "rmb = 0\nrmb = usd * 6.33\nprint(f'{usd}美元可兑换{rmb}人民币')", "usd = 0\nusd = rmb / 6.33\nprint(f'{rmb}人民币可兑换{usd}美元')" ]
<|body_start_0|> rmb = 0 rmb = usd * 6.33 print(f'{usd}美元可兑换{rmb}人民币') <|end_body_0|> <|body_start_1|> usd = 0 usd = rmb / 6.33 print(f'{rmb}人民币可兑换{usd}美元') <|end_body_1|>
美元转换人民币,人民币转换美元
Currency
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Currency: """美元转换人民币,人民币转换美元""" def usd_to_rmb(self, usd): """美元转人民币""" <|body_0|> def rmb_to_usd(self, rmb): """人民币转美元""" <|body_1|> <|end_skeleton|> <|body_start_0|> rmb = 0 rmb = usd * 6.33 print(f'{usd}美元可兑换{rmb}人民币') <|end_b...
stack_v2_sparse_classes_75kplus_train_065727
2,776
no_license
[ { "docstring": "美元转人民币", "name": "usd_to_rmb", "signature": "def usd_to_rmb(self, usd)" }, { "docstring": "人民币转美元", "name": "rmb_to_usd", "signature": "def rmb_to_usd(self, rmb)" } ]
2
null
Implement the Python class `Currency` described below. Class description: 美元转换人民币,人民币转换美元 Method signatures and docstrings: - def usd_to_rmb(self, usd): 美元转人民币 - def rmb_to_usd(self, rmb): 人民币转美元
Implement the Python class `Currency` described below. Class description: 美元转换人民币,人民币转换美元 Method signatures and docstrings: - def usd_to_rmb(self, usd): 美元转人民币 - def rmb_to_usd(self, rmb): 人民币转美元 <|skeleton|> class Currency: """美元转换人民币,人民币转换美元""" def usd_to_rmb(self, usd): """美元转人民币""" <|bod...
355c7251dda058deefc80f3bffbf6c541d92ad41
<|skeleton|> class Currency: """美元转换人民币,人民币转换美元""" def usd_to_rmb(self, usd): """美元转人民币""" <|body_0|> def rmb_to_usd(self, rmb): """人民币转美元""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Currency: """美元转换人民币,人民币转换美元""" def usd_to_rmb(self, usd): """美元转人民币""" rmb = 0 rmb = usd * 6.33 print(f'{usd}美元可兑换{rmb}人民币') def rmb_to_usd(self, rmb): """人民币转美元""" usd = 0 usd = rmb / 6.33 print(f'{rmb}人民币可兑换{usd}美元')
the_stack_v2_python_sparse
0202obj-pengtao/translator_v1.0.py
echolvan/homework
train
0
98060b4873157f332869b13137b4263e473d0e4e
[ "self.logger = logger\nself._loop = loop\nself._in_path = in_path\nself._out_path = out_path\nself._in = -1\nself._out = -1\nself._stream_reader = None\nself._reader_protocol = None\nself._fileobj = None\nself._connection_attempts = PIPE_CONN_ATTEMPTS\nself._connection_timeout = PIPE_CONN_TIMEOUT", "if self._loop...
<|body_start_0|> self.logger = logger self._loop = loop self._in_path = in_path self._out_path = out_path self._in = -1 self._out = -1 self._stream_reader = None self._reader_protocol = None self._fileobj = None self._connection_attempts = ...
Posix named pipes async wrapper communication protocol.
PosixNamedPipeProtocol
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PosixNamedPipeProtocol: """Posix named pipes async wrapper communication protocol.""" def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None: """Initialize a new posix named pipe. :param in_path: rendezv...
stack_v2_sparse_classes_75kplus_train_065728
23,051
permissive
[ { "docstring": "Initialize a new posix named pipe. :param in_path: rendezvous point for incoming data :param out_path: rendezvous point for outgoing data :param logger: the logger :param loop: the event loop", "name": "__init__", "signature": "def __init__(self, in_path: str, out_path: str, logger: logg...
6
stack_v2_sparse_classes_30k_train_014097
Implement the Python class `PosixNamedPipeProtocol` described below. Class description: Posix named pipes async wrapper communication protocol. Method signatures and docstrings: - def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None: I...
Implement the Python class `PosixNamedPipeProtocol` described below. Class description: Posix named pipes async wrapper communication protocol. Method signatures and docstrings: - def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None: I...
bec49adaeba661d8d0f03ac9935dc89f39d95a0d
<|skeleton|> class PosixNamedPipeProtocol: """Posix named pipes async wrapper communication protocol.""" def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None: """Initialize a new posix named pipe. :param in_path: rendezv...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PosixNamedPipeProtocol: """Posix named pipes async wrapper communication protocol.""" def __init__(self, in_path: str, out_path: str, logger: logging.Logger=_default_logger, loop: Optional[AbstractEventLoop]=None) -> None: """Initialize a new posix named pipe. :param in_path: rendezvous point for...
the_stack_v2_python_sparse
aea/helpers/pipe.py
fetchai/agents-aea
train
192
9d1a434935dc92f34a1a78f4b3f8b0efdf9596c4
[ "self.basename = addon\nself.addon_type = ValidAddons.get_addon_type(self.basename)\nself.module = 'gungame51.scripts.%s.%s.%s' % (self.addon_type, self.basename, self.basename)\ninstance = __import__(self.module, globals(), locals(), [''])\nreload(instance)\nself.globals = instance.__dict__\nself.info = self._get_...
<|body_start_0|> self.basename = addon self.addon_type = ValidAddons.get_addon_type(self.basename) self.module = 'gungame51.scripts.%s.%s.%s' % (self.addon_type, self.basename, self.basename) instance = __import__(self.module, globals(), locals(), ['']) reload(instance) s...
Class that stores the instance of an included/custom addon
_AddonInstance
[ "Artistic-1.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _AddonInstance: """Class that stores the instance of an included/custom addon""" def __init__(self, addon): """Called when the addon is first imported""" <|body_0|> def _get_addon_info(self): """Returns the AddonInfo instance for the addon""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_065729
2,595
permissive
[ { "docstring": "Called when the addon is first imported", "name": "__init__", "signature": "def __init__(self, addon)" }, { "docstring": "Returns the AddonInfo instance for the addon", "name": "_get_addon_info", "signature": "def _get_addon_info(self)" } ]
2
stack_v2_sparse_classes_30k_train_041779
Implement the Python class `_AddonInstance` described below. Class description: Class that stores the instance of an included/custom addon Method signatures and docstrings: - def __init__(self, addon): Called when the addon is first imported - def _get_addon_info(self): Returns the AddonInfo instance for the addon
Implement the Python class `_AddonInstance` described below. Class description: Class that stores the instance of an included/custom addon Method signatures and docstrings: - def __init__(self, addon): Called when the addon is first imported - def _get_addon_info(self): Returns the AddonInfo instance for the addon <...
ebf4624626266f552189a32612b8d09cd5b4c5a3
<|skeleton|> class _AddonInstance: """Class that stores the instance of an included/custom addon""" def __init__(self, addon): """Called when the addon is first imported""" <|body_0|> def _get_addon_info(self): """Returns the AddonInfo instance for the addon""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class _AddonInstance: """Class that stores the instance of an included/custom addon""" def __init__(self, addon): """Called when the addon is first imported""" self.basename = addon self.addon_type = ValidAddons.get_addon_type(self.basename) self.module = 'gungame51.scripts.%s.%...
the_stack_v2_python_sparse
cstrike/addons/eventscripts/gungame51/core/addons/instance.py
GunGame-Dev-Team/GunGame51
train
0
7fd83ee6c3e489d73a224e09e00cd92c0be79640
[ "if Articles.objects.filter(slug=article_slug).exists():\n comment = request.data.get('comment', {})\n article = Articles.objects.filter(slug=article_slug).first()\n comment.update({'article': article})\n serializer = self.serializer_class(data=comment)\n serializer.is_valid(raise_exception=True)\n ...
<|body_start_0|> if Articles.objects.filter(slug=article_slug).exists(): comment = request.data.get('comment', {}) article = Articles.objects.filter(slug=article_slug).first() comment.update({'article': article}) serializer = self.serializer_class(data=comment) ...
Endpoint for creating a comments
CreateCommentView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateCommentView: """Endpoint for creating a comments""" def post(self, request, article_slug): """Handles all post requests to create a comment""" <|body_0|> def get(self, request, article_slug): """Handles all get requests by users to view the comments of a pa...
stack_v2_sparse_classes_75kplus_train_065730
8,741
permissive
[ { "docstring": "Handles all post requests to create a comment", "name": "post", "signature": "def post(self, request, article_slug)" }, { "docstring": "Handles all get requests by users to view the comments of a particular article", "name": "get", "signature": "def get(self, request, art...
2
stack_v2_sparse_classes_30k_train_035608
Implement the Python class `CreateCommentView` described below. Class description: Endpoint for creating a comments Method signatures and docstrings: - def post(self, request, article_slug): Handles all post requests to create a comment - def get(self, request, article_slug): Handles all get requests by users to view...
Implement the Python class `CreateCommentView` described below. Class description: Endpoint for creating a comments Method signatures and docstrings: - def post(self, request, article_slug): Handles all post requests to create a comment - def get(self, request, article_slug): Handles all get requests by users to view...
ff4f1ba34d074e68e49f7896848f81b729542e1f
<|skeleton|> class CreateCommentView: """Endpoint for creating a comments""" def post(self, request, article_slug): """Handles all post requests to create a comment""" <|body_0|> def get(self, request, article_slug): """Handles all get requests by users to view the comments of a pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CreateCommentView: """Endpoint for creating a comments""" def post(self, request, article_slug): """Handles all post requests to create a comment""" if Articles.objects.filter(slug=article_slug).exists(): comment = request.data.get('comment', {}) article = Articles...
the_stack_v2_python_sparse
authors/apps/comments/views.py
rfpremier/ah-django
train
0
ff1dc5ae25fe95e389bd1178c4ffe7e8bfe8b6cb
[ "custom_args = self.args if custom_args is None else custom_args\nproc = subprocess.Popen([self.cmd] + custom_args, shell=False, bufsize=-1, cwd=self.git_repo_dir, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\noutput, error = proc.communicate()\nself.results = {'output': output, 'error': e...
<|body_start_0|> custom_args = self.args if custom_args is None else custom_args proc = subprocess.Popen([self.cmd] + custom_args, shell=False, bufsize=-1, cwd=self.git_repo_dir, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output, error = proc.communicate() sel...
A simple interface for some common interactions with the git binary
MunkiGit
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MunkiGit: """A simple interface for some common interactions with the git binary""" def run_git(self, custom_args=None): """Executes the git command with the current set of arguments and returns a dictionary with the keys 'output', 'error', and 'returncode'. You can optionally pass a...
stack_v2_sparse_classes_75kplus_train_065731
5,017
permissive
[ { "docstring": "Executes the git command with the current set of arguments and returns a dictionary with the keys 'output', 'error', and 'returncode'. You can optionally pass an array into customArgs to override the self.args value without overwriting them.", "name": "run_git", "signature": "def run_git...
6
stack_v2_sparse_classes_30k_val_000776
Implement the Python class `MunkiGit` described below. Class description: A simple interface for some common interactions with the git binary Method signatures and docstrings: - def run_git(self, custom_args=None): Executes the git command with the current set of arguments and returns a dictionary with the keys 'outp...
Implement the Python class `MunkiGit` described below. Class description: A simple interface for some common interactions with the git binary Method signatures and docstrings: - def run_git(self, custom_args=None): Executes the git command with the current set of arguments and returns a dictionary with the keys 'outp...
0ba369100a7fa5864bd0107e4f77bd8787737ba3
<|skeleton|> class MunkiGit: """A simple interface for some common interactions with the git binary""" def run_git(self, custom_args=None): """Executes the git command with the current set of arguments and returns a dictionary with the keys 'output', 'error', and 'returncode'. You can optionally pass a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MunkiGit: """A simple interface for some common interactions with the git binary""" def run_git(self, custom_args=None): """Executes the git command with the current set of arguments and returns a dictionary with the keys 'output', 'error', and 'returncode'. You can optionally pass an array into ...
the_stack_v2_python_sparse
munkiwebadmin/utils.py
poundbangbash/mwa2
train
0
8caafb2e69682d5c6ff187dd10554eb4fc693cb5
[ "if auth_header is None or type(auth_header) != str or (not auth_header.startswith('Basic ')):\n return None\nreturn auth_header.split(' ')[1]", "if b64_auth_header is None or type(b64_auth_header) != str:\n return None\ntry:\n return base64.b64decode(b64_auth_header.encode('ascii')).decode('ascii')\nexc...
<|body_start_0|> if auth_header is None or type(auth_header) != str or (not auth_header.startswith('Basic ')): return None return auth_header.split(' ')[1] <|end_body_0|> <|body_start_1|> if b64_auth_header is None or type(b64_auth_header) != str: return None try...
BasicAuth class.
BasicAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicAuth: """BasicAuth class.""" def extract_base64_authorization_header(self, auth_header: str) -> str: """Returns Base64 of the Authorization header""" <|body_0|> def decode_base64_authorization_header(self, b64_auth_header: str) -> str: """Returns decoded val...
stack_v2_sparse_classes_75kplus_train_065732
1,999
no_license
[ { "docstring": "Returns Base64 of the Authorization header", "name": "extract_base64_authorization_header", "signature": "def extract_base64_authorization_header(self, auth_header: str) -> str" }, { "docstring": "Returns decoded value of a Base64 string", "name": "decode_base64_authorization...
4
stack_v2_sparse_classes_30k_test_000672
Implement the Python class `BasicAuth` described below. Class description: BasicAuth class. Method signatures and docstrings: - def extract_base64_authorization_header(self, auth_header: str) -> str: Returns Base64 of the Authorization header - def decode_base64_authorization_header(self, b64_auth_header: str) -> str...
Implement the Python class `BasicAuth` described below. Class description: BasicAuth class. Method signatures and docstrings: - def extract_base64_authorization_header(self, auth_header: str) -> str: Returns Base64 of the Authorization header - def decode_base64_authorization_header(self, b64_auth_header: str) -> str...
0aa1f87942a34efe436a8bebf95cc267cd846e04
<|skeleton|> class BasicAuth: """BasicAuth class.""" def extract_base64_authorization_header(self, auth_header: str) -> str: """Returns Base64 of the Authorization header""" <|body_0|> def decode_base64_authorization_header(self, b64_auth_header: str) -> str: """Returns decoded val...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasicAuth: """BasicAuth class.""" def extract_base64_authorization_header(self, auth_header: str) -> str: """Returns Base64 of the Authorization header""" if auth_header is None or type(auth_header) != str or (not auth_header.startswith('Basic ')): return None return a...
the_stack_v2_python_sparse
0x06-Basic_authentication/api/v1/auth/basic_auth.py
maleksal/holbertonschool-web_back_end
train
1
b48d0cc3a0347ee9da7f29b18238dfea97c8f00f
[ "assert IGSContentManagerFolderMarker in providedBy(folder)\nself.context = self.folder = folder\nself.__tree = None", "if self.__tree is None:\n self.__tree = self.get_tree(self.get_root(self.folder))\nretval = self.__tree\nassert retval\nassert len(retval) == 2\nassert IGSContentManagerFolderMarker in provid...
<|body_start_0|> assert IGSContentManagerFolderMarker in providedBy(folder) self.context = self.folder = folder self.__tree = None <|end_body_0|> <|body_start_1|> if self.__tree is None: self.__tree = self.get_tree(self.get_root(self.folder)) retval = self.__tree ...
A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. PROPERTIES tree The tree as a 2-tuple: (node, children).
PageTree
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PageTree: """A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. PROPERTIES tree The tree as a 2-tuple: (...
stack_v2_sparse_classes_75kplus_train_065733
5,595
permissive
[ { "docstring": "Create a tree. ARGUMENTS folder A folder, any folder, in the tree.", "name": "__init__", "signature": "def __init__(self, folder)" }, { "docstring": "Get the tree as a 2-tuple: (node, children). Each child is represented as a 2-tuple of (node, children).", "name": "tree", ...
4
stack_v2_sparse_classes_30k_val_002051
Implement the Python class `PageTree` described below. Class description: A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. P...
Implement the Python class `PageTree` described below. Class description: A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. P...
2fd8d708f378eb1bde4a7331f724f4c9a3b974ae
<|skeleton|> class PageTree: """A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. PROPERTIES tree The tree as a 2-tuple: (...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PageTree: """A representation of a tree of pages as a list of lists. The methods here are old-skool COSC121 depth-first tree walking algorithms. The class itself is just a big ol' wrapper for the "tree" property. I remember this being a lot more difficult. PROPERTIES tree The tree as a 2-tuple: (node, childre...
the_stack_v2_python_sparse
Products/GSContentManager/pagetree.py
groupserver/Products.GSContentManager
train
0
75badd685a6aca2002c58b0da1066372d17809c2
[ "entry = AuditLog(actor_id=actor_id, log_time=datetime.utcnow(), action=action, description=description, on_user_id=on_user_id if on_user_id else None, on_group_id=on_group_id if on_group_id else None, on_permission_id=on_permission_id if on_permission_id else None, category=int(category))\ntry:\n entry.add(sess...
<|body_start_0|> entry = AuditLog(actor_id=actor_id, log_time=datetime.utcnow(), action=action, description=description, on_user_id=on_user_id if on_user_id else None, on_group_id=on_group_id if on_group_id else None, on_permission_id=on_permission_id if on_permission_id else None, category=int(category)) ...
Logs actions taken in the system. This is a pretty simple logging framework to just let us track everything that happened. The main use case is to show users what has happened recently, to help them understand.
AuditLog
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuditLog: """Logs actions taken in the system. This is a pretty simple logging framework to just let us track everything that happened. The main use case is to show users what has happened recently, to help them understand.""" def log(session, actor_id, action, description, on_user_id=None, ...
stack_v2_sparse_classes_75kplus_train_065734
5,000
permissive
[ { "docstring": "Log an event in the database. Args: session(Session): database session actor_id(int): actor action(str): unique string identifier for action taken description(str): description for action taken on_user_id(int): user affected, if any on_group_id(int): group affected, if any on_permission_id(int):...
2
null
Implement the Python class `AuditLog` described below. Class description: Logs actions taken in the system. This is a pretty simple logging framework to just let us track everything that happened. The main use case is to show users what has happened recently, to help them understand. Method signatures and docstrings:...
Implement the Python class `AuditLog` described below. Class description: Logs actions taken in the system. This is a pretty simple logging framework to just let us track everything that happened. The main use case is to show users what has happened recently, to help them understand. Method signatures and docstrings:...
a4dae2a016ced01399e491964e0d7516113670a8
<|skeleton|> class AuditLog: """Logs actions taken in the system. This is a pretty simple logging framework to just let us track everything that happened. The main use case is to show users what has happened recently, to help them understand.""" def log(session, actor_id, action, description, on_user_id=None, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuditLog: """Logs actions taken in the system. This is a pretty simple logging framework to just let us track everything that happened. The main use case is to show users what has happened recently, to help them understand.""" def log(session, actor_id, action, description, on_user_id=None, on_group_id=N...
the_stack_v2_python_sparse
grouper/models/audit_log.py
dropbox/merou
train
65
a7c46aedba6fdde82f4e12e17763a6e542483afb
[ "super(ConsumerComplaints, self).__init__(name, **kwargs)\nself.website_id = 'consumer_complaints'\nself.website_type = 'complaint'", "base_url = 'https://www.consumercomplaints.in/bysubcategory/mobile-handsets/page/%d'\nfor page_index in range(1, 2):\n request_url = base_url % page_index\n request = Reques...
<|body_start_0|> super(ConsumerComplaints, self).__init__(name, **kwargs) self.website_id = 'consumer_complaints' self.website_type = 'complaint' <|end_body_0|> <|body_start_1|> base_url = 'https://www.consumercomplaints.in/bysubcategory/mobile-handsets/page/%d' for page_index i...
爬虫类 爬虫类名与 website_id 一致,不过遵循类名的首字母大写命名格式
ConsumerComplaints
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConsumerComplaints: """爬虫类 爬虫类名与 website_id 一致,不过遵循类名的首字母大写命名格式""" def __init__(self, name=None, **kwargs): """完成解析前的初始化工作,主要是将用的到 xpath 配合完成 :param self: 类的对象自身 :param name: scrapy 会将 name 属性传递进来 :param kwargs: 字典形式的参数,用于更新 self.__dict__ :return None""" <|body_0|> def s...
stack_v2_sparse_classes_75kplus_train_065735
3,480
no_license
[ { "docstring": "完成解析前的初始化工作,主要是将用的到 xpath 配合完成 :param self: 类的对象自身 :param name: scrapy 会将 name 属性传递进来 :param kwargs: 字典形式的参数,用于更新 self.__dict__ :return None", "name": "__init__", "signature": "def __init__(self, name=None, **kwargs)" }, { "docstring": "爬虫任务的起点,由于网站数据量有限,这里 url 为不变的 :warning: 增量更...
3
stack_v2_sparse_classes_30k_train_026978
Implement the Python class `ConsumerComplaints` described below. Class description: 爬虫类 爬虫类名与 website_id 一致,不过遵循类名的首字母大写命名格式 Method signatures and docstrings: - def __init__(self, name=None, **kwargs): 完成解析前的初始化工作,主要是将用的到 xpath 配合完成 :param self: 类的对象自身 :param name: scrapy 会将 name 属性传递进来 :param kwargs: 字典形式的参数,用于更新 se...
Implement the Python class `ConsumerComplaints` described below. Class description: 爬虫类 爬虫类名与 website_id 一致,不过遵循类名的首字母大写命名格式 Method signatures and docstrings: - def __init__(self, name=None, **kwargs): 完成解析前的初始化工作,主要是将用的到 xpath 配合完成 :param self: 类的对象自身 :param name: scrapy 会将 name 属性传递进来 :param kwargs: 字典形式的参数,用于更新 se...
1b42878b694fabc65a02228662ffdf819e5dcc71
<|skeleton|> class ConsumerComplaints: """爬虫类 爬虫类名与 website_id 一致,不过遵循类名的首字母大写命名格式""" def __init__(self, name=None, **kwargs): """完成解析前的初始化工作,主要是将用的到 xpath 配合完成 :param self: 类的对象自身 :param name: scrapy 会将 name 属性传递进来 :param kwargs: 字典形式的参数,用于更新 self.__dict__ :return None""" <|body_0|> def s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConsumerComplaints: """爬虫类 爬虫类名与 website_id 一致,不过遵循类名的首字母大写命名格式""" def __init__(self, name=None, **kwargs): """完成解析前的初始化工作,主要是将用的到 xpath 配合完成 :param self: 类的对象自身 :param name: scrapy 会将 name 属性传递进来 :param kwargs: 字典形式的参数,用于更新 self.__dict__ :return None""" super(ConsumerComplaints, self).__...
the_stack_v2_python_sparse
zhengkuo/consumer_complaints/consumer_complaints/spiders/consumer_complaints.py
wangsanshi123/spiders
train
0
a40e36424bdf0dac7ef3b258ce27876cfa3de4de
[ "self.host = host\nself.integral_volume_names = integral_volume_names\nself.password = password\nself.port = port\nself.share_type = share_type\nself.use_https = use_https\nself.username = username", "if dictionary is None:\n return None\nhost = dictionary.get('host')\nintegral_volume_names = dictionary.get('i...
<|body_start_0|> self.host = host self.integral_volume_names = integral_volume_names self.password = password self.port = port self.share_type = share_type self.use_https = use_https self.username = username <|end_body_0|> <|body_start_1|> if dictionary i...
Implementation of the 'QStarServerCredentials' model. Specifies the server credentials to connect to a QStar service to manage the media Vault. Attributes: host (string): Specifies the IP address or DNS name of the server where QStar service is running. integral_volume_names (list of string): Array of Integral Volume N...
QStarServerCredentials
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QStarServerCredentials: """Implementation of the 'QStarServerCredentials' model. Specifies the server credentials to connect to a QStar service to manage the media Vault. Attributes: host (string): Specifies the IP address or DNS name of the server where QStar service is running. integral_volume_...
stack_v2_sparse_classes_75kplus_train_065736
3,345
permissive
[ { "docstring": "Constructor for the QStarServerCredentials class", "name": "__init__", "signature": "def __init__(self, host=None, integral_volume_names=None, password=None, port=None, share_type=None, use_https=None, username=None)" }, { "docstring": "Creates an instance of this model from a di...
2
stack_v2_sparse_classes_30k_train_021712
Implement the Python class `QStarServerCredentials` described below. Class description: Implementation of the 'QStarServerCredentials' model. Specifies the server credentials to connect to a QStar service to manage the media Vault. Attributes: host (string): Specifies the IP address or DNS name of the server where QSt...
Implement the Python class `QStarServerCredentials` described below. Class description: Implementation of the 'QStarServerCredentials' model. Specifies the server credentials to connect to a QStar service to manage the media Vault. Attributes: host (string): Specifies the IP address or DNS name of the server where QSt...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class QStarServerCredentials: """Implementation of the 'QStarServerCredentials' model. Specifies the server credentials to connect to a QStar service to manage the media Vault. Attributes: host (string): Specifies the IP address or DNS name of the server where QStar service is running. integral_volume_...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QStarServerCredentials: """Implementation of the 'QStarServerCredentials' model. Specifies the server credentials to connect to a QStar service to manage the media Vault. Attributes: host (string): Specifies the IP address or DNS name of the server where QStar service is running. integral_volume_names (list o...
the_stack_v2_python_sparse
cohesity_management_sdk/models/q_star_server_credentials.py
cohesity/management-sdk-python
train
24
b922df153c49f845f03d8f14b6396bd3aed4da6e
[ "if not lists:\n return None\nfrom heapq import heappush, heappop\nheap = []\ntmp = 0\nfor n in lists:\n if n:\n heappush(heap, (n.val, (tmp, n)))\n tmp += 1\nif not heap:\n return None\nhead = cur = ListNode(None)\nwhile heap:\n v, (_, n) = heappop(heap)\n cur.next = n\n cur = cur.n...
<|body_start_0|> if not lists: return None from heapq import heappush, heappop heap = [] tmp = 0 for n in lists: if n: heappush(heap, (n.val, (tmp, n))) tmp += 1 if not heap: return None head = cu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKLists(self, lists): """08/04/2018 22:06""" <|body_0|> def mergeKLists(self, lists: List[Optional[ListNode]]) -> Optional[ListNode]: """Time complexity: O(n*m*n) Space complexity: O(n)""" <|body_1|> def mergeKLists(self, lists: List[Op...
stack_v2_sparse_classes_75kplus_train_065737
3,955
no_license
[ { "docstring": "08/04/2018 22:06", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring": "Time complexity: O(n*m*n) Space complexity: O(n)", "name": "mergeKLists", "signature": "def mergeKLists(self, lists: List[Optional[ListNode]]) -> Optional[ListNode]" ...
4
stack_v2_sparse_classes_30k_train_040840
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): 08/04/2018 22:06 - def mergeKLists(self, lists: List[Optional[ListNode]]) -> Optional[ListNode]: Time complexity: O(n*m*n) Space complexity: O(n) - ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): 08/04/2018 22:06 - def mergeKLists(self, lists: List[Optional[ListNode]]) -> Optional[ListNode]: Time complexity: O(n*m*n) Space complexity: O(n) - ...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def mergeKLists(self, lists): """08/04/2018 22:06""" <|body_0|> def mergeKLists(self, lists: List[Optional[ListNode]]) -> Optional[ListNode]: """Time complexity: O(n*m*n) Space complexity: O(n)""" <|body_1|> def mergeKLists(self, lists: List[Op...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mergeKLists(self, lists): """08/04/2018 22:06""" if not lists: return None from heapq import heappush, heappop heap = [] tmp = 0 for n in lists: if n: heappush(heap, (n.val, (tmp, n))) tmp += ...
the_stack_v2_python_sparse
leetcode/solved/23_Merge_k_Sorted_Lists/solution.py
sungminoh/algorithms
train
0
e63f75b56d0df9d60d6284b0fea1a47f205a1316
[ "states_series, hidden_size = self.hidden_layer()\nwith tf.variable_scope(constants.OUTPUT):\n states_series = tf.unstack(states_series, axis=1, name='unstack_states_series')\n self.batch_y_placeholder = tf.placeholder(dtype=tf.int32, shape=[self.settings.train.batch_size, self.settings.train.truncate], name=...
<|body_start_0|> states_series, hidden_size = self.hidden_layer() with tf.variable_scope(constants.OUTPUT): states_series = tf.unstack(states_series, axis=1, name='unstack_states_series') self.batch_y_placeholder = tf.placeholder(dtype=tf.int32, shape=[self.settings.train.batch_s...
An implementation of an RNN running with multiple inputs. @see RNNBase
MultiFeatureRNN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiFeatureRNN: """An implementation of an RNN running with multiple inputs. @see RNNBase""" def output_layer(self): """@see RNNBase.output_layer""" <|body_0|> def hidden_layer(self): """@see RNNBase.hidden_layer Also returns: - hidden_size (int): The size of th...
stack_v2_sparse_classes_75kplus_train_065738
16,835
permissive
[ { "docstring": "@see RNNBase.output_layer", "name": "output_layer", "signature": "def output_layer(self)" }, { "docstring": "@see RNNBase.hidden_layer Also returns: - hidden_size (int): The size of the hidden layer for multiple inputs (hidden_size * number_of_inputs)", "name": "hidden_layer"...
3
stack_v2_sparse_classes_30k_train_013486
Implement the Python class `MultiFeatureRNN` described below. Class description: An implementation of an RNN running with multiple inputs. @see RNNBase Method signatures and docstrings: - def output_layer(self): @see RNNBase.output_layer - def hidden_layer(self): @see RNNBase.hidden_layer Also returns: - hidden_size ...
Implement the Python class `MultiFeatureRNN` described below. Class description: An implementation of an RNN running with multiple inputs. @see RNNBase Method signatures and docstrings: - def output_layer(self): @see RNNBase.output_layer - def hidden_layer(self): @see RNNBase.hidden_layer Also returns: - hidden_size ...
23400d4deb775841a1b8aae2831c09cc043b8263
<|skeleton|> class MultiFeatureRNN: """An implementation of an RNN running with multiple inputs. @see RNNBase""" def output_layer(self): """@see RNNBase.output_layer""" <|body_0|> def hidden_layer(self): """@see RNNBase.hidden_layer Also returns: - hidden_size (int): The size of th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiFeatureRNN: """An implementation of an RNN running with multiple inputs. @see RNNBase""" def output_layer(self): """@see RNNBase.output_layer""" states_series, hidden_size = self.hidden_layer() with tf.variable_scope(constants.OUTPUT): states_series = tf.unstack(s...
the_stack_v2_python_sparse
tf_rnn/model.py
ffrankies/tf_rnn
train
1
9baee40b6dcff4c3136e0cd427ea69d5455cc071
[ "self.origin = origin\nself.destination = destination\nself.date = date\nself.return_date = return_date\nself.num_adults = num_adults\nself.passengers = {'kind': 'qpxexpress#passengerCounts', 'adultCount': num_adults}\nself.slices = [{'kind': 'qpxexpress#sliceInput', 'origin': origin, 'destination': destination, 'd...
<|body_start_0|> self.origin = origin self.destination = destination self.date = date self.return_date = return_date self.num_adults = num_adults self.passengers = {'kind': 'qpxexpress#passengerCounts', 'adultCount': num_adults} self.slices = [{'kind': 'qpxexpress...
QPX Request formatter.
QPXRequest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QPXRequest: """QPX Request formatter.""" def __init__(self, origin, destination, date, num_adults, return_date=None): """Create request object. :param origin: origin airport or IATA code :param destination: destination airport or IATA code :param date: datetime object :param num_adul...
stack_v2_sparse_classes_75kplus_train_065739
8,346
no_license
[ { "docstring": "Create request object. :param origin: origin airport or IATA code :param destination: destination airport or IATA code :param date: datetime object :param num_adults: integer representing the number of adults :kwarg return_date: datetime object", "name": "__init__", "signature": "def __i...
3
stack_v2_sparse_classes_30k_train_051488
Implement the Python class `QPXRequest` described below. Class description: QPX Request formatter. Method signatures and docstrings: - def __init__(self, origin, destination, date, num_adults, return_date=None): Create request object. :param origin: origin airport or IATA code :param destination: destination airport ...
Implement the Python class `QPXRequest` described below. Class description: QPX Request formatter. Method signatures and docstrings: - def __init__(self, origin, destination, date, num_adults, return_date=None): Create request object. :param origin: origin airport or IATA code :param destination: destination airport ...
362e6034764d97c78a48211c394f75caafad3eb3
<|skeleton|> class QPXRequest: """QPX Request formatter.""" def __init__(self, origin, destination, date, num_adults, return_date=None): """Create request object. :param origin: origin airport or IATA code :param destination: destination airport or IATA code :param date: datetime object :param num_adul...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class QPXRequest: """QPX Request formatter.""" def __init__(self, origin, destination, date, num_adults, return_date=None): """Create request object. :param origin: origin airport or IATA code :param destination: destination airport or IATA code :param date: datetime object :param num_adults: integer r...
the_stack_v2_python_sparse
enot_app/qpxexpress.py
noodlesen/raccoon
train
0
e4c0e617349eb7e96ead366aca413627c22e495f
[ "def thd(conn):\n submitted_at = datetime.now()\n submitted_at_epoch = time.mktime(submitted_at.timetuple())\n transaction = conn.begin()\n r = conn.execute(self.db.model.buildsets.insert(), dict(sourcestampid=ssid, submitted_at=submitted_at_epoch, reason=reason, external_idstring=external_idstring))\n ...
<|body_start_0|> def thd(conn): submitted_at = datetime.now() submitted_at_epoch = time.mktime(submitted_at.timetuple()) transaction = conn.begin() r = conn.execute(self.db.model.buildsets.insert(), dict(sourcestampid=ssid, submitted_at=submitted_at_epoch, reason=...
A DBConnectorComponent to handle getting buildsets into and out of the database. An instance is available at C{master.db.buildsets}.
BuildsetsConnectorComponent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildsetsConnectorComponent: """A DBConnectorComponent to handle getting buildsets into and out of the database. An instance is available at C{master.db.buildsets}.""" def addBuildset(self, ssid, reason, properties, builderNames, external_idstring=None): """Add a new Buildset to the ...
stack_v2_sparse_classes_75kplus_train_065740
5,968
no_license
[ { "docstring": "Add a new Buildset to the database, along with the buildrequests for each named builder, returning the resulting bsid via a Deferred. Arguments should be specified by keyword. @param ssid: id of the SourceStamp for this buildset @type ssid: integer @param reason: reason for this buildset @type r...
4
null
Implement the Python class `BuildsetsConnectorComponent` described below. Class description: A DBConnectorComponent to handle getting buildsets into and out of the database. An instance is available at C{master.db.buildsets}. Method signatures and docstrings: - def addBuildset(self, ssid, reason, properties, builderN...
Implement the Python class `BuildsetsConnectorComponent` described below. Class description: A DBConnectorComponent to handle getting buildsets into and out of the database. An instance is available at C{master.db.buildsets}. Method signatures and docstrings: - def addBuildset(self, ssid, reason, properties, builderN...
8f2806e1b83ff1df5f6f6313089c0d1d1f2fe288
<|skeleton|> class BuildsetsConnectorComponent: """A DBConnectorComponent to handle getting buildsets into and out of the database. An instance is available at C{master.db.buildsets}.""" def addBuildset(self, ssid, reason, properties, builderNames, external_idstring=None): """Add a new Buildset to the ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BuildsetsConnectorComponent: """A DBConnectorComponent to handle getting buildsets into and out of the database. An instance is available at C{master.db.buildsets}.""" def addBuildset(self, ssid, reason, properties, builderNames, external_idstring=None): """Add a new Buildset to the database, alo...
the_stack_v2_python_sparse
Lib/site-packages/buildbot/db/buildsets.py
acmiyaguchi/buildbotve
train
0
e318c2c5c922960ab49634f1943513ce804a2302
[ "delay = DelayFilter()\noriginal = delay(0)\nnorm = NormFilter()\nshift = ShiftSWFilter(window_size=2, strict_windows=False, cs=False)\nmean = MeanSWFilter(window_size=25, cs=False)\nstd = StdSWFilter(window_size=25, strict_windows=True)\ndtr = DecisionTreeRegressorSWFilter(window_size=100, strict_windows=True, ove...
<|body_start_0|> delay = DelayFilter() original = delay(0) norm = NormFilter() shift = ShiftSWFilter(window_size=2, strict_windows=False, cs=False) mean = MeanSWFilter(window_size=25, cs=False) std = StdSWFilter(window_size=25, strict_windows=True) dtr = DecisionT...
...
DtrEventSelector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DtrEventSelector: """...""" def seq_filters(): """:return:""" <|body_0|> def filter_events(self, event_seq, **kwargs): """Should be implemented :param event_seq:""" <|body_1|> <|end_skeleton|> <|body_start_0|> delay = DelayFilter() origi...
stack_v2_sparse_classes_75kplus_train_065741
4,290
permissive
[ { "docstring": ":return:", "name": "seq_filters", "signature": "def seq_filters()" }, { "docstring": "Should be implemented :param event_seq:", "name": "filter_events", "signature": "def filter_events(self, event_seq, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_025936
Implement the Python class `DtrEventSelector` described below. Class description: ... Method signatures and docstrings: - def seq_filters(): :return: - def filter_events(self, event_seq, **kwargs): Should be implemented :param event_seq:
Implement the Python class `DtrEventSelector` described below. Class description: ... Method signatures and docstrings: - def seq_filters(): :return: - def filter_events(self, event_seq, **kwargs): Should be implemented :param event_seq: <|skeleton|> class DtrEventSelector: """...""" def seq_filters(): ...
617ff45c9c3c96bbd9a975aef15f1b2697282b9c
<|skeleton|> class DtrEventSelector: """...""" def seq_filters(): """:return:""" <|body_0|> def filter_events(self, event_seq, **kwargs): """Should be implemented :param event_seq:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DtrEventSelector: """...""" def seq_filters(): """:return:""" delay = DelayFilter() original = delay(0) norm = NormFilter() shift = ShiftSWFilter(window_size=2, strict_windows=False, cs=False) mean = MeanSWFilter(window_size=25, cs=False) std = StdS...
the_stack_v2_python_sparse
shot_detector/selectors/event/dtr_event_selector.py
w495/python-video-shot-detector
train
20
95ef2b388a271b0a2e5b4b3331aab0ac6d40c581
[ "def dfs(node):\n if node:\n vals.append(str(node.val))\n dfs(node.left)\n dfs(node.right)\n else:\n vals.append('n')\nvals = []\ndfs(root)\nreturn ','.join(vals)", "def dfs():\n val = next(vals)\n if val == 'n':\n return None\n node = TreeNode(int(val))\n node...
<|body_start_0|> def dfs(node): if node: vals.append(str(node.val)) dfs(node.left) dfs(node.right) else: vals.append('n') vals = [] dfs(root) return ','.join(vals) <|end_body_0|> <|body_start_1|> ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_065742
2,805
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_022670
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
0171afb25cb555f19dd4b3f707ea3faee6793f4f
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def dfs(node): if node: vals.append(str(node.val)) dfs(node.left) dfs(node.right) else: vals.appen...
the_stack_v2_python_sparse
tree/#297.py
liyu10000/leetcode
train
3
7f5501a461322f3913e2f624fefb9951af3194cd
[ "self.gt1 = _gt_type(gt1)\nself.gt2 = _gt_type(gt2)\nself.na_ignore = na_ignore\nself.n_total = None\nself.n_share = None\nself.n_unique = None\nself._not_both_ref = None", "if self.na_ignore:\n self.n_total = (self.gt1 + self.gt2).fillna(0).map(lambda x: 1 if x != 0 else 0).sum()\nelse:\n self.n_total = (s...
<|body_start_0|> self.gt1 = _gt_type(gt1) self.gt2 = _gt_type(gt2) self.na_ignore = na_ignore self.n_total = None self.n_share = None self.n_unique = None self._not_both_ref = None <|end_body_0|> <|body_start_1|> if self.na_ignore: self.n_tota...
gt_pair
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class gt_pair: def __init__(self, gt1, gt2, na_ignore=False): """Parameters ---------- gt1, gt2: pd.Series Example ------- >>> gt1 = pd.Series([0, 1, 2, 0, 1, 2, 0, 1, 2, np.nan]) >>> gt2 = pd.Series([0, 1, 2, 1, 0, 1, np.nan, np.nan, np.nan, np.nan]) >>> gt = gt_pair(gt1, gt2).get_n_unique() ...
stack_v2_sparse_classes_75kplus_train_065743
21,141
permissive
[ { "docstring": "Parameters ---------- gt1, gt2: pd.Series Example ------- >>> gt1 = pd.Series([0, 1, 2, 0, 1, 2, 0, 1, 2, np.nan]) >>> gt2 = pd.Series([0, 1, 2, 1, 0, 1, np.nan, np.nan, np.nan, np.nan]) >>> gt = gt_pair(gt1, gt2).get_n_unique() >>> print(gt.n_total, gt.n_unique, gt.n_share) 7 5 2 >>> gt = gt_pa...
4
null
Implement the Python class `gt_pair` described below. Class description: Implement the gt_pair class. Method signatures and docstrings: - def __init__(self, gt1, gt2, na_ignore=False): Parameters ---------- gt1, gt2: pd.Series Example ------- >>> gt1 = pd.Series([0, 1, 2, 0, 1, 2, 0, 1, 2, np.nan]) >>> gt2 = pd.Serie...
Implement the Python class `gt_pair` described below. Class description: Implement the gt_pair class. Method signatures and docstrings: - def __init__(self, gt1, gt2, na_ignore=False): Parameters ---------- gt1, gt2: pd.Series Example ------- >>> gt1 = pd.Series([0, 1, 2, 0, 1, 2, 0, 1, 2, np.nan]) >>> gt2 = pd.Serie...
e5079b7b21b16a03d5a924a2d236cbd313f74aff
<|skeleton|> class gt_pair: def __init__(self, gt1, gt2, na_ignore=False): """Parameters ---------- gt1, gt2: pd.Series Example ------- >>> gt1 = pd.Series([0, 1, 2, 0, 1, 2, 0, 1, 2, np.nan]) >>> gt2 = pd.Series([0, 1, 2, 1, 0, 1, np.nan, np.nan, np.nan, np.nan]) >>> gt = gt_pair(gt1, gt2).get_n_unique() ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class gt_pair: def __init__(self, gt1, gt2, na_ignore=False): """Parameters ---------- gt1, gt2: pd.Series Example ------- >>> gt1 = pd.Series([0, 1, 2, 0, 1, 2, 0, 1, 2, np.nan]) >>> gt2 = pd.Series([0, 1, 2, 1, 0, 1, np.nan, np.nan, np.nan, np.nan]) >>> gt = gt_pair(gt1, gt2).get_n_unique() >>> print(gt.n...
the_stack_v2_python_sparse
funpipe/vcf.py
Philo-Li/funpipe
train
2
a2cf3507045b07adb76a9eb86df98b65b453ec7c
[ "Process.__init__(self)\nself.daemonic = True\nself.work_queue = work_queue", "while True:\n work_arg = self.work_queue.get()\n if work_arg is None:\n self.work_queue.task_done()\n return\n try:\n cine_fname, cine_hash, hdf_fname_template = work_arg\n proc_cine_fname(cine_fnam...
<|body_start_0|> Process.__init__(self) self.daemonic = True self.work_queue = work_queue <|end_body_0|> <|body_start_1|> while True: work_arg = self.work_queue.get() if work_arg is None: self.work_queue.task_done() return ...
Worker class for farming out the work of doing the least squares fit
worker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class worker: """Worker class for farming out the work of doing the least squares fit""" def __init__(self, work_queue): """Work queue is a joinable queue, res_queue can be any sort of thing that supports put()""" <|body_0|> def run(self): """The assumption is that the...
stack_v2_sparse_classes_75kplus_train_065744
8,273
no_license
[ { "docstring": "Work queue is a joinable queue, res_queue can be any sort of thing that supports put()", "name": "__init__", "signature": "def __init__(self, work_queue)" }, { "docstring": "The assumption is that these will be run daemonic and reused for multiple work sessions", "name": "run...
2
stack_v2_sparse_classes_30k_train_025304
Implement the Python class `worker` described below. Class description: Worker class for farming out the work of doing the least squares fit Method signatures and docstrings: - def __init__(self, work_queue): Work queue is a joinable queue, res_queue can be any sort of thing that supports put() - def run(self): The a...
Implement the Python class `worker` described below. Class description: Worker class for farming out the work of doing the least squares fit Method signatures and docstrings: - def __init__(self, work_queue): Work queue is a joinable queue, res_queue can be any sort of thing that supports put() - def run(self): The a...
78abcd84d3d2d2d4ecf15d0c77d1eeb86f5ab3e0
<|skeleton|> class worker: """Worker class for farming out the work of doing the least squares fit""" def __init__(self, work_queue): """Work queue is a joinable queue, res_queue can be any sort of thing that supports put()""" <|body_0|> def run(self): """The assumption is that the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class worker: """Worker class for farming out the work of doing the least squares fit""" def __init__(self, work_queue): """Work queue is a joinable queue, res_queue can be any sort of thing that supports put()""" Process.__init__(self) self.daemonic = True self.work_queue = wor...
the_stack_v2_python_sparse
scripts/proc_mongo.py
tacaswell/leidenfrost
train
1
6de0436abd47ba94fac9bb05fdbe77550bf7c91f
[ "self.column_names: List[str] = kargs.pop('column_names')\nsuper().__init__(*args, **kargs)\nself.set_fields_from_dict(['item_column', 'confirm_items', 'send_confirmation', 'track_read'])\nitem_column_name = self.fields['item_column'].initial\nif item_column_name is None:\n item_column_name = next((cname for cna...
<|body_start_0|> self.column_names: List[str] = kargs.pop('column_names') super().__init__(*args, **kargs) self.set_fields_from_dict(['item_column', 'confirm_items', 'send_confirmation', 'track_read']) item_column_name = self.fields['item_column'].initial if item_column_name is N...
Form to edit the Send Email action.
EmailActionForm
[ "MIT", "LGPL-2.0-or-later", "Python-2.0", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailActionForm: """Form to edit the Send Email action.""" def __init__(self, *args, **kargs): """Store column names and adjust initial values.""" <|body_0|> def clean(self): """Verify email values.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_065745
20,237
permissive
[ { "docstring": "Store column names and adjust initial values.", "name": "__init__", "signature": "def __init__(self, *args, **kargs)" }, { "docstring": "Verify email values.", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_052421
Implement the Python class `EmailActionForm` described below. Class description: Form to edit the Send Email action. Method signatures and docstrings: - def __init__(self, *args, **kargs): Store column names and adjust initial values. - def clean(self): Verify email values.
Implement the Python class `EmailActionForm` described below. Class description: Form to edit the Send Email action. Method signatures and docstrings: - def __init__(self, *args, **kargs): Store column names and adjust initial values. - def clean(self): Verify email values. <|skeleton|> class EmailActionForm: ""...
5473e9faa24c71a2a1102d47ebc2cbf27608e42a
<|skeleton|> class EmailActionForm: """Form to edit the Send Email action.""" def __init__(self, *args, **kargs): """Store column names and adjust initial values.""" <|body_0|> def clean(self): """Verify email values.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmailActionForm: """Form to edit the Send Email action.""" def __init__(self, *args, **kargs): """Store column names and adjust initial values.""" self.column_names: List[str] = kargs.pop('column_names') super().__init__(*args, **kargs) self.set_fields_from_dict(['item_col...
the_stack_v2_python_sparse
ontask/action/forms/run.py
LucasFranciscoCorreia/ontask_b
train
0
df45a8c530ab5d6c3eaa34a1fb6cbb1b22d76094
[ "if self.user:\n return self.user.realname or self.user.username\nreturn '({})'.format(self._user_name) if self._user_name else None", "user_name = user.realname or user.username if user else None\nuser_name = user_name or realname or username or self._user_name\nself._user_name = user_name" ]
<|body_start_0|> if self.user: return self.user.realname or self.user.username return '({})'.format(self._user_name) if self._user_name else None <|end_body_0|> <|body_start_1|> user_name = user.realname or user.username if user else None user_name = user_name or realname or...
Mixin providing a cached version of the user name. There needs to be: - a ``user`` relationship (which has no dynamic backref) - a meta column The observer needs to be registered in the children: @observes('user', 'user.realname', 'user.username') def user_observer(self, user, realname, username): if hasattr(self, '_us...
CachedUserNameMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CachedUserNameMixin: """Mixin providing a cached version of the user name. There needs to be: - a ``user`` relationship (which has no dynamic backref) - a meta column The observer needs to be registered in the children: @observes('user', 'user.realname', 'user.username') def user_observer(self, u...
stack_v2_sparse_classes_75kplus_train_065746
12,773
permissive
[ { "docstring": "Returns the name of the owner. If the user has been deleted, the last known name in brackets is returned.", "name": "user_name", "signature": "def user_name(self)" }, { "docstring": "Upates the last known name of the owner. This never deletes the stored name, set ``self._user_nam...
2
stack_v2_sparse_classes_30k_val_002391
Implement the Python class `CachedUserNameMixin` described below. Class description: Mixin providing a cached version of the user name. There needs to be: - a ``user`` relationship (which has no dynamic backref) - a meta column The observer needs to be registered in the children: @observes('user', 'user.realname', 'us...
Implement the Python class `CachedUserNameMixin` described below. Class description: Mixin providing a cached version of the user name. There needs to be: - a ``user`` relationship (which has no dynamic backref) - a meta column The observer needs to be registered in the children: @observes('user', 'user.realname', 'us...
c706b38d5b67692b4146cdf14ef24d971a32c6b8
<|skeleton|> class CachedUserNameMixin: """Mixin providing a cached version of the user name. There needs to be: - a ``user`` relationship (which has no dynamic backref) - a meta column The observer needs to be registered in the children: @observes('user', 'user.realname', 'user.username') def user_observer(self, u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CachedUserNameMixin: """Mixin providing a cached version of the user name. There needs to be: - a ``user`` relationship (which has no dynamic backref) - a meta column The observer needs to be registered in the children: @observes('user', 'user.realname', 'user.username') def user_observer(self, user, realname...
the_stack_v2_python_sparse
src/onegov/gazette/models/notice.py
OneGov/onegov-cloud
train
17
4c78e167e4acaedc01cf4142293048c7419f590e
[ "list_display = list(self.list_display)\nfor index, field_name in enumerate(list_display):\n field = getattr(self.model, field_name, None)\n if hasattr(field, 'related'):\n list_display.remove(field_name)\n list_display.insert(index, self.display_add_link(request, field.related))\nreturn list_di...
<|body_start_0|> list_display = list(self.list_display) for index, field_name in enumerate(list_display): field = getattr(self.model, field_name, None) if hasattr(field, 'related'): list_display.remove(field_name) list_display.insert(index, self.di...
AuditAdmin for Audit model. Mixins: Versions, permissions, spreadsheet export.
AuditAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuditAdmin: """AuditAdmin for Audit model. Mixins: Versions, permissions, spreadsheet export.""" def get_list_display(self, request): """Custom get_list_display.""" <|body_0|> def display_add_link(self, request, related): """Custom display_add_link.""" <|...
stack_v2_sparse_classes_75kplus_train_065747
32,483
no_license
[ { "docstring": "Custom get_list_display.", "name": "get_list_display", "signature": "def get_list_display(self, request)" }, { "docstring": "Custom display_add_link.", "name": "display_add_link", "signature": "def display_add_link(self, request, related)" } ]
2
null
Implement the Python class `AuditAdmin` described below. Class description: AuditAdmin for Audit model. Mixins: Versions, permissions, spreadsheet export. Method signatures and docstrings: - def get_list_display(self, request): Custom get_list_display. - def display_add_link(self, request, related): Custom display_ad...
Implement the Python class `AuditAdmin` described below. Class description: AuditAdmin for Audit model. Mixins: Versions, permissions, spreadsheet export. Method signatures and docstrings: - def get_list_display(self, request): Custom get_list_display. - def display_add_link(self, request, related): Custom display_ad...
7be8c29c55dde2de4d5cec819d73726094af08ef
<|skeleton|> class AuditAdmin: """AuditAdmin for Audit model. Mixins: Versions, permissions, spreadsheet export.""" def get_list_display(self, request): """Custom get_list_display.""" <|body_0|> def display_add_link(self, request, related): """Custom display_add_link.""" <|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AuditAdmin: """AuditAdmin for Audit model. Mixins: Versions, permissions, spreadsheet export.""" def get_list_display(self, request): """Custom get_list_display.""" list_display = list(self.list_display) for index, field_name in enumerate(list_display): field = getattr...
the_stack_v2_python_sparse
pythia/admin.py
dbca-wa/sdis
train
6
447e950fffaad9c0f629649c2daa6b4b3e2d9e17
[ "n = len(parent)\nself.locks = {i: -1 for i in range(n)}\nself.ancestors = {0: []}\nfor i in range(1, n):\n father = parent[i]\n self.ancestors[i] = [father] + self.ancestors[father]\nself.descendants = {i: [] for i in range(n)}\nfor i in range(n - 1, 0, -1):\n curr = parent[i]\n self.descendants[curr] ...
<|body_start_0|> n = len(parent) self.locks = {i: -1 for i in range(n)} self.ancestors = {0: []} for i in range(1, n): father = parent[i] self.ancestors[i] = [father] + self.ancestors[father] self.descendants = {i: [] for i in range(n)} for i in ra...
LockingTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LockingTree: def __init__(self, parent): """:type parent: List[int]""" <|body_0|> def lock(self, num, user): """:type num: int :type user: int :rtype: bool""" <|body_1|> def unlock(self, num, user): """:type num: int :type user: int :rtype: bool"...
stack_v2_sparse_classes_75kplus_train_065748
2,615
no_license
[ { "docstring": ":type parent: List[int]", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": ":type num: int :type user: int :rtype: bool", "name": "lock", "signature": "def lock(self, num, user)" }, { "docstring": ":type num: int :type user: int :rty...
4
null
Implement the Python class `LockingTree` described below. Class description: Implement the LockingTree class. Method signatures and docstrings: - def __init__(self, parent): :type parent: List[int] - def lock(self, num, user): :type num: int :type user: int :rtype: bool - def unlock(self, num, user): :type num: int :...
Implement the Python class `LockingTree` described below. Class description: Implement the LockingTree class. Method signatures and docstrings: - def __init__(self, parent): :type parent: List[int] - def lock(self, num, user): :type num: int :type user: int :rtype: bool - def unlock(self, num, user): :type num: int :...
ee59b82125f100970c842d5e1245287c484d6649
<|skeleton|> class LockingTree: def __init__(self, parent): """:type parent: List[int]""" <|body_0|> def lock(self, num, user): """:type num: int :type user: int :rtype: bool""" <|body_1|> def unlock(self, num, user): """:type num: int :type user: int :rtype: bool"...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LockingTree: def __init__(self, parent): """:type parent: List[int]""" n = len(parent) self.locks = {i: -1 for i in range(n)} self.ancestors = {0: []} for i in range(1, n): father = parent[i] self.ancestors[i] = [father] + self.ancestors[father] ...
the_stack_v2_python_sparse
_CodeTopics/LeetCode_contest/biweekly/biweekly2021/60/RE--60_3.py
BIAOXYZ/variousCodes
train
0
1115c0c86e333eabb1f817e8b03430666e09062b
[ "try:\n logger.info(\"更改poc供电状态测试'\")\n self.login()\n self.getin_outin()\n state = self.change_poc_state()\n self.assertEqual(state, ('PoC未连接', 'PoC已连接'))\nexcept Exception as msg:\n logger.error(u'异常原因:%s' % msg)\n self.driver.get_screenshot_as_file(os.path.join(readconfig.screen_path, 'test_...
<|body_start_0|> try: logger.info("更改poc供电状态测试'") self.login() self.getin_outin() state = self.change_poc_state() self.assertEqual(state, ('PoC未连接', 'PoC已连接')) except Exception as msg: logger.error(u'异常原因:%s' % msg) self...
输入输出相关测试
InputOutputTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InputOutputTest: """输入输出相关测试""" def test_change_poc_state(self): """更改poc供电状态测试""" <|body_0|> def test_urldisabled(self): """选择本地多流时,URL不可编辑""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: logger.info("更改poc供电状态测试'") ...
stack_v2_sparse_classes_75kplus_train_065749
1,665
no_license
[ { "docstring": "更改poc供电状态测试", "name": "test_change_poc_state", "signature": "def test_change_poc_state(self)" }, { "docstring": "选择本地多流时,URL不可编辑", "name": "test_urldisabled", "signature": "def test_urldisabled(self)" } ]
2
stack_v2_sparse_classes_30k_train_038577
Implement the Python class `InputOutputTest` described below. Class description: 输入输出相关测试 Method signatures and docstrings: - def test_change_poc_state(self): 更改poc供电状态测试 - def test_urldisabled(self): 选择本地多流时,URL不可编辑
Implement the Python class `InputOutputTest` described below. Class description: 输入输出相关测试 Method signatures and docstrings: - def test_change_poc_state(self): 更改poc供电状态测试 - def test_urldisabled(self): 选择本地多流时,URL不可编辑 <|skeleton|> class InputOutputTest: """输入输出相关测试""" def test_change_poc_state(self): ...
fd552eeb47fd4838c2c5caef4deea7480ab75ce9
<|skeleton|> class InputOutputTest: """输入输出相关测试""" def test_change_poc_state(self): """更改poc供电状态测试""" <|body_0|> def test_urldisabled(self): """选择本地多流时,URL不可编辑""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InputOutputTest: """输入输出相关测试""" def test_change_poc_state(self): """更改poc供电状态测试""" try: logger.info("更改poc供电状态测试'") self.login() self.getin_outin() state = self.change_poc_state() self.assertEqual(state, ('PoC未连接', 'PoC已连接')) ...
the_stack_v2_python_sparse
test_case/B005_Input_output_test.py
luhuifnag/AVA_UIauto_test
train
0
da6e8e90b303be724b177840345b1640e5b79a0c
[ "while n % 4 == 0:\n n = n // 4\nif n % 8 == 7:\n return 4\nx = 0\nwhile x * x <= n:\n y = int(math.sqrt(n - x * x))\n if x * x + y * y == n:\n if x == 0 or y == 0:\n return 1\n else:\n return 2\n x += 1\nreturn 3", "dp = [2147483647 for _ in range(n + 1)]\ndp[0]...
<|body_start_0|> while n % 4 == 0: n = n // 4 if n % 8 == 7: return 4 x = 0 while x * x <= n: y = int(math.sqrt(n - x * x)) if x * x + y * y == n: if x == 0 or y == 0: return 1 else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquares_dp1(self, n): """:type n: int :rtype: int""" <|body_1|> def numSquares_dp2(self, n): """:type n: int :rtype: int""" <|body_2|> def numSquares...
stack_v2_sparse_classes_75kplus_train_065750
4,676
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "numSquares", "signature": "def numSquares(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numSquares_dp1", "signature": "def numSquares_dp1(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "nu...
6
stack_v2_sparse_classes_30k_train_045685
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int - def numSquares_dp1(self, n): :type n: int :rtype: int - def numSquares_dp2(self, n): :type n: int :rtype: int - def numSquares...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int - def numSquares_dp1(self, n): :type n: int :rtype: int - def numSquares_dp2(self, n): :type n: int :rtype: int - def numSquares...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquares_dp1(self, n): """:type n: int :rtype: int""" <|body_1|> def numSquares_dp2(self, n): """:type n: int :rtype: int""" <|body_2|> def numSquares...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def numSquares(self, n): """:type n: int :rtype: int""" while n % 4 == 0: n = n // 4 if n % 8 == 7: return 4 x = 0 while x * x <= n: y = int(math.sqrt(n - x * x)) if x * x + y * y == n: if x == 0 ...
the_stack_v2_python_sparse
src/lt_279.py
oxhead/CodingYourWay
train
0
6de35e61cf48a13a1689fafd04d73f6db969309f
[ "from resistics.errors import ProjectLoadError\nfrom resistics.common import assert_dir, dir_subdirs\nassert_dir(self.dir_path)\nmetadata_path = self.dir_path / PROJ_FILE\nif not metadata_path.exists():\n raise ProjectLoadError(self.dir_path, f'Resistics project file {metadata_path} not found')\nself._check_subd...
<|body_start_0|> from resistics.errors import ProjectLoadError from resistics.common import assert_dir, dir_subdirs assert_dir(self.dir_path) metadata_path = self.dir_path / PROJ_FILE if not metadata_path.exists(): raise ProjectLoadError(self.dir_path, f'Resistics pro...
Project loader
ProjectLoader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectLoader: """Project loader""" def run(self, config: Configuration) -> Project: """Load a project Parameters ---------- config : Configuration The configuration for the purposes of getting the time readers Returns ------- Project Project instance Raises ------ ProjectLoadError I...
stack_v2_sparse_classes_75kplus_train_065751
24,919
permissive
[ { "docstring": "Load a project Parameters ---------- config : Configuration The configuration for the purposes of getting the time readers Returns ------- Project Project instance Raises ------ ProjectLoadError If the resistcs project metadata is not found", "name": "run", "signature": "def run(self, co...
4
stack_v2_sparse_classes_30k_train_012054
Implement the Python class `ProjectLoader` described below. Class description: Project loader Method signatures and docstrings: - def run(self, config: Configuration) -> Project: Load a project Parameters ---------- config : Configuration The configuration for the purposes of getting the time readers Returns ------- ...
Implement the Python class `ProjectLoader` described below. Class description: Project loader Method signatures and docstrings: - def run(self, config: Configuration) -> Project: Load a project Parameters ---------- config : Configuration The configuration for the purposes of getting the time readers Returns ------- ...
cba60747803b6c582eaaf1a670a7f455f5724ebd
<|skeleton|> class ProjectLoader: """Project loader""" def run(self, config: Configuration) -> Project: """Load a project Parameters ---------- config : Configuration The configuration for the purposes of getting the time readers Returns ------- Project Project instance Raises ------ ProjectLoadError I...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProjectLoader: """Project loader""" def run(self, config: Configuration) -> Project: """Load a project Parameters ---------- config : Configuration The configuration for the purposes of getting the time readers Returns ------- Project Project instance Raises ------ ProjectLoadError If the resistc...
the_stack_v2_python_sparse
resistics/letsgo.py
resistics/resistics
train
47
da8bf669b3376badf975ea6b64e514cfb17c8168
[ "params = params.copy()\noptions = params.pop('OPTIONS').copy()\noptions.setdefault('autoescape', True)\noptions.setdefault('debug', settings.DEBUG)\noptions.setdefault('file_charset', settings.FILE_CHARSET)\nlibraries = options.get('libraries', {})\noptions['libraries'] = self.get_templatetag_libraries(libraries)\...
<|body_start_0|> params = params.copy() options = params.pop('OPTIONS').copy() options.setdefault('autoescape', True) options.setdefault('debug', settings.DEBUG) options.setdefault('file_charset', settings.FILE_CHARSET) libraries = options.get('libraries', {}) opt...
DjangoTemplates
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DjangoTemplates: def __init__(self, params): """Hard override of init to use our engine.""" <|body_0|> def get_template(self, template_name, app_label=None, model_name=None): """Hard override accepts app_label and model_name""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_75kplus_train_065752
1,292
permissive
[ { "docstring": "Hard override of init to use our engine.", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "Hard override accepts app_label and model_name", "name": "get_template", "signature": "def get_template(self, template_name, app_label=None, model_n...
2
stack_v2_sparse_classes_30k_train_026114
Implement the Python class `DjangoTemplates` described below. Class description: Implement the DjangoTemplates class. Method signatures and docstrings: - def __init__(self, params): Hard override of init to use our engine. - def get_template(self, template_name, app_label=None, model_name=None): Hard override accepts...
Implement the Python class `DjangoTemplates` described below. Class description: Implement the DjangoTemplates class. Method signatures and docstrings: - def __init__(self, params): Hard override of init to use our engine. - def get_template(self, template_name, app_label=None, model_name=None): Hard override accepts...
3762baf7e10bf80bfb6efb44a585beff8e8fc882
<|skeleton|> class DjangoTemplates: def __init__(self, params): """Hard override of init to use our engine.""" <|body_0|> def get_template(self, template_name, app_label=None, model_name=None): """Hard override accepts app_label and model_name""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DjangoTemplates: def __init__(self, params): """Hard override of init to use our engine.""" params = params.copy() options = params.pop('OPTIONS').copy() options.setdefault('autoescape', True) options.setdefault('debug', settings.DEBUG) options.setdefault('file_...
the_stack_v2_python_sparse
foundation/template/backends/django.py
altio/foundation
train
5
a0e7435379eb7e9906d95be3ee347cb2478790e7
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('hek_kquirk', 'hek_kquirk')\nl = []\nurl = 'https://dataverse.harvard.edu/api/access/datafile/:persistentId/?persistentId=doi:10.7910/DVN/JZV6ON/BGTJS7&version=1.1'\nr = requests.get(url)\nz = zipfile.Zip...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('hek_kquirk', 'hek_kquirk') l = [] url = 'https://dataverse.harvard.edu/api/access/datafile/:persistentId/?persistentId=doi:10.7910/DVN/JZV6ON/BGTJ...
police_districts
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class police_districts: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyth...
stack_v2_sparse_classes_75kplus_train_065753
4,472
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
null
Implement the Python class `police_districts` described below. Class description: Implement the police_districts class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=N...
Implement the Python class `police_districts` described below. Class description: Implement the police_districts class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=N...
90284cf3debbac36eead07b8d2339cdd191b86cf
<|skeleton|> class police_districts: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyth...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class police_districts: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('hek_kquirk', 'hek_kquirk') ...
the_stack_v2_python_sparse
hek_kquirk/police_districts.py
maximega/course-2019-spr-proj
train
2
6aca551c823be1cd6a8cf845aa61a8742a5de8d1
[ "id = request.GET.get('id', '')\nplanObj = ExecutePlan.objects.filter(id=id).first()\nprojectName = planObj.parent.projectName\nreportObject = InterfaceTestReport.objects.filter(parent=id)\nmaxRunNumber = reportObject.aggregate(Max('runNumber'))['runNumber__max']\nrunNumberList = reportObject.values('runNumber').di...
<|body_start_0|> id = request.GET.get('id', '') planObj = ExecutePlan.objects.filter(id=id).first() projectName = planObj.parent.projectName reportObject = InterfaceTestReport.objects.filter(parent=id) maxRunNumber = reportObject.aggregate(Max('runNumber'))['runNumber__max'] ...
TestReport
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestReport: def get(self, request, *args, **kwargs): """return:开始时间、结束时间、运行次数""" <|body_0|> def post(self, request, *args, **kwargs): """测试报告数据列表""" <|body_1|> <|end_skeleton|> <|body_start_0|> id = request.GET.get('id', '') planObj = Execut...
stack_v2_sparse_classes_75kplus_train_065754
15,556
no_license
[ { "docstring": "return:开始时间、结束时间、运行次数", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "测试报告数据列表", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_035870
Implement the Python class `TestReport` described below. Class description: Implement the TestReport class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): return:开始时间、结束时间、运行次数 - def post(self, request, *args, **kwargs): 测试报告数据列表
Implement the Python class `TestReport` described below. Class description: Implement the TestReport class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): return:开始时间、结束时间、运行次数 - def post(self, request, *args, **kwargs): 测试报告数据列表 <|skeleton|> class TestReport: def get(self, request...
f2523d6e51cde1b53ac6f453f8066b4b90c523b9
<|skeleton|> class TestReport: def get(self, request, *args, **kwargs): """return:开始时间、结束时间、运行次数""" <|body_0|> def post(self, request, *args, **kwargs): """测试报告数据列表""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestReport: def get(self, request, *args, **kwargs): """return:开始时间、结束时间、运行次数""" id = request.GET.get('id', '') planObj = ExecutePlan.objects.filter(id=id).first() projectName = planObj.parent.projectName reportObject = InterfaceTestReport.objects.filter(parent=id) ...
the_stack_v2_python_sparse
api/interface/rest/executePlan.py
zhuzhanhao1/backend
train
0
8617996fd65b7a78dcdb47385f693aa67a039f01
[ "self.ai_settings = ai_settings\nself.reset_stats()\nself.game_active = False\nself.max_score = 0", "self.ships_left = self.ai_settings.ship_lives\nself.score = 0\nself.level = 1" ]
<|body_start_0|> self.ai_settings = ai_settings self.reset_stats() self.game_active = False self.max_score = 0 <|end_body_0|> <|body_start_1|> self.ships_left = self.ai_settings.ship_lives self.score = 0 self.level = 1 <|end_body_1|>
follow all the information of the game
GameStats
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameStats: """follow all the information of the game""" def __init__(self, ai_settings): """initialize all the information""" <|body_0|> def reset_stats(self): """initialize all the information the may be changed on the procedure of running program""" <|b...
stack_v2_sparse_classes_75kplus_train_065755
608
no_license
[ { "docstring": "initialize all the information", "name": "__init__", "signature": "def __init__(self, ai_settings)" }, { "docstring": "initialize all the information the may be changed on the procedure of running program", "name": "reset_stats", "signature": "def reset_stats(self)" } ]
2
stack_v2_sparse_classes_30k_train_035073
Implement the Python class `GameStats` described below. Class description: follow all the information of the game Method signatures and docstrings: - def __init__(self, ai_settings): initialize all the information - def reset_stats(self): initialize all the information the may be changed on the procedure of running p...
Implement the Python class `GameStats` described below. Class description: follow all the information of the game Method signatures and docstrings: - def __init__(self, ai_settings): initialize all the information - def reset_stats(self): initialize all the information the may be changed on the procedure of running p...
a5261982057f5a2d8fdf673b23593b7abd722c36
<|skeleton|> class GameStats: """follow all the information of the game""" def __init__(self, ai_settings): """initialize all the information""" <|body_0|> def reset_stats(self): """initialize all the information the may be changed on the procedure of running program""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GameStats: """follow all the information of the game""" def __init__(self, ai_settings): """initialize all the information""" self.ai_settings = ai_settings self.reset_stats() self.game_active = False self.max_score = 0 def reset_stats(self): """initia...
the_stack_v2_python_sparse
Part2/alien_invasion/game_stats.py
bigbillfighter/Python-Tutorial
train
0
27a6017cb281093716c05405fa11855bb24decbb
[ "canonical_arch = None\nfor k, v in BuildArchitecture._build_architecture.iteritems():\n if arch == k or arch in v['alias']:\n canonical_arch = k\n break\nreturn canonical_arch", "arch = BuildArchitecture.get_canonical_architecture(arch)\nif arch:\n return BuildArchitecture._build_architecture...
<|body_start_0|> canonical_arch = None for k, v in BuildArchitecture._build_architecture.iteritems(): if arch == k or arch in v['alias']: canonical_arch = k break return canonical_arch <|end_body_0|> <|body_start_1|> arch = BuildArchitecture.g...
The BuildArchitecture class manages architecture/bits configuration across various platforms/compilers combined with the input from command line.
BuildArchitecture
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildArchitecture: """The BuildArchitecture class manages architecture/bits configuration across various platforms/compilers combined with the input from command line.""" def get_canonical_architecture(arch): """Get the canonical architecture from the specified arch.""" <|bod...
stack_v2_sparse_classes_75kplus_train_065756
11,605
permissive
[ { "docstring": "Get the canonical architecture from the specified arch.", "name": "get_canonical_architecture", "signature": "def get_canonical_architecture(arch)" }, { "docstring": "Get the architecture bits.", "name": "get_architecture_bits", "signature": "def get_architecture_bits(arc...
3
null
Implement the Python class `BuildArchitecture` described below. Class description: The BuildArchitecture class manages architecture/bits configuration across various platforms/compilers combined with the input from command line. Method signatures and docstrings: - def get_canonical_architecture(arch): Get the canonic...
Implement the Python class `BuildArchitecture` described below. Class description: The BuildArchitecture class manages architecture/bits configuration across various platforms/compilers combined with the input from command line. Method signatures and docstrings: - def get_canonical_architecture(arch): Get the canonic...
a7da427617885546c5b5e07aa7740b3dee690337
<|skeleton|> class BuildArchitecture: """The BuildArchitecture class manages architecture/bits configuration across various platforms/compilers combined with the input from command line.""" def get_canonical_architecture(arch): """Get the canonical architecture from the specified arch.""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BuildArchitecture: """The BuildArchitecture class manages architecture/bits configuration across various platforms/compilers combined with the input from command line.""" def get_canonical_architecture(arch): """Get the canonical architecture from the specified arch.""" canonical_arch = N...
the_stack_v2_python_sparse
build_tools/typhoon-blade/src/blade/blade_platform.py
algo-data-platform/PredictorService
train
3
48495827d4f139c6463ed0a004e9465dab3f2da0
[ "employee_schema = EmployeeSchema()\nemployee_data = request.get_json()\nvalidated_employee_data, errors = employee_schema.load(employee_data)\nif errors:\n return (dict(status='fail', message=errors), 400)\nemployee = Employee(**validated_employee_data)\nsaved_employee = employee.save()\nif not saved_employee:\...
<|body_start_0|> employee_schema = EmployeeSchema() employee_data = request.get_json() validated_employee_data, errors = employee_schema.load(employee_data) if errors: return (dict(status='fail', message=errors), 400) employee = Employee(**validated_employee_data) ...
EmployeeView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmployeeView: def post(self): """Creating an Employee ad""" <|body_0|> def get(self): """Getting All employees""" <|body_1|> <|end_skeleton|> <|body_start_0|> employee_schema = EmployeeSchema() employee_data = request.get_json() vali...
stack_v2_sparse_classes_75kplus_train_065757
3,201
no_license
[ { "docstring": "Creating an Employee ad", "name": "post", "signature": "def post(self)" }, { "docstring": "Getting All employees", "name": "get", "signature": "def get(self)" } ]
2
stack_v2_sparse_classes_30k_train_010937
Implement the Python class `EmployeeView` described below. Class description: Implement the EmployeeView class. Method signatures and docstrings: - def post(self): Creating an Employee ad - def get(self): Getting All employees
Implement the Python class `EmployeeView` described below. Class description: Implement the EmployeeView class. Method signatures and docstrings: - def post(self): Creating an Employee ad - def get(self): Getting All employees <|skeleton|> class EmployeeView: def post(self): """Creating an Employee ad""...
015d70b8f79df6c1a5629add35767cee52f424f5
<|skeleton|> class EmployeeView: def post(self): """Creating an Employee ad""" <|body_0|> def get(self): """Getting All employees""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EmployeeView: def post(self): """Creating an Employee ad""" employee_schema = EmployeeSchema() employee_data = request.get_json() validated_employee_data, errors = employee_schema.load(employee_data) if errors: return (dict(status='fail', message=errors), 40...
the_stack_v2_python_sparse
app/controllers/employee.py
MutegekiHenry/project-cohort-backend
train
0
91f0b1ad868614320f65d62713e4db67ec6b3fda
[ "self.structure = structure\nself.element = element\nsga = SpacegroupAnalyzer(self.structure)\nself.symm_structure = sga.get_symmetrized_structure()\nself.equiv_sub = []\nfor equiv_site_set in list(self.symm_structure.equivalent_sites):\n vac_site = equiv_site_set[0]\n if isinstance(element, str):\n va...
<|body_start_0|> self.structure = structure self.element = element sga = SpacegroupAnalyzer(self.structure) self.symm_structure = sga.get_symmetrized_structure() self.equiv_sub = [] for equiv_site_set in list(self.symm_structure.equivalent_sites): vac_site = e...
Simple generator for substitution based on periodically equivalent sites
SubstitutionGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubstitutionGenerator: """Simple generator for substitution based on periodically equivalent sites""" def __init__(self, structure, element): """Initializes a Substitution Generator note: an Antisite is considered a type of substitution Args: structure(Structure): pymatgen structure ...
stack_v2_sparse_classes_75kplus_train_065758
10,935
permissive
[ { "docstring": "Initializes a Substitution Generator note: an Antisite is considered a type of substitution Args: structure(Structure): pymatgen structure object element (str or Element or Specie): element for the substitution", "name": "__init__", "signature": "def __init__(self, structure, element)" ...
2
stack_v2_sparse_classes_30k_train_028804
Implement the Python class `SubstitutionGenerator` described below. Class description: Simple generator for substitution based on periodically equivalent sites Method signatures and docstrings: - def __init__(self, structure, element): Initializes a Substitution Generator note: an Antisite is considered a type of sub...
Implement the Python class `SubstitutionGenerator` described below. Class description: Simple generator for substitution based on periodically equivalent sites Method signatures and docstrings: - def __init__(self, structure, element): Initializes a Substitution Generator note: an Antisite is considered a type of sub...
62ecae1c7382a41861e3a5d9b9c8dd1207472409
<|skeleton|> class SubstitutionGenerator: """Simple generator for substitution based on periodically equivalent sites""" def __init__(self, structure, element): """Initializes a Substitution Generator note: an Antisite is considered a type of substitution Args: structure(Structure): pymatgen structure ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SubstitutionGenerator: """Simple generator for substitution based on periodically equivalent sites""" def __init__(self, structure, element): """Initializes a Substitution Generator note: an Antisite is considered a type of substitution Args: structure(Structure): pymatgen structure object elemen...
the_stack_v2_python_sparse
pymatgen/analysis/defects/generators.py
montoyjh/pymatgen
train
2
da1d467ca18ea0d04a14302652ec12a89507b60f
[ "QWidget.__init__(self)\nself.layout = QVBoxLayout(self)\nself.tabs = QTabWidget()\nself.tabs.setFixedSize(700, 700)\nself.layout.addWidget(self.tabs)\nself.setLayout(self.layout)\nself.tabs.currentChanged.connect(self._update_mode)\nconfigs = MechOS_Network_Configs(MECHOS_CONFIG_FILE_PATH)._get_network_parameters(...
<|body_start_0|> QWidget.__init__(self) self.layout = QVBoxLayout(self) self.tabs = QTabWidget() self.tabs.setFixedSize(700, 700) self.layout.addWidget(self.tabs) self.setLayout(self.layout) self.tabs.currentChanged.connect(self._update_mode) configs = Mec...
Tabbed_Display
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tabbed_Display: def __init__(self): """Initializes a Tabbed Display widget. Parameters: individual_tab: The individual_tab Qwidget""" <|body_0|> def add_tab(self, widget, title): """Creates a new tab and adds a Qwidget to it. Parameters: widget: The Qwidget to be dis...
stack_v2_sparse_classes_75kplus_train_065759
3,833
permissive
[ { "docstring": "Initializes a Tabbed Display widget. Parameters: individual_tab: The individual_tab Qwidget", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Creates a new tab and adds a Qwidget to it. Parameters: widget: The Qwidget to be displayed. title: (string) The ...
3
stack_v2_sparse_classes_30k_train_018161
Implement the Python class `Tabbed_Display` described below. Class description: Implement the Tabbed_Display class. Method signatures and docstrings: - def __init__(self): Initializes a Tabbed Display widget. Parameters: individual_tab: The individual_tab Qwidget - def add_tab(self, widget, title): Creates a new tab ...
Implement the Python class `Tabbed_Display` described below. Class description: Implement the Tabbed_Display class. Method signatures and docstrings: - def __init__(self): Initializes a Tabbed Display widget. Parameters: individual_tab: The individual_tab Qwidget - def add_tab(self, widget, title): Creates a new tab ...
26b476e1c8743f422c5affea744234e6322d4f59
<|skeleton|> class Tabbed_Display: def __init__(self): """Initializes a Tabbed Display widget. Parameters: individual_tab: The individual_tab Qwidget""" <|body_0|> def add_tab(self, widget, title): """Creates a new tab and adds a Qwidget to it. Parameters: widget: The Qwidget to be dis...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Tabbed_Display: def __init__(self): """Initializes a Tabbed Display widget. Parameters: individual_tab: The individual_tab Qwidget""" QWidget.__init__(self) self.layout = QVBoxLayout(self) self.tabs = QTabWidget() self.tabs.setFixedSize(700, 700) self.layout.add...
the_stack_v2_python_sparse
GUI/Src/tabbed_display_widget.py
senseishafi/mechatronics-2019
train
0
ab94f16c112ea2ba2bcfa23b7bdcbc27b921edcb
[ "levels = []\nif not root:\n return levels\n\ndef helper(node, level):\n if len(levels) == level:\n levels.append([])\n levels[level].append(node.val)\n if node.left:\n helper(node.left, level + 1)\n if node.right:\n helper(node.right, level + 1)\nhelper(root, 0)\nreturn levels",...
<|body_start_0|> levels = [] if not root: return levels def helper(node, level): if len(levels) == level: levels.append([]) levels[level].append(node.val) if node.left: helper(node.left, level + 1) if no...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder(self, root: TreeNode) -> list[list[int]]: """使用递归的方式层次遍历,并标记每一层的level :param root: :return:""" <|body_0|> def levelOrder2(self, root): """使用迭代的方式层次遍历 :param root: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> leve...
stack_v2_sparse_classes_75kplus_train_065760
3,139
no_license
[ { "docstring": "使用递归的方式层次遍历,并标记每一层的level :param root: :return:", "name": "levelOrder", "signature": "def levelOrder(self, root: TreeNode) -> list[list[int]]" }, { "docstring": "使用迭代的方式层次遍历 :param root: :return:", "name": "levelOrder2", "signature": "def levelOrder2(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_042931
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: TreeNode) -> list[list[int]]: 使用递归的方式层次遍历,并标记每一层的level :param root: :return: - def levelOrder2(self, root): 使用迭代的方式层次遍历 :param root: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder(self, root: TreeNode) -> list[list[int]]: 使用递归的方式层次遍历,并标记每一层的level :param root: :return: - def levelOrder2(self, root): 使用迭代的方式层次遍历 :param root: :return: <|skelet...
ab998462d7f59409a57ef3dc9437ddfcfde177e1
<|skeleton|> class Solution: def levelOrder(self, root: TreeNode) -> list[list[int]]: """使用递归的方式层次遍历,并标记每一层的level :param root: :return:""" <|body_0|> def levelOrder2(self, root): """使用迭代的方式层次遍历 :param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def levelOrder(self, root: TreeNode) -> list[list[int]]: """使用递归的方式层次遍历,并标记每一层的level :param root: :return:""" levels = [] if not root: return levels def helper(node, level): if len(levels) == level: levels.append([]) ...
the_stack_v2_python_sparse
leetcode/tree/LevelOrder.py
technologyMz/Python_DS
train
0
3175f5221d0141c62e7acd77f0a5cfeff02ae166
[ "self.driver.get('http://www.baidu.com')\nself.driver.set_window_size(600, 600)\nself.driver.find_element_by_id('kw').send_keys('selenium')\nself.driver.find_element_by_id('su').click()\nsleep(3)\njs = 'window.scrollTo(100,450);'\nself.driver.execute_script(js)\nsleep(3)", "self.driver.get('http://videojs.com/')\...
<|body_start_0|> self.driver.get('http://www.baidu.com') self.driver.set_window_size(600, 600) self.driver.find_element_by_id('kw').send_keys('selenium') self.driver.find_element_by_id('su').click() sleep(3) js = 'window.scrollTo(100,450);' self.driver.execute_scr...
JS_Test
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JS_Test: def scroll_test(self): """利用js拖动滚动条 :return:""" <|body_0|> def watch_video_test(self): """调用js播放视频 JavaScript函数内置一个arguments对象,包含了函数调用的参数数组 load()、play()、pause()控制视频的加载、播放、暂停 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.dri...
stack_v2_sparse_classes_75kplus_train_065761
1,474
no_license
[ { "docstring": "利用js拖动滚动条 :return:", "name": "scroll_test", "signature": "def scroll_test(self)" }, { "docstring": "调用js播放视频 JavaScript函数内置一个arguments对象,包含了函数调用的参数数组 load()、play()、pause()控制视频的加载、播放、暂停 :return:", "name": "watch_video_test", "signature": "def watch_video_test(self)" } ]
2
stack_v2_sparse_classes_30k_train_003866
Implement the Python class `JS_Test` described below. Class description: Implement the JS_Test class. Method signatures and docstrings: - def scroll_test(self): 利用js拖动滚动条 :return: - def watch_video_test(self): 调用js播放视频 JavaScript函数内置一个arguments对象,包含了函数调用的参数数组 load()、play()、pause()控制视频的加载、播放、暂停 :return:
Implement the Python class `JS_Test` described below. Class description: Implement the JS_Test class. Method signatures and docstrings: - def scroll_test(self): 利用js拖动滚动条 :return: - def watch_video_test(self): 调用js播放视频 JavaScript函数内置一个arguments对象,包含了函数调用的参数数组 load()、play()、pause()控制视频的加载、播放、暂停 :return: <|skeleton|> ...
8be80db20810b443909c63c47293d25b41561495
<|skeleton|> class JS_Test: def scroll_test(self): """利用js拖动滚动条 :return:""" <|body_0|> def watch_video_test(self): """调用js播放视频 JavaScript函数内置一个arguments对象,包含了函数调用的参数数组 load()、play()、pause()控制视频的加载、播放、暂停 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class JS_Test: def scroll_test(self): """利用js拖动滚动条 :return:""" self.driver.get('http://www.baidu.com') self.driver.set_window_size(600, 600) self.driver.find_element_by_id('kw').send_keys('selenium') self.driver.find_element_by_id('su').click() sleep(3) js = '...
the_stack_v2_python_sparse
testcase/js_case.py
JialeeChen/selenium-python
train
0
f51abd339f1674e42954e5fbddcd72c04af46c82
[ "super().__init__(jobs_limit=jobs_limit)\nself.blur = 5\nself.threshold_block = 11\nself.threshold_val = 8", "pre_processed_image = cv2.resize(img, None, fx=2, fy=2, interpolation=cv2.INTER_LINEAR)\nif self.blur:\n pre_processed_image = cv2.medianBlur(pre_processed_image, self.blur)\npre_processed_image = cv2....
<|body_start_0|> super().__init__(jobs_limit=jobs_limit) self.blur = 5 self.threshold_block = 11 self.threshold_val = 8 <|end_body_0|> <|body_start_1|> pre_processed_image = cv2.resize(img, None, fx=2, fy=2, interpolation=cv2.INTER_LINEAR) if self.blur: pre_p...
Ocr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ocr: def __init__(self, jobs_limit=0): """Description -- Initializes the instance. Parameters -- - jobs_limit - (see base)""" <|body_0|> def _pre_process_image(self, img): """Description -- Pre-processes the image, for better OCR. Parameters -- - img - the image Retu...
stack_v2_sparse_classes_75kplus_train_065762
2,298
no_license
[ { "docstring": "Description -- Initializes the instance. Parameters -- - jobs_limit - (see base)", "name": "__init__", "signature": "def __init__(self, jobs_limit=0)" }, { "docstring": "Description -- Pre-processes the image, for better OCR. Parameters -- - img - the image Returns -- The process...
3
stack_v2_sparse_classes_30k_train_028437
Implement the Python class `Ocr` described below. Class description: Implement the Ocr class. Method signatures and docstrings: - def __init__(self, jobs_limit=0): Description -- Initializes the instance. Parameters -- - jobs_limit - (see base) - def _pre_process_image(self, img): Description -- Pre-processes the ima...
Implement the Python class `Ocr` described below. Class description: Implement the Ocr class. Method signatures and docstrings: - def __init__(self, jobs_limit=0): Description -- Initializes the instance. Parameters -- - jobs_limit - (see base) - def _pre_process_image(self, img): Description -- Pre-processes the ima...
cb8fc9a55ddb8256ffa2503f88971ef06c99058e
<|skeleton|> class Ocr: def __init__(self, jobs_limit=0): """Description -- Initializes the instance. Parameters -- - jobs_limit - (see base)""" <|body_0|> def _pre_process_image(self, img): """Description -- Pre-processes the image, for better OCR. Parameters -- - img - the image Retu...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Ocr: def __init__(self, jobs_limit=0): """Description -- Initializes the instance. Parameters -- - jobs_limit - (see base)""" super().__init__(jobs_limit=jobs_limit) self.blur = 5 self.threshold_block = 11 self.threshold_val = 8 def _pre_process_image(self, img): ...
the_stack_v2_python_sparse
workers/ocr.py
hyankov/anpr
train
0
1b987b56b532baf21f873e389a899c11189d7f2a
[ "self.resource_name = str_id\nCDevice.__init__(self, self.resource_name)\nself.obj_parent = obj_device\nself.set_logger(self.obj_parent.obj_logger)\nself.set_rest_agent(self.obj_parent.obj_rest_agent)\nself.str_device_type = self.obj_parent.str_device_type\nif str_id.lower() == 'active':\n self.uri = '{}/{}'.for...
<|body_start_0|> self.resource_name = str_id CDevice.__init__(self, self.resource_name) self.obj_parent = obj_device self.set_logger(self.obj_parent.obj_logger) self.set_rest_agent(self.obj_parent.obj_rest_agent) self.str_device_type = self.obj_parent.str_device_type ...
CWorkflow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CWorkflow: def __init__(self, obj_device, str_id): """@param obj_device: Parent device that init this one @type obj_device: CDevice""" <|body_0|> def update(self): """Update monorail data of self""" <|body_1|> def set_mon_data(self, dict_data): "...
stack_v2_sparse_classes_75kplus_train_065763
6,944
no_license
[ { "docstring": "@param obj_device: Parent device that init this one @type obj_device: CDevice", "name": "__init__", "signature": "def __init__(self, obj_device, str_id)" }, { "docstring": "Update monorail data of self", "name": "update", "signature": "def update(self)" }, { "docs...
5
stack_v2_sparse_classes_30k_train_015045
Implement the Python class `CWorkflow` described below. Class description: Implement the CWorkflow class. Method signatures and docstrings: - def __init__(self, obj_device, str_id): @param obj_device: Parent device that init this one @type obj_device: CDevice - def update(self): Update monorail data of self - def set...
Implement the Python class `CWorkflow` described below. Class description: Implement the CWorkflow class. Method signatures and docstrings: - def __init__(self, obj_device, str_id): @param obj_device: Parent device that init this one @type obj_device: CDevice - def update(self): Update monorail data of self - def set...
8290fc0ccbde0a6a7d8784aec04c88cc325cfa4c
<|skeleton|> class CWorkflow: def __init__(self, obj_device, str_id): """@param obj_device: Parent device that init this one @type obj_device: CDevice""" <|body_0|> def update(self): """Update monorail data of self""" <|body_1|> def set_mon_data(self, dict_data): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CWorkflow: def __init__(self, obj_device, str_id): """@param obj_device: Parent device that init this one @type obj_device: CDevice""" self.resource_name = str_id CDevice.__init__(self, self.resource_name) self.obj_parent = obj_device self.set_logger(self.obj_parent.obj...
the_stack_v2_python_sparse
idic/monorail/Workflow.py
InfraSIM/test
train
1
2411ad3b42f97c779b0e43215cb4d50a607a17e3
[ "curindox = lastindox = len(nums) - 1\nwhile curindox >= 0:\n if nums[curindox] == 0:\n count = lastindox - curindox\n for i in range(count):\n nums[curindox + i] = nums[curindox + i + 1]\n nums[lastindox] = 0\n lastindox -= 1\n curindox -= 1", "j = 0\nfor i in range(l...
<|body_start_0|> curindox = lastindox = len(nums) - 1 while curindox >= 0: if nums[curindox] == 0: count = lastindox - curindox for i in range(count): nums[curindox + i] = nums[curindox + i + 1] nums[lastindox] = 0 ...
算法:利用两个索引,curindox向前移动,与lastindox计算差值前移
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """算法:利用两个索引,curindox向前移动,与lastindox计算差值前移""" def moveZeroes1(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes2(self, nums): """:type nums: List[int] :rtype: void Do no...
stack_v2_sparse_classes_75kplus_train_065764
1,385
no_license
[ { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "moveZeroes1", "signature": "def moveZeroes1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.", "name": "...
2
null
Implement the Python class `Solution` described below. Class description: 算法:利用两个索引,curindox向前移动,与lastindox计算差值前移 Method signatures and docstrings: - def moveZeroes1(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def moveZeroes2(self, nums): :type nums: List[in...
Implement the Python class `Solution` described below. Class description: 算法:利用两个索引,curindox向前移动,与lastindox计算差值前移 Method signatures and docstrings: - def moveZeroes1(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. - def moveZeroes2(self, nums): :type nums: List[in...
e9b18cdd8c3ec49c14284a1feb1fbff9409dd40c
<|skeleton|> class Solution: """算法:利用两个索引,curindox向前移动,与lastindox计算差值前移""" def moveZeroes1(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" <|body_0|> def moveZeroes2(self, nums): """:type nums: List[int] :rtype: void Do no...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """算法:利用两个索引,curindox向前移动,与lastindox计算差值前移""" def moveZeroes1(self, nums): """:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.""" curindox = lastindox = len(nums) - 1 while curindox >= 0: if nums[curindox] == 0: ...
the_stack_v2_python_sparse
leetcode/283_moveZeros.py
2B-people/2B-repositery
train
0
144e8bc464940711e49ac8ebb9f2c70f375f85c3
[ "n = len(nums)\nk = k % n\nnums[:] = nums[n - k:] + nums[:n - k]\nreturn nums", "if len(nums) <= k:\n nums.reverse()\n return nums\nnums.reverse()\nnumk, nume = (nums[:k], nums[k:])\nnumk.reverse()\nnume.reverse()\nnums[:k] = numk\nnums[k:] = nume\nreturn nums" ]
<|body_start_0|> n = len(nums) k = k % n nums[:] = nums[n - k:] + nums[:n - k] return nums <|end_body_0|> <|body_start_1|> if len(nums) <= k: nums.reverse() return nums nums.reverse() numk, nume = (nums[:k], nums[k:]) numk.reverse(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, nums, k): """国外大神 几行代码解决,果然是大神,但是没看懂""" <|body_0|> def rotate1(self, nums, k): """反转更好理解一点点,但是代码有问题,执行不成功""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) k = k % n nums[:] = nums[n - k:] + num...
stack_v2_sparse_classes_75kplus_train_065765
2,277
no_license
[ { "docstring": "国外大神 几行代码解决,果然是大神,但是没看懂", "name": "rotate", "signature": "def rotate(self, nums, k)" }, { "docstring": "反转更好理解一点点,但是代码有问题,执行不成功", "name": "rotate1", "signature": "def rotate1(self, nums, k)" } ]
2
stack_v2_sparse_classes_30k_train_028351
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums, k): 国外大神 几行代码解决,果然是大神,但是没看懂 - def rotate1(self, nums, k): 反转更好理解一点点,但是代码有问题,执行不成功
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, nums, k): 国外大神 几行代码解决,果然是大神,但是没看懂 - def rotate1(self, nums, k): 反转更好理解一点点,但是代码有问题,执行不成功 <|skeleton|> class Solution: def rotate(self, nums, k): """...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def rotate(self, nums, k): """国外大神 几行代码解决,果然是大神,但是没看懂""" <|body_0|> def rotate1(self, nums, k): """反转更好理解一点点,但是代码有问题,执行不成功""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rotate(self, nums, k): """国外大神 几行代码解决,果然是大神,但是没看懂""" n = len(nums) k = k % n nums[:] = nums[n - k:] + nums[:n - k] return nums def rotate1(self, nums, k): """反转更好理解一点点,但是代码有问题,执行不成功""" if len(nums) <= k: nums.reverse() ...
the_stack_v2_python_sparse
算法/Week_01/189. 旋转数组.py
RichieSong/algorithm
train
0
1f8e8074a6049cddad32684c5d32f90b3616292e
[ "if not root:\n return ''\nqueue = deque([root])\nserialized = []\nwhile queue:\n node = queue.popleft()\n if not node:\n serialized.append('null')\n else:\n serialized.append(str(node.val))\n queue.append(node.left)\n queue.append(node.right)\nreturn ','.join(serialized)", ...
<|body_start_0|> if not root: return '' queue = deque([root]) serialized = [] while queue: node = queue.popleft() if not node: serialized.append('null') else: serialized.append(str(node.val)) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_75kplus_train_065766
1,834
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_019968
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
51b379b1be406cd27c92f26f44633c87360c7de3
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' queue = deque([root]) serialized = [] while queue: node = queue.popleft() if not node: ...
the_stack_v2_python_sparse
LC/297/297-py3.py
albertopha/ds-algo
train
2
effa15905cfcda53d25cced9f62bbf9117b21b23
[ "params_is_str = isinstance(key_str, str) and isinstance(data, str)\nif params_is_str:\n key_md5 = MD5.new()\n key_md5.update(bytes(key_str, 'utf-8'))\n key_str = key_md5.hexdigest()\n iv_str = key_str[2:18]\n padding = '\\x00'\n pad_it = lambda s: s + (16 - len(bytes(s, 'utf-8')) % 16) * padding\...
<|body_start_0|> params_is_str = isinstance(key_str, str) and isinstance(data, str) if params_is_str: key_md5 = MD5.new() key_md5.update(bytes(key_str, 'utf-8')) key_str = key_md5.hexdigest() iv_str = key_str[2:18] padding = '\x00' ...
给出一种CBC加密和解密方法
CBC
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBC: """给出一种CBC加密和解密方法""" def crypt(key_str, data): """将给定字符串加密 Parameters: :key_str: 用于加密的密钥 :data: 要被加密的字符串 Returns: :crypted_str: 加密后的数据的base64编码""" <|body_0|> def decrypt(key_str, data): """将给定加密后的字符串解密 Parameters: :key_str: 用于解密的密钥 :data: 加密后的base64字符串 Retur...
stack_v2_sparse_classes_75kplus_train_065767
21,831
permissive
[ { "docstring": "将给定字符串加密 Parameters: :key_str: 用于加密的密钥 :data: 要被加密的字符串 Returns: :crypted_str: 加密后的数据的base64编码", "name": "crypt", "signature": "def crypt(key_str, data)" }, { "docstring": "将给定加密后的字符串解密 Parameters: :key_str: 用于解密的密钥 :data: 加密后的base64字符串 Returns: :recovery_str: 解密后的字符串", "name"...
2
stack_v2_sparse_classes_30k_train_003019
Implement the Python class `CBC` described below. Class description: 给出一种CBC加密和解密方法 Method signatures and docstrings: - def crypt(key_str, data): 将给定字符串加密 Parameters: :key_str: 用于加密的密钥 :data: 要被加密的字符串 Returns: :crypted_str: 加密后的数据的base64编码 - def decrypt(key_str, data): 将给定加密后的字符串解密 Parameters: :key_str: 用于解密的密钥 :data...
Implement the Python class `CBC` described below. Class description: 给出一种CBC加密和解密方法 Method signatures and docstrings: - def crypt(key_str, data): 将给定字符串加密 Parameters: :key_str: 用于加密的密钥 :data: 要被加密的字符串 Returns: :crypted_str: 加密后的数据的base64编码 - def decrypt(key_str, data): 将给定加密后的字符串解密 Parameters: :key_str: 用于解密的密钥 :data...
f8c8d6d55dd1806d1d4e5eec3170aaaa4bdf4018
<|skeleton|> class CBC: """给出一种CBC加密和解密方法""" def crypt(key_str, data): """将给定字符串加密 Parameters: :key_str: 用于加密的密钥 :data: 要被加密的字符串 Returns: :crypted_str: 加密后的数据的base64编码""" <|body_0|> def decrypt(key_str, data): """将给定加密后的字符串解密 Parameters: :key_str: 用于解密的密钥 :data: 加密后的base64字符串 Retur...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CBC: """给出一种CBC加密和解密方法""" def crypt(key_str, data): """将给定字符串加密 Parameters: :key_str: 用于加密的密钥 :data: 要被加密的字符串 Returns: :crypted_str: 加密后的数据的base64编码""" params_is_str = isinstance(key_str, str) and isinstance(data, str) if params_is_str: key_md5 = MD5.new() ...
the_stack_v2_python_sparse
api/utils.py
CSshengxy/codegame
train
0
f6a9da15cd7d656815adf5d4625f848a44487e39
[ "if la:\n return la.size() ** 2 + la[0]\nelse:\n return 0", "if sexpr == 0:\n return self(0)\nif sexpr.support() == [[]]:\n return self._from_dict({self.one_basis(): sexpr.coefficient([])}, remove_zeros=False)\nout = self.zero()\nwhile sexpr:\n mup = max(sexpr.support(), key=self._my_key)\n out ...
<|body_start_0|> if la: return la.size() ** 2 + la[0] else: return 0 <|end_body_0|> <|body_start_1|> if sexpr == 0: return self(0) if sexpr.support() == [[]]: return self._from_dict({self.one_basis(): sexpr.coefficient([])}, remove_zeros=F...
generic_character
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class generic_character: def _my_key(self, la): """A rank function for partitions. The leading term of a homogeneous expression will be the partition with the largest key value. This key value is `|\\lambda|^2 + \\lambda_0` and using the ``max`` function on a list of Partitions. Of course it i...
stack_v2_sparse_classes_75kplus_train_065768
16,482
no_license
[ { "docstring": "A rank function for partitions. The leading term of a homogeneous expression will be the partition with the largest key value. This key value is `|\\\\lambda|^2 + \\\\lambda_0` and using the ``max`` function on a list of Partitions. Of course it is possible that this rank function is equal for s...
2
stack_v2_sparse_classes_30k_train_003873
Implement the Python class `generic_character` described below. Class description: Implement the generic_character class. Method signatures and docstrings: - def _my_key(self, la): A rank function for partitions. The leading term of a homogeneous expression will be the partition with the largest key value. This key v...
Implement the Python class `generic_character` described below. Class description: Implement the generic_character class. Method signatures and docstrings: - def _my_key(self, la): A rank function for partitions. The leading term of a homogeneous expression will be the partition with the largest key value. This key v...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class generic_character: def _my_key(self, la): """A rank function for partitions. The leading term of a homogeneous expression will be the partition with the largest key value. This key value is `|\\lambda|^2 + \\lambda_0` and using the ``max`` function on a list of Partitions. Of course it i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class generic_character: def _my_key(self, la): """A rank function for partitions. The leading term of a homogeneous expression will be the partition with the largest key value. This key value is `|\\lambda|^2 + \\lambda_0` and using the ``max`` function on a list of Partitions. Of course it is possible tha...
the_stack_v2_python_sparse
sage/src/sage/combinat/sf/character.py
bopopescu/geosci
train
0
b8534b94aa3a1393bab2e9f4abc7fa871e89e733
[ "super().__init__(dev_id, dev_name, description)\nself._scale_min = scale_min\nself._scale_max = scale_max\nself.range_from = range_from\nself.range_to = range_to", "if packet.data[0] != 165:\n return\ntemp_scale = self._scale_max - self._scale_min\ntemp_range = self.range_to - self.range_from\nraw_val = packe...
<|body_start_0|> super().__init__(dev_id, dev_name, description) self._scale_min = scale_min self._scale_max = scale_max self.range_from = range_from self.range_to = range_to <|end_body_0|> <|body_start_1|> if packet.data[0] != 165: return temp_scale ...
Representation of an EnOcean temperature sensor device. EEPs (EnOcean Equipment Profiles): - A5-02-01 to A5-02-1B All 8 Bit Temperature Sensors of A5-02 - A5-10-01 to A5-10-14 (Room Operating Panels) - A5-04-01 (Temp. and Humidity Sensor, Range 0°C to +40°C and 0% to 100%) - A5-04-02 (Temp. and Humidity Sensor, Range -...
EnOceanTemperatureSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnOceanTemperatureSensor: """Representation of an EnOcean temperature sensor device. EEPs (EnOcean Equipment Profiles): - A5-02-01 to A5-02-1B All 8 Bit Temperature Sensors of A5-02 - A5-10-01 to A5-10-14 (Room Operating Panels) - A5-04-01 (Temp. and Humidity Sensor, Range 0°C to +40°C and 0% to ...
stack_v2_sparse_classes_75kplus_train_065769
9,398
permissive
[ { "docstring": "Initialize the EnOcean temperature sensor device.", "name": "__init__", "signature": "def __init__(self, dev_id: list[int], dev_name: str, description: EnOceanSensorEntityDescription, *, scale_min: int, scale_max: int, range_from: int, range_to: int) -> None" }, { "docstring": "U...
2
stack_v2_sparse_classes_30k_train_025276
Implement the Python class `EnOceanTemperatureSensor` described below. Class description: Representation of an EnOcean temperature sensor device. EEPs (EnOcean Equipment Profiles): - A5-02-01 to A5-02-1B All 8 Bit Temperature Sensors of A5-02 - A5-10-01 to A5-10-14 (Room Operating Panels) - A5-04-01 (Temp. and Humidit...
Implement the Python class `EnOceanTemperatureSensor` described below. Class description: Representation of an EnOcean temperature sensor device. EEPs (EnOcean Equipment Profiles): - A5-02-01 to A5-02-1B All 8 Bit Temperature Sensors of A5-02 - A5-10-01 to A5-10-14 (Room Operating Panels) - A5-04-01 (Temp. and Humidit...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class EnOceanTemperatureSensor: """Representation of an EnOcean temperature sensor device. EEPs (EnOcean Equipment Profiles): - A5-02-01 to A5-02-1B All 8 Bit Temperature Sensors of A5-02 - A5-10-01 to A5-10-14 (Room Operating Panels) - A5-04-01 (Temp. and Humidity Sensor, Range 0°C to +40°C and 0% to ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EnOceanTemperatureSensor: """Representation of an EnOcean temperature sensor device. EEPs (EnOcean Equipment Profiles): - A5-02-01 to A5-02-1B All 8 Bit Temperature Sensors of A5-02 - A5-10-01 to A5-10-14 (Room Operating Panels) - A5-04-01 (Temp. and Humidity Sensor, Range 0°C to +40°C and 0% to 100%) - A5-04...
the_stack_v2_python_sparse
homeassistant/components/enocean/sensor.py
home-assistant/core
train
35,501
37267467e15cc89d4420fa5bc933c08e31f7f41d
[ "if os.path.exists(file):\n self.file = file\nelse:\n sys.exit('Invalid or missing file.')\ntry:\n fasta = pysam.FastxFile(file)\n for record in fasta:\n samplename = re.sub('.primertrimmed.consensus_threshold_0.75_quality_20$', '', record.name)\n samplename = re.sub('^Consensus_', '', sam...
<|body_start_0|> if os.path.exists(file): self.file = file else: sys.exit('Invalid or missing file.') try: fasta = pysam.FastxFile(file) for record in fasta: samplename = re.sub('.primertrimmed.consensus_threshold_0.75_quality_20$',...
A class to handle the consensus FASTA file.
Consensus
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Consensus: """A class to handle the consensus FASTA file.""" def __init__(self, file): """Initialize the Consensus class.""" <|body_0|> def count_iupac_in_fasta(self): """Count the number of IUPAC occurrences in the consensus FASTA file. N is counted as a seperat...
stack_v2_sparse_classes_75kplus_train_065770
2,285
permissive
[ { "docstring": "Initialize the Consensus class.", "name": "__init__", "signature": "def __init__(self, file)" }, { "docstring": "Count the number of IUPAC occurrences in the consensus FASTA file. N is counted as a seperate value. Return Value: The function returns an integer representing the num...
3
stack_v2_sparse_classes_30k_train_015937
Implement the Python class `Consensus` described below. Class description: A class to handle the consensus FASTA file. Method signatures and docstrings: - def __init__(self, file): Initialize the Consensus class. - def count_iupac_in_fasta(self): Count the number of IUPAC occurrences in the consensus FASTA file. N is...
Implement the Python class `Consensus` described below. Class description: A class to handle the consensus FASTA file. Method signatures and docstrings: - def __init__(self, file): Initialize the Consensus class. - def count_iupac_in_fasta(self): Count the number of IUPAC occurrences in the consensus FASTA file. N is...
9f81f4bda3d1581e666fedebb9f31b066ceefb70
<|skeleton|> class Consensus: """A class to handle the consensus FASTA file.""" def __init__(self, file): """Initialize the Consensus class.""" <|body_0|> def count_iupac_in_fasta(self): """Count the number of IUPAC occurrences in the consensus FASTA file. N is counted as a seperat...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Consensus: """A class to handle the consensus FASTA file.""" def __init__(self, file): """Initialize the Consensus class.""" if os.path.exists(file): self.file = file else: sys.exit('Invalid or missing file.') try: fasta = pysam.FastxFil...
the_stack_v2_python_sparse
parser/ncov/parser/Consensus.py
connor-lab/ncov-tools
train
3
6eeb2d6be78771a9465d6d2e7b9be50ccaa4674f
[ "self.num_events = num_events\nself.num_areaperils = num_areaperils\nself.areaperils_per_event = areaperils_per_event\nself.num_intensity_bins = num_intensity_bins\nself.intensity_sparseness = intensity_sparseness\nself.no_intensity_uncertainty = no_intensity_uncertainty\nself.random_seed = random_seed\nself.file_n...
<|body_start_0|> self.num_events = num_events self.num_areaperils = num_areaperils self.areaperils_per_event = areaperils_per_event self.num_intensity_bins = num_intensity_bins self.intensity_sparseness = intensity_sparseness self.no_intensity_uncertainty = no_intensity_u...
Generate data for Footprint binary dummy model file. This file shows the intensity of a given event-areaperil combination. The binary footprint file footprint.bin requires the index file footprint.idx. Attributes: generate_data: Generate Footprint binary dummy model file data.
FootprintBinFile
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FootprintBinFile: """Generate data for Footprint binary dummy model file. This file shows the intensity of a given event-areaperil combination. The binary footprint file footprint.bin requires the index file footprint.idx. Attributes: generate_data: Generate Footprint binary dummy model file data...
stack_v2_sparse_classes_75kplus_train_065771
39,722
permissive
[ { "docstring": "Initialise Footprint binary file class. Args: num_events (int): number of events. num_areaperils (int): number of areaperils. areaperils_per_event (int): number of areaperils impacted per event. num_intensity_bins (int): number of intensity bins. intensity_sparseness (float): percentage of bins ...
2
stack_v2_sparse_classes_30k_train_033357
Implement the Python class `FootprintBinFile` described below. Class description: Generate data for Footprint binary dummy model file. This file shows the intensity of a given event-areaperil combination. The binary footprint file footprint.bin requires the index file footprint.idx. Attributes: generate_data: Generate...
Implement the Python class `FootprintBinFile` described below. Class description: Generate data for Footprint binary dummy model file. This file shows the intensity of a given event-areaperil combination. The binary footprint file footprint.bin requires the index file footprint.idx. Attributes: generate_data: Generate...
23e704c335629ccd010969b1090446cfa3f384d5
<|skeleton|> class FootprintBinFile: """Generate data for Footprint binary dummy model file. This file shows the intensity of a given event-areaperil combination. The binary footprint file footprint.bin requires the index file footprint.idx. Attributes: generate_data: Generate Footprint binary dummy model file data...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FootprintBinFile: """Generate data for Footprint binary dummy model file. This file shows the intensity of a given event-areaperil combination. The binary footprint file footprint.bin requires the index file footprint.idx. Attributes: generate_data: Generate Footprint binary dummy model file data.""" def...
the_stack_v2_python_sparse
oasislmf/computation/data/dummy_model/generate.py
OasisLMF/OasisLMF
train
122
0899d02f195a62538265011b181aa54b3d4bf621
[ "super().__init__(**kwargs)\nself.frame_length = frame_length\nself.frame_step = frame_step\nself.fft_length = fft_length\nself.linear_to_mel_weight_matrix = tf.signal.linear_to_mel_weight_matrix(n_mels, fft_length // 2 + 1, sample_rate, f_min, f_max)", "stfts = tf.signal.stft(signals, frame_length=self.frame_len...
<|body_start_0|> super().__init__(**kwargs) self.frame_length = frame_length self.frame_step = frame_step self.fft_length = fft_length self.linear_to_mel_weight_matrix = tf.signal.linear_to_mel_weight_matrix(n_mels, fft_length // 2 + 1, sample_rate, f_min, f_max) <|end_body_0|> ...
Mel Spectrogram loss.
TFMelSpectrogram
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFMelSpectrogram: """Mel Spectrogram loss.""" def __init__(self, n_mels=80, f_min=80.0, f_max=7600, frame_length=1024, frame_step=256, fft_length=1024, sample_rate=16000, **kwargs): """Initialize.""" <|body_0|> def _calculate_log_mels_spectrogram(self, signals): ...
stack_v2_sparse_classes_75kplus_train_065772
2,697
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, n_mels=80, f_min=80.0, f_max=7600, frame_length=1024, frame_step=256, fft_length=1024, sample_rate=16000, **kwargs)" }, { "docstring": "Calculate forward propagation. Args: signals (Tensor): signal (B, T). Returns...
3
stack_v2_sparse_classes_30k_train_020760
Implement the Python class `TFMelSpectrogram` described below. Class description: Mel Spectrogram loss. Method signatures and docstrings: - def __init__(self, n_mels=80, f_min=80.0, f_max=7600, frame_length=1024, frame_step=256, fft_length=1024, sample_rate=16000, **kwargs): Initialize. - def _calculate_log_mels_spec...
Implement the Python class `TFMelSpectrogram` described below. Class description: Mel Spectrogram loss. Method signatures and docstrings: - def __init__(self, n_mels=80, f_min=80.0, f_max=7600, frame_length=1024, frame_step=256, fft_length=1024, sample_rate=16000, **kwargs): Initialize. - def _calculate_log_mels_spec...
136877136355c82d7ba474ceb7a8f133bd84767e
<|skeleton|> class TFMelSpectrogram: """Mel Spectrogram loss.""" def __init__(self, n_mels=80, f_min=80.0, f_max=7600, frame_length=1024, frame_step=256, fft_length=1024, sample_rate=16000, **kwargs): """Initialize.""" <|body_0|> def _calculate_log_mels_spectrogram(self, signals): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TFMelSpectrogram: """Mel Spectrogram loss.""" def __init__(self, n_mels=80, f_min=80.0, f_max=7600, frame_length=1024, frame_step=256, fft_length=1024, sample_rate=16000, **kwargs): """Initialize.""" super().__init__(**kwargs) self.frame_length = frame_length self.frame_st...
the_stack_v2_python_sparse
tensorflow_tts/losses/spectrogram.py
TensorSpeech/TensorFlowTTS
train
2,889
eb8383fe8408d5aa9e8bbb13cd9de9343aa49052
[ "if self._pool_paths is None:\n self._pool_paths = self.data_glob(self.test_dir, 'pools', glob='*.csv')\nreturn self._pool_paths", "if self._truth_paths is None:\n self._truth_paths = self.data_glob(*self.ref_loc, glob='*.json')\nreturn self._truth_paths" ]
<|body_start_0|> if self._pool_paths is None: self._pool_paths = self.data_glob(self.test_dir, 'pools', glob='*.csv') return self._pool_paths <|end_body_0|> <|body_start_1|> if self._truth_paths is None: self._truth_paths = self.data_glob(*self.ref_loc, glob='*.json') ...
Retreive the SDP pools from the test data source These tests are very much tied to using `pytest` and the `ci-watson` plugin. In particular, there are references to `pytest.config` that only exist when running under pytest. Such references are stubbed out with best defaults used.
SDPPoolsSource
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SDPPoolsSource: """Retreive the SDP pools from the test data source These tests are very much tied to using `pytest` and the `ci-watson` plugin. In particular, there are references to `pytest.config` that only exist when running under pytest. Such references are stubbed out with best defaults use...
stack_v2_sparse_classes_75kplus_train_065773
1,499
permissive
[ { "docstring": "Get the association pools", "name": "pool_paths", "signature": "def pool_paths(self)" }, { "docstring": "Get the truth associations", "name": "truth_paths", "signature": "def truth_paths(self)" } ]
2
stack_v2_sparse_classes_30k_train_000657
Implement the Python class `SDPPoolsSource` described below. Class description: Retreive the SDP pools from the test data source These tests are very much tied to using `pytest` and the `ci-watson` plugin. In particular, there are references to `pytest.config` that only exist when running under pytest. Such references...
Implement the Python class `SDPPoolsSource` described below. Class description: Retreive the SDP pools from the test data source These tests are very much tied to using `pytest` and the `ci-watson` plugin. In particular, there are references to `pytest.config` that only exist when running under pytest. Such references...
bc10af678e2e5ba7d3fad54141938f5de3713c02
<|skeleton|> class SDPPoolsSource: """Retreive the SDP pools from the test data source These tests are very much tied to using `pytest` and the `ci-watson` plugin. In particular, there are references to `pytest.config` that only exist when running under pytest. Such references are stubbed out with best defaults use...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SDPPoolsSource: """Retreive the SDP pools from the test data source These tests are very much tied to using `pytest` and the `ci-watson` plugin. In particular, there are references to `pytest.config` that only exist when running under pytest. Such references are stubbed out with best defaults used.""" de...
the_stack_v2_python_sparse
jwst/regtest/sdp_pools_source.py
rizeladiaz/jwst
train
0
ede72c094b46a27d9285866842aaca7636be4806
[ "n = len(s)\nstack = [-1]\nans = 0\nfor i in range(n):\n if s[i] == '(':\n stack.append(i)\n continue\n else:\n stack.pop()\n if not stack:\n stack.append(i)\n else:\n ans = max(ans, i - stack[-1])\nreturn ans", "n = len(s)\nif n == 0:\n return 0\ndp = [0] * n\nfo...
<|body_start_0|> n = len(s) stack = [-1] ans = 0 for i in range(n): if s[i] == '(': stack.append(i) continue else: stack.pop() if not stack: stack.append(i) else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestValidParentheses(self, s: str) -> int: """栈解法: 初始化:栈为-1,避免当第一个字符就是),出栈没有元素报错;同时避免所有括号全部匹配时候计算长度少1. 入栈条件:当前括号为左括号 出栈条件:当前括号为右括号 计算子串长度条件:当前栈不为空,栈内有元素 计算方法:当前元素 - 栈底元素 并且更新最大值 :param s: :return:""" <|body_0|> def longestValidParentheses2(self, s: str) -> i...
stack_v2_sparse_classes_75kplus_train_065774
1,790
no_license
[ { "docstring": "栈解法: 初始化:栈为-1,避免当第一个字符就是),出栈没有元素报错;同时避免所有括号全部匹配时候计算长度少1. 入栈条件:当前括号为左括号 出栈条件:当前括号为右括号 计算子串长度条件:当前栈不为空,栈内有元素 计算方法:当前元素 - 栈底元素 并且更新最大值 :param s: :return:", "name": "longestValidParentheses", "signature": "def longestValidParentheses(self, s: str) -> int" }, { "docstring": "动态龟化参考的官方...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s: str) -> int: 栈解法: 初始化:栈为-1,避免当第一个字符就是),出栈没有元素报错;同时避免所有括号全部匹配时候计算长度少1. 入栈条件:当前括号为左括号 出栈条件:当前括号为右括号 计算子串长度条件:当前栈不为空,栈内有元素 计算方法:当前元素 - 栈底元素 并且更新...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestValidParentheses(self, s: str) -> int: 栈解法: 初始化:栈为-1,避免当第一个字符就是),出栈没有元素报错;同时避免所有括号全部匹配时候计算长度少1. 入栈条件:当前括号为左括号 出栈条件:当前括号为右括号 计算子串长度条件:当前栈不为空,栈内有元素 计算方法:当前元素 - 栈底元素 并且更新...
578cacff5851c5c2522981693c34e3c318002d30
<|skeleton|> class Solution: def longestValidParentheses(self, s: str) -> int: """栈解法: 初始化:栈为-1,避免当第一个字符就是),出栈没有元素报错;同时避免所有括号全部匹配时候计算长度少1. 入栈条件:当前括号为左括号 出栈条件:当前括号为右括号 计算子串长度条件:当前栈不为空,栈内有元素 计算方法:当前元素 - 栈底元素 并且更新最大值 :param s: :return:""" <|body_0|> def longestValidParentheses2(self, s: str) -> i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def longestValidParentheses(self, s: str) -> int: """栈解法: 初始化:栈为-1,避免当第一个字符就是),出栈没有元素报错;同时避免所有括号全部匹配时候计算长度少1. 入栈条件:当前括号为左括号 出栈条件:当前括号为右括号 计算子串长度条件:当前栈不为空,栈内有元素 计算方法:当前元素 - 栈底元素 并且更新最大值 :param s: :return:""" n = len(s) stack = [-1] ans = 0 for i in range(n): ...
the_stack_v2_python_sparse
最长有效括号.py
cjrzs/MyLeetCode
train
8
c6db2adbce560398664242de1a787d620d5d06ee
[ "import collections\nif not nums:\n return []\ncounter = collections.Counter(nums)\ntmp = counter.most_common(k)\nresult = []\nfor x in tmp:\n result.append(x[0])\nreturn result", "if not nums:\n return []\ncounter = {}\nfor n in nums:\n if n not in counter:\n counter[n] = 1\n else:\n ...
<|body_start_0|> import collections if not nums: return [] counter = collections.Counter(nums) tmp = counter.most_common(k) result = [] for x in tmp: result.append(x[0]) return result <|end_body_0|> <|body_start_1|> if not nums: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def topKFrequent(self, nums: List[int], k: int) -> List[int]: """347. 前 K 个高频元素 给定一个非空的整数数组,返回其中出现频率前 k 高的元素。 示例 1: 输入: nums = [1,1,1,2,2,3], k = 2 输出: [1,2] 示例 2: 输入: nums = [1], k = 1 输出: [1] 提示: 你可以假设给定的 k 总是合理的,且 1 ≤ k ≤ 数组中不相同的元素的个数。 你的算法的时间复杂度必须优于 O(n log n) , n 是数组的大小。 题...
stack_v2_sparse_classes_75kplus_train_065775
1,945
no_license
[ { "docstring": "347. 前 K 个高频元素 给定一个非空的整数数组,返回其中出现频率前 k 高的元素。 示例 1: 输入: nums = [1,1,1,2,2,3], k = 2 输出: [1,2] 示例 2: 输入: nums = [1], k = 1 输出: [1] 提示: 你可以假设给定的 k 总是合理的,且 1 ≤ k ≤ 数组中不相同的元素的个数。 你的算法的时间复杂度必须优于 O(n log n) , n 是数组的大小。 题目数据保证答案唯一,换句话说,数组中前 k 个高频元素的集合是唯一的。 你可以按任意顺序返回答案。 来源:力扣(LeetCode) 链接:https://leetco...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def topKFrequent(self, nums: List[int], k: int) -> List[int]: 347. 前 K 个高频元素 给定一个非空的整数数组,返回其中出现频率前 k 高的元素。 示例 1: 输入: nums = [1,1,1,2,2,3], k = 2 输出: [1,2] 示例 2: 输入: nums = [1], k...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def topKFrequent(self, nums: List[int], k: int) -> List[int]: 347. 前 K 个高频元素 给定一个非空的整数数组,返回其中出现频率前 k 高的元素。 示例 1: 输入: nums = [1,1,1,2,2,3], k = 2 输出: [1,2] 示例 2: 输入: nums = [1], k...
6580c7fd9a62494f82cedf69edda793865b5bd2d
<|skeleton|> class Solution: def topKFrequent(self, nums: List[int], k: int) -> List[int]: """347. 前 K 个高频元素 给定一个非空的整数数组,返回其中出现频率前 k 高的元素。 示例 1: 输入: nums = [1,1,1,2,2,3], k = 2 输出: [1,2] 示例 2: 输入: nums = [1], k = 1 输出: [1] 提示: 你可以假设给定的 k 总是合理的,且 1 ≤ k ≤ 数组中不相同的元素的个数。 你的算法的时间复杂度必须优于 O(n log n) , n 是数组的大小。 题...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def topKFrequent(self, nums: List[int], k: int) -> List[int]: """347. 前 K 个高频元素 给定一个非空的整数数组,返回其中出现频率前 k 高的元素。 示例 1: 输入: nums = [1,1,1,2,2,3], k = 2 输出: [1,2] 示例 2: 输入: nums = [1], k = 1 输出: [1] 提示: 你可以假设给定的 k 总是合理的,且 1 ≤ k ≤ 数组中不相同的元素的个数。 你的算法的时间复杂度必须优于 O(n log n) , n 是数组的大小。 题目数据保证答案唯一,换句话说...
the_stack_v2_python_sparse
Week_02/topKFrequentElements.py
ZGingko/algorithm008-class02
train
0
88f495c302724df293b1875f738196746c292d26
[ "n = 50\nactual = a1.num_buses(n)\nexpected = 1\nself.assertEqual(actual, expected)", "n = 0\nactual = a1.num_buses(n)\nexpected = 0\nself.assertEqual(actual, expected)", "n = 35\nactual = a1.num_buses(n)\nexpected = 1\nself.assertEqual(actual, expected)", "n = 156\nactual = a1.num_buses(n)\nexpected = 4\nsel...
<|body_start_0|> n = 50 actual = a1.num_buses(n) expected = 1 self.assertEqual(actual, expected) <|end_body_0|> <|body_start_1|> n = 0 actual = a1.num_buses(n) expected = 0 self.assertEqual(actual, expected) <|end_body_1|> <|body_start_2|> n = 35...
Test class for function a1.num_buses.
TestNumBuses
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNumBuses: """Test class for function a1.num_buses.""" def test_ecual(self): """Test if the function works properly with exact number for the passengers""" <|body_0|> def test_zero(self): """Test when the number of passangers is 0""" <|body_1|> de...
stack_v2_sparse_classes_75kplus_train_065776
1,065
no_license
[ { "docstring": "Test if the function works properly with exact number for the passengers", "name": "test_ecual", "signature": "def test_ecual(self)" }, { "docstring": "Test when the number of passangers is 0", "name": "test_zero", "signature": "def test_zero(self)" }, { "docstrin...
4
stack_v2_sparse_classes_30k_train_044932
Implement the Python class `TestNumBuses` described below. Class description: Test class for function a1.num_buses. Method signatures and docstrings: - def test_ecual(self): Test if the function works properly with exact number for the passengers - def test_zero(self): Test when the number of passangers is 0 - def te...
Implement the Python class `TestNumBuses` described below. Class description: Test class for function a1.num_buses. Method signatures and docstrings: - def test_ecual(self): Test if the function works properly with exact number for the passengers - def test_zero(self): Test when the number of passangers is 0 - def te...
ba0e48825e3f90f9da0e7506c89354622198c4a5
<|skeleton|> class TestNumBuses: """Test class for function a1.num_buses.""" def test_ecual(self): """Test if the function works properly with exact number for the passengers""" <|body_0|> def test_zero(self): """Test when the number of passangers is 0""" <|body_1|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestNumBuses: """Test class for function a1.num_buses.""" def test_ecual(self): """Test if the function works properly with exact number for the passengers""" n = 50 actual = a1.num_buses(n) expected = 1 self.assertEqual(actual, expected) def test_zero(self): ...
the_stack_v2_python_sparse
Coursera/Python3/Second Course Asignments/Assighment 1/test_num_buses.py
Vutov/SideProjects
train
0
07f198b5889f99cd1ebfe85ce78fec0b4a6a70c4
[ "self.logger = get_module_logger('User', level=logging.INFO)\nself.account = account\nself.strategy = strategy\nself.model = model\nself.verbose = verbose", "self.account.init_state(today=date)\nself.strategy.init_state(trade_date=date, model=self.model, account=self.account)\nreturn", "if not self.account.last...
<|body_start_0|> self.logger = get_module_logger('User', level=logging.INFO) self.account = account self.strategy = strategy self.model = model self.verbose = verbose <|end_body_0|> <|body_start_1|> self.account.init_state(today=date) self.strategy.init_state(tra...
User
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class User: def __init__(self, account, strategy, model, verbose=False): """A user in online system, which contains account, strategy and model three module. Parameter account : Account() strategy : a strategy instance model : a model instance report_save_path : string the path to save report....
stack_v2_sparse_classes_75kplus_train_065777
2,980
permissive
[ { "docstring": "A user in online system, which contains account, strategy and model three module. Parameter account : Account() strategy : a strategy instance model : a model instance report_save_path : string the path to save report. Will not save report if None verbose : bool Whether to print the info during ...
4
stack_v2_sparse_classes_30k_train_015362
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def __init__(self, account, strategy, model, verbose=False): A user in online system, which contains account, strategy and model three module. Parameter account : Account() strategy : a ...
Implement the Python class `User` described below. Class description: Implement the User class. Method signatures and docstrings: - def __init__(self, account, strategy, model, verbose=False): A user in online system, which contains account, strategy and model three module. Parameter account : Account() strategy : a ...
4c30e5827b74bcc45f14cf3ae0c1715459ed09ae
<|skeleton|> class User: def __init__(self, account, strategy, model, verbose=False): """A user in online system, which contains account, strategy and model three module. Parameter account : Account() strategy : a strategy instance model : a model instance report_save_path : string the path to save report....
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class User: def __init__(self, account, strategy, model, verbose=False): """A user in online system, which contains account, strategy and model three module. Parameter account : Account() strategy : a strategy instance model : a model instance report_save_path : string the path to save report. Will not save...
the_stack_v2_python_sparse
qlib/contrib/online/user.py
microsoft/qlib
train
12,822
cb2601b5ab3fa12801bcd182f0ec4d0666d920dd
[ "self.data_path = os.path.join(global_path)\nself.radar = 'radar'\nself.label = 'label'\nself.rgb = 'rgb'\nself.b_label = b_label\nself.b_rgb = b_rgb\nself.sar_c = sar_c\nself.opt_c = opt_c\nself.randomized = randomized\nself.radar_list = sorted(os.listdir(os.path.join(self.data_path, self.radar)))\nself.rand_list ...
<|body_start_0|> self.data_path = os.path.join(global_path) self.radar = 'radar' self.label = 'label' self.rgb = 'rgb' self.b_label = b_label self.b_rgb = b_rgb self.sar_c = sar_c self.opt_c = opt_c self.randomized = randomized self.radar_l...
Implementation of the torch Dataset class for EUSAR dataset The Dataset must be structured as follow: The naming convetion for patches is: XXXX_XXXXXXX_data.npy Where: - XXXX is the tile ID (from 0 to N) - XXXXXXX is the patch ID (from zero to M) - data can be label rgb or radar Dataset --/ radar --/ radar patches in n...
EUSARDataset
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EUSARDataset: """Implementation of the torch Dataset class for EUSAR dataset The Dataset must be structured as follow: The naming convetion for patches is: XXXX_XXXXXXX_data.npy Where: - XXXX is the tile ID (from 0 to N) - XXXXXXX is the patch ID (from zero to M) - data can be label rgb or radar ...
stack_v2_sparse_classes_75kplus_train_065778
4,562
permissive
[ { "docstring": "Init function :param global_path: path to the directory of data (which should be composed of: rgb, radar, label) :param b_rgb: use label? :param b_rgb: use rgb data? :param b_rgb: use rgb data? :param sar_c: number of channel of sar data :param opt_c: number of channel of optical data :param ran...
3
stack_v2_sparse_classes_30k_train_004122
Implement the Python class `EUSARDataset` described below. Class description: Implementation of the torch Dataset class for EUSAR dataset The Dataset must be structured as follow: The naming convetion for patches is: XXXX_XXXXXXX_data.npy Where: - XXXX is the tile ID (from 0 to N) - XXXXXXX is the patch ID (from zero ...
Implement the Python class `EUSARDataset` described below. Class description: Implementation of the torch Dataset class for EUSAR dataset The Dataset must be structured as follow: The naming convetion for patches is: XXXX_XXXXXXX_data.npy Where: - XXXX is the tile ID (from 0 to N) - XXXXXXX is the patch ID (from zero ...
162c26446837a7c0ffd2679b3fb54ba01f204123
<|skeleton|> class EUSARDataset: """Implementation of the torch Dataset class for EUSAR dataset The Dataset must be structured as follow: The naming convetion for patches is: XXXX_XXXXXXX_data.npy Where: - XXXX is the tile ID (from 0 to N) - XXXXXXX is the patch ID (from zero to M) - data can be label rgb or radar ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EUSARDataset: """Implementation of the torch Dataset class for EUSAR dataset The Dataset must be structured as follow: The naming convetion for patches is: XXXX_XXXXXXX_data.npy Where: - XXXX is the tile ID (from 0 to N) - XXXXXXX is the patch ID (from zero to M) - data can be label rgb or radar Dataset --/ r...
the_stack_v2_python_sparse
Lib/Datasets/EUSAR/EUSARDataset.py
cattale93/pytorch_self_supervised_learning
train
9
abeca593c173d61be194e3c86acaca8b8cb70c21
[ "discriminator = getattr(ctx.dialog, 'discriminator', None)\nif discriminator:\n if not entities.Entity.ByKeys(discriminator):\n raise ue.Exception('csweb_err_classtilesmall_discriminator')", "def _add_subclass_config(config, plugin_configs):\n \"\"\"\n The function checks if the class of ...
<|body_start_0|> discriminator = getattr(ctx.dialog, 'discriminator', None) if discriminator: if not entities.Entity.ByKeys(discriminator): raise ue.Exception('csweb_err_classtilesmall_discriminator') <|end_body_0|> <|body_start_1|> def _add_subclass_config(config, p...
PlugIn to manage plugins with the id ``class-tile_small``
WebUIPluginCallbackClassTileSmall
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebUIPluginCallbackClassTileSmall: """PlugIn to manage plugins with the id ``class-tile_small``""" def check_values(cls, ctx): """Check if the discriminator is a valid regular expression.""" <|body_0|> def adapt_config(cls, plugin_configs): """This callback allow...
stack_v2_sparse_classes_75kplus_train_065779
8,936
no_license
[ { "docstring": "Check if the discriminator is a valid regular expression.", "name": "check_values", "signature": "def check_values(cls, ctx)" }, { "docstring": "This callback allows you to manipulate the plugin_config list after the configuration has been read from the database.", "name": "a...
2
stack_v2_sparse_classes_30k_train_023419
Implement the Python class `WebUIPluginCallbackClassTileSmall` described below. Class description: PlugIn to manage plugins with the id ``class-tile_small`` Method signatures and docstrings: - def check_values(cls, ctx): Check if the discriminator is a valid regular expression. - def adapt_config(cls, plugin_configs)...
Implement the Python class `WebUIPluginCallbackClassTileSmall` described below. Class description: PlugIn to manage plugins with the id ``class-tile_small`` Method signatures and docstrings: - def check_values(cls, ctx): Check if the discriminator is a valid regular expression. - def adapt_config(cls, plugin_configs)...
6bc932c67bc8d93b873838ae6d9fb8d33c72234d
<|skeleton|> class WebUIPluginCallbackClassTileSmall: """PlugIn to manage plugins with the id ``class-tile_small``""" def check_values(cls, ctx): """Check if the discriminator is a valid regular expression.""" <|body_0|> def adapt_config(cls, plugin_configs): """This callback allow...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WebUIPluginCallbackClassTileSmall: """PlugIn to manage plugins with the id ``class-tile_small``""" def check_values(cls, ctx): """Check if the discriminator is a valid regular expression.""" discriminator = getattr(ctx.dialog, 'discriminator', None) if discriminator: i...
the_stack_v2_python_sparse
site-packages/cs.web-15.3.0.6-py2.7.egg/cs/web/components/plugin_config.py
prachipainuly-rbei/devops-poc
train
0
3be89b0d9fdef12c76500bab4265a77e579a1583
[ "cleaned_data = super(UserSignUpForm, self).clean()\ntry:\n original_password = cleaned_data['password']\n confirm_password = cleaned_data['password_confirm']\nexcept KeyError:\n return cleaned_data\nif original_password != confirm_password:\n raise forms.ValidationError('الباسورد مش متطابق.')\nreturn c...
<|body_start_0|> cleaned_data = super(UserSignUpForm, self).clean() try: original_password = cleaned_data['password'] confirm_password = cleaned_data['password_confirm'] except KeyError: return cleaned_data if original_password != confirm_password: ...
UserSignUpForm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserSignUpForm: def clean(self): """cleaned_data -> ValidationError if possible Returns Validation error if and only if: - Confirm_password != original_password""" <|body_0|> def clean_password(self): """Takes the given password and call django's built-in validators ...
stack_v2_sparse_classes_75kplus_train_065780
3,210
permissive
[ { "docstring": "cleaned_data -> ValidationError if possible Returns Validation error if and only if: - Confirm_password != original_password", "name": "clean", "signature": "def clean(self)" }, { "docstring": "Takes the given password and call django's built-in validators on it.", "name": "c...
4
stack_v2_sparse_classes_30k_train_001329
Implement the Python class `UserSignUpForm` described below. Class description: Implement the UserSignUpForm class. Method signatures and docstrings: - def clean(self): cleaned_data -> ValidationError if possible Returns Validation error if and only if: - Confirm_password != original_password - def clean_password(sel...
Implement the Python class `UserSignUpForm` described below. Class description: Implement the UserSignUpForm class. Method signatures and docstrings: - def clean(self): cleaned_data -> ValidationError if possible Returns Validation error if and only if: - Confirm_password != original_password - def clean_password(sel...
70638c121ea85ff0e6a650c5f2641b0b3b04d6d0
<|skeleton|> class UserSignUpForm: def clean(self): """cleaned_data -> ValidationError if possible Returns Validation error if and only if: - Confirm_password != original_password""" <|body_0|> def clean_password(self): """Takes the given password and call django's built-in validators ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserSignUpForm: def clean(self): """cleaned_data -> ValidationError if possible Returns Validation error if and only if: - Confirm_password != original_password""" cleaned_data = super(UserSignUpForm, self).clean() try: original_password = cleaned_data['password'] ...
the_stack_v2_python_sparse
users/forms.py
Ibrahem3amer/bala7
train
0
b9f2c99e1f499d12ebfaa30640a27f22827b6d09
[ "self._element_tag = element_tag\nself._xpath = xpath\nself.__main_controller = controller\nself._element = None", "try:\n self._element = self.__main_controller.appium.get_element(self._element_tag)\nexcept NoSuchUIElement:\n index_ = 0\n success = False\n while index_ < Settings.Errors.RETRY_NUMBER ...
<|body_start_0|> self._element_tag = element_tag self._xpath = xpath self.__main_controller = controller self._element = None <|end_body_0|> <|body_start_1|> try: self._element = self.__main_controller.appium.get_element(self._element_tag) except NoSuchUIElem...
UIObject definition
UIObject
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UIObject: """UIObject definition""" def __init__(self, controller, element_tag=None, xpath=None): """Constructor. :param controller: Main Controller :param element_tag: The path of the ui object""" <|body_0|> def _set_element(self): """Creates the link between th...
stack_v2_sparse_classes_75kplus_train_065781
2,764
no_license
[ { "docstring": "Constructor. :param controller: Main Controller :param element_tag: The path of the ui object", "name": "__init__", "signature": "def __init__(self, controller, element_tag=None, xpath=None)" }, { "docstring": "Creates the link between the class and the UI element. Virtualizes th...
6
stack_v2_sparse_classes_30k_train_039158
Implement the Python class `UIObject` described below. Class description: UIObject definition Method signatures and docstrings: - def __init__(self, controller, element_tag=None, xpath=None): Constructor. :param controller: Main Controller :param element_tag: The path of the ui object - def _set_element(self): Create...
Implement the Python class `UIObject` described below. Class description: UIObject definition Method signatures and docstrings: - def __init__(self, controller, element_tag=None, xpath=None): Constructor. :param controller: Main Controller :param element_tag: The path of the ui object - def _set_element(self): Create...
f9522c301d6bf2e0086316b1e212a39a366bcfc6
<|skeleton|> class UIObject: """UIObject definition""" def __init__(self, controller, element_tag=None, xpath=None): """Constructor. :param controller: Main Controller :param element_tag: The path of the ui object""" <|body_0|> def _set_element(self): """Creates the link between th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UIObject: """UIObject definition""" def __init__(self, controller, element_tag=None, xpath=None): """Constructor. :param controller: Main Controller :param element_tag: The path of the ui object""" self._element_tag = element_tag self._xpath = xpath self.__main_controller ...
the_stack_v2_python_sparse
src/model/UIElements/UIObject.py
meltiseugen/mobile-automation-framework
train
0
66ec79927e1c484caebf62b4ac99667edc64381b
[ "self.file = file\nself.db = SqliteDB()\nwith self.db as cur:\n cur.execute('SELECT * from salaries ORDER BY department_code, position_type;')\n self.work_data = cur.fetchall()\nself.fill = PatternFill(fill_type='solid', start_color='c1c1c1', end_color='c2c2c2')\nself.border = Border(left=Side(border_style='t...
<|body_start_0|> self.file = file self.db = SqliteDB() with self.db as cur: cur.execute('SELECT * from salaries ORDER BY department_code, position_type;') self.work_data = cur.fetchall() self.fill = PatternFill(fill_type='solid', start_color='c1c1c1', end_color='c...
Класс, выгружающий штатное расписание в файл Excel для заполнения отклонений
FullShtatToExcel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullShtatToExcel: """Класс, выгружающий штатное расписание в файл Excel для заполнения отклонений""" def __init__(self, file: str): """Метод инициализации класса :param file: Название файла для отклонений""" <|body_0|> def full_shtat_to_excel(self) -> None: """Ме...
stack_v2_sparse_classes_75kplus_train_065782
4,837
no_license
[ { "docstring": "Метод инициализации класса :param file: Название файла для отклонений", "name": "__init__", "signature": "def __init__(self, file: str)" }, { "docstring": "Метод выгрузки штатного расписания в файл :return: None", "name": "full_shtat_to_excel", "signature": "def full_shta...
2
stack_v2_sparse_classes_30k_train_023567
Implement the Python class `FullShtatToExcel` described below. Class description: Класс, выгружающий штатное расписание в файл Excel для заполнения отклонений Method signatures and docstrings: - def __init__(self, file: str): Метод инициализации класса :param file: Название файла для отклонений - def full_shtat_to_ex...
Implement the Python class `FullShtatToExcel` described below. Class description: Класс, выгружающий штатное расписание в файл Excel для заполнения отклонений Method signatures and docstrings: - def __init__(self, file: str): Метод инициализации класса :param file: Название файла для отклонений - def full_shtat_to_ex...
f63d5db6780cc02cb064e70d2076eba94cb45785
<|skeleton|> class FullShtatToExcel: """Класс, выгружающий штатное расписание в файл Excel для заполнения отклонений""" def __init__(self, file: str): """Метод инициализации класса :param file: Название файла для отклонений""" <|body_0|> def full_shtat_to_excel(self) -> None: """Ме...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FullShtatToExcel: """Класс, выгружающий штатное расписание в файл Excel для заполнения отклонений""" def __init__(self, file: str): """Метод инициализации класса :param file: Название файла для отклонений""" self.file = file self.db = SqliteDB() with self.db as cur: ...
the_stack_v2_python_sparse
save_loads/full_shtat_to_excel.py
Pheeneek/Salary
train
0
a2793b73b42ce24b28b50031b0df6c69890a9f39
[ "super().__init__()\nif portfolioBias == PortfolioBias.Short:\n raise ArgumentException('Long position must be allowed in MeanReversionPortfolioConstructionModel.')\nself.reversion_threshold = reversion_threshold\nself.window_size = window_size\nself.resolution = resolution\nself.num_of_assets = 0\nself.symbol_d...
<|body_start_0|> super().__init__() if portfolioBias == PortfolioBias.Short: raise ArgumentException('Long position must be allowed in MeanReversionPortfolioConstructionModel.') self.reversion_threshold = reversion_threshold self.window_size = window_size self.resolut...
MeanReversionPortfolioConstructionModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeanReversionPortfolioConstructionModel: def __init__(self, rebalance=Resolution.Daily, portfolioBias=PortfolioBias.LongShort, reversion_threshold=1, window_size=20, resolution=Resolution.Daily): """Initialize the model Args: rebalance: Rebalancing parameter. If it is a timedelta, date r...
stack_v2_sparse_classes_75kplus_train_065783
9,005
permissive
[ { "docstring": "Initialize the model Args: rebalance: Rebalancing parameter. If it is a timedelta, date rules or Resolution, it will be converted into a function. If None will be ignored. The function returns the next expected rebalance time for a given algorithm UTC DateTime. The function returns null if unkno...
5
stack_v2_sparse_classes_30k_train_021116
Implement the Python class `MeanReversionPortfolioConstructionModel` described below. Class description: Implement the MeanReversionPortfolioConstructionModel class. Method signatures and docstrings: - def __init__(self, rebalance=Resolution.Daily, portfolioBias=PortfolioBias.LongShort, reversion_threshold=1, window_...
Implement the Python class `MeanReversionPortfolioConstructionModel` described below. Class description: Implement the MeanReversionPortfolioConstructionModel class. Method signatures and docstrings: - def __init__(self, rebalance=Resolution.Daily, portfolioBias=PortfolioBias.LongShort, reversion_threshold=1, window_...
b33dd3bc140e14b883f39ecf848a793cf7292277
<|skeleton|> class MeanReversionPortfolioConstructionModel: def __init__(self, rebalance=Resolution.Daily, portfolioBias=PortfolioBias.LongShort, reversion_threshold=1, window_size=20, resolution=Resolution.Daily): """Initialize the model Args: rebalance: Rebalancing parameter. If it is a timedelta, date r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MeanReversionPortfolioConstructionModel: def __init__(self, rebalance=Resolution.Daily, portfolioBias=PortfolioBias.LongShort, reversion_threshold=1, window_size=20, resolution=Resolution.Daily): """Initialize the model Args: rebalance: Rebalancing parameter. If it is a timedelta, date rules or Resolu...
the_stack_v2_python_sparse
Algorithm.Framework/Portfolio/MeanReversionPortfolioConstructionModel.py
Capnode/Algoloop
train
87
f29dd8f61f0491cf45bc566ff43f6a469032e233
[ "ret = 'zz'\nfor letter in letters:\n if letter > target:\n ret = min(letter, ret)\nreturn ret if ret != 'zz' else min(letters)", "for letter in letters:\n if letter > target:\n return letter\nreturn letters[0]", "if target >= letters[-1]:\n return letters[0]\nstart = 0\nend = len(letters...
<|body_start_0|> ret = 'zz' for letter in letters: if letter > target: ret = min(letter, ret) return ret if ret != 'zz' else min(letters) <|end_body_0|> <|body_start_1|> for letter in letters: if letter > target: return letter ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def nextGreatestLetter1(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_0|> def nextGreatestLetter2(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus_train_065784
1,413
no_license
[ { "docstring": ":type letters: List[str] :type target: str :rtype: str", "name": "nextGreatestLetter1", "signature": "def nextGreatestLetter1(self, letters, target)" }, { "docstring": ":type letters: List[str] :type target: str :rtype: str", "name": "nextGreatestLetter2", "signature": "d...
3
stack_v2_sparse_classes_30k_test_001291
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreatestLetter1(self, letters, target): :type letters: List[str] :type target: str :rtype: str - def nextGreatestLetter2(self, letters, target): :type letters: List[str] ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def nextGreatestLetter1(self, letters, target): :type letters: List[str] :type target: str :rtype: str - def nextGreatestLetter2(self, letters, target): :type letters: List[str] ...
70bdd75b6af2e1811c1beab22050c01d28d7373e
<|skeleton|> class Solution: def nextGreatestLetter1(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_0|> def nextGreatestLetter2(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def nextGreatestLetter1(self, letters, target): """:type letters: List[str] :type target: str :rtype: str""" ret = 'zz' for letter in letters: if letter > target: ret = min(letter, ret) return ret if ret != 'zz' else min(letters) def n...
the_stack_v2_python_sparse
python/leetcode_bak/744_Find_Smallest_Letter_Greater_Than_Target.py
bobcaoge/my-code
train
0
59ea520e9c20b2da38ef9d55a4c133010860200a
[ "if not query:\n return ''\nsearch_query = '%{0}%'.format(query)\nreturn or_(Issue.email.ilike(search_query))", "issue.status = 'open'\nissue.save()\nreturn issue", "issue.status = 'contacted'\nissue.save()\nreturn issue" ]
<|body_start_0|> if not query: return '' search_query = '%{0}%'.format(query) return or_(Issue.email.ilike(search_query)) <|end_body_0|> <|body_start_1|> issue.status = 'open' issue.save() return issue <|end_body_1|> <|body_start_2|> issue.status = '...
Issue
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Issue: def search(cls, query): """Search a resource by 1 or more fields. :param query: Search query :type query: str :return: SQLAlchemy filter""" <|body_0|> def unread_to_open(cls, issue): """Change unread issues to open. :param issue: Issue instance :type issue: Is...
stack_v2_sparse_classes_75kplus_train_065785
2,143
permissive
[ { "docstring": "Search a resource by 1 or more fields. :param query: Search query :type query: str :return: SQLAlchemy filter", "name": "search", "signature": "def search(cls, query)" }, { "docstring": "Change unread issues to open. :param issue: Issue instance :type issue: Issue instance :retur...
3
stack_v2_sparse_classes_30k_train_041102
Implement the Python class `Issue` described below. Class description: Implement the Issue class. Method signatures and docstrings: - def search(cls, query): Search a resource by 1 or more fields. :param query: Search query :type query: str :return: SQLAlchemy filter - def unread_to_open(cls, issue): Change unread is...
Implement the Python class `Issue` described below. Class description: Implement the Issue class. Method signatures and docstrings: - def search(cls, query): Search a resource by 1 or more fields. :param query: Search query :type query: str :return: SQLAlchemy filter - def unread_to_open(cls, issue): Change unread is...
4b0fcb06cb0e4efb1e3f1d9e3999019580f73a64
<|skeleton|> class Issue: def search(cls, query): """Search a resource by 1 or more fields. :param query: Search query :type query: str :return: SQLAlchemy filter""" <|body_0|> def unread_to_open(cls, issue): """Change unread issues to open. :param issue: Issue instance :type issue: Is...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Issue: def search(cls, query): """Search a resource by 1 or more fields. :param query: Search query :type query: str :return: SQLAlchemy filter""" if not query: return '' search_query = '%{0}%'.format(query) return or_(Issue.email.ilike(search_query)) def unrea...
the_stack_v2_python_sparse
catwatch/blueprints/issue/models.py
bikegriffith/build-a-saas-app-with-flask
train
0
3ca7612feb92e3bad6d9d06856901e370437829a
[ "class NodeSubgSampler(Sampler):\n\n def __init__(self):\n super(NodeSubgSampler, self).__init__()\n\n def sample(self, g, nids):\n return dgl.node_subgraph(g, nids)\n\nclass EdgeSubgSampler(Sampler):\n\n def __init__(self):\n super(EdgeSubgSampler, self).__init__()\n\n def sample(s...
<|body_start_0|> class NodeSubgSampler(Sampler): def __init__(self): super(NodeSubgSampler, self).__init__() def sample(self, g, nids): return dgl.node_subgraph(g, nids) class EdgeSubgSampler(Sampler): def __init__(self): ...
Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline
SamplerTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SamplerTest: """Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline""" def test_sampler(self): """dgl.dataloading.Sampler:Sampler抽象基类, 核心方法sample(g, indices)""" <|bod...
stack_v2_sparse_classes_75kplus_train_065786
4,392
no_license
[ { "docstring": "dgl.dataloading.Sampler:Sampler抽象基类, 核心方法sample(g, indices)", "name": "test_sampler", "signature": "def test_sampler(self)" }, { "docstring": "基类: BlockSampler(prefetch_node_feats=None, prefetch_labels=None, prefetch_edge_feats=None) 从原图采样mfgs的Sampler抽象基类 构造参数: - prefetch_node_fe...
2
stack_v2_sparse_classes_30k_train_049185
Implement the Python class `SamplerTest` described below. Class description: Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline Method signatures and docstrings: - def test_sampler(self): dgl.dataloading.Sam...
Implement the Python class `SamplerTest` described below. Class description: Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline Method signatures and docstrings: - def test_sampler(self): dgl.dataloading.Sam...
4f4bd55d7f0502c188976dda2f95fd25614283f3
<|skeleton|> class SamplerTest: """Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline""" def test_sampler(self): """dgl.dataloading.Sampler:Sampler抽象基类, 核心方法sample(g, indices)""" <|bod...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SamplerTest: """Sampler: generate subgraph samples from original graph. Dataloader: iterables over subgraph samples. Together they form the basic primitives of the data pipeline""" def test_sampler(self): """dgl.dataloading.Sampler:Sampler抽象基类, 核心方法sample(g, indices)""" class NodeSubgSamp...
the_stack_v2_python_sparse
com.xulf.learn.ml.dgl/dgl_data/sampler_test.py
sankoudai/py-knowledge-center
train
0
0a37a3dd9d3d263d6fa5fa7e5624585b8b140579
[ "if nums is []:\n return None\nleft = 0\nright = len(nums) - 1\nwhile left < right - 1:\n mid = (left + right) / 2\n if nums[left] < nums[right]:\n return nums[left]\n if nums[left] < nums[mid]:\n left = mid\n else:\n right = mid\nreturn min(nums[left], nums[right])", "if nums ...
<|body_start_0|> if nums is []: return None left = 0 right = len(nums) - 1 while left < right - 1: mid = (left + right) / 2 if nums[left] < nums[right]: return nums[left] if nums[left] < nums[mid]: left = mid...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMin(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMin_2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if nums is []: return None left...
stack_v2_sparse_classes_75kplus_train_065787
929
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findMin", "signature": "def findMin(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findMin_2", "signature": "def findMin_2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_val_000274
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMin(self, nums): :type nums: List[int] :rtype: int - def findMin_2(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMin(self, nums): :type nums: List[int] :rtype: int - def findMin_2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def findMin(self, num...
4d24e9924a92d2f9517f82a07933b51a9ab32023
<|skeleton|> class Solution: def findMin(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findMin_2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def findMin(self, nums): """:type nums: List[int] :rtype: int""" if nums is []: return None left = 0 right = len(nums) - 1 while left < right - 1: mid = (left + right) / 2 if nums[left] < nums[right]: return ...
the_stack_v2_python_sparse
find-minimum-in-rotated-sorted-array.py
ceciet/leetcode
train
0
02b5da61f9f19061525ed4459258e50e3bf0bd27
[ "self._cap = capacity\nself._size = 0\nself._table = {}\nself._head = Node(0, -1)\nself._tail = Node(0, -1)\nself._head.next = self._tail\nself._tail.prev = self._head", "if key not in self._table:\n return -1\nnode = self._table[key]\nnode.prev.next = node.next\nnode.next.prev = node.prev\nnode.next = self._t...
<|body_start_0|> self._cap = capacity self._size = 0 self._table = {} self._head = Node(0, -1) self._tail = Node(0, -1) self._head.next = self._tail self._tail.prev = self._head <|end_body_0|> <|body_start_1|> if key not in self._table: return...
LRUCache
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus_train_065788
2,110
permissive
[ { "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_027563
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...
e38774cab5cf757ed858547780a8582951f117b4
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self._cap = capacity self._size = 0 self._table = {} self._head = Node(0, -1) self._tail = Node(0, -1) self._head.next = self._tail self._tail.prev = self._head def get(self, ...
the_stack_v2_python_sparse
crack-data-structures-and-algorithms/leetcode/python-impl/lru_cache_q146.py
kingsamchen/Eureka
train
28
5f3f187ddf31b186bbf5170a857490adf1d2370a
[ "bootstrap_exp_count = 1000\nresample_count = 1000\nbound_limits = list()\nfor N in xrange(2, self.N + 1):\n samples = self.sample_generator.generate_samples(N, self.T)\n for T in range(self.T):\n m_l, m_u = self.compute_boostrap_experiment(N, samples[:, T], resample_count, bootstrap_exp_count)\n ...
<|body_start_0|> bootstrap_exp_count = 1000 resample_count = 1000 bound_limits = list() for N in xrange(2, self.N + 1): samples = self.sample_generator.generate_samples(N, self.T) for T in range(self.T): m_l, m_u = self.compute_boostrap_experiment(...
Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future.
Bootstrap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bootstrap: """Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future.""" def compute_mean(self): """Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(Trails) is equivalent to number Bootstrap sampling experi...
stack_v2_sparse_classes_75kplus_train_065789
2,348
no_license
[ { "docstring": "Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(Trails) is equivalent to number Bootstrap sampling experiment.", "name": "compute_mean", "signature": "def compute_mean(self)" }, { "docstring": "Performs one Bootstrap experiment. :param N: Number of samples, ...
2
stack_v2_sparse_classes_30k_train_010002
Implement the Python class `Bootstrap` described below. Class description: Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future. Method signatures and docstrings: - def compute_mean(self): Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(...
Implement the Python class `Bootstrap` described below. Class description: Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future. Method signatures and docstrings: - def compute_mean(self): Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(...
582db28c4f3251486f940f4054418cc7290f4d45
<|skeleton|> class Bootstrap: """Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future.""" def compute_mean(self): """Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(Trails) is equivalent to number Bootstrap sampling experi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Bootstrap: """Class for Bootstrap Bounds The Confidence is set to 95* for this bound. Might mae it configurable in the future.""" def compute_mean(self): """Computes mean with the DELTA method of Bootstrapping. For Bootstrap T(Trails) is equivalent to number Bootstrap sampling experiment.""" ...
the_stack_v2_python_sparse
src/main/algorithm/bootstrap.py
abhinavshaw1993/SampleBounds
train
4
e2dba5a4a611426dc25f1138d6da27be3f50e485
[ "mock_cmd.return_value = (0, 'success')\nresponse = self.client.get('/ftp/user')\nself.assertEqual(response.status_code, 200)", "test_user = {'name': 'test', 'homedir': '/var/ftp/test'}\nmock_cmd.return_value = (0, 'success')\ndeletedata = json.dumps(test_user)\nresponse = self.client.delete('/ftp/user', data=del...
<|body_start_0|> mock_cmd.return_value = (0, 'success') response = self.client.get('/ftp/user') self.assertEqual(response.status_code, 200) <|end_body_0|> <|body_start_1|> test_user = {'name': 'test', 'homedir': '/var/ftp/test'} mock_cmd.return_value = (0, 'success') del...
UserTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserTests: def test_get(self, mock_cmd): """Test for the FTP user list""" <|body_0|> def test_delete(self, mock_cmd): """Delete FTP user testing""" <|body_1|> def test_post(self): """Add FTP user testing""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_75kplus_train_065790
9,943
no_license
[ { "docstring": "Test for the FTP user list", "name": "test_get", "signature": "def test_get(self, mock_cmd)" }, { "docstring": "Delete FTP user testing", "name": "test_delete", "signature": "def test_delete(self, mock_cmd)" }, { "docstring": "Add FTP user testing", "name": "t...
3
null
Implement the Python class `UserTests` described below. Class description: Implement the UserTests class. Method signatures and docstrings: - def test_get(self, mock_cmd): Test for the FTP user list - def test_delete(self, mock_cmd): Delete FTP user testing - def test_post(self): Add FTP user testing
Implement the Python class `UserTests` described below. Class description: Implement the UserTests class. Method signatures and docstrings: - def test_get(self, mock_cmd): Test for the FTP user list - def test_delete(self, mock_cmd): Delete FTP user testing - def test_post(self): Add FTP user testing <|skeleton|> cl...
7f801a569a396a27371d0831752595877c224a6b
<|skeleton|> class UserTests: def test_get(self, mock_cmd): """Test for the FTP user list""" <|body_0|> def test_delete(self, mock_cmd): """Delete FTP user testing""" <|body_1|> def test_post(self): """Add FTP user testing""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserTests: def test_get(self, mock_cmd): """Test for the FTP user list""" mock_cmd.return_value = (0, 'success') response = self.client.get('/ftp/user') self.assertEqual(response.status_code, 200) def test_delete(self, mock_cmd): """Delete FTP user testing""" ...
the_stack_v2_python_sparse
Python_projects/flask_projects/unicorn_project/ftp/tests.py
sdtimothy8/Coding
train
0
2968199be47606452dbc768461fa40782dc26323
[ "trigger = TimerTrigger(self.mudpi, config)\nself.add_component(trigger)\nreturn True", "if not isinstance(config, list):\n config = [config]\nfor conf in config:\n if not conf.get('key'):\n raise ConfigError('Missing `key` in Timer Trigger config.')\nreturn config", "self.register_component_action...
<|body_start_0|> trigger = TimerTrigger(self.mudpi, config) self.add_component(trigger) return True <|end_body_0|> <|body_start_1|> if not isinstance(config, list): config = [config] for conf in config: if not conf.get('key'): raise Config...
Interface
[ "BSD-4-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Interface: def load(self, config): """Load timer trigger component from configs""" <|body_0|> def validate(self, config): """Validate the trigger config""" <|body_1|> def register_actions(self): """Register any interface actions""" <|body...
stack_v2_sparse_classes_75kplus_train_065791
6,506
permissive
[ { "docstring": "Load timer trigger component from configs", "name": "load", "signature": "def load(self, config)" }, { "docstring": "Validate the trigger config", "name": "validate", "signature": "def validate(self, config)" }, { "docstring": "Register any interface actions", ...
3
stack_v2_sparse_classes_30k_train_009643
Implement the Python class `Interface` described below. Class description: Implement the Interface class. Method signatures and docstrings: - def load(self, config): Load timer trigger component from configs - def validate(self, config): Validate the trigger config - def register_actions(self): Register any interface...
Implement the Python class `Interface` described below. Class description: Implement the Interface class. Method signatures and docstrings: - def load(self, config): Load timer trigger component from configs - def validate(self, config): Validate the trigger config - def register_actions(self): Register any interface...
fb206b1136f529c7197f1e6b29629ed05630d377
<|skeleton|> class Interface: def load(self, config): """Load timer trigger component from configs""" <|body_0|> def validate(self, config): """Validate the trigger config""" <|body_1|> def register_actions(self): """Register any interface actions""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Interface: def load(self, config): """Load timer trigger component from configs""" trigger = TimerTrigger(self.mudpi, config) self.add_component(trigger) return True def validate(self, config): """Validate the trigger config""" if not isinstance(config, lis...
the_stack_v2_python_sparse
mudpi/extensions/timer/trigger.py
mistasp0ck/mudpi-core
train
0
6de0436abd47ba94fac9bb05fdbe77550bf7c91f
[ "self.action: Action = kwargs.pop('action', None)\nself.column_name: str = kwargs.pop('column_name', None)\nself.exclude_init: List[str] = kwargs.pop('exclude_values', list)\nsuper().__init__(form_data, *args, **kwargs)\nself.set_field_from_dict('exclude_values')\nself.fields['exclude_values'].choices = get_rows(se...
<|body_start_0|> self.action: Action = kwargs.pop('action', None) self.column_name: str = kwargs.pop('column_name', None) self.exclude_init: List[str] = kwargs.pop('exclude_values', list) super().__init__(form_data, *args, **kwargs) self.set_field_from_dict('exclude_values') ...
Form to select a few fields to exclude.
ValueExcludeForm
[ "MIT", "LGPL-2.0-or-later", "Python-2.0", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueExcludeForm: """Form to select a few fields to exclude.""" def __init__(self, form_data, *args, **kwargs): """Store action, column name and exclude init, adjust fields.""" <|body_0|> def clean(self): """Store the values in the field in the dictionary.""" ...
stack_v2_sparse_classes_75kplus_train_065792
20,237
permissive
[ { "docstring": "Store action, column name and exclude init, adjust fields.", "name": "__init__", "signature": "def __init__(self, form_data, *args, **kwargs)" }, { "docstring": "Store the values in the field in the dictionary.", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_054230
Implement the Python class `ValueExcludeForm` described below. Class description: Form to select a few fields to exclude. Method signatures and docstrings: - def __init__(self, form_data, *args, **kwargs): Store action, column name and exclude init, adjust fields. - def clean(self): Store the values in the field in t...
Implement the Python class `ValueExcludeForm` described below. Class description: Form to select a few fields to exclude. Method signatures and docstrings: - def __init__(self, form_data, *args, **kwargs): Store action, column name and exclude init, adjust fields. - def clean(self): Store the values in the field in t...
5473e9faa24c71a2a1102d47ebc2cbf27608e42a
<|skeleton|> class ValueExcludeForm: """Form to select a few fields to exclude.""" def __init__(self, form_data, *args, **kwargs): """Store action, column name and exclude init, adjust fields.""" <|body_0|> def clean(self): """Store the values in the field in the dictionary.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ValueExcludeForm: """Form to select a few fields to exclude.""" def __init__(self, form_data, *args, **kwargs): """Store action, column name and exclude init, adjust fields.""" self.action: Action = kwargs.pop('action', None) self.column_name: str = kwargs.pop('column_name', None)...
the_stack_v2_python_sparse
ontask/action/forms/run.py
LucasFranciscoCorreia/ontask_b
train
0
748064b34224df77d43938dfc2346d32ee38bc59
[ "visited = [[False for _ in range(len(board[0]))] for _ in range(len(board))]\nfor i in range(len(board)):\n for j in range(len(board[0])):\n if self.dfs(board, i, j, 0, word, visited):\n return True\nreturn False", "if index == len(word):\n return True\nif row < 0 or row > len(board) - 1 ...
<|body_start_0|> visited = [[False for _ in range(len(board[0]))] for _ in range(len(board))] for i in range(len(board)): for j in range(len(board[0])): if self.dfs(board, i, j, 0, word, visited): return True return False <|end_body_0|> <|body_sta...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def exist(self, board, word): """Args: board: list[list[str]] word: str Return: bool""" <|body_0|> def dfs(self, board, row, col, index, word, visited): """Args: board: list[list[str]] row: int col: int path: list[str] word: str visited: list[list[bool]] Re...
stack_v2_sparse_classes_75kplus_train_065793
1,510
no_license
[ { "docstring": "Args: board: list[list[str]] word: str Return: bool", "name": "exist", "signature": "def exist(self, board, word)" }, { "docstring": "Args: board: list[list[str]] row: int col: int path: list[str] word: str visited: list[list[bool]] Return: bool", "name": "dfs", "signatur...
2
stack_v2_sparse_classes_30k_train_002877
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exist(self, board, word): Args: board: list[list[str]] word: str Return: bool - def dfs(self, board, row, col, index, word, visited): Args: board: list[list[str]] row: int co...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def exist(self, board, word): Args: board: list[list[str]] word: str Return: bool - def dfs(self, board, row, col, index, word, visited): Args: board: list[list[str]] row: int co...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def exist(self, board, word): """Args: board: list[list[str]] word: str Return: bool""" <|body_0|> def dfs(self, board, row, col, index, word, visited): """Args: board: list[list[str]] row: int col: int path: list[str] word: str visited: list[list[bool]] Re...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def exist(self, board, word): """Args: board: list[list[str]] word: str Return: bool""" visited = [[False for _ in range(len(board[0]))] for _ in range(len(board))] for i in range(len(board)): for j in range(len(board[0])): if self.dfs(board, i, j,...
the_stack_v2_python_sparse
剑指offer/剑指 Offer 12. 矩阵中的路径.py
AiZhanghan/Leetcode
train
0
ed4de4124e9b0f86c13df9dc7d4c1de0bf5966a0
[ "row, col = (len(grid), len(grid[0]))\ndp = [[0] * col] * row\nfor i in range(row):\n for j in range(col):\n if i == 0:\n if j == 0:\n dp[i][j] = grid[i][j]\n else:\n dp[i][j] = dp[i][j - 1] + grid[i][j]\n elif j == 0:\n dp[i][j] = dp[i...
<|body_start_0|> row, col = (len(grid), len(grid[0])) dp = [[0] * col] * row for i in range(row): for j in range(col): if i == 0: if j == 0: dp[i][j] = grid[i][j] else: dp[i][j] = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int dp方程二维:试试一维的???""" <|body_0|> def test1(self, grid): """dp[i][j]=min(dp[i-1][j],dp[i][j-1])+nums[i][j] :param grid: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_065794
2,097
no_license
[ { "docstring": ":type grid: List[List[int]] :rtype: int dp方程二维:试试一维的???", "name": "minPathSum", "signature": "def minPathSum(self, grid)" }, { "docstring": "dp[i][j]=min(dp[i-1][j],dp[i][j-1])+nums[i][j] :param grid: :return:", "name": "test1", "signature": "def test1(self, grid)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int dp方程二维:试试一维的??? - def test1(self, grid): dp[i][j]=min(dp[i-1][j],dp[i][j-1])+nums[i][j] :param grid: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int dp方程二维:试试一维的??? - def test1(self, grid): dp[i][j]=min(dp[i-1][j],dp[i][j-1])+nums[i][j] :param grid: :return: ...
069bb0b751ef7f469036b9897436eb5d138ffa24
<|skeleton|> class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int dp方程二维:试试一维的???""" <|body_0|> def test1(self, grid): """dp[i][j]=min(dp[i-1][j],dp[i][j-1])+nums[i][j] :param grid: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def minPathSum(self, grid): """:type grid: List[List[int]] :rtype: int dp方程二维:试试一维的???""" row, col = (len(grid), len(grid[0])) dp = [[0] * col] * row for i in range(row): for j in range(col): if i == 0: if j == 0: ...
the_stack_v2_python_sparse
算法/动态规划/最小路径和.py
RichieSong/algorithm
train
0
54ac5436b36db3362a194a5fae5345cda49bf510
[ "if isinstance(key, int):\n return RouterAlert(key)\nif key not in RouterAlert._member_map_:\n extend_enum(RouterAlert, key, default)\nreturn RouterAlert[key]", "if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 66 <= value <= ...
<|body_start_0|> if isinstance(key, int): return RouterAlert(key) if key not in RouterAlert._member_map_: extend_enum(RouterAlert, key, default) return RouterAlert[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 65535): ...
[RouterAlert] IPv4 Router Alert Option Values
RouterAlert
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RouterAlert: """[RouterAlert] IPv4 Router Alert Option Values""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|> <...
stack_v2_sparse_classes_75kplus_train_065795
6,502
permissive
[ { "docstring": "Backport support for original codes.", "name": "get", "signature": "def get(key, default=-1)" }, { "docstring": "Lookup function used when value is not found.", "name": "_missing_", "signature": "def _missing_(cls, value)" } ]
2
stack_v2_sparse_classes_30k_train_013195
Implement the Python class `RouterAlert` described below. Class description: [RouterAlert] IPv4 Router Alert Option Values Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found.
Implement the Python class `RouterAlert` described below. Class description: [RouterAlert] IPv4 Router Alert Option Values Method signatures and docstrings: - def get(key, default=-1): Backport support for original codes. - def _missing_(cls, value): Lookup function used when value is not found. <|skeleton|> class R...
71363d7948003fec88cedcf5bc80b6befa2ba244
<|skeleton|> class RouterAlert: """[RouterAlert] IPv4 Router Alert Option Values""" def get(key, default=-1): """Backport support for original codes.""" <|body_0|> def _missing_(cls, value): """Lookup function used when value is not found.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RouterAlert: """[RouterAlert] IPv4 Router Alert Option Values""" def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return RouterAlert(key) if key not in RouterAlert._member_map_: extend_enum(RouterAlert, key, defa...
the_stack_v2_python_sparse
pcapkit/const/ipv4/router_alert.py
hiok2000/PyPCAPKit
train
0
eae7869fdc8163dce9c31051a4e39b7f98cc0330
[ "self.main_window = QtGui.QWidget()\nself.gui = Gui()\nself.gui.setupUi(self.main_window)\nself.gui.drawing_widget.mousePressEvent = self.mouse_press\nself.gui.drawing_widget.paintEvent = self.paint_event\nself.ttt = TicTacToeModel()", "w = self.gui.drawing_widget.width() // 3\nh = self.gui.drawing_widget.height(...
<|body_start_0|> self.main_window = QtGui.QWidget() self.gui = Gui() self.gui.setupUi(self.main_window) self.gui.drawing_widget.mousePressEvent = self.mouse_press self.gui.drawing_widget.paintEvent = self.paint_event self.ttt = TicTacToeModel() <|end_body_0|> <|body_star...
Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.
App
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.""" def __init__(self): """Initialize the gui.""" <|body_0|> def mouse_press(self, event): """Called automatically whenever the drawing wi...
stack_v2_sparse_classes_75kplus_train_065796
4,727
no_license
[ { "docstring": "Initialize the gui.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Called automatically whenever the drawing widget is clicked. :param PyQt.QtGui.QMouseEvent event: The event object from PyQt. :return: None", "name": "mouse_press", "signature":...
3
stack_v2_sparse_classes_30k_train_051222
Implement the Python class `App` described below. Class description: Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget. Method signatures and docstrings: - def __init__(self): Initialize the gui. - def mouse_press(self, event): Called automatically wh...
Implement the Python class `App` described below. Class description: Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget. Method signatures and docstrings: - def __init__(self): Initialize the gui. - def mouse_press(self, event): Called automatically wh...
0e3470085083012f893adb22aa46d46039016965
<|skeleton|> class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.""" def __init__(self): """Initialize the gui.""" <|body_0|> def mouse_press(self, event): """Called automatically whenever the drawing wi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class App: """Application class to create and control the gui. This version implements the Tic Tac Toe game using a drawing widget.""" def __init__(self): """Initialize the gui.""" self.main_window = QtGui.QWidget() self.gui = Gui() self.gui.setupUi(self.main_window) sel...
the_stack_v2_python_sparse
CS_210 (Introduction to Programming)/TicTacToe/DrawApp.py
JacobOrner/USAFA
train
0
c26c2039ea0afa6f699a7decc83a72fff7344846
[ "tiles = data_input('test_data')\nresult = part_1(tiles)\nself.assertEqual(result, 20899048083289)", "tiles = data_input('data')\nresult = part_1(tiles)\nself.assertEqual(result, 18482479935793)", "tiles = data_input('test_data')\nresult = part_2(tiles)\nself.assertEqual(result, 273)", "tiles = data_input('da...
<|body_start_0|> tiles = data_input('test_data') result = part_1(tiles) self.assertEqual(result, 20899048083289) <|end_body_0|> <|body_start_1|> tiles = data_input('data') result = part_1(tiles) self.assertEqual(result, 18482479935793) <|end_body_1|> <|body_start_2|> ...
()
TestAoC20
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAoC20: """()""" def test_part_1_1(self): """()""" <|body_0|> def test_part_1_2(self): """()""" <|body_1|> def test_part_2_1(self): """()""" <|body_2|> def test_part_2_2(self): """()""" <|body_3|> <|end_skelet...
stack_v2_sparse_classes_75kplus_train_065797
953
no_license
[ { "docstring": "()", "name": "test_part_1_1", "signature": "def test_part_1_1(self)" }, { "docstring": "()", "name": "test_part_1_2", "signature": "def test_part_1_2(self)" }, { "docstring": "()", "name": "test_part_2_1", "signature": "def test_part_2_1(self)" }, { ...
4
stack_v2_sparse_classes_30k_train_027259
Implement the Python class `TestAoC20` described below. Class description: () Method signatures and docstrings: - def test_part_1_1(self): () - def test_part_1_2(self): () - def test_part_2_1(self): () - def test_part_2_2(self): ()
Implement the Python class `TestAoC20` described below. Class description: () Method signatures and docstrings: - def test_part_1_1(self): () - def test_part_1_2(self): () - def test_part_2_1(self): () - def test_part_2_2(self): () <|skeleton|> class TestAoC20: """()""" def test_part_1_1(self): """(...
934c1c45daf189ce2f517b70abe896fedb152b88
<|skeleton|> class TestAoC20: """()""" def test_part_1_1(self): """()""" <|body_0|> def test_part_1_2(self): """()""" <|body_1|> def test_part_2_1(self): """()""" <|body_2|> def test_part_2_2(self): """()""" <|body_3|> <|end_skelet...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestAoC20: """()""" def test_part_1_1(self): """()""" tiles = data_input('test_data') result = part_1(tiles) self.assertEqual(result, 20899048083289) def test_part_1_2(self): """()""" tiles = data_input('data') result = part_1(tiles) se...
the_stack_v2_python_sparse
20/test.py
iveL91/Advent-of-Code-2020
train
0
2bb911741c43493ffe36ce3a1e048036384ad70e
[ "user = get_a_user(userpermissionid)\nif not user:\n api.abort(404)\nelse:\n return user\ndata = request.json\nreturn get_a_user(data=data)", "user = complete_users(userpermissionid)\nif not user:\n api.abort(404)\nelse:\n return user\ndata = request.json\nreturn complete_users(data=data)", "user = ...
<|body_start_0|> user = get_a_user(userpermissionid) if not user: api.abort(404) else: return user data = request.json return get_a_user(data=data) <|end_body_0|> <|body_start_1|> user = complete_users(userpermissionid) if not user: ...
UserPermissions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserPermissions: def get(self, userpermissionid): """get a UserPermissions given its identifier""" <|body_0|> def put(self, userpermissionid): """UserPermissions updated""" <|body_1|> def delete(self, userpermissionid): """UserPermissions deleted...
stack_v2_sparse_classes_75kplus_train_065798
2,909
no_license
[ { "docstring": "get a UserPermissions given its identifier", "name": "get", "signature": "def get(self, userpermissionid)" }, { "docstring": "UserPermissions updated", "name": "put", "signature": "def put(self, userpermissionid)" }, { "docstring": "UserPermissions deleted", "...
3
stack_v2_sparse_classes_30k_train_047369
Implement the Python class `UserPermissions` described below. Class description: Implement the UserPermissions class. Method signatures and docstrings: - def get(self, userpermissionid): get a UserPermissions given its identifier - def put(self, userpermissionid): UserPermissions updated - def delete(self, userpermis...
Implement the Python class `UserPermissions` described below. Class description: Implement the UserPermissions class. Method signatures and docstrings: - def get(self, userpermissionid): get a UserPermissions given its identifier - def put(self, userpermissionid): UserPermissions updated - def delete(self, userpermis...
4fa4042304ee01cf23ecc81f9c27977fd12c31b9
<|skeleton|> class UserPermissions: def get(self, userpermissionid): """get a UserPermissions given its identifier""" <|body_0|> def put(self, userpermissionid): """UserPermissions updated""" <|body_1|> def delete(self, userpermissionid): """UserPermissions deleted...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserPermissions: def get(self, userpermissionid): """get a UserPermissions given its identifier""" user = get_a_user(userpermissionid) if not user: api.abort(404) else: return user data = request.json return get_a_user(data=data) def...
the_stack_v2_python_sparse
main/controller/userpermissions_controller.py
Gauravkumar45/Flask-RESTPlus-API
train
0
5967c62b1c50829697d646938c6300e20a73a443
[ "try:\n params = request._serialize()\n headers = request.headers\n body = self.call('CancelTask', params, headers=headers)\n response = json.loads(body)\n model = models.CancelTaskResponse()\n model._deserialize(response['Response'])\n return model\nexcept Exception as e:\n if isinstance(e,...
<|body_start_0|> try: params = request._serialize() headers = request.headers body = self.call('CancelTask', params, headers=headers) response = json.loads(body) model = models.CancelTaskResponse() model._deserialize(response['Response']) ...
VmClient
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VmClient: def CancelTask(self, request): """This API is used to cancel a moderation task. It will return the `TaskId` of the task after the task is canceled successfully.<br> Default API request rate limit: **20 requests/sec**. :param request: Request instance for CancelTask. :type reque...
stack_v2_sparse_classes_75kplus_train_065799
9,643
no_license
[ { "docstring": "This API is used to cancel a moderation task. It will return the `TaskId` of the task after the task is canceled successfully.<br> Default API request rate limit: **20 requests/sec**. :param request: Request instance for CancelTask. :type request: :class:`tencentcloud.vm.v20201229.models.CancelT...
4
null
Implement the Python class `VmClient` described below. Class description: Implement the VmClient class. Method signatures and docstrings: - def CancelTask(self, request): This API is used to cancel a moderation task. It will return the `TaskId` of the task after the task is canceled successfully.<br> Default API requ...
Implement the Python class `VmClient` described below. Class description: Implement the VmClient class. Method signatures and docstrings: - def CancelTask(self, request): This API is used to cancel a moderation task. It will return the `TaskId` of the task after the task is canceled successfully.<br> Default API requ...
042b4d7fb609d4d240728197901b46008b35d4b0
<|skeleton|> class VmClient: def CancelTask(self, request): """This API is used to cancel a moderation task. It will return the `TaskId` of the task after the task is canceled successfully.<br> Default API request rate limit: **20 requests/sec**. :param request: Request instance for CancelTask. :type reque...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VmClient: def CancelTask(self, request): """This API is used to cancel a moderation task. It will return the `TaskId` of the task after the task is canceled successfully.<br> Default API request rate limit: **20 requests/sec**. :param request: Request instance for CancelTask. :type request: :class:`te...
the_stack_v2_python_sparse
tencentcloud/vm/v20201229/vm_client.py
TencentCloud/tencentcloud-sdk-python-intl-en
train
4