blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
cb2de76ad47851fb38b0704606852e640f8a5359
[ "csv_file = 'data/customer_data.csv'\nnew_data = database.read_data(csv_file)\nexpected = [{'user_id': '37431', 'name': 'Bill Gates', 'address': '500 5th Ave, Seattle, WA', 'phone_number': '206-709-3100', 'email': 'bgates@microsoft.com'}, {'user_id': '18720', 'name': 'Steve Ballmer', 'address': '123 Bel Air Road Lo...
<|body_start_0|> csv_file = 'data/customer_data.csv' new_data = database.read_data(csv_file) expected = [{'user_id': '37431', 'name': 'Bill Gates', 'address': '500 5th Ave, Seattle, WA', 'phone_number': '206-709-3100', 'email': 'bgates@microsoft.com'}, {'user_id': '18720', 'name': 'Steve Ballmer...
Tests functionality of MongoDB in database module.
TestDatabase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDatabase: """Tests functionality of MongoDB in database module.""" def test_read_data(self): """Tests if csv input files will be formatted correctly to list of dictionaries.""" <|body_0|> def test_import_data(self): """Tests data will be imported correctly, s...
stack_v2_sparse_classes_36k_train_011300
3,859
no_license
[ { "docstring": "Tests if csv input files will be formatted correctly to list of dictionaries.", "name": "test_read_data", "signature": "def test_read_data(self)" }, { "docstring": "Tests data will be imported correctly, setting up database tables with proper formats.", "name": "test_import_d...
5
null
Implement the Python class `TestDatabase` described below. Class description: Tests functionality of MongoDB in database module. Method signatures and docstrings: - def test_read_data(self): Tests if csv input files will be formatted correctly to list of dictionaries. - def test_import_data(self): Tests data will be ...
Implement the Python class `TestDatabase` described below. Class description: Tests functionality of MongoDB in database module. Method signatures and docstrings: - def test_read_data(self): Tests if csv input files will be formatted correctly to list of dictionaries. - def test_import_data(self): Tests data will be ...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class TestDatabase: """Tests functionality of MongoDB in database module.""" def test_read_data(self): """Tests if csv input files will be formatted correctly to list of dictionaries.""" <|body_0|> def test_import_data(self): """Tests data will be imported correctly, s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDatabase: """Tests functionality of MongoDB in database module.""" def test_read_data(self): """Tests if csv input files will be formatted correctly to list of dictionaries.""" csv_file = 'data/customer_data.csv' new_data = database.read_data(csv_file) expected = [{'us...
the_stack_v2_python_sparse
students/N0vA/lesson10/assignment/test_database.py
JavaRod/SP_Python220B_2019
train
1
6177e37be64b94b52bf5b0bf6e35181e92159170
[ "self.interval = interval\nthread = threading.Thread(target=self.update_information, args=())\nthread.setDaemon(True)\nthread.start()", "while True:\n full_weather = prediction_weather_funct()\n print(f'#### Updating Weather Information @ {datetime.now()} ####')\n self.update = Weatherforecast\n sle...
<|body_start_0|> self.interval = interval thread = threading.Thread(target=self.update_information, args=()) thread.setDaemon(True) thread.start() <|end_body_0|> <|body_start_1|> while True: full_weather = prediction_weather_funct() print(f'#### Updating...
Weatherforecast
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Weatherforecast: def __init__(self, interval): """Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running update function""" <|body_0|> def update_information(self): """Method that runs in b...
stack_v2_sparse_classes_36k_train_011301
5,735
no_license
[ { "docstring": "Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running update function", "name": "__init__", "signature": "def __init__(self, interval)" }, { "docstring": "Method that runs in background updating global...
2
stack_v2_sparse_classes_30k_train_000496
Implement the Python class `Weatherforecast` described below. Class description: Implement the Weatherforecast class. Method signatures and docstrings: - def __init__(self, interval): Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running u...
Implement the Python class `Weatherforecast` described below. Class description: Implement the Weatherforecast class. Method signatures and docstrings: - def __init__(self, interval): Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running u...
5efeebedd4695ef9d904beb707a1538ba049b187
<|skeleton|> class Weatherforecast: def __init__(self, interval): """Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running update function""" <|body_0|> def update_information(self): """Method that runs in b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Weatherforecast: def __init__(self, interval): """Constructor: Make a background job whihch automatically updates the weather infomration. (int) Interval: time to sleep after running update function""" self.interval = interval thread = threading.Thread(target=self.update_information, a...
the_stack_v2_python_sparse
dbbus/apps/prediction/get_prediction.py
mofiebiger/DublinBus
train
1
9fa6f4fcc902ec6f654df3cbcfff050e01c1e997
[ "client = test_client.TestClient(context.node['baseurl'])\npid = object_info.identifier.value()\nresponse = client.get(context.TOKEN, pid)\nchecksum_from_get = test_utilities.calculate_checksum_on_string(response, object_info.checksum.algorithm)\nassert object_info.checksum.value() == checksum_from_get\nresponse = ...
<|body_start_0|> client = test_client.TestClient(context.node['baseurl']) pid = object_info.identifier.value() response = client.get(context.TOKEN, pid) checksum_from_get = test_utilities.calculate_checksum_on_string(response, object_info.checksum.algorithm) assert object_info.ch...
Test050Get
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test050Get: def validate_object(self, object_info): """Get object and verify retrieved information against its ObjectInfo.""" <|body_0|> def test_010_get_object_by_invalid_pid(self): """404 NotFound when attempting to get non-existing object.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_011302
2,629
permissive
[ { "docstring": "Get object and verify retrieved information against its ObjectInfo.", "name": "validate_object", "signature": "def validate_object(self, object_info)" }, { "docstring": "404 NotFound when attempting to get non-existing object.", "name": "test_010_get_object_by_invalid_pid", ...
3
stack_v2_sparse_classes_30k_train_008754
Implement the Python class `Test050Get` described below. Class description: Implement the Test050Get class. Method signatures and docstrings: - def validate_object(self, object_info): Get object and verify retrieved information against its ObjectInfo. - def test_010_get_object_by_invalid_pid(self): 404 NotFound when ...
Implement the Python class `Test050Get` described below. Class description: Implement the Test050Get class. Method signatures and docstrings: - def validate_object(self, object_info): Get object and verify retrieved information against its ObjectInfo. - def test_010_get_object_by_invalid_pid(self): 404 NotFound when ...
d72a9461894d9be7d71178fb7310101b8ef9066a
<|skeleton|> class Test050Get: def validate_object(self, object_info): """Get object and verify retrieved information against its ObjectInfo.""" <|body_0|> def test_010_get_object_by_invalid_pid(self): """404 NotFound when attempting to get non-existing object.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test050Get: def validate_object(self, object_info): """Get object and verify retrieved information against its ObjectInfo.""" client = test_client.TestClient(context.node['baseurl']) pid = object_info.identifier.value() response = client.get(context.TOKEN, pid) checksum...
the_stack_v2_python_sparse
test_utilities/src/d1_test/stress_tester/projects/_unit_test_bases_for_stress_tests/tier_1_mn_read_get.py
DataONEorg/d1_python
train
15
82c19359a2f4462a41d36691641ccd563e80513f
[ "C = self.COEFFS[imt]\nln_y_ref = self._get_ln_y_ref(rup, dists, C)\nexp1 = np.exp(C['phi3'] * (sites.vs30.clip(-np.inf, 1130) - 360))\nexp2 = np.exp(C['phi3'] * (1130 - 360))\nmean = self._get_mean(sites, C, ln_y_ref, exp1, exp2)\nstddevs = self._get_stddevs(sites, rup, C, stddev_types, ln_y_ref, exp1, exp2)\nretu...
<|body_start_0|> C = self.COEFFS[imt] ln_y_ref = self._get_ln_y_ref(rup, dists, C) exp1 = np.exp(C['phi3'] * (sites.vs30.clip(-np.inf, 1130) - 360)) exp2 = np.exp(C['phi3'] * (1130 - 360)) mean = self._get_mean(sites, C, ln_y_ref, exp1, exp2) stddevs = self._get_stddevs(s...
Implements GMPE developed by Brian S.-J. Chiou and Robert R. Youngs and published as "An NGA Model for the Average Horizontal Component of Peak Ground Motion and Response Spectra" (2008, Earthquake Spectra, Volume 24, No. 1, pages 173-215).
ChiouYoungs2008
[ "BSD-3-Clause", "AGPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChiouYoungs2008: """Implements GMPE developed by Brian S.-J. Chiou and Robert R. Youngs and published as "An NGA Model for the Average Horizontal Component of Peak Ground Motion and Response Spectra" (2008, Earthquake Spectra, Volume 24, No. 1, pages 173-215).""" def get_mean_and_stddevs(sel...
stack_v2_sparse_classes_36k_train_011303
14,578
permissive
[ { "docstring": "See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.", "name": "get_mean_and_stddevs", "signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)" }, { "docstring": "Add site effects to...
4
null
Implement the Python class `ChiouYoungs2008` described below. Class description: Implements GMPE developed by Brian S.-J. Chiou and Robert R. Youngs and published as "An NGA Model for the Average Horizontal Component of Peak Ground Motion and Response Spectra" (2008, Earthquake Spectra, Volume 24, No. 1, pages 173-215...
Implement the Python class `ChiouYoungs2008` described below. Class description: Implements GMPE developed by Brian S.-J. Chiou and Robert R. Youngs and published as "An NGA Model for the Average Horizontal Component of Peak Ground Motion and Response Spectra" (2008, Earthquake Spectra, Volume 24, No. 1, pages 173-215...
0da9ba5a575360081715e8b90c71d4b16c6687c8
<|skeleton|> class ChiouYoungs2008: """Implements GMPE developed by Brian S.-J. Chiou and Robert R. Youngs and published as "An NGA Model for the Average Horizontal Component of Peak Ground Motion and Response Spectra" (2008, Earthquake Spectra, Volume 24, No. 1, pages 173-215).""" def get_mean_and_stddevs(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChiouYoungs2008: """Implements GMPE developed by Brian S.-J. Chiou and Robert R. Youngs and published as "An NGA Model for the Average Horizontal Component of Peak Ground Motion and Response Spectra" (2008, Earthquake Spectra, Volume 24, No. 1, pages 173-215).""" def get_mean_and_stddevs(self, sites, rup...
the_stack_v2_python_sparse
openquake/hazardlib/gsim/chiou_youngs_2008.py
GFZ-Centre-for-Early-Warning/shakyground
train
1
e46cfcd3f40f76248b8e0b88734e1db0e747a6ab
[ "with QuantumTape() as tape:\n qml.BasisState(np.array([1, 0]), wires=[0, 1])\n qml.RY(0.5, wires=[1])\n qml.CNOT(wires=[0, 1])\n qml.expval(qml.PauliZ(0) @ qml.PauliY(1))\ncopied_tape = tape.copy()\nassert copied_tape is not tape\nassert copied_tape.operations == tape.operations\nassert copied_tape.obs...
<|body_start_0|> with QuantumTape() as tape: qml.BasisState(np.array([1, 0]), wires=[0, 1]) qml.RY(0.5, wires=[1]) qml.CNOT(wires=[0, 1]) qml.expval(qml.PauliZ(0) @ qml.PauliY(1)) copied_tape = tape.copy() assert copied_tape is not tape ass...
Test for tape copying behaviour
TestTapeCopying
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestTapeCopying: """Test for tape copying behaviour""" def test_shallow_copy(self): """Test that shallow copying of a tape results in all contained data being shared between the original tape and the copy""" <|body_0|> def test_shallow_copy_with_operations(self, copy_fn)...
stack_v2_sparse_classes_36k_train_011304
49,877
permissive
[ { "docstring": "Test that shallow copying of a tape results in all contained data being shared between the original tape and the copy", "name": "test_shallow_copy", "signature": "def test_shallow_copy(self)" }, { "docstring": "Test that shallow copying of a tape and operations allows parameters ...
4
stack_v2_sparse_classes_30k_train_008000
Implement the Python class `TestTapeCopying` described below. Class description: Test for tape copying behaviour Method signatures and docstrings: - def test_shallow_copy(self): Test that shallow copying of a tape results in all contained data being shared between the original tape and the copy - def test_shallow_cop...
Implement the Python class `TestTapeCopying` described below. Class description: Test for tape copying behaviour Method signatures and docstrings: - def test_shallow_copy(self): Test that shallow copying of a tape results in all contained data being shared between the original tape and the copy - def test_shallow_cop...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class TestTapeCopying: """Test for tape copying behaviour""" def test_shallow_copy(self): """Test that shallow copying of a tape results in all contained data being shared between the original tape and the copy""" <|body_0|> def test_shallow_copy_with_operations(self, copy_fn)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestTapeCopying: """Test for tape copying behaviour""" def test_shallow_copy(self): """Test that shallow copying of a tape results in all contained data being shared between the original tape and the copy""" with QuantumTape() as tape: qml.BasisState(np.array([1, 0]), wires=[0...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits_v02/pennylane/pennylane#1243/before/test_tape.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
708a80ef1b51d9c7eec6a9fab8496cc2144e7ed8
[ "rval, pval, qval = (root.val, p.val, q.val)\nif pval < rval and qval < rval:\n return self.lowestCommonAncestor_MK1(root.left, p, q)\nelif pval > rval and qval > rval:\n return self.lowestCommonAncestor_MK1(root.right, p, q)\nelse:\n return root", "pval, qval = (p.val, q.val)\ncurr = root\nwhile curr:\n...
<|body_start_0|> rval, pval, qval = (root.val, p.val, q.val) if pval < rval and qval < rval: return self.lowestCommonAncestor_MK1(root.left, p, q) elif pval > rval and qval > rval: return self.lowestCommonAncestor_MK1(root.right, p, q) else: return roo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lowestCommonAncestor_MK1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: """Recursive""" <|body_0|> def lowestCommonAncestor_MK2(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: """Iterative""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_011305
1,002
no_license
[ { "docstring": "Recursive", "name": "lowestCommonAncestor_MK1", "signature": "def lowestCommonAncestor_MK1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode" }, { "docstring": "Iterative", "name": "lowestCommonAncestor_MK2", "signature": "def lowestCommonAncestor_MK2(self, root...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor_MK1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: Recursive - def lowestCommonAncestor_MK2(self, root: TreeNode, p: TreeNode, q: TreeNode)...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lowestCommonAncestor_MK1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: Recursive - def lowestCommonAncestor_MK2(self, root: TreeNode, p: TreeNode, q: TreeNode)...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def lowestCommonAncestor_MK1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: """Recursive""" <|body_0|> def lowestCommonAncestor_MK2(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: """Iterative""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lowestCommonAncestor_MK1(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: """Recursive""" rval, pval, qval = (root.val, p.val, q.val) if pval < rval and qval < rval: return self.lowestCommonAncestor_MK1(root.left, p, q) elif pval > rval and...
the_stack_v2_python_sparse
0235. Lowest Common Ancestor of a Binary Search Tree/Solution.py
faterazer/LeetCode
train
4
d0f0e7fa29fe3f4f724257441a2149379f211c71
[ "if dhce == None:\n dhce = DataHolderCallEncapsulator()\ndh = dhce.encapsulate_call(SheetPreProcessor.pre_strip, dh)\ndh, meta_dh = dhce.encapsulate_call(TriangleHeaderFinder.find_triangle_headers, dh, return_meta=True)\ndh = dhce.encapsulate_call(DateFiller.identify_and_gen_date_cols, dh, replace_col=False)\ndh...
<|body_start_0|> if dhce == None: dhce = DataHolderCallEncapsulator() dh = dhce.encapsulate_call(SheetPreProcessor.pre_strip, dh) dh, meta_dh = dhce.encapsulate_call(TriangleHeaderFinder.find_triangle_headers, dh, return_meta=True) dh = dhce.encapsulate_call(DateFiller.identi...
TrianglePipeline
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrianglePipeline: def triangle_pipeline_dh(dh, dhce=None, tri_type='single', n_outputs=1): """Performs a list of operations on an incoming DataHolder (dh) :param dh: :param dhce: :param tri_type: :param n_outputs: :return:""" <|body_0|> def table_triangle_pipeline_dh(dh, dhc...
stack_v2_sparse_classes_36k_train_011306
3,987
permissive
[ { "docstring": "Performs a list of operations on an incoming DataHolder (dh) :param dh: :param dhce: :param tri_type: :param n_outputs: :return:", "name": "triangle_pipeline_dh", "signature": "def triangle_pipeline_dh(dh, dhce=None, tri_type='single', n_outputs=1)" }, { "docstring": "Performs a ...
2
null
Implement the Python class `TrianglePipeline` described below. Class description: Implement the TrianglePipeline class. Method signatures and docstrings: - def triangle_pipeline_dh(dh, dhce=None, tri_type='single', n_outputs=1): Performs a list of operations on an incoming DataHolder (dh) :param dh: :param dhce: :par...
Implement the Python class `TrianglePipeline` described below. Class description: Implement the TrianglePipeline class. Method signatures and docstrings: - def triangle_pipeline_dh(dh, dhce=None, tri_type='single', n_outputs=1): Performs a list of operations on an incoming DataHolder (dh) :param dh: :param dhce: :par...
ee0ad1bb43e8df525c2d747f23ef8e2580f72f0f
<|skeleton|> class TrianglePipeline: def triangle_pipeline_dh(dh, dhce=None, tri_type='single', n_outputs=1): """Performs a list of operations on an incoming DataHolder (dh) :param dh: :param dhce: :param tri_type: :param n_outputs: :return:""" <|body_0|> def table_triangle_pipeline_dh(dh, dhc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrianglePipeline: def triangle_pipeline_dh(dh, dhce=None, tri_type='single', n_outputs=1): """Performs a list of operations on an incoming DataHolder (dh) :param dh: :param dhce: :param tri_type: :param n_outputs: :return:""" if dhce == None: dhce = DataHolderCallEncapsulator() ...
the_stack_v2_python_sparse
python_back_end/triangle_formatting/triangle_pipeline.py
Henler/ReBridge_data_cloud
train
0
60a6bc4edc2623c992baddf2529b7324c1a8bf47
[ "def dfs(root):\n if not root:\n return\n res.append(str(root.val) + ',')\n dfs(root.left)\n dfs(root.right)\nres = []\ndfs(root)\nreturn ''.join(res)", "lst = data.split(',')\nlst.pop()\nstack = []\nhead = None\nfor n in lst:\n n = int(n)\n if not head:\n head = TreeNode(n)\n ...
<|body_start_0|> def dfs(root): if not root: return res.append(str(root.val) + ',') dfs(root.left) dfs(root.right) res = [] dfs(root) return ''.join(res) <|end_body_0|> <|body_start_1|> lst = data.split(',') ...
Codec2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec2: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(root)...
stack_v2_sparse_classes_36k_train_011307
1,478
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_000600
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec2` described below. Class description: Implement the Codec2 class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class ...
3f0ffd519404165fd1a735441b212c801fd1ad1e
<|skeleton|> class Codec2: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec2: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def dfs(root): if not root: return res.append(str(root.val) + ',') dfs(root.left) dfs(root.right) res = [] dfs(root) ...
the_stack_v2_python_sparse
Problems/0400_0499/0449_Serialize_and_Deserialize_BST/Project_Python3/TreeNode/Codec2.py
NobuyukiInoue/LeetCode
train
0
06f60112d8b0de54934ffb50a1d0743103898ab3
[ "self.clock = False\nself.bus = bus\nself.bus.register(self)\nself._data = [0] * (16635 + 1)\nreturn", "if self.bus.address > 16635:\n return\nif self.bus.mode == MODE.READ:\n self.bus.data = self._data[self.bus.address]\nelif self.bus.mode == MODE.WRITE:\n self._data[self.bus.address] = self.bus.data\nr...
<|body_start_0|> self.clock = False self.bus = bus self.bus.register(self) self._data = [0] * (16635 + 1) return <|end_body_0|> <|body_start_1|> if self.bus.address > 16635: return if self.bus.mode == MODE.READ: self.bus.data = self._data[...
class ROM ======================== Cette classe représente la mémoire du micro-ordinateur. Elle contient une fonction qui permet d'uploader le code dans la mémoire ROM (un peu comme nous pourrions le faire avec certains micro-controlleur USB). À chaque coup d'horloge (clock/event), la classe vérifie si elle doit effect...
ROM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ROM: """class ROM ======================== Cette classe représente la mémoire du micro-ordinateur. Elle contient une fonction qui permet d'uploader le code dans la mémoire ROM (un peu comme nous pourrions le faire avec certains micro-controlleur USB). À chaque coup d'horloge (clock/event), la cla...
stack_v2_sparse_classes_36k_train_011308
4,546
permissive
[ { "docstring": "Constructeur de la classe ROM. Le constructeur s'occupe d'initialiser la mémoire et lie ce composant avec le bus. :example: >>> test = ROM(modBus.Bus()) :param bus: Composant Bus du Micro-Ordinateur. :type bus: Bus", "name": "__init__", "signature": "def __init__(self, bus)" }, { ...
3
stack_v2_sparse_classes_30k_train_003328
Implement the Python class `ROM` described below. Class description: class ROM ======================== Cette classe représente la mémoire du micro-ordinateur. Elle contient une fonction qui permet d'uploader le code dans la mémoire ROM (un peu comme nous pourrions le faire avec certains micro-controlleur USB). À chaq...
Implement the Python class `ROM` described below. Class description: class ROM ======================== Cette classe représente la mémoire du micro-ordinateur. Elle contient une fonction qui permet d'uploader le code dans la mémoire ROM (un peu comme nous pourrions le faire avec certains micro-controlleur USB). À chaq...
0a3a9b0deffa16e8c851eb53e6aad1a8983936e6
<|skeleton|> class ROM: """class ROM ======================== Cette classe représente la mémoire du micro-ordinateur. Elle contient une fonction qui permet d'uploader le code dans la mémoire ROM (un peu comme nous pourrions le faire avec certains micro-controlleur USB). À chaque coup d'horloge (clock/event), la cla...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ROM: """class ROM ======================== Cette classe représente la mémoire du micro-ordinateur. Elle contient une fonction qui permet d'uploader le code dans la mémoire ROM (un peu comme nous pourrions le faire avec certains micro-controlleur USB). À chaque coup d'horloge (clock/event), la classe vérifie s...
the_stack_v2_python_sparse
Modules/04-04-ROM.py
MarcAndreJean/PCONC
train
0
ac32dc961bdc88a0c130842aada1d9ffcd011db9
[ "args = parser.parse_args()\nif int(args['debug']) not in [1, 2]:\n raise Exception('The debug parameter is wrong, 1 is True and 2 is False')\ntry:\n control.system.system_config_create(platform_name=args['platform_name'], version_information=args['version_information'], copyright=args['copyright'], user_auth...
<|body_start_0|> args = parser.parse_args() if int(args['debug']) not in [1, 2]: raise Exception('The debug parameter is wrong, 1 is True and 2 is False') try: control.system.system_config_create(platform_name=args['platform_name'], version_information=args['version_infor...
System
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class System: def post(self): """初始化系统配置 --- tags: - system config parameters: - name: platform_name in: query type: string description: 平台名称 required: true - name: version_information type: string in: query description: 版本信息 - name: copyright type: string in: query description: 版权 - name: use...
stack_v2_sparse_classes_36k_train_011309
8,495
no_license
[ { "docstring": "初始化系统配置 --- tags: - system config parameters: - name: platform_name in: query type: string description: 平台名称 required: true - name: version_information type: string in: query description: 版本信息 - name: copyright type: string in: query description: 版权 - name: user_authentication_mode type: string ...
3
null
Implement the Python class `System` described below. Class description: Implement the System class. Method signatures and docstrings: - def post(self): 初始化系统配置 --- tags: - system config parameters: - name: platform_name in: query type: string description: 平台名称 required: true - name: version_information type: string i...
Implement the Python class `System` described below. Class description: Implement the System class. Method signatures and docstrings: - def post(self): 初始化系统配置 --- tags: - system config parameters: - name: platform_name in: query type: string description: 平台名称 required: true - name: version_information type: string i...
d25871dc66dfbd9f04e3d4d95843e39de286cfc8
<|skeleton|> class System: def post(self): """初始化系统配置 --- tags: - system config parameters: - name: platform_name in: query type: string description: 平台名称 required: true - name: version_information type: string in: query description: 版本信息 - name: copyright type: string in: query description: 版权 - name: use...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class System: def post(self): """初始化系统配置 --- tags: - system config parameters: - name: platform_name in: query type: string description: 平台名称 required: true - name: version_information type: string in: query description: 版本信息 - name: copyright type: string in: query description: 版权 - name: user_authenticati...
the_stack_v2_python_sparse
app/main/base/apis/system.py
zcl-organization/naguan
train
0
8fd147a88f6df4ee9c477c301c500fae331e8d70
[ "self.results = {}\nself.calls = 0\nself.arg_names = None", "if self.arg_names is not None:\n raise AssertionError('Instantiate a new Memoizer for each function')\nself.arg_names = inspect.getfullargspec(func).args\n\n@wraps(func)\ndef wrapper(*args, **kwargs):\n key = ', '.join([\"('{}', {})\".format(arg_n...
<|body_start_0|> self.results = {} self.calls = 0 self.arg_names = None <|end_body_0|> <|body_start_1|> if self.arg_names is not None: raise AssertionError('Instantiate a new Memoizer for each function') self.arg_names = inspect.getfullargspec(func).args @wr...
Memoizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Memoizer: def __init__(self): """Class to store the results of a function given a set of inputs.""" <|body_0|> def __call__(self, func): """Memoize decorator. Any time a function is called that a memoizer has been attached to its results are stored in the results dic...
stack_v2_sparse_classes_36k_train_011310
25,943
permissive
[ { "docstring": "Class to store the results of a function given a set of inputs.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Memoize decorator. Any time a function is called that a memoizer has been attached to its results are stored in the results dictionary or ret...
2
stack_v2_sparse_classes_30k_test_000290
Implement the Python class `Memoizer` described below. Class description: Implement the Memoizer class. Method signatures and docstrings: - def __init__(self): Class to store the results of a function given a set of inputs. - def __call__(self, func): Memoize decorator. Any time a function is called that a memoizer h...
Implement the Python class `Memoizer` described below. Class description: Implement the Memoizer class. Method signatures and docstrings: - def __init__(self): Class to store the results of a function given a set of inputs. - def __call__(self, func): Memoize decorator. Any time a function is called that a memoizer h...
c21e8859bdb20737352147b9904797ac99985b73
<|skeleton|> class Memoizer: def __init__(self): """Class to store the results of a function given a set of inputs.""" <|body_0|> def __call__(self, func): """Memoize decorator. Any time a function is called that a memoizer has been attached to its results are stored in the results dic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Memoizer: def __init__(self): """Class to store the results of a function given a set of inputs.""" self.results = {} self.calls = 0 self.arg_names = None def __call__(self, func): """Memoize decorator. Any time a function is called that a memoizer has been attache...
the_stack_v2_python_sparse
autoarray/structures/arrays/two_d/array_2d_util.py
jonathanfrawley/PyAutoArray_copy
train
0
114be6a63b7532b7a4dd36acd74b34a8c05c3549
[ "assert len(master_key) in AES.rounds_by_key_size\nself.n_rounds = AES.rounds_by_key_size[len(master_key)]\nself._key_matrices = self._expand_key(master_key)", "key_columns = bytes2matrix(master_key)\niteration_size = len(master_key) // 4\ni = 1\nwhile len(key_columns) < (self.n_rounds + 1) * 4:\n word = list(...
<|body_start_0|> assert len(master_key) in AES.rounds_by_key_size self.n_rounds = AES.rounds_by_key_size[len(master_key)] self._key_matrices = self._expand_key(master_key) <|end_body_0|> <|body_start_1|> key_columns = bytes2matrix(master_key) iteration_size = len(master_key) // ...
AES
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AES: def __init__(self, master_key): """Initializes the object with a given key.""" <|body_0|> def _expand_key(self, master_key): """Expands and returns a list of key matrices for the given master_key.""" <|body_1|> def encrypt_block(self, plaintext): ...
stack_v2_sparse_classes_36k_train_011311
4,275
permissive
[ { "docstring": "Initializes the object with a given key.", "name": "__init__", "signature": "def __init__(self, master_key)" }, { "docstring": "Expands and returns a list of key matrices for the given master_key.", "name": "_expand_key", "signature": "def _expand_key(self, master_key)" ...
3
stack_v2_sparse_classes_30k_train_016781
Implement the Python class `AES` described below. Class description: Implement the AES class. Method signatures and docstrings: - def __init__(self, master_key): Initializes the object with a given key. - def _expand_key(self, master_key): Expands and returns a list of key matrices for the given master_key. - def enc...
Implement the Python class `AES` described below. Class description: Implement the AES class. Method signatures and docstrings: - def __init__(self, master_key): Initializes the object with a given key. - def _expand_key(self, master_key): Expands and returns a list of key matrices for the given master_key. - def enc...
cda0db4888322cce759a7362de88fff5cc79f599
<|skeleton|> class AES: def __init__(self, master_key): """Initializes the object with a given key.""" <|body_0|> def _expand_key(self, master_key): """Expands and returns a list of key matrices for the given master_key.""" <|body_1|> def encrypt_block(self, plaintext): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AES: def __init__(self, master_key): """Initializes the object with a given key.""" assert len(master_key) in AES.rounds_by_key_size self.n_rounds = AES.rounds_by_key_size[len(master_key)] self._key_matrices = self._expand_key(master_key) def _expand_key(self, master_key):...
the_stack_v2_python_sparse
Codegate/2022 Finals/aesmaster/aes.py
Qwaz/solved-hacking-problem
train
100
f2b0fbc98fc2bd8fe90294854641aa4a3e97e921
[ "self.event = None\nself.concrete_categories = None\nself.abstract_categories = None\nself.key = key\nif not regex_objects:\n if model:\n regex_objs = RegexCategory.objects.select_related().filter(model_type=model)\n else:\n regex_objs = RegexCategory.objects.all()\nelse:\n regex_objs = regex...
<|body_start_0|> self.event = None self.concrete_categories = None self.abstract_categories = None self.key = key if not regex_objects: if model: regex_objs = RegexCategory.objects.select_related().filter(model_type=model) else: ...
Use a regular expression to map the external category text to internal categories
RegexRule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegexRule: """Use a regular expression to map the external category text to internal categories""" def __init__(self, key, model, regex_objects=None): """# note: regexes are compiled here- they are not strings self.source_rules = defaultdict(list) # built from a table self.null_rules...
stack_v2_sparse_classes_36k_train_011312
10,087
no_license
[ { "docstring": "# note: regexes are compiled here- they are not strings self.source_rules = defaultdict(list) # built from a table self.null_rules = [] # from items in table with source NULL for row in model: key(row) -> category each model is of the form: regular_expression We basically build 2 different types...
2
stack_v2_sparse_classes_30k_val_000946
Implement the Python class `RegexRule` described below. Class description: Use a regular expression to map the external category text to internal categories Method signatures and docstrings: - def __init__(self, key, model, regex_objects=None): # note: regexes are compiled here- they are not strings self.source_rules...
Implement the Python class `RegexRule` described below. Class description: Use a regular expression to map the external category text to internal categories Method signatures and docstrings: - def __init__(self, key, model, regex_objects=None): # note: regexes are compiled here- they are not strings self.source_rules...
c4992d80f984f3360eb2018c5a1b13ce962a55b4
<|skeleton|> class RegexRule: """Use a regular expression to map the external category text to internal categories""" def __init__(self, key, model, regex_objects=None): """# note: regexes are compiled here- they are not strings self.source_rules = defaultdict(list) # built from a table self.null_rules...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegexRule: """Use a regular expression to map the external category text to internal categories""" def __init__(self, key, model, regex_objects=None): """# note: regexes are compiled here- they are not strings self.source_rules = defaultdict(list) # built from a table self.null_rules = [] # from ...
the_stack_v2_python_sparse
abextra/pundit/classification_rules.py
danbretl/mid-tier
train
0
620040f16423e947db1c5e7c291bb39f196554cf
[ "self.students = []\nself.grades = {}\nself.isSorted = True", "if student in self.students:\n raise ValueError('Duplicate Error')\nself.students.append(student)\nself.grades[student.getIdNum()] = []\nself.isSorted = False", "try:\n self.grades[student.getIdNum()].append(grade)\nexcept KeyError:\n raise...
<|body_start_0|> self.students = [] self.grades = {} self.isSorted = True <|end_body_0|> <|body_start_1|> if student in self.students: raise ValueError('Duplicate Error') self.students.append(student) self.grades[student.getIdNum()] = [] self.isSorted...
A mapping from students to a list of grades
Grades
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grades: """A mapping from students to a list of grades""" def __init__(self): """Creates empty grade book""" <|body_0|> def addStudent(self, student): """Assumes: student is of type student Add student to the grade book.""" <|body_1|> def addGrades(s...
stack_v2_sparse_classes_36k_train_011313
2,545
no_license
[ { "docstring": "Creates empty grade book", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Assumes: student is of type student Add student to the grade book.", "name": "addStudent", "signature": "def addStudent(self, student)" }, { "docstring": "Assumes: ...
6
stack_v2_sparse_classes_30k_train_007527
Implement the Python class `Grades` described below. Class description: A mapping from students to a list of grades Method signatures and docstrings: - def __init__(self): Creates empty grade book - def addStudent(self, student): Assumes: student is of type student Add student to the grade book. - def addGrades(self,...
Implement the Python class `Grades` described below. Class description: A mapping from students to a list of grades Method signatures and docstrings: - def __init__(self): Creates empty grade book - def addStudent(self, student): Assumes: student is of type student Add student to the grade book. - def addGrades(self,...
93e5e2a5e9355b4dc94ce2071351ee4bf280b9a8
<|skeleton|> class Grades: """A mapping from students to a list of grades""" def __init__(self): """Creates empty grade book""" <|body_0|> def addStudent(self, student): """Assumes: student is of type student Add student to the grade book.""" <|body_1|> def addGrades(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Grades: """A mapping from students to a list of grades""" def __init__(self): """Creates empty grade book""" self.students = [] self.grades = {} self.isSorted = True def addStudent(self, student): """Assumes: student is of type student Add student to the grade...
the_stack_v2_python_sparse
python_programming_exercise/classHierarchy/Grades.py
dskeshav/python_practise
train
0
cdd6d3f86cb6b835fb751b5260be3eaa29ee6a31
[ "response = await self.response\nif not response.code.is_successful():\n raise error.ResponseWrappingError(response)\nreturn response", "try:\n return await self.response\nexcept error.RenderableError as e:\n return e.to_message()\nexcept Exception:\n return Message(code=INTERNAL_SERVER_ERROR)" ]
<|body_start_0|> response = await self.response if not response.code.is_successful(): raise error.ResponseWrappingError(response) return response <|end_body_0|> <|body_start_1|> try: return await self.response except error.RenderableError as e: ...
A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an exception. It also provides some internal tools for handling anything that has a :attr:...
BaseUnicastRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseUnicastRequest: """A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an exception. It also provides some internal...
stack_v2_sparse_classes_36k_train_011314
43,955
permissive
[ { "docstring": "An awaitable that returns if a response comes in and is successful, otherwise raises generic network exception or a :class:`.error.ResponseWrappingError` for unsuccessful responses. Experimental Interface.", "name": "response_raising", "signature": "async def response_raising(self)" },...
2
null
Implement the Python class `BaseUnicastRequest` described below. Class description: A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an ex...
Implement the Python class `BaseUnicastRequest` described below. Class description: A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an ex...
66bd6f66b5ba9f17c5c688dfae51a3aace7e0070
<|skeleton|> class BaseUnicastRequest: """A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an exception. It also provides some internal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseUnicastRequest: """A utility class that offers the :attr:`response_raising` and :attr:`response_nonraising` alternatives to waiting for the :attr:`response` future whose error states can be presented either as an unsuccessful response (eg. 4.04) or an exception. It also provides some internal tools for ha...
the_stack_v2_python_sparse
aiocoap/protocol.py
chrysn/aiocoap
train
258
6a930c8a1353c5becbaa2a1cf78191bacd40dd5c
[ "cur = head\na = []\nwhile cur:\n a.append(cur.val)\n cur = cur.next\nfor i in range(len(a)):\n if a[i] != a[len(a) - 1 - i]:\n return False\nreturn True", "if not head.next:\n return True\ndummy = ListNode()\ndummy.next = head\none, two = (dummy, dummy)\nwhile two and two.next:\n one = one....
<|body_start_0|> cur = head a = [] while cur: a.append(cur.val) cur = cur.next for i in range(len(a)): if a[i] != a[len(a) - 1 - i]: return False return True <|end_body_0|> <|body_start_1|> if not head.next: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, head: ListNode) -> bool: """Time Complexity : O(N), Space Complexity : O(N) Solution : list만들어서 two pointer로 비교""" <|body_0|> def isPalindrome(self, head: ListNode) -> bool: """Time Complexity : O(N), Space Complexity : O(1) Solution ...
stack_v2_sparse_classes_36k_train_011315
2,407
no_license
[ { "docstring": "Time Complexity : O(N), Space Complexity : O(N) Solution : list만들어서 two pointer로 비교", "name": "isPalindrome", "signature": "def isPalindrome(self, head: ListNode) -> bool" }, { "docstring": "Time Complexity : O(N), Space Complexity : O(1) Solution : 아래 방식과 동일한데 절반 위치를 구하고 리스트를 분리...
3
stack_v2_sparse_classes_30k_train_021274
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head: ListNode) -> bool: Time Complexity : O(N), Space Complexity : O(N) Solution : list만들어서 two pointer로 비교 - def isPalindrome(self, head: ListNode) -> bo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, head: ListNode) -> bool: Time Complexity : O(N), Space Complexity : O(N) Solution : list만들어서 two pointer로 비교 - def isPalindrome(self, head: ListNode) -> bo...
c26aef2a59e5cc2d9b0658b9c7386a43267ff8a1
<|skeleton|> class Solution: def isPalindrome(self, head: ListNode) -> bool: """Time Complexity : O(N), Space Complexity : O(N) Solution : list만들어서 two pointer로 비교""" <|body_0|> def isPalindrome(self, head: ListNode) -> bool: """Time Complexity : O(N), Space Complexity : O(1) Solution ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, head: ListNode) -> bool: """Time Complexity : O(N), Space Complexity : O(N) Solution : list만들어서 two pointer로 비교""" cur = head a = [] while cur: a.append(cur.val) cur = cur.next for i in range(len(a)): ...
the_stack_v2_python_sparse
Leetcode/Palindrome_Linked_List.py
hanwgyu/algorithm_problem_solving
train
5
38f68dffd2c450516dc303be3de45b34a725d797
[ "n = len(nums)\nL, R = (0, 0)\ntotal = 0\nres = n + 1\nwhile R < n:\n total += nums[R]\n while total >= s:\n res = min(res, R - L + 1)\n total -= nums[L]\n L += 1\n R += 1\nreturn res if res < n + 1 else 0", "if not nums or min(nums) > s or sum(nums) < s:\n return 0\nn = len(nums)...
<|body_start_0|> n = len(nums) L, R = (0, 0) total = 0 res = n + 1 while R < n: total += nums[R] while total >= s: res = min(res, R - L + 1) total -= nums[L] L += 1 R += 1 return res if re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minSubArrayLen(self, s, nums): """滑动窗口 如果窗口内的和>=s 窗口左边界右移,更新res,直到窗口内的和不再大于等于s 然后窗口右边界右移 :param s: :param nums: :return:""" <|body_0|> def minSubArrayLen2(self, s, nums): """想错了 应该用滑动窗口 超时 ls[i] 前i-1个数组的前缀和 :type s: int :type nums: List[int] :rtype: int...
stack_v2_sparse_classes_36k_train_011316
1,976
no_license
[ { "docstring": "滑动窗口 如果窗口内的和>=s 窗口左边界右移,更新res,直到窗口内的和不再大于等于s 然后窗口右边界右移 :param s: :param nums: :return:", "name": "minSubArrayLen", "signature": "def minSubArrayLen(self, s, nums)" }, { "docstring": "想错了 应该用滑动窗口 超时 ls[i] 前i-1个数组的前缀和 :type s: int :type nums: List[int] :rtype: int", "name": "mi...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSubArrayLen(self, s, nums): 滑动窗口 如果窗口内的和>=s 窗口左边界右移,更新res,直到窗口内的和不再大于等于s 然后窗口右边界右移 :param s: :param nums: :return: - def minSubArrayLen2(self, s, nums): 想错了 应该用滑动窗口 超时 ls[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minSubArrayLen(self, s, nums): 滑动窗口 如果窗口内的和>=s 窗口左边界右移,更新res,直到窗口内的和不再大于等于s 然后窗口右边界右移 :param s: :param nums: :return: - def minSubArrayLen2(self, s, nums): 想错了 应该用滑动窗口 超时 ls[...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def minSubArrayLen(self, s, nums): """滑动窗口 如果窗口内的和>=s 窗口左边界右移,更新res,直到窗口内的和不再大于等于s 然后窗口右边界右移 :param s: :param nums: :return:""" <|body_0|> def minSubArrayLen2(self, s, nums): """想错了 应该用滑动窗口 超时 ls[i] 前i-1个数组的前缀和 :type s: int :type nums: List[int] :rtype: int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minSubArrayLen(self, s, nums): """滑动窗口 如果窗口内的和>=s 窗口左边界右移,更新res,直到窗口内的和不再大于等于s 然后窗口右边界右移 :param s: :param nums: :return:""" n = len(nums) L, R = (0, 0) total = 0 res = n + 1 while R < n: total += nums[R] while total >= s: ...
the_stack_v2_python_sparse
209_长度最小的子数组.py
lovehhf/LeetCode
train
0
f97d89b1feb547da59ea5e9d91a5d623d89fc423
[ "self.traclist = traclist\nassert order in {1, 2, 3, 4, 5}\nself.order = order\ndiffusion = len(diff_coef) > 0\nself.diffusion = diffusion\nif diffusion:\n self.ids2 = grid.ids2\n self.diff_coef = diff_coef\nself.i0 = {}\nself.i1 = {}\nngbs = param['neighbours']\nfor d in 'ijk':\n i0 = 0\n i1 = 0\n i...
<|body_start_0|> self.traclist = traclist assert order in {1, 2, 3, 4, 5} self.order = order diffusion = len(diff_coef) > 0 self.diffusion = diffusion if diffusion: self.ids2 = grid.ids2 self.diff_coef = diff_coef self.i0 = {} self....
Tracer_numerics
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tracer_numerics: def __init__(self, param, grid, traclist, order, diff_coef=[]): """- grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist = ['b'] - order: can be 1, 3, or 5; sets the order of the upwind scheme used to calculate the advection...
stack_v2_sparse_classes_36k_train_011317
3,260
permissive
[ { "docstring": "- grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist = ['b'] - order: can be 1, 3, or 5; sets the order of the upwind scheme used to calculate the advection of the tracer - diffcoef is a dictionnary with diffusion coefficient for each variable", ...
2
stack_v2_sparse_classes_30k_train_005839
Implement the Python class `Tracer_numerics` described below. Class description: Implement the Tracer_numerics class. Method signatures and docstrings: - def __init__(self, param, grid, traclist, order, diff_coef=[]): - grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist...
Implement the Python class `Tracer_numerics` described below. Class description: Implement the Tracer_numerics class. Method signatures and docstrings: - def __init__(self, param, grid, traclist, order, diff_coef=[]): - grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist...
8d5989699127f4897c3591f01f218b2f796ba938
<|skeleton|> class Tracer_numerics: def __init__(self, param, grid, traclist, order, diff_coef=[]): """- grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist = ['b'] - order: can be 1, 3, or 5; sets the order of the upwind scheme used to calculate the advection...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tracer_numerics: def __init__(self, param, grid, traclist, order, diff_coef=[]): """- grid: nyles grid object - traclist: list of prognostic variables that are advected, e.g., traclist = ['b'] - order: can be 1, 3, or 5; sets the order of the upwind scheme used to calculate the advection of the tracer...
the_stack_v2_python_sparse
core/tracer.py
pvthinker/Nyles
train
19
bba310e00c1afdffef382cfdc4ce467497ec007c
[ "super(FeedbackLinearizedParkController, self).__init__(path, L, is_ned, is_flat)\nassert type(acceleration) is numpy.ndarray, 'acceleration must be numpy array'\nassert acceleration.shape[1] == 3, 'acceleration must be nx3'\nassert acceleration.shape == path.shape, 'path and acceleration must ...
<|body_start_0|> super(FeedbackLinearizedParkController, self).__init__(path, L, is_ned, is_flat) assert type(acceleration) is numpy.ndarray, 'acceleration must be numpy array' assert acceleration.shape[1] == 3, 'acceleration must be nx3' assert acceleration.shape == path.shap...
A class generalizing the park controller to accelerating trajectories The park controller is developed for linear trajectories (ie tracking a line from one point to another). Here we generalize that through the use of feedback linearization. A nominal acceleration is provided for every point along the trajectory and is...
FeedbackLinearizedParkController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeedbackLinearizedParkController: """A class generalizing the park controller to accelerating trajectories The park controller is developed for linear trajectories (ie tracking a line from one point to another). Here we generalize that through the use of feedback linearization. A nominal accelera...
stack_v2_sparse_classes_36k_train_011318
19,298
permissive
[ { "docstring": "Constructor Arguments: path: an nx3 numpy specifying positions along the path in 3-d space acceleration: an nx3 numpy array specifying the nominal acceleration at each point on the path L: the lookahead distance on the path. is_ned: optional flag indicating if the path is given in north, east, d...
2
stack_v2_sparse_classes_30k_train_001951
Implement the Python class `FeedbackLinearizedParkController` described below. Class description: A class generalizing the park controller to accelerating trajectories The park controller is developed for linear trajectories (ie tracking a line from one point to another). Here we generalize that through the use of fee...
Implement the Python class `FeedbackLinearizedParkController` described below. Class description: A class generalizing the park controller to accelerating trajectories The park controller is developed for linear trajectories (ie tracking a line from one point to another). Here we generalize that through the use of fee...
6827886916e36432ce1d806f0a78edef6c9270d9
<|skeleton|> class FeedbackLinearizedParkController: """A class generalizing the park controller to accelerating trajectories The park controller is developed for linear trajectories (ie tracking a line from one point to another). Here we generalize that through the use of feedback linearization. A nominal accelera...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeedbackLinearizedParkController: """A class generalizing the park controller to accelerating trajectories The park controller is developed for linear trajectories (ie tracking a line from one point to another). Here we generalize that through the use of feedback linearization. A nominal acceleration is provi...
the_stack_v2_python_sparse
pybots/src/robot_control/path_following.py
aivian/robots
train
0
740a08a2d13f21b2d2207e5ba94cabce294b0b7c
[ "super(KernelVar, self).__init__()\nself.embd_dim = embd_dim\nself.hidden_dim = hidden_dim\nself.kernel_dim = kernel_dim\nself.layer1 = nn.Linear(2 * embd_dim, hidden_dim)\nself.layer2 = nn.Linear(hidden_dim, hidden_dim)\nself.layer3 = nn.Linear(hidden_dim, kernel_dim)\nself.net = nn.Sequential(self.layer1, nn.ReLU...
<|body_start_0|> super(KernelVar, self).__init__() self.embd_dim = embd_dim self.hidden_dim = hidden_dim self.kernel_dim = kernel_dim self.layer1 = nn.Linear(2 * embd_dim, hidden_dim) self.layer2 = nn.Linear(hidden_dim, hidden_dim) self.layer3 = nn.Linear(hidden_d...
KernelVar
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KernelVar: def __init__(self, embd_dim, hidden_dim, kernel_dim): """Currently, this creates a 2-hidden-layer network with ELU non-linearities.""" <|body_0|> def forward(self, words): """Given words, returns batch_kernel of dimension [-1, kernel_dim]""" <|body...
stack_v2_sparse_classes_36k_train_011319
30,546
permissive
[ { "docstring": "Currently, this creates a 2-hidden-layer network with ELU non-linearities.", "name": "__init__", "signature": "def __init__(self, embd_dim, hidden_dim, kernel_dim)" }, { "docstring": "Given words, returns batch_kernel of dimension [-1, kernel_dim]", "name": "forward", "si...
2
stack_v2_sparse_classes_30k_train_007557
Implement the Python class `KernelVar` described below. Class description: Implement the KernelVar class. Method signatures and docstrings: - def __init__(self, embd_dim, hidden_dim, kernel_dim): Currently, this creates a 2-hidden-layer network with ELU non-linearities. - def forward(self, words): Given words, return...
Implement the Python class `KernelVar` described below. Class description: Implement the KernelVar class. Method signatures and docstrings: - def __init__(self, embd_dim, hidden_dim, kernel_dim): Currently, this creates a 2-hidden-layer network with ELU non-linearities. - def forward(self, words): Given words, return...
86859b7612433cc6349b427b47c54986224e702a
<|skeleton|> class KernelVar: def __init__(self, embd_dim, hidden_dim, kernel_dim): """Currently, this creates a 2-hidden-layer network with ELU non-linearities.""" <|body_0|> def forward(self, words): """Given words, returns batch_kernel of dimension [-1, kernel_dim]""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KernelVar: def __init__(self, embd_dim, hidden_dim, kernel_dim): """Currently, this creates a 2-hidden-layer network with ELU non-linearities.""" super(KernelVar, self).__init__() self.embd_dim = embd_dim self.hidden_dim = hidden_dim self.kernel_dim = kernel_dim ...
the_stack_v2_python_sparse
dpp_nets/layers/layers.py
mbp28/dpp_nets
train
1
e0cfcac258f71173b2928e5b9a051d6277354935
[ "campaign_objs = Campaign.objects.all().order_by('-id')\nserializer = CampaignSerializer(campaign_objs, many=True)\nreturn Response(create_response(serializer.data))", "serializer = CampaignSerializer(data=request.data)\nif serializer.is_valid():\n serializer.save()\n return Response(create_response(seriali...
<|body_start_0|> campaign_objs = Campaign.objects.all().order_by('-id') serializer = CampaignSerializer(campaign_objs, many=True) return Response(create_response(serializer.data)) <|end_body_0|> <|body_start_1|> serializer = CampaignSerializer(data=request.data) if serializer.is...
this view is used to create,update,list and delete Campaign's
CampaignView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CampaignView: """this view is used to create,update,list and delete Campaign's""" def get(self, request): """get list of all campaigns""" <|body_0|> def post(self, request): """create new campaign""" <|body_1|> def put(self, request): """upda...
stack_v2_sparse_classes_36k_train_011320
48,154
permissive
[ { "docstring": "get list of all campaigns", "name": "get", "signature": "def get(self, request)" }, { "docstring": "create new campaign", "name": "post", "signature": "def post(self, request)" }, { "docstring": "update existing campaign", "name": "put", "signature": "def ...
3
stack_v2_sparse_classes_30k_train_001837
Implement the Python class `CampaignView` described below. Class description: this view is used to create,update,list and delete Campaign's Method signatures and docstrings: - def get(self, request): get list of all campaigns - def post(self, request): create new campaign - def put(self, request): update existing cam...
Implement the Python class `CampaignView` described below. Class description: this view is used to create,update,list and delete Campaign's Method signatures and docstrings: - def get(self, request): get list of all campaigns - def post(self, request): create new campaign - def put(self, request): update existing cam...
590d8f6d597b9bafa1d0263edb95490f16570c37
<|skeleton|> class CampaignView: """this view is used to create,update,list and delete Campaign's""" def get(self, request): """get list of all campaigns""" <|body_0|> def post(self, request): """create new campaign""" <|body_1|> def put(self, request): """upda...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CampaignView: """this view is used to create,update,list and delete Campaign's""" def get(self, request): """get list of all campaigns""" campaign_objs = Campaign.objects.all().order_by('-id') serializer = CampaignSerializer(campaign_objs, many=True) return Response(create...
the_stack_v2_python_sparse
newscout_web/api/v1/views.py
rsqwerty/newscout_web
train
0
3f2182fed3b446fed3e3b342c1f22ddb93e5d681
[ "self._dbName = os.environ['MOPS_DBINSTANCE']\nself._instance = mopsInstance = Instance(self._dbName)\nself._conn = self._instance.get_dbh()\nself._cursor = self._conn.cursor()\nsql = 'select tracklet_id, v_ra, v_dec, v_tot, ' + 'v_ra_sigma, v_dec_sigma, pos_ang_deg, ' + 'gcr_arcsec, ext_epoch, ext_ra, ext_dec, ext...
<|body_start_0|> self._dbName = os.environ['MOPS_DBINSTANCE'] self._instance = mopsInstance = Instance(self._dbName) self._conn = self._instance.get_dbh() self._cursor = self._conn.cursor() sql = 'select tracklet_id, v_ra, v_dec, v_tot, ' + 'v_ra_sigma, v_dec_sigma, pos_ang_deg, ...
TrackletTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrackletTests: def setUp(self): """Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.""" <|body_0|> def testFetchDetections(self): """Look at the number of detections associate...
stack_v2_sparse_classes_36k_train_011321
17,613
no_license
[ { "docstring": "Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Look at the number of detections associatedto this tracklet. Then inv...
2
stack_v2_sparse_classes_30k_test_000745
Implement the Python class `TrackletTests` described below. Class description: Implement the TrackletTests class. Method signatures and docstrings: - def setUp(self): Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it. - def tes...
Implement the Python class `TrackletTests` described below. Class description: Implement the TrackletTests class. Method signatures and docstrings: - def setUp(self): Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it. - def tes...
06858b7e935243da7a3f55b3e5097d6440e0c1c2
<|skeleton|> class TrackletTests: def setUp(self): """Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.""" <|body_0|> def testFetchDetections(self): """Look at the number of detections associate...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrackletTests: def setUp(self): """Just create an Orbit instance from data in the DB. We will use that instance in our tests. We choose a field with tracklets associated to it.""" self._dbName = os.environ['MOPS_DBINSTANCE'] self._instance = mopsInstance = Instance(self._dbName) ...
the_stack_v2_python_sparse
python/MOPS/test.py
ldenneau/mopsng
train
0
1d433af29808bd16c2a16eb9955d1ec66eed418d
[ "created = self['created_at']\ncreated = fromisoformat_z(created)\nreturn created", "updated = self['updated_at']\nupdated = fromisoformat_z(updated)\nreturn updated" ]
<|body_start_0|> created = self['created_at'] created = fromisoformat_z(created) return created <|end_body_0|> <|body_start_1|> updated = self['updated_at'] updated = fromisoformat_z(updated) return updated <|end_body_1|>
Base class for miscellaneous 1Password objects as returned by 'op get <object class>'
OPBaseObject
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OPBaseObject: """Base class for miscellaneous 1Password objects as returned by 'op get <object class>'""" def created_at(self) -> datetime: """datetime : The created_at attribute parsed as a datetime object""" <|body_0|> def updated_at(self) -> datetime: """datet...
stack_v2_sparse_classes_36k_train_011322
11,729
permissive
[ { "docstring": "datetime : The created_at attribute parsed as a datetime object", "name": "created_at", "signature": "def created_at(self) -> datetime" }, { "docstring": "datetime : The updated_at attribute parsed as a datetime object", "name": "updated_at", "signature": "def updated_at(...
2
stack_v2_sparse_classes_30k_train_008665
Implement the Python class `OPBaseObject` described below. Class description: Base class for miscellaneous 1Password objects as returned by 'op get <object class>' Method signatures and docstrings: - def created_at(self) -> datetime: datetime : The created_at attribute parsed as a datetime object - def updated_at(sel...
Implement the Python class `OPBaseObject` described below. Class description: Base class for miscellaneous 1Password objects as returned by 'op get <object class>' Method signatures and docstrings: - def created_at(self) -> datetime: datetime : The created_at attribute parsed as a datetime object - def updated_at(sel...
3ced5acf3667f1af73cad26ae0ef31e8c4b19585
<|skeleton|> class OPBaseObject: """Base class for miscellaneous 1Password objects as returned by 'op get <object class>'""" def created_at(self) -> datetime: """datetime : The created_at attribute parsed as a datetime object""" <|body_0|> def updated_at(self) -> datetime: """datet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OPBaseObject: """Base class for miscellaneous 1Password objects as returned by 'op get <object class>'""" def created_at(self) -> datetime: """datetime : The created_at attribute parsed as a datetime object""" created = self['created_at'] created = fromisoformat_z(created) ...
the_stack_v2_python_sparse
pyonepassword/op_objects.py
zcutlip/pyonepassword
train
48
01caf40f97f5504a55072101e5c74f35e11d43d6
[ "import skipthoughts\nself.encode = skipthoughts.encode\nif datadir is None:\n datadir = os.path.realpath('__file__')\nself.datadir = self.datadir\nself.cache_table = {}\nself.uni_bi = uni_bi\nif uni_bi in ('uni', 'bi'):\n self.N = 2400\nelif uni_bi == 'combined':\n self.N = 4800\nelse:\n raise ValueErr...
<|body_start_0|> import skipthoughts self.encode = skipthoughts.encode if datadir is None: datadir = os.path.realpath('__file__') self.datadir = self.datadir self.cache_table = {} self.uni_bi = uni_bi if uni_bi in ('uni', 'bi'): self.N = 24...
SkipThought
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SkipThought: def __init__(self, datadir, uni_bi='combined'): """Embed Skip_Thought vectors, using precomputed model in npy format. Args: uni_bi: possible values are "uni", "bi" or "combined" determining what kind of embedding should be used. todo: is argument ndim working properly?""" ...
stack_v2_sparse_classes_36k_train_011323
5,893
no_license
[ { "docstring": "Embed Skip_Thought vectors, using precomputed model in npy format. Args: uni_bi: possible values are \"uni\", \"bi\" or \"combined\" determining what kind of embedding should be used. todo: is argument ndim working properly?", "name": "__init__", "signature": "def __init__(self, datadir,...
2
null
Implement the Python class `SkipThought` described below. Class description: Implement the SkipThought class. Method signatures and docstrings: - def __init__(self, datadir, uni_bi='combined'): Embed Skip_Thought vectors, using precomputed model in npy format. Args: uni_bi: possible values are "uni", "bi" or "combine...
Implement the Python class `SkipThought` described below. Class description: Implement the SkipThought class. Method signatures and docstrings: - def __init__(self, datadir, uni_bi='combined'): Embed Skip_Thought vectors, using precomputed model in npy format. Args: uni_bi: possible values are "uni", "bi" or "combine...
d494b3041069d377d6a7a9c296a14334f2fa5acc
<|skeleton|> class SkipThought: def __init__(self, datadir, uni_bi='combined'): """Embed Skip_Thought vectors, using precomputed model in npy format. Args: uni_bi: possible values are "uni", "bi" or "combined" determining what kind of embedding should be used. todo: is argument ndim working properly?""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SkipThought: def __init__(self, datadir, uni_bi='combined'): """Embed Skip_Thought vectors, using precomputed model in npy format. Args: uni_bi: possible values are "uni", "bi" or "combined" determining what kind of embedding should be used. todo: is argument ndim working properly?""" import s...
the_stack_v2_python_sparse
python/brmson_dataset-sts/dataset-sts-master/pysts/embedding.py
LiuFang816/SALSTM_py_data
train
10
40afbc8e67eed4a8aebbd09f6555623008e9a649
[ "Aperture.__init__(self, diameter, origin, theta, blocker_diameter, flipped)\nself.f = focal_length\nself.matrix = np.array([[1.0, 0], [-1.0 / self.f, 1.0]])\nself.draw_arcs = False", "plotted_objects = Element.plot(self, ax)\nplotted_objects += plotting.plot_aperture(ax, self)\nif plot_blockers:\n plotted_obj...
<|body_start_0|> Aperture.__init__(self, diameter, origin, theta, blocker_diameter, flipped) self.f = focal_length self.matrix = np.array([[1.0, 0], [-1.0 / self.f, 1.0]]) self.draw_arcs = False <|end_body_0|> <|body_start_1|> plotted_objects = Element.plot(self, ax) plo...
Lens
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Lens: def __init__(self, focal_length: float, diameter: float, origin=[0.0, 0.0], theta=0.0, blocker_diameter: float=float('+Inf'), flipped=False): """Creates an lens element Args: focal_length: (float) focal length of the lens diameter: (float) diameter of the lens origin: position of t...
stack_v2_sparse_classes_36k_train_011324
2,387
permissive
[ { "docstring": "Creates an lens element Args: focal_length: (float) focal length of the lens diameter: (float) diameter of the lens origin: position of the center of the lens theta: rotation angle of aperture (with respect the abscissa) blocker_diameter: (float, optional) size of the aperture blocker flipped: (...
2
stack_v2_sparse_classes_30k_train_004875
Implement the Python class `Lens` described below. Class description: Implement the Lens class. Method signatures and docstrings: - def __init__(self, focal_length: float, diameter: float, origin=[0.0, 0.0], theta=0.0, blocker_diameter: float=float('+Inf'), flipped=False): Creates an lens element Args: focal_length: ...
Implement the Python class `Lens` described below. Class description: Implement the Lens class. Method signatures and docstrings: - def __init__(self, focal_length: float, diameter: float, origin=[0.0, 0.0], theta=0.0, blocker_diameter: float=float('+Inf'), flipped=False): Creates an lens element Args: focal_length: ...
145a87c075cd66c45db7cccb5672d6103b4c3547
<|skeleton|> class Lens: def __init__(self, focal_length: float, diameter: float, origin=[0.0, 0.0], theta=0.0, blocker_diameter: float=float('+Inf'), flipped=False): """Creates an lens element Args: focal_length: (float) focal length of the lens diameter: (float) diameter of the lens origin: position of t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Lens: def __init__(self, focal_length: float, diameter: float, origin=[0.0, 0.0], theta=0.0, blocker_diameter: float=float('+Inf'), flipped=False): """Creates an lens element Args: focal_length: (float) focal length of the lens diameter: (float) diameter of the lens origin: position of the center of t...
the_stack_v2_python_sparse
raypy2d/elements/lens.py
null179/python-raypy
train
0
3b93749b15014d6832d4848b651754e25fc57837
[ "user = UserFactory.create()\ncourse = CourseFactory.create()\navailable_grade = ProctoredExamGradeFactory.create(user=user, course=course, exam_run__course=course, exam_run__eligibility_past=True)\nProctoredExamGradeFactory.create(user=user, course=course, exam_run__course=course, exam_run__eligibility_future=True...
<|body_start_0|> user = UserFactory.create() course = CourseFactory.create() available_grade = ProctoredExamGradeFactory.create(user=user, course=course, exam_run__course=course, exam_run__eligibility_past=True) ProctoredExamGradeFactory.create(user=user, course=course, exam_run__course=...
Tests for ProctoredExamGrade
ProctoredExamGradeTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProctoredExamGradeTests: """Tests for ProctoredExamGrade""" def test_for_user_course(self): """Tests that for_user_course() does not return unavailable grades""" <|body_0|> def test_set_score(self, grade_adjust, expected_passed_value, expected_grade_str): """Test...
stack_v2_sparse_classes_36k_train_011325
8,033
permissive
[ { "docstring": "Tests that for_user_course() does not return unavailable grades", "name": "test_for_user_course", "signature": "def test_for_user_course(self)" }, { "docstring": "Tests that the set_score helper method sets score-related fields appropriately", "name": "test_set_score", "s...
3
null
Implement the Python class `ProctoredExamGradeTests` described below. Class description: Tests for ProctoredExamGrade Method signatures and docstrings: - def test_for_user_course(self): Tests that for_user_course() does not return unavailable grades - def test_set_score(self, grade_adjust, expected_passed_value, expe...
Implement the Python class `ProctoredExamGradeTests` described below. Class description: Tests for ProctoredExamGrade Method signatures and docstrings: - def test_for_user_course(self): Tests that for_user_course() does not return unavailable grades - def test_set_score(self, grade_adjust, expected_passed_value, expe...
d6564caca0b7bbfd31e67a751564107fd17d6eb0
<|skeleton|> class ProctoredExamGradeTests: """Tests for ProctoredExamGrade""" def test_for_user_course(self): """Tests that for_user_course() does not return unavailable grades""" <|body_0|> def test_set_score(self, grade_adjust, expected_passed_value, expected_grade_str): """Test...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProctoredExamGradeTests: """Tests for ProctoredExamGrade""" def test_for_user_course(self): """Tests that for_user_course() does not return unavailable grades""" user = UserFactory.create() course = CourseFactory.create() available_grade = ProctoredExamGradeFactory.create(...
the_stack_v2_python_sparse
grades/models_test.py
mitodl/micromasters
train
35
5629ad020469bb4f0749842a5e0a615cc8c15d4c
[ "Frame.__init__(self, master)\nself.pack()\nself.createArtistWidgets()", "top_frame = Frame(self)\nself.labelInput = Label(top_frame, text='Artist Name')\nself.text_in = Entry(top_frame)\nself.labelResult = Label(top_frame, text='Result')\nself.labelInput.pack()\nself.text_in.pack()\nself.labelResult.pack()\ntop_...
<|body_start_0|> Frame.__init__(self, master) self.pack() self.createArtistWidgets() <|end_body_0|> <|body_start_1|> top_frame = Frame(self) self.labelInput = Label(top_frame, text='Artist Name') self.text_in = Entry(top_frame) self.labelResult = Label(top_frame,...
Application main window class.
getArtist_UI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class getArtist_UI: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createArtistWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self):...
stack_v2_sparse_classes_36k_train_011326
10,077
no_license
[ { "docstring": "Main frame initialization (mostly delegated)", "name": "__init__", "signature": "def __init__(self, master=None)" }, { "docstring": "Add all the widgets to the main frame.", "name": "createArtistWidgets", "signature": "def createArtistWidgets(self)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_020408
Implement the Python class `getArtist_UI` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createArtistWidgets(self): Add all the widgets to the main frame. - def handle(self): Han...
Implement the Python class `getArtist_UI` described below. Class description: Application main window class. Method signatures and docstrings: - def __init__(self, master=None): Main frame initialization (mostly delegated) - def createArtistWidgets(self): Add all the widgets to the main frame. - def handle(self): Han...
2dba11861f91e4bdc1ef28279132a6d8dd4ccf54
<|skeleton|> class getArtist_UI: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" <|body_0|> def createArtistWidgets(self): """Add all the widgets to the main frame.""" <|body_1|> def handle(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class getArtist_UI: """Application main window class.""" def __init__(self, master=None): """Main frame initialization (mostly delegated)""" Frame.__init__(self, master) self.pack() self.createArtistWidgets() def createArtistWidgets(self): """Add all the widgets to ...
the_stack_v2_python_sparse
Mux_src/Fix_All_Music_Guis.py
rduvalwa5/Mux
train
0
774651c63242d17c9e71ace0381e97dbf5109f70
[ "super(SeriesIdWorker, self).__init__()\nself.q = genre_url_queue\nself.set_lock = set_lock\nself.id_set = id_set\nself.crawler = SeriesCrawler()\nself.logger = log.logger", "self.set_lock.acquire()\nfor s_id in s_ids:\n self.id_set.add(s_id)\nself.set_lock.release()", "while True:\n new_url = self.q.get(...
<|body_start_0|> super(SeriesIdWorker, self).__init__() self.q = genre_url_queue self.set_lock = set_lock self.id_set = id_set self.crawler = SeriesCrawler() self.logger = log.logger <|end_body_0|> <|body_start_1|> self.set_lock.acquire() for s_id in s_id...
Thread that works on contributing to the bag of series_ids retrieved from iTunes, indicating what podcasts are currently available on iTunes
SeriesIdWorker
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeriesIdWorker: """Thread that works on contributing to the bag of series_ids retrieved from iTunes, indicating what podcasts are currently available on iTunes""" def __init__(self, genre_url_queue, id_set, set_lock): """Constructor: genre_url_queue [string Queue] - Concurrently-safe...
stack_v2_sparse_classes_36k_train_011327
6,254
permissive
[ { "docstring": "Constructor: genre_url_queue [string Queue] - Concurrently-safe queue filled with genre paginated URLs that we're grabbing series_ids froms id_set [set of ints] - Set of series_ids seen set_lock [Lock] - Lock needed to add things to the global id_set", "name": "__init__", "signature": "d...
3
null
Implement the Python class `SeriesIdWorker` described below. Class description: Thread that works on contributing to the bag of series_ids retrieved from iTunes, indicating what podcasts are currently available on iTunes Method signatures and docstrings: - def __init__(self, genre_url_queue, id_set, set_lock): Constr...
Implement the Python class `SeriesIdWorker` described below. Class description: Thread that works on contributing to the bag of series_ids retrieved from iTunes, indicating what podcasts are currently available on iTunes Method signatures and docstrings: - def __init__(self, genre_url_queue, id_set, set_lock): Constr...
061d0f9cccf278363ffaeb27fc655743b1052ae5
<|skeleton|> class SeriesIdWorker: """Thread that works on contributing to the bag of series_ids retrieved from iTunes, indicating what podcasts are currently available on iTunes""" def __init__(self, genre_url_queue, id_set, set_lock): """Constructor: genre_url_queue [string Queue] - Concurrently-safe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SeriesIdWorker: """Thread that works on contributing to the bag of series_ids retrieved from iTunes, indicating what podcasts are currently available on iTunes""" def __init__(self, genre_url_queue, id_set, set_lock): """Constructor: genre_url_queue [string Queue] - Concurrently-safe queue filled...
the_stack_v2_python_sparse
podcatch/utpodcatch/ils/series_grabber.py
cuappdev/archives
train
0
e1656ffdaf59263dedc65a40ae50f6ab1f052084
[ "self.servo1 = s1\nself.servo2 = s2\nself.servo3 = s3\nself.servo4 = s4\nself.speed_list = speed_list\nif calibrate:\n self.servo1.calibration()\n self.servo2.calibration()\n self.servo3.calibration()\n self.servo4.calibration()\ns1.speed(0)\ns2.speed(0)\ns3.speed(0)\ns4.speed(0)\nself.offset = offset",...
<|body_start_0|> self.servo1 = s1 self.servo2 = s2 self.servo3 = s3 self.servo4 = s4 self.speed_list = speed_list if calibrate: self.servo1.calibration() self.servo2.calibration() self.servo3.calibration() self.servo4.calibr...
Task for sending the most up to date outputs to the motor :param s1: Parameter is the first servo object. :param s2: Parameter is the second servo object. :param s3: Parameter is the third servo object. :param s4: Parameter is the fourth servo object. :param speed_list: A parameter containing a list of commanded speeds...
MotorControlTask
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MotorControlTask: """Task for sending the most up to date outputs to the motor :param s1: Parameter is the first servo object. :param s2: Parameter is the second servo object. :param s3: Parameter is the third servo object. :param s4: Parameter is the fourth servo object. :param speed_list: A par...
stack_v2_sparse_classes_36k_train_011328
1,815
no_license
[ { "docstring": "Constructor for the MotorControlTask", "name": "__init__", "signature": "def __init__(self, s1, s2, s3, s4, speed_list, offset=0, calibrate=False)" }, { "docstring": "Method to update the speed of each motor with the newest outputs", "name": "run", "signature": "def run(s...
2
stack_v2_sparse_classes_30k_test_000987
Implement the Python class `MotorControlTask` described below. Class description: Task for sending the most up to date outputs to the motor :param s1: Parameter is the first servo object. :param s2: Parameter is the second servo object. :param s3: Parameter is the third servo object. :param s4: Parameter is the fourth...
Implement the Python class `MotorControlTask` described below. Class description: Task for sending the most up to date outputs to the motor :param s1: Parameter is the first servo object. :param s2: Parameter is the second servo object. :param s3: Parameter is the third servo object. :param s4: Parameter is the fourth...
4be3c9dd4dc2ef1c9d74502ad30900627fe5f862
<|skeleton|> class MotorControlTask: """Task for sending the most up to date outputs to the motor :param s1: Parameter is the first servo object. :param s2: Parameter is the second servo object. :param s3: Parameter is the third servo object. :param s4: Parameter is the fourth servo object. :param speed_list: A par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MotorControlTask: """Task for sending the most up to date outputs to the motor :param s1: Parameter is the first servo object. :param s2: Parameter is the second servo object. :param s3: Parameter is the third servo object. :param s4: Parameter is the fourth servo object. :param speed_list: A parameter contai...
the_stack_v2_python_sparse
src/motor_control_task.py
mfgeorge/pyCopter
train
5
65d88785f79bd16f39bfc2dad2f2d76f92978334
[ "super(Encoder, self).__init__()\nself.hidden_dim = hidden_dim // 2 if bidir else hidden_dim\nself.n_layers = n_layers * 2 if bidir else n_layers\nself.bidir = bidir\nself.lstm = nn.LSTM(embedding_dim, self.hidden_dim, n_layers, dropout=dropout, bidirectional=bidir)\nself.h0 = Parameter(torch.zeros(1), requires_gra...
<|body_start_0|> super(Encoder, self).__init__() self.hidden_dim = hidden_dim // 2 if bidir else hidden_dim self.n_layers = n_layers * 2 if bidir else n_layers self.bidir = bidir self.lstm = nn.LSTM(embedding_dim, self.hidden_dim, n_layers, dropout=dropout, bidirectional=bidir) ...
Encoder class for Pointer-Net
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder class for Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, n_layers, dropout, bidir): """Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number of hidden units for the LSTM :param int n_layers: Number o...
stack_v2_sparse_classes_36k_train_011329
12,775
no_license
[ { "docstring": "Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number of hidden units for the LSTM :param int n_layers: Number of layers for LSTMs :param float dropout: Float between 0-1 :param bool bidir: Bidirectional", "name": "__init__", "signature"...
3
stack_v2_sparse_classes_30k_train_005998
Implement the Python class `Encoder` described below. Class description: Encoder class for Pointer-Net Method signatures and docstrings: - def __init__(self, embedding_dim, hidden_dim, n_layers, dropout, bidir): Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number o...
Implement the Python class `Encoder` described below. Class description: Encoder class for Pointer-Net Method signatures and docstrings: - def __init__(self, embedding_dim, hidden_dim, n_layers, dropout, bidir): Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number o...
86a480b9196053cee9a3287e023dd12a13bb5df8
<|skeleton|> class Encoder: """Encoder class for Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, n_layers, dropout, bidir): """Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number of hidden units for the LSTM :param int n_layers: Number o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """Encoder class for Pointer-Net""" def __init__(self, embedding_dim, hidden_dim, n_layers, dropout, bidir): """Initiate Encoder :param Tensor embedding_dim: Number of embbeding channels :param int hidden_dim: Number of hidden units for the LSTM :param int n_layers: Number of layers for ...
the_stack_v2_python_sparse
PointerNet.py
EleanorHYW/Rerank
train
0
c87919dc93fafaa2d8e584a99a9487bedd084d4f
[ "if velocity is not None:\n numvel = len(velocity)\n myvel = velocity\n if numvel > dim:\n dim = numvel\n elif numvel < dim:\n myvel = np.zeros(shape=(dim,))\n for i in range(numvel):\n myvel[i] = velocity[i]\n self._velocity = myvel\nelse:\n self._velocity = np.zer...
<|body_start_0|> if velocity is not None: numvel = len(velocity) myvel = velocity if numvel > dim: dim = numvel elif numvel < dim: myvel = np.zeros(shape=(dim,)) for i in range(numvel): myvel[i] =...
Solution initializer for a uniform flow. A uniform flow is the same everywhere and should have a zero RHS. .. automethod:: __init__ .. automethod:: __call__ .. automethod:: exact_rhs
Uniform
[ "X11", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Uniform: """Solution initializer for a uniform flow. A uniform flow is the same everywhere and should have a zero RHS. .. automethod:: __init__ .. automethod:: __call__ .. automethod:: exact_rhs""" def __init__(self, *, dim=1, nspecies=0, rho=1.0, p=1.0, e=2.5, velocity=None, mass_fracs=None...
stack_v2_sparse_classes_36k_train_011330
32,800
permissive
[ { "docstring": "Initialize uniform flow parameters. Parameters ---------- dim: int specify the number of dimensions for the flow nspecies: int specify the number of species in the flow rho: float specifies the density p: float specifies the pressure e: float specifies the internal energy velocity: numpy.ndarray...
3
stack_v2_sparse_classes_30k_train_017545
Implement the Python class `Uniform` described below. Class description: Solution initializer for a uniform flow. A uniform flow is the same everywhere and should have a zero RHS. .. automethod:: __init__ .. automethod:: __call__ .. automethod:: exact_rhs Method signatures and docstrings: - def __init__(self, *, dim=...
Implement the Python class `Uniform` described below. Class description: Solution initializer for a uniform flow. A uniform flow is the same everywhere and should have a zero RHS. .. automethod:: __init__ .. automethod:: __call__ .. automethod:: exact_rhs Method signatures and docstrings: - def __init__(self, *, dim=...
47f144782258eae2b1fb39520e96f414ae176ff4
<|skeleton|> class Uniform: """Solution initializer for a uniform flow. A uniform flow is the same everywhere and should have a zero RHS. .. automethod:: __init__ .. automethod:: __call__ .. automethod:: exact_rhs""" def __init__(self, *, dim=1, nspecies=0, rho=1.0, p=1.0, e=2.5, velocity=None, mass_fracs=None...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Uniform: """Solution initializer for a uniform flow. A uniform flow is the same everywhere and should have a zero RHS. .. automethod:: __init__ .. automethod:: __call__ .. automethod:: exact_rhs""" def __init__(self, *, dim=1, nspecies=0, rho=1.0, p=1.0, e=2.5, velocity=None, mass_fracs=None): ""...
the_stack_v2_python_sparse
mirgecom/initializers.py
kaushikcfd/mirgecom
train
0
46850c8332c1f12a8f83b9b691ffedd863f2c29d
[ "try:\n return self.load_cached_obj('native.coordinates')\nexcept:\n pass\nds = self.dataset\ntimes = self.get_available_dates()\nlons = podpac.crange(ds['lon'][0], ds['lon'][-1], ds['lon'][1] - ds['lon'][0])\nlats = podpac.crange(ds['lat'][0], ds['lat'][-1], ds['lat'][1] - ds['lat'][0])\ncoords = podpac.Coor...
<|body_start_0|> try: return self.load_cached_obj('native.coordinates') except: pass ds = self.dataset times = self.get_available_dates() lons = podpac.crange(ds['lon'][0], ds['lon'][-1], ds['lon'][1] - ds['lon'][0]) lats = podpac.crange(ds['lat'][...
Summary Attributes ---------- base_dir_url : TYPE Description base_url : TYPE Description date_url_re : TYPE Description product : TYPE Description site : TYPE Description
AirMOSS_Site
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AirMOSS_Site: """Summary Attributes ---------- base_dir_url : TYPE Description base_url : TYPE Description date_url_re : TYPE Description product : TYPE Description site : TYPE Description""" def get_native_coordinates(self): """Summary Returns ------- TYPE Description""" <|b...
stack_v2_sparse_classes_36k_train_011331
5,736
permissive
[ { "docstring": "Summary Returns ------- TYPE Description", "name": "get_native_coordinates", "signature": "def get_native_coordinates(self)" }, { "docstring": "Summary Returns ------- TYPE Description", "name": "get_available_dates", "signature": "def get_available_dates(self)" } ]
2
stack_v2_sparse_classes_30k_train_017417
Implement the Python class `AirMOSS_Site` described below. Class description: Summary Attributes ---------- base_dir_url : TYPE Description base_url : TYPE Description date_url_re : TYPE Description product : TYPE Description site : TYPE Description Method signatures and docstrings: - def get_native_coordinates(self)...
Implement the Python class `AirMOSS_Site` described below. Class description: Summary Attributes ---------- base_dir_url : TYPE Description base_url : TYPE Description date_url_re : TYPE Description product : TYPE Description site : TYPE Description Method signatures and docstrings: - def get_native_coordinates(self)...
0a96a9b3726aee9bb6208244ae96ed685667e16c
<|skeleton|> class AirMOSS_Site: """Summary Attributes ---------- base_dir_url : TYPE Description base_url : TYPE Description date_url_re : TYPE Description product : TYPE Description site : TYPE Description""" def get_native_coordinates(self): """Summary Returns ------- TYPE Description""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AirMOSS_Site: """Summary Attributes ---------- base_dir_url : TYPE Description base_url : TYPE Description date_url_re : TYPE Description product : TYPE Description site : TYPE Description""" def get_native_coordinates(self): """Summary Returns ------- TYPE Description""" try: ...
the_stack_v2_python_sparse
podpac/datalib/airmoss.py
ccuadrado/podpac
train
0
e9c21be15e811cdaed551b974b9cc3bfa994ad37
[ "step = 0\nmedian_p = (len(nums1) + len(nums2) - 1) / 2\nmedian = []\nwhile True:\n if step - median_p >= 1:\n break\n if abs(step - median_p) <= 0.5:\n if len(nums1) == 0:\n median.append(nums2[0])\n elif len(nums2) == 0:\n median.append(nums1[0])\n else:\n ...
<|body_start_0|> step = 0 median_p = (len(nums1) + len(nums2) - 1) / 2 median = [] while True: if step - median_p >= 1: break if abs(step - median_p) <= 0.5: if len(nums1) == 0: median.append(nums2[0]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: """Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^""" <|body_0|> def findMedianSortedArrays_2(self, nums1: List[int], nums2: List[int]) ->...
stack_v2_sparse_classes_36k_train_011332
2,905
no_license
[ { "docstring": "Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^", "name": "findMedianSortedArrays", "signature": "def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float" }, { "docstring": "Step 4 pointer, get rid of a min and...
2
stack_v2_sparse_classes_30k_train_004411
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^ - d...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^ - d...
d679a06a72e6dc18aed95c7e79e25de87e9c18c2
<|skeleton|> class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: """Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^""" <|body_0|> def findMedianSortedArrays_2(self, nums1: List[int], nums2: List[int]) ->...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: """Set two pointer, get rid of min of two arrays each step. [1, 2] [_, 2] ^ => ^ [3, 4] [3, 4] ^ ^""" step = 0 median_p = (len(nums1) + len(nums2) - 1) / 2 median = [] while True: ...
the_stack_v2_python_sparse
leetcode/4-median-of-two-sorted-arrays.py
ninjaboynaru/my-python-demo
train
0
55d8d994b233f6c49b75223bd00d1bed58c514cc
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
A set of methods for managing MongoDB Backup resources.
BackupServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BackupServiceServicer: """A set of methods for managing MongoDB Backup resources.""" def Get(self, request, context): """Returns the specified MongoDB Backup resource. To get the list of available MongoDB Backup resources, make a [List] request.""" <|body_0|> def List(se...
stack_v2_sparse_classes_36k_train_011333
2,939
permissive
[ { "docstring": "Returns the specified MongoDB Backup resource. To get the list of available MongoDB Backup resources, make a [List] request.", "name": "Get", "signature": "def Get(self, request, context)" }, { "docstring": "Retrieves the list of Backup resources available for the specified folde...
2
stack_v2_sparse_classes_30k_train_011429
Implement the Python class `BackupServiceServicer` described below. Class description: A set of methods for managing MongoDB Backup resources. Method signatures and docstrings: - def Get(self, request, context): Returns the specified MongoDB Backup resource. To get the list of available MongoDB Backup resources, make...
Implement the Python class `BackupServiceServicer` described below. Class description: A set of methods for managing MongoDB Backup resources. Method signatures and docstrings: - def Get(self, request, context): Returns the specified MongoDB Backup resource. To get the list of available MongoDB Backup resources, make...
980e2c5d848eadb42799132b35a9f58ab7b27157
<|skeleton|> class BackupServiceServicer: """A set of methods for managing MongoDB Backup resources.""" def Get(self, request, context): """Returns the specified MongoDB Backup resource. To get the list of available MongoDB Backup resources, make a [List] request.""" <|body_0|> def List(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BackupServiceServicer: """A set of methods for managing MongoDB Backup resources.""" def Get(self, request, context): """Returns the specified MongoDB Backup resource. To get the list of available MongoDB Backup resources, make a [List] request.""" context.set_code(grpc.StatusCode.UNIMPLE...
the_stack_v2_python_sparse
yandex/cloud/mdb/mongodb/v1/backup_service_pb2_grpc.py
IIKovalenko/python-sdk
train
1
d5fbdd708af2e1f898f7292a6cb75a06613b18d4
[ "from aha.widget.field import TextField, RichText\nfrom aha.widget.form import Form\nfrom formencode import validators as v\n\nclass AddForm(Form):\n multipart = True\n form_title = u'Add New Folder'\n button_title = u'Add'\n submit = u'Save'\n name = TextField(title=u'ID', args={'size': 40}, validat...
<|body_start_0|> from aha.widget.field import TextField, RichText from aha.widget.form import Form from formencode import validators as v class AddForm(Form): multipart = True form_title = u'Add New Folder' button_title = u'Add' submit = u...
The controller for Folder.
FolderController
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FolderController: """The controller for Folder.""" def get_form(self, kind, ins=None): """A method to return form object based on given kind. kind must be one of 'add' or 'edit'""" <|body_0|> def add_new_object(cls, v, ins): """A method to obtain new object""" ...
stack_v2_sparse_classes_36k_train_011334
2,372
permissive
[ { "docstring": "A method to return form object based on given kind. kind must be one of 'add' or 'edit'", "name": "get_form", "signature": "def get_form(self, kind, ins=None)" }, { "docstring": "A method to obtain new object", "name": "add_new_object", "signature": "def add_new_object(cl...
2
stack_v2_sparse_classes_30k_train_018422
Implement the Python class `FolderController` described below. Class description: The controller for Folder. Method signatures and docstrings: - def get_form(self, kind, ins=None): A method to return form object based on given kind. kind must be one of 'add' or 'edit' - def add_new_object(cls, v, ins): A method to ob...
Implement the Python class `FolderController` described below. Class description: The controller for Folder. Method signatures and docstrings: - def get_form(self, kind, ins=None): A method to return form object based on given kind. kind must be one of 'add' or 'edit' - def add_new_object(cls, v, ins): A method to ob...
e1209f7d44d1c59ff9d373b7d89d414f31a9c28b
<|skeleton|> class FolderController: """The controller for Folder.""" def get_form(self, kind, ins=None): """A method to return form object based on given kind. kind must be one of 'add' or 'edit'""" <|body_0|> def add_new_object(cls, v, ins): """A method to obtain new object""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FolderController: """The controller for Folder.""" def get_form(self, kind, ins=None): """A method to return form object based on given kind. kind must be one of 'add' or 'edit'""" from aha.widget.field import TextField, RichText from aha.widget.form import Form from forme...
the_stack_v2_python_sparse
applications/aha.application.coreblog3/application/controller/folder.py
Letractively/aha-gae
train
0
6028785e6d058ad4e98bef60569ca859e5a93533
[ "def build_list(node, ln):\n if node is None:\n ln.append(self.nullStr)\n return\n ln.append(str(node.val))\n build_list(node.left, ln)\n build_list(node.right, ln)\nlist_node = []\nbuild_list(root, list_node)\nreturn self.splitter.join(list_node)", "def createTree(list_node):\n try:\...
<|body_start_0|> def build_list(node, ln): if node is None: ln.append(self.nullStr) return ln.append(str(node.val)) build_list(node.left, ln) build_list(node.right, ln) list_node = [] build_list(root, list_node) ...
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_36k_train_011335
2,121
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
null
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:...
fe3c39e0c1cb689dad5f5305a890f21a3edb2260
<|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_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def build_list(node, ln): if node is None: ln.append(self.nullStr) return ln.append(str(node.val)) build_list(node.lef...
the_stack_v2_python_sparse
leetcode/LC297_serialize_deserialize_binarytree.py
gauravtatke/codetinkering
train
0
f3f1e70b9d4e9388fc3825d698118682e4a64547
[ "interval = hours * 3600\nkeys = list(sorted(data.keys()))\nts_start = min(keys)\nts_stop = max(keys)\nself._data_dict = {}\nboundaries = []\nbuckets = list(range(ts_start, ts_stop, interval))\nfor pointer in range(1, len(buckets)):\n boundaries.append((buckets[pointer - 1], buckets[pointer]))\nfor boundary in b...
<|body_start_0|> interval = hours * 3600 keys = list(sorted(data.keys())) ts_start = min(keys) ts_stop = max(keys) self._data_dict = {} boundaries = [] buckets = list(range(ts_start, ts_stop, interval)) for pointer in range(1, len(buckets)): bo...
Process data for ingestion.
Data
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Data: """Process data for ingestion.""" def __init__(self, data, hours=1, rrd_step=300): """Method that instantiates the class. Args: data: Dict of values keyed by timestamp hours: rrd_step: Returns: None""" <|body_0|> def load(self, width=5, height=6, training_lookahead...
stack_v2_sparse_classes_36k_train_011336
8,937
no_license
[ { "docstring": "Method that instantiates the class. Args: data: Dict of values keyed by timestamp hours: rrd_step: Returns: None", "name": "__init__", "signature": "def __init__(self, data, hours=1, rrd_step=300)" }, { "docstring": "Create histogram of data. Args: vector_length: Lenth of the vec...
2
stack_v2_sparse_classes_30k_train_020879
Implement the Python class `Data` described below. Class description: Process data for ingestion. Method signatures and docstrings: - def __init__(self, data, hours=1, rrd_step=300): Method that instantiates the class. Args: data: Dict of values keyed by timestamp hours: rrd_step: Returns: None - def load(self, width...
Implement the Python class `Data` described below. Class description: Process data for ingestion. Method signatures and docstrings: - def __init__(self, data, hours=1, rrd_step=300): Method that instantiates the class. Args: data: Dict of values keyed by timestamp hours: rrd_step: Returns: None - def load(self, width...
36a7996b140cccb9003cba8367364645e2d65d85
<|skeleton|> class Data: """Process data for ingestion.""" def __init__(self, data, hours=1, rrd_step=300): """Method that instantiates the class. Args: data: Dict of values keyed by timestamp hours: rrd_step: Returns: None""" <|body_0|> def load(self, width=5, height=6, training_lookahead...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Data: """Process data for ingestion.""" def __init__(self, data, hours=1, rrd_step=300): """Method that instantiates the class. Args: data: Dict of values keyed by timestamp hours: rrd_step: Returns: None""" interval = hours * 3600 keys = list(sorted(data.keys())) ts_start...
the_stack_v2_python_sparse
timeseries/forecast/_archive/forecast-cnn-1543954179.py
palisadoes/AI
train
1
8449739dd0f1e7fe6916a3dcc5d2939d5042bd6d
[ "Animal.__init__(self, habitat)\nMammal.__init__(self, food, fur)\nself.age = age\nself.sex = sex\nprint('---A Human---')", "print(f'\\nAge: {self.age}')\nprint(f'Sex: {self.sex}')\nprint(f'Habitat: {self.habitat}')\nprint(f'Food: {self.food}')\nprint(f'Fur: {self.fur}\\n')" ]
<|body_start_0|> Animal.__init__(self, habitat) Mammal.__init__(self, food, fur) self.age = age self.sex = sex print('---A Human---') <|end_body_0|> <|body_start_1|> print(f'\nAge: {self.age}') print(f'Sex: {self.sex}') print(f'Habitat: {self.habitat}') ...
Human class. Args: age (int): Age of the human. sex (str): Sex of the human.
Human
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Human: """Human class. Args: age (int): Age of the human. sex (str): Sex of the human.""" def __init__(self, age, sex, habitat, food, fur=False): """Constructor of Human class.""" <|body_0|> def display(self): """Display method to print the different characterist...
stack_v2_sparse_classes_36k_train_011337
2,135
no_license
[ { "docstring": "Constructor of Human class.", "name": "__init__", "signature": "def __init__(self, age, sex, habitat, food, fur=False)" }, { "docstring": "Display method to print the different characteristics.", "name": "display", "signature": "def display(self)" } ]
2
stack_v2_sparse_classes_30k_train_017176
Implement the Python class `Human` described below. Class description: Human class. Args: age (int): Age of the human. sex (str): Sex of the human. Method signatures and docstrings: - def __init__(self, age, sex, habitat, food, fur=False): Constructor of Human class. - def display(self): Display method to print the d...
Implement the Python class `Human` described below. Class description: Human class. Args: age (int): Age of the human. sex (str): Sex of the human. Method signatures and docstrings: - def __init__(self, age, sex, habitat, food, fur=False): Constructor of Human class. - def display(self): Display method to print the d...
892d9c25b9712bf3bbfd7f29529eca8b47fb8039
<|skeleton|> class Human: """Human class. Args: age (int): Age of the human. sex (str): Sex of the human.""" def __init__(self, age, sex, habitat, food, fur=False): """Constructor of Human class.""" <|body_0|> def display(self): """Display method to print the different characterist...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Human: """Human class. Args: age (int): Age of the human. sex (str): Sex of the human.""" def __init__(self, age, sex, habitat, food, fur=False): """Constructor of Human class.""" Animal.__init__(self, habitat) Mammal.__init__(self, food, fur) self.age = age self.s...
the_stack_v2_python_sparse
sem-3/practical_26_Nov.py
B-Tech-AI-Python/Class-assignments
train
0
89d62bb864bebe3b231123be90f670189b4baa12
[ "m_arit = ArithmeticUtil.arithmetic_mean(dat)\nn = ArithmeticUtil.number_of_elements(dat)\nreturn np.math.fsum((dat - m_arit) ** 2) / (n - 1)", "m_arit = ArithmeticUtil.arithmetic_mean(dat)\nn = ArithmeticUtil.number_of_elements(dat)\nreturn np.math.sqrt(np.math.fsum((dat - m_arit) ** 2) / (n - 1))", "m_arit = ...
<|body_start_0|> m_arit = ArithmeticUtil.arithmetic_mean(dat) n = ArithmeticUtil.number_of_elements(dat) return np.math.fsum((dat - m_arit) ** 2) / (n - 1) <|end_body_0|> <|body_start_1|> m_arit = ArithmeticUtil.arithmetic_mean(dat) n = ArithmeticUtil.number_of_elements(dat) ...
ModuleStatisticsManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleStatisticsManager: def module_variance(self, dat): """TEST SMALL ERROR""" <|body_0|> def module_standard_deviation(self, dat): """TEST SMALL ERROR""" <|body_1|> def module_population_variance(self, dat): """TEST SMALL ERROR""" <|bod...
stack_v2_sparse_classes_36k_train_011338
1,949
no_license
[ { "docstring": "TEST SMALL ERROR", "name": "module_variance", "signature": "def module_variance(self, dat)" }, { "docstring": "TEST SMALL ERROR", "name": "module_standard_deviation", "signature": "def module_standard_deviation(self, dat)" }, { "docstring": "TEST SMALL ERROR", ...
6
stack_v2_sparse_classes_30k_train_021155
Implement the Python class `ModuleStatisticsManager` described below. Class description: Implement the ModuleStatisticsManager class. Method signatures and docstrings: - def module_variance(self, dat): TEST SMALL ERROR - def module_standard_deviation(self, dat): TEST SMALL ERROR - def module_population_variance(self,...
Implement the Python class `ModuleStatisticsManager` described below. Class description: Implement the ModuleStatisticsManager class. Method signatures and docstrings: - def module_variance(self, dat): TEST SMALL ERROR - def module_standard_deviation(self, dat): TEST SMALL ERROR - def module_population_variance(self,...
59c327a0ef80740e1c6967729d9472aac2afd1b5
<|skeleton|> class ModuleStatisticsManager: def module_variance(self, dat): """TEST SMALL ERROR""" <|body_0|> def module_standard_deviation(self, dat): """TEST SMALL ERROR""" <|body_1|> def module_population_variance(self, dat): """TEST SMALL ERROR""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModuleStatisticsManager: def module_variance(self, dat): """TEST SMALL ERROR""" m_arit = ArithmeticUtil.arithmetic_mean(dat) n = ArithmeticUtil.number_of_elements(dat) return np.math.fsum((dat - m_arit) ** 2) / (n - 1) def module_standard_deviation(self, dat): """T...
the_stack_v2_python_sparse
VecStatsGraph/manager/ModuleStatisticsManager.py
IvanDragoJr/VecStatsGraph3d
train
0
415b2a62f03336d840b79820e5dc8608762fefc1
[ "super().__init__()\nself.embedder = embedder\nself.output_layer = output_layer\nself.drop = nn.Dropout(dropout)", "outputs = self.embedder(data)\nif isinstance(outputs, tuple):\n encoding = outputs[0]\nelse:\n encoding = outputs\npred = self.output_layer(self.drop(encoding))\nreturn (pred, target) if targe...
<|body_start_0|> super().__init__() self.embedder = embedder self.output_layer = output_layer self.drop = nn.Dropout(dropout) <|end_body_0|> <|body_start_1|> outputs = self.embedder(data) if isinstance(outputs, tuple): encoding = outputs[0] else: ...
Implements a standard classifier. The classifier is composed of an encoder module, followed by a fully connected output layer, with a dropout layer in between. Attributes ---------- embedder: Embedder The embedder layer output_layer : Module The output layer, yields a probability distribution over targets drop: nn.Drop...
TextClassifier
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextClassifier: """Implements a standard classifier. The classifier is composed of an encoder module, followed by a fully connected output layer, with a dropout layer in between. Attributes ---------- embedder: Embedder The embedder layer output_layer : Module The output layer, yields a probabili...
stack_v2_sparse_classes_36k_train_011339
2,138
permissive
[ { "docstring": "Initialize the TextClassifier model. Parameters ---------- embedder: Embedder The embedder layer output_layer : Module The output layer, yields a probability distribution dropout : float, optional Amount of dropout to include between layers (defaults to 0)", "name": "__init__", "signatur...
2
stack_v2_sparse_classes_30k_val_000586
Implement the Python class `TextClassifier` described below. Class description: Implements a standard classifier. The classifier is composed of an encoder module, followed by a fully connected output layer, with a dropout layer in between. Attributes ---------- embedder: Embedder The embedder layer output_layer : Modu...
Implement the Python class `TextClassifier` described below. Class description: Implements a standard classifier. The classifier is composed of an encoder module, followed by a fully connected output layer, with a dropout layer in between. Attributes ---------- embedder: Embedder The embedder layer output_layer : Modu...
0dc2f5b2b286694defe8abf450fe5be9ae12c097
<|skeleton|> class TextClassifier: """Implements a standard classifier. The classifier is composed of an encoder module, followed by a fully connected output layer, with a dropout layer in between. Attributes ---------- embedder: Embedder The embedder layer output_layer : Module The output layer, yields a probabili...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextClassifier: """Implements a standard classifier. The classifier is composed of an encoder module, followed by a fully connected output layer, with a dropout layer in between. Attributes ---------- embedder: Embedder The embedder layer output_layer : Module The output layer, yields a probability distributi...
the_stack_v2_python_sparse
flambe/nlp/classification/model.py
cle-ros/flambe
train
1
b81e79a69d51c92a95221f4c12bc04e93dfa55b8
[ "if not root:\n return None\nres = []\nl = [root, '*']\nwhile l:\n ll = []\n for n in l:\n if n == '*':\n res.append('*')\n else:\n res.append(str(n.val))\n for nn in n.children:\n ll.append(nn)\n ll.append('*')\n l = ll\nreturn ',...
<|body_start_0|> if not root: return None res = [] l = [root, '*'] while l: ll = [] for n in l: if n == '*': res.append('*') else: res.append(str(n.val)) for nn...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_011340
1,548
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def deserialize(self, ...
2
null
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: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
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: Node :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod...
36d7f9e967a62db77622e0888f61999d7f37579a
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: Node :rtype: str""" if not root: return None res = [] l = [root, '*'] while l: ll = [] for n in l: if n == '*': re...
the_stack_v2_python_sparse
apple/P0428_apple.py
westgate458/LeetCode
train
0
fdfd7dc52761826c35d4c8da97ca1ea76aed43aa
[ "query = self.table.query(g.db_session)\nadditional_modifiers = None\nif id is not None:\n additional_modifiers = add_filter(additional_modifiers, RPMComment.id == id)\nif username is not None:\n additional_modifiers = add_filter(additional_modifiers, User.name == username)\nif id_comp is not None:\n addit...
<|body_start_0|> query = self.table.query(g.db_session) additional_modifiers = None if id is not None: additional_modifiers = add_filter(additional_modifiers, RPMComment.id == id) if username is not None: additional_modifiers = add_filter(additional_modifiers, Use...
List of rpm comments.
RPMCommentsList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RPMCommentsList: """List of rpm comments.""" def get(self, id=None, username=None, id_comp=None, id_diff=None): """Get list. :param int id: id to optionally filter by :return list: list of the resulting query""" <|body_0|> def post(self): """Add new comment.""" ...
stack_v2_sparse_classes_36k_train_011341
22,524
permissive
[ { "docstring": "Get list. :param int id: id to optionally filter by :return list: list of the resulting query", "name": "get", "signature": "def get(self, id=None, username=None, id_comp=None, id_diff=None)" }, { "docstring": "Add new comment.", "name": "post", "signature": "def post(sel...
2
stack_v2_sparse_classes_30k_train_018312
Implement the Python class `RPMCommentsList` described below. Class description: List of rpm comments. Method signatures and docstrings: - def get(self, id=None, username=None, id_comp=None, id_diff=None): Get list. :param int id: id to optionally filter by :return list: list of the resulting query - def post(self): ...
Implement the Python class `RPMCommentsList` described below. Class description: List of rpm comments. Method signatures and docstrings: - def get(self, id=None, username=None, id_comp=None, id_diff=None): Get list. :param int id: id to optionally filter by :return list: list of the resulting query - def post(self): ...
06f2ef0bb232b1ffe46e9d50575c4b79b1cff191
<|skeleton|> class RPMCommentsList: """List of rpm comments.""" def get(self, id=None, username=None, id_comp=None, id_diff=None): """Get list. :param int id: id to optionally filter by :return list: list of the resulting query""" <|body_0|> def post(self): """Add new comment.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RPMCommentsList: """List of rpm comments.""" def get(self, id=None, username=None, id_comp=None, id_diff=None): """Get list. :param int id: id to optionally filter by :return list: list of the resulting query""" query = self.table.query(g.db_session) additional_modifiers = None ...
the_stack_v2_python_sparse
archdiffer/plugins/rpmdiff/flask_frontend/bp.py
pkratoch/archdiffer
train
0
36a0f05f217afe060d51c293981652bf44e86ff1
[ "os.umask(0)\nif config is None:\n config = {}\nself.config: Dict[str, str] = config\nself.sessions: Dict[int, Session] = {}\nself.service_errors: List[str] = []\nself.load_services()\nself.service_manager: ConfigServiceManager = ConfigServiceManager()\nconfig_services_path = os.path.abspath(os.path.dirname(conf...
<|body_start_0|> os.umask(0) if config is None: config = {} self.config: Dict[str, str] = config self.sessions: Dict[int, Session] = {} self.service_errors: List[str] = [] self.load_services() self.service_manager: ConfigServiceManager = ConfigServiceM...
Provides logic for creating and configuring CORE sessions and the nodes within them.
CoreEmu
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoreEmu: """Provides logic for creating and configuring CORE sessions and the nodes within them.""" def __init__(self, config: Dict[str, str]=None) -> None: """Create a CoreEmu object. :param config: configuration options""" <|body_0|> def _validate_env(self) -> None: ...
stack_v2_sparse_classes_36k_train_011342
4,589
permissive
[ { "docstring": "Create a CoreEmu object. :param config: configuration options", "name": "__init__", "signature": "def __init__(self, config: Dict[str, str]=None) -> None" }, { "docstring": "Validates executables CORE depends on exist on path. :return: nothing :raises core.errors.CoreError: when ...
6
stack_v2_sparse_classes_30k_train_010432
Implement the Python class `CoreEmu` described below. Class description: Provides logic for creating and configuring CORE sessions and the nodes within them. Method signatures and docstrings: - def __init__(self, config: Dict[str, str]=None) -> None: Create a CoreEmu object. :param config: configuration options - def...
Implement the Python class `CoreEmu` described below. Class description: Provides logic for creating and configuring CORE sessions and the nodes within them. Method signatures and docstrings: - def __init__(self, config: Dict[str, str]=None) -> None: Create a CoreEmu object. :param config: configuration options - def...
87ca431e73fec22faeaebd6b25fc76e0b165c639
<|skeleton|> class CoreEmu: """Provides logic for creating and configuring CORE sessions and the nodes within them.""" def __init__(self, config: Dict[str, str]=None) -> None: """Create a CoreEmu object. :param config: configuration options""" <|body_0|> def _validate_env(self) -> None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoreEmu: """Provides logic for creating and configuring CORE sessions and the nodes within them.""" def __init__(self, config: Dict[str, str]=None) -> None: """Create a CoreEmu object. :param config: configuration options""" os.umask(0) if config is None: config = {} ...
the_stack_v2_python_sparse
daemon/core/emulator/coreemu.py
kleberango/core
train
0
e0fe56975cc73becdc5b8364b51699dd7c60ce9c
[ "if self.request.user.is_superuser:\n return models.Workflow.objects.all()\nreturn models.Workflow.objects.filter(Q(user=self.request.user) | Q(shared=self.request.user)).distinct()", "if self.request.user.is_superuser:\n serializer.save()\nelse:\n serializer.save(user=self.request.user)" ]
<|body_start_0|> if self.request.user.is_superuser: return models.Workflow.objects.all() return models.Workflow.objects.filter(Q(user=self.request.user) | Q(shared=self.request.user)).distinct() <|end_body_0|> <|body_start_1|> if self.request.user.is_superuser: serialize...
Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes
WorkflowAPIListCreate
[ "LGPL-2.0-or-later", "BSD-3-Clause", "MIT", "Apache-2.0", "LGPL-2.1-only", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowAPIListCreate: """Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes""" def get_queryset(self): """Access the required workflow.""" <|body_0|> def perform_create(self, serializer): ...
stack_v2_sparse_classes_36k_train_011343
4,435
permissive
[ { "docstring": "Access the required workflow.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Create the new workflow.", "name": "perform_create", "signature": "def perform_create(self, serializer)" } ]
2
stack_v2_sparse_classes_30k_val_000031
Implement the Python class `WorkflowAPIListCreate` described below. Class description: Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes Method signatures and docstrings: - def get_queryset(self): Access the required workflow. - def perfo...
Implement the Python class `WorkflowAPIListCreate` described below. Class description: Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes Method signatures and docstrings: - def get_queryset(self): Access the required workflow. - def perfo...
c432745dfff932cbe7397100422d49df78f0a882
<|skeleton|> class WorkflowAPIListCreate: """Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes""" def get_queryset(self): """Access the required workflow.""" <|body_0|> def perform_create(self, serializer): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkflowAPIListCreate: """Access the workflow. get: Return a list of available workflows post: Create a new workflow given name, description and attributes""" def get_queryset(self): """Access the required workflow.""" if self.request.user.is_superuser: return models.Workflow....
the_stack_v2_python_sparse
ontask/workflow/api.py
abelardopardo/ontask_b
train
43
7f2ea98b2ea076c5bb3095e170b2be7a3a708d90
[ "self.N_PIX = N_PIX\nself.create_zernike_matrix(N_levels=N_levels)\nself.create_least_squares_matrix()\nself.aberrations = ['Obliq. Astig.', 'Defocus', 'Horiz. Astig.', 'Obliq. Trefoil', 'Horiz. Coma', 'Vert. Coma', 'Horiz. Trefoil', 'Obliq. Quadref.', '2nd Obliq. Coma', 'Spherical', '2nd Horiz. Coma', 'Horiz. Quad...
<|body_start_0|> self.N_PIX = N_PIX self.create_zernike_matrix(N_levels=N_levels) self.create_least_squares_matrix() self.aberrations = ['Obliq. Astig.', 'Defocus', 'Horiz. Astig.', 'Obliq. Trefoil', 'Horiz. Coma', 'Vert. Coma', 'Horiz. Trefoil', 'Obliq. Quadref.', '2nd Obliq. Coma', 'Sp...
Object in charge of receiving some wavefront maps and fitting them to Zernike polynomials (1 - 3) Piston, Tilts (4) Oblique Astigmatism (5) Defocus (6) Horizontal Astigmatism (7) Oblique Trefoil (8) Horizontal Coma (9) Vertical Coma (10) Horizontal Trefoil (11) Oblique Quadrefoil
ZernikeFit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZernikeFit: """Object in charge of receiving some wavefront maps and fitting them to Zernike polynomials (1 - 3) Piston, Tilts (4) Oblique Astigmatism (5) Defocus (6) Horizontal Astigmatism (7) Oblique Trefoil (8) Horizontal Coma (9) Vertical Coma (10) Horizontal Trefoil (11) Oblique Quadrefoil""...
stack_v2_sparse_classes_36k_train_011344
17,758
no_license
[ { "docstring": ":param N_PIX: Number of pixels in the wavefront maps :param N_levels: How many Zernike radial levels to consider", "name": "__init__", "signature": "def __init__(self, N_PIX, N_levels)" }, { "docstring": "Initialize a Zernike matrix containing the Zernike polynomials up to radial...
4
stack_v2_sparse_classes_30k_train_000855
Implement the Python class `ZernikeFit` described below. Class description: Object in charge of receiving some wavefront maps and fitting them to Zernike polynomials (1 - 3) Piston, Tilts (4) Oblique Astigmatism (5) Defocus (6) Horizontal Astigmatism (7) Oblique Trefoil (8) Horizontal Coma (9) Vertical Coma (10) Horiz...
Implement the Python class `ZernikeFit` described below. Class description: Object in charge of receiving some wavefront maps and fitting them to Zernike polynomials (1 - 3) Piston, Tilts (4) Oblique Astigmatism (5) Defocus (6) Horizontal Astigmatism (7) Oblique Trefoil (8) Horizontal Coma (9) Vertical Coma (10) Horiz...
7eb3fdbf2e648f215ebb9054014602424131f295
<|skeleton|> class ZernikeFit: """Object in charge of receiving some wavefront maps and fitting them to Zernike polynomials (1 - 3) Piston, Tilts (4) Oblique Astigmatism (5) Defocus (6) Horizontal Astigmatism (7) Oblique Trefoil (8) Horizontal Coma (9) Vertical Coma (10) Horizontal Trefoil (11) Oblique Quadrefoil""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZernikeFit: """Object in charge of receiving some wavefront maps and fitting them to Zernike polynomials (1 - 3) Piston, Tilts (4) Oblique Astigmatism (5) Defocus (6) Horizontal Astigmatism (7) Oblique Trefoil (8) Horizontal Coma (9) Vertical Coma (10) Horizontal Trefoil (11) Oblique Quadrefoil""" def __...
the_stack_v2_python_sparse
old bits/e2e_wavefronts.py
AlvaroMenduina/E2E
train
0
1e611737a52ac21b9885d3d4a26c8c3de1a43cd7
[ "global _SESSIONS\nif not _SESSIONS:\n from evennia.server.sessionhandler import SESSIONS as _SESSIONS\nif irc_botname:\n self.db.irc_botname = irc_botname\nelif not self.db.irc_botname:\n self.db.irc_botname = self.key\nif ev_channel:\n channel = search.channel_search(ev_channel)\n if not channel:\n...
<|body_start_0|> global _SESSIONS if not _SESSIONS: from evennia.server.sessionhandler import SESSIONS as _SESSIONS if irc_botname: self.db.irc_botname = irc_botname elif not self.db.irc_botname: self.db.irc_botname = self.key if ev_channel: ...
Bot for handling IRC connections.
IRCBot
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IRCBot: """Bot for handling IRC connections.""" def start(self, ev_channel=None, irc_botname=None, irc_channel=None, irc_network=None, irc_port=None, irc_ssl=None): """Start by telling the portal to start a new session. Args: ev_channel (str): Key of the Evennia channel to connect to...
stack_v2_sparse_classes_36k_train_011345
13,744
permissive
[ { "docstring": "Start by telling the portal to start a new session. Args: ev_channel (str): Key of the Evennia channel to connect to. irc_botname (str): Name of bot to connect to irc channel. If not set, use `self.key`. irc_channel (str): Name of channel on the form `#channelname`. irc_network (str): URL of the...
3
stack_v2_sparse_classes_30k_train_005504
Implement the Python class `IRCBot` described below. Class description: Bot for handling IRC connections. Method signatures and docstrings: - def start(self, ev_channel=None, irc_botname=None, irc_channel=None, irc_network=None, irc_port=None, irc_ssl=None): Start by telling the portal to start a new session. Args: e...
Implement the Python class `IRCBot` described below. Class description: Bot for handling IRC connections. Method signatures and docstrings: - def start(self, ev_channel=None, irc_botname=None, irc_channel=None, irc_network=None, irc_port=None, irc_ssl=None): Start by telling the portal to start a new session. Args: e...
384d08f9d877c7ad758292822e6f04292fdad047
<|skeleton|> class IRCBot: """Bot for handling IRC connections.""" def start(self, ev_channel=None, irc_botname=None, irc_channel=None, irc_network=None, irc_port=None, irc_ssl=None): """Start by telling the portal to start a new session. Args: ev_channel (str): Key of the Evennia channel to connect to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IRCBot: """Bot for handling IRC connections.""" def start(self, ev_channel=None, irc_botname=None, irc_channel=None, irc_network=None, irc_port=None, irc_ssl=None): """Start by telling the portal to start a new session. Args: ev_channel (str): Key of the Evennia channel to connect to. irc_botname...
the_stack_v2_python_sparse
evennia/players/bots.py
robbintt/evennia
train
1
dd9a7deeea03078ef9e1cc69ab4574de8bedf06d
[ "ctx.save_for_backward(x, w, b)\ny = x.mm(w) + b.T\nreturn y", "x, w, b = ctx.saved_tensors\ndzdx = dz_dy.mm(w.T)\ndzdw = x.T.mm(dz_dy)\nsize_m = dz_dy.size(0)\ndydb = torch.ones((1, size_m))\ndzdb = dydb.mm(dz_dy.float())\nreturn (dzdx, dzdw, dzdb)" ]
<|body_start_0|> ctx.save_for_backward(x, w, b) y = x.mm(w) + b.T return y <|end_body_0|> <|body_start_1|> x, w, b = ctx.saved_tensors dzdx = dz_dy.mm(w.T) dzdw = x.T.mm(dz_dy) size_m = dz_dy.size(0) dydb = torch.ones((1, size_m)) dzdb = dydb.mm(d...
FullyConnected
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FullyConnected: def forward(ctx, x, w, b): """Computes the output of the fully_connected function given in the assignment Arguments --------- ctx: a PyTorch context object x (Tensor): of size (T x n), the input features w (Tensor): of size (n x m), the weights b (Tensor): of size (m), th...
stack_v2_sparse_classes_36k_train_011346
1,416
no_license
[ { "docstring": "Computes the output of the fully_connected function given in the assignment Arguments --------- ctx: a PyTorch context object x (Tensor): of size (T x n), the input features w (Tensor): of size (n x m), the weights b (Tensor): of size (m), the biases Returns ----- y (Tensor): of size (T x m), th...
2
stack_v2_sparse_classes_30k_val_000920
Implement the Python class `FullyConnected` described below. Class description: Implement the FullyConnected class. Method signatures and docstrings: - def forward(ctx, x, w, b): Computes the output of the fully_connected function given in the assignment Arguments --------- ctx: a PyTorch context object x (Tensor): o...
Implement the Python class `FullyConnected` described below. Class description: Implement the FullyConnected class. Method signatures and docstrings: - def forward(ctx, x, w, b): Computes the output of the fully_connected function given in the assignment Arguments --------- ctx: a PyTorch context object x (Tensor): o...
07703e76f49d9be86b39d7c2af1ee1e0efe07031
<|skeleton|> class FullyConnected: def forward(ctx, x, w, b): """Computes the output of the fully_connected function given in the assignment Arguments --------- ctx: a PyTorch context object x (Tensor): of size (T x n), the input features w (Tensor): of size (n x m), the weights b (Tensor): of size (m), th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FullyConnected: def forward(ctx, x, w, b): """Computes the output of the fully_connected function given in the assignment Arguments --------- ctx: a PyTorch context object x (Tensor): of size (T x n), the input features w (Tensor): of size (n x m), the weights b (Tensor): of size (m), the biases Retur...
the_stack_v2_python_sparse
DL_HW/Jialing_Wu_HW1/fully_connected.py
muzhiBryn/ML_DL_at-Dartmouth
train
0
48fc8d2094aca0fb68753a3f46488d3f72a486d2
[ "res = []\nsetNums = set(nums)\nfor i in range(1, len(nums) + 1):\n if i not in setNums:\n res.append(i)\nreturn res", "for i in xrange(len(nums)):\n index = abs(nums[i]) - 1\n nums[index] = -abs(nums[index])\nres = [i + 1 for i, x in enumerate(nums) if x > 0]\nreturn res", "ret = []\nnums = [0]...
<|body_start_0|> res = [] setNums = set(nums) for i in range(1, len(nums) + 1): if i not in setNums: res.append(i) return res <|end_body_0|> <|body_start_1|> for i in xrange(len(nums)): index = abs(nums[i]) - 1 nums[index] = -a...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDisappearedNumbers2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> def findDisappearedNumbers3(self, nums): ...
stack_v2_sparse_classes_36k_train_011347
1,369
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDisappearedNumbers", "signature": "def findDisappearedNumbers(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "findDisappearedNumbers2", "signature": "def findDisappearedNumbers2(self...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int] - def findDisappearedNumbers2(self, nums): :type nums: List[int] :rtype: List[int] - def findDisap...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDisappearedNumbers(self, nums): :type nums: List[int] :rtype: List[int] - def findDisappearedNumbers2(self, nums): :type nums: List[int] :rtype: List[int] - def findDisap...
b925bb22d1daa4a56c5a238a5758a926905559b4
<|skeleton|> class Solution: def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def findDisappearedNumbers2(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> def findDisappearedNumbers3(self, nums): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDisappearedNumbers(self, nums): """:type nums: List[int] :rtype: List[int]""" res = [] setNums = set(nums) for i in range(1, len(nums) + 1): if i not in setNums: res.append(i) return res def findDisappearedNumbers2(self...
the_stack_v2_python_sparse
448. Find All Numbers Disappeared in an Array.py
beninghton/notGivenUpToG
train
0
ed009c01180f071657fb1680dff2aaf765af10d5
[ "super(MultiHeadedAttention, self).__init__()\nassert d_model % h == 0\nself.d_k = d_model // h\nself.h = h\nself.linears = clones(nn.Linear(d_model, d_model), 4)\nself.attn = None\nself.dropout = nn.Dropout(p=dropout)", "d_k = query.size(-1)\nscores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(d_k)\n...
<|body_start_0|> super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_model), 4) self.attn = None self.dropout = nn.Dropout(p=dropout) <|end_body_0|> <|body_start_1|> ...
MultiHeadedAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def attention(self, query, key, value, mask=None, dropout=None): """Compute 'Scaled Dot Product Attention'""" <|body_1|> def forwa...
stack_v2_sparse_classes_36k_train_011348
14,213
no_license
[ { "docstring": "Take in model size and number of heads.", "name": "__init__", "signature": "def __init__(self, h, d_model, dropout=0.1)" }, { "docstring": "Compute 'Scaled Dot Product Attention'", "name": "attention", "signature": "def attention(self, query, key, value, mask=None, dropou...
3
stack_v2_sparse_classes_30k_train_017730
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def attention(self, query, key, value, mask=None, dropout=None): Co...
Implement the Python class `MultiHeadedAttention` described below. Class description: Implement the MultiHeadedAttention class. Method signatures and docstrings: - def __init__(self, h, d_model, dropout=0.1): Take in model size and number of heads. - def attention(self, query, key, value, mask=None, dropout=None): Co...
7c389dd416c67f382c9a5d3e1661a5bd89aecc47
<|skeleton|> class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" <|body_0|> def attention(self, query, key, value, mask=None, dropout=None): """Compute 'Scaled Dot Product Attention'""" <|body_1|> def forwa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiHeadedAttention: def __init__(self, h, d_model, dropout=0.1): """Take in model size and number of heads.""" super(MultiHeadedAttention, self).__init__() assert d_model % h == 0 self.d_k = d_model // h self.h = h self.linears = clones(nn.Linear(d_model, d_mo...
the_stack_v2_python_sparse
models/AttModel.py
Shiyang-Yan/ParaCNN
train
2
f92f8b236bcd75998b1dae4c067488c894c72664
[ "def climb(n: int):\n if n <= 3:\n return n\n else:\n return climb(n - 1) + climb(n - 2)\nreturn climb(n)", "if len(self.steps) < n:\n for i in range(n):\n if i <= 2:\n if len(self.steps) <= i:\n self.steps.append(i + 1)\n elif len(self.steps) <= i:\n...
<|body_start_0|> def climb(n: int): if n <= 3: return n else: return climb(n - 1) + climb(n - 2) return climb(n) <|end_body_0|> <|body_start_1|> if len(self.steps) < n: for i in range(n): if i <= 2: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def climbStairs(self, n: int) -> int: """n = 38 超时""" <|body_0|> def climbStairs1(self, n: int) -> int: """执行用时 : 76 ms, 在Climbing Stairs的Python3提交中击败了17.58% 的用户 内存消耗 : 13 MB, 在Climbing Stairs的Python3提交中击败了97.24% 的用户""" <|body_1|> def climbStai...
stack_v2_sparse_classes_36k_train_011349
2,752
no_license
[ { "docstring": "n = 38 超时", "name": "climbStairs", "signature": "def climbStairs(self, n: int) -> int" }, { "docstring": "执行用时 : 76 ms, 在Climbing Stairs的Python3提交中击败了17.58% 的用户 内存消耗 : 13 MB, 在Climbing Stairs的Python3提交中击败了97.24% 的用户", "name": "climbStairs1", "signature": "def climbStairs1...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n: int) -> int: n = 38 超时 - def climbStairs1(self, n: int) -> int: 执行用时 : 76 ms, 在Climbing Stairs的Python3提交中击败了17.58% 的用户 内存消耗 : 13 MB, 在Climbing Stairs的Pyt...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def climbStairs(self, n: int) -> int: n = 38 超时 - def climbStairs1(self, n: int) -> int: 执行用时 : 76 ms, 在Climbing Stairs的Python3提交中击败了17.58% 的用户 内存消耗 : 13 MB, 在Climbing Stairs的Pyt...
7bca9dc8ec211be15c12f89bffbb680d639f87bf
<|skeleton|> class Solution: def climbStairs(self, n: int) -> int: """n = 38 超时""" <|body_0|> def climbStairs1(self, n: int) -> int: """执行用时 : 76 ms, 在Climbing Stairs的Python3提交中击败了17.58% 的用户 内存消耗 : 13 MB, 在Climbing Stairs的Python3提交中击败了97.24% 的用户""" <|body_1|> def climbStai...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def climbStairs(self, n: int) -> int: """n = 38 超时""" def climb(n: int): if n <= 3: return n else: return climb(n - 1) + climb(n - 2) return climb(n) def climbStairs1(self, n: int) -> int: """执行用时 : 76 ms, 在...
the_stack_v2_python_sparse
python/leetcode/70-climbing-stairs.py
wxnacy/study
train
18
0c0f4716c28d4b5cd1c39c7e0b96df0a9a0bef43
[ "strings = tf.string_split([string_line], delimiter=' ').values\nimage_path = tf.string_join([root_path, strings[0]], separator=os.sep)\nlabels = tf.string_to_number(strings[1:], out_type=tf.float32)\nreturn (image_path, labels)", "image = tf.read_file(image_path)\nimage = tf.image.decode_jpeg(image)\nsrc_size_hw...
<|body_start_0|> strings = tf.string_split([string_line], delimiter=' ').values image_path = tf.string_join([root_path, strings[0]], separator=os.sep) labels = tf.string_to_number(strings[1:], out_type=tf.float32) return (image_path, labels) <|end_body_0|> <|body_start_1|> image...
从标签文件中,构造返回(image, label)的tf.data.Dataset数据集 标签文件内容如下: image_name label0,label1,label2,...
FileUtil
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileUtil: """从标签文件中,构造返回(image, label)的tf.data.Dataset数据集 标签文件内容如下: image_name label0,label1,label2,...""" def _parse_string_line(string_line, root_path): """解析文本中的一行字符串行,得到图片路径(拼接图片根目录)和标签 :param string_line: 文本中的一行字符串,image_name label0 label1 label2 label3 ... :param root_path: 图片根...
stack_v2_sparse_classes_36k_train_011350
7,637
permissive
[ { "docstring": "解析文本中的一行字符串行,得到图片路径(拼接图片根目录)和标签 :param string_line: 文本中的一行字符串,image_name label0 label1 label2 label3 ... :param root_path: 图片根目录 :return: DatasetV1Adapter<(图片路径Tensor(shape=(), dtype=string),标签Tensor(shape=(?,), dtype=float32))>", "name": "_parse_string_line", "signature": "def _parse_st...
3
stack_v2_sparse_classes_30k_train_010075
Implement the Python class `FileUtil` described below. Class description: 从标签文件中,构造返回(image, label)的tf.data.Dataset数据集 标签文件内容如下: image_name label0,label1,label2,... Method signatures and docstrings: - def _parse_string_line(string_line, root_path): 解析文本中的一行字符串行,得到图片路径(拼接图片根目录)和标签 :param string_line: 文本中的一行字符串,image_n...
Implement the Python class `FileUtil` described below. Class description: 从标签文件中,构造返回(image, label)的tf.data.Dataset数据集 标签文件内容如下: image_name label0,label1,label2,... Method signatures and docstrings: - def _parse_string_line(string_line, root_path): 解析文本中的一行字符串行,得到图片路径(拼接图片根目录)和标签 :param string_line: 文本中的一行字符串,image_n...
8f2d722e4067aef0c8a9cc29f76d958c0f97fb9f
<|skeleton|> class FileUtil: """从标签文件中,构造返回(image, label)的tf.data.Dataset数据集 标签文件内容如下: image_name label0,label1,label2,...""" def _parse_string_line(string_line, root_path): """解析文本中的一行字符串行,得到图片路径(拼接图片根目录)和标签 :param string_line: 文本中的一行字符串,image_name label0 label1 label2 label3 ... :param root_path: 图片根...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileUtil: """从标签文件中,构造返回(image, label)的tf.data.Dataset数据集 标签文件内容如下: image_name label0,label1,label2,...""" def _parse_string_line(string_line, root_path): """解析文本中的一行字符串行,得到图片路径(拼接图片根目录)和标签 :param string_line: 文本中的一行字符串,image_name label0 label1 label2 label3 ... :param root_path: 图片根目录 :return: D...
the_stack_v2_python_sparse
dataset/file_util.py
zheng-yuwei/YOLOv3-tensorflow
train
5
700b9dfcf44c2bf2aa43cdad2a3fb54f4b8c4bff
[ "super().__init__(self.PROBLEM_NAME)\nself.input_list = input_list\nself.min_value = min_value\nself.max_value = max_value", "print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nif len(self.input_list) == 0:\n return range(0, self.max_value + 1)\nrange_list = []\nfor i in range(len(self.input_list)):\n ...
<|body_start_0|> super().__init__(self.PROBLEM_NAME) self.input_list = input_list self.min_value = min_value self.max_value = max_value <|end_body_0|> <|body_start_1|> print('Solving {} problem ...'.format(self.PROBLEM_NAME)) if len(self.input_list) == 0: ret...
MissingRanges
MissingRanges
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MissingRanges: """MissingRanges""" def __init__(self, input_list, min_value, max_value): """Missing Ranges Args: input_list: Contains a list of integers Returns: None Raises: None""" <|body_0|> def solve(self): """Solve the problem Note: O(n) (runtime) and O(1) (...
stack_v2_sparse_classes_36k_train_011351
3,054
no_license
[ { "docstring": "Missing Ranges Args: input_list: Contains a list of integers Returns: None Raises: None", "name": "__init__", "signature": "def __init__(self, input_list, min_value, max_value)" }, { "docstring": "Solve the problem Note: O(n) (runtime) and O(1) (space) works by iterating the inpu...
2
stack_v2_sparse_classes_30k_train_020996
Implement the Python class `MissingRanges` described below. Class description: MissingRanges Method signatures and docstrings: - def __init__(self, input_list, min_value, max_value): Missing Ranges Args: input_list: Contains a list of integers Returns: None Raises: None - def solve(self): Solve the problem Note: O(n)...
Implement the Python class `MissingRanges` described below. Class description: MissingRanges Method signatures and docstrings: - def __init__(self, input_list, min_value, max_value): Missing Ranges Args: input_list: Contains a list of integers Returns: None Raises: None - def solve(self): Solve the problem Note: O(n)...
11f4d25cb211740514c119a60962d075a0817abd
<|skeleton|> class MissingRanges: """MissingRanges""" def __init__(self, input_list, min_value, max_value): """Missing Ranges Args: input_list: Contains a list of integers Returns: None Raises: None""" <|body_0|> def solve(self): """Solve the problem Note: O(n) (runtime) and O(1) (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MissingRanges: """MissingRanges""" def __init__(self, input_list, min_value, max_value): """Missing Ranges Args: input_list: Contains a list of integers Returns: None Raises: None""" super().__init__(self.PROBLEM_NAME) self.input_list = input_list self.min_value = min_valu...
the_stack_v2_python_sparse
python/problems/array/missing_ranges.py
santhosh-kumar/AlgorithmsAndDataStructures
train
2
4013a6981598931ed2e189781fd80d2e6351ce9c
[ "agg = {'sum': 0, 'avg': 1, 'max': 2}\nB, N, M, out_dim = point_features.size()\n_, npoint, K, _ = scores.size()\noutput = point_features.new_zeros((B, out_dim, npoint, K))\next_module.assign_score_withk_forward(point_features.contiguous(), center_features.contiguous(), scores.contiguous(), knn_idx.contiguous(), ou...
<|body_start_0|> agg = {'sum': 0, 'avg': 1, 'max': 2} B, N, M, out_dim = point_features.size() _, npoint, K, _ = scores.size() output = point_features.new_zeros((B, out_dim, npoint, K)) ext_module.assign_score_withk_forward(point_features.contiguous(), center_features.contiguous(...
Perform weighted sum to generate output features according to scores. Modified from `PAConv <https://github.com/CVMI-Lab/PAConv/tree/main/ scene_seg/lib/paconv_lib/src/gpu>`_. This is a memory-efficient CUDA implementation of assign_scores operation, which first transform all point features with weight bank, then assem...
AssignScoreWithK
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssignScoreWithK: """Perform weighted sum to generate output features according to scores. Modified from `PAConv <https://github.com/CVMI-Lab/PAConv/tree/main/ scene_seg/lib/paconv_lib/src/gpu>`_. This is a memory-efficient CUDA implementation of assign_scores operation, which first transform all...
stack_v2_sparse_classes_36k_train_011352
4,761
permissive
[ { "docstring": "Args: scores (torch.Tensor): (B, npoint, K, M), predicted scores to aggregate weight matrices in the weight bank. ``npoint`` is the number of sampled centers. ``K`` is the number of queried neighbors. ``M`` is the number of weight matrices in the weight bank. point_features (torch.Tensor): (B, N...
2
null
Implement the Python class `AssignScoreWithK` described below. Class description: Perform weighted sum to generate output features according to scores. Modified from `PAConv <https://github.com/CVMI-Lab/PAConv/tree/main/ scene_seg/lib/paconv_lib/src/gpu>`_. This is a memory-efficient CUDA implementation of assign_scor...
Implement the Python class `AssignScoreWithK` described below. Class description: Perform weighted sum to generate output features according to scores. Modified from `PAConv <https://github.com/CVMI-Lab/PAConv/tree/main/ scene_seg/lib/paconv_lib/src/gpu>`_. This is a memory-efficient CUDA implementation of assign_scor...
6e9ee26718b22961d5c34caca4108413b1b7b3af
<|skeleton|> class AssignScoreWithK: """Perform weighted sum to generate output features according to scores. Modified from `PAConv <https://github.com/CVMI-Lab/PAConv/tree/main/ scene_seg/lib/paconv_lib/src/gpu>`_. This is a memory-efficient CUDA implementation of assign_scores operation, which first transform all...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AssignScoreWithK: """Perform weighted sum to generate output features according to scores. Modified from `PAConv <https://github.com/CVMI-Lab/PAConv/tree/main/ scene_seg/lib/paconv_lib/src/gpu>`_. This is a memory-efficient CUDA implementation of assign_scores operation, which first transform all point featur...
the_stack_v2_python_sparse
mmcv/ops/assign_score_withk.py
open-mmlab/mmcv
train
5,319
2bfd235494d5c9710a4c67cd610b5bced84ba325
[ "LOG.debug('Setting register {:#0x} to value {}'.format(p_register, p_values))\nBuildCommand.write_register_command(p_controller_obj, p_register, p_values)\npass", "l_val = bytearray(1)\nl_val[0] = 3\nself.set_register_value(255, 112, l_val)" ]
<|body_start_0|> LOG.debug('Setting register {:#0x} to value {}'.format(p_register, p_values)) BuildCommand.write_register_command(p_controller_obj, p_register, p_values) pass <|end_body_0|> <|body_start_1|> l_val = bytearray(1) l_val[0] = 3 self.set_register_value(255, ...
CreateCommands
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateCommands: def set_register_value(self, p_controller_obj, p_register, p_values): """Set one of the device's registers.""" <|body_0|> def set_pim_mode(self): """Set the PIM operating mode: Page 6 of UPB Powerline Interface Module (PIM) Description Version 1.6 The...
stack_v2_sparse_classes_36k_train_011353
17,549
permissive
[ { "docstring": "Set one of the device's registers.", "name": "set_register_value", "signature": "def set_register_value(self, p_controller_obj, p_register, p_values)" }, { "docstring": "Set the PIM operating mode: Page 6 of UPB Powerline Interface Module (PIM) Description Version 1.6 The PIM mod...
2
stack_v2_sparse_classes_30k_train_018413
Implement the Python class `CreateCommands` described below. Class description: Implement the CreateCommands class. Method signatures and docstrings: - def set_register_value(self, p_controller_obj, p_register, p_values): Set one of the device's registers. - def set_pim_mode(self): Set the PIM operating mode: Page 6 ...
Implement the Python class `CreateCommands` described below. Class description: Implement the CreateCommands class. Method signatures and docstrings: - def set_register_value(self, p_controller_obj, p_register, p_values): Set one of the device's registers. - def set_pim_mode(self): Set the PIM operating mode: Page 6 ...
a100fc67761a22ae47ed6f21f3c9464e2de5d54f
<|skeleton|> class CreateCommands: def set_register_value(self, p_controller_obj, p_register, p_values): """Set one of the device's registers.""" <|body_0|> def set_pim_mode(self): """Set the PIM operating mode: Page 6 of UPB Powerline Interface Module (PIM) Description Version 1.6 The...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateCommands: def set_register_value(self, p_controller_obj, p_register, p_values): """Set one of the device's registers.""" LOG.debug('Setting register {:#0x} to value {}'.format(p_register, p_values)) BuildCommand.write_register_command(p_controller_obj, p_register, p_values) ...
the_stack_v2_python_sparse
Project/src/Modules/House/Family/Upb/upb_pim.py
DBrianKimmel/PyHouse
train
3
4b33d93571bf4e476b3ab0841d2d1887877a1af7
[ "y = model.layers[logits_layer_index].output[0, class_index]\ntarget_conv_layer_output = model.layers[target_conv_layer_index].output\ngrads = normalize(K.gradients(y, target_conv_layer_output)[0])\ngradient_function = K.function([model.input, K.learning_phase()], [target_conv_layer_output, grads])\n'\\n The...
<|body_start_0|> y = model.layers[logits_layer_index].output[0, class_index] target_conv_layer_output = model.layers[target_conv_layer_index].output grads = normalize(K.gradients(y, target_conv_layer_output)[0]) gradient_function = K.function([model.input, K.learning_phase()], [target_co...
GradCAM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradCAM: def __init__(self, model, logits_layer_index, target_conv_layer_index, class_index, number_of_classes): """Parameters ---------- model : keras.model.Model CNN model. logits_layer_index : int Index of layer outputting logits. target_conv_layer_index : int Index of last convolutio...
stack_v2_sparse_classes_36k_train_011354
11,820
permissive
[ { "docstring": "Parameters ---------- model : keras.model.Model CNN model. logits_layer_index : int Index of layer outputting logits. target_conv_layer_index : int Index of last convolutional layer. class_index : int Targeted class index to visualize. number_of_classes : int Number of all classes output by mode...
2
stack_v2_sparse_classes_30k_train_014761
Implement the Python class `GradCAM` described below. Class description: Implement the GradCAM class. Method signatures and docstrings: - def __init__(self, model, logits_layer_index, target_conv_layer_index, class_index, number_of_classes): Parameters ---------- model : keras.model.Model CNN model. logits_layer_inde...
Implement the Python class `GradCAM` described below. Class description: Implement the GradCAM class. Method signatures and docstrings: - def __init__(self, model, logits_layer_index, target_conv_layer_index, class_index, number_of_classes): Parameters ---------- model : keras.model.Model CNN model. logits_layer_inde...
5d976f11f7487d2c76eec030c15dd52e73d6a48b
<|skeleton|> class GradCAM: def __init__(self, model, logits_layer_index, target_conv_layer_index, class_index, number_of_classes): """Parameters ---------- model : keras.model.Model CNN model. logits_layer_index : int Index of layer outputting logits. target_conv_layer_index : int Index of last convolutio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GradCAM: def __init__(self, model, logits_layer_index, target_conv_layer_index, class_index, number_of_classes): """Parameters ---------- model : keras.model.Model CNN model. logits_layer_index : int Index of layer outputting logits. target_conv_layer_index : int Index of last convolutional layer. cla...
the_stack_v2_python_sparse
drl_lab/gcam.py
chavdim/drl_lab
train
1
c77258afa463e66c019dbf252722c2311f6aa680
[ "if use_active_config:\n return os.path.join(os.environ['HOME'], '.active')\nreturn os.path.join(find_pdaq_config(), '.config')", "cluster_file = cls.__get_cached_name_path(use_active_config)\ntry:\n with open(cluster_file, 'r') as fin:\n ret = fin.readline()\n if ret is not None:\n ...
<|body_start_0|> if use_active_config: return os.path.join(os.environ['HOME'], '.active') return os.path.join(find_pdaq_config(), '.config') <|end_body_0|> <|body_start_1|> cluster_file = cls.__get_cached_name_path(use_active_config) try: with open(cluster_file, ...
Manage pDAQ's run configuration name, in either ~/.active or in $PDAQ_CONFIG/.config
CachedFile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CachedFile: """Manage pDAQ's run configuration name, in either ~/.active or in $PDAQ_CONFIG/.config""" def __get_cached_name_path(cls, use_active_config): """get the active or default cluster configuration""" <|body_0|> def __read_cache_file(cls, use_active_config): ...
stack_v2_sparse_classes_36k_train_011355
2,960
no_license
[ { "docstring": "get the active or default cluster configuration", "name": "__get_cached_name_path", "signature": "def __get_cached_name_path(cls, use_active_config)" }, { "docstring": "read the single line of cached text", "name": "__read_cache_file", "signature": "def __read_cache_file(...
5
null
Implement the Python class `CachedFile` described below. Class description: Manage pDAQ's run configuration name, in either ~/.active or in $PDAQ_CONFIG/.config Method signatures and docstrings: - def __get_cached_name_path(cls, use_active_config): get the active or default cluster configuration - def __read_cache_fi...
Implement the Python class `CachedFile` described below. Class description: Manage pDAQ's run configuration name, in either ~/.active or in $PDAQ_CONFIG/.config Method signatures and docstrings: - def __get_cached_name_path(cls, use_active_config): get the active or default cluster configuration - def __read_cache_fi...
718189be62907a6a8031980fe0c41fa7e06b898d
<|skeleton|> class CachedFile: """Manage pDAQ's run configuration name, in either ~/.active or in $PDAQ_CONFIG/.config""" def __get_cached_name_path(cls, use_active_config): """get the active or default cluster configuration""" <|body_0|> def __read_cache_file(cls, use_active_config): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CachedFile: """Manage pDAQ's run configuration name, in either ~/.active or in $PDAQ_CONFIG/.config""" def __get_cached_name_path(cls, use_active_config): """get the active or default cluster configuration""" if use_active_config: return os.path.join(os.environ['HOME'], '.acti...
the_stack_v2_python_sparse
CachedConfigName.py
dglo/dash
train
0
7bfb41f23d8f7fc12966d1af1d3013a2ccb78fee
[ "if size < 3:\n raise Exception('Cells must be at least three pixels wide')\nself.height = height\nself.width = width\nself.size = size\nself.numrows = height / size\nself.numcols = width / size\nself.construct()", "master = Tkinter.Tk()\nw = Tkinter.Canvas(master, width=self.width + 10, height=self.height + 1...
<|body_start_0|> if size < 3: raise Exception('Cells must be at least three pixels wide') self.height = height self.width = width self.size = size self.numrows = height / size self.numcols = width / size self.construct() <|end_body_0|> <|body_start_1|...
Maze
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Maze: def __init__(self, height, width, size): """initialize maze""" <|body_0|> def view(self): """Show window with maze""" <|body_1|> def clearWall(self, fromCell, toCell): """Remove wall between two cells""" <|body_2|> def dfsVisit...
stack_v2_sparse_classes_36k_train_011356
4,512
no_license
[ { "docstring": "initialize maze", "name": "__init__", "signature": "def __init__(self, height, width, size)" }, { "docstring": "Show window with maze", "name": "view", "signature": "def view(self)" }, { "docstring": "Remove wall between two cells", "name": "clearWall", "s...
6
null
Implement the Python class `Maze` described below. Class description: Implement the Maze class. Method signatures and docstrings: - def __init__(self, height, width, size): initialize maze - def view(self): Show window with maze - def clearWall(self, fromCell, toCell): Remove wall between two cells - def dfsVisit(sel...
Implement the Python class `Maze` described below. Class description: Implement the Maze class. Method signatures and docstrings: - def __init__(self, height, width, size): initialize maze - def view(self): Show window with maze - def clearWall(self, fromCell, toCell): Remove wall between two cells - def dfsVisit(sel...
929dde1723fb2f54870c8a9badc80fc23e8400d3
<|skeleton|> class Maze: def __init__(self, height, width, size): """initialize maze""" <|body_0|> def view(self): """Show window with maze""" <|body_1|> def clearWall(self, fromCell, toCell): """Remove wall between two cells""" <|body_2|> def dfsVisit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Maze: def __init__(self, height, width, size): """initialize maze""" if size < 3: raise Exception('Cells must be at least three pixels wide') self.height = height self.width = width self.size = size self.numrows = height / size self.numcols =...
the_stack_v2_python_sparse
Working with Algorithms in Python/6. DepthFirstSearch/maze.py
syurskyi/Algorithms_and_Data_Structure
train
4
a92414f009d71ad0531650a70f661a186c18c476
[ "super().__init__()\nself.generator = generator_cls(img_shape[0], img_shape[0], num_residuals)\nself.feature_extractor = feature_extractor_cls()\nself.discriminator = discriminator_cls(img_shape[0])", "gen_hr = self.generator(imgs_lr)\ngen_features = self.feature_extractor(gen_hr)\nreal_features = self.feature_ex...
<|body_start_0|> super().__init__() self.generator = generator_cls(img_shape[0], img_shape[0], num_residuals) self.feature_extractor = feature_extractor_cls() self.discriminator = discriminator_cls(img_shape[0]) <|end_body_0|> <|body_start_1|> gen_hr = self.generator(imgs_lr) ...
Class implementing Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network References ---------- `Paper <https://arxiv.org/abs/1609.04802>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network, it might be best, to split this ...
SuperResolutionGAN
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperResolutionGAN: """Class implementing Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network References ---------- `Paper <https://arxiv.org/abs/1609.04802>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already tra...
stack_v2_sparse_classes_36k_train_011357
4,479
permissive
[ { "docstring": "Parameters ---------- img_shape : tuple the shape of the input/generated images (including channels, excluding batch dimension) num_residuals : int number of residual blocks inside the generator generator_cls : class implementing the actual generator topology feature_extractor_cls : class implem...
2
null
Implement the Python class `SuperResolutionGAN` described below. Class description: Class implementing Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network References ---------- `Paper <https://arxiv.org/abs/1609.04802>`_ Warnings -------- This Network is designed for training only; if ...
Implement the Python class `SuperResolutionGAN` described below. Class description: Class implementing Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network References ---------- `Paper <https://arxiv.org/abs/1609.04802>`_ Warnings -------- This Network is designed for training only; if ...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class SuperResolutionGAN: """Class implementing Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network References ---------- `Paper <https://arxiv.org/abs/1609.04802>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already tra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SuperResolutionGAN: """Class implementing Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network References ---------- `Paper <https://arxiv.org/abs/1609.04802>`_ Warnings -------- This Network is designed for training only; if you want to predict from an already trained network,...
the_stack_v2_python_sparse
dlutils/models/gans/super_resolution/sr_gan.py
justusschock/dl-utils
train
15
f0a583739c9777f0b9d30126a71a4df0d12ddcd4
[ "if not quota_max_calls:\n use_rate_limiter = False\nself._projects_locations = None\nself._projects_zones = None\nself._projects_zones_clusters = None\nsuper(ContainerRepositoryClient, self).__init__(API_NAME, versions=['v1', 'v1beta1'], quota_max_calls=quota_max_calls, quota_period=quota_period, use_rate_limit...
<|body_start_0|> if not quota_max_calls: use_rate_limiter = False self._projects_locations = None self._projects_zones = None self._projects_zones_clusters = None super(ContainerRepositoryClient, self).__init__(API_NAME, versions=['v1', 'v1beta1'], quota_max_calls=quo...
Cloud Kubernetes Engine API Respository.
ContainerRepositoryClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContainerRepositoryClient: """Cloud Kubernetes Engine API Respository.""" def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time ...
stack_v2_sparse_classes_36k_train_011358
10,586
permissive
[ { "docstring": "Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to track requests over. use_rate_limiter (bool): Set to false to disable the use of a rate limiter for this service.", "name": "__init__", "signature": "def __...
4
null
Implement the Python class `ContainerRepositoryClient` described below. Class description: Cloud Kubernetes Engine API Respository. Method signatures and docstrings: - def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True): Constructor. Args: quota_max_calls (int): Allowed requests per <q...
Implement the Python class `ContainerRepositoryClient` described below. Class description: Cloud Kubernetes Engine API Respository. Method signatures and docstrings: - def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True): Constructor. Args: quota_max_calls (int): Allowed requests per <q...
d4421afa50a17ed47cbebe942044ebab3720e0f5
<|skeleton|> class ContainerRepositoryClient: """Cloud Kubernetes Engine API Respository.""" def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContainerRepositoryClient: """Cloud Kubernetes Engine API Respository.""" def __init__(self, quota_max_calls=None, quota_period=100.0, use_rate_limiter=True): """Constructor. Args: quota_max_calls (int): Allowed requests per <quota_period> for the API. quota_period (float): The time period to tra...
the_stack_v2_python_sparse
google/cloud/forseti/common/gcp_api/container.py
kevensen/forseti-security
train
1
a9cebafc33846c8daeaa7bd9981d61d1fffa2021
[ "try:\n data = open('addRequest_schema.json', 'rU').read()\nexcept IOError as e:\n print('Error loading input schema: ' + e.strerror)\n sys.exit(1)\ntry:\n Handler.requestSchema = loads(data)\nexcept Exception as e:\n print('Invalid JSON content in input schema')\n sys.exit(1)", "print('Request ...
<|body_start_0|> try: data = open('addRequest_schema.json', 'rU').read() except IOError as e: print('Error loading input schema: ' + e.strerror) sys.exit(1) try: Handler.requestSchema = loads(data) except Exception as e: print('...
HTTP request handler
Handler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Handler: """HTTP request handler""" def loadRequestSchema(self): """load request schema from file (once only)""" <|body_0|> def do_POST(self): """process POST, generate response""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: da...
stack_v2_sparse_classes_36k_train_011359
3,656
permissive
[ { "docstring": "load request schema from file (once only)", "name": "loadRequestSchema", "signature": "def loadRequestSchema(self)" }, { "docstring": "process POST, generate response", "name": "do_POST", "signature": "def do_POST(self)" } ]
2
stack_v2_sparse_classes_30k_test_000807
Implement the Python class `Handler` described below. Class description: HTTP request handler Method signatures and docstrings: - def loadRequestSchema(self): load request schema from file (once only) - def do_POST(self): process POST, generate response
Implement the Python class `Handler` described below. Class description: HTTP request handler Method signatures and docstrings: - def loadRequestSchema(self): load request schema from file (once only) - def do_POST(self): process POST, generate response <|skeleton|> class Handler: """HTTP request handler""" ...
d6e8ca06c70e31bff0e56f7d94bfa0bd835bf61c
<|skeleton|> class Handler: """HTTP request handler""" def loadRequestSchema(self): """load request schema from file (once only)""" <|body_0|> def do_POST(self): """process POST, generate response""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Handler: """HTTP request handler""" def loadRequestSchema(self): """load request schema from file (once only)""" try: data = open('addRequest_schema.json', 'rU').read() except IOError as e: print('Error loading input schema: ' + e.strerror) sys....
the_stack_v2_python_sparse
chapter7/additionService.py
MikeBeaulieu/ujs-book-materials
train
0
d5c862540a2610ae9af0d3b464a01424a13aa362
[ "circuit = ic.IBMCircuit(10)\nw1 = iw.IBMInputWire('w1', circuit)\ng = igr.IBMRotateGate('g', w1, 5, circuit)\nself.assertEquals('g:LROTATE(w1,5)', g.get_full_display_string())", "circuit1 = ic.IBMCircuit(600)\nw1 = iw.IBMInputWire('w1', circuit1)\ng1 = igr.IBMRotateGate('g1', w1, 3, circuit1)\nself.assertEqual(0...
<|body_start_0|> circuit = ic.IBMCircuit(10) w1 = iw.IBMInputWire('w1', circuit) g = igr.IBMRotateGate('g', w1, 5, circuit) self.assertEquals('g:LROTATE(w1,5)', g.get_full_display_string()) <|end_body_0|> <|body_start_1|> circuit1 = ic.IBMCircuit(600) w1 = iw.IBMInputWir...
TestRotateGate
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRotateGate: def test_get_full_display_string(self): """Tests that the method get_full_display_string returns the correct string.""" <|body_0|> def test_get_depth(self): """Tests that the get_depth method returns the correct depth, as defined by IBM.""" <|...
stack_v2_sparse_classes_36k_train_011360
2,354
permissive
[ { "docstring": "Tests that the method get_full_display_string returns the correct string.", "name": "test_get_full_display_string", "signature": "def test_get_full_display_string(self)" }, { "docstring": "Tests that the get_depth method returns the correct depth, as defined by IBM.", "name":...
2
stack_v2_sparse_classes_30k_train_005673
Implement the Python class `TestRotateGate` described below. Class description: Implement the TestRotateGate class. Method signatures and docstrings: - def test_get_full_display_string(self): Tests that the method get_full_display_string returns the correct string. - def test_get_depth(self): Tests that the get_depth...
Implement the Python class `TestRotateGate` described below. Class description: Implement the TestRotateGate class. Method signatures and docstrings: - def test_get_full_display_string(self): Tests that the method get_full_display_string returns the correct string. - def test_get_depth(self): Tests that the get_depth...
264459a8fa1480c7b65d946f88d94af1a038fbf1
<|skeleton|> class TestRotateGate: def test_get_full_display_string(self): """Tests that the method get_full_display_string returns the correct string.""" <|body_0|> def test_get_depth(self): """Tests that the get_depth method returns the correct depth, as defined by IBM.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestRotateGate: def test_get_full_display_string(self): """Tests that the method get_full_display_string returns the correct string.""" circuit = ic.IBMCircuit(10) w1 = iw.IBMInputWire('w1', circuit) g = igr.IBMRotateGate('g', w1, 5, circuit) self.assertEquals('g:LROTAT...
the_stack_v2_python_sparse
hetest/python/circuit_generation/ibm/ibm_gate_rotate_test.py
y4n9squared/HEtest
train
7
c42548783cf725937afdc9c2d8c90be62fa27cae
[ "self.project_path = project_path\nself.package_path = package_path\nself.filename_path = filename_path\nself.project = self.package = self.filename = None\nif self.project_path is not None:\n self.project = wc_read_project(self.project_path)\nif self.package_path is not None:\n if wc_is_package(self.package_...
<|body_start_0|> self.project_path = project_path self.package_path = package_path self.filename_path = filename_path self.project = self.package = self.filename = None if self.project_path is not None: self.project = wc_read_project(self.project_path) if self...
Represents a wc path.
WCPath
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WCPath: """Represents a wc path.""" def __init__(self, project_path, package_path, filename_path): """Constructs a new WCPath object. project_path is the path to the project wc. package_path is the path to the package wc. filename_path is the path to the wc filename. Either project_p...
stack_v2_sparse_classes_36k_train_011361
19,804
no_license
[ { "docstring": "Constructs a new WCPath object. project_path is the path to the project wc. package_path is the path to the package wc. filename_path is the path to the wc filename. Either project_path or package_path or both aren't None.", "name": "__init__", "signature": "def __init__(self, project_pa...
3
stack_v2_sparse_classes_30k_train_011161
Implement the Python class `WCPath` described below. Class description: Represents a wc path. Method signatures and docstrings: - def __init__(self, project_path, package_path, filename_path): Constructs a new WCPath object. project_path is the path to the project wc. package_path is the path to the package wc. filen...
Implement the Python class `WCPath` described below. Class description: Represents a wc path. Method signatures and docstrings: - def __init__(self, project_path, package_path, filename_path): Constructs a new WCPath object. project_path is the path to the project wc. package_path is the path to the package wc. filen...
fd75a75371ae33740a68913ca8ab64a9e8e6654a
<|skeleton|> class WCPath: """Represents a wc path.""" def __init__(self, project_path, package_path, filename_path): """Constructs a new WCPath object. project_path is the path to the project wc. package_path is the path to the package wc. filename_path is the path to the wc filename. Either project_p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WCPath: """Represents a wc path.""" def __init__(self, project_path, package_path, filename_path): """Constructs a new WCPath object. project_path is the path to the project wc. package_path is the path to the package wc. filename_path is the path to the wc filename. Either project_path or packag...
the_stack_v2_python_sparse
osc2/oscargs.py
openSUSE/osc2
train
16
e25ebfa45bac614b5b7a12b4c6d3bf5802f775c3
[ "from Acquisition import aq_inner\nfrom zope.component import getUtility\nfrom zope.intid.interfaces import IIntIds\nfrom zope.security import checkPermission\nfrom zc.relation.interfaces import ICatalog\ncatalog = getUtility(ICatalog)\nintids = getUtility(IIntIds)\nresult = []\nfor rel in catalog.findRelations(dic...
<|body_start_0|> from Acquisition import aq_inner from zope.component import getUtility from zope.intid.interfaces import IIntIds from zope.security import checkPermission from zc.relation.interfaces import ICatalog catalog = getUtility(ICatalog) intids = getUtili...
BorrowableItem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BorrowableItem: def getBorrowRequests(self): """Return all borrow requests referencing the curret item""" <|body_0|> def isBorrowable(self, start=None, end=None): """Is current item borrowable from start-end ?""" <|body_1|> def getBookingDates(self): ...
stack_v2_sparse_classes_36k_train_011362
5,740
no_license
[ { "docstring": "Return all borrow requests referencing the curret item", "name": "getBorrowRequests", "signature": "def getBorrowRequests(self)" }, { "docstring": "Is current item borrowable from start-end ?", "name": "isBorrowable", "signature": "def isBorrowable(self, start=None, end=N...
4
null
Implement the Python class `BorrowableItem` described below. Class description: Implement the BorrowableItem class. Method signatures and docstrings: - def getBorrowRequests(self): Return all borrow requests referencing the curret item - def isBorrowable(self, start=None, end=None): Is current item borrowable from st...
Implement the Python class `BorrowableItem` described below. Class description: Implement the BorrowableItem class. Method signatures and docstrings: - def getBorrowRequests(self): Return all borrow requests referencing the curret item - def isBorrowable(self, start=None, end=None): Is current item borrowable from st...
62203ae995bd708dc81809cc8698c0b24208735e
<|skeleton|> class BorrowableItem: def getBorrowRequests(self): """Return all borrow requests referencing the curret item""" <|body_0|> def isBorrowable(self, start=None, end=None): """Is current item borrowable from start-end ?""" <|body_1|> def getBookingDates(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BorrowableItem: def getBorrowRequests(self): """Return all borrow requests referencing the curret item""" from Acquisition import aq_inner from zope.component import getUtility from zope.intid.interfaces import IIntIds from zope.security import checkPermission f...
the_stack_v2_python_sparse
nva.borrow/tags/before-refactoring/nva/borrow/borrowableitem.py
witsch/novareto
train
0
eb5e92fbe994625d45178f8d38ffce78e54b3ca6
[ "if root == None:\n return False\nelif root.left == None and root.right == None and (root.val == sum):\n return True\nreturn self.hasPathSum(root.left, sum - root.val) or self.hasPathSum(root.right, sum - root.val)", "if root == None:\n return False\nnode_array = [root]\npath_sum_array = [root.val]\nwhil...
<|body_start_0|> if root == None: return False elif root.left == None and root.right == None and (root.val == sum): return True return self.hasPathSum(root.left, sum - root.val) or self.hasPathSum(root.right, sum - root.val) <|end_body_0|> <|body_start_1|> if roo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_0|> def hasPathSumIterate(self, root, sum): """层序遍历""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root == None: return False ...
stack_v2_sparse_classes_36k_train_011363
1,828
no_license
[ { "docstring": ":type root: TreeNode :type sum: int :rtype: bool", "name": "hasPathSum", "signature": "def hasPathSum(self, root, sum)" }, { "docstring": "层序遍历", "name": "hasPathSumIterate", "signature": "def hasPathSumIterate(self, root, sum)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool - def hasPathSumIterate(self, root, sum): 层序遍历
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasPathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: bool - def hasPathSumIterate(self, root, sum): 层序遍历 <|skeleton|> class Solution: def hasPathSum...
8853f85214ac88db024d26e228f1848dd5acd933
<|skeleton|> class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" <|body_0|> def hasPathSumIterate(self, root, sum): """层序遍历""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasPathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: bool""" if root == None: return False elif root.left == None and root.right == None and (root.val == sum): return True return self.hasPathSum(root.left, sum - root....
the_stack_v2_python_sparse
112-PathSum/PathSum.py
cqxmzhc/my_leetcode_solutions
train
2
9f3cac440f4bcc03cc02f5ab837e182d6d69c7d0
[ "SpeciesOrderedKey.__init__(self, species)\nself.opponents = opponents\nself.feed_type = get_species_feed_type(species, owning_player, opponents)", "if self.feed_type is not other.feed_type:\n return self.feed_type.value > other.feed_type.value\nif self.feed_type is SpeciesFeedType.STORE_FAT:\n return FatOr...
<|body_start_0|> SpeciesOrderedKey.__init__(self, species) self.opponents = opponents self.feed_type = get_species_feed_type(species, owning_player, opponents) <|end_body_0|> <|body_start_1|> if self.feed_type is not other.feed_type: return self.feed_type.value > other.feed_...
Representing a way of comparing Species according to the Simple Player specifications The Key Prioritizes Feed Type then for Store Foot then Prioritizes the fat food need Then Prioritizes by lexicographical by population, food already fed, and body size
SimpleSpeciesOrderedKey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleSpeciesOrderedKey: """Representing a way of comparing Species according to the Simple Player specifications The Key Prioritizes Feed Type then for Store Foot then Prioritizes the fat food need Then Prioritizes by lexicographical by population, food already fed, and body size""" def __i...
stack_v2_sparse_classes_36k_train_011364
6,072
no_license
[ { "docstring": "Construct a Species Pick Key :param species: The Species :param owning_player: The PlayerState that owns the Species :param opponents: The Opponents' PlayerStates", "name": "__init__", "signature": "def __init__(self, species: Species, owning_player: IPlayer, opponents: List[IPlayer])" ...
3
null
Implement the Python class `SimpleSpeciesOrderedKey` described below. Class description: Representing a way of comparing Species according to the Simple Player specifications The Key Prioritizes Feed Type then for Store Foot then Prioritizes the fat food need Then Prioritizes by lexicographical by population, food alr...
Implement the Python class `SimpleSpeciesOrderedKey` described below. Class description: Representing a way of comparing Species according to the Simple Player specifications The Key Prioritizes Feed Type then for Store Foot then Prioritizes the fat food need Then Prioritizes by lexicographical by population, food alr...
a59252a7d55a474bcb2b469414902c585bc89641
<|skeleton|> class SimpleSpeciesOrderedKey: """Representing a way of comparing Species according to the Simple Player specifications The Key Prioritizes Feed Type then for Store Foot then Prioritizes the fat food need Then Prioritizes by lexicographical by population, food already fed, and body size""" def __i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleSpeciesOrderedKey: """Representing a way of comparing Species according to the Simple Player specifications The Key Prioritizes Feed Type then for Store Foot then Prioritizes the fat food need Then Prioritizes by lexicographical by population, food already fed, and body size""" def __init__(self, s...
the_stack_v2_python_sparse
evolution/external_players/silly/silly_species_keys.py
escowart/SoftwareDev
train
0
bb170026178c714934d782b7989b93ed3159126d
[ "min_height = float('inf')\nupdated = False\n\ndef traverse(n, height=0):\n nonlocal min_height, updated\n if n == None:\n if height < min_height:\n if updated:\n return False\n else:\n if min_height < float('inf'):\n updated = True...
<|body_start_0|> min_height = float('inf') updated = False def traverse(n, height=0): nonlocal min_height, updated if n == None: if height < min_height: if updated: return False else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isCompleteTree(self, root: TreeNode) -> bool: """May 30, 2020 18:23""" <|body_0|> def isCompleteTree(self, root: Optional[TreeNode]) -> bool: """Apr 23, 2023 17:45""" <|body_1|> <|end_skeleton|> <|body_start_0|> min_height = float('inf...
stack_v2_sparse_classes_36k_train_011365
3,289
no_license
[ { "docstring": "May 30, 2020 18:23", "name": "isCompleteTree", "signature": "def isCompleteTree(self, root: TreeNode) -> bool" }, { "docstring": "Apr 23, 2023 17:45", "name": "isCompleteTree", "signature": "def isCompleteTree(self, root: Optional[TreeNode]) -> bool" } ]
2
stack_v2_sparse_classes_30k_train_009575
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isCompleteTree(self, root: TreeNode) -> bool: May 30, 2020 18:23 - def isCompleteTree(self, root: Optional[TreeNode]) -> bool: Apr 23, 2023 17:45
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isCompleteTree(self, root: TreeNode) -> bool: May 30, 2020 18:23 - def isCompleteTree(self, root: Optional[TreeNode]) -> bool: Apr 23, 2023 17:45 <|skeleton|> class Solution...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def isCompleteTree(self, root: TreeNode) -> bool: """May 30, 2020 18:23""" <|body_0|> def isCompleteTree(self, root: Optional[TreeNode]) -> bool: """Apr 23, 2023 17:45""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isCompleteTree(self, root: TreeNode) -> bool: """May 30, 2020 18:23""" min_height = float('inf') updated = False def traverse(n, height=0): nonlocal min_height, updated if n == None: if height < min_height: ...
the_stack_v2_python_sparse
leetcode/solved/998_Check_Completeness_of_a_Binary_Tree/solution.py
sungminoh/algorithms
train
0
cafdc7186c6ed19498c8b11081d55c2ad93c96de
[ "if isinstance(key, int):\n return TaggerID(key)\nif key not in TaggerID._member_map_:\n extend_enum(TaggerID, key, default)\nreturn TaggerID[key]", "if not (isinstance(value, int) and 0 <= value <= 7):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 4 <= value <= 7:\n extend_en...
<|body_start_0|> if isinstance(key, int): return TaggerID(key) if key not in TaggerID._member_map_: extend_enum(TaggerID, key, default) return TaggerID[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 7): raise Val...
[TaggerID] TaggerID Types
TaggerID
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaggerID: """[TaggerID] TaggerID Types""" 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|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_011366
1,119
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_018905
Implement the Python class `TaggerID` described below. Class description: [TaggerID] TaggerID Types 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 `TaggerID` described below. Class description: [TaggerID] TaggerID Types 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 TaggerID: """[Tagger...
90cd07d67df28d5c5ab0585bc60f467a78d9db33
<|skeleton|> class TaggerID: """[TaggerID] TaggerID Types""" 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_36k
data/stack_v2_sparse_classes_30k
class TaggerID: """[TaggerID] TaggerID Types""" def get(key, default=-1): """Backport support for original codes.""" if isinstance(key, int): return TaggerID(key) if key not in TaggerID._member_map_: extend_enum(TaggerID, key, default) return TaggerID[key...
the_stack_v2_python_sparse
pcapkit/const/ipv6/tagger_id.py
stjordanis/PyPCAPKit
train
0
e1feb9f30702a68fa07d73b5a5d57746551de7f3
[ "self.elapsed = 0.0\nself._func = func\nself._start = None", "if self._start is not None:\n raise RuntimeError('Already started')\nself._start = self._func()", "if self._start is None:\n raise RuntimeError('Not started')\nend = self._func()\nself.elapsed += end - self._start\nself._start = None" ]
<|body_start_0|> self.elapsed = 0.0 self._func = func self._start = None <|end_body_0|> <|body_start_1|> if self._start is not None: raise RuntimeError('Already started') self._start = self._func() <|end_body_1|> <|body_start_2|> if self._start is None: ...
The timer function
Timer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Timer: """The timer function""" def __init__(self, func=time.perf_counter): """Initialize the timer object""" <|body_0|> def start(self): """Start the timer""" <|body_1|> def stop(self): """Stop the timer""" <|body_2|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_011367
10,931
no_license
[ { "docstring": "Initialize the timer object", "name": "__init__", "signature": "def __init__(self, func=time.perf_counter)" }, { "docstring": "Start the timer", "name": "start", "signature": "def start(self)" }, { "docstring": "Stop the timer", "name": "stop", "signature"...
3
null
Implement the Python class `Timer` described below. Class description: The timer function Method signatures and docstrings: - def __init__(self, func=time.perf_counter): Initialize the timer object - def start(self): Start the timer - def stop(self): Stop the timer
Implement the Python class `Timer` described below. Class description: The timer function Method signatures and docstrings: - def __init__(self, func=time.perf_counter): Initialize the timer object - def start(self): Start the timer - def stop(self): Stop the timer <|skeleton|> class Timer: """The timer function...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class Timer: """The timer function""" def __init__(self, func=time.perf_counter): """Initialize the timer object""" <|body_0|> def start(self): """Start the timer""" <|body_1|> def stop(self): """Stop the timer""" <|body_2|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Timer: """The timer function""" def __init__(self, func=time.perf_counter): """Initialize the timer object""" self.elapsed = 0.0 self._func = func self._start = None def start(self): """Start the timer""" if self._start is not None: raise R...
the_stack_v2_python_sparse
students/JoeNunnelley/lesson10/assignment/database.py
JavaRod/SP_Python220B_2019
train
1
f2ee7f09cd7883b0a77fa7228113203c47f4fb27
[ "limit = df[CLOSE].min()\nif limit > 0:\n limit_df = df[df[CLOSE] <= limit * (2 - LIMIT_DETECT_LIMIT_FACTOR)]\n if not limit_df.empty:\n tm = limit_df.index[-1]\n return tm", "limit = df[DIF].min()\nif limit < 0:\n return cls.__get_min_limit_tm(df[DIF], limit)", "limit = df[MACD].min()\ni...
<|body_start_0|> limit = df[CLOSE].min() if limit > 0: limit_df = df[df[CLOSE] <= limit * (2 - LIMIT_DETECT_LIMIT_FACTOR)] if not limit_df.empty: tm = limit_df.index[-1] return tm <|end_body_0|> <|body_start_1|> limit = df[DIF].min() ...
检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD
MinLimitDetect
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MinLimitDetect: """检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD""" def get_close_limit_tm_in(cls, df): """获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return:""" <|body_0|> def get_dif_limit_tm_in(cls, df): """获取区间内DIF最小值的时间。 ...
stack_v2_sparse_classes_36k_train_011368
36,499
no_license
[ { "docstring": "获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return:", "name": "get_close_limit_tm_in", "signature": "def get_close_limit_tm_in(cls, df)" }, { "docstring": "获取区间内DIF最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return:", ...
4
null
Implement the Python class `MinLimitDetect` described below. Class description: 检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD Method signatures and docstrings: - def get_close_limit_tm_in(cls, df): 获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return: - def get_dif_limit_tm_in(cls, ...
Implement the Python class `MinLimitDetect` described below. Class description: 检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD Method signatures and docstrings: - def get_close_limit_tm_in(cls, df): 获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return: - def get_dif_limit_tm_in(cls, ...
9446d33c0978c325c8b24a876ac2c42fe323dbe6
<|skeleton|> class MinLimitDetect: """检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD""" def get_close_limit_tm_in(cls, df): """获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return:""" <|body_0|> def get_dif_limit_tm_in(cls, df): """获取区间内DIF最小值的时间。 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MinLimitDetect: """检测极值:最小值的时间。用于检测3种极值的时间,3种极值分别是:DIF/CLOSE/MACD""" def get_close_limit_tm_in(cls, df): """获取区间内close最小值的时间。 :param df: DataFrame类型, 相邻的死叉和金叉之间或两个死叉之间的所有数据[包含死叉点,不包含金叉点] :return:""" limit = df[CLOSE].min() if limit > 0: limit_df = df[df[CLOSE] <= limit...
the_stack_v2_python_sparse
back_forecast/learn_quant/MACD/jukuan_macd_signal.py
lnkyzhang/wayToFreedomOfWealth
train
3
8650dd9b797d519d6ae2091bdcd65f209ab38e43
[ "self.background_color = background_color\nself.border_color = border_color\nself.border_width = border_width\nself.corner_radius = corner_radius\nself.frame = frame\nself.flex = flex\nself.padding = padding\nself.name = name\nold_add_subview = self.add_subview\n\ndef new_add_subview(subviews):\n if not hasattr(...
<|body_start_0|> self.background_color = background_color self.border_color = border_color self.border_width = border_width self.corner_radius = corner_radius self.frame = frame self.flex = flex self.padding = padding self.name = name old_add_subvi...
a subclass of View that automatically flows subviews in the order they were added. and reflows upon resize. also, set a few sane defaults, and expose some of the commonly midified params in thr constructor
FlowContainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlowContainer: """a subclass of View that automatically flows subviews in the order they were added. and reflows upon resize. also, set a few sane defaults, and expose some of the commonly midified params in thr constructor""" def __init__(self, background_color=(0.9, 0.9, 0.9), border_color...
stack_v2_sparse_classes_36k_train_011369
7,019
no_license
[ { "docstring": "initialize view. flex settings control layout.", "name": "__init__", "signature": "def __init__(self, background_color=(0.9, 0.9, 0.9), border_color=(0.5, 0.5, 0.5), border_width=1, corner_radius=5, frame=(0, 0, 200, 200), flex='WH', padding=5, subviews=None, name=None)" }, { "do...
4
stack_v2_sparse_classes_30k_train_017618
Implement the Python class `FlowContainer` described below. Class description: a subclass of View that automatically flows subviews in the order they were added. and reflows upon resize. also, set a few sane defaults, and expose some of the commonly midified params in thr constructor Method signatures and docstrings:...
Implement the Python class `FlowContainer` described below. Class description: a subclass of View that automatically flows subviews in the order they were added. and reflows upon resize. also, set a few sane defaults, and expose some of the commonly midified params in thr constructor Method signatures and docstrings:...
4caba2d48508eafa2477370923e96132947d7b24
<|skeleton|> class FlowContainer: """a subclass of View that automatically flows subviews in the order they were added. and reflows upon resize. also, set a few sane defaults, and expose some of the commonly midified params in thr constructor""" def __init__(self, background_color=(0.9, 0.9, 0.9), border_color...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlowContainer: """a subclass of View that automatically flows subviews in the order they were added. and reflows upon resize. also, set a few sane defaults, and expose some of the commonly midified params in thr constructor""" def __init__(self, background_color=(0.9, 0.9, 0.9), border_color=(0.5, 0.5, 0...
the_stack_v2_python_sparse
ui/uicontainer.py
c0ns0le/Pythonista
train
3
d5c23848ed1c82e5906b30d63a3fd6ffda4361b1
[ "self.vars = vars\nself.annot_body_code = annot_body_code\nself.indent = indent\nself.language = 'c'\npass", "vname = var.vname\ndims = var.dims[:]\ndims.remove(None)\ns = str(vname)\nif len(dims) > 0:\n s += '[' + ']['.join(map(str, dims)) + ']'\nreturn s", "indent = self.indent\nextra_indent = ' '\ns = '\...
<|body_start_0|> self.vars = vars self.annot_body_code = annot_body_code self.indent = indent self.language = 'c' pass <|end_body_0|> <|body_start_1|> vname = var.vname dims = var.dims[:] dims.remove(None) s = str(vname) if len(dims) > 0: ...
The code generator for the Blue Gene's memory alignment optimizer
CodeGen_C
[ "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-permissive" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodeGen_C: """The code generator for the Blue Gene's memory alignment optimizer""" def __init__(self, vars, annot_body_code, indent): """To instantiate a code generator instance""" <|body_0|> def __printAddress(self, var): """To Return the starting address locati...
stack_v2_sparse_classes_36k_train_011370
3,849
permissive
[ { "docstring": "To instantiate a code generator instance", "name": "__init__", "signature": "def __init__(self, vars, annot_body_code, indent)" }, { "docstring": "To Return the starting address location of the given variable (in C/C++)", "name": "__printAddress", "signature": "def __prin...
3
null
Implement the Python class `CodeGen_C` described below. Class description: The code generator for the Blue Gene's memory alignment optimizer Method signatures and docstrings: - def __init__(self, vars, annot_body_code, indent): To instantiate a code generator instance - def __printAddress(self, var): To Return the st...
Implement the Python class `CodeGen_C` described below. Class description: The code generator for the Blue Gene's memory alignment optimizer Method signatures and docstrings: - def __init__(self, vars, annot_body_code, indent): To instantiate a code generator instance - def __printAddress(self, var): To Return the st...
934ba192301cb4e23d98b9f79e91799152bf76b1
<|skeleton|> class CodeGen_C: """The code generator for the Blue Gene's memory alignment optimizer""" def __init__(self, vars, annot_body_code, indent): """To instantiate a code generator instance""" <|body_0|> def __printAddress(self, var): """To Return the starting address locati...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CodeGen_C: """The code generator for the Blue Gene's memory alignment optimizer""" def __init__(self, vars, annot_body_code, indent): """To instantiate a code generator instance""" self.vars = vars self.annot_body_code = annot_body_code self.indent = indent self.la...
the_stack_v2_python_sparse
orio/module/align/codegen.py
phrb/orio_experiments
train
1
5fc6c86715e2405076541db45616642c32dc24c5
[ "self.n_iter = 0\nself.n_steps = n_steps\nself.walkers = np.zeros((2, n_walkers), int)\nself.n_walkers = n_walkers", "while self.n_iter < self.n_steps:\n x = ran.randint(low=-1, high=2, size=self.n_walkers)\n y = ran.randint(low=-1, high=2, size=self.n_walkers)\n self.walkers[0] += x\n self.walkers[1]...
<|body_start_0|> self.n_iter = 0 self.n_steps = n_steps self.walkers = np.zeros((2, n_walkers), int) self.n_walkers = n_walkers <|end_body_0|> <|body_start_1|> while self.n_iter < self.n_steps: x = ran.randint(low=-1, high=2, size=self.n_walkers) y = ran....
class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers[1] are y coords.
random_walk
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class random_walk: """class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers[1] are y coords.""" def __init__(...
stack_v2_sparse_classes_36k_train_011371
1,945
no_license
[ { "docstring": "initialize walkers to origin", "name": "__init__", "signature": "def __init__(self, n_walkers, n_steps)" }, { "docstring": "update the random walk and call plot method each time", "name": "iterate", "signature": "def iterate(self)" }, { "docstring": "plots the wal...
3
null
Implement the Python class `random_walk` described below. Class description: class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers...
Implement the Python class `random_walk` described below. Class description: class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers...
516b74c57a1c7db7fb5097e833582744c92adf62
<|skeleton|> class random_walk: """class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers[1] are y coords.""" def __init__(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class random_walk: """class for random walk simulation parameters: self.n_iter - number of executed iterations self.n_steps: - number of steps to be performed self.walkers: - ndarray that holds x & y coords of each walker self.walkers[0] are x coords. self.walkers[1] are y coords.""" def __init__(self, n_walke...
the_stack_v2_python_sparse
PythonProgramming/Homework 08/wood_10.3.py
Computational-Physics-Research/Computational-Physics-1
train
0
72e220dba94ce928aff89c419162c71cc19d3402
[ "def dfs(node, last_val, tmp_len):\n if node is None:\n return\n if node.val == last_val + 1:\n tmp_len += 1\n max_len[0] = max(max_len[0], tmp_len)\n else:\n tmp_len = 1\n for child in [node.left, node.right]:\n dfs(child, node.val, tmp_len)\nif root is None:\n ret...
<|body_start_0|> def dfs(node, last_val, tmp_len): if node is None: return if node.val == last_val + 1: tmp_len += 1 max_len[0] = max(max_len[0], tmp_len) else: tmp_len = 1 for child in [node.left, no...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def dfs(node, last_val, tmp_len):...
stack_v2_sparse_classes_36k_train_011372
2,202
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "longestConsecutive", "signature": "def longestConsecutive(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "longestConsecutive", "signature": "def longestConsecutive(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, root): :type root: TreeNode :rtype: int - def longestConsecutive(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestConsecutive(self, root): :type root: TreeNode :rtype: int - def longestConsecutive(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def...
18ed31a3edf20a3e5a0b7a0b56acca5b98939693
<|skeleton|> class Solution: def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestConsecutive(self, root): """:type root: TreeNode :rtype: int""" def dfs(node, last_val, tmp_len): if node is None: return if node.val == last_val + 1: tmp_len += 1 max_len[0] = max(max_len[0], tmp_len)...
the_stack_v2_python_sparse
exercises/binary-tree/binary_tree_longest_consective_sequence.py
nahgnaw/data-structure
train
0
4e9d8a0b09eba4d2e126876ae1307596d589a959
[ "if not self._root:\n self._root = self._Node(key)\nelse:\n node = self._root\n parent = None\n while node:\n parent = node\n if key == node.key:\n break\n node = node.left if key < node.key else node.right\n if key == parent.key:\n parent._count += 1\n elif ...
<|body_start_0|> if not self._root: self._root = self._Node(key) else: node = self._root parent = None while node: parent = node if key == node.key: break node = node.left if key < node.ke...
Represents a Binary Search Tree with duplicate keys.
BinarySearchTreeDupKeys
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinarySearchTreeDupKeys: """Represents a Binary Search Tree with duplicate keys.""" def insert(self, key): """Inserts ``key`` in the tree.""" <|body_0|> def delete(self, key, delete_all=False): """Deletes key ``key`` from the tree. :param delete_all: If true, del...
stack_v2_sparse_classes_36k_train_011373
1,832
permissive
[ { "docstring": "Inserts ``key`` in the tree.", "name": "insert", "signature": "def insert(self, key)" }, { "docstring": "Deletes key ``key`` from the tree. :param delete_all: If true, deletes all the duplicate keys. Else deletes only a single occurrence of the key.", "name": "delete", "s...
2
stack_v2_sparse_classes_30k_train_018110
Implement the Python class `BinarySearchTreeDupKeys` described below. Class description: Represents a Binary Search Tree with duplicate keys. Method signatures and docstrings: - def insert(self, key): Inserts ``key`` in the tree. - def delete(self, key, delete_all=False): Deletes key ``key`` from the tree. :param del...
Implement the Python class `BinarySearchTreeDupKeys` described below. Class description: Represents a Binary Search Tree with duplicate keys. Method signatures and docstrings: - def insert(self, key): Inserts ``key`` in the tree. - def delete(self, key, delete_all=False): Deletes key ``key`` from the tree. :param del...
7e2e024cc55d7eb2ee2d205c912e184f1d32cfdf
<|skeleton|> class BinarySearchTreeDupKeys: """Represents a Binary Search Tree with duplicate keys.""" def insert(self, key): """Inserts ``key`` in the tree.""" <|body_0|> def delete(self, key, delete_all=False): """Deletes key ``key`` from the tree. :param delete_all: If true, del...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinarySearchTreeDupKeys: """Represents a Binary Search Tree with duplicate keys.""" def insert(self, key): """Inserts ``key`` in the tree.""" if not self._root: self._root = self._Node(key) else: node = self._root parent = None while...
the_stack_v2_python_sparse
ds/tree/binary_search_tree_with_dup.py
farnasirim/zahlen
train
0
a07e42c6c0007850394658455f3565be67e0fe20
[ "creator = kwargs.pop('creator', None)\nrecipients = kwargs.pop('recipients', None)\nalias = super().create(*args, **kwargs)\nif creator:\n alias.post_create(creator)\nif recipients:\n alias.set_recipients(recipients)\nreturn alias", "alias = self.get_queryset().filter(address=address, internal=False)\nif a...
<|body_start_0|> creator = kwargs.pop('creator', None) recipients = kwargs.pop('recipients', None) alias = super().create(*args, **kwargs) if creator: alias.post_create(creator) if recipients: alias.set_recipients(recipients) return alias <|end_bod...
Custom manager for Alias.
AliasManager
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AliasManager: """Custom manager for Alias.""" def create(self, *args, **kwargs): """Custom create method.""" <|body_0|> def modify_or_create(self, address, recipients, creator, domain): """Add recipient if the alias already exists or create it.""" <|body_...
stack_v2_sparse_classes_36k_train_011374
10,712
permissive
[ { "docstring": "Custom create method.", "name": "create", "signature": "def create(self, *args, **kwargs)" }, { "docstring": "Add recipient if the alias already exists or create it.", "name": "modify_or_create", "signature": "def modify_or_create(self, address, recipients, creator, domai...
2
null
Implement the Python class `AliasManager` described below. Class description: Custom manager for Alias. Method signatures and docstrings: - def create(self, *args, **kwargs): Custom create method. - def modify_or_create(self, address, recipients, creator, domain): Add recipient if the alias already exists or create i...
Implement the Python class `AliasManager` described below. Class description: Custom manager for Alias. Method signatures and docstrings: - def create(self, *args, **kwargs): Custom create method. - def modify_or_create(self, address, recipients, creator, domain): Add recipient if the alias already exists or create i...
df699aab0799ec1725b6b89be38e56285821c889
<|skeleton|> class AliasManager: """Custom manager for Alias.""" def create(self, *args, **kwargs): """Custom create method.""" <|body_0|> def modify_or_create(self, address, recipients, creator, domain): """Add recipient if the alias already exists or create it.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AliasManager: """Custom manager for Alias.""" def create(self, *args, **kwargs): """Custom create method.""" creator = kwargs.pop('creator', None) recipients = kwargs.pop('recipients', None) alias = super().create(*args, **kwargs) if creator: alias.post...
the_stack_v2_python_sparse
modoboa/admin/models/alias.py
modoboa/modoboa
train
2,201
3397315fe61aa64f683b1822e89cca8fcc20d0e5
[ "value = super(TaggitSelect2, self).value_from_datadict(data, files, name)\nif ',' not in value:\n value = '%s,' % value\nreturn value", "selected_choices_arg = 1 if VERSION < (1, 10) else 0\nselected_choices = args[selected_choices_arg]\nif isinstance(selected_choices, six.text_type):\n choices = [c.strip(...
<|body_start_0|> value = super(TaggitSelect2, self).value_from_datadict(data, files, name) if ',' not in value: value = '%s,' % value return value <|end_body_0|> <|body_start_1|> selected_choices_arg = 1 if VERSION < (1, 10) else 0 selected_choices = args[selected_ch...
Select2 tag widget for taggit's TagField.
TaggitSelect2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaggitSelect2: """Select2 tag widget for taggit's TagField.""" def value_from_datadict(self, data, files, name): """Handle multi-word tag. Insure there's a comma when there's only a single multi-word tag, or tag "Multi word" would end up as "Multi" and "word".""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_011375
1,412
permissive
[ { "docstring": "Handle multi-word tag. Insure there's a comma when there's only a single multi-word tag, or tag \"Multi word\" would end up as \"Multi\" and \"word\".", "name": "value_from_datadict", "signature": "def value_from_datadict(self, data, files, name)" }, { "docstring": "Render only s...
2
null
Implement the Python class `TaggitSelect2` described below. Class description: Select2 tag widget for taggit's TagField. Method signatures and docstrings: - def value_from_datadict(self, data, files, name): Handle multi-word tag. Insure there's a comma when there's only a single multi-word tag, or tag "Multi word" wo...
Implement the Python class `TaggitSelect2` described below. Class description: Select2 tag widget for taggit's TagField. Method signatures and docstrings: - def value_from_datadict(self, data, files, name): Handle multi-word tag. Insure there's a comma when there's only a single multi-word tag, or tag "Multi word" wo...
30121cb565fbc1b1dc844378a68cb38ca8bbf3cf
<|skeleton|> class TaggitSelect2: """Select2 tag widget for taggit's TagField.""" def value_from_datadict(self, data, files, name): """Handle multi-word tag. Insure there's a comma when there's only a single multi-word tag, or tag "Multi word" would end up as "Multi" and "word".""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaggitSelect2: """Select2 tag widget for taggit's TagField.""" def value_from_datadict(self, data, files, name): """Handle multi-word tag. Insure there's a comma when there's only a single multi-word tag, or tag "Multi word" would end up as "Multi" and "word".""" value = super(TaggitSelec...
the_stack_v2_python_sparse
annexes/django-autocomplete-light/src/dal_select2_taggit/widgets.py
pvergain/django-test-autocomplete
train
1
2edc20ef8018c6ad89c72a6a2684da90895a7860
[ "def post_order(root):\n return post_order(root.left) + post_order(root.right) + [root.val] if root else []\nreturn ' '.join(map(str, post_order(root)))", "post_order = [int(each) for each in data.split(' ') if data]\nprint(post_order)\n\ndef helper(lower=float('-inf'), upper=float('inf')):\n if not post_or...
<|body_start_0|> def post_order(root): return post_order(root.left) + post_order(root.right) + [root.val] if root else [] return ' '.join(map(str, post_order(root))) <|end_body_0|> <|body_start_1|> post_order = [int(each) for each in data.split(' ') if data] print(post_order...
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_36k_train_011376
2,184
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_019547
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:...
80cca595dc688ca67c1ebb45b339e724ec09c374
<|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_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def post_order(root): return post_order(root.left) + post_order(root.right) + [root.val] if root else [] return ' '.join(map(str, post_order(root))) def deserial...
the_stack_v2_python_sparse
Companies/Amazon/449.py
Dinesh94Singh/PythonArchivedSolutions
train
0
a50f4271fc20e2a88e1e5e78c85e2d6ad27dae22
[ "if server is None:\n self.server = 'https://archive.gemini.edu'\nelif not server.lower().startswith('http:') and (not server.lower().startswith('https:')):\n self.server = 'https://%s' % server\nelse:\n self.server = server", "qa_parm = ''\neng_parm = ''\nqa_parameters = ('NotFail', 'AnyQA', 'Pass', 'Lu...
<|body_start_0|> if server is None: self.server = 'https://archive.gemini.edu' elif not server.lower().startswith('http:') and (not server.lower().startswith('https:')): self.server = 'https://%s' % server else: self.server = server <|end_body_0|> <|body_star...
URLHelper
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class URLHelper: def __init__(self, server='https://archive.gemini.edu'): """Make a URL Helper for building URLs to the Gemini Archive REST service.""" <|body_0|> def build_url(self, *args, **kwargs): """Build a URL with the given args and kwargs as the query parameters. P...
stack_v2_sparse_classes_36k_train_011377
3,666
permissive
[ { "docstring": "Make a URL Helper for building URLs to the Gemini Archive REST service.", "name": "__init__", "signature": "def __init__(self, server='https://archive.gemini.edu')" }, { "docstring": "Build a URL with the given args and kwargs as the query parameters. Parameters ---------- args :...
2
null
Implement the Python class `URLHelper` described below. Class description: Implement the URLHelper class. Method signatures and docstrings: - def __init__(self, server='https://archive.gemini.edu'): Make a URL Helper for building URLs to the Gemini Archive REST service. - def build_url(self, *args, **kwargs): Build a...
Implement the Python class `URLHelper` described below. Class description: Implement the URLHelper class. Method signatures and docstrings: - def __init__(self, server='https://archive.gemini.edu'): Make a URL Helper for building URLs to the Gemini Archive REST service. - def build_url(self, *args, **kwargs): Build a...
51316d7417d7daf01a8b29d1df99037b9227c2bc
<|skeleton|> class URLHelper: def __init__(self, server='https://archive.gemini.edu'): """Make a URL Helper for building URLs to the Gemini Archive REST service.""" <|body_0|> def build_url(self, *args, **kwargs): """Build a URL with the given args and kwargs as the query parameters. P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class URLHelper: def __init__(self, server='https://archive.gemini.edu'): """Make a URL Helper for building URLs to the Gemini Archive REST service.""" if server is None: self.server = 'https://archive.gemini.edu' elif not server.lower().startswith('http:') and (not server.lower(...
the_stack_v2_python_sparse
astroquery/gemini/urlhelper.py
astropy/astroquery
train
636
a55dc6594227a004dd2dff0d2226e071150cc0fe
[ "print('Loading model')\npath = Models.modelPath('stackexchange')\ndbfile = os.path.join(path, 'questions.db')\ndb = sqlite3.connect(dbfile)\nembeddings = Embeddings()\nembeddings.load(path)\nreturn (db, embeddings)", "db, embeddings = StackExchange.load()\ncur = db.cursor()\nmrr = []\nwith open(Models.testPath('...
<|body_start_0|> print('Loading model') path = Models.modelPath('stackexchange') dbfile = os.path.join(path, 'questions.db') db = sqlite3.connect(dbfile) embeddings = Embeddings() embeddings.load(path) return (db, embeddings) <|end_body_0|> <|body_start_1|> ...
StackExchange query-answer dataset.
StackExchange
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StackExchange: """StackExchange query-answer dataset.""" def load(): """Loads a questions database and pre-trained embeddings model Returns: (db, embeddings)""" <|body_0|> def run(args): """Evaluates a pre-trained model against the StackExchange query-answer data...
stack_v2_sparse_classes_36k_train_011378
6,859
permissive
[ { "docstring": "Loads a questions database and pre-trained embeddings model Returns: (db, embeddings)", "name": "load", "signature": "def load()" }, { "docstring": "Evaluates a pre-trained model against the StackExchange query-answer dataset. Args: args: command line arguments", "name": "run...
2
stack_v2_sparse_classes_30k_train_012541
Implement the Python class `StackExchange` described below. Class description: StackExchange query-answer dataset. Method signatures and docstrings: - def load(): Loads a questions database and pre-trained embeddings model Returns: (db, embeddings) - def run(args): Evaluates a pre-trained model against the StackExcha...
Implement the Python class `StackExchange` described below. Class description: StackExchange query-answer dataset. Method signatures and docstrings: - def load(): Loads a questions database and pre-trained embeddings model Returns: (db, embeddings) - def run(args): Evaluates a pre-trained model against the StackExcha...
c1fde2fcb3cf830247131385ec5340e6a148e70a
<|skeleton|> class StackExchange: """StackExchange query-answer dataset.""" def load(): """Loads a questions database and pre-trained embeddings model Returns: (db, embeddings)""" <|body_0|> def run(args): """Evaluates a pre-trained model against the StackExchange query-answer data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StackExchange: """StackExchange query-answer dataset.""" def load(): """Loads a questions database and pre-trained embeddings model Returns: (db, embeddings)""" print('Loading model') path = Models.modelPath('stackexchange') dbfile = os.path.join(path, 'questions.db') ...
the_stack_v2_python_sparse
src/python/codequestion/evaluate.py
spreck/codequestion
train
0
ba4a872bb84d469d6ab3cb06db8f31c7bd36808c
[ "_action_class = City()\nif 'ibi_cities' in params and 'ibi_districts' in params:\n _city = params['ibi_cities'].lower()\n _district = params['ibi_districts']\n return getattr(_action_class, _city)(_district)\nelse:\n return getattr(_action_class, 'guaiba')('centro')", "_address = Address()\napp.logge...
<|body_start_0|> _action_class = City() if 'ibi_cities' in params and 'ibi_districts' in params: _city = params['ibi_cities'].lower() _district = params['ibi_districts'] return getattr(_action_class, _city)(_district) else: return getattr(_action_c...
Handle the intents resposes by action names
Actions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Actions: """Handle the intents resposes by action names""" def ask_cells_cities(self, params, outputContexts, IntentRequest): """Return the list of Cell addresses by city and district""" <|body_0|> def ask_cells_cities_select_address(self, params, outputContexts, IntentR...
stack_v2_sparse_classes_36k_train_011379
1,284
no_license
[ { "docstring": "Return the list of Cell addresses by city and district", "name": "ask_cells_cities", "signature": "def ask_cells_cities(self, params, outputContexts, IntentRequest)" }, { "docstring": "Return the map link for the selected address", "name": "ask_cells_cities_select_address", ...
2
stack_v2_sparse_classes_30k_train_008782
Implement the Python class `Actions` described below. Class description: Handle the intents resposes by action names Method signatures and docstrings: - def ask_cells_cities(self, params, outputContexts, IntentRequest): Return the list of Cell addresses by city and district - def ask_cells_cities_select_address(self,...
Implement the Python class `Actions` described below. Class description: Handle the intents resposes by action names Method signatures and docstrings: - def ask_cells_cities(self, params, outputContexts, IntentRequest): Return the list of Cell addresses by city and district - def ask_cells_cities_select_address(self,...
29da21469c8e78b3374f5e5237067a97107e02d2
<|skeleton|> class Actions: """Handle the intents resposes by action names""" def ask_cells_cities(self, params, outputContexts, IntentRequest): """Return the list of Cell addresses by city and district""" <|body_0|> def ask_cells_cities_select_address(self, params, outputContexts, IntentR...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Actions: """Handle the intents resposes by action names""" def ask_cells_cities(self, params, outputContexts, IntentRequest): """Return the list of Cell addresses by city and district""" _action_class = City() if 'ibi_cities' in params and 'ibi_districts' in params: _c...
the_stack_v2_python_sparse
actions/actions.py
douglasmoraisdev/ibi_chatbot
train
0
cd6e3a9d90c76280ad510d9320df2e8d4bb86b88
[ "self._process = None\nself._nm = PortScanner()\nreturn", "if self._process is not None:\n try:\n if self._process.is_alive():\n self._process.terminate()\n except AssertionError:\n pass\nself._process = None\nreturn", "if sys.version_info[0] == 2:\n assert type(hosts) in (str,...
<|body_start_0|> self._process = None self._nm = PortScanner() return <|end_body_0|> <|body_start_1|> if self._process is not None: try: if self._process.is_alive(): self._process.terminate() except AssertionError: ...
PortScannerAsync allows to use nmap from python asynchronously for each host scanned, callback is called with scan result for the host
PortScannerAsync
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PortScannerAsync: """PortScannerAsync allows to use nmap from python asynchronously for each host scanned, callback is called with scan result for the host""" def __init__(self): """Initialize the module * detects nmap on the system and nmap version * may raise PortScannerError excep...
stack_v2_sparse_classes_36k_train_011380
40,862
permissive
[ { "docstring": "Initialize the module * detects nmap on the system and nmap version * may raise PortScannerError exception if nmap is not found in the path", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Cleanup when deleted", "name": "__del__", "signature": "d...
6
null
Implement the Python class `PortScannerAsync` described below. Class description: PortScannerAsync allows to use nmap from python asynchronously for each host scanned, callback is called with scan result for the host Method signatures and docstrings: - def __init__(self): Initialize the module * detects nmap on the s...
Implement the Python class `PortScannerAsync` described below. Class description: PortScannerAsync allows to use nmap from python asynchronously for each host scanned, callback is called with scan result for the host Method signatures and docstrings: - def __init__(self): Initialize the module * detects nmap on the s...
fadb1136b8896fe2a0f7783627bda867d5e6fd98
<|skeleton|> class PortScannerAsync: """PortScannerAsync allows to use nmap from python asynchronously for each host scanned, callback is called with scan result for the host""" def __init__(self): """Initialize the module * detects nmap on the system and nmap version * may raise PortScannerError excep...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PortScannerAsync: """PortScannerAsync allows to use nmap from python asynchronously for each host scanned, callback is called with scan result for the host""" def __init__(self): """Initialize the module * detects nmap on the system and nmap version * may raise PortScannerError exception if nmap ...
the_stack_v2_python_sparse
fuxi/common/libs/nmap.py
Solotov/fuxi
train
0
0e691ac7febb18c3510ed79ef05ee2592ef4e926
[ "super(CBHG, self).__init__()\nself.hidden_size = hidden_size\nself.projection_size = projection_size\nself.convbank_list = nn.ModuleList()\nself.convbank_list.append(nn.Conv1d(in_channels=projection_size, out_channels=hidden_size, kernel_size=1, padding=int(np.floor(1 / 2))))\nfor i in range(2, K + 1):\n self.c...
<|body_start_0|> super(CBHG, self).__init__() self.hidden_size = hidden_size self.projection_size = projection_size self.convbank_list = nn.ModuleList() self.convbank_list.append(nn.Conv1d(in_channels=projection_size, out_channels=hidden_size, kernel_size=1, padding=int(np.floor(...
CBHG Module.
CBHG
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CBHG: """CBHG Module.""" def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False): """init.""" <|body_0|> def _conv_fit_dim(self, x, kernel_size=3): """_conv_fit_dim.""" <|body_1|> def forwar...
stack_v2_sparse_classes_36k_train_011381
17,934
permissive
[ { "docstring": "init.", "name": "__init__", "signature": "def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False)" }, { "docstring": "_conv_fit_dim.", "name": "_conv_fit_dim", "signature": "def _conv_fit_dim(self, x, kernel_size...
3
null
Implement the Python class `CBHG` described below. Class description: CBHG Module. Method signatures and docstrings: - def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False): init. - def _conv_fit_dim(self, x, kernel_size=3): _conv_fit_dim. - def forward(se...
Implement the Python class `CBHG` described below. Class description: CBHG Module. Method signatures and docstrings: - def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False): init. - def _conv_fit_dim(self, x, kernel_size=3): _conv_fit_dim. - def forward(se...
31d50b1ea1dea92f4182c5b2b6fe9fe4c981ae39
<|skeleton|> class CBHG: """CBHG Module.""" def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False): """init.""" <|body_0|> def _conv_fit_dim(self, x, kernel_size=3): """_conv_fit_dim.""" <|body_1|> def forwar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CBHG: """CBHG Module.""" def __init__(self, hidden_size, K=16, projection_size=256, num_gru_layers=2, max_pool_kernel_size=2, is_post=False): """init.""" super(CBHG, self).__init__() self.hidden_size = hidden_size self.projection_size = projection_size self.convban...
the_stack_v2_python_sparse
SVS/model/layers/pretrain_module.py
SJTMusicTeam/SVS_system
train
85
0c537649fc89f3a6db7c05b8ef1c75265fe7524d
[ "reflection_table = SumIntensityReducer.reduce_on_intensities(reflection_table)\nreflection_table = ScaleIntensityReducer.reduce_on_intensities(reflection_table)\nreturn reflection_table", "reflection_table = SumIntensityReducer.apply_scaling_factors(reflection_table)\nreflection_table = ScaleIntensityReducer.app...
<|body_start_0|> reflection_table = SumIntensityReducer.reduce_on_intensities(reflection_table) reflection_table = ScaleIntensityReducer.reduce_on_intensities(reflection_table) return reflection_table <|end_body_0|> <|body_start_1|> reflection_table = SumIntensityReducer.apply_scaling_f...
Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained.
SumAndScaleIntensityReducer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SumAndScaleIntensityReducer: """Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select those with valid reflections for all values.""" <|body...
stack_v2_sparse_classes_36k_train_011382
38,270
permissive
[ { "docstring": "Select those with valid reflections for all values.", "name": "reduce_on_intensities", "signature": "def reduce_on_intensities(reflection_table)" }, { "docstring": "Apply corrections to the intensities and variances.", "name": "apply_scaling_factors", "signature": "def ap...
2
null
Implement the Python class `SumAndScaleIntensityReducer` described below. Class description: Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): Select those...
Implement the Python class `SumAndScaleIntensityReducer` described below. Class description: Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): Select those...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class SumAndScaleIntensityReducer: """Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select those with valid reflections for all values.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SumAndScaleIntensityReducer: """Reduction methods for data with sum and scale intensities. Only reflections with valid values for all intensity types are retained.""" def reduce_on_intensities(reflection_table): """Select those with valid reflections for all values.""" reflection_table = ...
the_stack_v2_python_sparse
src/dials/util/filter_reflections.py
dials/dials
train
71
dbf4c6bb8984a5fb75df28f25a3c3cdad35c4ce1
[ "super(Res18, self).__init__(name=name)\nself._output_size = num_outputs\nself._conv_channels = 64\nself._conv_kernel_shape = [7, 7]\nself._conv_stride = 2\nself._pooling_kernel_shape = [2, 2]\nself._pooling_stride = 2\nself._resunit_channels = [64, 64, 128, 128, 256, 256, 512, 512]\nself._num_resunits = len(self._...
<|body_start_0|> super(Res18, self).__init__(name=name) self._output_size = num_outputs self._conv_channels = 64 self._conv_kernel_shape = [7, 7] self._conv_stride = 2 self._pooling_kernel_shape = [2, 2] self._pooling_stride = 2 self._resunit_channels = [6...
Res18
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Res18: def __init__(self, num_outputs, name='res18', activation=tf.nn.relu, **extra_params): """Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_params: all the additional key...
stack_v2_sparse_classes_36k_train_011383
48,282
permissive
[ { "docstring": "Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_params: all the additional keyword arguments will be passed to all the snt.Conv2D and to the ResUnit layers.", "name": "__init__",...
2
stack_v2_sparse_classes_30k_train_008104
Implement the Python class `Res18` described below. Class description: Implement the Res18 class. Method signatures and docstrings: - def __init__(self, num_outputs, name='res18', activation=tf.nn.relu, **extra_params): Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation ...
Implement the Python class `Res18` described below. Class description: Implement the Res18 class. Method signatures and docstrings: - def __init__(self, num_outputs, name='res18', activation=tf.nn.relu, **extra_params): Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation ...
a10c33346803239db8a64c104db7f22ec4e05bef
<|skeleton|> class Res18: def __init__(self, num_outputs, name='res18', activation=tf.nn.relu, **extra_params): """Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_params: all the additional key...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Res18: def __init__(self, num_outputs, name='res18', activation=tf.nn.relu, **extra_params): """Args: num_outputs (int): the number of outputs of the module. name (str): module name. activation (tf function): activation used for the internal layers. **extra_params: all the additional keyword arguments...
the_stack_v2_python_sparse
argo/core/utils/utils_modules.py
ricvo/argo
train
0
fc7185e1a1f2145302ffafc4bffe2b5cb5a15e44
[ "if not self.base_directory.exists():\n raise TestConnectionError(f'Path: {self.base_directory.resolve()} does not exist.')\nif self.assets and test_assets:\n for asset in self.assets:\n asset.test_connection()", "if kwargs:\n raise TypeError(f'_build_data_connector() got unexpected keyword argume...
<|body_start_0|> if not self.base_directory.exists(): raise TestConnectionError(f'Path: {self.base_directory.resolve()} does not exist.') if self.assets and test_assets: for asset in self.assets: asset.test_connection() <|end_body_0|> <|body_start_1|> if ...
Pandas based Datasource for filesystem based data assets.
PandasFilesystemDatasource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PandasFilesystemDatasource: """Pandas based Datasource for filesystem based data assets.""" def test_connection(self, test_assets: bool=True) -> None: """Test the connection for the PandasFilesystemDatasource. Args: test_assets: If assets have been passed to the PandasFilesystemDatas...
stack_v2_sparse_classes_36k_train_011384
3,249
permissive
[ { "docstring": "Test the connection for the PandasFilesystemDatasource. Args: test_assets: If assets have been passed to the PandasFilesystemDatasource, whether to test them as well. Raises: TestConnectionError: If the connection test fails.", "name": "test_connection", "signature": "def test_connection...
2
stack_v2_sparse_classes_30k_train_012021
Implement the Python class `PandasFilesystemDatasource` described below. Class description: Pandas based Datasource for filesystem based data assets. Method signatures and docstrings: - def test_connection(self, test_assets: bool=True) -> None: Test the connection for the PandasFilesystemDatasource. Args: test_assets...
Implement the Python class `PandasFilesystemDatasource` described below. Class description: Pandas based Datasource for filesystem based data assets. Method signatures and docstrings: - def test_connection(self, test_assets: bool=True) -> None: Test the connection for the PandasFilesystemDatasource. Args: test_assets...
b0290e2fd2aa05aec6d7d8871b91cb4478e9501d
<|skeleton|> class PandasFilesystemDatasource: """Pandas based Datasource for filesystem based data assets.""" def test_connection(self, test_assets: bool=True) -> None: """Test the connection for the PandasFilesystemDatasource. Args: test_assets: If assets have been passed to the PandasFilesystemDatas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PandasFilesystemDatasource: """Pandas based Datasource for filesystem based data assets.""" def test_connection(self, test_assets: bool=True) -> None: """Test the connection for the PandasFilesystemDatasource. Args: test_assets: If assets have been passed to the PandasFilesystemDatasource, whethe...
the_stack_v2_python_sparse
great_expectations/datasource/fluent/pandas_filesystem_datasource.py
great-expectations/great_expectations
train
8,931
0769599800cc91095a265ff51bddb05899892966
[ "ans = []\n\ndef dfs(root):\n if not root:\n ans.append('#')\n return\n ans.append(str(root.val))\n dfs(root.left)\n dfs(root.right)\ndfs(root)\nreturn ' '.join(ans)", "def convert_str_to_iterator(source, seperator):\n start, seperator_size, index = (0, len(seperator), 0)\n while T...
<|body_start_0|> ans = [] def dfs(root): if not root: ans.append('#') return ans.append(str(root.val)) dfs(root.left) dfs(root.right) dfs(root) return ' '.join(ans) <|end_body_0|> <|body_start_1|> d...
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_36k_train_011385
1,573
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_010376
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:...
d66be3a8f002875097754df6138c704e28b79810
<|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_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" ans = [] def dfs(root): if not root: ans.append('#') return ans.append(str(root.val)) dfs(root.left) ...
the_stack_v2_python_sparse
449_Serialize_and_Deserialize_BST/serialize_and_deserialize_bst.py
Brady31027/leetcode
train
4
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_36k_train_011386
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_002345
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_36k
data/stack_v2_sparse_classes_30k
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
f5ef94c60d4a8e75ab09155905dd41f3d1ec9754
[ "if _cfg.server_backend == 'cassandra':\n clear_graph()\nelse:\n Gremlin().gremlin_post('graph.truncateBackend();')\nInsertData(gremlin='gremlin_alg_03.txt').gremlin_graph()", "body = {}\ncode, res = Algorithm().post_count_vertex(body, auth=auth)\nid = res['task_id']\nif id > 0:\n result = get_task_res(i...
<|body_start_0|> if _cfg.server_backend == 'cassandra': clear_graph() else: Gremlin().gremlin_post('graph.truncateBackend();') InsertData(gremlin='gremlin_alg_03.txt').gremlin_graph() <|end_body_0|> <|body_start_1|> body = {} code, res = Algorithm().post_...
接口count_vertex:统计顶点信息,包括图中顶点数量、各类型的顶点数量
TestCountVertex
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCountVertex: """接口count_vertex:统计顶点信息,包括图中顶点数量、各类型的顶点数量""" def setup_class(self): """测试类开始""" <|body_0|> def test_count_vertex(self): """统计顶点信息接口 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if _cfg.server_backend == 'cassandra':...
stack_v2_sparse_classes_36k_train_011387
1,518
no_license
[ { "docstring": "测试类开始", "name": "setup_class", "signature": "def setup_class(self)" }, { "docstring": "统计顶点信息接口 :return:", "name": "test_count_vertex", "signature": "def test_count_vertex(self)" } ]
2
stack_v2_sparse_classes_30k_train_012708
Implement the Python class `TestCountVertex` described below. Class description: 接口count_vertex:统计顶点信息,包括图中顶点数量、各类型的顶点数量 Method signatures and docstrings: - def setup_class(self): 测试类开始 - def test_count_vertex(self): 统计顶点信息接口 :return:
Implement the Python class `TestCountVertex` described below. Class description: 接口count_vertex:统计顶点信息,包括图中顶点数量、各类型的顶点数量 Method signatures and docstrings: - def setup_class(self): 测试类开始 - def test_count_vertex(self): 统计顶点信息接口 :return: <|skeleton|> class TestCountVertex: """接口count_vertex:统计顶点信息,包括图中顶点数量、各类型的顶点数量...
89e5b34ab925bcc0bbc4ad63302e96c62a420399
<|skeleton|> class TestCountVertex: """接口count_vertex:统计顶点信息,包括图中顶点数量、各类型的顶点数量""" def setup_class(self): """测试类开始""" <|body_0|> def test_count_vertex(self): """统计顶点信息接口 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCountVertex: """接口count_vertex:统计顶点信息,包括图中顶点数量、各类型的顶点数量""" def setup_class(self): """测试类开始""" if _cfg.server_backend == 'cassandra': clear_graph() else: Gremlin().gremlin_post('graph.truncateBackend();') InsertData(gremlin='gremlin_alg_03.txt')....
the_stack_v2_python_sparse
src/graph_function_test/server/algorithm_olap/test_countVertex.py
hugegraph/hugegraph-test
train
1
cf65cddbaf6ce41b97ee54d624d8a2053aa1df90
[ "self.pyr_scale = pyr_scale\nself.levels = levels\nself.winsize = winsize\nself.iterations = iterations\nself.poly_n = poly_n\nself.poly_sigma = poly_sigma\nself.motion_image = None\nself.magnitude_image = None\nself.direction_image = None", "hsv = np.zeros((prev.shape[0], prev.shape[1], 3))\nhsv[..., 1] = 255\nf...
<|body_start_0|> self.pyr_scale = pyr_scale self.levels = levels self.winsize = winsize self.iterations = iterations self.poly_n = poly_n self.poly_sigma = poly_sigma self.motion_image = None self.magnitude_image = None self.direction_image = None ...
Farneback
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Farneback: def __init__(self, pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0): """Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0) Initializes the object that comput...
stack_v2_sparse_classes_36k_train_011388
3,952
no_license
[ { "docstring": "Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0) Initializes the object that computes a dense optical flow using the Gunnar Farneback’s algorithm. :param float pyr_scale: scaling factor between images i...
2
stack_v2_sparse_classes_30k_train_003880
Implement the Python class `Farneback` described below. Class description: Implement the Farneback class. Method signatures and docstrings: - def __init__(self, pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0): Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5...
Implement the Python class `Farneback` described below. Class description: Implement the Farneback class. Method signatures and docstrings: - def __init__(self, pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0): Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5...
90531055691a094dd271966b53c40b7a097df375
<|skeleton|> class Farneback: def __init__(self, pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0): """Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0) Initializes the object that comput...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Farneback: def __init__(self, pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0): """Function definition +++++++++++++++++++ .. py:function:: __init__(pyr_scale=0.5, levels=3, winsize=15, iterations=3, poly_n=1.2, poly_sigma=0) Initializes the object that computes a dense opt...
the_stack_v2_python_sparse
OpticalFlow/Dense/Farneback.py
kmakantasis/CV-Tools
train
0
750fb9e3e815e77fcb53e48ce80482bc61ee3088
[ "try:\n time.sleep(5)\n tv_vips = driver.find_elements_by_id('com.chtwm.mall:id/tv_vip')\n for i in tv_vips:\n if i.text == vipnames:\n with allure.step('点击\"%s\"按钮' % vipnames):\n i.click()\n break\nexcept Exception as e:\n print('%s报错:' % vipnames, e)", "n...
<|body_start_0|> try: time.sleep(5) tv_vips = driver.find_elements_by_id('com.chtwm.mall:id/tv_vip') for i in tv_vips: if i.text == vipnames: with allure.step('点击"%s"按钮' % vipnames): i.click() bre...
AllEquitys
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AllEquitys: def EveryEquitys(driver, vipnames): """:param vipnames: 传入权益内容名称 :return:""" <|body_0|> def EveryEquitys_CheckPoint(driver, vipnames): """:param vipnames: 传入权益内容名称 :return: pytest结果""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: ...
stack_v2_sparse_classes_36k_train_011389
1,553
no_license
[ { "docstring": ":param vipnames: 传入权益内容名称 :return:", "name": "EveryEquitys", "signature": "def EveryEquitys(driver, vipnames)" }, { "docstring": ":param vipnames: 传入权益内容名称 :return: pytest结果", "name": "EveryEquitys_CheckPoint", "signature": "def EveryEquitys_CheckPoint(driver, vipnames)" ...
2
null
Implement the Python class `AllEquitys` described below. Class description: Implement the AllEquitys class. Method signatures and docstrings: - def EveryEquitys(driver, vipnames): :param vipnames: 传入权益内容名称 :return: - def EveryEquitys_CheckPoint(driver, vipnames): :param vipnames: 传入权益内容名称 :return: pytest结果
Implement the Python class `AllEquitys` described below. Class description: Implement the AllEquitys class. Method signatures and docstrings: - def EveryEquitys(driver, vipnames): :param vipnames: 传入权益内容名称 :return: - def EveryEquitys_CheckPoint(driver, vipnames): :param vipnames: 传入权益内容名称 :return: pytest结果 <|skeleto...
618a47ea572f8fccfbf10f5f50aff1dfffb7b0e3
<|skeleton|> class AllEquitys: def EveryEquitys(driver, vipnames): """:param vipnames: 传入权益内容名称 :return:""" <|body_0|> def EveryEquitys_CheckPoint(driver, vipnames): """:param vipnames: 传入权益内容名称 :return: pytest结果""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AllEquitys: def EveryEquitys(driver, vipnames): """:param vipnames: 传入权益内容名称 :return:""" try: time.sleep(5) tv_vips = driver.find_elements_by_id('com.chtwm.mall:id/tv_vip') for i in tv_vips: if i.text == vipnames: with all...
the_stack_v2_python_sparse
Appium/HengTianCaiFu_Android/ReleasePage/Case013_AllEquitys.py
Fengyongming0311/TANUKI
train
0
0699626f2e02e98e80728c051a0a7a4d7c081d86
[ "super().__init__()\nself.w1 = Parameter(shape=[out_channels, in_channels], dtype=dtype)\nself.w2 = Parameter(shape=[out_channels, in_channels], dtype=dtype)\nif fast_gelu:\n self.op = ops.dual_gemm_rcr_fast_gelu()\nelse:\n self.op = ops.dual_gemm_rcr_silu()", "assert len(args) == 1\nx = args[0]\nreturn sel...
<|body_start_0|> super().__init__() self.w1 = Parameter(shape=[out_channels, in_channels], dtype=dtype) self.w2 = Parameter(shape=[out_channels, in_channels], dtype=dtype) if fast_gelu: self.op = ops.dual_gemm_rcr_fast_gelu() else: self.op = ops.dual_gemm_...
DualGemm frontend
DualGemm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DualGemm: """DualGemm frontend""" def __init__(self, in_channels, out_channels, fast_gelu=True, dtype='float16'): """Initialize dual gemm module, create a tensor for weights""" <|body_0|> def forward(self, *args): """forward pass for calling attention op""" ...
stack_v2_sparse_classes_36k_train_011390
2,504
permissive
[ { "docstring": "Initialize dual gemm module, create a tensor for weights", "name": "__init__", "signature": "def __init__(self, in_channels, out_channels, fast_gelu=True, dtype='float16')" }, { "docstring": "forward pass for calling attention op", "name": "forward", "signature": "def for...
2
null
Implement the Python class `DualGemm` described below. Class description: DualGemm frontend Method signatures and docstrings: - def __init__(self, in_channels, out_channels, fast_gelu=True, dtype='float16'): Initialize dual gemm module, create a tensor for weights - def forward(self, *args): forward pass for calling ...
Implement the Python class `DualGemm` described below. Class description: DualGemm frontend Method signatures and docstrings: - def __init__(self, in_channels, out_channels, fast_gelu=True, dtype='float16'): Initialize dual gemm module, create a tensor for weights - def forward(self, *args): forward pass for calling ...
c60dc19788217556ba12ea378c02b9fd0aea9ffe
<|skeleton|> class DualGemm: """DualGemm frontend""" def __init__(self, in_channels, out_channels, fast_gelu=True, dtype='float16'): """Initialize dual gemm module, create a tensor for weights""" <|body_0|> def forward(self, *args): """forward pass for calling attention op""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DualGemm: """DualGemm frontend""" def __init__(self, in_channels, out_channels, fast_gelu=True, dtype='float16'): """Initialize dual gemm module, create a tensor for weights""" super().__init__() self.w1 = Parameter(shape=[out_channels, in_channels], dtype=dtype) self.w2 =...
the_stack_v2_python_sparse
python/aitemplate/frontend/nn/dual_gemm.py
facebookincubator/AITemplate
train
4,065
bf9e32eb8dcede249c2534219c0c72518eea1c2f
[ "Fruit.__init__(self)\nself._flower_duration = flower_duration\nself._max_relative_growth_rate = max_relative_growth_rate\nself._lost_time = lost_time\nself._max_age = max_age\nself._probability = probability\nself._max_absolute_growth_rate = max_absolute_growth_rate\nself._r = self._max_absolute_growth_rate / self...
<|body_start_0|> Fruit.__init__(self) self._flower_duration = flower_duration self._max_relative_growth_rate = max_relative_growth_rate self._lost_time = lost_time self._max_age = max_age self._probability = probability self._max_absolute_growth_rate = max_absolut...
A specialised fruit class for apple trees This class inherits methods and attributes from :class:`~openalea.stocatree.fruit.Fruit` and specialises the :meth:`compute_mass` method. >>> fruit = AppleFruit(max_age=100., flower_duration=12.) >>> fruit.state 'flower' >>> fruit.age 0 >>> fruit.mass 0.0 >>> fruit._flower_dura...
AppleFruit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppleFruit: """A specialised fruit class for apple trees This class inherits methods and attributes from :class:`~openalea.stocatree.fruit.Fruit` and specialises the :meth:`compute_mass` method. >>> fruit = AppleFruit(max_age=100., flower_duration=12.) >>> fruit.state 'flower' >>> fruit.age 0 >>>...
stack_v2_sparse_classes_36k_train_011391
6,591
no_license
[ { "docstring": "**Construtor** Inherits :meth:`get_state`, :meth:`set_state` from :class:`Fruit` class. The method :meth:`compute_mass` is redefined. The following arguments may be provided and are specific to apple trees. There are mainly used to compute the mass of the fruit as a function of its age except fo...
2
stack_v2_sparse_classes_30k_train_001497
Implement the Python class `AppleFruit` described below. Class description: A specialised fruit class for apple trees This class inherits methods and attributes from :class:`~openalea.stocatree.fruit.Fruit` and specialises the :meth:`compute_mass` method. >>> fruit = AppleFruit(max_age=100., flower_duration=12.) >>> f...
Implement the Python class `AppleFruit` described below. Class description: A specialised fruit class for apple trees This class inherits methods and attributes from :class:`~openalea.stocatree.fruit.Fruit` and specialises the :meth:`compute_mass` method. >>> fruit = AppleFruit(max_age=100., flower_duration=12.) >>> f...
090370f08271455f6c1b89592a0b7eb18212a6c9
<|skeleton|> class AppleFruit: """A specialised fruit class for apple trees This class inherits methods and attributes from :class:`~openalea.stocatree.fruit.Fruit` and specialises the :meth:`compute_mass` method. >>> fruit = AppleFruit(max_age=100., flower_duration=12.) >>> fruit.state 'flower' >>> fruit.age 0 >>>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppleFruit: """A specialised fruit class for apple trees This class inherits methods and attributes from :class:`~openalea.stocatree.fruit.Fruit` and specialises the :meth:`compute_mass` method. >>> fruit = AppleFruit(max_age=100., flower_duration=12.) >>> fruit.state 'flower' >>> fruit.age 0 >>> fruit.mass 0...
the_stack_v2_python_sparse
src/openalea/stocatree/fruit.py
junqi108/MAppleT
train
0
e3f2aa4ce039371e682022384151e6cd098e0813
[ "try:\n json_data = json.loads(request.data.decode())\n firewallController.add_whitelist_url(json_data)\n return Response(status=202)\nexcept Exception as err:\n return Response(json.dumps(str(err)), status=500, mimetype='application/json')", "try:\n json_data = json.dumps(firewallController.get_wh...
<|body_start_0|> try: json_data = json.loads(request.data.decode()) firewallController.add_whitelist_url(json_data) return Response(status=202) except Exception as err: return Response(json.dumps(str(err)), status=500, mimetype='application/json') <|end_bo...
Whitelist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Whitelist: def post(self): """Add an url to the whitelist""" <|body_0|> def get(self): """Get all the urls from the whitelist""" <|body_1|> def delete(self, id): """Remove an url from the whitelist""" <|body_2|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_011392
2,162
no_license
[ { "docstring": "Add an url to the whitelist", "name": "post", "signature": "def post(self)" }, { "docstring": "Get all the urls from the whitelist", "name": "get", "signature": "def get(self)" }, { "docstring": "Remove an url from the whitelist", "name": "delete", "signat...
3
null
Implement the Python class `Whitelist` described below. Class description: Implement the Whitelist class. Method signatures and docstrings: - def post(self): Add an url to the whitelist - def get(self): Get all the urls from the whitelist - def delete(self, id): Remove an url from the whitelist
Implement the Python class `Whitelist` described below. Class description: Implement the Whitelist class. Method signatures and docstrings: - def post(self): Add an url to the whitelist - def get(self): Get all the urls from the whitelist - def delete(self, id): Remove an url from the whitelist <|skeleton|> class Wh...
6070e3cb6bf957e04f5d8267db11f3296410e18e
<|skeleton|> class Whitelist: def post(self): """Add an url to the whitelist""" <|body_0|> def get(self): """Get all the urls from the whitelist""" <|body_1|> def delete(self, id): """Remove an url from the whitelist""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Whitelist: def post(self): """Add an url to the whitelist""" try: json_data = json.loads(request.data.decode()) firewallController.add_whitelist_url(json_data) return Response(status=202) except Exception as err: return Response(json.dump...
the_stack_v2_python_sparse
configuration-agent/firewall/rest_api/resources/whitelist.py
ReliableLion/frog4-configurable-vnf
train
0
90e91b39492215f3cb8f4f64052bf392ef086be5
[ "if not prices:\n return 0\ndp = [[0] * (2 + 1) for _ in range(len(prices))]\nfor k in range(1, 3):\n for i in range(1, len(prices)):\n temp = prices[i] - prices[0]\n for j in range(1, i):\n temp = max(temp, prices[i] - prices[j] + dp[j - 1][k - 1])\n dp[i][k] = max(dp[i - 1][k...
<|body_start_0|> if not prices: return 0 dp = [[0] * (2 + 1) for _ in range(len(prices))] for k in range(1, 3): for i in range(1, len(prices)): temp = prices[i] - prices[0] for j in range(1, i): temp = max(temp, prices[i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit_1(self, prices: List[int]) -> int: """FIXME: 超时 动态规划,辅助数组: dp[i][1] 表示前 i 天内 1 笔交易的最大利润 dp[i][2] 表示前 i 天内 2 笔交易的最大利润 - 第 i 天无动作, 则 dp[i][2] = dp[i-1][2] - 第 i 天卖出,则必须在第 j 天买入,此时利润 prices[i] - prices[j] + dp[j - 1][1]""" <|body_0|> def maxProfit(self, ...
stack_v2_sparse_classes_36k_train_011393
3,489
no_license
[ { "docstring": "FIXME: 超时 动态规划,辅助数组: dp[i][1] 表示前 i 天内 1 笔交易的最大利润 dp[i][2] 表示前 i 天内 2 笔交易的最大利润 - 第 i 天无动作, 则 dp[i][2] = dp[i-1][2] - 第 i 天卖出,则必须在第 j 天买入,此时利润 prices[i] - prices[j] + dp[j - 1][1]", "name": "maxProfit_1", "signature": "def maxProfit_1(self, prices: List[int]) -> int" }, { "docstri...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit_1(self, prices: List[int]) -> int: FIXME: 超时 动态规划,辅助数组: dp[i][1] 表示前 i 天内 1 笔交易的最大利润 dp[i][2] 表示前 i 天内 2 笔交易的最大利润 - 第 i 天无动作, 则 dp[i][2] = dp[i-1][2] - 第 i 天卖出,则必须在...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit_1(self, prices: List[int]) -> int: FIXME: 超时 动态规划,辅助数组: dp[i][1] 表示前 i 天内 1 笔交易的最大利润 dp[i][2] 表示前 i 天内 2 笔交易的最大利润 - 第 i 天无动作, 则 dp[i][2] = dp[i-1][2] - 第 i 天卖出,则必须在...
4732fb80710a08a715c3e7080c394f5298b8326d
<|skeleton|> class Solution: def maxProfit_1(self, prices: List[int]) -> int: """FIXME: 超时 动态规划,辅助数组: dp[i][1] 表示前 i 天内 1 笔交易的最大利润 dp[i][2] 表示前 i 天内 2 笔交易的最大利润 - 第 i 天无动作, 则 dp[i][2] = dp[i-1][2] - 第 i 天卖出,则必须在第 j 天买入,此时利润 prices[i] - prices[j] + dp[j - 1][1]""" <|body_0|> def maxProfit(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit_1(self, prices: List[int]) -> int: """FIXME: 超时 动态规划,辅助数组: dp[i][1] 表示前 i 天内 1 笔交易的最大利润 dp[i][2] 表示前 i 天内 2 笔交易的最大利润 - 第 i 天无动作, 则 dp[i][2] = dp[i-1][2] - 第 i 天卖出,则必须在第 j 天买入,此时利润 prices[i] - prices[j] + dp[j - 1][1]""" if not prices: return 0 dp = [...
the_stack_v2_python_sparse
.leetcode/123.买卖股票的最佳时机-iii.py
xiaoruijiang/algorithm
train
0
20280acddbb2d2e90906b0e7982b797cde17bf1b
[ "self.__object2MatrixFunction = object2MatrixFunction\nself.__distanceBetween2Objects = distanceBetween2Objects\nself.__embedding_dim = embedding_dim\nself.__feature_dim = feature_dim\nself.corpus = None", "n = len(batch1)\nscores = np.zeros(n * (n - 1) / 2, dtype=np.float32)\ndata = np.zeros((n * (n - 1) / 2, se...
<|body_start_0|> self.__object2MatrixFunction = object2MatrixFunction self.__distanceBetween2Objects = distanceBetween2Objects self.__embedding_dim = embedding_dim self.__feature_dim = feature_dim self.corpus = None <|end_body_0|> <|body_start_1|> n = len(batch1) ...
For processing one batch of objects that are stored in memory
ProcessInMemoryBatch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProcessInMemoryBatch: """For processing one batch of objects that are stored in memory""" def __init__(self, object2MatrixFunction, distanceBetween2Objects, embedding_dim, feature_dim): """:param object2MatrixFunction: function that takes an object and creates an embedding as 2D nump...
stack_v2_sparse_classes_36k_train_011394
16,335
no_license
[ { "docstring": ":param object2MatrixFunction: function that takes an object and creates an embedding as 2D numpy array of the object :param distanceBetween2Objects: function that takes two objects and returns the distance :param embedding_dim: the dimension of raw object embedding :param feature_dim: the number...
4
stack_v2_sparse_classes_30k_train_002092
Implement the Python class `ProcessInMemoryBatch` described below. Class description: For processing one batch of objects that are stored in memory Method signatures and docstrings: - def __init__(self, object2MatrixFunction, distanceBetween2Objects, embedding_dim, feature_dim): :param object2MatrixFunction: function...
Implement the Python class `ProcessInMemoryBatch` described below. Class description: For processing one batch of objects that are stored in memory Method signatures and docstrings: - def __init__(self, object2MatrixFunction, distanceBetween2Objects, embedding_dim, feature_dim): :param object2MatrixFunction: function...
b3d5afd9b0a33da01ff83516e934d4620f73bcce
<|skeleton|> class ProcessInMemoryBatch: """For processing one batch of objects that are stored in memory""" def __init__(self, object2MatrixFunction, distanceBetween2Objects, embedding_dim, feature_dim): """:param object2MatrixFunction: function that takes an object and creates an embedding as 2D nump...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProcessInMemoryBatch: """For processing one batch of objects that are stored in memory""" def __init__(self, object2MatrixFunction, distanceBetween2Objects, embedding_dim, feature_dim): """:param object2MatrixFunction: function that takes an object and creates an embedding as 2D numpy array of th...
the_stack_v2_python_sparse
src/train.py
wxhC3SC6OPm8M1HXboMy/embedding4DTW
train
2
b3309162925e9c6938c0c8d94c1e71c1b0c0c0d0
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
SimulatorServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulatorServicer: """Missing associated documentation comment in .proto file.""" def startDeviceSimulation(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def stopDeviceSimulation(self, request, context): """Mis...
stack_v2_sparse_classes_36k_train_011395
6,706
no_license
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "startDeviceSimulation", "signature": "def startDeviceSimulation(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "stopDeviceSimulation", "sign...
3
stack_v2_sparse_classes_30k_train_006461
Implement the Python class `SimulatorServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def startDeviceSimulation(self, request, context): Missing associated documentation comment in .proto file. - def stopDeviceSimulation(self, r...
Implement the Python class `SimulatorServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def startDeviceSimulation(self, request, context): Missing associated documentation comment in .proto file. - def stopDeviceSimulation(self, r...
eb1cd0d0ee5eb02f27f76967679c29068b277a2e
<|skeleton|> class SimulatorServicer: """Missing associated documentation comment in .proto file.""" def startDeviceSimulation(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def stopDeviceSimulation(self, request, context): """Mis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimulatorServicer: """Missing associated documentation comment in .proto file.""" def startDeviceSimulation(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not imple...
the_stack_v2_python_sparse
src/gateway/protocol_buffers/generated_files/simulator_services_pb2_grpc.py
andru1236/mock-backend
train
3
81876ccd754274a281e78fd6ab59805c8ec4960b
[ "items = []\nparent_urls = response.xpath('//div[@id=\"tab01\"]/div/h3/a/@href').extract()\nparent_titles = response.xpath('//div[@id=\"tab01\"]/div/h3/a/text()').extract()\nsub_urls = response.xpath('//div[@class=\"clearfix\"]/ul/li/a/@href').extract()\nsub_titles = response.xpath('//div[@class=\"clearfix\"]/ul/li...
<|body_start_0|> items = [] parent_urls = response.xpath('//div[@id="tab01"]/div/h3/a/@href').extract() parent_titles = response.xpath('//div[@id="tab01"]/div/h3/a/text()').extract() sub_urls = response.xpath('//div[@class="clearfix"]/ul/li/a/@href').extract() sub_titles = respon...
SinaSpider
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SinaSpider: def parse(self, response): """解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return:""" <|body_0|> def sub_pares(self, response): """对于返回的小类sub_url,进行递归请求 :param response: :return:""" <|body_1|> def content_parse...
stack_v2_sparse_classes_36k_train_011396
3,641
no_license
[ { "docstring": "解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return:", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "对于返回的小类sub_url,进行递归请求 :param response: :return:", "name": "sub_pares", "signature": "def sub_pares(self, res...
3
stack_v2_sparse_classes_30k_train_012204
Implement the Python class `SinaSpider` described below. Class description: Implement the SinaSpider class. Method signatures and docstrings: - def parse(self, response): 解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return: - def sub_pares(self, response): 对于返回的小类sub_url,进行递归请求 :param ...
Implement the Python class `SinaSpider` described below. Class description: Implement the SinaSpider class. Method signatures and docstrings: - def parse(self, response): 解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return: - def sub_pares(self, response): 对于返回的小类sub_url,进行递归请求 :param ...
bac744667f60618b5ed96d301293955ccfce7f91
<|skeleton|> class SinaSpider: def parse(self, response): """解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return:""" <|body_0|> def sub_pares(self, response): """对于返回的小类sub_url,进行递归请求 :param response: :return:""" <|body_1|> def content_parse...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SinaSpider: def parse(self, response): """解析所有大类title,url; 小类title,url。获取小类中文章的url,交给content_parse处理 :param response: :return:""" items = [] parent_urls = response.xpath('//div[@id="tab01"]/div/h3/a/@href').extract() parent_titles = response.xpath('//div[@id="tab01"]/div/h3/a/t...
the_stack_v2_python_sparse
sinanews/sinanews/spiders/sina.py
Cprocc/spiderStudy
train
0
d2295f6d27c31e69bd8355a0bab9e16f7b9cadb3
[ "preorder = []\n\ndef preOrder(node):\n if node:\n preorder.append(node.val)\n preOrder(node.left)\n preOrder(node.right)\npreOrder(root)\nreturn ' '.join(map(str, preorder))", "deque = collections.deque((int(val) for val in data.split()))\n\ndef build(floor, ceiling):\n if deque and fl...
<|body_start_0|> preorder = [] def preOrder(node): if node: preorder.append(node.val) preOrder(node.left) preOrder(node.right) preOrder(root) return ' '.join(map(str, preorder)) <|end_body_0|> <|body_start_1|> deque = ...
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_36k_train_011397
1,954
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_000054
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:...
d1666d44226274f13af25cf878cd63a24e1c5528
<|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_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" preorder = [] def preOrder(node): if node: preorder.append(node.val) preOrder(node.left) preOrder(node.right) ...
the_stack_v2_python_sparse
BinaryTree/LeetCode449_SerializeAndDeserializeBST.py
rexhzhang/LeetCodeProbelms
train
0
80e40081905c1e571740b3c3bcadc49418c112a2
[ "processor = cls.processors.get(dnn_cfg.processor)\ndownload_model(dnn_cfg, opt_verbose=False)\nreturn processor(dnn_cfg)", "name = enum_obj.name.lower()\ndnn_cfg = modelzoo_cfg.modelzoo.get(name)\nreturn cls.from_dnn_cfg(dnn_cfg)" ]
<|body_start_0|> processor = cls.processors.get(dnn_cfg.processor) download_model(dnn_cfg, opt_verbose=False) return processor(dnn_cfg) <|end_body_0|> <|body_start_1|> name = enum_obj.name.lower() dnn_cfg = modelzoo_cfg.modelzoo.get(name) return cls.from_dnn_cfg(dnn_cfg)...
DNNFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DNNFactory: def from_dnn_cfg(cls, dnn_cfg): """Creates DNN model based on configuration from ModelZoo :param dnn_cfg: DNN object for the model :returns (NetProc):""" <|body_0|> def from_enum(cls, enum_obj): """Loads DNN model based on enum name. Use from_dnn_cfg for ...
stack_v2_sparse_classes_36k_train_011398
1,836
permissive
[ { "docstring": "Creates DNN model based on configuration from ModelZoo :param dnn_cfg: DNN object for the model :returns (NetProc):", "name": "from_dnn_cfg", "signature": "def from_dnn_cfg(cls, dnn_cfg)" }, { "docstring": "Loads DNN model based on enum name. Use from_dnn_cfg for custom props. :p...
2
null
Implement the Python class `DNNFactory` described below. Class description: Implement the DNNFactory class. Method signatures and docstrings: - def from_dnn_cfg(cls, dnn_cfg): Creates DNN model based on configuration from ModelZoo :param dnn_cfg: DNN object for the model :returns (NetProc): - def from_enum(cls, enum_...
Implement the Python class `DNNFactory` described below. Class description: Implement the DNNFactory class. Method signatures and docstrings: - def from_dnn_cfg(cls, dnn_cfg): Creates DNN model based on configuration from ModelZoo :param dnn_cfg: DNN object for the model :returns (NetProc): - def from_enum(cls, enum_...
5c490cb72607f60e33467a9a0f412d23024e5963
<|skeleton|> class DNNFactory: def from_dnn_cfg(cls, dnn_cfg): """Creates DNN model based on configuration from ModelZoo :param dnn_cfg: DNN object for the model :returns (NetProc):""" <|body_0|> def from_enum(cls, enum_obj): """Loads DNN model based on enum name. Use from_dnn_cfg for ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DNNFactory: def from_dnn_cfg(cls, dnn_cfg): """Creates DNN model based on configuration from ModelZoo :param dnn_cfg: DNN object for the model :returns (NetProc):""" processor = cls.processors.get(dnn_cfg.processor) download_model(dnn_cfg, opt_verbose=False) return processor(dn...
the_stack_v2_python_sparse
src/vframe/image/dnn_factory.py
vframeio/vframe
train
50
6c534ab421dd312248fcb969e0c085ccd8f7d7b9
[ "if freezer_type is not FreezerPropertyFreezer:\n assert issubclass(freezer_type, Freezer)\n if not on_freeze is on_thaw is do_nothing:\n raise Exception(\"You've passed a `freezer_type` argument, so you're not allowed to pass `on_freeze` or `on_thaw` arguments. The freeze/thaw handlers should be defin...
<|body_start_0|> if freezer_type is not FreezerPropertyFreezer: assert issubclass(freezer_type, Freezer) if not on_freeze is on_thaw is do_nothing: raise Exception("You've passed a `freezer_type` argument, so you're not allowed to pass `on_freeze` or `on_thaw` arguments. ...
A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creating a freezer attribute for each instance: - The `.on_freeze` and `.on_thaw` decorat...
FreezerProperty
[ "BSD-3-Clause", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FreezerProperty: """A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creating a freezer attribute for each instance...
stack_v2_sparse_classes_36k_train_011399
3,931
permissive
[ { "docstring": "Create the `FreezerProperty`. All arguments are optional: You may pass in freeze/thaw handlers as `on_freeze` and `on_thaw`, but you don't have to. You may choose a specific freezer type to use as `freezer_type`, in which case you can't use either the `on_freeze`/`on_thaw` arguments nor the deco...
4
stack_v2_sparse_classes_30k_train_013269
Implement the Python class `FreezerProperty` described below. Class description: A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creatin...
Implement the Python class `FreezerProperty` described below. Class description: A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creatin...
cb9ef64b48f1d03275484d707dc5079b6701ad0c
<|skeleton|> class FreezerProperty: """A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creating a freezer attribute for each instance...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FreezerProperty: """A property which lazy-creates a freezer. A freezer is used as a context manager to "freeze" and "thaw" an object. See documentation of `Freezer` in this package for more info. The advantages of using a `FreezerProperty` instead of creating a freezer attribute for each instance: - The `.on_...
the_stack_v2_python_sparse
python_toolbox/freezing/freezer_property.py
cool-RR/python_toolbox
train
130