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
0240c7cde659d874e199cf82c07eb1b3f85ac2eb
[ "generic.printerr('some error')\nself.assertEqual(mocked_stderr.write.call_count, 1)\nself.assertEqual(mocked_stderr.flush.call_count, 1)", "generic.printerr('some error')\nargs, _ = mocked_stderr.write.call_args\nmessage = args[0]\nself.assertTrue(message.endswith('\\n'))" ]
<|body_start_0|> generic.printerr('some error') self.assertEqual(mocked_stderr.write.call_count, 1) self.assertEqual(mocked_stderr.flush.call_count, 1) <|end_body_0|> <|body_start_1|> generic.printerr('some error') args, _ = mocked_stderr.write.call_args message = args[0...
A suite of test cases for the iiqtools.utils.generic module
TestGenericUtils
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGenericUtils: """A suite of test cases for the iiqtools.utils.generic module""" def test_printerr_happy_path(self, mocked_stderr): """printerr writes to stderr""" <|body_0|> def test_printerr_newline(self, mocked_stderr): """printerr appends a newline charact...
stack_v2_sparse_classes_36k_train_007400
2,169
permissive
[ { "docstring": "printerr writes to stderr", "name": "test_printerr_happy_path", "signature": "def test_printerr_happy_path(self, mocked_stderr)" }, { "docstring": "printerr appends a newline character automatically", "name": "test_printerr_newline", "signature": "def test_printerr_newlin...
2
stack_v2_sparse_classes_30k_train_019015
Implement the Python class `TestGenericUtils` described below. Class description: A suite of test cases for the iiqtools.utils.generic module Method signatures and docstrings: - def test_printerr_happy_path(self, mocked_stderr): printerr writes to stderr - def test_printerr_newline(self, mocked_stderr): printerr appe...
Implement the Python class `TestGenericUtils` described below. Class description: A suite of test cases for the iiqtools.utils.generic module Method signatures and docstrings: - def test_printerr_happy_path(self, mocked_stderr): printerr writes to stderr - def test_printerr_newline(self, mocked_stderr): printerr appe...
a44a8ee9a299c7711b3abd69d21c24f55f2ae84e
<|skeleton|> class TestGenericUtils: """A suite of test cases for the iiqtools.utils.generic module""" def test_printerr_happy_path(self, mocked_stderr): """printerr writes to stderr""" <|body_0|> def test_printerr_newline(self, mocked_stderr): """printerr appends a newline charact...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestGenericUtils: """A suite of test cases for the iiqtools.utils.generic module""" def test_printerr_happy_path(self, mocked_stderr): """printerr writes to stderr""" generic.printerr('some error') self.assertEqual(mocked_stderr.write.call_count, 1) self.assertEqual(mocked...
the_stack_v2_python_sparse
iiqtools_tests/utils/test_generic.py
willnx/iiqtools
train
5
add181f9395434b7e2e1d2331f9ac8ee6153148f
[ "from collections import deque\nq = deque([(root, 1)])\nans = 0\nwhile q:\n sz = len(q)\n l, r = (-1, -1)\n for i in range(sz):\n node, idx = q.popleft()\n if i == 0:\n l = idx\n if i == sz - 1:\n r = idx\n if node.left:\n q.append((node.left, id...
<|body_start_0|> from collections import deque q = deque([(root, 1)]) ans = 0 while q: sz = len(q) l, r = (-1, -1) for i in range(sz): node, idx = q.popleft() if i == 0: l = idx if i =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def widthOfBinaryTree(self, root: TreeNode) -> int: """BFS, Time: O(n), Space: O(n)""" <|body_0|> def widthOfBinaryTree(self, root: TreeNode) -> int: """DFS, Time: O(n), Space: O(n)""" <|body_1|> <|end_skeleton|> <|body_start_0|> from coll...
stack_v2_sparse_classes_36k_train_007401
1,580
no_license
[ { "docstring": "BFS, Time: O(n), Space: O(n)", "name": "widthOfBinaryTree", "signature": "def widthOfBinaryTree(self, root: TreeNode) -> int" }, { "docstring": "DFS, Time: O(n), Space: O(n)", "name": "widthOfBinaryTree", "signature": "def widthOfBinaryTree(self, root: TreeNode) -> int" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def widthOfBinaryTree(self, root: TreeNode) -> int: BFS, Time: O(n), Space: O(n) - def widthOfBinaryTree(self, root: TreeNode) -> int: DFS, Time: O(n), Space: O(n)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def widthOfBinaryTree(self, root: TreeNode) -> int: BFS, Time: O(n), Space: O(n) - def widthOfBinaryTree(self, root: TreeNode) -> int: DFS, Time: O(n), Space: O(n) <|skeleton|> ...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def widthOfBinaryTree(self, root: TreeNode) -> int: """BFS, Time: O(n), Space: O(n)""" <|body_0|> def widthOfBinaryTree(self, root: TreeNode) -> int: """DFS, Time: O(n), Space: O(n)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def widthOfBinaryTree(self, root: TreeNode) -> int: """BFS, Time: O(n), Space: O(n)""" from collections import deque q = deque([(root, 1)]) ans = 0 while q: sz = len(q) l, r = (-1, -1) for i in range(sz): nod...
the_stack_v2_python_sparse
python/662-Maximum Width of Binary Tree.py
cwza/leetcode
train
0
dfa9694fd6f3cbdfaa4fd6de256c7a65031315d0
[ "try:\n cls.abrir_conexion()\n sql = 'SELECT idProdTipArt, idTipoArticulo, fecha, cantidad FROM prodTipArt WHERE estado != \"eliminado\" order by fecha DESC;'\n cls.cursor.execute(sql)\n prods_ = cls.curs...
<|body_start_0|> try: cls.abrir_conexion() sql = 'SELECT idProdTipArt, idTipoArticulo, fecha, cantidad FROM prodTipArt WHERE estado != "eliminado" order by fecha DESC;' cls.cur...
DatosProduccion
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatosProduccion: def get_all_articulos(cls): """Obtiene todas las producciones de artículos de la BD.""" <|body_0|> def get_all_insumos(cls): """Obtiene todas las producciones de insumos de la BD.""" <|body_1|> def add(cls, id, fecha, cant, kind): ...
stack_v2_sparse_classes_36k_train_007402
5,809
no_license
[ { "docstring": "Obtiene todas las producciones de artículos de la BD.", "name": "get_all_articulos", "signature": "def get_all_articulos(cls)" }, { "docstring": "Obtiene todas las producciones de insumos de la BD.", "name": "get_all_insumos", "signature": "def get_all_insumos(cls)" }, ...
5
null
Implement the Python class `DatosProduccion` described below. Class description: Implement the DatosProduccion class. Method signatures and docstrings: - def get_all_articulos(cls): Obtiene todas las producciones de artículos de la BD. - def get_all_insumos(cls): Obtiene todas las producciones de insumos de la BD. - ...
Implement the Python class `DatosProduccion` described below. Class description: Implement the DatosProduccion class. Method signatures and docstrings: - def get_all_articulos(cls): Obtiene todas las producciones de artículos de la BD. - def get_all_insumos(cls): Obtiene todas las producciones de insumos de la BD. - ...
57ca674dba4dabd2526c450ba7210933240f19c5
<|skeleton|> class DatosProduccion: def get_all_articulos(cls): """Obtiene todas las producciones de artículos de la BD.""" <|body_0|> def get_all_insumos(cls): """Obtiene todas las producciones de insumos de la BD.""" <|body_1|> def add(cls, id, fecha, cant, kind): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatosProduccion: def get_all_articulos(cls): """Obtiene todas las producciones de artículos de la BD.""" try: cls.abrir_conexion() sql = 'SELECT idProdTipArt, idTipoArticulo, fecha, cantidad...
the_stack_v2_python_sparse
data/data_produccion.py
JoaquinCardonaRuiz/proyecto-final
train
0
4882c2170bd60bc6c7c1e5beb021d05f2a0a3ea4
[ "c = companymanage(self.driver)\nc.open_companymanage()\nself.assertEqual(c.verify(), True)\nc.add()\nself.assertEqual(c.sub_tagname(), '企业管理-新增')\nc.add_save()\nself.assertEqual(c.error_name(), '不能为空哦')\nself.assertEqual(c.error_type(), '不能为空哦')\nself.assertEqual(c.error_trade(), '不能为空哦')\nself.assertEqual(c.error...
<|body_start_0|> c = companymanage(self.driver) c.open_companymanage() self.assertEqual(c.verify(), True) c.add() self.assertEqual(c.sub_tagname(), '企业管理-新增') c.add_save() self.assertEqual(c.error_name(), '不能为空哦') self.assertEqual(c.error_type(), '不能为空哦') ...
Test025_Company_Add_Error
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test025_Company_Add_Error: def test_company_add_error1(self): """输入为空""" <|body_0|> def test_company_add_error2(self): """人数上限输入无效""" <|body_1|> <|end_skeleton|> <|body_start_0|> c = companymanage(self.driver) c.open_companymanage() ...
stack_v2_sparse_classes_36k_train_007403
1,560
no_license
[ { "docstring": "输入为空", "name": "test_company_add_error1", "signature": "def test_company_add_error1(self)" }, { "docstring": "人数上限输入无效", "name": "test_company_add_error2", "signature": "def test_company_add_error2(self)" } ]
2
stack_v2_sparse_classes_30k_train_021335
Implement the Python class `Test025_Company_Add_Error` described below. Class description: Implement the Test025_Company_Add_Error class. Method signatures and docstrings: - def test_company_add_error1(self): 输入为空 - def test_company_add_error2(self): 人数上限输入无效
Implement the Python class `Test025_Company_Add_Error` described below. Class description: Implement the Test025_Company_Add_Error class. Method signatures and docstrings: - def test_company_add_error1(self): 输入为空 - def test_company_add_error2(self): 人数上限输入无效 <|skeleton|> class Test025_Company_Add_Error: def te...
6f42c25249fc642cecc270578a180820988d45b5
<|skeleton|> class Test025_Company_Add_Error: def test_company_add_error1(self): """输入为空""" <|body_0|> def test_company_add_error2(self): """人数上限输入无效""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test025_Company_Add_Error: def test_company_add_error1(self): """输入为空""" c = companymanage(self.driver) c.open_companymanage() self.assertEqual(c.verify(), True) c.add() self.assertEqual(c.sub_tagname(), '企业管理-新增') c.add_save() self.assertEqual(c...
the_stack_v2_python_sparse
GlxssLive_web/TestCase/Manage_Company/Test025_company_add_error.py
rrmiracle/GlxssLive
train
0
63930b9ef201d044344a7caddf92fb03f990432f
[ "sim_scene = MockSimScene(nq=10)\nsim_scene.data.qpos[:] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\nsim_scene.data.qvel[:] = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]\nrobot = RobotComponent(sim_scene, groups={'a': {'qpos_indices': [0, 1, 3, 5]}, 'b': {'qpos_indices': [2, 6], 'qvel_indices': [7, 8, 9]}})\na_state, b_state =...
<|body_start_0|> sim_scene = MockSimScene(nq=10) sim_scene.data.qpos[:] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] sim_scene.data.qvel[:] = [11, 12, 13, 14, 15, 16, 17, 18, 19, 20] robot = RobotComponent(sim_scene, groups={'a': {'qpos_indices': [0, 1, 3, 5]}, 'b': {'qpos_indices': [2, 6], 'qvel_i...
Unit test class for RobotComponent.
RobotComponentTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RobotComponentTest: """Unit test class for RobotComponent.""" def test_get_state(self): """Tests querying the state of multiple groups.""" <|body_0|> def test_step(self): """Tests stepping with an action for multiple groups.""" <|body_1|> def test_st...
stack_v2_sparse_classes_36k_train_007404
4,448
permissive
[ { "docstring": "Tests querying the state of multiple groups.", "name": "test_get_state", "signature": "def test_get_state(self)" }, { "docstring": "Tests stepping with an action for multiple groups.", "name": "test_step", "signature": "def test_step(self)" }, { "docstring": "Test...
5
stack_v2_sparse_classes_30k_train_004314
Implement the Python class `RobotComponentTest` described below. Class description: Unit test class for RobotComponent. Method signatures and docstrings: - def test_get_state(self): Tests querying the state of multiple groups. - def test_step(self): Tests stepping with an action for multiple groups. - def test_step_d...
Implement the Python class `RobotComponentTest` described below. Class description: Unit test class for RobotComponent. Method signatures and docstrings: - def test_get_state(self): Tests querying the state of multiple groups. - def test_step(self): Tests stepping with an action for multiple groups. - def test_step_d...
bdba0b58c4a01e0742e97299ce3bd1587ad2aa25
<|skeleton|> class RobotComponentTest: """Unit test class for RobotComponent.""" def test_get_state(self): """Tests querying the state of multiple groups.""" <|body_0|> def test_step(self): """Tests stepping with an action for multiple groups.""" <|body_1|> def test_st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RobotComponentTest: """Unit test class for RobotComponent.""" def test_get_state(self): """Tests querying the state of multiple groups.""" sim_scene = MockSimScene(nq=10) sim_scene.data.qpos[:] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] sim_scene.data.qvel[:] = [11, 12, 13, 14, 15,...
the_stack_v2_python_sparse
adept_envs/components/robot/robot_test.py
google-research/DBAP-simulation
train
3
81334d3a270a2a82f0030ec3efd479b05a9a3579
[ "self.csv_spec = csv_spec\nself.csv_map = csv_map\nself.csv_name = csv_name\nDataTable.__init__(self, None, csv_name if csv_name else None, refresh_minutes)\nself.refresh()", "dt = from_csv(open(self.csv_spec, 'r'), self.name, self.csv_map)\nif dt:\n rows, cols = dt.get_bounds()\n for idx in range(cols):\n ...
<|body_start_0|> self.csv_spec = csv_spec self.csv_map = csv_map self.csv_name = csv_name DataTable.__init__(self, None, csv_name if csv_name else None, refresh_minutes) self.refresh() <|end_body_0|> <|body_start_1|> dt = from_csv(open(self.csv_spec, 'r'), self.name, sel...
class that collects data from a CSV file on disk and extracts columns based on a column map of the form [[CSV_column_name, DataTable_column_name,DataTable_type (one of _string,_int,_float,_date )],...]
CSVDataTable
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CSVDataTable: """class that collects data from a CSV file on disk and extracts columns based on a column map of the form [[CSV_column_name, DataTable_column_name,DataTable_type (one of _string,_int,_float,_date )],...]""" def __init__(self, refresh_minutes=1, csv_spec=None, csv_map=None, csv...
stack_v2_sparse_classes_36k_train_007405
1,770
permissive
[ { "docstring": "Initialize the CSVDataTable object from the file named in csv_spec and extract the columns in the provided csv_map, name the table based on the name provided or extracted from the CSV", "name": "__init__", "signature": "def __init__(self, refresh_minutes=1, csv_spec=None, csv_map=None, c...
2
stack_v2_sparse_classes_30k_test_000391
Implement the Python class `CSVDataTable` described below. Class description: class that collects data from a CSV file on disk and extracts columns based on a column map of the form [[CSV_column_name, DataTable_column_name,DataTable_type (one of _string,_int,_float,_date )],...] Method signatures and docstrings: - de...
Implement the Python class `CSVDataTable` described below. Class description: class that collects data from a CSV file on disk and extracts columns based on a column map of the form [[CSV_column_name, DataTable_column_name,DataTable_type (one of _string,_int,_float,_date )],...] Method signatures and docstrings: - de...
c7b742e049e2cea1bb982ed337609b4af5d8f1c8
<|skeleton|> class CSVDataTable: """class that collects data from a CSV file on disk and extracts columns based on a column map of the form [[CSV_column_name, DataTable_column_name,DataTable_type (one of _string,_int,_float,_date )],...]""" def __init__(self, refresh_minutes=1, csv_spec=None, csv_map=None, csv...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CSVDataTable: """class that collects data from a CSV file on disk and extracts columns based on a column map of the form [[CSV_column_name, DataTable_column_name,DataTable_type (one of _string,_int,_float,_date )],...]""" def __init__(self, refresh_minutes=1, csv_spec=None, csv_map=None, csv_name=None): ...
the_stack_v2_python_sparse
data_sources/csv_data.py
jpfxgood/dashboard
train
7
835d4bfefd4efb4b46cab38626f9d393a439922e
[ "self.document_status = document_status\nself.completed_packages = completed_packages\nself.additional_properties = additional_properties", "if dictionary is None:\n return None\ndocument_status = dictionary.get('documentStatus')\ncompleted_packages = dictionary.get('completedPackages')\nfor key in cls._names....
<|body_start_0|> self.document_status = document_status self.completed_packages = completed_packages self.additional_properties = additional_properties <|end_body_0|> <|body_start_1|> if dictionary is None: return None document_status = dictionary.get('documentStatus...
Implementation of the 'Status201' model. TODO: type model description here. Attributes: document_status (DocumentStatus): The overall status for the document completed_packages (list of CompletedPackage): A list of all the completed files/packages on this document.
Status201
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Status201: """Implementation of the 'Status201' model. TODO: type model description here. Attributes: document_status (DocumentStatus): The overall status for the document completed_packages (list of CompletedPackage): A list of all the completed files/packages on this document.""" def __ini...
stack_v2_sparse_classes_36k_train_007406
2,256
permissive
[ { "docstring": "Constructor for the Status201 class", "name": "__init__", "signature": "def __init__(self, document_status=None, completed_packages=None, additional_properties={})" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary ...
2
stack_v2_sparse_classes_30k_test_000643
Implement the Python class `Status201` described below. Class description: Implementation of the 'Status201' model. TODO: type model description here. Attributes: document_status (DocumentStatus): The overall status for the document completed_packages (list of CompletedPackage): A list of all the completed files/packa...
Implement the Python class `Status201` described below. Class description: Implementation of the 'Status201' model. TODO: type model description here. Attributes: document_status (DocumentStatus): The overall status for the document completed_packages (list of CompletedPackage): A list of all the completed files/packa...
fa3918a6c54ea0eedb9146578645b7eb1755b642
<|skeleton|> class Status201: """Implementation of the 'Status201' model. TODO: type model description here. Attributes: document_status (DocumentStatus): The overall status for the document completed_packages (list of CompletedPackage): A list of all the completed files/packages on this document.""" def __ini...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Status201: """Implementation of the 'Status201' model. TODO: type model description here. Attributes: document_status (DocumentStatus): The overall status for the document completed_packages (list of CompletedPackage): A list of all the completed files/packages on this document.""" def __init__(self, doc...
the_stack_v2_python_sparse
idfy_rest_client/models/status_201.py
dealflowteam/Idfy
train
0
3a1a2409dca409d0a7750b0fa9a85ec8f812cd27
[ "super().__init__()\nself.__cursor = cursor\nself.__parent = parent\nself.__buffer = None", "if self.__cursor.closed:\n raise StopIteration\nif self.__buffer != None:\n item = self.__buffer\n self.__buffer = None\n return item\nelse:\n return next(self.__cursor)", "if self.__buffer != None:\n ...
<|body_start_0|> super().__init__() self.__cursor = cursor self.__parent = parent self.__buffer = None <|end_body_0|> <|body_start_1|> if self.__cursor.closed: raise StopIteration if self.__buffer != None: item = self.__buffer self.__b...
_PostgreSQLIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _PostgreSQLIterator: def __init__(self, cursor, parent): """Parameters: cursor A cursor on which the query to iterate through has already been executed without fail. parent : PostgreSQLStream The parent Stream. Will be closed when the stream is over and the cursor closed.""" <|bo...
stack_v2_sparse_classes_36k_train_007407
5,462
no_license
[ { "docstring": "Parameters: cursor A cursor on which the query to iterate through has already been executed without fail. parent : PostgreSQLStream The parent Stream. Will be closed when the stream is over and the cursor closed.", "name": "__init__", "signature": "def __init__(self, cursor, parent)" }...
4
stack_v2_sparse_classes_30k_train_008763
Implement the Python class `_PostgreSQLIterator` described below. Class description: Implement the _PostgreSQLIterator class. Method signatures and docstrings: - def __init__(self, cursor, parent): Parameters: cursor A cursor on which the query to iterate through has already been executed without fail. parent : Postg...
Implement the Python class `_PostgreSQLIterator` described below. Class description: Implement the _PostgreSQLIterator class. Method signatures and docstrings: - def __init__(self, cursor, parent): Parameters: cursor A cursor on which the query to iterate through has already been executed without fail. parent : Postg...
5d1fce470eeb31f5cc75cadfc06d9d2908736052
<|skeleton|> class _PostgreSQLIterator: def __init__(self, cursor, parent): """Parameters: cursor A cursor on which the query to iterate through has already been executed without fail. parent : PostgreSQLStream The parent Stream. Will be closed when the stream is over and the cursor closed.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _PostgreSQLIterator: def __init__(self, cursor, parent): """Parameters: cursor A cursor on which the query to iterate through has already been executed without fail. parent : PostgreSQLStream The parent Stream. Will be closed when the stream is over and the cursor closed.""" super().__init__()...
the_stack_v2_python_sparse
otri/database/database_stream.py
OTRI-Unipd/OTRI
train
0
a05a1e920347ac67689a99be3428ea9dc63ffd1c
[ "super(OUIIndexParser, self).__init__()\nif hasattr(ieee_file, 'readline') and hasattr(ieee_file, 'tell'):\n self.fh = ieee_file\nelse:\n self.fh = open(ieee_file, 'rb')", "skip_header = True\nrecord = None\nsize = 0\nmarker = _bytes_type('(hex)')\nhyphen = _bytes_type('-')\nempty_string = _bytes_type('')\n...
<|body_start_0|> super(OUIIndexParser, self).__init__() if hasattr(ieee_file, 'readline') and hasattr(ieee_file, 'tell'): self.fh = ieee_file else: self.fh = open(ieee_file, 'rb') <|end_body_0|> <|body_start_1|> skip_header = True record = None si...
A concrete Publisher that parses OUI (Organisationally Unique Identifier) records from IEEE text-based registration files It notifies registered Subscribers as each record is encountered, passing on the record's position relative to the start of the file (offset) and the size of the record (in bytes). The file processe...
OUIIndexParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OUIIndexParser: """A concrete Publisher that parses OUI (Organisationally Unique Identifier) records from IEEE text-based registration files It notifies registered Subscribers as each record is encountered, passing on the record's position relative to the start of the file (offset) and the size o...
stack_v2_sparse_classes_36k_train_007408
9,500
permissive
[ { "docstring": "Constructor. :param ieee_file: a file-like object or name of file containing OUI records. When using a file-like object always open it in binary mode otherwise offsets will probably misbehave.", "name": "__init__", "signature": "def __init__(self, ieee_file)" }, { "docstring": "S...
2
null
Implement the Python class `OUIIndexParser` described below. Class description: A concrete Publisher that parses OUI (Organisationally Unique Identifier) records from IEEE text-based registration files It notifies registered Subscribers as each record is encountered, passing on the record's position relative to the st...
Implement the Python class `OUIIndexParser` described below. Class description: A concrete Publisher that parses OUI (Organisationally Unique Identifier) records from IEEE text-based registration files It notifies registered Subscribers as each record is encountered, passing on the record's position relative to the st...
750da5eaef33cede9f3ef532453d63e507f34a2c
<|skeleton|> class OUIIndexParser: """A concrete Publisher that parses OUI (Organisationally Unique Identifier) records from IEEE text-based registration files It notifies registered Subscribers as each record is encountered, passing on the record's position relative to the start of the file (offset) and the size o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OUIIndexParser: """A concrete Publisher that parses OUI (Organisationally Unique Identifier) records from IEEE text-based registration files It notifies registered Subscribers as each record is encountered, passing on the record's position relative to the start of the file (offset) and the size of the record ...
the_stack_v2_python_sparse
venv/Lib/site-packages/netaddr/eui/ieee.py
natemellendorf/configpy
train
4
419f94ebca1709b922030afb4050a04f4f8f24f9
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AttendeeAvailability()", "from .attendee_base import AttendeeBase\nfrom .free_busy_status import FreeBusyStatus\nfrom .attendee_base import AttendeeBase\nfrom .free_busy_status import FreeBusyStatus\nfields: Dict[str, Callable[[Any], N...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AttendeeAvailability() <|end_body_0|> <|body_start_1|> from .attendee_base import AttendeeBase from .free_busy_status import FreeBusyStatus from .attendee_base import AttendeeBas...
AttendeeAvailability
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttendeeAvailability: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttendeeAvailability: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ...
stack_v2_sparse_classes_36k_train_007409
3,257
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: AttendeeAvailability", "name": "create_from_discriminator_value", "signature": "def create_from_discriminato...
3
null
Implement the Python class `AttendeeAvailability` described below. Class description: Implement the AttendeeAvailability class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttendeeAvailability: Creates a new instance of the appropriate class based o...
Implement the Python class `AttendeeAvailability` described below. Class description: Implement the AttendeeAvailability class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttendeeAvailability: Creates a new instance of the appropriate class based o...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AttendeeAvailability: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttendeeAvailability: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttendeeAvailability: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AttendeeAvailability: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns...
the_stack_v2_python_sparse
msgraph/generated/models/attendee_availability.py
microsoftgraph/msgraph-sdk-python
train
135
8a9ccd5f07c2a995a3afdf3369c4a27b81cdff6f
[ "if not (api_utils.check_user_is_foundation_admin() or api_utils.check_user_is_vendor_admin(vendor_id)):\n return None\norg_users = db.get_organization_users(vendor_id)\nreturn [x for x in six.itervalues(org_users)]", "openid = base64.b64decode(openid)\nif not (api_utils.check_user_is_foundation_admin() or api...
<|body_start_0|> if not (api_utils.check_user_is_foundation_admin() or api_utils.check_user_is_vendor_admin(vendor_id)): return None org_users = db.get_organization_users(vendor_id) return [x for x in six.itervalues(org_users)] <|end_body_0|> <|body_start_1|> openid = base64...
/v1/vendors/<vendor_id>/users handler.
UsersController
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UsersController: """/v1/vendors/<vendor_id>/users handler.""" def get(self, vendor_id): """Return list of users in the vendor's group.""" <|body_0|> def put(self, vendor_id, openid): """Add user to vendor group.""" <|body_1|> def delete(self, vendor_...
stack_v2_sparse_classes_36k_train_007410
11,223
permissive
[ { "docstring": "Return list of users in the vendor's group.", "name": "get", "signature": "def get(self, vendor_id)" }, { "docstring": "Add user to vendor group.", "name": "put", "signature": "def put(self, vendor_id, openid)" }, { "docstring": "Remove user from vendor group.", ...
3
stack_v2_sparse_classes_30k_train_000897
Implement the Python class `UsersController` described below. Class description: /v1/vendors/<vendor_id>/users handler. Method signatures and docstrings: - def get(self, vendor_id): Return list of users in the vendor's group. - def put(self, vendor_id, openid): Add user to vendor group. - def delete(self, vendor_id, ...
Implement the Python class `UsersController` described below. Class description: /v1/vendors/<vendor_id>/users handler. Method signatures and docstrings: - def get(self, vendor_id): Return list of users in the vendor's group. - def put(self, vendor_id, openid): Add user to vendor group. - def delete(self, vendor_id, ...
0af3a46e16037d13695ef74d35d2ef5909186d97
<|skeleton|> class UsersController: """/v1/vendors/<vendor_id>/users handler.""" def get(self, vendor_id): """Return list of users in the vendor's group.""" <|body_0|> def put(self, vendor_id, openid): """Add user to vendor group.""" <|body_1|> def delete(self, vendor_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UsersController: """/v1/vendors/<vendor_id>/users handler.""" def get(self, vendor_id): """Return list of users in the vendor's group.""" if not (api_utils.check_user_is_foundation_admin() or api_utils.check_user_is_vendor_admin(vendor_id)): return None org_users = db....
the_stack_v2_python_sparse
refstack/api/controllers/vendors.py
openstack-archive/refstack
train
0
6de53bf26181ed7068f9fb2b3d1e1581c2ea836e
[ "self.st = state\nself.suc = success\nself.d = depth\nself.cut = cutoff", "if self.suc:\n prstr = 'Solution found at depth ' + str(self.d) + '\\nState:\\n'\nelif self.cut:\n prstr = 'Limit reached before solution was found\\n'\nelse:\n prstr = 'Failed to find a solution.\\n'\nprstr += format(self.st)\nre...
<|body_start_0|> self.st = state self.suc = success self.d = depth self.cut = cutoff <|end_body_0|> <|body_start_1|> if self.suc: prstr = 'Solution found at depth ' + str(self.d) + '\nState:\n' elif self.cut: prstr = 'Limit reached before solution...
MathSearchResult
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MathSearchResult: def __init__(self, success, depth, state, cutoff=False): """Contains the results of a search. success -- True if solution found, false otherwise depth -- the distance from intial node to success node state -- the state at which success was met""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_007411
5,565
no_license
[ { "docstring": "Contains the results of a search. success -- True if solution found, false otherwise depth -- the distance from intial node to success node state -- the state at which success was met", "name": "__init__", "signature": "def __init__(self, success, depth, state, cutoff=False)" }, { ...
2
stack_v2_sparse_classes_30k_train_007944
Implement the Python class `MathSearchResult` described below. Class description: Implement the MathSearchResult class. Method signatures and docstrings: - def __init__(self, success, depth, state, cutoff=False): Contains the results of a search. success -- True if solution found, false otherwise depth -- the distanc...
Implement the Python class `MathSearchResult` described below. Class description: Implement the MathSearchResult class. Method signatures and docstrings: - def __init__(self, success, depth, state, cutoff=False): Contains the results of a search. success -- True if solution found, false otherwise depth -- the distanc...
aacf205c4a2eac4b518c9a38bf28eb65523a4cbb
<|skeleton|> class MathSearchResult: def __init__(self, success, depth, state, cutoff=False): """Contains the results of a search. success -- True if solution found, false otherwise depth -- the distance from intial node to success node state -- the state at which success was met""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MathSearchResult: def __init__(self, success, depth, state, cutoff=False): """Contains the results of a search. success -- True if solution found, false otherwise depth -- the distance from intial node to success node state -- the state at which success was met""" self.st = state self....
the_stack_v2_python_sparse
a1/a1q2.py
Azellic/317IntroToArtificialIntelligence
train
0
9b211d0af3f215f314fd4bfba2984810f01ae155
[ "super(TaskLossEvaluator, self).__init__(conf, dataconf, models, task)\nif lossconf:\n loss_type = lossconf['loss_type']\nelse:\n loss_type = conf.get(task, 'loss_type')\nself.loss_computer = loss_computer_factory.factory(loss_type)(lossconf, self.batch_size)", "with tf.name_scope('evaluate_logits'):\n l...
<|body_start_0|> super(TaskLossEvaluator, self).__init__(conf, dataconf, models, task) if lossconf: loss_type = lossconf['loss_type'] else: loss_type = conf.get(task, 'loss_type') self.loss_computer = loss_computer_factory.factory(loss_type)(lossconf, self.batch_s...
The TaskLossEvaluator is used to evaluate
TaskLossEvaluator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskLossEvaluator: """The TaskLossEvaluator is used to evaluate""" def __init__(self, conf, dataconf, lossconf, models, task): """TaskLossEvaluator constructor Args: conf: the evaluator configuration as a ConfigParser dataconf: the database configuration lossconf: a configuration for...
stack_v2_sparse_classes_36k_train_007412
2,241
permissive
[ { "docstring": "TaskLossEvaluator constructor Args: conf: the evaluator configuration as a ConfigParser dataconf: the database configuration lossconf: a configuration for the loss function models: the models to be evaluated task: the name of the task being evaluated", "name": "__init__", "signature": "d...
3
stack_v2_sparse_classes_30k_train_004548
Implement the Python class `TaskLossEvaluator` described below. Class description: The TaskLossEvaluator is used to evaluate Method signatures and docstrings: - def __init__(self, conf, dataconf, lossconf, models, task): TaskLossEvaluator constructor Args: conf: the evaluator configuration as a ConfigParser dataconf:...
Implement the Python class `TaskLossEvaluator` described below. Class description: The TaskLossEvaluator is used to evaluate Method signatures and docstrings: - def __init__(self, conf, dataconf, lossconf, models, task): TaskLossEvaluator constructor Args: conf: the evaluator configuration as a ConfigParser dataconf:...
5e862cbf846d45b8a317f87588533f3fde9f0726
<|skeleton|> class TaskLossEvaluator: """The TaskLossEvaluator is used to evaluate""" def __init__(self, conf, dataconf, lossconf, models, task): """TaskLossEvaluator constructor Args: conf: the evaluator configuration as a ConfigParser dataconf: the database configuration lossconf: a configuration for...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskLossEvaluator: """The TaskLossEvaluator is used to evaluate""" def __init__(self, conf, dataconf, lossconf, models, task): """TaskLossEvaluator constructor Args: conf: the evaluator configuration as a ConfigParser dataconf: the database configuration lossconf: a configuration for the loss fun...
the_stack_v2_python_sparse
nabu/neuralnetworks/evaluators/task_loss_evaluator.py
JeroenZegers/Nabu-MSSS
train
19
7c8441d86da1cf129006a3190c237b99dd5a6af8
[ "super(ProtCnnForward, self).__init__()\nself.prot2vec = prot2vec\nself.pcnn = prot_cnn_model\nself.gnet = comp_model", "comp_input, prot_input = inputs\ncomp_out = self.gnet(comp_input)\nprot_input = self.prot2vec(prot_input)\nprot_out = self.pcnn(prot_input, comp_out)\nout = torch.cat([comp_out, prot_out], dim=...
<|body_start_0|> super(ProtCnnForward, self).__init__() self.prot2vec = prot2vec self.pcnn = prot_cnn_model self.gnet = comp_model <|end_body_0|> <|body_start_1|> comp_input, prot_input = inputs comp_out = self.gnet(comp_input) prot_input = self.prot2vec(prot_inp...
Helper forward propagation module for :class:ProtCNN
ProtCnnForward
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtCnnForward: """Helper forward propagation module for :class:ProtCNN""" def __init__(self, prot2vec, prot_cnn_model, comp_model): """Note: The final dimension of the proteins and compounds must be equal due to the PCNN attention calculation. :param prot_cnn_model: protein model :p...
stack_v2_sparse_classes_36k_train_007413
27,873
permissive
[ { "docstring": "Note: The final dimension of the proteins and compounds must be equal due to the PCNN attention calculation. :param prot_cnn_model: protein model :param comp_model: compound model", "name": "__init__", "signature": "def __init__(self, prot2vec, prot_cnn_model, comp_model)" }, { "...
2
stack_v2_sparse_classes_30k_train_001252
Implement the Python class `ProtCnnForward` described below. Class description: Helper forward propagation module for :class:ProtCNN Method signatures and docstrings: - def __init__(self, prot2vec, prot_cnn_model, comp_model): Note: The final dimension of the proteins and compounds must be equal due to the PCNN atten...
Implement the Python class `ProtCnnForward` described below. Class description: Helper forward propagation module for :class:ProtCNN Method signatures and docstrings: - def __init__(self, prot2vec, prot_cnn_model, comp_model): Note: The final dimension of the proteins and compounds must be equal due to the PCNN atten...
f1ddd11fd769c782c354425967c3cc326b9adf69
<|skeleton|> class ProtCnnForward: """Helper forward propagation module for :class:ProtCNN""" def __init__(self, prot2vec, prot_cnn_model, comp_model): """Note: The final dimension of the proteins and compounds must be equal due to the PCNN attention calculation. :param prot_cnn_model: protein model :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtCnnForward: """Helper forward propagation module for :class:ProtCNN""" def __init__(self, prot2vec, prot_cnn_model, comp_model): """Note: The final dimension of the proteins and compounds must be equal due to the PCNN attention calculation. :param prot_cnn_model: protein model :param comp_mod...
the_stack_v2_python_sparse
jova/nn/models.py
bbrighttaer/jova_baselines
train
2
07ccf33813989a71aecbf9dc5e7b63dd71edf555
[ "self._rules = rules\nself.unmapping = {}\nfor name, rule in self._rules.items():\n self.unmapping[name] = {rule.mapping[x]: x for x in rule.mapping}", "try:\n r = self._rules[name]\nexcept KeyError:\n return data\nif isinstance(data, list):\n keys = [r.convertfunc(x) for x in data]\n return [r.map...
<|body_start_0|> self._rules = rules self.unmapping = {} for name, rule in self._rules.items(): self.unmapping[name] = {rule.mapping[x]: x for x in rule.mapping} <|end_body_0|> <|body_start_1|> try: r = self._rules[name] except KeyError: retur...
Converter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Converter: def __init__(self, rules): """初始化 每条规则下mapping代表代码(带有前缀或后缀)-名称, unmapping代表名称-代码(带有前缀或后缀)""" <|body_0|> def convert(self, name, data): """行业代码转行业名称""" <|body_1|> def name2id(self, name, data): """行业名称转行业代码""" <|body_2|> de...
stack_v2_sparse_classes_36k_train_007414
5,537
no_license
[ { "docstring": "初始化 每条规则下mapping代表代码(带有前缀或后缀)-名称, unmapping代表名称-代码(带有前缀或后缀)", "name": "__init__", "signature": "def __init__(self, rules)" }, { "docstring": "行业代码转行业名称", "name": "convert", "signature": "def convert(self, name, data)" }, { "docstring": "行业名称转行业代码", "name": "na...
5
stack_v2_sparse_classes_30k_train_009275
Implement the Python class `Converter` described below. Class description: Implement the Converter class. Method signatures and docstrings: - def __init__(self, rules): 初始化 每条规则下mapping代表代码(带有前缀或后缀)-名称, unmapping代表名称-代码(带有前缀或后缀) - def convert(self, name, data): 行业代码转行业名称 - def name2id(self, name, data): 行业名称转行业代码 - d...
Implement the Python class `Converter` described below. Class description: Implement the Converter class. Method signatures and docstrings: - def __init__(self, rules): 初始化 每条规则下mapping代表代码(带有前缀或后缀)-名称, unmapping代表名称-代码(带有前缀或后缀) - def convert(self, name, data): 行业代码转行业名称 - def name2id(self, name, data): 行业名称转行业代码 - d...
1986ad3995daa2f1cc4510844f5e22da79817d47
<|skeleton|> class Converter: def __init__(self, rules): """初始化 每条规则下mapping代表代码(带有前缀或后缀)-名称, unmapping代表名称-代码(带有前缀或后缀)""" <|body_0|> def convert(self, name, data): """行业代码转行业名称""" <|body_1|> def name2id(self, name, data): """行业名称转行业代码""" <|body_2|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Converter: def __init__(self, rules): """初始化 每条规则下mapping代表代码(带有前缀或后缀)-名称, unmapping代表名称-代码(带有前缀或后缀)""" self._rules = rules self.unmapping = {} for name, rule in self._rules.items(): self.unmapping[name] = {rule.mapping[x]: x for x in rule.mapping} def convert(...
the_stack_v2_python_sparse
FactorLib/data_source/converter.py
fan1018wen/Packages
train
0
585ed3b8f6d17f9d343e3867fd20f52228ec1f66
[ "cmd = self._get_cmd()\ncontent = ''\nif cmd:\n optlist = self.settings.get('ASCIIDOC_OPTIONS', []) + self.default_options\n options = ' '.join(optlist)\n content = call('%s %s -o - %s' % (cmd, options, source_path))\nmetadata = self._read_metadata(source_path)\nreturn (content, metadata)", "if self.sett...
<|body_start_0|> cmd = self._get_cmd() content = '' if cmd: optlist = self.settings.get('ASCIIDOC_OPTIONS', []) + self.default_options options = ' '.join(optlist) content = call('%s %s -o - %s' % (cmd, options, source_path)) metadata = self._read_metad...
Reader for AsciiDoc files.
AsciiDocReader
[ "AGPL-3.0-only", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsciiDocReader: """Reader for AsciiDoc files.""" def read(self, source_path): """Parse content and metadata of AsciiDoc files.""" <|body_0|> def _get_cmd(self): """Returns the AsciiDoc utility command to use for rendering or None if one cannot be found.""" ...
stack_v2_sparse_classes_36k_train_007415
3,245
permissive
[ { "docstring": "Parse content and metadata of AsciiDoc files.", "name": "read", "signature": "def read(self, source_path)" }, { "docstring": "Returns the AsciiDoc utility command to use for rendering or None if one cannot be found.", "name": "_get_cmd", "signature": "def _get_cmd(self)" ...
3
stack_v2_sparse_classes_30k_test_000269
Implement the Python class `AsciiDocReader` described below. Class description: Reader for AsciiDoc files. Method signatures and docstrings: - def read(self, source_path): Parse content and metadata of AsciiDoc files. - def _get_cmd(self): Returns the AsciiDoc utility command to use for rendering or None if one canno...
Implement the Python class `AsciiDocReader` described below. Class description: Reader for AsciiDoc files. Method signatures and docstrings: - def read(self, source_path): Parse content and metadata of AsciiDoc files. - def _get_cmd(self): Returns the AsciiDoc utility command to use for rendering or None if one canno...
b5d68070b6f15677a183424c84e30440e128e1ea
<|skeleton|> class AsciiDocReader: """Reader for AsciiDoc files.""" def read(self, source_path): """Parse content and metadata of AsciiDoc files.""" <|body_0|> def _get_cmd(self): """Returns the AsciiDoc utility command to use for rendering or None if one cannot be found.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsciiDocReader: """Reader for AsciiDoc files.""" def read(self, source_path): """Parse content and metadata of AsciiDoc files.""" cmd = self._get_cmd() content = '' if cmd: optlist = self.settings.get('ASCIIDOC_OPTIONS', []) + self.default_options o...
the_stack_v2_python_sparse
plugins/asciidoc_reader/asciidoc_reader.py
JackMcKew/jackmckew.dev
train
15
3ee798616b7318daf16e6bd9c2f2cc1975fa7353
[ "if 'current_content' in kwargs:\n content = kwargs['current_content']\nelse:\n website_object = self.api.get()\n content = website_object.content if website_object is not None else ''\ncontext = {'form': self.form_class({'content': content})}\nif 'error_id' in kwargs:\n if kwargs['error_id'] < len(cons...
<|body_start_0|> if 'current_content' in kwargs: content = kwargs['current_content'] else: website_object = self.api.get() content = website_object.content if website_object is not None else '' context = {'form': self.form_class({'content': content})} ...
WebPageView
[ "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebPageView: def get(self, request, **kwargs): """GET request. Create/Show the form for the configuration. Args: request: **kwargs: Returns:""" <|body_0|> def post(self, request): """POST request. Try to save the configuration. Args: request: Returns:""" <|bo...
stack_v2_sparse_classes_36k_train_007416
17,826
permissive
[ { "docstring": "GET request. Create/Show the form for the configuration. Args: request: **kwargs: Returns:", "name": "get", "signature": "def get(self, request, **kwargs)" }, { "docstring": "POST request. Try to save the configuration. Args: request: Returns:", "name": "post", "signature...
2
stack_v2_sparse_classes_30k_train_012754
Implement the Python class `WebPageView` described below. Class description: Implement the WebPageView class. Method signatures and docstrings: - def get(self, request, **kwargs): GET request. Create/Show the form for the configuration. Args: request: **kwargs: Returns: - def post(self, request): POST request. Try to...
Implement the Python class `WebPageView` described below. Class description: Implement the WebPageView class. Method signatures and docstrings: - def get(self, request, **kwargs): GET request. Create/Show the form for the configuration. Args: request: **kwargs: Returns: - def post(self, request): POST request. Try to...
568cb75a40ccff1d74a1a757866112535efd769a
<|skeleton|> class WebPageView: def get(self, request, **kwargs): """GET request. Create/Show the form for the configuration. Args: request: **kwargs: Returns:""" <|body_0|> def post(self, request): """POST request. Try to save the configuration. Args: request: Returns:""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebPageView: def get(self, request, **kwargs): """GET request. Create/Show the form for the configuration. Args: request: **kwargs: Returns:""" if 'current_content' in kwargs: content = kwargs['current_content'] else: website_object = self.api.get() ...
the_stack_v2_python_sparse
core_main_app/views/admin/views.py
adilmania/core_main_app
train
0
a862ad8a0f099c56940d8d830d266ac5b18dc585
[ "email = self.normalize_email(email)\nuser = self.model(name=name, email=email)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user", "user = self.create_user(email=email, name='Superuser', password=password)\nuser.is_staff = True\nuser.is_superuser = True\nuser.save(using=self._db)\nreturn user"...
<|body_start_0|> email = self.normalize_email(email) user = self.model(name=name, email=email) user.set_password(password) user.save(using=self._db) return user <|end_body_0|> <|body_start_1|> user = self.create_user(email=email, name='Superuser', password=password) ...
this class handles the management of the Myuser class
MyuserManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyuserManager: """this class handles the management of the Myuser class""" def create_user(self, name, email, password=None): """this function helps create a userInstance using Myuser Model""" <|body_0|> def create_superuser(self, email, password=None): """when w...
stack_v2_sparse_classes_36k_train_007417
1,547
no_license
[ { "docstring": "this function helps create a userInstance using Myuser Model", "name": "create_user", "signature": "def create_user(self, name, email, password=None)" }, { "docstring": "when we call the create_user it returns a newly created instance all we need to do is to attach so permiisions...
2
stack_v2_sparse_classes_30k_train_001105
Implement the Python class `MyuserManager` described below. Class description: this class handles the management of the Myuser class Method signatures and docstrings: - def create_user(self, name, email, password=None): this function helps create a userInstance using Myuser Model - def create_superuser(self, email, p...
Implement the Python class `MyuserManager` described below. Class description: this class handles the management of the Myuser class Method signatures and docstrings: - def create_user(self, name, email, password=None): this function helps create a userInstance using Myuser Model - def create_superuser(self, email, p...
cb4351d860e5d745770a9f6eb342b6ece4e790fa
<|skeleton|> class MyuserManager: """this class handles the management of the Myuser class""" def create_user(self, name, email, password=None): """this function helps create a userInstance using Myuser Model""" <|body_0|> def create_superuser(self, email, password=None): """when w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyuserManager: """this class handles the management of the Myuser class""" def create_user(self, name, email, password=None): """this function helps create a userInstance using Myuser Model""" email = self.normalize_email(email) user = self.model(name=name, email=email) us...
the_stack_v2_python_sparse
users/models.py
MARKOTHEDEV/blog-Api
train
0
340ca5d86442dc63c1c4bb8325f9e14a4238ffd1
[ "ROWS = len(A)\nCOLS = len(A[0])\ngrid = [[0 for _ in range(COLS)] for _ in range(2)]\nfor i in range(ROWS - 1, -1, -1):\n for j in range(COLS):\n if i == ROWS - 1:\n grid[i & 1][j] = A[i][j]\n else:\n grid[i & 1][j] = grid[i + 1 & 1][j]\n if j + 1 < COLS:\n ...
<|body_start_0|> ROWS = len(A) COLS = len(A[0]) grid = [[0 for _ in range(COLS)] for _ in range(2)] for i in range(ROWS - 1, -1, -1): for j in range(COLS): if i == ROWS - 1: grid[i & 1][j] = A[i][j] else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minFallingPathSumBackwardDP(self, A: List[List[int]]) -> int: """Just save the min falling path (i, j) -> minimum value start from bottom row as base case, build next layer above based on bottom row.""" <|body_0|> def minFallingPathSum(self, A: List[List[int]])...
stack_v2_sparse_classes_36k_train_007418
3,215
no_license
[ { "docstring": "Just save the min falling path (i, j) -> minimum value start from bottom row as base case, build next layer above based on bottom row.", "name": "minFallingPathSumBackwardDP", "signature": "def minFallingPathSumBackwardDP(self, A: List[List[int]]) -> int" }, { "docstring": "Just ...
2
stack_v2_sparse_classes_30k_train_003989
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minFallingPathSumBackwardDP(self, A: List[List[int]]) -> int: Just save the min falling path (i, j) -> minimum value start from bottom row as base case, build next layer abov...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minFallingPathSumBackwardDP(self, A: List[List[int]]) -> int: Just save the min falling path (i, j) -> minimum value start from bottom row as base case, build next layer abov...
483f0c93faca8ccaf038b77ebe2fa712f6b0c6bc
<|skeleton|> class Solution: def minFallingPathSumBackwardDP(self, A: List[List[int]]) -> int: """Just save the min falling path (i, j) -> minimum value start from bottom row as base case, build next layer above based on bottom row.""" <|body_0|> def minFallingPathSum(self, A: List[List[int]])...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minFallingPathSumBackwardDP(self, A: List[List[int]]) -> int: """Just save the min falling path (i, j) -> minimum value start from bottom row as base case, build next layer above based on bottom row.""" ROWS = len(A) COLS = len(A[0]) grid = [[0 for _ in range(COLS...
the_stack_v2_python_sparse
Algorithms and Data Structures Practice/LeetCode Questions/MOST IMPORTANT PROBLEMS/931. Minimum Falling Path Sum.py
harman666666/Algorithms-Data-Structures-and-Design
train
3
b5453fc5941423d073bbfb6c14278ca4f6641323
[ "if not (nums1 or nums2):\n nums1 = []\nelif nums1 and (not nums2):\n nums1\nelif not nums1 and nums2:\n nums1 = nums2\nelse:\n len_nums1 = len(nums1)\n nums1_epos = m - 1\n nums2_epos = n - 1\n for i in range(len(nums1)):\n if nums1_epos >= 0 and nums2_epos >= 0:\n if nums1[n...
<|body_start_0|> if not (nums1 or nums2): nums1 = [] elif nums1 and (not nums2): nums1 elif not nums1 and nums2: nums1 = nums2 else: len_nums1 = len(nums1) nums1_epos = m - 1 nums2_epos = n - 1 for i in r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def merge_old(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead. 老方法, 没想到这么长... 44 ms 13.7 MB Python3 同样没想到的是, 这么高效, 击败了 96.04%""" <|body_0|> def merge(self, nums1: List[int], m: int, nums2: ...
stack_v2_sparse_classes_36k_train_007419
2,833
no_license
[ { "docstring": "Do not return anything, modify nums1 in-place instead. 老方法, 没想到这么长... 44 ms 13.7 MB Python3 同样没想到的是, 这么高效, 击败了 96.04%", "name": "merge_old", "signature": "def merge_old(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None" }, { "docstring": "20191021 52 ms 13.7 MB Py...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge_old(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: Do not return anything, modify nums1 in-place instead. 老方法, 没想到这么长... 44 ms 13.7 MB Python3 同样没想到...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def merge_old(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: Do not return anything, modify nums1 in-place instead. 老方法, 没想到这么长... 44 ms 13.7 MB Python3 同样没想到...
99a3abf1774933af73a8405f9b59e5e64906bca4
<|skeleton|> class Solution: def merge_old(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead. 老方法, 没想到这么长... 44 ms 13.7 MB Python3 同样没想到的是, 这么高效, 击败了 96.04%""" <|body_0|> def merge(self, nums1: List[int], m: int, nums2: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def merge_old(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """Do not return anything, modify nums1 in-place instead. 老方法, 没想到这么长... 44 ms 13.7 MB Python3 同样没想到的是, 这么高效, 击败了 96.04%""" if not (nums1 or nums2): nums1 = [] elif nums1 and (not num...
the_stack_v2_python_sparse
leetcode/88.merge_sorted_array.py
iamkissg/leetcode
train
0
ce006eafaad2de714d9f806ed5acb2c8f4c995f3
[ "super().__init__()\nself.init = tf.Variable(0.0, trainable=False)\nself.mean = tf.Variable(tf.zeros([channels]))\nself.logstd = tf.Variable(tf.zeros([channels]))", "denom = tf.reduce_sum(mask)\nmean = tf.reduce_sum(inputs, axis=[0, 1]) / denom\nvariance = tf.reduce_sum(tf.square(inputs), axis=[0, 1]) / denom - t...
<|body_start_0|> super().__init__() self.init = tf.Variable(0.0, trainable=False) self.mean = tf.Variable(tf.zeros([channels])) self.logstd = tf.Variable(tf.zeros([channels])) <|end_body_0|> <|body_start_1|> denom = tf.reduce_sum(mask) mean = tf.reduce_sum(inputs, axis=[...
Activation normalization.
ActNorm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActNorm: """Activation normalization.""" def __init__(self, channels: int): """Initializer. Args: channels: size of the input channels.""" <|body_0|> def ddi(self, inputs: tf.Tensor, mask: tf.Tensor): """Data-dependent initialization. Args: inputs: [tf.float32; [...
stack_v2_sparse_classes_36k_train_007420
2,415
permissive
[ { "docstring": "Initializer. Args: channels: size of the input channels.", "name": "__init__", "signature": "def __init__(self, channels: int)" }, { "docstring": "Data-dependent initialization. Args: inputs: [tf.float32; [B, T, C]], input tensor. mask: [tf.float32; [B, T]], binary sequence mask....
4
stack_v2_sparse_classes_30k_train_021059
Implement the Python class `ActNorm` described below. Class description: Activation normalization. Method signatures and docstrings: - def __init__(self, channels: int): Initializer. Args: channels: size of the input channels. - def ddi(self, inputs: tf.Tensor, mask: tf.Tensor): Data-dependent initialization. Args: i...
Implement the Python class `ActNorm` described below. Class description: Activation normalization. Method signatures and docstrings: - def __init__(self, channels: int): Initializer. Args: channels: size of the input channels. - def ddi(self, inputs: tf.Tensor, mask: tf.Tensor): Data-dependent initialization. Args: i...
c9df591d339eb998daf4f1e5a922a61309b6363d
<|skeleton|> class ActNorm: """Activation normalization.""" def __init__(self, channels: int): """Initializer. Args: channels: size of the input channels.""" <|body_0|> def ddi(self, inputs: tf.Tensor, mask: tf.Tensor): """Data-dependent initialization. Args: inputs: [tf.float32; [...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActNorm: """Activation normalization.""" def __init__(self, channels: int): """Initializer. Args: channels: size of the input channels.""" super().__init__() self.init = tf.Variable(0.0, trainable=False) self.mean = tf.Variable(tf.zeros([channels])) self.logstd = t...
the_stack_v2_python_sparse
glowtts/flow/actnorm.py
ishine/tf-glow-tts
train
0
e2b6fcdb10f659aba4f0941d17d3d9500875dff9
[ "g.sort()\ns.sort()\ng_length = len(g) - 1\ngave_cookies = 0\nfor select_cookie in s:\n if gave_cookies > g_length:\n break\n elif g[gave_cookies] <= select_cookie:\n gave_cookies += 1\nreturn gave_cookies", "g.sort()\ns.sort()\nchild = 0\ncookie = 0\nwhile child < len(g) and cookie < len(s):\...
<|body_start_0|> g.sort() s.sort() g_length = len(g) - 1 gave_cookies = 0 for select_cookie in s: if gave_cookies > g_length: break elif g[gave_cookies] <= select_cookie: gave_cookies += 1 return gave_cookies <|end_b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findContentChildren(self, g, s): """:type g: List[int] :type s: List[int] :rtype: int""" <|body_0|> def findContentChildren2(self, g, s): """:type g: List[int] :type s: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_007421
1,966
no_license
[ { "docstring": ":type g: List[int] :type s: List[int] :rtype: int", "name": "findContentChildren", "signature": "def findContentChildren(self, g, s)" }, { "docstring": ":type g: List[int] :type s: List[int] :rtype: int", "name": "findContentChildren2", "signature": "def findContentChildr...
2
stack_v2_sparse_classes_30k_train_017789
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findContentChildren(self, g, s): :type g: List[int] :type s: List[int] :rtype: int - def findContentChildren2(self, g, s): :type g: List[int] :type s: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findContentChildren(self, g, s): :type g: List[int] :type s: List[int] :rtype: int - def findContentChildren2(self, g, s): :type g: List[int] :type s: List[int] :rtype: int ...
3f0ffd519404165fd1a735441b212c801fd1ad1e
<|skeleton|> class Solution: def findContentChildren(self, g, s): """:type g: List[int] :type s: List[int] :rtype: int""" <|body_0|> def findContentChildren2(self, g, s): """:type g: List[int] :type s: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findContentChildren(self, g, s): """:type g: List[int] :type s: List[int] :rtype: int""" g.sort() s.sort() g_length = len(g) - 1 gave_cookies = 0 for select_cookie in s: if gave_cookies > g_length: break elif...
the_stack_v2_python_sparse
Problems/0400_0499/0455_Assign_Cookies/Project_Python3/Assign_Cookies.py
NobuyukiInoue/LeetCode
train
0
72c0fd0bd4515c28bb8b220ed799198fa5f501b5
[ "self.file_path = file_path\nwith open(file_path, 'r') as file:\n self.doc = yaml.safe_load(file)\n self.onto_doc = self.doc[ONTOLOGY_KEY]\n self.orig_onto_doc = deepcopy(self.onto_doc)\n self.namespace = self.doc[NAMESPACE_KEY].lower()\n self.ambiguity_resolution = dict()", "self.doc[NAMESPACE_KEY...
<|body_start_0|> self.file_path = file_path with open(file_path, 'r') as file: self.doc = yaml.safe_load(file) self.onto_doc = self.doc[ONTOLOGY_KEY] self.orig_onto_doc = deepcopy(self.onto_doc) self.namespace = self.doc[NAMESPACE_KEY].lower() ...
Tool that transforms entity names of YAML ontologies. Input: YAML with with entity name in ALL_CAPS Output: YAML ontology in CamelCase.
Yaml2CamelCaseConverter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Yaml2CamelCaseConverter: """Tool that transforms entity names of YAML ontologies. Input: YAML with with entity name in ALL_CAPS Output: YAML ontology in CamelCase.""" def __init__(self, file_path): """Initialize the converter. Args: file_path (path): Path to the yaml file to convert"...
stack_v2_sparse_classes_36k_train_007422
7,542
permissive
[ { "docstring": "Initialize the converter. Args: file_path (path): Path to the yaml file to convert", "name": "__init__", "signature": "def __init__(self, file_path)" }, { "docstring": "Convert the yaml file to CamelCase.", "name": "convert", "signature": "def convert(self)" }, { ...
6
null
Implement the Python class `Yaml2CamelCaseConverter` described below. Class description: Tool that transforms entity names of YAML ontologies. Input: YAML with with entity name in ALL_CAPS Output: YAML ontology in CamelCase. Method signatures and docstrings: - def __init__(self, file_path): Initialize the converter. ...
Implement the Python class `Yaml2CamelCaseConverter` described below. Class description: Tool that transforms entity names of YAML ontologies. Input: YAML with with entity name in ALL_CAPS Output: YAML ontology in CamelCase. Method signatures and docstrings: - def __init__(self, file_path): Initialize the converter. ...
17a6bbabbe972c63a75cdfca15deeee41840cd31
<|skeleton|> class Yaml2CamelCaseConverter: """Tool that transforms entity names of YAML ontologies. Input: YAML with with entity name in ALL_CAPS Output: YAML ontology in CamelCase.""" def __init__(self, file_path): """Initialize the converter. Args: file_path (path): Path to the yaml file to convert"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Yaml2CamelCaseConverter: """Tool that transforms entity names of YAML ontologies. Input: YAML with with entity name in ALL_CAPS Output: YAML ontology in CamelCase.""" def __init__(self, file_path): """Initialize the converter. Args: file_path (path): Path to the yaml file to convert""" se...
the_stack_v2_python_sparse
osp/core/tools/yaml2camelcase.py
tareq97/osp-core
train
0
7a76768f600a22465cfc08608bbc7dee71a9176d
[ "querier = wt_uu.CreateGenericWebTestQuerier()\nwith self.assertRaises(RuntimeError):\n querier._StripPrefixFromTestId('foobar')", "querier = wt_uu.CreateGenericWebTestQuerier()\ntest_ids = [prefix + 'a' for prefix in queries.KNOWN_TEST_ID_PREFIXES]\nfor t in test_ids:\n stripped = querier._StripPrefixFromT...
<|body_start_0|> querier = wt_uu.CreateGenericWebTestQuerier() with self.assertRaises(RuntimeError): querier._StripPrefixFromTestId('foobar') <|end_body_0|> <|body_start_1|> querier = wt_uu.CreateGenericWebTestQuerier() test_ids = [prefix + 'a' for prefix in queries.KNOWN_TE...
StripPrefixFromTestIdUnittest
[ "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "BSD-3-Clause", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StripPrefixFromTestIdUnittest: def testUnknownPrefix(self) -> None: """Tests that an error is raised if an unknown prefix is found.""" <|body_0|> def testKnownPrefixes(self) -> None: """Tests that all known prefixes are properly stripped.""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_007423
21,966
permissive
[ { "docstring": "Tests that an error is raised if an unknown prefix is found.", "name": "testUnknownPrefix", "signature": "def testUnknownPrefix(self) -> None" }, { "docstring": "Tests that all known prefixes are properly stripped.", "name": "testKnownPrefixes", "signature": "def testKnow...
2
null
Implement the Python class `StripPrefixFromTestIdUnittest` described below. Class description: Implement the StripPrefixFromTestIdUnittest class. Method signatures and docstrings: - def testUnknownPrefix(self) -> None: Tests that an error is raised if an unknown prefix is found. - def testKnownPrefixes(self) -> None:...
Implement the Python class `StripPrefixFromTestIdUnittest` described below. Class description: Implement the StripPrefixFromTestIdUnittest class. Method signatures and docstrings: - def testUnknownPrefix(self) -> None: Tests that an error is raised if an unknown prefix is found. - def testKnownPrefixes(self) -> None:...
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
<|skeleton|> class StripPrefixFromTestIdUnittest: def testUnknownPrefix(self) -> None: """Tests that an error is raised if an unknown prefix is found.""" <|body_0|> def testKnownPrefixes(self) -> None: """Tests that all known prefixes are properly stripped.""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StripPrefixFromTestIdUnittest: def testUnknownPrefix(self) -> None: """Tests that an error is raised if an unknown prefix is found.""" querier = wt_uu.CreateGenericWebTestQuerier() with self.assertRaises(RuntimeError): querier._StripPrefixFromTestId('foobar') def testK...
the_stack_v2_python_sparse
third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/queries_unittest.py
chromium/chromium
train
17,408
eab69e98c7836be620d6ac3b1f40c131a6ed22f4
[ "widget.setStyle(QtWidgets.QStyleFactory.create('Fusion'))\ncls.__applyFont(widget)\ncls.__applyPalette(widget)\nwidget.setStyleSheet(Resource.stylesheet())", "defaultFont = QtWidgets.QApplication.font()\ndefaultFont.setPointSize(defaultFont.pointSize() + 2.0)\nwidget.setFont(defaultFont)", "darkPalette = QtGui...
<|body_start_0|> widget.setStyle(QtWidgets.QStyleFactory.create('Fusion')) cls.__applyFont(widget) cls.__applyPalette(widget) widget.setStyleSheet(Resource.stylesheet()) <|end_body_0|> <|body_start_1|> defaultFont = QtWidgets.QApplication.font() defaultFont.setPointSize(...
Kombi style.
Style
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Style: """Kombi style.""" def apply(cls, widget): """Apply the default stylesheet to the interface.""" <|body_0|> def __applyFont(cls, widget): """Apply the default font.""" <|body_1|> def __applyPalette(cls, widget): """Apply the palette to ...
stack_v2_sparse_classes_36k_train_007424
3,404
permissive
[ { "docstring": "Apply the default stylesheet to the interface.", "name": "apply", "signature": "def apply(cls, widget)" }, { "docstring": "Apply the default font.", "name": "__applyFont", "signature": "def __applyFont(cls, widget)" }, { "docstring": "Apply the palette to the widg...
3
null
Implement the Python class `Style` described below. Class description: Kombi style. Method signatures and docstrings: - def apply(cls, widget): Apply the default stylesheet to the interface. - def __applyFont(cls, widget): Apply the default font. - def __applyPalette(cls, widget): Apply the palette to the widget.
Implement the Python class `Style` described below. Class description: Kombi style. Method signatures and docstrings: - def apply(cls, widget): Apply the default stylesheet to the interface. - def __applyFont(cls, widget): Apply the default font. - def __applyPalette(cls, widget): Apply the palette to the widget. <|...
046dbb0c1b4ff20ea5f2e1679f8d89f3089b6aa4
<|skeleton|> class Style: """Kombi style.""" def apply(cls, widget): """Apply the default stylesheet to the interface.""" <|body_0|> def __applyFont(cls, widget): """Apply the default font.""" <|body_1|> def __applyPalette(cls, widget): """Apply the palette to ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Style: """Kombi style.""" def apply(cls, widget): """Apply the default stylesheet to the interface.""" widget.setStyle(QtWidgets.QStyleFactory.create('Fusion')) cls.__applyFont(widget) cls.__applyPalette(widget) widget.setStyleSheet(Resource.stylesheet()) def ...
the_stack_v2_python_sparse
src/lib/kombiqt/Style.py
kombiHQ/kombi
train
2
7f21dcf95b011292844fa197982adee16c80fead
[ "super().__init__(in_channels=in_channels, squeeze_ratio=squeeze_ratio, conv=conv, activation=activation, gate_activation=gate_activation)\nself.conv_squeeze2 = Conv(conv, in_channels=in_channels, out_channels=1, kernel_size=1, padding=0)\nself.gate2 = Activation(gate_activation)", "x_ce = x.mean((2, 3), keepdim=...
<|body_start_0|> super().__init__(in_channels=in_channels, squeeze_ratio=squeeze_ratio, conv=conv, activation=activation, gate_activation=gate_activation) self.conv_squeeze2 = Conv(conv, in_channels=in_channels, out_channels=1, kernel_size=1, padding=0) self.gate2 = Activation(gate_activation) <...
SCSqueezeAndExcite
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SCSqueezeAndExcite: def __init__(self, in_channels: int, squeeze_ratio: float=0.25, conv: str='conv', activation: str='relu', gate_activation: str='sigmoid', **kwargs) -> None: """Spatial and Channel Squeeze & Excitation. https://arxiv.org/abs/1803.02579 Parameters ---------- in_channels...
stack_v2_sparse_classes_36k_train_007425
11,576
permissive
[ { "docstring": "Spatial and Channel Squeeze & Excitation. https://arxiv.org/abs/1803.02579 Parameters ---------- in_channels : int Number of input channels. squeeze_ratio : float, default=0.25 Ratio of squeeze. conv : str, default=\"conv\" Convolution layer type. activation : str, default=\"relu\" Activation la...
2
null
Implement the Python class `SCSqueezeAndExcite` described below. Class description: Implement the SCSqueezeAndExcite class. Method signatures and docstrings: - def __init__(self, in_channels: int, squeeze_ratio: float=0.25, conv: str='conv', activation: str='relu', gate_activation: str='sigmoid', **kwargs) -> None: S...
Implement the Python class `SCSqueezeAndExcite` described below. Class description: Implement the SCSqueezeAndExcite class. Method signatures and docstrings: - def __init__(self, in_channels: int, squeeze_ratio: float=0.25, conv: str='conv', activation: str='relu', gate_activation: str='sigmoid', **kwargs) -> None: S...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class SCSqueezeAndExcite: def __init__(self, in_channels: int, squeeze_ratio: float=0.25, conv: str='conv', activation: str='relu', gate_activation: str='sigmoid', **kwargs) -> None: """Spatial and Channel Squeeze & Excitation. https://arxiv.org/abs/1803.02579 Parameters ---------- in_channels...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SCSqueezeAndExcite: def __init__(self, in_channels: int, squeeze_ratio: float=0.25, conv: str='conv', activation: str='relu', gate_activation: str='sigmoid', **kwargs) -> None: """Spatial and Channel Squeeze & Excitation. https://arxiv.org/abs/1803.02579 Parameters ---------- in_channels : int Number ...
the_stack_v2_python_sparse
cellseg_models_pytorch/modules/attention_modules.py
okunator/cellseg_models.pytorch
train
43
bb187ee689ddcfc19545b1920cc5882d37236f62
[ "A = a.split('+')\nB = b.split('+')\nA[-1] = A[-1][0:-1]\nB[-1] = B[-1][0:-1]\nfirst = int(A[0]) * int(B[0])\nsecond = -int(A[-1]) * int(B[-1])\nthrid = int(A[0]) * int(B[-1]) + int(A[-1]) * int(B[0])\na = first + second\nb = str(thrid) + 'i'\nreturn str(a) + '+' + b", "def parse(s):\n array = s.split('+')\n ...
<|body_start_0|> A = a.split('+') B = b.split('+') A[-1] = A[-1][0:-1] B[-1] = B[-1][0:-1] first = int(A[0]) * int(B[0]) second = -int(A[-1]) * int(B[-1]) thrid = int(A[0]) * int(B[-1]) + int(A[-1]) * int(B[0]) a = first + second b = str(thrid) + '...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def complexNumberMultiply(self, a, b): """:type a: str :type b: str :rtype: str 36ms""" <|body_0|> def complexNumberMultiply_1(self, a, b): """:type a: str :type b: str :rtype: str 33ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> A = a...
stack_v2_sparse_classes_36k_train_007426
1,892
no_license
[ { "docstring": ":type a: str :type b: str :rtype: str 36ms", "name": "complexNumberMultiply", "signature": "def complexNumberMultiply(self, a, b)" }, { "docstring": ":type a: str :type b: str :rtype: str 33ms", "name": "complexNumberMultiply_1", "signature": "def complexNumberMultiply_1(...
2
stack_v2_sparse_classes_30k_train_014196
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def complexNumberMultiply(self, a, b): :type a: str :type b: str :rtype: str 36ms - def complexNumberMultiply_1(self, a, b): :type a: str :type b: str :rtype: str 33ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def complexNumberMultiply(self, a, b): :type a: str :type b: str :rtype: str 36ms - def complexNumberMultiply_1(self, a, b): :type a: str :type b: str :rtype: str 33ms <|skeleto...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def complexNumberMultiply(self, a, b): """:type a: str :type b: str :rtype: str 36ms""" <|body_0|> def complexNumberMultiply_1(self, a, b): """:type a: str :type b: str :rtype: str 33ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def complexNumberMultiply(self, a, b): """:type a: str :type b: str :rtype: str 36ms""" A = a.split('+') B = b.split('+') A[-1] = A[-1][0:-1] B[-1] = B[-1][0:-1] first = int(A[0]) * int(B[0]) second = -int(A[-1]) * int(B[-1]) thrid = in...
the_stack_v2_python_sparse
ComplexNumberMultiplication_MID_537.py
953250587/leetcode-python
train
2
42c9ff7bb15008ac358d54a560329cb4ceb8560a
[ "self.deployed_vm_name = deployed_vm_name\nself.entity = entity\nself.error = error\nself.previous_relative_clone_dir_path = previous_relative_clone_dir_path\nself.previous_relative_clone_paths = previous_relative_clone_paths\nself.progress_monitor_task_path = progress_monitor_task_path\nself.public_status = public...
<|body_start_0|> self.deployed_vm_name = deployed_vm_name self.entity = entity self.error = error self.previous_relative_clone_dir_path = previous_relative_clone_dir_path self.previous_relative_clone_paths = previous_relative_clone_paths self.progress_monitor_task_path = ...
Implementation of the 'CloudDeployInfoProto_CloudDeployEntity' model. TODO: type description here. Attributes: deployed_vm_name (string): Optional name that should be used for deployed VM. entity (EntityProto): The entity that was deployed to cloud. error (ErrorProto): If cloud deploy of the 'entity' failed, this field...
CloudDeployInfoProto_CloudDeployEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudDeployInfoProto_CloudDeployEntity: """Implementation of the 'CloudDeployInfoProto_CloudDeployEntity' model. TODO: type description here. Attributes: deployed_vm_name (string): Optional name that should be used for deployed VM. entity (EntityProto): The entity that was deployed to cloud. erro...
stack_v2_sparse_classes_36k_train_007427
4,761
permissive
[ { "docstring": "Constructor for the CloudDeployInfoProto_CloudDeployEntity class", "name": "__init__", "signature": "def __init__(self, deployed_vm_name=None, entity=None, error=None, previous_relative_clone_dir_path=None, previous_relative_clone_paths=None, progress_monitor_task_path=None, public_statu...
2
null
Implement the Python class `CloudDeployInfoProto_CloudDeployEntity` described below. Class description: Implementation of the 'CloudDeployInfoProto_CloudDeployEntity' model. TODO: type description here. Attributes: deployed_vm_name (string): Optional name that should be used for deployed VM. entity (EntityProto): The ...
Implement the Python class `CloudDeployInfoProto_CloudDeployEntity` described below. Class description: Implementation of the 'CloudDeployInfoProto_CloudDeployEntity' model. TODO: type description here. Attributes: deployed_vm_name (string): Optional name that should be used for deployed VM. entity (EntityProto): The ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class CloudDeployInfoProto_CloudDeployEntity: """Implementation of the 'CloudDeployInfoProto_CloudDeployEntity' model. TODO: type description here. Attributes: deployed_vm_name (string): Optional name that should be used for deployed VM. entity (EntityProto): The entity that was deployed to cloud. erro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CloudDeployInfoProto_CloudDeployEntity: """Implementation of the 'CloudDeployInfoProto_CloudDeployEntity' model. TODO: type description here. Attributes: deployed_vm_name (string): Optional name that should be used for deployed VM. entity (EntityProto): The entity that was deployed to cloud. error (ErrorProto...
the_stack_v2_python_sparse
cohesity_management_sdk/models/cloud_deploy_info_proto_cloud_deploy_entity.py
cohesity/management-sdk-python
train
24
1c37808ebe07f3928a57cbe559765bf9692b1692
[ "debug.log('Asking whether the inventory source can be updated.', header='details')\nr = client.get('%s%d/update/' % (self.endpoint, inventory_source))\nif not r.json()['can_update']:\n raise exc.BadRequest('Tower says it cannot run an update against this inventory source.')\ndebug.log('Updating the inventory so...
<|body_start_0|> debug.log('Asking whether the inventory source can be updated.', header='details') r = client.get('%s%d/update/' % (self.endpoint, inventory_source)) if not r.json()['can_update']: raise exc.BadRequest('Tower says it cannot run an update against this inventory source...
Resource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Resource: def update(self, inventory_source, monitor=False, timeout=None, **kwargs): """Update the given inventory source.""" <|body_0|> def status(self, pk, detail=False): """Print the current job status.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_007428
5,001
permissive
[ { "docstring": "Update the given inventory source.", "name": "update", "signature": "def update(self, inventory_source, monitor=False, timeout=None, **kwargs)" }, { "docstring": "Print the current job status.", "name": "status", "signature": "def status(self, pk, detail=False)" } ]
2
stack_v2_sparse_classes_30k_train_020567
Implement the Python class `Resource` described below. Class description: Implement the Resource class. Method signatures and docstrings: - def update(self, inventory_source, monitor=False, timeout=None, **kwargs): Update the given inventory source. - def status(self, pk, detail=False): Print the current job status.
Implement the Python class `Resource` described below. Class description: Implement the Resource class. Method signatures and docstrings: - def update(self, inventory_source, monitor=False, timeout=None, **kwargs): Update the given inventory source. - def status(self, pk, detail=False): Print the current job status. ...
e6a1f62a4f33ea94ff7dd53b9690a7b3057a7a31
<|skeleton|> class Resource: def update(self, inventory_source, monitor=False, timeout=None, **kwargs): """Update the given inventory source.""" <|body_0|> def status(self, pk, detail=False): """Print the current job status.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Resource: def update(self, inventory_source, monitor=False, timeout=None, **kwargs): """Update the given inventory source.""" debug.log('Asking whether the inventory source can be updated.', header='details') r = client.get('%s%d/update/' % (self.endpoint, inventory_source)) if...
the_stack_v2_python_sparse
lib/tower_cli/resources/inventory_source.py
willthames/tower-cli
train
2
1d398b6aad9a1c4400e3bc8d302806ad821363bf
[ "QtGui.QFrame.__init__(self, args[0])\nself.setObjectName(args[1])\nself.orientation = kwargs.get('orientation', 'horizontal')\nself.execution_mode = kwargs.get('executionMode', False)\nself.setFixedSize(-1)\nif self.orientation == 'horizontal':\n self.main_layout = QtGui.QHBoxLayout()\nelse:\n self.main_layo...
<|body_start_0|> QtGui.QFrame.__init__(self, args[0]) self.setObjectName(args[1]) self.orientation = kwargs.get('orientation', 'horizontal') self.execution_mode = kwargs.get('executionMode', False) self.setFixedSize(-1) if self.orientation == 'horizontal': sel...
Descript. :
Spacer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Spacer: """Descript. :""" def __init__(self, *args, **kwargs): """Descript. :""" <|body_0|> def setFixedSize(self, fixed_size): """Descript. :""" <|body_1|> def paintEvent(self, event): """Descript. :""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_007429
46,303
no_license
[ { "docstring": "Descript. :", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Descript. :", "name": "setFixedSize", "signature": "def setFixedSize(self, fixed_size)" }, { "docstring": "Descript. :", "name": "paintEvent", "signatur...
3
null
Implement the Python class `Spacer` described below. Class description: Descript. : Method signatures and docstrings: - def __init__(self, *args, **kwargs): Descript. : - def setFixedSize(self, fixed_size): Descript. : - def paintEvent(self, event): Descript. :
Implement the Python class `Spacer` described below. Class description: Descript. : Method signatures and docstrings: - def __init__(self, *args, **kwargs): Descript. : - def setFixedSize(self, fixed_size): Descript. : - def paintEvent(self, event): Descript. : <|skeleton|> class Spacer: """Descript. :""" d...
11486d6c91fc0077e967cb2321743466a7c1aa8b
<|skeleton|> class Spacer: """Descript. :""" def __init__(self, *args, **kwargs): """Descript. :""" <|body_0|> def setFixedSize(self, fixed_size): """Descript. :""" <|body_1|> def paintEvent(self, event): """Descript. :""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Spacer: """Descript. :""" def __init__(self, *args, **kwargs): """Descript. :""" QtGui.QFrame.__init__(self, args[0]) self.setObjectName(args[1]) self.orientation = kwargs.get('orientation', 'horizontal') self.execution_mode = kwargs.get('executionMode', False) ...
the_stack_v2_python_sparse
Utils/Qt4_GUIDisplay.py
douglasbeniz/BlissFramework
train
0
c76efe424fb0b553f6973a73c124619f02014b27
[ "self.generator = generator\nself.summary = summary\nself.prompt = not always\nself.unprotect = unprotect\nself.edit = edit\nself.move = move", "for page in self.generator:\n pywikibot.output(u'Processing page %s' % page.title())\n page.protect(unprotect=self.unprotect, reason=self.summary, prompt=self.prom...
<|body_start_0|> self.generator = generator self.summary = summary self.prompt = not always self.unprotect = unprotect self.edit = edit self.move = move <|end_body_0|> <|body_start_1|> for page in self.generator: pywikibot.output(u'Processing page %s'...
This bot allows protection of pages en masse.
ProtectionRobot
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProtectionRobot: """This bot allows protection of pages en masse.""" def __init__(self, generator, summary, always=False, unprotect=False, edit='sysop', move='sysop', create='sysop'): """Arguments: * generator - A page generator. * always - Protect without prompting? * edit, move, cr...
stack_v2_sparse_classes_36k_train_007430
7,140
permissive
[ { "docstring": "Arguments: * generator - A page generator. * always - Protect without prompting? * edit, move, create - protection level for these operations * unprotect - unprotect pages (and ignore edit, move, create params)", "name": "__init__", "signature": "def __init__(self, generator, summary, al...
2
stack_v2_sparse_classes_30k_train_016572
Implement the Python class `ProtectionRobot` described below. Class description: This bot allows protection of pages en masse. Method signatures and docstrings: - def __init__(self, generator, summary, always=False, unprotect=False, edit='sysop', move='sysop', create='sysop'): Arguments: * generator - A page generato...
Implement the Python class `ProtectionRobot` described below. Class description: This bot allows protection of pages en masse. Method signatures and docstrings: - def __init__(self, generator, summary, always=False, unprotect=False, edit='sysop', move='sysop', create='sysop'): Arguments: * generator - A page generato...
23e23240854aef59108b16b63a567fffb2aabb69
<|skeleton|> class ProtectionRobot: """This bot allows protection of pages en masse.""" def __init__(self, generator, summary, always=False, unprotect=False, edit='sysop', move='sysop', create='sysop'): """Arguments: * generator - A page generator. * always - Protect without prompting? * edit, move, cr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProtectionRobot: """This bot allows protection of pages en masse.""" def __init__(self, generator, summary, always=False, unprotect=False, edit='sysop', move='sysop', create='sysop'): """Arguments: * generator - A page generator. * always - Protect without prompting? * edit, move, create - protec...
the_stack_v2_python_sparse
ExpertIdeas_WikipediaProxyServer_Bot_EmailTracking/ExpertIdeas/core/scripts/protect.py
ImanYZ/ExpertIdeas
train
0
9f79f26badca04ddf1a3cbdbaa307bab41e2e4d4
[ "if hdl[:5] == 'xxxxx':\n self.msg = self.dh.hh[hdl]\nelse:\n if url == None:\n thisid = hdl.replace('hdl:999999', '10876.test')\n if thisid[:4] == 'hdl:':\n thisid = thisid[4:]\n url = self.htmpl % thisid\n self.fetch(url)", "try:\n fh = request.urlopen(url)\n self....
<|body_start_0|> if hdl[:5] == 'xxxxx': self.msg = self.dh.hh[hdl] else: if url == None: thisid = hdl.replace('hdl:999999', '10876.test') if thisid[:4] == 'hdl:': thisid = thisid[4:] url = self.htmpl % thisid ...
Remote
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Remote: def __init__(self, hdl, url=None): """Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code.""" <|body_0|> def fetch(self, url): """Retrieve the handle data, using urllib ir reques...
stack_v2_sparse_classes_36k_train_007431
14,203
permissive
[ { "docstring": "Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code.", "name": "__init__", "signature": "def __init__(self, hdl, url=None)" }, { "docstring": "Retrieve the handle data, using urllib ir requests libra...
2
stack_v2_sparse_classes_30k_train_009771
Implement the Python class `Remote` described below. Class description: Implement the Remote class. Method signatures and docstrings: - def __init__(self, hdl, url=None): Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code. - def fetch(s...
Implement the Python class `Remote` described below. Class description: Implement the Remote class. Method signatures and docstrings: - def __init__(self, hdl, url=None): Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code. - def fetch(s...
6fca2632029a2adb9736bfc1382b39f82d8a27e1
<|skeleton|> class Remote: def __init__(self, hdl, url=None): """Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code.""" <|body_0|> def fetch(self, url): """Retrieve the handle data, using urllib ir reques...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Remote: def __init__(self, hdl, url=None): """Class to retrieve a handle .. optionally to retrieve from test data. Still needs some error handling based on the HTTP response code.""" if hdl[:5] == 'xxxxx': self.msg = self.dh.hh[hdl] else: if url == None: ...
the_stack_v2_python_sparse
ddc_packages/hddump/hddump/hddumpMain.py
cp4cds/cmip6_range_check_2
train
0
5f77c5318a4541c5e746d74d3fe1d3c2d656643a
[ "email_content, receivers_email = self.generate_report(task_id=task_id)\nlogger.info('task task_id:{} has been checked out, hunter will send result to email:{}'.format(task_id, receivers_email))\nif receivers_email is not None and receivers_email.strip() != '':\n EmailUtils().send_mail_with_ssl(receivers_email, ...
<|body_start_0|> email_content, receivers_email = self.generate_report(task_id=task_id) logger.info('task task_id:{} has been checked out, hunter will send result to email:{}'.format(task_id, receivers_email)) if receivers_email is not None and receivers_email.strip() != '': EmailUti...
EmailObserver
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailObserver: def notify(self, task_id): """发送邮件通知 :return:""" <|body_0|> def generate_report(self, task_id): """生成邮件发送报告 :param cls: :param task_id: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> email_content, receivers_email = self.gen...
stack_v2_sparse_classes_36k_train_007432
4,435
permissive
[ { "docstring": "发送邮件通知 :return:", "name": "notify", "signature": "def notify(self, task_id)" }, { "docstring": "生成邮件发送报告 :param cls: :param task_id: :return:", "name": "generate_report", "signature": "def generate_report(self, task_id)" } ]
2
stack_v2_sparse_classes_30k_train_003549
Implement the Python class `EmailObserver` described below. Class description: Implement the EmailObserver class. Method signatures and docstrings: - def notify(self, task_id): 发送邮件通知 :return: - def generate_report(self, task_id): 生成邮件发送报告 :param cls: :param task_id: :return:
Implement the Python class `EmailObserver` described below. Class description: Implement the EmailObserver class. Method signatures and docstrings: - def notify(self, task_id): 发送邮件通知 :return: - def generate_report(self, task_id): 生成邮件发送报告 :param cls: :param task_id: :return: <|skeleton|> class EmailObserver: d...
4ee5cca8dc5fc5d7e631e935517bd0f493c30a37
<|skeleton|> class EmailObserver: def notify(self, task_id): """发送邮件通知 :return:""" <|body_0|> def generate_report(self, task_id): """生成邮件发送报告 :param cls: :param task_id: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailObserver: def notify(self, task_id): """发送邮件通知 :return:""" email_content, receivers_email = self.generate_report(task_id=task_id) logger.info('task task_id:{} has been checked out, hunter will send result to email:{}'.format(task_id, receivers_email)) if receivers_email is...
the_stack_v2_python_sparse
HunterCelery/notice/email_observer.py
a1kaid/hunter
train
0
0783c86779c801aa5a8b7001d7a186dda43ac186
[ "self.instruction = instruction\nself.cycles = {}\nfor stage in STAGES:\n self.cycles[stage] = 0\nself.cycles[STAGES[0]] = cycle\nself.hazards = {}\nfor hazard in HAZARDS:\n self.hazards[hazard] = False", "string = ''\nfor label, location in LABEL.items():\n if self.instruction.location == location:\n ...
<|body_start_0|> self.instruction = instruction self.cycles = {} for stage in STAGES: self.cycles[stage] = 0 self.cycles[STAGES[0]] = cycle self.hazards = {} for hazard in HAZARDS: self.hazards[hazard] = False <|end_body_0|> <|body_start_1|> ...
Class to present the resulting output.
Output
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Output: """Class to present the resulting output.""" def __init__(self, instruction, cycle=0): """Initialize the output.""" <|body_0|> def __str__(self): """Convert to string representation.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.i...
stack_v2_sparse_classes_36k_train_007433
1,233
no_license
[ { "docstring": "Initialize the output.", "name": "__init__", "signature": "def __init__(self, instruction, cycle=0)" }, { "docstring": "Convert to string representation.", "name": "__str__", "signature": "def __str__(self)" } ]
2
stack_v2_sparse_classes_30k_train_014411
Implement the Python class `Output` described below. Class description: Class to present the resulting output. Method signatures and docstrings: - def __init__(self, instruction, cycle=0): Initialize the output. - def __str__(self): Convert to string representation.
Implement the Python class `Output` described below. Class description: Class to present the resulting output. Method signatures and docstrings: - def __init__(self, instruction, cycle=0): Initialize the output. - def __str__(self): Convert to string representation. <|skeleton|> class Output: """Class to present...
fe92989ee0d1a864e3985fce3e708041c2917768
<|skeleton|> class Output: """Class to present the resulting output.""" def __init__(self, instruction, cycle=0): """Initialize the output.""" <|body_0|> def __str__(self): """Convert to string representation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Output: """Class to present the resulting output.""" def __init__(self, instruction, cycle=0): """Initialize the output.""" self.instruction = instruction self.cycles = {} for stage in STAGES: self.cycles[stage] = 0 self.cycles[STAGES[0]] = cycle ...
the_stack_v2_python_sparse
output.py
manishc1/MIPS_Simulator
train
0
a8b23a9281af45585b521befb87576a4090b7b6c
[ "if not message:\n raise ValueError('Message can not be empty.')\nif not phone_number:\n raise ValueError('Phone number can not be empty.')\ntry:\n parsed_number = phonenumbers.parse(phone_number)\n parsed_number = phonenumbers.format_number(parsed_number, phonenumbers.PhoneNumberFormat.E164)\nexcept ph...
<|body_start_0|> if not message: raise ValueError('Message can not be empty.') if not phone_number: raise ValueError('Phone number can not be empty.') try: parsed_number = phonenumbers.parse(phone_number) parsed_number = phonenumbers.format_number(...
Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interval of the day.
SendQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SendQueue: """Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interval of the day.""" def enqueue(cls, ...
stack_v2_sparse_classes_36k_train_007434
1,997
no_license
[ { "docstring": "Adds message to the queue. :param message: body of the SMS. :param phone_number: number which should receive notification. :param date_queued: date when notification should be sent.", "name": "enqueue", "signature": "def enqueue(cls, message, phone_number, date_queued)" }, { "doc...
2
stack_v2_sparse_classes_30k_train_008887
Implement the Python class `SendQueue` described below. Class description: Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interva...
Implement the Python class `SendQueue` described below. Class description: Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interva...
c060941b16c36d258989206f9c2143b5179b4acd
<|skeleton|> class SendQueue: """Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interval of the day.""" def enqueue(cls, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SendQueue: """Customers doesn't like to receive notifications in middle of the night, but almost all processing of the customer's data will be done at night. So this queue is used to collect users sms notifications and to sent them in acceptable time interval of the day.""" def enqueue(cls, message, phon...
the_stack_v2_python_sparse
core/users/notifications/sms_dispatcher/models.py
HaySayCheese/mappino
train
0
266d0b511448142495c7a31e15c35c266adff5f5
[ "from .node import OZWNode\nparent = self.parent\nwhile parent is not None and (not isinstance(parent, OZWNode)):\n parent = parent.parent\nif isinstance(parent, OZWNode):\n return cast(OZWNode, parent)\nraise RuntimeError('Object is not a descendant of a Node')", "iden = f' {self.id}' if self.id else ''\nt...
<|body_start_0|> from .node import OZWNode parent = self.parent while parent is not None and (not isinstance(parent, OZWNode)): parent = parent.parent if isinstance(parent, OZWNode): return cast(OZWNode, parent) raise RuntimeError('Object is not a descenda...
Base class for objects that are descendants of a Node object.
OZWNodeChildBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OZWNodeChildBase: """Base class for objects that are descendants of a Node object.""" def node(self): """Return the node that this child belongs to.""" <|body_0|> def __repr__(self): """Return a representation of this object.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_007435
926
permissive
[ { "docstring": "Return the node that this child belongs to.", "name": "node", "signature": "def node(self)" }, { "docstring": "Return a representation of this object.", "name": "__repr__", "signature": "def __repr__(self)" } ]
2
stack_v2_sparse_classes_30k_train_016845
Implement the Python class `OZWNodeChildBase` described below. Class description: Base class for objects that are descendants of a Node object. Method signatures and docstrings: - def node(self): Return the node that this child belongs to. - def __repr__(self): Return a representation of this object.
Implement the Python class `OZWNodeChildBase` described below. Class description: Base class for objects that are descendants of a Node object. Method signatures and docstrings: - def node(self): Return the node that this child belongs to. - def __repr__(self): Return a representation of this object. <|skeleton|> cl...
3bf4ce3b2f4bfce65dec5580c7692bc7b699e3ba
<|skeleton|> class OZWNodeChildBase: """Base class for objects that are descendants of a Node object.""" def node(self): """Return the node that this child belongs to.""" <|body_0|> def __repr__(self): """Return a representation of this object.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OZWNodeChildBase: """Base class for objects that are descendants of a Node object.""" def node(self): """Return the node that this child belongs to.""" from .node import OZWNode parent = self.parent while parent is not None and (not isinstance(parent, OZWNode)): ...
the_stack_v2_python_sparse
openzwavemqtt/models/node_child_base.py
cgarwood/python-openzwave-mqtt
train
63
f6c49486c40dc3ead3418a22a3127157209bbd06
[ "from math import sqrt\nwhile c % 2 == 0:\n c /= 2\n if c == 0:\n return True\nif sqrt(c) == int(sqrt(c)):\n return True\nd = {}\nfor i in range(1, int(sqrt(c)) + 1):\n if i ** 2 in d:\n return True\n else:\n d[c - i ** 2] = i ** 2\nreturn False", "from math import sqrt\ni = 0\...
<|body_start_0|> from math import sqrt while c % 2 == 0: c /= 2 if c == 0: return True if sqrt(c) == int(sqrt(c)): return True d = {} for i in range(1, int(sqrt(c)) + 1): if i ** 2 in d: return True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def judgeSquareSum(self, c): """:type c: int :rtype: bool""" <|body_0|> def judgeSquareSum2(self, c): """:type c: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> from math import sqrt while c % 2 == 0: ...
stack_v2_sparse_classes_36k_train_007436
863
no_license
[ { "docstring": ":type c: int :rtype: bool", "name": "judgeSquareSum", "signature": "def judgeSquareSum(self, c)" }, { "docstring": ":type c: int :rtype: bool", "name": "judgeSquareSum2", "signature": "def judgeSquareSum2(self, c)" } ]
2
stack_v2_sparse_classes_30k_train_015088
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def judgeSquareSum(self, c): :type c: int :rtype: bool - def judgeSquareSum2(self, c): :type c: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def judgeSquareSum(self, c): :type c: int :rtype: bool - def judgeSquareSum2(self, c): :type c: int :rtype: bool <|skeleton|> class Solution: def judgeSquareSum(self, c): ...
624975f767f6efa1d7361cc077eaebc344d57210
<|skeleton|> class Solution: def judgeSquareSum(self, c): """:type c: int :rtype: bool""" <|body_0|> def judgeSquareSum2(self, c): """:type c: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def judgeSquareSum(self, c): """:type c: int :rtype: bool""" from math import sqrt while c % 2 == 0: c /= 2 if c == 0: return True if sqrt(c) == int(sqrt(c)): return True d = {} for i in range(1, int(...
the_stack_v2_python_sparse
633. 平方数之和.py
dx19910707/LeetCode
train
0
725dbcba2b55d59dfde10900ddb2a735bfda5e0b
[ "if not head.next:\n return\nl, cur = (1, head)\nwhile cur.next:\n l += 1\n cur = cur.next\nif l == n:\n return head.next\ni, cur = (1, head)\nwhile cur and cur.next:\n if i == l - n:\n cur.next = cur.next.next\n else:\n cur = cur.next\n i += 1\nreturn head", "if not head.next:\...
<|body_start_0|> if not head.next: return l, cur = (1, head) while cur.next: l += 1 cur = cur.next if l == n: return head.next i, cur = (1, head) while cur and cur.next: if i == l - n: cur.next = ...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """Two Pass""" <|body_0|> def removeNthFromEnd2(self, head: ListNode, n: int) -> ListNode: """One Pass, keeping a window with size = n""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_007437
1,816
permissive
[ { "docstring": "Two Pass", "name": "removeNthFromEnd", "signature": "def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode" }, { "docstring": "One Pass, keeping a window with size = n", "name": "removeNthFromEnd2", "signature": "def removeNthFromEnd2(self, head: ListNode, n: int...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: Two Pass - def removeNthFromEnd2(self, head: ListNode, n: int) -> ListNode: One Pass, keeping a window with size =...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: Two Pass - def removeNthFromEnd2(self, head: ListNode, n: int) -> ListNode: One Pass, keeping a window with size =...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """Two Pass""" <|body_0|> def removeNthFromEnd2(self, head: ListNode, n: int) -> ListNode: """One Pass, keeping a window with size = n""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode: """Two Pass""" if not head.next: return l, cur = (1, head) while cur.next: l += 1 cur = cur.next if l == n: return head.next i, cur = (1, he...
the_stack_v2_python_sparse
leetcode/0019_remove_nth_node_from_end_of_list.py
chaosWsF/Python-Practice
train
1
b932836f42c61dde39fe505bbc6fc31315d1eb03
[ "Parameter.checkClass(alterRegressor, AbstractPredictor)\nParameter.checkClass(egoRegressor, AbstractPredictor)\nself.alterRegressor = alterRegressor\nself.egoRegressor = egoRegressor\nself.windowSize = windowSize", "Parameter.checkInt(self.windowSize, 1, graph.getNumVertices())\nself.graph = graph\nlogging.info(...
<|body_start_0|> Parameter.checkClass(alterRegressor, AbstractPredictor) Parameter.checkClass(egoRegressor, AbstractPredictor) self.alterRegressor = alterRegressor self.egoRegressor = egoRegressor self.windowSize = windowSize <|end_body_0|> <|body_start_1|> Parameter.che...
A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent.
EgoEdgePredictor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EgoEdgePredictor: """A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent.""" def __init__(self, alterRegressor, egoRegressor, windowSize): """The alterRegressor must be a primal method, since the number of alters ...
stack_v2_sparse_classes_36k_train_007438
4,152
no_license
[ { "docstring": "The alterRegressor must be a primal method, since the number of alters for each ego vary, and hence the dual vectors are not constant in size.", "name": "__init__", "signature": "def __init__(self, alterRegressor, egoRegressor, windowSize)" }, { "docstring": "Learn a prediction m...
3
stack_v2_sparse_classes_30k_train_018355
Implement the Python class `EgoEdgePredictor` described below. Class description: A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent. Method signatures and docstrings: - def __init__(self, alterRegressor, egoRegressor, windowSize): The alterRegre...
Implement the Python class `EgoEdgePredictor` described below. Class description: A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent. Method signatures and docstrings: - def __init__(self, alterRegressor, egoRegressor, windowSize): The alterRegre...
1703510cbb51ec6df0efe1de850cd48ef7004b00
<|skeleton|> class EgoEdgePredictor: """A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent.""" def __init__(self, alterRegressor, egoRegressor, windowSize): """The alterRegressor must be a primal method, since the number of alters ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EgoEdgePredictor: """A class which splits the graph into ego networks and then makes predictions assuming that all ego networks are independent.""" def __init__(self, alterRegressor, egoRegressor, windowSize): """The alterRegressor must be a primal method, since the number of alters for each ego ...
the_stack_v2_python_sparse
exp/sandbox/predictors/edge/EgoEdgePredictor.py
malcolmreynolds/APGL
train
0
811f7225620ea1acfcea001b0435cb9f38c36f60
[ "strings = ['Abc123,./=-0jkf', '']\nfor s in strings:\n result = sol[101].isUniqueA(s)\n self.assertTrue(result)\n result = sol[101].isUniqueB(s)\n self.assertTrue(result)", "strings = ['Abc123,./=-03jkf', ' ']\nfor s in strings:\n result = sol[101].isUniqueA(s)\n self.assertFalse(result)\n ...
<|body_start_0|> strings = ['Abc123,./=-0jkf', ''] for s in strings: result = sol[101].isUniqueA(s) self.assertTrue(result) result = sol[101].isUniqueB(s) self.assertTrue(result) <|end_body_0|> <|body_start_1|> strings = ['Abc123,./=-03jkf', ' ']...
Tests for: isUniqueA, isUniqueB
S0101TestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S0101TestCase: """Tests for: isUniqueA, isUniqueB""" def test_1_uniq(self): """Check unique string.""" <|body_0|> def test_2_nonuniq(self): """Check non-unique string.""" <|body_1|> <|end_skeleton|> <|body_start_0|> strings = ['Abc123,./=-0jkf',...
stack_v2_sparse_classes_36k_train_007439
6,651
no_license
[ { "docstring": "Check unique string.", "name": "test_1_uniq", "signature": "def test_1_uniq(self)" }, { "docstring": "Check non-unique string.", "name": "test_2_nonuniq", "signature": "def test_2_nonuniq(self)" } ]
2
stack_v2_sparse_classes_30k_test_000525
Implement the Python class `S0101TestCase` described below. Class description: Tests for: isUniqueA, isUniqueB Method signatures and docstrings: - def test_1_uniq(self): Check unique string. - def test_2_nonuniq(self): Check non-unique string.
Implement the Python class `S0101TestCase` described below. Class description: Tests for: isUniqueA, isUniqueB Method signatures and docstrings: - def test_1_uniq(self): Check unique string. - def test_2_nonuniq(self): Check non-unique string. <|skeleton|> class S0101TestCase: """Tests for: isUniqueA, isUniqueB"...
c27f19fac14b4acef8c631ad5569e1a5c29e9e1f
<|skeleton|> class S0101TestCase: """Tests for: isUniqueA, isUniqueB""" def test_1_uniq(self): """Check unique string.""" <|body_0|> def test_2_nonuniq(self): """Check non-unique string.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class S0101TestCase: """Tests for: isUniqueA, isUniqueB""" def test_1_uniq(self): """Check unique string.""" strings = ['Abc123,./=-0jkf', ''] for s in strings: result = sol[101].isUniqueA(s) self.assertTrue(result) result = sol[101].isUniqueB(s) ...
the_stack_v2_python_sparse
Chapter 1 - Arrays and Strings/test.py
liseyko/CtCI
train
0
82e51e82ada853c5ccca92ef79246a9abd7920ba
[ "norep = [num for num, _ in groupby(nums)]\ntriples = zip(norep, norep[1:], norep[2:])\nreturn sum(((b > a) == (b > c) for a, b, c in triples)) + len(norep[:2])", "norep = [num for num, _ in groupby(nums)]\nif len(norep) < 2:\n return len(norep)\ntriples = zip(norep, norep[1:], norep[2:])\nreturn 2 + sum((a < ...
<|body_start_0|> norep = [num for num, _ in groupby(nums)] triples = zip(norep, norep[1:], norep[2:]) return sum(((b > a) == (b > c) for a, b, c in triples)) + len(norep[:2]) <|end_body_0|> <|body_start_1|> norep = [num for num, _ in groupby(nums)] if len(norep) < 2: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wiggleMaxLength(self, nums): """:type nums: List[int] :rtype: int beats 44.44%""" <|body_0|> def wiggleMaxLength1(self, nums): """:param nums: :return: beats 97.22%""" <|body_1|> <|end_skeleton|> <|body_start_0|> norep = [num for num, ...
stack_v2_sparse_classes_36k_train_007440
704
no_license
[ { "docstring": ":type nums: List[int] :rtype: int beats 44.44%", "name": "wiggleMaxLength", "signature": "def wiggleMaxLength(self, nums)" }, { "docstring": ":param nums: :return: beats 97.22%", "name": "wiggleMaxLength1", "signature": "def wiggleMaxLength1(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_009488
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wiggleMaxLength(self, nums): :type nums: List[int] :rtype: int beats 44.44% - def wiggleMaxLength1(self, nums): :param nums: :return: beats 97.22%
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wiggleMaxLength(self, nums): :type nums: List[int] :rtype: int beats 44.44% - def wiggleMaxLength1(self, nums): :param nums: :return: beats 97.22% <|skeleton|> class Solutio...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def wiggleMaxLength(self, nums): """:type nums: List[int] :rtype: int beats 44.44%""" <|body_0|> def wiggleMaxLength1(self, nums): """:param nums: :return: beats 97.22%""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wiggleMaxLength(self, nums): """:type nums: List[int] :rtype: int beats 44.44%""" norep = [num for num, _ in groupby(nums)] triples = zip(norep, norep[1:], norep[2:]) return sum(((b > a) == (b > c) for a, b, c in triples)) + len(norep[:2]) def wiggleMaxLength...
the_stack_v2_python_sparse
LeetCode/376_wiggle_subsequence.py
yao23/Machine_Learning_Playground
train
12
44cd910dda05b0f07c9339f3a0fc6d95e9977bb3
[ "if '_xml_ns' in kwargs:\n self._xml_ns = kwargs['_xml_ns']\nif '_xml_ns_key' in kwargs:\n self._xml_ns_key = kwargs['_xml_ns_key']\nself.Information = Information\nself.Geometry = Geometry\nself.Phenomenology = Phenomenology\nself.identifier = identifier\nsuper(CollectionType, self).__init__(**kwargs)", "i...
<|body_start_0|> if '_xml_ns' in kwargs: self._xml_ns = kwargs['_xml_ns'] if '_xml_ns_key' in kwargs: self._xml_ns_key = kwargs['_xml_ns_key'] self.Information = Information self.Geometry = Geometry self.Phenomenology = Phenomenology self.identifie...
Metadata regarding one of the input collections.
CollectionType
[ "MIT", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectionType: """Metadata regarding one of the input collections.""" def __init__(self, Information=None, Geometry=None, Phenomenology=None, identifier=None, **kwargs): """Parameters ---------- Information : ExploitationFeaturesCollectionInformationType Geometry : None|Exploitation...
stack_v2_sparse_classes_36k_train_007441
34,922
permissive
[ { "docstring": "Parameters ---------- Information : ExploitationFeaturesCollectionInformationType Geometry : None|ExploitationFeaturesCollectionGeometryType Phenomenology : None|ExploitationFeaturesCollectionPhenomenologyType identifier : str kwargs", "name": "__init__", "signature": "def __init__(self,...
2
null
Implement the Python class `CollectionType` described below. Class description: Metadata regarding one of the input collections. Method signatures and docstrings: - def __init__(self, Information=None, Geometry=None, Phenomenology=None, identifier=None, **kwargs): Parameters ---------- Information : ExploitationFeatu...
Implement the Python class `CollectionType` described below. Class description: Metadata regarding one of the input collections. Method signatures and docstrings: - def __init__(self, Information=None, Geometry=None, Phenomenology=None, identifier=None, **kwargs): Parameters ---------- Information : ExploitationFeatu...
de1b1886f161a83b6c89aadc7a2c7cfc4892ef81
<|skeleton|> class CollectionType: """Metadata regarding one of the input collections.""" def __init__(self, Information=None, Geometry=None, Phenomenology=None, identifier=None, **kwargs): """Parameters ---------- Information : ExploitationFeaturesCollectionInformationType Geometry : None|Exploitation...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollectionType: """Metadata regarding one of the input collections.""" def __init__(self, Information=None, Geometry=None, Phenomenology=None, identifier=None, **kwargs): """Parameters ---------- Information : ExploitationFeaturesCollectionInformationType Geometry : None|ExploitationFeaturesColle...
the_stack_v2_python_sparse
sarpy/io/product/sidd2_elements/ExploitationFeatures.py
ngageoint/sarpy
train
192
92b87fa643a4366415e50de74162dd65c63ff16d
[ "PROVIDER_ID = kwargs.get('id')\nprovider = providerModel.ProviderModel.get_by_id(self.db.session, PROVIDER_ID)\nif provider:\n provider_wallet = walletModel.WalletModel.get_by_id(self.db.session, provider.wallet_id)\n provider_wallet = provider_wallet.as_dict\n remove_privateKey = provider_wallet.pop(PRIV...
<|body_start_0|> PROVIDER_ID = kwargs.get('id') provider = providerModel.ProviderModel.get_by_id(self.db.session, PROVIDER_ID) if provider: provider_wallet = walletModel.WalletModel.get_by_id(self.db.session, provider.wallet_id) provider_wallet = provider_wallet.as_dict ...
API Resource to interact with Wallets BD model. This resource exposes an Option, GET, POST and PATCH methods. This converts wallets data into/from DB models. All methods translate keystone URI to internal URI.
WalletsResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WalletsResource: """API Resource to interact with Wallets BD model. This resource exposes an Option, GET, POST and PATCH methods. This converts wallets data into/from DB models. All methods translate keystone URI to internal URI.""" def on_get(self, req, resp, **kwargs): """Get a wal...
stack_v2_sparse_classes_36k_train_007442
7,341
permissive
[ { "docstring": "Get a wallet by its provider id --- summary: Fetches a wallet by its provider id description: Endpoint that gets a wallet by its provider id tags: - wallets consumes: - application/json produces: - application/json parameters: - in: path name: id description: id of provider schema: type: integer...
2
stack_v2_sparse_classes_30k_train_008930
Implement the Python class `WalletsResource` described below. Class description: API Resource to interact with Wallets BD model. This resource exposes an Option, GET, POST and PATCH methods. This converts wallets data into/from DB models. All methods translate keystone URI to internal URI. Method signatures and docst...
Implement the Python class `WalletsResource` described below. Class description: API Resource to interact with Wallets BD model. This resource exposes an Option, GET, POST and PATCH methods. This converts wallets data into/from DB models. All methods translate keystone URI to internal URI. Method signatures and docst...
e2c74c36d5eb8492764205fe99558b0818473cb7
<|skeleton|> class WalletsResource: """API Resource to interact with Wallets BD model. This resource exposes an Option, GET, POST and PATCH methods. This converts wallets data into/from DB models. All methods translate keystone URI to internal URI.""" def on_get(self, req, resp, **kwargs): """Get a wal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WalletsResource: """API Resource to interact with Wallets BD model. This resource exposes an Option, GET, POST and PATCH methods. This converts wallets data into/from DB models. All methods translate keystone URI to internal URI.""" def on_get(self, req, resp, **kwargs): """Get a wallet by its pr...
the_stack_v2_python_sparse
mobility-service-provider---service/msp/resources/wallets.py
vicinityh2020/vicinity-vas-dreven
train
0
1093bfb704374e2ba67e09c797a77129d22a98f2
[ "super(AttendCompareAggregateBlock, self).__init__()\nself.compression_factor = compression_factor\nself.num_images = args.num_images\nself.attend_module = AttendModule(args, inplanes, compression_factor)\nself.compare_module = CompareModule(args, inplanes, self.num_images)\nself.aggregate_module = AggregateModule(...
<|body_start_0|> super(AttendCompareAggregateBlock, self).__init__() self.compression_factor = compression_factor self.num_images = args.num_images self.attend_module = AttendModule(args, inplanes, compression_factor) self.compare_module = CompareModule(args, inplanes, self.num_i...
Attend Compare Aggregate block.
AttendCompareAggregateBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttendCompareAggregateBlock: """Attend Compare Aggregate block.""" def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2): """Initializes the ACABlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (...
stack_v2_sparse_classes_36k_train_007443
8,762
permissive
[ { "docstring": "Initializes the ACABlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (number of channels) of the output. downsample(nn.Module): When not none, used to downsample output to planes. compression_factor(int): The compression factor to use when perfo...
2
stack_v2_sparse_classes_30k_train_016055
Implement the Python class `AttendCompareAggregateBlock` described below. Class description: Attend Compare Aggregate block. Method signatures and docstrings: - def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2): Initializes the ACABlock. Arguments: inplanes(int): The depth (n...
Implement the Python class `AttendCompareAggregateBlock` described below. Class description: Attend Compare Aggregate block. Method signatures and docstrings: - def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2): Initializes the ACABlock. Arguments: inplanes(int): The depth (n...
12bace8fd6ce9c5bb129fd0d30a46a00a2f7b054
<|skeleton|> class AttendCompareAggregateBlock: """Attend Compare Aggregate block.""" def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2): """Initializes the ACABlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttendCompareAggregateBlock: """Attend Compare Aggregate block.""" def __init__(self, args, inplanes, planes, stride=1, downsample=None, compression_factor=2): """Initializes the ACABlock. Arguments: inplanes(int): The depth (number of channels) of the input. planes(int): The depth (number of cha...
the_stack_v2_python_sparse
onconet/models/blocks/attend_compare_agg_block.py
yala/Mirai
train
66
c005b26ed11aeab63d4f798c7635cdbbdfd2886e
[ "self._rear = None\nself._front = None\nAbstractQueue.__init__(self, sourceCollection)", "probe = self._front\nwhile probe != None:\n yield probe.data\n probe = probe.next", "if self.isEmpty():\n raise KeyError('the queue is empty')\nreturn self._front.data", "newNode = Node(item, None)\nif self.isEm...
<|body_start_0|> self._rear = None self._front = None AbstractQueue.__init__(self, sourceCollection) <|end_body_0|> <|body_start_1|> probe = self._front while probe != None: yield probe.data probe = probe.next <|end_body_1|> <|body_start_2|> if s...
基于linked的queue实现.
LinkedQueue
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkedQueue: """基于linked的queue实现.""" def __init__(self, sourceCollection=None): """初始状态,其中包括sourceCollection的内容(如果存在).""" <|body_0|> def __iter__(self): """支持将self进行迭代.""" <|body_1|> def peek(self): """返回stack的队头项. 前提: queue不是空的. 如果是空的则抛出异常."...
stack_v2_sparse_classes_36k_train_007444
1,705
no_license
[ { "docstring": "初始状态,其中包括sourceCollection的内容(如果存在).", "name": "__init__", "signature": "def __init__(self, sourceCollection=None)" }, { "docstring": "支持将self进行迭代.", "name": "__iter__", "signature": "def __iter__(self)" }, { "docstring": "返回stack的队头项. 前提: queue不是空的. 如果是空的则抛出异常.", ...
5
null
Implement the Python class `LinkedQueue` described below. Class description: 基于linked的queue实现. Method signatures and docstrings: - def __init__(self, sourceCollection=None): 初始状态,其中包括sourceCollection的内容(如果存在). - def __iter__(self): 支持将self进行迭代. - def peek(self): 返回stack的队头项. 前提: queue不是空的. 如果是空的则抛出异常. - def add(self,...
Implement the Python class `LinkedQueue` described below. Class description: 基于linked的queue实现. Method signatures and docstrings: - def __init__(self, sourceCollection=None): 初始状态,其中包括sourceCollection的内容(如果存在). - def __iter__(self): 支持将self进行迭代. - def peek(self): 返回stack的队头项. 前提: queue不是空的. 如果是空的则抛出异常. - def add(self,...
dc1062df01cc53eb9a2a1849709d2f88e8b4488c
<|skeleton|> class LinkedQueue: """基于linked的queue实现.""" def __init__(self, sourceCollection=None): """初始状态,其中包括sourceCollection的内容(如果存在).""" <|body_0|> def __iter__(self): """支持将self进行迭代.""" <|body_1|> def peek(self): """返回stack的队头项. 前提: queue不是空的. 如果是空的则抛出异常."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkedQueue: """基于linked的queue实现.""" def __init__(self, sourceCollection=None): """初始状态,其中包括sourceCollection的内容(如果存在).""" self._rear = None self._front = None AbstractQueue.__init__(self, sourceCollection) def __iter__(self): """支持将self进行迭代.""" probe =...
the_stack_v2_python_sparse
PyDemo/dataStructure/linkeds/linkedqueue.py
RockJohnson503/MyDemo
train
5
77f1dc5c1d3d029aa3b64f9561953d897633aefa
[ "try:\n return PredictionTileService.tilejson(project_id, prediction_id)\nexcept PredictionsNotFound:\n return (err(404, 'Prediction TileJSON not found'), 404)\nexcept Exception as e:\n current_app.logger.error(traceback.format_exc())\n error_msg = f'Unhandled error: {str(e)}'\n return (err(500, erro...
<|body_start_0|> try: return PredictionTileService.tilejson(project_id, prediction_id) except PredictionsNotFound: return (err(404, 'Prediction TileJSON not found'), 404) except Exception as e: current_app.logger.error(traceback.format_exc()) error...
Methods to manage tile predictions
PredictionTileAPI
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PredictionTileAPI: """Methods to manage tile predictions""" def get(self, project_id, prediction_id): """TileJSON response for the predictions --- produces: - application/json parameters: - in: path name: project_id description: ID of the Model required: true type: integer - in: path...
stack_v2_sparse_classes_36k_train_007445
46,323
permissive
[ { "docstring": "TileJSON response for the predictions --- produces: - application/json parameters: - in: path name: project_id description: ID of the Model required: true type: integer - in: path name: prediction_id description: ID of the Prediction required: true type: integer responses: 200: description: ID o...
2
stack_v2_sparse_classes_30k_train_004986
Implement the Python class `PredictionTileAPI` described below. Class description: Methods to manage tile predictions Method signatures and docstrings: - def get(self, project_id, prediction_id): TileJSON response for the predictions --- produces: - application/json parameters: - in: path name: project_id description...
Implement the Python class `PredictionTileAPI` described below. Class description: Methods to manage tile predictions Method signatures and docstrings: - def get(self, project_id, prediction_id): TileJSON response for the predictions --- produces: - application/json parameters: - in: path name: project_id description...
cff1b5955c6f110e64489427dfb8902d442a0e62
<|skeleton|> class PredictionTileAPI: """Methods to manage tile predictions""" def get(self, project_id, prediction_id): """TileJSON response for the predictions --- produces: - application/json parameters: - in: path name: project_id description: ID of the Model required: true type: integer - in: path...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PredictionTileAPI: """Methods to manage tile predictions""" def get(self, project_id, prediction_id): """TileJSON response for the predictions --- produces: - application/json parameters: - in: path name: project_id description: ID of the Model required: true type: integer - in: path name: predic...
the_stack_v2_python_sparse
ml_enabler/api/ml.py
rustyb/ml-enabler
train
0
ea91e84824249c3a79c9289202c100aa87b2880d
[ "twython.TwythonStreamer.__init__(self, app_key, app_secret, oauth_token, oauth_token_secret)\nself.response_queue = response_queue\nself.db_queue = db_queue\nself.filter_list = filter_list\nself.message_received = False\nreturn", "message = ''\nuser_name = ''\nscreen_name = ''\nprint(data)\nif 'text' in data:\n ...
<|body_start_0|> twython.TwythonStreamer.__init__(self, app_key, app_secret, oauth_token, oauth_token_secret) self.response_queue = response_queue self.db_queue = db_queue self.filter_list = filter_list self.message_received = False return <|end_body_0|> <|body_start_1|>...
This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it.
TwitterStreamer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwitterStreamer: """This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it.""" def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None, response_...
stack_v2_sparse_classes_36k_train_007446
4,693
no_license
[ { "docstring": "Create our instance of the TwythonStreamer", "name": "__init__", "signature": "def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None, response_queue=None, filter_list=None, db_queue=None)" }, { "docstring": "Come here when we receive a tweet ...
2
null
Implement the Python class `TwitterStreamer` described below. Class description: This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it. Method signatures and docstrings: - def __init__(self, app_key=None, a...
Implement the Python class `TwitterStreamer` described below. Class description: This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it. Method signatures and docstrings: - def __init__(self, app_key=None, a...
7d4a27126f7f2a93f7216b9ea4eed15789599bf3
<|skeleton|> class TwitterStreamer: """This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it.""" def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None, response_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwitterStreamer: """This class is an extension of the twython.TwythonStreamer. The on_success method is called when we get a message from our list of commands and we can then process it.""" def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None, response_queue=None, f...
the_stack_v2_python_sparse
python3/RaspberryPi/twitter.py
ptracton/experimental
train
4
648e0737aa194181b8bdb42a36aedeb77b06d131
[ "login_url = self.ip + '/api/user/mis/login.do'\nlogin_params = {'username': self.username, 'password': self.password}\nr = requests.post(url=login_url, params=login_params)\nreturn r.json()", "url = self.ip + '/api/user/mis/login.do'\nheader = {'Token': self.login_with_password()['data']['loginUser']['token']}\n...
<|body_start_0|> login_url = self.ip + '/api/user/mis/login.do' login_params = {'username': self.username, 'password': self.password} r = requests.post(url=login_url, params=login_params) return r.json() <|end_body_0|> <|body_start_1|> url = self.ip + '/api/user/mis/login.do' ...
Login
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Login: def login_with_password(self): """使用 用户名、密码 登录 :return:""" <|body_0|> def login_with_token(self): """使用 token 登录 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> login_url = self.ip + '/api/user/mis/login.do' login_params = {'...
stack_v2_sparse_classes_36k_train_007447
844
no_license
[ { "docstring": "使用 用户名、密码 登录 :return:", "name": "login_with_password", "signature": "def login_with_password(self)" }, { "docstring": "使用 token 登录 :return:", "name": "login_with_token", "signature": "def login_with_token(self)" } ]
2
stack_v2_sparse_classes_30k_train_010569
Implement the Python class `Login` described below. Class description: Implement the Login class. Method signatures and docstrings: - def login_with_password(self): 使用 用户名、密码 登录 :return: - def login_with_token(self): 使用 token 登录 :return:
Implement the Python class `Login` described below. Class description: Implement the Login class. Method signatures and docstrings: - def login_with_password(self): 使用 用户名、密码 登录 :return: - def login_with_token(self): 使用 token 登录 :return: <|skeleton|> class Login: def login_with_password(self): """使用 用户名...
26d2ae773a999fd8446e18f9c0719d46402b19aa
<|skeleton|> class Login: def login_with_password(self): """使用 用户名、密码 登录 :return:""" <|body_0|> def login_with_token(self): """使用 token 登录 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Login: def login_with_password(self): """使用 用户名、密码 登录 :return:""" login_url = self.ip + '/api/user/mis/login.do' login_params = {'username': self.username, 'password': self.password} r = requests.post(url=login_url, params=login_params) return r.json() def login_wi...
the_stack_v2_python_sparse
api/login.py
Leofighting/dimi_api_test
train
0
ea0a1cf7317714204ae34ee8c20f741e49907d68
[ "result = {}\nfor i in nums:\n result[i] = result.get(i, 0) + 1\nmax_nums = 0\nmax_element = 0\nfor k, v in result.items():\n if v > max_nums:\n max_nums = v\n max_element = k\nreturn max_element", "dic = {}\nlen_t = len(nums) // 2\nfor num in nums:\n dic[num] = dic.get(num, 0) + 1\n if ...
<|body_start_0|> result = {} for i in nums: result[i] = result.get(i, 0) + 1 max_nums = 0 max_element = 0 for k, v in result.items(): if v > max_nums: max_nums = v max_element = k return max_element <|end_body_0|> <...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def majorityElement(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def majorityElement_another(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {} for i in ...
stack_v2_sparse_classes_36k_train_007448
764
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "majorityElement", "signature": "def majorityElement(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "majorityElement_another", "signature": "def majorityElement_another(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums): :type nums: List[int] :rtype: int - def majorityElement_another(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElement(self, nums): :type nums: List[int] :rtype: int - def majorityElement_another(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: ...
8a62b397a5fa107c70efc8ea65d0edfb74f8baa7
<|skeleton|> class Solution: def majorityElement(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def majorityElement_another(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def majorityElement(self, nums): """:type nums: List[int] :rtype: int""" result = {} for i in nums: result[i] = result.get(i, 0) + 1 max_nums = 0 max_element = 0 for k, v in result.items(): if v > max_nums: max_n...
the_stack_v2_python_sparse
LeetCode-Solution/Algorithms/Majority-Element.py
LFYG/leetcode-acm-euler-other
train
0
6e2b563d6d0eb668ab6d78fa80770e5881b40df9
[ "with self.session() as session:\n position = mod.CorrespondencePositions\n info = mod.CorrespondenceInfo\n subquery = session.query(position.correspondence_id).distinct().subquery()\n query = session.query(info).join(subquery, subquery.c.correspondence_id == info.correspondence_id)\n return [result....
<|body_start_0|> with self.session() as session: position = mod.CorrespondencePositions info = mod.CorrespondenceInfo subquery = session.query(position.correspondence_id).distinct().subquery() query = session.query(info).join(subquery, subquery.c.correspondence_id...
Loader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Loader: def to_process(self, pdbs, **kwargs): """We transform the list of pdbs into the list of correspondences. :param list pdb: The list of pdb ids. Currently ignored. :param dict kwargs: The keyword arguments which are ignored. :returns: A list of correspondence ids to process.""" ...
stack_v2_sparse_classes_36k_train_007449
2,548
no_license
[ { "docstring": "We transform the list of pdbs into the list of correspondences. :param list pdb: The list of pdb ids. Currently ignored. :param dict kwargs: The keyword arguments which are ignored. :returns: A list of correspondence ids to process.", "name": "to_process", "signature": "def to_process(se...
3
stack_v2_sparse_classes_30k_train_013251
Implement the Python class `Loader` described below. Class description: Implement the Loader class. Method signatures and docstrings: - def to_process(self, pdbs, **kwargs): We transform the list of pdbs into the list of correspondences. :param list pdb: The list of pdb ids. Currently ignored. :param dict kwargs: The...
Implement the Python class `Loader` described below. Class description: Implement the Loader class. Method signatures and docstrings: - def to_process(self, pdbs, **kwargs): We transform the list of pdbs into the list of correspondences. :param list pdb: The list of pdb ids. Currently ignored. :param dict kwargs: The...
1982e10a56885e56d79aac69365b9ff78c0e3d92
<|skeleton|> class Loader: def to_process(self, pdbs, **kwargs): """We transform the list of pdbs into the list of correspondences. :param list pdb: The list of pdb ids. Currently ignored. :param dict kwargs: The keyword arguments which are ignored. :returns: A list of correspondence ids to process.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Loader: def to_process(self, pdbs, **kwargs): """We transform the list of pdbs into the list of correspondences. :param list pdb: The list of pdb ids. Currently ignored. :param dict kwargs: The keyword arguments which are ignored. :returns: A list of correspondence ids to process.""" with self...
the_stack_v2_python_sparse
pymotifs/correspondence/cleanup.py
BGSU-RNA/RNA-3D-Hub-core
train
3
f2f9bb9410af21e09d3f5c0e4b95e135fda2980e
[ "if out_frames not in self.VALID_OUT_FRAMES:\n raise ValueError('Invalid number of frames in desired output: %d' % out_frames)\nsuper(Generator, self).__init__()\nself.gen_name = gen_name\nself.out_frames = out_frames\nlayer_out_channels = {'conv_1a': 256, 'conv_1b': 256, 'conv_2a': 256, 'conv_2b': 256, 'rdn_blo...
<|body_start_0|> if out_frames not in self.VALID_OUT_FRAMES: raise ValueError('Invalid number of frames in desired output: %d' % out_frames) super(Generator, self).__init__() self.gen_name = gen_name self.out_frames = out_frames layer_out_channels = {'conv_1a': 256, '...
Class representing the Generator network to be used.
Generator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: """Class representing the Generator network to be used.""" def __init__(self, in_channels, out_frames, gen_name='Video Generator'): """Initializes the Generator network. :param in_channels: (int) The number of channels in the input tensor. :param out_frames: (int) The numb...
stack_v2_sparse_classes_36k_train_007450
14,041
no_license
[ { "docstring": "Initializes the Generator network. :param in_channels: (int) The number of channels in the input tensor. :param out_frames: (int) The number of frames desired in the generated output video. Legal values: 8, 16 :param gen_name: (str, optional) The name of the network (default 'Video Generator'). ...
2
stack_v2_sparse_classes_30k_train_019330
Implement the Python class `Generator` described below. Class description: Class representing the Generator network to be used. Method signatures and docstrings: - def __init__(self, in_channels, out_frames, gen_name='Video Generator'): Initializes the Generator network. :param in_channels: (int) The number of channe...
Implement the Python class `Generator` described below. Class description: Class representing the Generator network to be used. Method signatures and docstrings: - def __init__(self, in_channels, out_frames, gen_name='Video Generator'): Initializes the Generator network. :param in_channels: (int) The number of channe...
6de28b5a8992f6122f2e9813de8b92d9e97ccbf3
<|skeleton|> class Generator: """Class representing the Generator network to be used.""" def __init__(self, in_channels, out_frames, gen_name='Video Generator'): """Initializes the Generator network. :param in_channels: (int) The number of channels in the input tensor. :param out_frames: (int) The numb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Generator: """Class representing the Generator network to be used.""" def __init__(self, in_channels, out_frames, gen_name='Video Generator'): """Initializes the Generator network. :param in_channels: (int) The number of channels in the input tensor. :param out_frames: (int) The number of frames ...
the_stack_v2_python_sparse
1recon/generator.py
schatzkara/REU2019
train
0
42846d6de2508d57d3b9a6f6012d26915249167a
[ "self.scales = scales\nself.min_scale = min_scale\nself.max_scale = max_scale\nself.aspect_ratios = aspect_ratios\nself.interpolated_scale_aspect_ratio = interpolated_scale_aspect_ratio\nself.reduce_boxes_in_lowest_layer = reduce_boxes_in_lowest_layer", "feature_map_shape_list = []\nnum_layers = len(image_feature...
<|body_start_0|> self.scales = scales self.min_scale = min_scale self.max_scale = max_scale self.aspect_ratios = aspect_ratios self.interpolated_scale_aspect_ratio = interpolated_scale_aspect_ratio self.reduce_boxes_in_lowest_layer = reduce_boxes_in_lowest_layer <|end_bod...
AnchorGenerator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnchorGenerator: def __init__(self, scales=None, min_scale=0.2, max_scale=0.9, aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333), interpolated_scale_aspect_ratio=1.0, reduce_boxes_in_lowest_layer=True): """Creates SSD anchors. Grid sizes are assumed to be passed in at generation time from finest...
stack_v2_sparse_classes_36k_train_007451
7,293
permissive
[ { "docstring": "Creates SSD anchors. Grid sizes are assumed to be passed in at generation time from finest resolution to coarsest resolution. Arguments: scales: a list of float numbers or None, if scales is None then min_scale and max_scale are used. min_scale: a float number, scale of anchors corresponding to ...
3
stack_v2_sparse_classes_30k_train_004428
Implement the Python class `AnchorGenerator` described below. Class description: Implement the AnchorGenerator class. Method signatures and docstrings: - def __init__(self, scales=None, min_scale=0.2, max_scale=0.9, aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333), interpolated_scale_aspect_ratio=1.0, reduce_boxes_in_lowest...
Implement the Python class `AnchorGenerator` described below. Class description: Implement the AnchorGenerator class. Method signatures and docstrings: - def __init__(self, scales=None, min_scale=0.2, max_scale=0.9, aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333), interpolated_scale_aspect_ratio=1.0, reduce_boxes_in_lowest...
45f977d6622b083d5817167bc9da20420299b273
<|skeleton|> class AnchorGenerator: def __init__(self, scales=None, min_scale=0.2, max_scale=0.9, aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333), interpolated_scale_aspect_ratio=1.0, reduce_boxes_in_lowest_layer=True): """Creates SSD anchors. Grid sizes are assumed to be passed in at generation time from finest...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnchorGenerator: def __init__(self, scales=None, min_scale=0.2, max_scale=0.9, aspect_ratios=(1.0, 2.0, 3.0, 0.5, 0.333), interpolated_scale_aspect_ratio=1.0, reduce_boxes_in_lowest_layer=True): """Creates SSD anchors. Grid sizes are assumed to be passed in at generation time from finest resolution to...
the_stack_v2_python_sparse
src/anchor_generator.py
zsz00/single-shot-detector
train
1
3c6c7228a2b40b35be6604a70ac71748457e0b0f
[ "if isinstance(filter_names[0], str):\n flist = phot.load_filters(filter_names, interp=True, lamb=self.lamb, filterLib=filterLib)\n _fnames = filter_names\nelse:\n flist = phot.load_Integrationfilters(filter_names, interp=True, lamb=self.lamb)\n _fnames = [fk.name for fk in filter_names]\nif extLaw is n...
<|body_start_0|> if isinstance(filter_names[0], str): flist = phot.load_filters(filter_names, interp=True, lamb=self.lamb, filterLib=filterLib) _fnames = filter_names else: flist = phot.load_Integrationfilters(filter_names, interp=True, lamb=self.lamb) _fn...
Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs
SpectralGrid
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpectralGrid: """Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs""" def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): """Extract integrated fluxes through filters Parameters ----...
stack_v2_sparse_classes_36k_train_007452
11,734
permissive
[ { "docstring": "Extract integrated fluxes through filters Parameters ---------- filter_names: list list of filter names according to the filter lib or filter instances (no mixing between name and instances) absFlux:bool returns absolute fluxes if set extLaw: extinction.ExtinctionLaw apply extinction law if prov...
2
stack_v2_sparse_classes_30k_train_000397
Implement the Python class `SpectralGrid` described below. Class description: Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs Method signatures and docstrings: - def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): ...
Implement the Python class `SpectralGrid` described below. Class description: Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs Method signatures and docstrings: - def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): ...
892940813f4b22d545b501cc596c72967d9a45bc
<|skeleton|> class SpectralGrid: """Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs""" def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): """Extract integrated fluxes through filters Parameters ----...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpectralGrid: """Generate a grid that contains spectra. It provides an access to integrated photometry function getSEDs""" def getSEDs(self, filter_names, absFlux=True, extLaw=None, inplace=False, filterLib=None, **kwargs): """Extract integrated fluxes through filters Parameters ---------- filter...
the_stack_v2_python_sparse
beast/physicsmodel/grid.py
dthilker/beast
train
0
05bb353437463e2497d11fc5a097ee4c8b981432
[ "def cmp(a, b):\n z = list(zip(a, b))\n n = len(z)\n for i in range(1, n):\n if z[i][0] < z[i][1]:\n return True\n if z[i][0] > z[i][1]:\n return False\n if len(a) > len(b):\n return False\n else:\n return a[0] <= b[0]\n\ndef partition(left, right):\n...
<|body_start_0|> def cmp(a, b): z = list(zip(a, b)) n = len(z) for i in range(1, n): if z[i][0] < z[i][1]: return True if z[i][0] > z[i][1]: return False if len(a) > len(b): re...
SolutionQuickSort
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolutionQuickSort: def quick_sort(self, logs): """["let1 art","let3 art","let2 art own dig","dig1 8 1 5 1","dig2 3 6"]""" <|body_0|> def reorderLogFiles(self, logs: List[str]) -> List[str]: """d = ["dig1...", "dig2..."] ^ [dig1, 8, 1, 5, 1] l = ["let1...", "let2..."]...
stack_v2_sparse_classes_36k_train_007453
5,368
no_license
[ { "docstring": "[\"let1 art\",\"let3 art\",\"let2 art own dig\",\"dig1 8 1 5 1\",\"dig2 3 6\"]", "name": "quick_sort", "signature": "def quick_sort(self, logs)" }, { "docstring": "d = [\"dig1...\", \"dig2...\"] ^ [dig1, 8, 1, 5, 1] l = [\"let1...\", \"let2...\"] ^ convert to array [[let, art, ca...
2
null
Implement the Python class `SolutionQuickSort` described below. Class description: Implement the SolutionQuickSort class. Method signatures and docstrings: - def quick_sort(self, logs): ["let1 art","let3 art","let2 art own dig","dig1 8 1 5 1","dig2 3 6"] - def reorderLogFiles(self, logs: List[str]) -> List[str]: d = ...
Implement the Python class `SolutionQuickSort` described below. Class description: Implement the SolutionQuickSort class. Method signatures and docstrings: - def quick_sort(self, logs): ["let1 art","let3 art","let2 art own dig","dig1 8 1 5 1","dig2 3 6"] - def reorderLogFiles(self, logs: List[str]) -> List[str]: d = ...
4619a23386bb62041a134afc782ff56918dd7b47
<|skeleton|> class SolutionQuickSort: def quick_sort(self, logs): """["let1 art","let3 art","let2 art own dig","dig1 8 1 5 1","dig2 3 6"]""" <|body_0|> def reorderLogFiles(self, logs: List[str]) -> List[str]: """d = ["dig1...", "dig2..."] ^ [dig1, 8, 1, 5, 1] l = ["let1...", "let2..."]...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolutionQuickSort: def quick_sort(self, logs): """["let1 art","let3 art","let2 art own dig","dig1 8 1 5 1","dig2 3 6"]""" def cmp(a, b): z = list(zip(a, b)) n = len(z) for i in range(1, n): if z[i][0] < z[i][1]: return Tru...
the_stack_v2_python_sparse
0937_reorder_data_in_log_files.py
Kcheung42/Leet_Code
train
0
ab6ff28ebabff1c5725945ff3ebda6c804488543
[ "if n <= 1:\n return [0]\nedges = defaultdict(set)\nfor edge in edges_:\n a, b = (edge[0], edge[1])\n edges[a].add(b)\n edges[b].add(a)\nleaves = [node for node in edges if len(edges[node]) == 1]\nwhile n > 2:\n n -= len(leaves)\n new_leaves = []\n while leaves:\n node = leaves.pop(0)\n ...
<|body_start_0|> if n <= 1: return [0] edges = defaultdict(set) for edge in edges_: a, b = (edge[0], edge[1]) edges[a].add(b) edges[b].add(a) leaves = [node for node in edges if len(edges[node]) == 1] while n > 2: n -= l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMinHeightTrees(self, n, edges_): """:type n: int :type edges_: List[List[int]] :rtype: List[int]""" <|body_0|> def findMinHeightTrees_(self, n, edges_): """:type n: int :type edges_: List[List[int]] :rtype: List[int]""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k_train_007454
2,172
no_license
[ { "docstring": ":type n: int :type edges_: List[List[int]] :rtype: List[int]", "name": "findMinHeightTrees", "signature": "def findMinHeightTrees(self, n, edges_)" }, { "docstring": ":type n: int :type edges_: List[List[int]] :rtype: List[int]", "name": "findMinHeightTrees_", "signature"...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinHeightTrees(self, n, edges_): :type n: int :type edges_: List[List[int]] :rtype: List[int] - def findMinHeightTrees_(self, n, edges_): :type n: int :type edges_: List[...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinHeightTrees(self, n, edges_): :type n: int :type edges_: List[List[int]] :rtype: List[int] - def findMinHeightTrees_(self, n, edges_): :type n: int :type edges_: List[...
ef052efcbcceb38e44fdd7cbcb6a7e6bd7ff8aa2
<|skeleton|> class Solution: def findMinHeightTrees(self, n, edges_): """:type n: int :type edges_: List[List[int]] :rtype: List[int]""" <|body_0|> def findMinHeightTrees_(self, n, edges_): """:type n: int :type edges_: List[List[int]] :rtype: List[int]""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMinHeightTrees(self, n, edges_): """:type n: int :type edges_: List[List[int]] :rtype: List[int]""" if n <= 1: return [0] edges = defaultdict(set) for edge in edges_: a, b = (edge[0], edge[1]) edges[a].add(b) edg...
the_stack_v2_python_sparse
bfs_dfs/minimum_height_trees.py
moyuanhuang/leetcode
train
2
5e85f509df1cf3df89e54b79b58fa7c7cd5f7fa7
[ "super(RedisKeyIdentifier, self).__init__()\nif identifier:\n self.identifier = uuid.UUID(identifier)\nelse:\n self.identifier = uuid.uuid4()", "if not self.identifier:\n return None\nreturn self.identifier.hex" ]
<|body_start_0|> super(RedisKeyIdentifier, self).__init__() if identifier: self.identifier = uuid.UUID(identifier) else: self.identifier = uuid.uuid4() <|end_body_0|> <|body_start_1|> if not self.identifier: return None return self.identifier....
Redis key attribute container identifier. The identifier is used to uniquely identify attribute containers. Where for example an attribute container is stored as a JSON serialized data in a Redis instance. Attributes: identifier (UUID): unique identifier of a container.
RedisKeyIdentifier
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RedisKeyIdentifier: """Redis key attribute container identifier. The identifier is used to uniquely identify attribute containers. Where for example an attribute container is stored as a JSON serialized data in a Redis instance. Attributes: identifier (UUID): unique identifier of a container.""" ...
stack_v2_sparse_classes_36k_train_007455
4,240
permissive
[ { "docstring": "\"Initializes a Redis key identifier. Args: identifier (Optional[str]): hexadecimal representation of a UUID (version 4). If not specified, a random UUID (version 4) will be generated.", "name": "__init__", "signature": "def __init__(self, identifier=None)" }, { "docstring": "Cop...
2
null
Implement the Python class `RedisKeyIdentifier` described below. Class description: Redis key attribute container identifier. The identifier is used to uniquely identify attribute containers. Where for example an attribute container is stored as a JSON serialized data in a Redis instance. Attributes: identifier (UUID)...
Implement the Python class `RedisKeyIdentifier` described below. Class description: Redis key attribute container identifier. The identifier is used to uniquely identify attribute containers. Where for example an attribute container is stored as a JSON serialized data in a Redis instance. Attributes: identifier (UUID)...
c69b2952b608cfce47ff8fd0d1409d856be35cb1
<|skeleton|> class RedisKeyIdentifier: """Redis key attribute container identifier. The identifier is used to uniquely identify attribute containers. Where for example an attribute container is stored as a JSON serialized data in a Redis instance. Attributes: identifier (UUID): unique identifier of a container.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RedisKeyIdentifier: """Redis key attribute container identifier. The identifier is used to uniquely identify attribute containers. Where for example an attribute container is stored as a JSON serialized data in a Redis instance. Attributes: identifier (UUID): unique identifier of a container.""" def __in...
the_stack_v2_python_sparse
plaso/storage/identifiers.py
cyb3rfox/plaso
train
3
5ddd42743d93b50cb8b2966b548ef7a351da4d63
[ "try:\n if self.processing_job.isAlive():\n self.display('Processing too slow')\n return\nexcept AttributeError:\n pass\nself.processing_job = Thread(target=process, args=(image, self.results))\nself.processing_job.start()", "self.display('Camera started.')\nn_img = 0\nwhile not self.wants_abo...
<|body_start_0|> try: if self.processing_job.isAlive(): self.display('Processing too slow') return except AttributeError: pass self.processing_job = Thread(target=process, args=(image, self.results)) self.processing_job.start() <|en...
Acquisition loop. This is the worker thread that retrieves images from the camera, displays them, and spawns the processing job.
AcquisitionThread
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AcquisitionThread: """Acquisition loop. This is the worker thread that retrieves images from the camera, displays them, and spawns the processing job.""" def process(self, image): """Spawns the processing job.""" <|body_0|> def run(self): """Runs the acquisition ...
stack_v2_sparse_classes_36k_train_007456
6,806
permissive
[ { "docstring": "Spawns the processing job.", "name": "process", "signature": "def process(self, image)" }, { "docstring": "Runs the acquisition loop.", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_012044
Implement the Python class `AcquisitionThread` described below. Class description: Acquisition loop. This is the worker thread that retrieves images from the camera, displays them, and spawns the processing job. Method signatures and docstrings: - def process(self, image): Spawns the processing job. - def run(self): ...
Implement the Python class `AcquisitionThread` described below. Class description: Acquisition loop. This is the worker thread that retrieves images from the camera, displays them, and spawns the processing job. Method signatures and docstrings: - def process(self, image): Spawns the processing job. - def run(self): ...
35e9a781fa1a7328679794d27e24e194e35c012b
<|skeleton|> class AcquisitionThread: """Acquisition loop. This is the worker thread that retrieves images from the camera, displays them, and spawns the processing job.""" def process(self, image): """Spawns the processing job.""" <|body_0|> def run(self): """Runs the acquisition ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AcquisitionThread: """Acquisition loop. This is the worker thread that retrieves images from the camera, displays them, and spawns the processing job.""" def process(self, image): """Spawns the processing job.""" try: if self.processing_job.isAlive(): self.disp...
the_stack_v2_python_sparse
TraitsUI/build_camera_application/final_application.py
marshallmcdonnell/interactive_plotting
train
0
8841b1a87f48c5a37da8b0144c52b7a2edc487ad
[ "if not (data == None) & (type(data) == dict) & ('sectionType' in data.keys()):\n if data['sectionType'] == 'COMMENT':\n super().__init__(api, data)\n else:\n raise Exception('no paragraph')\nelse:\n raise Exception('no (valid) section data')", "contents = self.get()['contents']\nhtmlCode =...
<|body_start_0|> if not (data == None) & (type(data) == dict) & ('sectionType' in data.keys()): if data['sectionType'] == 'COMMENT': super().__init__(api, data) else: raise Exception('no paragraph') else: raise Exception('no (valid) sec...
SectionComment
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SectionComment: def __init__(self, api, data): """Internal use only: initialize section object""" <|body_0|> def show(self): """Show the content""" <|body_1|> def get(self): """Get the content of this section""" <|body_2|> def set(se...
stack_v2_sparse_classes_36k_train_007457
1,827
permissive
[ { "docstring": "Internal use only: initialize section object", "name": "__init__", "signature": "def __init__(self, api, data)" }, { "docstring": "Show the content", "name": "show", "signature": "def show(self)" }, { "docstring": "Get the content of this section", "name": "ge...
4
stack_v2_sparse_classes_30k_train_010013
Implement the Python class `SectionComment` described below. Class description: Implement the SectionComment class. Method signatures and docstrings: - def __init__(self, api, data): Internal use only: initialize section object - def show(self): Show the content - def get(self): Get the content of this section - def ...
Implement the Python class `SectionComment` described below. Class description: Implement the SectionComment class. Method signatures and docstrings: - def __init__(self, api, data): Internal use only: initialize section object - def show(self): Show the content - def get(self): Get the content of this section - def ...
4063b01993f0bf17ea2857009c1bedc5ace8b87b
<|skeleton|> class SectionComment: def __init__(self, api, data): """Internal use only: initialize section object""" <|body_0|> def show(self): """Show the content""" <|body_1|> def get(self): """Get the content of this section""" <|body_2|> def set(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SectionComment: def __init__(self, api, data): """Internal use only: initialize section object""" if not (data == None) & (type(data) == dict) & ('sectionType' in data.keys()): if data['sectionType'] == 'COMMENT': super().__init__(api, data) else: ...
the_stack_v2_python_sparse
elabjournal/elabjournal/SectionComment.py
matthijsbrouwer/elabjournal-python
train
2
a8d4677a2ee231590d9c8d9eeb71f4ef8a159748
[ "url = 'http://third.payment.com'\ndata = {'card_num': card_num, 'amount': amount}\nself.response = requests.post(url, data=data)\nreturn self.response.status_code", "try:\n status_code = self.auth(card_num, amount)\nexcept TimeoutError:\n status_code = self.auth(card_num, amount)\nif status_code == 200:\n ...
<|body_start_0|> url = 'http://third.payment.com' data = {'card_num': card_num, 'amount': amount} self.response = requests.post(url, data=data) return self.response.status_code <|end_body_0|> <|body_start_1|> try: status_code = self.auth(card_num, amount) exc...
定义第三方支付类
Payment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Payment: """定义第三方支付类""" def auth(self, card_num, amount): """请求第三方支付接口,并返回响应码 :param card_num: 卡号 :param amount: 金额 :return: 返回状态码,200代表支付成功,500代表支付失败""" <|body_0|> def pay(self, user_id, card_num, amount): """支付 :param user_id: :param card_num: :param amount: :r...
stack_v2_sparse_classes_36k_train_007458
1,178
no_license
[ { "docstring": "请求第三方支付接口,并返回响应码 :param card_num: 卡号 :param amount: 金额 :return: 返回状态码,200代表支付成功,500代表支付失败", "name": "auth", "signature": "def auth(self, card_num, amount)" }, { "docstring": "支付 :param user_id: :param card_num: :param amount: :return:", "name": "pay", "signature": "def pa...
2
null
Implement the Python class `Payment` described below. Class description: 定义第三方支付类 Method signatures and docstrings: - def auth(self, card_num, amount): 请求第三方支付接口,并返回响应码 :param card_num: 卡号 :param amount: 金额 :return: 返回状态码,200代表支付成功,500代表支付失败 - def pay(self, user_id, card_num, amount): 支付 :param user_id: :param card_n...
Implement the Python class `Payment` described below. Class description: 定义第三方支付类 Method signatures and docstrings: - def auth(self, card_num, amount): 请求第三方支付接口,并返回响应码 :param card_num: 卡号 :param amount: 金额 :return: 返回状态码,200代表支付成功,500代表支付失败 - def pay(self, user_id, card_num, amount): 支付 :param user_id: :param card_n...
c8bd6d284499ac205b772280d3a347a888c80d17
<|skeleton|> class Payment: """定义第三方支付类""" def auth(self, card_num, amount): """请求第三方支付接口,并返回响应码 :param card_num: 卡号 :param amount: 金额 :return: 返回状态码,200代表支付成功,500代表支付失败""" <|body_0|> def pay(self, user_id, card_num, amount): """支付 :param user_id: :param card_num: :param amount: :r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Payment: """定义第三方支付类""" def auth(self, card_num, amount): """请求第三方支付接口,并返回响应码 :param card_num: 卡号 :param amount: 金额 :return: 返回状态码,200代表支付成功,500代表支付失败""" url = 'http://third.payment.com' data = {'card_num': card_num, 'amount': amount} self.response = requests.post(url, dat...
the_stack_v2_python_sparse
PycharmProjects/Python_Automated_Testing_Class_16/Class_16_20190612_Learn_Mock/payment_mock.py
dransonjs/my_python_test_codes
train
0
edc5e21b12b7b9f0cd4d64334f7ac745ea4ff8fb
[ "import bisect\nl = len(str(N))\nl_D = len(D)\nD = list(map(int, D))\nans = 0\nfor i in range(1, l):\n ans += l_D ** i\nfor i, a in enumerate(str(N)):\n print('star: ', ans, a, i)\n pos = bisect.bisect_left(D, int(a))\n if pos < len(D) and D[pos] == int(a):\n ans += pos * l_D ** (l - i - 1)\n ...
<|body_start_0|> import bisect l = len(str(N)) l_D = len(D) D = list(map(int, D)) ans = 0 for i in range(1, l): ans += l_D ** i for i, a in enumerate(str(N)): print('star: ', ans, a, i) pos = bisect.bisect_left(D, int(a)) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def atMostNGivenDigitSet(self, D, N): """:type D: List[str] :type N: int :rtype: int 24 ms""" <|body_0|> def atMostNGivenDigitSet_1(self, D, N): """:type D: List[str] :type N: int :rtype: int 24ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_007459
3,010
no_license
[ { "docstring": ":type D: List[str] :type N: int :rtype: int 24 ms", "name": "atMostNGivenDigitSet", "signature": "def atMostNGivenDigitSet(self, D, N)" }, { "docstring": ":type D: List[str] :type N: int :rtype: int 24ms", "name": "atMostNGivenDigitSet_1", "signature": "def atMostNGivenDi...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def atMostNGivenDigitSet(self, D, N): :type D: List[str] :type N: int :rtype: int 24 ms - def atMostNGivenDigitSet_1(self, D, N): :type D: List[str] :type N: int :rtype: int 24ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def atMostNGivenDigitSet(self, D, N): :type D: List[str] :type N: int :rtype: int 24 ms - def atMostNGivenDigitSet_1(self, D, N): :type D: List[str] :type N: int :rtype: int 24ms...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def atMostNGivenDigitSet(self, D, N): """:type D: List[str] :type N: int :rtype: int 24 ms""" <|body_0|> def atMostNGivenDigitSet_1(self, D, N): """:type D: List[str] :type N: int :rtype: int 24ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def atMostNGivenDigitSet(self, D, N): """:type D: List[str] :type N: int :rtype: int 24 ms""" import bisect l = len(str(N)) l_D = len(D) D = list(map(int, D)) ans = 0 for i in range(1, l): ans += l_D ** i for i, a in enumera...
the_stack_v2_python_sparse
NumbersAtMostNGivenDigitSet_HARD_902.py
953250587/leetcode-python
train
2
4e839ba3808743ba8c8785079521bbfa02a0e34f
[ "id = request.GET.get('id', None)\nif id is None:\n fields_of_study = FieldOfStudy.objects.all()\n serializer = FieldOfStudySerializer(fields_of_study, many=True)\n return JsonResponse({'fields_of_study': serializer.data}, safe=False)\nelse:\n field_of_study = get_object_or_404(FieldOfStudy, id=id)\n ...
<|body_start_0|> id = request.GET.get('id', None) if id is None: fields_of_study = FieldOfStudy.objects.all() serializer = FieldOfStudySerializer(fields_of_study, many=True) return JsonResponse({'fields_of_study': serializer.data}, safe=False) else: ...
专业方向view
FieldsOfStudy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FieldsOfStudy: """专业方向view""" def get(self, request): """查询专业方向""" <|body_0|> def put(self, request): """修改专业方向""" <|body_1|> def post(self, request): """增加专业方向""" <|body_2|> def delete(self, request): """删除专业方向""" ...
stack_v2_sparse_classes_36k_train_007460
15,061
permissive
[ { "docstring": "查询专业方向", "name": "get", "signature": "def get(self, request)" }, { "docstring": "修改专业方向", "name": "put", "signature": "def put(self, request)" }, { "docstring": "增加专业方向", "name": "post", "signature": "def post(self, request)" }, { "docstring": "删除专...
4
stack_v2_sparse_classes_30k_train_018633
Implement the Python class `FieldsOfStudy` described below. Class description: 专业方向view Method signatures and docstrings: - def get(self, request): 查询专业方向 - def put(self, request): 修改专业方向 - def post(self, request): 增加专业方向 - def delete(self, request): 删除专业方向
Implement the Python class `FieldsOfStudy` described below. Class description: 专业方向view Method signatures and docstrings: - def get(self, request): 查询专业方向 - def put(self, request): 修改专业方向 - def post(self, request): 增加专业方向 - def delete(self, request): 删除专业方向 <|skeleton|> class FieldsOfStudy: """专业方向view""" d...
7aaa1be773718de1beb3ce0080edca7c4114b7ad
<|skeleton|> class FieldsOfStudy: """专业方向view""" def get(self, request): """查询专业方向""" <|body_0|> def put(self, request): """修改专业方向""" <|body_1|> def post(self, request): """增加专业方向""" <|body_2|> def delete(self, request): """删除专业方向""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FieldsOfStudy: """专业方向view""" def get(self, request): """查询专业方向""" id = request.GET.get('id', None) if id is None: fields_of_study = FieldOfStudy.objects.all() serializer = FieldOfStudySerializer(fields_of_study, many=True) return JsonResponse({...
the_stack_v2_python_sparse
plan/views.py
MIXISAMA/MIS-backend
train
0
6e7d8de05799374aab46a64bb3d7415a76933929
[ "if not Token.__instance:\n Token()\nreturn Token.__instance", "if Token.__instance:\n raise Exception('This class is a singleton!')\nelse:\n req = requests.post(url=URL.DB_URL + 'generateToken/', data={'type': 'COMPONENT'})\n token_id = json.loads(req.text)['token']\n req_token = requests.get(url=...
<|body_start_0|> if not Token.__instance: Token() return Token.__instance <|end_body_0|> <|body_start_1|> if Token.__instance: raise Exception('This class is a singleton!') else: req = requests.post(url=URL.DB_URL + 'generateToken/', data={'type': 'CO...
Token
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Token: def get_instance(): """Static access method.""" <|body_0|> def __init__(self): """Virtually private constructor.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not Token.__instance: Token() return Token.__instance <|en...
stack_v2_sparse_classes_36k_train_007461
957
permissive
[ { "docstring": "Static access method.", "name": "get_instance", "signature": "def get_instance()" }, { "docstring": "Virtually private constructor.", "name": "__init__", "signature": "def __init__(self)" } ]
2
stack_v2_sparse_classes_30k_train_007648
Implement the Python class `Token` described below. Class description: Implement the Token class. Method signatures and docstrings: - def get_instance(): Static access method. - def __init__(self): Virtually private constructor.
Implement the Python class `Token` described below. Class description: Implement the Token class. Method signatures and docstrings: - def get_instance(): Static access method. - def __init__(self): Virtually private constructor. <|skeleton|> class Token: def get_instance(): """Static access method.""" ...
c7a1f6bb69099797e2136522dbdda94c2e6a4895
<|skeleton|> class Token: def get_instance(): """Static access method.""" <|body_0|> def __init__(self): """Virtually private constructor.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Token: def get_instance(): """Static access method.""" if not Token.__instance: Token() return Token.__instance def __init__(self): """Virtually private constructor.""" if Token.__instance: raise Exception('This class is a singleton!') ...
the_stack_v2_python_sparse
IoT_Recovery/singletonClass.py
ertis-research/reliable-iot
train
1
238100d453e2b18fc1bac43766290dcc03fe72b3
[ "nums.sort()\nres = []\nfor i in range(0, len(nums) - 2):\n if i > 0 and nums[i] == nums[i - 1]:\n continue\n left = i + 1\n right = len(nums) - 1\n while left < right:\n current_sum = nums[i] + nums[left] + nums[right]\n if current_sum < 0:\n left += 1\n elif curr...
<|body_start_0|> nums.sort() res = [] for i in range(0, len(nums) - 2): if i > 0 and nums[i] == nums[i - 1]: continue left = i + 1 right = len(nums) - 1 while left < right: current_sum = nums[i] + nums[left] + nums[r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSum_no_deDup(self, nums): """:type nums: List[int] :rtype: List[List[int]] :Note: This solution will contain duplicated answer.""" <|body_0|> def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]] This is faster then the one bel...
stack_v2_sparse_classes_36k_train_007462
3,348
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]] :Note: This solution will contain duplicated answer.", "name": "threeSum_no_deDup", "signature": "def threeSum_no_deDup(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]] This is faster then the one below.",...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum_no_deDup(self, nums): :type nums: List[int] :rtype: List[List[int]] :Note: This solution will contain duplicated answer. - def threeSum(self, nums): :type nums: List...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSum_no_deDup(self, nums): :type nums: List[int] :rtype: List[List[int]] :Note: This solution will contain duplicated answer. - def threeSum(self, nums): :type nums: List...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|skeleton|> class Solution: def threeSum_no_deDup(self, nums): """:type nums: List[int] :rtype: List[List[int]] :Note: This solution will contain duplicated answer.""" <|body_0|> def threeSum(self, nums): """:type nums: List[int] :rtype: List[List[int]] This is faster then the one bel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSum_no_deDup(self, nums): """:type nums: List[int] :rtype: List[List[int]] :Note: This solution will contain duplicated answer.""" nums.sort() res = [] for i in range(0, len(nums) - 2): if i > 0 and nums[i] == nums[i - 1]: continue...
the_stack_v2_python_sparse
Algorithm/015_3sum.py
Gi1ia/TechNoteBook
train
7
7a87f9c55b7753fd63557ef72ee8a5708aa00ffb
[ "super(EncoderMix, self).__init__()\ntyp = etype.lstrip('vgg').rstrip('p')\nif typ not in ['lstm', 'gru', 'blstm', 'bgru']:\n logging.error('Error: need to specify an appropriate encoder architecture')\nif etype.startswith('vgg'):\n if etype[-1] == 'p':\n self.enc_mix = torch.nn.ModuleList([VGG2L(in_ch...
<|body_start_0|> super(EncoderMix, self).__init__() typ = etype.lstrip('vgg').rstrip('p') if typ not in ['lstm', 'gru', 'blstm', 'bgru']: logging.error('Error: need to specify an appropriate encoder architecture') if etype.startswith('vgg'): if etype[-1] == 'p': ...
Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder network :param int elayers_rec: number of layers of shared recognition part in ...
EncoderMix
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderMix: """Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder network :param int elayers_rec: number of...
stack_v2_sparse_classes_36k_train_007463
30,819
permissive
[ { "docstring": "Initialize the encoder of single-channel multi-speaker ASR.", "name": "__init__", "signature": "def __init__(self, etype, idim, elayers_sd, elayers_rec, eunits, eprojs, subsample, dropout, num_spkrs=2, in_channel=1)" }, { "docstring": "Encodermix forward. :param torch.Tensor xs_p...
2
stack_v2_sparse_classes_30k_train_015134
Implement the Python class `EncoderMix` described below. Class description: Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder ne...
Implement the Python class `EncoderMix` described below. Class description: Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder ne...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class EncoderMix: """Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder network :param int elayers_rec: number of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderMix: """Encoder module for the case of multi-speaker mixture speech. :param str etype: type of encoder network :param int idim: number of dimensions of encoder network :param int elayers_sd: number of layers of speaker differentiate part in encoder network :param int elayers_rec: number of layers of sh...
the_stack_v2_python_sparse
espnet/nets/pytorch_backend/e2e_asr_mix.py
espnet/espnet
train
7,242
43b5f5a9b95dccb6133c7e2c8a2158466f958f3e
[ "if ADDRESS_NOT_FOUND:\n return HttpResponseNotFound(ADDRESS_NOT_FOUND_MSG)\nreturn Response([{'ruleId': 0, 'ruleAddress': ruleAddress, 'ruleFrom': True, 'ruleTo': True, 'ruleReason': 'string'}])", "if ADDRESS_NOT_FOUND:\n return HttpResponseNotFound(ADDRESS_NOT_FOUND_MSG)\nif len(request.data) != 3:\n r...
<|body_start_0|> if ADDRESS_NOT_FOUND: return HttpResponseNotFound(ADDRESS_NOT_FOUND_MSG) return Response([{'ruleId': 0, 'ruleAddress': ruleAddress, 'ruleFrom': True, 'ruleTo': True, 'ruleReason': 'string'}]) <|end_body_0|> <|body_start_1|> if ADDRESS_NOT_FOUND: return H...
[GET] /mailFilter/{ruleAddress} Get all rules with specified ruleAddress [PUT] /mailFilter/{ruleAddress} Change a reason and direction for all rules with the specified e-mail address [DELETE] /mailFilter/{ruleAddress} Delete all rules for specified e-mail address and direction (from or to)
MailFilterRuleAddress
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailFilterRuleAddress: """[GET] /mailFilter/{ruleAddress} Get all rules with specified ruleAddress [PUT] /mailFilter/{ruleAddress} Change a reason and direction for all rules with the specified e-mail address [DELETE] /mailFilter/{ruleAddress} Delete all rules for specified e-mail address and dir...
stack_v2_sparse_classes_36k_train_007464
6,047
permissive
[ { "docstring": ":param ruleAddress: e-mail address", "name": "get", "signature": "def get(self, request, ruleAddress, **kwargs)" }, { "docstring": ":param ruleAddress: e-mail address", "name": "put", "signature": "def put(self, request, ruleAddress, **kwargs)" }, { "docstring": "...
3
stack_v2_sparse_classes_30k_train_007513
Implement the Python class `MailFilterRuleAddress` described below. Class description: [GET] /mailFilter/{ruleAddress} Get all rules with specified ruleAddress [PUT] /mailFilter/{ruleAddress} Change a reason and direction for all rules with the specified e-mail address [DELETE] /mailFilter/{ruleAddress} Delete all rul...
Implement the Python class `MailFilterRuleAddress` described below. Class description: [GET] /mailFilter/{ruleAddress} Get all rules with specified ruleAddress [PUT] /mailFilter/{ruleAddress} Change a reason and direction for all rules with the specified e-mail address [DELETE] /mailFilter/{ruleAddress} Delete all rul...
73e4ac0ced6c3ac46d24ac5c3feb01a1e88bd36b
<|skeleton|> class MailFilterRuleAddress: """[GET] /mailFilter/{ruleAddress} Get all rules with specified ruleAddress [PUT] /mailFilter/{ruleAddress} Change a reason and direction for all rules with the specified e-mail address [DELETE] /mailFilter/{ruleAddress} Delete all rules for specified e-mail address and dir...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MailFilterRuleAddress: """[GET] /mailFilter/{ruleAddress} Get all rules with specified ruleAddress [PUT] /mailFilter/{ruleAddress} Change a reason and direction for all rules with the specified e-mail address [DELETE] /mailFilter/{ruleAddress} Delete all rules for specified e-mail address and direction (from ...
the_stack_v2_python_sparse
crusoe_act/act-component/mailFilter-wrapper/mailFilter_wrapper_project/views.py
wumingruiye/CRUSOE
train
0
226369d65764eb45a402eddd657e595a4d924b01
[ "hashmap = {}\nmaj, appearance = (None, 0)\nfor num in nums:\n if num not in hashmap:\n hashmap[num] = 1\n else:\n hashmap[num] += 1\n if hashmap[num] > appearance:\n appearance = hashmap[num]\n maj = num\nreturn maj", "def appearance(num, left, right):\n \"\"\" 计算出现次数 \"\"...
<|body_start_0|> hashmap = {} maj, appearance = (None, 0) for num in nums: if num not in hashmap: hashmap[num] = 1 else: hashmap[num] += 1 if hashmap[num] > appearance: appearance = hashmap[num] m...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def majorityElementHashmap(self, nums: List[int]) -> int: """哈希表""" <|body_0|> def majorityElementRecursion(self, nums: List[int]) -> int: """分治法""" <|body_1|> def majorityElement(self, nums: List[int]) -> int: """Boyer-Moore 投票算法""" ...
stack_v2_sparse_classes_36k_train_007465
2,706
no_license
[ { "docstring": "哈希表", "name": "majorityElementHashmap", "signature": "def majorityElementHashmap(self, nums: List[int]) -> int" }, { "docstring": "分治法", "name": "majorityElementRecursion", "signature": "def majorityElementRecursion(self, nums: List[int]) -> int" }, { "docstring":...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElementHashmap(self, nums: List[int]) -> int: 哈希表 - def majorityElementRecursion(self, nums: List[int]) -> int: 分治法 - def majorityElement(self, nums: List[int]) -> in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def majorityElementHashmap(self, nums: List[int]) -> int: 哈希表 - def majorityElementRecursion(self, nums: List[int]) -> int: 分治法 - def majorityElement(self, nums: List[int]) -> in...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def majorityElementHashmap(self, nums: List[int]) -> int: """哈希表""" <|body_0|> def majorityElementRecursion(self, nums: List[int]) -> int: """分治法""" <|body_1|> def majorityElement(self, nums: List[int]) -> int: """Boyer-Moore 投票算法""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def majorityElementHashmap(self, nums: List[int]) -> int: """哈希表""" hashmap = {} maj, appearance = (None, 0) for num in nums: if num not in hashmap: hashmap[num] = 1 else: hashmap[num] += 1 if hashmap...
the_stack_v2_python_sparse
169.多数元素/solution.py
QtTao/daily_leetcode
train
0
0465e6332722a08abf5b36a07b1aedbf3d444e19
[ "queryset = models.Referral.objects.exclude(state=ReferralState.DRAFT).annotate(due_date=ExpressionWrapper(F('sent_at') + F('urgency_level__duration'), output_field=DateTimeField()))\nqueryset = queryset.annotate(is_user_related_unit_member=Exists(models.UnitMembership.objects.filter(unit=OuterRef('units'), user=se...
<|body_start_0|> queryset = models.Referral.objects.exclude(state=ReferralState.DRAFT).annotate(due_date=ExpressionWrapper(F('sent_at') + F('urgency_level__duration'), output_field=DateTimeField())) queryset = queryset.annotate(is_user_related_unit_member=Exists(models.UnitMembership.objects.filter(unit...
Return a list of referrals as a csv file to authenticated users.
ExportView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExportView: """Return a list of referrals as a csv file to authenticated users.""" def get_queryset(self): """fFilter referrals and return a ready-to-use queryset.""" <|body_0|> def get(self, request): """Build and return the csv file""" <|body_1|> <|end...
stack_v2_sparse_classes_36k_train_007466
6,466
permissive
[ { "docstring": "fFilter referrals and return a ready-to-use queryset.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Build and return the csv file", "name": "get", "signature": "def get(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_006634
Implement the Python class `ExportView` described below. Class description: Return a list of referrals as a csv file to authenticated users. Method signatures and docstrings: - def get_queryset(self): fFilter referrals and return a ready-to-use queryset. - def get(self, request): Build and return the csv file
Implement the Python class `ExportView` described below. Class description: Return a list of referrals as a csv file to authenticated users. Method signatures and docstrings: - def get_queryset(self): fFilter referrals and return a ready-to-use queryset. - def get(self, request): Build and return the csv file <|skel...
22e4afa728a851bb4c2479fbb6f5944a75984b9b
<|skeleton|> class ExportView: """Return a list of referrals as a csv file to authenticated users.""" def get_queryset(self): """fFilter referrals and return a ready-to-use queryset.""" <|body_0|> def get(self, request): """Build and return the csv file""" <|body_1|> <|end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExportView: """Return a list of referrals as a csv file to authenticated users.""" def get_queryset(self): """fFilter referrals and return a ready-to-use queryset.""" queryset = models.Referral.objects.exclude(state=ReferralState.DRAFT).annotate(due_date=ExpressionWrapper(F('sent_at') + F...
the_stack_v2_python_sparse
src/backend/partaj/core/views/common.py
MTES-MCT/partaj
train
4
02fbf6b94fd91a95ed4437921087bbaacf2d9a12
[ "def normalize(name):\n name = name.replace('-', '_')\n name = name.upper()\n return name\nreturn f'{normalize(self.prefix)}_{normalize(self.name)}'", "def normalize(name):\n name = name.replace('_', '-')\n name = name.lower()\n return name\nreturn f'--{normalize(self.prefix)}-{normalize(self.na...
<|body_start_0|> def normalize(name): name = name.replace('-', '_') name = name.upper() return name return f'{normalize(self.prefix)}_{normalize(self.name)}' <|end_body_0|> <|body_start_1|> def normalize(name): name = name.replace('_', '-') ...
Option
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Option: def env(self): """Environment variable name""" <|body_0|> def cli(self): """Cli argument name""" <|body_1|> def pytest(self): """Pytest option name""" <|body_2|> def help(self): """Help text including information abou...
stack_v2_sparse_classes_36k_train_007467
3,402
permissive
[ { "docstring": "Environment variable name", "name": "env", "signature": "def env(self)" }, { "docstring": "Cli argument name", "name": "cli", "signature": "def cli(self)" }, { "docstring": "Pytest option name", "name": "pytest", "signature": "def pytest(self)" }, { ...
4
null
Implement the Python class `Option` described below. Class description: Implement the Option class. Method signatures and docstrings: - def env(self): Environment variable name - def cli(self): Cli argument name - def pytest(self): Pytest option name - def help(self): Help text including information about default val...
Implement the Python class `Option` described below. Class description: Implement the Option class. Method signatures and docstrings: - def env(self): Environment variable name - def cli(self): Cli argument name - def pytest(self): Pytest option name - def help(self): Help text including information about default val...
d3450d947ea88e0d4900beac2a2a0cfd65c3806a
<|skeleton|> class Option: def env(self): """Environment variable name""" <|body_0|> def cli(self): """Cli argument name""" <|body_1|> def pytest(self): """Pytest option name""" <|body_2|> def help(self): """Help text including information abou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Option: def env(self): """Environment variable name""" def normalize(name): name = name.replace('-', '_') name = name.upper() return name return f'{normalize(self.prefix)}_{normalize(self.name)}' def cli(self): """Cli argument name""" ...
the_stack_v2_python_sparse
pytest_itde/config.py
exasol/integration-test-docker-environment
train
9
44ab080409a0baddac6e71cc84accb4bf5592c7f
[ "if root == None:\n return ''\n\ndef postorder(root):\n return postorder(root.left) + postorder(root.right) + [root.val] if root else ['None']\nreturn ','.join(map(str, postorder(root)))", "if data == '':\n return None\ndata = data.split(',')\n\ndef helper(data):\n val = data.pop()\n if val == 'Non...
<|body_start_0|> if root == None: return '' def postorder(root): return postorder(root.left) + postorder(root.right) + [root.val] if root else ['None'] return ','.join(map(str, postorder(root))) <|end_body_0|> <|body_start_1|> if data == '': return N...
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_007468
4,106
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_013378
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:...
56047a5058c6a20b356ab20e52eacb425ad45762
<|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""" if root == None: return '' def postorder(root): return postorder(root.left) + postorder(root.right) + [root.val] if root else ['None'] return ','...
the_stack_v2_python_sparse
Python/BinaryTree/297. Serialize and Deserialize Binary Tree.py
Leahxuliu/Data-Structure-And-Algorithm
train
2
8a18c4168b78391b56a128ccb155fd20cb6c1ab5
[ "if metadata:\n msg.update(metadata)\nreturn OrderBookMessage(OrderBookMessageType.SNAPSHOT, {'trading_pair': msg['marketId'], 'snapshotId': msg['snapshotId'], 'update_id': msg['snapshotId'], 'bids': msg['bids'], 'asks': msg['asks']}, timestamp=timestamp)", "if metadata:\n msg.update(metadata)\nreturn Order...
<|body_start_0|> if metadata: msg.update(metadata) return OrderBookMessage(OrderBookMessageType.SNAPSHOT, {'trading_pair': msg['marketId'], 'snapshotId': msg['snapshotId'], 'update_id': msg['snapshotId'], 'bids': msg['bids'], 'asks': msg['asks']}, timestamp=timestamp) <|end_body_0|> <|body_...
BtcMarketsOrderBook
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BtcMarketsOrderBook: def snapshot_message_from_exchange_websocket(cls, msg: Dict[str, any], timestamp: float, metadata: Optional[Dict]=None) -> OrderBookMessage: """Creates a snapshot message with the order book snapshot message :param msg: the response from the exchange when requesting ...
stack_v2_sparse_classes_36k_train_007469
4,545
permissive
[ { "docstring": "Creates a snapshot message with the order book snapshot message :param msg: the response from the exchange when requesting the order book snapshot :param timestamp: the snapshot timestamp :param metadata: a dictionary with extra information to add to the snapshot data :return: a snapshot message...
4
null
Implement the Python class `BtcMarketsOrderBook` described below. Class description: Implement the BtcMarketsOrderBook class. Method signatures and docstrings: - def snapshot_message_from_exchange_websocket(cls, msg: Dict[str, any], timestamp: float, metadata: Optional[Dict]=None) -> OrderBookMessage: Creates a snaps...
Implement the Python class `BtcMarketsOrderBook` described below. Class description: Implement the BtcMarketsOrderBook class. Method signatures and docstrings: - def snapshot_message_from_exchange_websocket(cls, msg: Dict[str, any], timestamp: float, metadata: Optional[Dict]=None) -> OrderBookMessage: Creates a snaps...
c3f101759ab7e7a2165cd23a3a3e94c90c642a9b
<|skeleton|> class BtcMarketsOrderBook: def snapshot_message_from_exchange_websocket(cls, msg: Dict[str, any], timestamp: float, metadata: Optional[Dict]=None) -> OrderBookMessage: """Creates a snapshot message with the order book snapshot message :param msg: the response from the exchange when requesting ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BtcMarketsOrderBook: def snapshot_message_from_exchange_websocket(cls, msg: Dict[str, any], timestamp: float, metadata: Optional[Dict]=None) -> OrderBookMessage: """Creates a snapshot message with the order book snapshot message :param msg: the response from the exchange when requesting the order book...
the_stack_v2_python_sparse
hummingbot/connector/exchange/btc_markets/btc_markets_order_book.py
CoinAlpha/hummingbot
train
135
85f82fd233c92a6959977eda259030bfddc12bc5
[ "self.out = None\nself.in_shape = None\nself.work_shape = None", "assert x.ndim > 1, \"prysm's softmax is meant for use with multiple independent variables at once\"\nxx = x.reshape((-1, x.shape[-1]))\nself.in_shape = x.shape\nself.work_shape = xx.shape\nxnorm = xx - xx.max(axis=1)[:, np.newaxis]\ne_x = np.exp(xn...
<|body_start_0|> self.out = None self.in_shape = None self.work_shape = None <|end_body_0|> <|body_start_1|> assert x.ndim > 1, "prysm's softmax is meant for use with multiple independent variables at once" xx = x.reshape((-1, x.shape[-1])) self.in_shape = x.shape ...
Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and reverse() may take any number of dimensions. The understanding of the inputs...
Softmax
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Softmax: """Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and reverse() may take any number of dimensio...
stack_v2_sparse_classes_36k_train_007470
7,697
permissive
[ { "docstring": "Create a new Softmax node.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Perform Softmax activation on logits. Parameters ---------- x : numpy.ndarray, shape (A,B,C, ... K) any number of leading dimensions, required trailing dimension of size K, where...
3
stack_v2_sparse_classes_30k_train_000373
Implement the Python class `Softmax` described below. Class description: Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and re...
Implement the Python class `Softmax` described below. Class description: Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and re...
af89c94d500a274eda664188ddb97fcae30c6ac5
<|skeleton|> class Softmax: """Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and reverse() may take any number of dimensio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Softmax: """Softmax activation function. Softmax is a soft, differntiable alternative to argmax. It is used as a component of GumbelSoftmaxEncoder to ecourage / softly force variables to take on one of K discrete states. The arrays passed to forward() and reverse() may take any number of dimensions. The under...
the_stack_v2_python_sparse
prysm/x/optym/activation.py
brandondube/prysm
train
192
9637a42ff59412de462f12db7ee837c7a1819c86
[ "super().__init__(focus)\nself.hierarchical = ProfileResults()\nself.aggregate = defaultdict(list)\nself._ctr = 0\nself.overhead = 0\nself.print_results = print_results", "if not profile:\n return\nd = self.hierarchical\nfor part in _stack[:-1]:\n if not part.kwargs.get('profile', True):\n return\n ...
<|body_start_0|> super().__init__(focus) self.hierarchical = ProfileResults() self.aggregate = defaultdict(list) self._ctr = 0 self.overhead = 0 self.print_results = print_results <|end_body_0|> <|body_start_1|> if not profile: return d = self...
Build a profile of the execution of the program.
Profiler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Profiler: """Build a profile of the execution of the program.""" def __init__(self, focus=None, print_results=True): """Initialize a Profiler.""" <|body_0|> def on_enter(self, _stack=None, profile=True, **kwargs): """Executed when a block is entered.""" <...
stack_v2_sparse_classes_36k_train_007471
12,173
permissive
[ { "docstring": "Initialize a Profiler.", "name": "__init__", "signature": "def __init__(self, focus=None, print_results=True)" }, { "docstring": "Executed when a block is entered.", "name": "on_enter", "signature": "def on_enter(self, _stack=None, profile=True, **kwargs)" }, { "d...
4
stack_v2_sparse_classes_30k_train_001589
Implement the Python class `Profiler` described below. Class description: Build a profile of the execution of the program. Method signatures and docstrings: - def __init__(self, focus=None, print_results=True): Initialize a Profiler. - def on_enter(self, _stack=None, profile=True, **kwargs): Executed when a block is ...
Implement the Python class `Profiler` described below. Class description: Build a profile of the execution of the program. Method signatures and docstrings: - def __init__(self, focus=None, print_results=True): Initialize a Profiler. - def on_enter(self, _stack=None, profile=True, **kwargs): Executed when a block is ...
d7b12c15453079e1a2c4fdae611c5f741574363d
<|skeleton|> class Profiler: """Build a profile of the execution of the program.""" def __init__(self, focus=None, print_results=True): """Initialize a Profiler.""" <|body_0|> def on_enter(self, _stack=None, profile=True, **kwargs): """Executed when a block is entered.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Profiler: """Build a profile of the execution of the program.""" def __init__(self, focus=None, print_results=True): """Initialize a Profiler.""" super().__init__(focus) self.hierarchical = ProfileResults() self.aggregate = defaultdict(list) self._ctr = 0 s...
the_stack_v2_python_sparse
myia/utils/trace.py
breuleux/myia
train
1
00a9113da39ca6aaa2bff3ac53e68aee0baf0e8b
[ "tmp = [-1 for _ in range(len(w) + 1)]\nfor index, val in enumerate(w):\n tmp[index + 1] = tmp[index] + val\nself.freq = tmp[1:]\nprint(self.freq)", "target = random.randint(0, self.freq[-1])\nstart = 0\nend = len(self.freq) - 1\nwhile start + 1 < end:\n mid = (start + end) // 2\n if self.freq[mid] < tar...
<|body_start_0|> tmp = [-1 for _ in range(len(w) + 1)] for index, val in enumerate(w): tmp[index + 1] = tmp[index] + val self.freq = tmp[1:] print(self.freq) <|end_body_0|> <|body_start_1|> target = random.randint(0, self.freq[-1]) start = 0 end = len...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> tmp = [-1 for _ in range(len(w) + 1)] for index, val in enumerate(w): tmp[in...
stack_v2_sparse_classes_36k_train_007472
1,034
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
5e09a5d36ac55d782628a888ad57d48e234b61ac
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" tmp = [-1 for _ in range(len(w) + 1)] for index, val in enumerate(w): tmp[index + 1] = tmp[index] + val self.freq = tmp[1:] print(self.freq) def pickIndex(self): """:rtype: int""" ...
the_stack_v2_python_sparse
528/528.py
sjzyjc/leetcode
train
0
48ae130d70feb9bc53d11c9d048e30c7fd28cd4c
[ "if n < 2:\n return []\nif n == 2:\n return [2]\ns = range(3, n, 2)\nmroot = n ** 0.5\nhalf = len(s)\ni = 0\nm = 3\nwhile m <= mroot:\n if s[i]:\n j = (m * m - 3) // 2\n if j < len(s):\n s[j] = 0\n while j < min(len(s), half):\n s[j] = 0\n j...
<|body_start_0|> if n < 2: return [] if n == 2: return [2] s = range(3, n, 2) mroot = n ** 0.5 half = len(s) i = 0 m = 3 while m <= mroot: if s[i]: j = (m * m - 3) // 2 if j < len(s): ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def find_primes(n): """returns a list of prime numbers from 2 to < n""" <|body_0|> def judgeSquareSum(self, c): """:type c: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 2: return [] if n == 2:...
stack_v2_sparse_classes_36k_train_007473
1,325
permissive
[ { "docstring": "returns a list of prime numbers from 2 to < n", "name": "find_primes", "signature": "def find_primes(n)" }, { "docstring": ":type c: int :rtype: bool", "name": "judgeSquareSum", "signature": "def judgeSquareSum(self, c)" } ]
2
stack_v2_sparse_classes_30k_train_002008
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_primes(n): returns a list of prime numbers from 2 to < n - def judgeSquareSum(self, c): :type c: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_primes(n): returns a list of prime numbers from 2 to < n - def judgeSquareSum(self, c): :type c: int :rtype: bool <|skeleton|> class Solution: def find_primes(n): ...
844c6f18d06dcb397db76436e5f4b8ddcb1beddc
<|skeleton|> class Solution: def find_primes(n): """returns a list of prime numbers from 2 to < n""" <|body_0|> def judgeSquareSum(self, c): """:type c: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def find_primes(n): """returns a list of prime numbers from 2 to < n""" if n < 2: return [] if n == 2: return [2] s = range(3, n, 2) mroot = n ** 0.5 half = len(s) i = 0 m = 3 while m <= mroot: ...
the_stack_v2_python_sparse
py/sum-of-square-numbers.py
ckclark/leetcode
train
0
1d598bb4e169b13c03127d02d3e642989f60c466
[ "res, self.target = ([], target)\nfor i in range(1, len(num) + 1):\n if i == 1 or (i > 1 and num[0] != '0'):\n self.dfs(num[i:], num[:i], int(num[:i]), int(num[:i]), res)\nreturn res", "if not num:\n if cur == self.target:\n res.append(temp)\n return\nfor i in range(1, len(num) + 1):\n v...
<|body_start_0|> res, self.target = ([], target) for i in range(1, len(num) + 1): if i == 1 or (i > 1 and num[0] != '0'): self.dfs(num[i:], num[:i], int(num[:i]), int(num[:i]), res) return res <|end_body_0|> <|body_start_1|> if not num: if cur == ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addOperators(self, num, target): """:type num: str :type target: int :rtype: List[str] beats 36.86%""" <|body_0|> def dfs(self, num, temp, cur, last, res): """:param num: :param temp: :param cur: :param last: :param res: :return: dfs() parameters: num: ...
stack_v2_sparse_classes_36k_train_007474
1,487
no_license
[ { "docstring": ":type num: str :type target: int :rtype: List[str] beats 36.86%", "name": "addOperators", "signature": "def addOperators(self, num, target)" }, { "docstring": ":param num: :param temp: :param cur: :param last: :param res: :return: dfs() parameters: num: remaining num string temp:...
2
stack_v2_sparse_classes_30k_train_011361
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addOperators(self, num, target): :type num: str :type target: int :rtype: List[str] beats 36.86% - def dfs(self, num, temp, cur, last, res): :param num: :param temp: :param c...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addOperators(self, num, target): :type num: str :type target: int :rtype: List[str] beats 36.86% - def dfs(self, num, temp, cur, last, res): :param num: :param temp: :param c...
7e0e917c15d3e35f49da3a00ef395bd5ff180d79
<|skeleton|> class Solution: def addOperators(self, num, target): """:type num: str :type target: int :rtype: List[str] beats 36.86%""" <|body_0|> def dfs(self, num, temp, cur, last, res): """:param num: :param temp: :param cur: :param last: :param res: :return: dfs() parameters: num: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addOperators(self, num, target): """:type num: str :type target: int :rtype: List[str] beats 36.86%""" res, self.target = ([], target) for i in range(1, len(num) + 1): if i == 1 or (i > 1 and num[0] != '0'): self.dfs(num[i:], num[:i], int(num[:...
the_stack_v2_python_sparse
LeetCode/282_expression_add_operators.py
yao23/Machine_Learning_Playground
train
12
940660561bb3967160934e08544fc0aad76833b3
[ "num_map = {}\nfor i in range(len(nums)):\n if nums[i] in num_map and i - num_map[nums[i]] <= k:\n return True\n else:\n num_map[nums[i]] = i\nreturn False", "if len(nums) == len(set(nums)):\n return False\nelif len(nums) <= k:\n return True\nfor i in range(k, len(nums), 1):\n if len(...
<|body_start_0|> num_map = {} for i in range(len(nums)): if nums[i] in num_map and i - num_map[nums[i]] <= k: return True else: num_map[nums[i]] = i return False <|end_body_0|> <|body_start_1|> if len(nums) == len(set(nums)): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate1(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_007475
1,285
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate", "signature": "def containsNearbyDuplicate(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate1", "signature": "def contai...
2
stack_v2_sparse_classes_30k_train_003707
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate1(self, nums, k): :type nums: List[int] :type k: int :rty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate1(self, nums, k): :type nums: List[int] :type k: int :rty...
1e32c88649b6e910d9c30c225881e841f881bbf4
<|skeleton|> class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate1(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" num_map = {} for i in range(len(nums)): if nums[i] in num_map and i - num_map[nums[i]] <= k: return True else: num_map[num...
the_stack_v2_python_sparse
Leetcode219. 存在重复元素 II.py
Lanteriso/leecode
train
0
b09ba37888da8baf3ee1fcb3a04d9df6fa46c02e
[ "n = len(nums)\nfor i in range(1, n):\n nums[i] = max(nums[i - 1], 0) + nums[i]\nreturn max(nums)", "n = len(nums)\ndp = [0] * n\ndp[0] = nums[0]\nfor i in range(1, n):\n if dp[i - 1] > 0:\n dp[i] = max(dp[i - 1], dp[i - 1] + nums[i])\n else:\n dp[i] = nums[i]\nreturn max(dp)" ]
<|body_start_0|> n = len(nums) for i in range(1, n): nums[i] = max(nums[i - 1], 0) + nums[i] return max(nums) <|end_body_0|> <|body_start_1|> n = len(nums) dp = [0] * n dp[0] = nums[0] for i in range(1, n): if dp[i - 1] > 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums: List[int]) -> int: """状态转移方程: 当 dp[i−1]>0 时:执行 dp[i]=dp[i−1]+nums[i] ; 当 dp[i−1]≤0 时:执行 dp[i]=nums[i] ; 时间复杂度:O(n) 空间复杂度:O(1) :param nums: :return:""" <|body_0|> def maxSubArray2(self, nums: List[int]) -> int: """dp模板写法,题解同上 :par...
stack_v2_sparse_classes_36k_train_007476
1,258
no_license
[ { "docstring": "状态转移方程: 当 dp[i−1]>0 时:执行 dp[i]=dp[i−1]+nums[i] ; 当 dp[i−1]≤0 时:执行 dp[i]=nums[i] ; 时间复杂度:O(n) 空间复杂度:O(1) :param nums: :return:", "name": "maxSubArray", "signature": "def maxSubArray(self, nums: List[int]) -> int" }, { "docstring": "dp模板写法,题解同上 :param nums: :return:", "name": "...
2
stack_v2_sparse_classes_30k_train_010697
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums: List[int]) -> int: 状态转移方程: 当 dp[i−1]>0 时:执行 dp[i]=dp[i−1]+nums[i] ; 当 dp[i−1]≤0 时:执行 dp[i]=nums[i] ; 时间复杂度:O(n) 空间复杂度:O(1) :param nums: :return: - def...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums: List[int]) -> int: 状态转移方程: 当 dp[i−1]>0 时:执行 dp[i]=dp[i−1]+nums[i] ; 当 dp[i−1]≤0 时:执行 dp[i]=nums[i] ; 时间复杂度:O(n) 空间复杂度:O(1) :param nums: :return: - def...
578cacff5851c5c2522981693c34e3c318002d30
<|skeleton|> class Solution: def maxSubArray(self, nums: List[int]) -> int: """状态转移方程: 当 dp[i−1]>0 时:执行 dp[i]=dp[i−1]+nums[i] ; 当 dp[i−1]≤0 时:执行 dp[i]=nums[i] ; 时间复杂度:O(n) 空间复杂度:O(1) :param nums: :return:""" <|body_0|> def maxSubArray2(self, nums: List[int]) -> int: """dp模板写法,题解同上 :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums: List[int]) -> int: """状态转移方程: 当 dp[i−1]>0 时:执行 dp[i]=dp[i−1]+nums[i] ; 当 dp[i−1]≤0 时:执行 dp[i]=nums[i] ; 时间复杂度:O(n) 空间复杂度:O(1) :param nums: :return:""" n = len(nums) for i in range(1, n): nums[i] = max(nums[i - 1], 0) + nums[i] r...
the_stack_v2_python_sparse
剑指offer/连续子数组的最大和.py
cjrzs/MyLeetCode
train
8
483f2d1bc98e8c3e9427c95d941e17ed12b824af
[ "self.debug = debug\nself.n = n\nself.a = a\nself.b = b\nsuper().__init__()", "finalLevel = 1\nperfect = 0\nnum = inNum\nif num < self.a + self.b:\n return (finalLevel, False)\nwhile num >= self.a + self.b:\n num -= self.b\n a = int(num / self.a)\n b = num % self.a\n if b != 0:\n return (fin...
<|body_start_0|> self.debug = debug self.n = n self.a = a self.b = b super().__init__() <|end_body_0|> <|body_start_1|> finalLevel = 1 perfect = 0 num = inNum if num < self.a + self.b: return (finalLevel, False) while num >= se...
A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n : hate a and b in set 10 2 2 : 2x + 2 <= 10 x=1 => 4 remove 1 2 3 5 6 7 8 9 10...
CountAntiSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CountAntiSet: """A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n : hate a and b in set 10 2 2 : 2x + 2 ...
stack_v2_sparse_classes_36k_train_007477
6,429
no_license
[ { "docstring": "get the count of elements to meet the rule. (2) :param n: max number :param a: ax+b :param b: ax+b :param debug: debug mode :return:", "name": "__init__", "signature": "def __init__(self, n, a, b, debug=0)" }, { "docstring": "Analyze number 함수 () 계속 나누어 떨어져서 딱 맞아떨어질때 몇 단계까지 가는지 조...
4
null
Implement the Python class `CountAntiSet` described below. Class description: A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n...
Implement the Python class `CountAntiSet` described below. Class description: A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n...
2fb6246be3bf48eb8ad626217300a1a9328f541a
<|skeleton|> class CountAntiSet: """A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n : hate a and b in set 10 2 2 : 2x + 2 ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CountAntiSet: """A class used to get the count of elements url : https://codeup.kr/problem.php?id=2128&rid=0 n, a, b이 주어진다. (1<=n<=10100) (1<=a,b<=103) 집합 A의 임의의 원소 x를 선택했을 때 ax+b가 집합 A에 존재하지 않도록 A의 원소를 빼버리자! 하지만 a, b는 배려심이 많기 때문에 A의 크기를 최대로 하려고 한다. ax+b = n : hate a and b in set 10 2 2 : 2x + 2 <= 10 x=1 => ...
the_stack_v2_python_sparse
2022/1-lowMem2.py
cheoljoo/problemSolving
train
1
cea3f3f332fce859047b08ae15bfdf7291d9608c
[ "import eos, logging, _eos\nfrom eos import _NativeLogLevel as ll\nlevels = [ll.DEBUG, ll.INFO, ll.WARNING, ll.ERROR]\nfor set_level in levels:\n _eos._set_native_log_level(set_level)\n for check_level in levels:\n if check_level <= set_level:\n with self.assertLogs('EOS', level='DEBUG') as ...
<|body_start_0|> import eos, logging, _eos from eos import _NativeLogLevel as ll levels = [ll.DEBUG, ll.INFO, ll.WARNING, ll.ERROR] for set_level in levels: _eos._set_native_log_level(set_level) for check_level in levels: if check_level <= set_leve...
LoggingTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoggingTests: def test_log_levels(self): """Check if the set log level is respected""" <|body_0|> def test_log_000(self): """Computation of specific observable should log error""" <|body_1|> <|end_skeleton|> <|body_start_0|> import eos, logging, _eo...
stack_v2_sparse_classes_36k_train_007478
7,272
no_license
[ { "docstring": "Check if the set log level is respected", "name": "test_log_levels", "signature": "def test_log_levels(self)" }, { "docstring": "Computation of specific observable should log error", "name": "test_log_000", "signature": "def test_log_000(self)" } ]
2
stack_v2_sparse_classes_30k_train_018932
Implement the Python class `LoggingTests` described below. Class description: Implement the LoggingTests class. Method signatures and docstrings: - def test_log_levels(self): Check if the set log level is respected - def test_log_000(self): Computation of specific observable should log error
Implement the Python class `LoggingTests` described below. Class description: Implement the LoggingTests class. Method signatures and docstrings: - def test_log_levels(self): Check if the set log level is respected - def test_log_000(self): Computation of specific observable should log error <|skeleton|> class Loggi...
958db5d493e7b614d2393dbe3605cc0d711a0246
<|skeleton|> class LoggingTests: def test_log_levels(self): """Check if the set log level is respected""" <|body_0|> def test_log_000(self): """Computation of specific observable should log error""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoggingTests: def test_log_levels(self): """Check if the set log level is respected""" import eos, logging, _eos from eos import _NativeLogLevel as ll levels = [ll.DEBUG, ll.INFO, ll.WARNING, ll.ERROR] for set_level in levels: _eos._set_native_log_level(set_...
the_stack_v2_python_sparse
python/eos_TEST.py
eos/eos
train
46
7f690688ef34996e12fd259dc50f0158f763caf0
[ "real_time = real_qty = 0\nstart_date = end_date = False\n' Process '\nfor work_order in self.production_cycle_ids:\n real_time += work_order.uptime\n real_qty += work_order.real_qty\n if not start_date or work_order.start_date < start_date:\n start_date = work_order.start_date\n if not end_date ...
<|body_start_0|> real_time = real_qty = 0 start_date = end_date = False ' Process ' for work_order in self.production_cycle_ids: real_time += work_order.uptime real_qty += work_order.real_qty if not start_date or work_order.start_date < start_date: ...
mrp_production
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mrp_production: def compute_real_values(self): """Init""" <|body_0|> def _action_compute_lines(self, properties=None): """Initialization""" <|body_1|> <|end_skeleton|> <|body_start_0|> real_time = real_qty = 0 start_date = end_date = False ...
stack_v2_sparse_classes_36k_train_007479
10,966
no_license
[ { "docstring": "Init", "name": "compute_real_values", "signature": "def compute_real_values(self)" }, { "docstring": "Initialization", "name": "_action_compute_lines", "signature": "def _action_compute_lines(self, properties=None)" } ]
2
stack_v2_sparse_classes_30k_val_000205
Implement the Python class `mrp_production` described below. Class description: Implement the mrp_production class. Method signatures and docstrings: - def compute_real_values(self): Init - def _action_compute_lines(self, properties=None): Initialization
Implement the Python class `mrp_production` described below. Class description: Implement the mrp_production class. Method signatures and docstrings: - def compute_real_values(self): Init - def _action_compute_lines(self, properties=None): Initialization <|skeleton|> class mrp_production: def compute_real_value...
3e35f7ba7246c54e5a5b31921b28aa5f1ab24999
<|skeleton|> class mrp_production: def compute_real_values(self): """Init""" <|body_0|> def _action_compute_lines(self, properties=None): """Initialization""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class mrp_production: def compute_real_values(self): """Init""" real_time = real_qty = 0 start_date = end_date = False ' Process ' for work_order in self.production_cycle_ids: real_time += work_order.uptime real_qty += work_order.real_qty i...
the_stack_v2_python_sparse
mrp_operations_cycle/models/operation_cycle.py
mgielissen/julius-openobject-addons
train
1
b82fc800dfec98c3254c3396b08fe1a4a5919eb8
[ "heap = []\nprojects = sorted(zip(Profits, Capital), key=lambda l: l[1])\nindex = 0\nfor i in range(k):\n while index < len(projects):\n if projects[index][1] > W:\n break\n else:\n self.heap_add(heap, projects[index][0])\n index += 1\n if not heap:\n break\n ...
<|body_start_0|> heap = [] projects = sorted(zip(Profits, Capital), key=lambda l: l[1]) index = 0 for i in range(k): while index < len(projects): if projects[index][1] > W: break else: self.heap_add(heap,...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" <|body_0|> def heap_poll(heap): """堆弹出""" <|body_1|> def heap_add(heap, val): """堆添加""...
stack_v2_sparse_classes_36k_train_007480
2,105
no_license
[ { "docstring": ":type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int", "name": "findMaximizedCapital", "signature": "def findMaximizedCapital(self, k, W, Profits, Capital)" }, { "docstring": "堆弹出", "name": "heap_poll", "signature": "def heap_poll(heap)"...
3
stack_v2_sparse_classes_30k_train_020863
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaximizedCapital(self, k, W, Profits, Capital): :type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int - def heap_poll(heap): 堆弹出 - def h...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaximizedCapital(self, k, W, Profits, Capital): :type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int - def heap_poll(heap): 堆弹出 - def h...
86352d3f51ab030afdb7b472a80bc8cab7260c08
<|skeleton|> class Solution: def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" <|body_0|> def heap_poll(heap): """堆弹出""" <|body_1|> def heap_add(heap, val): """堆添加""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMaximizedCapital(self, k, W, Profits, Capital): """:type k: int :type W: int :type Profits: List[int] :type Capital: List[int] :rtype: int""" heap = [] projects = sorted(zip(Profits, Capital), key=lambda l: l[1]) index = 0 for i in range(k): ...
the_stack_v2_python_sparse
leetcode/_502_IPO.py
scolphew/leetcode_python
train
0
01856d0a1cc74717a7604769998e2b50b55fac29
[ "tk.Frame.__init__(self, parent)\nself.parent = parent\nself.parameters = {}\nself.parameters_lists = load_algorithm_constants(yaml_filename)\nself.parameters_lists_keys = list(self.parameters_lists.keys())\nself.values_lists = []\nfor key in self.parameters_lists_keys:\n self.values_lists.append(self.parameters...
<|body_start_0|> tk.Frame.__init__(self, parent) self.parent = parent self.parameters = {} self.parameters_lists = load_algorithm_constants(yaml_filename) self.parameters_lists_keys = list(self.parameters_lists.keys()) self.values_lists = [] for key in self.parame...
A Class used to map all the actions in the GUI Methods ------- get_algorithm_parameters() Description | Return all the selected values for each algorithm parameter (selected value from the combo box)
AlgorithmFrameOptions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AlgorithmFrameOptions: """A Class used to map all the actions in the GUI Methods ------- get_algorithm_parameters() Description | Return all the selected values for each algorithm parameter (selected value from the combo box)""" def __init__(self, parent=None, yaml_filename=None): ""...
stack_v2_sparse_classes_36k_train_007481
4,029
no_license
[ { "docstring": "Parameters ---------- parent : ParametersOptionsWindow The parent window which controls the current frame yaml_filename : str The file which suits a specific algorithm in order to construct the frame", "name": "__init__", "signature": "def __init__(self, parent=None, yaml_filename=None)"...
3
stack_v2_sparse_classes_30k_train_009966
Implement the Python class `AlgorithmFrameOptions` described below. Class description: A Class used to map all the actions in the GUI Methods ------- get_algorithm_parameters() Description | Return all the selected values for each algorithm parameter (selected value from the combo box) Method signatures and docstring...
Implement the Python class `AlgorithmFrameOptions` described below. Class description: A Class used to map all the actions in the GUI Methods ------- get_algorithm_parameters() Description | Return all the selected values for each algorithm parameter (selected value from the combo box) Method signatures and docstring...
b9ccbb0d863ba7739b2b1913e5a5b97a87977df7
<|skeleton|> class AlgorithmFrameOptions: """A Class used to map all the actions in the GUI Methods ------- get_algorithm_parameters() Description | Return all the selected values for each algorithm parameter (selected value from the combo box)""" def __init__(self, parent=None, yaml_filename=None): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AlgorithmFrameOptions: """A Class used to map all the actions in the GUI Methods ------- get_algorithm_parameters() Description | Return all the selected values for each algorithm parameter (selected value from the combo box)""" def __init__(self, parent=None, yaml_filename=None): """Parameters -...
the_stack_v2_python_sparse
gui/algorithm_frame_options/algorithm_frame_options.py
liorpizman/AnomalyDetection
train
4
24d5ddfd705fde1f8a464200e71837453262d8dd
[ "neuron.Neuron.__init__(self, size)\nself.tau_rc = tau_rc\nself.tau_ref = tau_ref", "x = 1.0 / (1 - TT.exp((self.tau_ref - 1.0 / max_rates) / self.tau_rc))\nalpha = (1 - z2) / (intercepts - 1.0)\nj_bias = 1 - alpha * intercepts\nreturn (alpha, j_bias)", "rate = self.tau_ref - self.tau_rc * TT.log(1 - 1.0 / TT.m...
<|body_start_0|> neuron.Neuron.__init__(self, size) self.tau_rc = tau_rc self.tau_ref = tau_ref <|end_body_0|> <|body_start_1|> x = 1.0 / (1 - TT.exp((self.tau_ref - 1.0 / max_rates) / self.tau_rc)) alpha = (1 - z2) / (intercepts - 1.0) j_bias = 1 - alpha * intercepts ...
LIFRateNeuron
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LIFRateNeuron: def __init__(self, size, tau_rc=0.02, tau_ref=0.002): """Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time constant :param float tau_ref: refractory period length (s)""" <|body_0|> def make_alpha_...
stack_v2_sparse_classes_36k_train_007482
1,938
permissive
[ { "docstring": "Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time constant :param float tau_ref: refractory period length (s)", "name": "__init__", "signature": "def __init__(self, size, tau_rc=0.02, tau_ref=0.002)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_013506
Implement the Python class `LIFRateNeuron` described below. Class description: Implement the LIFRateNeuron class. Method signatures and docstrings: - def __init__(self, size, tau_rc=0.02, tau_ref=0.002): Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time ...
Implement the Python class `LIFRateNeuron` described below. Class description: Implement the LIFRateNeuron class. Method signatures and docstrings: - def __init__(self, size, tau_rc=0.02, tau_ref=0.002): Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time ...
9067f897d4bf3d1a01ceb03e1b1f044cde580a19
<|skeleton|> class LIFRateNeuron: def __init__(self, size, tau_rc=0.02, tau_ref=0.002): """Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time constant :param float tau_ref: refractory period length (s)""" <|body_0|> def make_alpha_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LIFRateNeuron: def __init__(self, size, tau_rc=0.02, tau_ref=0.002): """Constructor for a set of LIF rate neuron :param int size: number of neurons in set :param float t_rc: the RC time constant :param float tau_ref: refractory period length (s)""" neuron.Neuron.__init__(self, size) se...
the_stack_v2_python_sparse
nengo_theano/lif_rate.py
ctn-archive/nengo_theano
train
0
c235f3fe930ecc07f178311983aad70f6f0706f1
[ "dll = instrument.root_instrument.dll\nlabel = 'Working frequency'\nif isinstance(instrument, LdaChannel):\n label = f'{instrument.short_name} {label}'\nsuper().__init__(name, instrument, dll_get_function=dll.fnLDA_GetWorkingFrequency, dll_set_function=dll.fnLDA_SetWorkingFrequency, unit='Hz', label=label, docst...
<|body_start_0|> dll = instrument.root_instrument.dll label = 'Working frequency' if isinstance(instrument, LdaChannel): label = f'{instrument.short_name} {label}' super().__init__(name, instrument, dll_get_function=dll.fnLDA_GetWorkingFrequency, dll_set_function=dll.fnLDA_Se...
Working frequency of one channel of the LDA. Not supported on all models.
LdaWorkingFrequency
[ "GPL-2.0-only", "GPL-2.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LdaWorkingFrequency: """Working frequency of one channel of the LDA. Not supported on all models.""" def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], **kwargs): """Attenuation of one channel in the LDA. Args: name: parameter name instrument: parent instrument,...
stack_v2_sparse_classes_36k_train_007483
12,103
permissive
[ { "docstring": "Attenuation of one channel in the LDA. Args: name: parameter name instrument: parent instrument, either LDA or LDA channel", "name": "__init__", "signature": "def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], **kwargs)" }, { "docstring": "Returns validator ...
2
stack_v2_sparse_classes_30k_train_006852
Implement the Python class `LdaWorkingFrequency` described below. Class description: Working frequency of one channel of the LDA. Not supported on all models. Method signatures and docstrings: - def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], **kwargs): Attenuation of one channel in the LDA. ...
Implement the Python class `LdaWorkingFrequency` described below. Class description: Working frequency of one channel of the LDA. Not supported on all models. Method signatures and docstrings: - def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], **kwargs): Attenuation of one channel in the LDA. ...
e07c9f23339ab00b0f4c4cc46711593d88f7fc84
<|skeleton|> class LdaWorkingFrequency: """Working frequency of one channel of the LDA. Not supported on all models.""" def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], **kwargs): """Attenuation of one channel in the LDA. Args: name: parameter name instrument: parent instrument,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LdaWorkingFrequency: """Working frequency of one channel of the LDA. Not supported on all models.""" def __init__(self, name: str, instrument: Union[Vaunix_LDA, LdaChannel], **kwargs): """Attenuation of one channel in the LDA. Args: name: parameter name instrument: parent instrument, either LDA o...
the_stack_v2_python_sparse
qcodes_contrib_drivers/drivers/Vaunix/LDA.py
QCoDeS/Qcodes_contrib_drivers
train
32
b5f8468d2e5f6183497771495f81fd768e349b94
[ "def preorder(root):\n return [root.val] + preorder(root.left) + preorder(root.right) if root else []\nserialization = '*'.join(map(str, preorder(root)))\nreturn serialization", "vals = [int(s) for s in data.split('*') if s]\n\ndef constructBST(maxVal):\n if not vals or vals[0] > maxVal:\n return Non...
<|body_start_0|> def preorder(root): return [root.val] + preorder(root.left) + preorder(root.right) if root else [] serialization = '*'.join(map(str, preorder(root))) return serialization <|end_body_0|> <|body_start_1|> vals = [int(s) for s in data.split('*') if s] ...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def preorder(r...
stack_v2_sparse_classes_36k_train_007484
1,212
permissive
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_021556
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
73593fe642a06a83cde974ba5e6de3a7b396ec84
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" def preorder(root): return [root.val] + preorder(root.left) + preorder(root.right) if root else [] serialization = '*'.join(map(str, preorder(root))) return serialization ...
the_stack_v2_python_sparse
449_serializeDeserializeBST.py
stuti-rastogi/leetcode-python-solutions
train
0
07aaab1862077c0edbec886152b7e1f3cb76dc8c
[ "damp_sensor = DamperSensorInconsistency()\nif isinstance(damp_sensor, DamperSensorInconsistency):\n assert True\nelse:\n assert False", "damp_sensor = DamperSensorInconsistency()\ndata_window = td(minutes=1)\nopen_damp_time = td(minutes=5)\ntemp_diff_thr = 4.0\noat_mat_check = {'low': max(temp_diff_thr * 1...
<|body_start_0|> damp_sensor = DamperSensorInconsistency() if isinstance(damp_sensor, DamperSensorInconsistency): assert True else: assert False <|end_body_0|> <|body_start_1|> damp_sensor = DamperSensorInconsistency() data_window = td(minutes=1) ...
Contains all the tests for Temperature Diagnostic
TestDiagnosticsDamperSensorInconsistency
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDiagnosticsDamperSensorInconsistency: """Contains all the tests for Temperature Diagnostic""" def test_damper_sensor_inconsistency_creation(self): """test the creation of damper sensor diagnostic class""" <|body_0|> def test_damp_sensor_dx_set_values(self): "...
stack_v2_sparse_classes_36k_train_007485
42,174
permissive
[ { "docstring": "test the creation of damper sensor diagnostic class", "name": "test_damper_sensor_inconsistency_creation", "signature": "def test_damper_sensor_inconsistency_creation(self)" }, { "docstring": "test the damper sensor set values method", "name": "test_damp_sensor_dx_set_values"...
4
null
Implement the Python class `TestDiagnosticsDamperSensorInconsistency` described below. Class description: Contains all the tests for Temperature Diagnostic Method signatures and docstrings: - def test_damper_sensor_inconsistency_creation(self): test the creation of damper sensor diagnostic class - def test_damp_senso...
Implement the Python class `TestDiagnosticsDamperSensorInconsistency` described below. Class description: Contains all the tests for Temperature Diagnostic Method signatures and docstrings: - def test_damper_sensor_inconsistency_creation(self): test the creation of damper sensor diagnostic class - def test_damp_senso...
24d50729aef8d91036cc13b0f5c03be76f3237ed
<|skeleton|> class TestDiagnosticsDamperSensorInconsistency: """Contains all the tests for Temperature Diagnostic""" def test_damper_sensor_inconsistency_creation(self): """test the creation of damper sensor diagnostic class""" <|body_0|> def test_damp_sensor_dx_set_values(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDiagnosticsDamperSensorInconsistency: """Contains all the tests for Temperature Diagnostic""" def test_damper_sensor_inconsistency_creation(self): """test the creation of damper sensor diagnostic class""" damp_sensor = DamperSensorInconsistency() if isinstance(damp_sensor, Dam...
the_stack_v2_python_sparse
EnergyEfficiency/EconomizerRCxAgent/economizer/test.py
shwethanidd/volttron-pnnl-applications-2
train
0
5e23c50159cb217655453245f7a577fa35986f91
[ "super().__init__()\nillegal_args = [(k, a) for k, a in locals().items() if isinstance(a, tuple) and len(a) != n_blocks]\nif illegal_args:\n raise ValueError(f'All the tuple-arg lengths need to be equal to `n_blocks`={n_blocks}. Illegal args: {illegal_args}')\nself.tr_blocks = nn.ModuleList()\nself.layer_scales ...
<|body_start_0|> super().__init__() illegal_args = [(k, a) for k, a in locals().items() if isinstance(a, tuple) and len(a) != n_blocks] if illegal_args: raise ValueError(f'All the tuple-arg lengths need to be equal to `n_blocks`={n_blocks}. Illegal args: {illegal_args}') self...
TransformerLayer
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerLayer: def __init__(self, query_dim: int, num_heads: int=8, head_dim: int=64, cross_attention_dim: int=None, activation: str='star_relu', n_blocks: int=2, block_types: Tuple[str, ...]=('exact', 'exact'), computation_types: Tuple[str, ...]=('basic', 'basic'), dropouts: Tuple[float, ......
stack_v2_sparse_classes_36k_train_007486
12,584
permissive
[ { "docstring": "Chain transformer blocks to compose a full generic transformer. NOTE: For 2D image like data: - Forward input shape: (B, H*W, head_dim*num_heads) - Forward output sahpe: (B, H*W, head_dim*num_heads) Parameters ---------- query_dim : int The length/dim of the query. Typically: num_heads*head_dim ...
2
null
Implement the Python class `TransformerLayer` described below. Class description: Implement the TransformerLayer class. Method signatures and docstrings: - def __init__(self, query_dim: int, num_heads: int=8, head_dim: int=64, cross_attention_dim: int=None, activation: str='star_relu', n_blocks: int=2, block_types: T...
Implement the Python class `TransformerLayer` described below. Class description: Implement the TransformerLayer class. Method signatures and docstrings: - def __init__(self, query_dim: int, num_heads: int=8, head_dim: int=64, cross_attention_dim: int=None, activation: str='star_relu', n_blocks: int=2, block_types: T...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class TransformerLayer: def __init__(self, query_dim: int, num_heads: int=8, head_dim: int=64, cross_attention_dim: int=None, activation: str='star_relu', n_blocks: int=2, block_types: Tuple[str, ...]=('exact', 'exact'), computation_types: Tuple[str, ...]=('basic', 'basic'), dropouts: Tuple[float, ......
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerLayer: def __init__(self, query_dim: int, num_heads: int=8, head_dim: int=64, cross_attention_dim: int=None, activation: str='star_relu', n_blocks: int=2, block_types: Tuple[str, ...]=('exact', 'exact'), computation_types: Tuple[str, ...]=('basic', 'basic'), dropouts: Tuple[float, ...]=(0.0, 0.0), ...
the_stack_v2_python_sparse
cellseg_models_pytorch/modules/transformers.py
okunator/cellseg_models.pytorch
train
43
1812b167fb3dd6787f6aae6da7552187a614b230
[ "def calc(tot):\n return (ListNode(tot - 10 * int(tot > 9)), int(tot > 9))\ncarry = 0\ncur = head = ListNode(0)\nwhile l1 and l2:\n cur.next, carry = calc(l1.val + l2.val + carry)\n l1, l2, cur = (l1.next, l2.next, cur.next)\nl3 = l1 if l1 else l2\nwhile l3:\n cur.next, carry = calc(l3.val + carry)\n ...
<|body_start_0|> def calc(tot): return (ListNode(tot - 10 * int(tot > 9)), int(tot > 9)) carry = 0 cur = head = ListNode(0) while l1 and l2: cur.next, carry = calc(l1.val + l2.val + carry) l1, l2, cur = (l1.next, l2.next, cur.next) l3 = l1 if l...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def addTwoNumbers2(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_007487
1,571
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "addTwoNumbers", "signature": "def addTwoNumbers(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "addTwoNumbers2", "signature": "def addTwoNumbers2(self, l1...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def addTwoNumbers2(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def addTwoNumbers2(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode...
057ed5c6fe19268f36a1d5051d27b07aae0b63e0
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def addTwoNumbers2(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" def calc(tot): return (ListNode(tot - 10 * int(tot > 9)), int(tot > 9)) carry = 0 cur = head = ListNode(0) while l1 and l2: cur.next, carry = ...
the_stack_v2_python_sparse
2020/2020-02/26/eugene.py
wavetogether/wave_algorithm_challenge
train
3
6239352d4d833ce0ff0a4a3f391ff3a3c102b669
[ "valid, message = json_validate(match, {'type': 'object', 'properties': {'cidr': {'$ref': '#/pScheduler/IPCIDRList'}, 'invert': {'$ref': '#/pScheduler/Boolean'}}, 'additionalProperties': False, 'required': ['cidr']})\nif not valid:\n raise ValueError('Invalid match: ' + message)\ntry:\n self.invert = match['i...
<|body_start_0|> valid, message = json_validate(match, {'type': 'object', 'properties': {'cidr': {'$ref': '#/pScheduler/IPCIDRList'}, 'invert': {'$ref': '#/pScheduler/Boolean'}}, 'additionalProperties': False, 'required': ['cidr']}) if not valid: raise ValueError('Invalid match: ' + message)...
Class that matches an IP Cidr list.
IPCIDRMatcher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPCIDRMatcher: """Class that matches an IP Cidr list.""" def __init__(self, match): """Construct a matcher. The 'cidr' argument is a dict that conforms to an IPCIDRList as described in the pScheduler JSON Style Guide and Type Dictionary.""" <|body_0|> def contains(self, ...
stack_v2_sparse_classes_36k_train_007488
2,110
permissive
[ { "docstring": "Construct a matcher. The 'cidr' argument is a dict that conforms to an IPCIDRList as described in the pScheduler JSON Style Guide and Type Dictionary.", "name": "__init__", "signature": "def __init__(self, match)" }, { "docstring": "Try to match a candidate ip_address and see whe...
2
null
Implement the Python class `IPCIDRMatcher` described below. Class description: Class that matches an IP Cidr list. Method signatures and docstrings: - def __init__(self, match): Construct a matcher. The 'cidr' argument is a dict that conforms to an IPCIDRList as described in the pScheduler JSON Style Guide and Type D...
Implement the Python class `IPCIDRMatcher` described below. Class description: Class that matches an IP Cidr list. Method signatures and docstrings: - def __init__(self, match): Construct a matcher. The 'cidr' argument is a dict that conforms to an IPCIDRList as described in the pScheduler JSON Style Guide and Type D...
f6d04c0455e5be4d490df16ec1acb377f9025d9f
<|skeleton|> class IPCIDRMatcher: """Class that matches an IP Cidr list.""" def __init__(self, match): """Construct a matcher. The 'cidr' argument is a dict that conforms to an IPCIDRList as described in the pScheduler JSON Style Guide and Type Dictionary.""" <|body_0|> def contains(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IPCIDRMatcher: """Class that matches an IP Cidr list.""" def __init__(self, match): """Construct a matcher. The 'cidr' argument is a dict that conforms to an IPCIDRList as described in the pScheduler JSON Style Guide and Type Dictionary.""" valid, message = json_validate(match, {'type': '...
the_stack_v2_python_sparse
python-pscheduler/pscheduler/pscheduler/ipcidrmatcher.py
perfsonar/pscheduler
train
53
a30ddde4bc52304e0648e48d36d20176e09e0ff7
[ "self._api_client = api_client\nself._project_config_manager = project_config_manager\nself._pull_manager = pull_manager\nself._push_manager = push_manager\nself._path_manager = path_manager", "local_path = Path.cwd() / input\nif self._path_manager.is_path_valid(local_path) and local_path.is_dir() and self._proje...
<|body_start_0|> self._api_client = api_client self._project_config_manager = project_config_manager self._pull_manager = pull_manager self._push_manager = push_manager self._path_manager = path_manager <|end_body_0|> <|body_start_1|> local_path = Path.cwd() / input ...
The CloudProjectManager class is responsible for finding the correct cloud project in cloud commands.
CloudProjectManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CloudProjectManager: """The CloudProjectManager class is responsible for finding the correct cloud project in cloud commands.""" def __init__(self, api_client: APIClient, project_config_manager: ProjectConfigManager, pull_manager: PullManager, push_manager: PushManager, path_manager: PathMan...
stack_v2_sparse_classes_36k_train_007489
4,789
permissive
[ { "docstring": "Creates a new PullManager instance. :param api_client: the APIClient instance to use when communicating with the cloud :param project_config_manager: the ProjectConfigManager instance to use :param pull_manager: the PullManager instance to use :param push_manager: the PushManager instance to use...
2
null
Implement the Python class `CloudProjectManager` described below. Class description: The CloudProjectManager class is responsible for finding the correct cloud project in cloud commands. Method signatures and docstrings: - def __init__(self, api_client: APIClient, project_config_manager: ProjectConfigManager, pull_ma...
Implement the Python class `CloudProjectManager` described below. Class description: The CloudProjectManager class is responsible for finding the correct cloud project in cloud commands. Method signatures and docstrings: - def __init__(self, api_client: APIClient, project_config_manager: ProjectConfigManager, pull_ma...
c1051bd3e8851ae96f6e84f608a7116b1689c9e9
<|skeleton|> class CloudProjectManager: """The CloudProjectManager class is responsible for finding the correct cloud project in cloud commands.""" def __init__(self, api_client: APIClient, project_config_manager: ProjectConfigManager, pull_manager: PullManager, push_manager: PushManager, path_manager: PathMan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CloudProjectManager: """The CloudProjectManager class is responsible for finding the correct cloud project in cloud commands.""" def __init__(self, api_client: APIClient, project_config_manager: ProjectConfigManager, pull_manager: PullManager, push_manager: PushManager, path_manager: PathManager) -> None...
the_stack_v2_python_sparse
lean/components/cloud/cloud_project_manager.py
xdpknx/lean-cli
train
0
14b5eb05284b2a8c712e5a13cba92e9200c05f6e
[ "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...
PeeringGroupNodes provides the building blocks necessary to obtain attach a node to a peering group.
PeeringGroupNodesServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PeeringGroupNodesServicer: """PeeringGroupNodes provides the building blocks necessary to obtain attach a node to a peering group.""" def Create(self, request, context): """Create attaches a Node to a PeeringGroup""" <|body_0|> def Delete(self, request, context): ...
stack_v2_sparse_classes_36k_train_007490
8,255
permissive
[ { "docstring": "Create attaches a Node to a PeeringGroup", "name": "Create", "signature": "def Create(self, request, context)" }, { "docstring": "Delete detaches a Node to a PeeringGroup.", "name": "Delete", "signature": "def Delete(self, request, context)" }, { "docstring": "Get...
4
null
Implement the Python class `PeeringGroupNodesServicer` described below. Class description: PeeringGroupNodes provides the building blocks necessary to obtain attach a node to a peering group. Method signatures and docstrings: - def Create(self, request, context): Create attaches a Node to a PeeringGroup - def Delete(...
Implement the Python class `PeeringGroupNodesServicer` described below. Class description: PeeringGroupNodes provides the building blocks necessary to obtain attach a node to a peering group. Method signatures and docstrings: - def Create(self, request, context): Create attaches a Node to a PeeringGroup - def Delete(...
1f3a53ef8c404e64d9324f9fd13f5c39c71eaca5
<|skeleton|> class PeeringGroupNodesServicer: """PeeringGroupNodes provides the building blocks necessary to obtain attach a node to a peering group.""" def Create(self, request, context): """Create attaches a Node to a PeeringGroup""" <|body_0|> def Delete(self, request, context): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PeeringGroupNodesServicer: """PeeringGroupNodes provides the building blocks necessary to obtain attach a node to a peering group.""" def Create(self, request, context): """Create attaches a Node to a PeeringGroup""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_deta...
the_stack_v2_python_sparse
strongdm/peering_group_nodes_pb2_grpc.py
strongdm/strongdm-sdk-python
train
9
7bc9d45c276ecfda64a18e3225ec7446f55ae7c6
[ "labels = label_schema.get_labels(include_empty=False)\nself.normal_label = [label for label in labels if not label.is_anomalous][0]\nself.anomalous_label = [label for label in labels if label.is_anomalous][0]\nself.label_map = {0: self.normal_label, 1: self.anomalous_label}", "pred_mask = predictions >= 0.5\nmas...
<|body_start_0|> labels = label_schema.get_labels(include_empty=False) self.normal_label = [label for label in labels if not label.is_anomalous][0] self.anomalous_label = [label for label in labels if label.is_anomalous][0] self.label_map = {0: self.normal_label, 1: self.anomalous_label}...
Converts Anomaly Detection Predictions ModelAPI to Annotations. Args: labels (LabelSchemaEntity): Label Schema containing the label info of the task
AnomalyDetectionToAnnotationConverter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnomalyDetectionToAnnotationConverter: """Converts Anomaly Detection Predictions ModelAPI to Annotations. Args: labels (LabelSchemaEntity): Label Schema containing the label info of the task""" def __init__(self, label_schema: LabelSchemaEntity): """Initialize AnomalyDetectionToAnnot...
stack_v2_sparse_classes_36k_train_007491
25,105
permissive
[ { "docstring": "Initialize AnomalyDetectionToAnnotationConverter. Args: label_schema (LabelSchemaEntity): Label Schema containing the label info of the task", "name": "__init__", "signature": "def __init__(self, label_schema: LabelSchemaEntity)" }, { "docstring": "Convert predictions to OTX Anno...
2
null
Implement the Python class `AnomalyDetectionToAnnotationConverter` described below. Class description: Converts Anomaly Detection Predictions ModelAPI to Annotations. Args: labels (LabelSchemaEntity): Label Schema containing the label info of the task Method signatures and docstrings: - def __init__(self, label_schem...
Implement the Python class `AnomalyDetectionToAnnotationConverter` described below. Class description: Converts Anomaly Detection Predictions ModelAPI to Annotations. Args: labels (LabelSchemaEntity): Label Schema containing the label info of the task Method signatures and docstrings: - def __init__(self, label_schem...
80454808b38727e358e8b880043eeac0f18152fb
<|skeleton|> class AnomalyDetectionToAnnotationConverter: """Converts Anomaly Detection Predictions ModelAPI to Annotations. Args: labels (LabelSchemaEntity): Label Schema containing the label info of the task""" def __init__(self, label_schema: LabelSchemaEntity): """Initialize AnomalyDetectionToAnnot...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AnomalyDetectionToAnnotationConverter: """Converts Anomaly Detection Predictions ModelAPI to Annotations. Args: labels (LabelSchemaEntity): Label Schema containing the label info of the task""" def __init__(self, label_schema: LabelSchemaEntity): """Initialize AnomalyDetectionToAnnotationConverte...
the_stack_v2_python_sparse
src/otx/api/usecases/exportable_code/prediction_to_annotation_converter.py
openvinotoolkit/training_extensions
train
397
bf80e2d7b4a4bfcd0989639680bfa662157c1dfc
[ "n = len(nums)\nif n * k == 0:\n return []\nif k == 1:\n return nums\nleft, right = ([0] * n, [0] * n)\nleft[0], right[n - 1] = (nums[0], nums[n - 1])\nfor i in range(1, n):\n if i % k == 0:\n left[i] = nums[i]\n else:\n left[i] = max(left[i - 1], nums[i])\n j = n - i - 1\n if (j + 1...
<|body_start_0|> n = len(nums) if n * k == 0: return [] if k == 1: return nums left, right = ([0] * n, [0] * n) left[0], right[n - 1] = (nums[0], nums[n - 1]) for i in range(1, n): if i % k == 0: left[i] = nums[i] ...
SlidingWindow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SlidingWindow: def get_max_from_window(self, nums: List[int], k: int) -> List[int]: """Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:""" <|body_0|> def get_max_from_window_(self, nums: List[int], k: int) -> List[int]: """App...
stack_v2_sparse_classes_36k_train_007492
2,691
no_license
[ { "docstring": "Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:", "name": "get_max_from_window", "signature": "def get_max_from_window(self, nums: List[int], k: int) -> List[int]" }, { "docstring": "Approach: Using DS Deque. Time Complexity: O(N) Space C...
2
null
Implement the Python class `SlidingWindow` described below. Class description: Implement the SlidingWindow class. Method signatures and docstrings: - def get_max_from_window(self, nums: List[int], k: int) -> List[int]: Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return: - def get...
Implement the Python class `SlidingWindow` described below. Class description: Implement the SlidingWindow class. Method signatures and docstrings: - def get_max_from_window(self, nums: List[int], k: int) -> List[int]: Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return: - def get...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class SlidingWindow: def get_max_from_window(self, nums: List[int], k: int) -> List[int]: """Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:""" <|body_0|> def get_max_from_window_(self, nums: List[int], k: int) -> List[int]: """App...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SlidingWindow: def get_max_from_window(self, nums: List[int], k: int) -> List[int]: """Approach: DP Time Complexity: O(N) Space Complexity: O(N) :param nums: :param k: :return:""" n = len(nums) if n * k == 0: return [] if k == 1: return nums left...
the_stack_v2_python_sparse
data_structures/recurrsion_dp/sliding_window.py
Shiv2157k/leet_code
train
1
459d646fb7bfeba62dc4fd7efddf021c876a31d6
[ "if len(s) <= 1:\n return s\ns = '|'.join(s)\nresult = ''\nsLen = len(s)\ni = 0\nwhile i < sLen:\n k = 1\n while i - k >= 0 and i + k < sLen and (s[i - k] == s[i + k]):\n if '|' != s[i - k]:\n temp = s[i - k:i + k + 1]\n if len(temp) > len(result):\n result = tem...
<|body_start_0|> if len(s) <= 1: return s s = '|'.join(s) result = '' sLen = len(s) i = 0 while i < sLen: k = 1 while i - k >= 0 and i + k < sLen and (s[i - k] == s[i + k]): if '|' != s[i - k]: temp =...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome1(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(s) <= 1: return s s = '|'.joi...
stack_v2_sparse_classes_36k_train_007493
3,074
permissive
[ { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "longestPalindrome1", "signature": "def longestPalindrome1(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_001651
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome1(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome(self, s): :type s: str :rtype: str - def longestPalindrome1(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def longestPalindrome(self...
3e2484d19e6845f0f93e78f7b447909bba3efadd
<|skeleton|> class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def longestPalindrome1(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome(self, s): """:type s: str :rtype: str""" if len(s) <= 1: return s s = '|'.join(s) result = '' sLen = len(s) i = 0 while i < sLen: k = 1 while i - k >= 0 and i + k < sLen and (s[i - k] ==...
the_stack_v2_python_sparse
explore_medium/array_and_string/LongestPalindrome.py
niefy/LeetCodeExam
train
0
555e4586db963ddad37b0f87e242791794d8ecf9
[ "self.encode_res = ''\nfor i in strs:\n self.encode_res += str(len(i)) + ','\n self.encode_res += i + ','\nreturn self.encode_res[:-1]", "self.decode_res = []\ni = 0\nwhile i < len(s):\n len_word = ''\n while s[i] != ',':\n len_word += s[i]\n i += 1\n start = i + 1\n end = start + ...
<|body_start_0|> self.encode_res = '' for i in strs: self.encode_res += str(len(i)) + ',' self.encode_res += i + ',' return self.encode_res[:-1] <|end_body_0|> <|body_start_1|> self.decode_res = [] i = 0 while i < len(s): len_word = ''...
Codec
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.enco...
stack_v2_sparse_classes_36k_train_007494
2,072
permissive
[ { "docstring": "Encodes a list of strings to a single string.", "name": "encode", "signature": "def encode(self, strs: [str]) -> str" }, { "docstring": "Decodes a single string to a list of strings.", "name": "decode", "signature": "def decode(self, s: str) -> [str]" } ]
2
stack_v2_sparse_classes_30k_train_020927
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: [str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> [str]: Decodes a single string to a list of strings. <|skeleton|> cla...
1dbd18114ed688ddeaa3ee83181d373dcc1429e5
<|skeleton|> class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> [str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs: [str]) -> str: """Encodes a list of strings to a single string.""" self.encode_res = '' for i in strs: self.encode_res += str(len(i)) + ',' self.encode_res += i + ',' return self.encode_res[:-1] def decode(self, s: str)...
the_stack_v2_python_sparse
source/Clarification/Array/271.字符串的编码与解码.py
zhangwang0537/LeetCode-Notebook
train
0
ed41bfc5515008d62eee2b4e11ec55f39c8710c4
[ "query = request.GET.get('q')\nsort = request.GET.get('sort', 'name')\nasearch = Client.objects.filter(id=kwargs['id']).first()\nform = ClientForm(instance=asearch)\nlist_client = None\nif query:\n list_client = Client.objects.filter(Q(name__icontains=query) | Q(phone__icontains=query) | Q(email__icontains=query...
<|body_start_0|> query = request.GET.get('q') sort = request.GET.get('sort', 'name') asearch = Client.objects.filter(id=kwargs['id']).first() form = ClientForm(instance=asearch) list_client = None if query: list_client = Client.objects.filter(Q(name__icontains...
Clase para editar los clientes
ClientEditView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientEditView: """Clase para editar los clientes""" def get(self, request, *args, **kwargs): """Método get""" <|body_0|> def post(self, request, *args, **kwargs): """Método post""" <|body_1|> <|end_skeleton|> <|body_start_0|> query = request.GE...
stack_v2_sparse_classes_36k_train_007495
22,221
no_license
[ { "docstring": "Método get", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Método post", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_017869
Implement the Python class `ClientEditView` described below. Class description: Clase para editar los clientes Method signatures and docstrings: - def get(self, request, *args, **kwargs): Método get - def post(self, request, *args, **kwargs): Método post
Implement the Python class `ClientEditView` described below. Class description: Clase para editar los clientes Method signatures and docstrings: - def get(self, request, *args, **kwargs): Método get - def post(self, request, *args, **kwargs): Método post <|skeleton|> class ClientEditView: """Clase para editar lo...
e28e2d968372609ad396c42fb572a00c2410a117
<|skeleton|> class ClientEditView: """Clase para editar los clientes""" def get(self, request, *args, **kwargs): """Método get""" <|body_0|> def post(self, request, *args, **kwargs): """Método post""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientEditView: """Clase para editar los clientes""" def get(self, request, *args, **kwargs): """Método get""" query = request.GET.get('q') sort = request.GET.get('sort', 'name') asearch = Client.objects.filter(id=kwargs['id']).first() form = ClientForm(instance=as...
the_stack_v2_python_sparse
list/views.py
damaos/server_list2
train
0
ec9ff8438f3905aa100838b39b2b66d992fea398
[ "l_dict = {}\nl_xml = XmlConfigTools.find_xml_section(p_pyhouse_obj, 'ComputerDivision/InternetSection')\nif l_xml == None:\n return l_dict\nl_count = 0\nfor l_internet in l_xml.iterfind('Internet'):\n l_obj = Util._read_one_internet(l_internet)\n l_dict[l_count] = l_obj\n l_count += 1\nLOG.info('Loaded...
<|body_start_0|> l_dict = {} l_xml = XmlConfigTools.find_xml_section(p_pyhouse_obj, 'ComputerDivision/InternetSection') if l_xml == None: return l_dict l_count = 0 for l_internet in l_xml.iterfind('Internet'): l_obj = Util._read_one_internet(l_internet) ...
API
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class API: def read_internet_xml(self, p_pyhouse_obj): """Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element""" <|body_0|> def write_internet_xml(self, p_pyhouse_obj): """Create a sub tree for ...
stack_v2_sparse_classes_36k_train_007496
5,118
no_license
[ { "docstring": "Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element", "name": "read_internet_xml", "signature": "def read_internet_xml(self, p_pyhouse_obj)" }, { "docstring": "Create a sub tree for 'Internet' - the su...
2
stack_v2_sparse_classes_30k_train_006947
Implement the Python class `API` described below. Class description: Implement the API class. Method signatures and docstrings: - def read_internet_xml(self, p_pyhouse_obj): Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element - def write_i...
Implement the Python class `API` described below. Class description: Implement the API class. Method signatures and docstrings: - def read_internet_xml(self, p_pyhouse_obj): Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element - def write_i...
8ccbbd1494b7b33ff5099d321cda634fbb254ceb
<|skeleton|> class API: def read_internet_xml(self, p_pyhouse_obj): """Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element""" <|body_0|> def write_internet_xml(self, p_pyhouse_obj): """Create a sub tree for ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class API: def read_internet_xml(self, p_pyhouse_obj): """Reads zero or more <Internet> entries within the <InternetSection> @param p_internet_section_xml: is the <InternetSection> element""" l_dict = {} l_xml = XmlConfigTools.find_xml_section(p_pyhouse_obj, 'ComputerDivision/InternetSection...
the_stack_v2_python_sparse
Project/src/Modules/Computer/Internet/internet_xml.py
bopopescu/PyHouse
train
0
adf550095a803aa4301cfad39fd497dd3c2291f7
[ "dp = [0] * (amount + 1)\ndp[0] = 1\nfor i in coins:\n for j in range(1, amount + 1):\n if j >= i:\n dp[j] += dp[j - i]\nreturn dp[amount]", "dp = [0] * (amount + 1)\ndp[0] = 1\nfor c in coins:\n for idx in range(1, len(dp)):\n if idx >= c:\n dp[idx] += dp[idx - c]\nretur...
<|body_start_0|> dp = [0] * (amount + 1) dp[0] = 1 for i in coins: for j in range(1, amount + 1): if j >= i: dp[j] += dp[j - i] return dp[amount] <|end_body_0|> <|body_start_1|> dp = [0] * (amount + 1) dp[0] = 1 for...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_0|> def rewrite(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_007497
1,745
no_license
[ { "docstring": ":type amount: int :type coins: List[int] :rtype: int", "name": "change", "signature": "def change(self, amount, coins)" }, { "docstring": ":type amount: int :type coins: List[int] :rtype: int", "name": "rewrite", "signature": "def rewrite(self, amount, coins)" } ]
2
stack_v2_sparse_classes_30k_train_011464
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int - def rewrite(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int - def rewrite(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int <|...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_0|> def rewrite(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" dp = [0] * (amount + 1) dp[0] = 1 for i in coins: for j in range(1, amount + 1): if j >= i: dp[j] += dp[j - i] return dp...
the_stack_v2_python_sparse
dp/518_Coin_Change_2.py
vsdrun/lc_public
train
6
62d991f5db107f8844723fe018d8ab00245b4320
[ "assert d_min > 0\nassert width > 0\nunit_cell = space_group.average_unit_cell(unit_cell)\nself.half_width = width / 2.0\nd_min = uctbx.d_star_sq_as_d(uctbx.d_as_d_star_sq(d_min) + self.half_width)\ngenerator = index_generator(unit_cell, space_group.type(), False, d_min)\nindices = generator.to_array()\nself.d_star...
<|body_start_0|> assert d_min > 0 assert width > 0 unit_cell = space_group.average_unit_cell(unit_cell) self.half_width = width / 2.0 d_min = uctbx.d_star_sq_as_d(uctbx.d_as_d_star_sq(d_min) + self.half_width) generator = index_generator(unit_cell, space_group.type(), Fal...
A class to do powder ring filtering.
PowderRingFilter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PowderRingFilter: """A class to do powder ring filtering.""" def __init__(self, unit_cell, space_group, d_min, width): """Initialise the filter. :param unit_cell: The unit_cell of the powder rings :param space_group: The space group of the powder rings :param d_min: The maximum resol...
stack_v2_sparse_classes_36k_train_007498
3,314
permissive
[ { "docstring": "Initialise the filter. :param unit_cell: The unit_cell of the powder rings :param space_group: The space group of the powder rings :param d_min: The maximum resolution to filter to :param width: The resolution width to filter around", "name": "__init__", "signature": "def __init__(self, ...
2
stack_v2_sparse_classes_30k_train_001177
Implement the Python class `PowderRingFilter` described below. Class description: A class to do powder ring filtering. Method signatures and docstrings: - def __init__(self, unit_cell, space_group, d_min, width): Initialise the filter. :param unit_cell: The unit_cell of the powder rings :param space_group: The space ...
Implement the Python class `PowderRingFilter` described below. Class description: A class to do powder ring filtering. Method signatures and docstrings: - def __init__(self, unit_cell, space_group, d_min, width): Initialise the filter. :param unit_cell: The unit_cell of the powder rings :param space_group: The space ...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class PowderRingFilter: """A class to do powder ring filtering.""" def __init__(self, unit_cell, space_group, d_min, width): """Initialise the filter. :param unit_cell: The unit_cell of the powder rings :param space_group: The space group of the powder rings :param d_min: The maximum resol...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PowderRingFilter: """A class to do powder ring filtering.""" def __init__(self, unit_cell, space_group, d_min, width): """Initialise the filter. :param unit_cell: The unit_cell of the powder rings :param space_group: The space group of the powder rings :param d_min: The maximum resolution to filt...
the_stack_v2_python_sparse
src/dials/algorithms/integration/filtering.py
dials/dials
train
71
c70b3673702e3e924b26a38ce592eaaf8975b875
[ "self.eps = eps\nself.alpha = alpha.cuda() if cuda == True else alpha.cpu()\nself.gradSteps = gradSteps\nself.noRestarts = noRestarts\nself.cuda = cuda", "if self.eps == 0:\n x = x_nat\n ell = loss(x, y)\nelif self.gradSteps == 0 or self.alpha == 0:\n jacobian, ell = utils.get_jacobian(network, x_nat, y,...
<|body_start_0|> self.eps = eps self.alpha = alpha.cuda() if cuda == True else alpha.cpu() self.gradSteps = gradSteps self.noRestarts = noRestarts self.cuda = cuda <|end_body_0|> <|body_start_1|> if self.eps == 0: x = x_nat ell = loss(x, y) ...
Class that will be in charge of generating batches of adversarial images
Adversary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Adversary: """Class that will be in charge of generating batches of adversarial images""" def __init__(self, eps=0.3, alpha=0.01, gradSteps=100, noRestarts=0, cuda=False): """Constructor for a first order adversary :param eps: radius of l infinity ball :param alpha: learning rate :pa...
stack_v2_sparse_classes_36k_train_007499
3,343
no_license
[ { "docstring": "Constructor for a first order adversary :param eps: radius of l infinity ball :param alpha: learning rate :param gradSteps: number of gradient steps :param noRestarts: number of restarts", "name": "__init__", "signature": "def __init__(self, eps=0.3, alpha=0.01, gradSteps=100, noRestarts...
3
stack_v2_sparse_classes_30k_train_000040
Implement the Python class `Adversary` described below. Class description: Class that will be in charge of generating batches of adversarial images Method signatures and docstrings: - def __init__(self, eps=0.3, alpha=0.01, gradSteps=100, noRestarts=0, cuda=False): Constructor for a first order adversary :param eps: ...
Implement the Python class `Adversary` described below. Class description: Class that will be in charge of generating batches of adversarial images Method signatures and docstrings: - def __init__(self, eps=0.3, alpha=0.01, gradSteps=100, noRestarts=0, cuda=False): Constructor for a first order adversary :param eps: ...
76fd5104b5d15eb83cc54eaf43d0d8d4ca56206e
<|skeleton|> class Adversary: """Class that will be in charge of generating batches of adversarial images""" def __init__(self, eps=0.3, alpha=0.01, gradSteps=100, noRestarts=0, cuda=False): """Constructor for a first order adversary :param eps: radius of l infinity ball :param alpha: learning rate :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Adversary: """Class that will be in charge of generating batches of adversarial images""" def __init__(self, eps=0.3, alpha=0.01, gradSteps=100, noRestarts=0, cuda=False): """Constructor for a first order adversary :param eps: radius of l infinity ball :param alpha: learning rate :param gradSteps...
the_stack_v2_python_sparse
actual_regularization/adversaries.py
iclr2020powerlaw/power_law_nn
train
0