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
d1cf2693d6534155191cf92b85d6544d2c307cd2
[ "data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]])\nself.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea', realizations=np.array([1, 2]))\nself.plugin = DifferenceBetweenAdjacentGridSquares()", "expected_x = np.array([[1, 1], [2, 2], [5, 5]])\nexpected_y = np.array([[1, 2, 3], [3, 6, 9]])\n...
<|body_start_0|> data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]]) self.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea', realizations=np.array([1, 2])) self.plugin = DifferenceBetweenAdjacentGridSquares() <|end_body_0|> <|body_start_1|> expected_x = np.array([[1,...
Test the process method.
Test_process
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_process: """Test the process method.""" def setUp(self): """Set up cube.""" <|body_0|> def test_basic(self): """Test that differences are calculated along both the x and y dimensions and returned as separate cubes.""" <|body_1|> def test_metadat...
stack_v2_sparse_classes_36k_train_016700
8,701
permissive
[ { "docstring": "Set up cube.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that differences are calculated along both the x and y dimensions and returned as separate cubes.", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "...
4
null
Implement the Python class `Test_process` described below. Class description: Test the process method. Method signatures and docstrings: - def setUp(self): Set up cube. - def test_basic(self): Test that differences are calculated along both the x and y dimensions and returned as separate cubes. - def test_metadata(se...
Implement the Python class `Test_process` described below. Class description: Test the process method. Method signatures and docstrings: - def setUp(self): Set up cube. - def test_basic(self): Test that differences are calculated along both the x and y dimensions and returned as separate cubes. - def test_metadata(se...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_process: """Test the process method.""" def setUp(self): """Set up cube.""" <|body_0|> def test_basic(self): """Test that differences are calculated along both the x and y dimensions and returned as separate cubes.""" <|body_1|> def test_metadat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test_process: """Test the process method.""" def setUp(self): """Set up cube.""" data = np.array([[1, 2, 3], [2, 4, 6], [5, 10, 15]]) self.cube = set_up_variable_cube(data, 'wind_speed', 'm s-1', 'equalarea', realizations=np.array([1, 2])) self.plugin = DifferenceBetweenAd...
the_stack_v2_python_sparse
improver_tests/utilities/test_DifferenceBetweenAdjacentGridSquares.py
metoppv/improver
train
101
c99bf13de4fbee66cb3a560cb3943d311b88bb78
[ "if k < 0:\n return 0\ndset = set()\ncnt = set()\nfor i in range(len(nums)):\n pexpect = nums[i] + k\n mexpect = nums[i] - k\n if pexpect in dset:\n cnt.add(tuple(sorted([nums[i]] + [pexpect])))\n if mexpect in dset:\n cnt.add(tuple(sorted([nums[i]] + [mexpect])))\n dset.add(nums[i])...
<|body_start_0|> if k < 0: return 0 dset = set() cnt = set() for i in range(len(nums)): pexpect = nums[i] + k mexpect = nums[i] - k if pexpect in dset: cnt.add(tuple(sorted([nums[i]] + [pexpect]))) if mexpect in ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findPairs(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def rewrite(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if k < 0: ...
stack_v2_sparse_classes_36k_train_016701
2,455
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "findPairs", "signature": "def findPairs(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "rewrite", "signature": "def rewrite(self, nums, k)" } ]
2
stack_v2_sparse_classes_30k_train_006375
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPairs(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def rewrite(self, nums, k): :type nums: List[int] :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findPairs(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def rewrite(self, nums, k): :type nums: List[int] :type k: int :rtype: int <|skeleton|> class Solu...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def findPairs(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def rewrite(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findPairs(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" if k < 0: return 0 dset = set() cnt = set() for i in range(len(nums)): pexpect = nums[i] + k mexpect = nums[i] - k if pexpect in ...
the_stack_v2_python_sparse
array/532_K-diff_Pairs_in_an_Array.py
vsdrun/lc_public
train
6
c8aacb0c4b8a4c310aaa6fcda5da9e7decf478db
[ "cg = ['0.5', '0.4', '0.3', '0.2']\nn = ['0', '0.1', '0', '0']\nself.assertEqual(sqlref.cg_n_cont('cg_test.tab'), (cg, n))", "cg = ['0.5', '0.4', '0.3', '0.2']\nn = ['0', '0.1', '0', '0']\ntot = [('A', '0', 'ATGAATTGCCTGATAAAAAGGATTACCTTGATAGGGTAAATCATGCAGTT', '0.5', '0'), ('A', '1', 'TTCTGCATTCATTGACTGATTTATATAT...
<|body_start_0|> cg = ['0.5', '0.4', '0.3', '0.2'] n = ['0', '0.1', '0', '0'] self.assertEqual(sqlref.cg_n_cont('cg_test.tab'), (cg, n)) <|end_body_0|> <|body_start_1|> cg = ['0.5', '0.4', '0.3', '0.2'] n = ['0', '0.1', '0', '0'] tot = [('A', '0', 'ATGAATTGCCTGATAAAAAGGA...
Tests for sqlref.py
SqlRefTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SqlRefTestCase: """Tests for sqlref.py""" def test_cg_n_cont(self): """Does the list of cg and n percentages match up?""" <|body_0|> def test_mk_data(self): """Is the list of tuples correct?""" <|body_1|> <|end_skeleton|> <|body_start_0|> cg = [...
stack_v2_sparse_classes_36k_train_016702
1,720
no_license
[ { "docstring": "Does the list of cg and n percentages match up?", "name": "test_cg_n_cont", "signature": "def test_cg_n_cont(self)" }, { "docstring": "Is the list of tuples correct?", "name": "test_mk_data", "signature": "def test_mk_data(self)" } ]
2
stack_v2_sparse_classes_30k_train_007280
Implement the Python class `SqlRefTestCase` described below. Class description: Tests for sqlref.py Method signatures and docstrings: - def test_cg_n_cont(self): Does the list of cg and n percentages match up? - def test_mk_data(self): Is the list of tuples correct?
Implement the Python class `SqlRefTestCase` described below. Class description: Tests for sqlref.py Method signatures and docstrings: - def test_cg_n_cont(self): Does the list of cg and n percentages match up? - def test_mk_data(self): Is the list of tuples correct? <|skeleton|> class SqlRefTestCase: """Tests fo...
dd1bebde30364fb46761631d63245f74edfb479a
<|skeleton|> class SqlRefTestCase: """Tests for sqlref.py""" def test_cg_n_cont(self): """Does the list of cg and n percentages match up?""" <|body_0|> def test_mk_data(self): """Is the list of tuples correct?""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SqlRefTestCase: """Tests for sqlref.py""" def test_cg_n_cont(self): """Does the list of cg and n percentages match up?""" cg = ['0.5', '0.4', '0.3', '0.2'] n = ['0', '0.1', '0', '0'] self.assertEqual(sqlref.cg_n_cont('cg_test.tab'), (cg, n)) def test_mk_data(self): ...
the_stack_v2_python_sparse
Python/DrosDel/test_sqlref.py
jess28/Old_project_code
train
0
a57637e13030d2d006ca9a225a2765a675b9785e
[ "super().__init__()\nembed_dim = state_dim\ninputs = tf.keras.Input(shape=[None, state_dim])\noutputs = tf.keras.layers.LSTM(embed_dim)(inputs)\nif action_dim is None:\n inputs = tf.keras.Input(shape=(embed_dim,))\nelse:\n inputs = tf.keras.Input(shape=(embed_dim + action_dim,))\nif cross_norm:\n layers = ...
<|body_start_0|> super().__init__() embed_dim = state_dim inputs = tf.keras.Input(shape=[None, state_dim]) outputs = tf.keras.layers.LSTM(embed_dim)(inputs) if action_dim is None: inputs = tf.keras.Input(shape=(embed_dim,)) else: inputs = tf.keras....
A critic network.
CriticNet
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CriticNet: """A critic network.""" def __init__(self, state_dim, action_dim=None, hidden_dims=(256, 256), cross_norm=False): """Creates a neural net. Args: state_dim: State size. action_dim: Action size. hidden_dims: List of hidden dimensions. cross_norm: Whether to use cross norm.""...
stack_v2_sparse_classes_36k_train_016703
10,984
permissive
[ { "docstring": "Creates a neural net. Args: state_dim: State size. action_dim: Action size. hidden_dims: List of hidden dimensions. cross_norm: Whether to use cross norm.", "name": "__init__", "signature": "def __init__(self, state_dim, action_dim=None, hidden_dims=(256, 256), cross_norm=False)" }, ...
2
null
Implement the Python class `CriticNet` described below. Class description: A critic network. Method signatures and docstrings: - def __init__(self, state_dim, action_dim=None, hidden_dims=(256, 256), cross_norm=False): Creates a neural net. Args: state_dim: State size. action_dim: Action size. hidden_dims: List of hi...
Implement the Python class `CriticNet` described below. Class description: A critic network. Method signatures and docstrings: - def __init__(self, state_dim, action_dim=None, hidden_dims=(256, 256), cross_norm=False): Creates a neural net. Args: state_dim: State size. action_dim: Action size. hidden_dims: List of hi...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class CriticNet: """A critic network.""" def __init__(self, state_dim, action_dim=None, hidden_dims=(256, 256), cross_norm=False): """Creates a neural net. Args: state_dim: State size. action_dim: Action size. hidden_dims: List of hidden dimensions. cross_norm: Whether to use cross norm.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CriticNet: """A critic network.""" def __init__(self, state_dim, action_dim=None, hidden_dims=(256, 256), cross_norm=False): """Creates a neural net. Args: state_dim: State size. action_dim: Action size. hidden_dims: List of hidden dimensions. cross_norm: Whether to use cross norm.""" sup...
the_stack_v2_python_sparse
rl_repr/batch_rl/critic.py
Jimmy-INL/google-research
train
1
4921ae59e580edd7b5c2c208725a2c0e3f924110
[ "log.info('Getting list of simulations.')\ntry:\n self.sim_list = get_simulations(uut)\n log.info('Successfully got the list of simulations: {}'.format(self.sim_list))\nexcept Exception as e:\n raise Exception('Unable to get list of simulations.')", "log.info('stopping simulation {}'.format(simulation_na...
<|body_start_0|> log.info('Getting list of simulations.') try: self.sim_list = get_simulations(uut) log.info('Successfully got the list of simulations: {}'.format(self.sim_list)) except Exception as e: raise Exception('Unable to get list of simulations.') <|en...
Trigger class to start/stop simulation
TriggerStopStartSimulation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriggerStopStartSimulation: """Trigger class to start/stop simulation""" def get_simulations(self, uut): """Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results""" <|body_0|> def stop_simulation(self, uut, simulation_name): """Stop...
stack_v2_sparse_classes_36k_train_016704
4,753
permissive
[ { "docstring": "Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results", "name": "get_simulations", "signature": "def get_simulations(self, uut)" }, { "docstring": "Stop simulations Args: uut (`obj`): Device object simulation_name (`str`): simulation name Returns: N...
3
null
Implement the Python class `TriggerStopStartSimulation` described below. Class description: Trigger class to start/stop simulation Method signatures and docstrings: - def get_simulations(self, uut): Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results - def stop_simulation(self, uut, s...
Implement the Python class `TriggerStopStartSimulation` described below. Class description: Trigger class to start/stop simulation Method signatures and docstrings: - def get_simulations(self, uut): Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results - def stop_simulation(self, uut, s...
e42e51475cddcb10f5c7814d0fe892ac865742ba
<|skeleton|> class TriggerStopStartSimulation: """Trigger class to start/stop simulation""" def get_simulations(self, uut): """Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results""" <|body_0|> def stop_simulation(self, uut, simulation_name): """Stop...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TriggerStopStartSimulation: """Trigger class to start/stop simulation""" def get_simulations(self, uut): """Get simulations Args: uut (`obj`): Device object Returns: None Raises: pyATS Results""" log.info('Getting list of simulations.') try: self.sim_list = get_simulat...
the_stack_v2_python_sparse
pkgs/sdk-pkg/src/genie/libs/sdk/triggers/virl/virl.py
CiscoTestAutomation/genielibs
train
109
6dc1a76ce56c9ad9ea66f81adb73aae50fab70c5
[ "activation = Sigmoid()\noutput = Softmax()\nself.mulu = np.matmul(x, u)\nself.mulw = np.matmul(prev_s, w)\nself.sin = np.add(self.mulu, self.mulw)\nself.sout = activation.forward(self.sin)\nself.oin = np.matmul(self.sout, v)\nself.oout = output.forward(self.oin)", "activation = Sigmoid()\noutput = Softmax()\nsel...
<|body_start_0|> activation = Sigmoid() output = Softmax() self.mulu = np.matmul(x, u) self.mulw = np.matmul(prev_s, w) self.sin = np.add(self.mulu, self.mulw) self.sout = activation.forward(self.sin) self.oin = np.matmul(self.sout, v) self.oout = output.f...
Layer
[ "CC0-1.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Layer: def forward(self, x, prev_s, u, w, v): """x : input array prev_s : array u,v,w : weight matrices""" <|body_0|> def backward(self, x, prev_s, y, u, w, v): """y : integer""" <|body_1|> <|end_skeleton|> <|body_start_0|> activation = Sigmoid() ...
stack_v2_sparse_classes_36k_train_016705
7,270
permissive
[ { "docstring": "x : input array prev_s : array u,v,w : weight matrices", "name": "forward", "signature": "def forward(self, x, prev_s, u, w, v)" }, { "docstring": "y : integer", "name": "backward", "signature": "def backward(self, x, prev_s, y, u, w, v)" } ]
2
null
Implement the Python class `Layer` described below. Class description: Implement the Layer class. Method signatures and docstrings: - def forward(self, x, prev_s, u, w, v): x : input array prev_s : array u,v,w : weight matrices - def backward(self, x, prev_s, y, u, w, v): y : integer
Implement the Python class `Layer` described below. Class description: Implement the Layer class. Method signatures and docstrings: - def forward(self, x, prev_s, u, w, v): x : input array prev_s : array u,v,w : weight matrices - def backward(self, x, prev_s, y, u, w, v): y : integer <|skeleton|> class Layer: d...
4ae6ba54e90af14af236e03e435eb0402dcac787
<|skeleton|> class Layer: def forward(self, x, prev_s, u, w, v): """x : input array prev_s : array u,v,w : weight matrices""" <|body_0|> def backward(self, x, prev_s, y, u, w, v): """y : integer""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Layer: def forward(self, x, prev_s, u, w, v): """x : input array prev_s : array u,v,w : weight matrices""" activation = Sigmoid() output = Softmax() self.mulu = np.matmul(x, u) self.mulw = np.matmul(prev_s, w) self.sin = np.add(self.mulu, self.mulw) self...
the_stack_v2_python_sparse
machine_learning/deep_learning/python/rnn/rnn.py
ZoranPandovski/al-go-rithms
train
1,421
3340de3a43a0b13b8ca226a8fd36c15f4855701f
[ "self.surface = surface\nself.affine = affine\nself.has_hit = has_hit\nself.vertex_hit = vertex_hit\nself.surf_vox = self.surface.apply_affine(self.affine)", "res = np.zeros(self.has_hit.shape, dtype='i4')\nuse = self.has_hit != -1\nres[use] = np.sum(self.vertex_hit[self.has_hit[use], :] != -1, -1)\nreturn res", ...
<|body_start_0|> self.surface = surface self.affine = affine self.has_hit = has_hit self.vertex_hit = vertex_hit self.surf_vox = self.surface.apply_affine(self.affine) <|end_body_0|> <|body_start_1|> res = np.zeros(self.has_hit.shape, dtype='i4') use = self.has_h...
Represents the intersections between a surface and a grid.
GridSurfaceIntersection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GridSurfaceIntersection: """Represents the intersections between a surface and a grid.""" def __init__(self, surface, affine, has_hit, vertex_hit): """Computes the intersection of the surface with the grid defined by `shape` and `affine`. This object will usually be created through g...
stack_v2_sparse_classes_36k_train_016706
24,374
permissive
[ { "docstring": "Computes the intersection of the surface with the grid defined by `shape` and `affine`. This object will usually be created through grid.intersect or grid.intersect_resolution Arguments: :param surface: 2D surface in a 3D space that intersects with the grid. :type surface: Mesh2D :param affine: ...
4
stack_v2_sparse_classes_30k_train_008081
Implement the Python class `GridSurfaceIntersection` described below. Class description: Represents the intersections between a surface and a grid. Method signatures and docstrings: - def __init__(self, surface, affine, has_hit, vertex_hit): Computes the intersection of the surface with the grid defined by `shape` an...
Implement the Python class `GridSurfaceIntersection` described below. Class description: Represents the intersections between a surface and a grid. Method signatures and docstrings: - def __init__(self, surface, affine, has_hit, vertex_hit): Computes the intersection of the surface with the grid defined by `shape` an...
de00c15b946a99a048694f3d8b6ad822a835b299
<|skeleton|> class GridSurfaceIntersection: """Represents the intersections between a surface and a grid.""" def __init__(self, surface, affine, has_hit, vertex_hit): """Computes the intersection of the surface with the grid defined by `shape` and `affine`. This object will usually be created through g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GridSurfaceIntersection: """Represents the intersections between a surface and a grid.""" def __init__(self, surface, affine, has_hit, vertex_hit): """Computes the intersection of the surface with the grid defined by `shape` and `affine`. This object will usually be created through grid.intersect...
the_stack_v2_python_sparse
mcot/core/surface/grid.py
MichielCottaar/mcot.core
train
1
f1b240251721a2af5c350b82e2f8c6b25198787b
[ "try:\n result = single_run(nnid, ver, node)\n return Response(json.dumps(result))\nexcept Exception as e:\n traceback.print_exc()\n return_data = {'status': '404', 'result': str(e)}\n return Response(json.dumps(return_data))", "try:\n return_data = ''\n return Response(json.dumps(return_data...
<|body_start_0|> try: result = single_run(nnid, ver, node) return Response(json.dumps(result)) except Exception as e: traceback.print_exc() return_data = {'status': '404', 'result': str(e)} return Response(json.dumps(return_data)) <|end_body_0|...
RunManagerSingleRequest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunManagerSingleRequest: def post(self, request, nnid, ver, node): """We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # Class Name : RunManagerSingleRequest # Description: request single node to be executed""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_016707
2,307
permissive
[ { "docstring": "We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # Class Name : RunManagerSingleRequest # Description: request single node to be executed", "name": "post", "signature": "def post(self, request, nnid, ver, node)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_006084
Implement the Python class `RunManagerSingleRequest` described below. Class description: Implement the RunManagerSingleRequest class. Method signatures and docstrings: - def post(self, request, nnid, ver, node): We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # C...
Implement the Python class `RunManagerSingleRequest` described below. Class description: Implement the RunManagerSingleRequest class. Method signatures and docstrings: - def post(self, request, nnid, ver, node): We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # C...
6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f
<|skeleton|> class RunManagerSingleRequest: def post(self, request, nnid, ver, node): """We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # Class Name : RunManagerSingleRequest # Description: request single node to be executed""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunManagerSingleRequest: def post(self, request, nnid, ver, node): """We can execute single node with this api you must specify nnid, ver and node name for that purpose --- # Class Name : RunManagerSingleRequest # Description: request single node to be executed""" try: result = sin...
the_stack_v2_python_sparse
api/views/runmanager_single_request.py
yurimkoo/tensormsa
train
1
14ecdcd7412edf4c0c1cb50fbf59d2a48c8fb987
[ "cnts = collections.Counter(s)\nres = l = r = 0\ninvalid = [key for key, value in cnts.items() if value < k]\nwindow = collections.defaultdict(int)\nfor r in range(1, len(s) + 1):\n window[s[r - 1]] += 1\n if s[r - 1] in invalid:\n while l < r:\n check = [key for key, value in window.items()...
<|body_start_0|> cnts = collections.Counter(s) res = l = r = 0 invalid = [key for key, value in cnts.items() if value < k] window = collections.defaultdict(int) for r in range(1, len(s) + 1): window[s[r - 1]] += 1 if s[r - 1] in invalid: wh...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_0|> def longestSubstring_refer(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cnts = collections.Co...
stack_v2_sparse_classes_36k_train_016708
2,486
no_license
[ { "docstring": ":type s: str :type k: int :rtype: int", "name": "longestSubstring", "signature": "def longestSubstring(self, s, k)" }, { "docstring": ":type s: str :type k: int :rtype: int", "name": "longestSubstring_refer", "signature": "def longestSubstring_refer(self, s, k)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int - def longestSubstring_refer(self, s, k): :type s: str :type k: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestSubstring(self, s, k): :type s: str :type k: int :rtype: int - def longestSubstring_refer(self, s, k): :type s: str :type k: int :rtype: int <|skeleton|> class Soluti...
f3fc71f344cd758cfce77f16ab72992c99ab288e
<|skeleton|> class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_0|> def longestSubstring_refer(self, s, k): """:type s: str :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestSubstring(self, s, k): """:type s: str :type k: int :rtype: int""" cnts = collections.Counter(s) res = l = r = 0 invalid = [key for key, value in cnts.items() if value < k] window = collections.defaultdict(int) for r in range(1, len(s) + 1):...
the_stack_v2_python_sparse
395_longestSubstring.py
jennyChing/leetCode
train
2
90acc4c6f64af9f0513417fca149d619450bc5c7
[ "self.name = name\nself.pos = []\nself.Pn = []\nself.flux = []\nself.pointCloud = []\nself.readpil3d()", "res = np.loadtxt(self.name, delimiter=' ')\nself.pos = res[:, 0:3]\nself.Pn = res[:, 3:4]\nself.flux = res[:, -1]", "self.pointCloud = VtkPointCloud()\nfor k in range(np.size(self.pos, 0)):\n self.pointC...
<|body_start_0|> self.name = name self.pos = [] self.Pn = [] self.flux = [] self.pointCloud = [] self.readpil3d() <|end_body_0|> <|body_start_1|> res = np.loadtxt(self.name, delimiter=' ') self.pos = res[:, 0:3] self.Pn = res[:, 3:4] self....
Class representing a PILAGER3D output file.
PIL3D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PIL3D: """Class representing a PILAGER3D output file.""" def __init__(self, name): """Method to initialize class.""" <|body_0|> def readpil3d(self): """Method to read in the pil3d txt file.""" <|body_1|> def make_point_cloud(self): """Method ...
stack_v2_sparse_classes_36k_train_016709
3,136
no_license
[ { "docstring": "Method to initialize class.", "name": "__init__", "signature": "def __init__(self, name)" }, { "docstring": "Method to read in the pil3d txt file.", "name": "readpil3d", "signature": "def readpil3d(self)" }, { "docstring": "Method to plot the point cloud.", "n...
3
stack_v2_sparse_classes_30k_test_000963
Implement the Python class `PIL3D` described below. Class description: Class representing a PILAGER3D output file. Method signatures and docstrings: - def __init__(self, name): Method to initialize class. - def readpil3d(self): Method to read in the pil3d txt file. - def make_point_cloud(self): Method to plot the poi...
Implement the Python class `PIL3D` described below. Class description: Class representing a PILAGER3D output file. Method signatures and docstrings: - def __init__(self, name): Method to initialize class. - def readpil3d(self): Method to read in the pil3d txt file. - def make_point_cloud(self): Method to plot the poi...
6b37842203ff4318a48dbf0258cbe2b253436e7d
<|skeleton|> class PIL3D: """Class representing a PILAGER3D output file.""" def __init__(self, name): """Method to initialize class.""" <|body_0|> def readpil3d(self): """Method to read in the pil3d txt file.""" <|body_1|> def make_point_cloud(self): """Method ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PIL3D: """Class representing a PILAGER3D output file.""" def __init__(self, name): """Method to initialize class.""" self.name = name self.pos = [] self.Pn = [] self.flux = [] self.pointCloud = [] self.readpil3d() def readpil3d(self): "...
the_stack_v2_python_sparse
plume/pil3d.py
tslowery78/PyLnD
train
0
f0c4abdc1bb9a5fa59ff91b6504063065537b0e6
[ "result = []\nif len(matrix) <= 0:\n return result\nself.foo(matrix, result, 0, 0)\nreturn result", "n = len(matrix)\nm = len(matrix[0])\nif i >= n or j >= m or matrix[i][j] == '#':\n return\nfor col in range(j, m - j):\n if matrix[i][col] != '#':\n result.append(matrix[i][col])\n matrix[i]...
<|body_start_0|> result = [] if len(matrix) <= 0: return result self.foo(matrix, result, 0, 0) return result <|end_body_0|> <|body_start_1|> n = len(matrix) m = len(matrix[0]) if i >= n or j >= m or matrix[i][j] == '#': return for ...
Solution1
[ "WTFPL" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def spiralOrder(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" <|body_0|> def foo(self, matrix, result, i, j): """every time only add most outer rows and cols into result i,j is the start point, we add elemtents clockwise then i+1,j+1...
stack_v2_sparse_classes_36k_train_016710
1,872
permissive
[ { "docstring": ":type matrix: List[List[int]] :rtype: List[int]", "name": "spiralOrder", "signature": "def spiralOrder(self, matrix)" }, { "docstring": "every time only add most outer rows and cols into result i,j is the start point, we add elemtents clockwise then i+1,j+1 => go to inner matrix ...
2
stack_v2_sparse_classes_30k_train_004599
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def spiralOrder(self, matrix): :type matrix: List[List[int]] :rtype: List[int] - def foo(self, matrix, result, i, j): every time only add most outer rows and cols into result i...
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def spiralOrder(self, matrix): :type matrix: List[List[int]] :rtype: List[int] - def foo(self, matrix, result, i, j): every time only add most outer rows and cols into result i...
2677b6d26bedb9bc6c6137a2392d0afaceb91ec2
<|skeleton|> class Solution1: def spiralOrder(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" <|body_0|> def foo(self, matrix, result, i, j): """every time only add most outer rows and cols into result i,j is the start point, we add elemtents clockwise then i+1,j+1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution1: def spiralOrder(self, matrix): """:type matrix: List[List[int]] :rtype: List[int]""" result = [] if len(matrix) <= 0: return result self.foo(matrix, result, 0, 0) return result def foo(self, matrix, result, i, j): """every time only a...
the_stack_v2_python_sparse
spiral_matrix/solution.py
haotianzhu/Questions_Solutions
train
0
d3dcd82fe22869609945cb73474af1c159388268
[ "for pol in self.auth:\n if pol.actor == uid:\n return pol\nreturn None", "pol = self.get_policy(uid)\nif pol is not None:\n session.delete(pol)", "del session\npol = self.get_policy(uid)\npol.role = new_role" ]
<|body_start_0|> for pol in self.auth: if pol.actor == uid: return pol return None <|end_body_0|> <|body_start_1|> pol = self.get_policy(uid) if pol is not None: session.delete(pol) <|end_body_1|> <|body_start_2|> del session pol ...
Base class for models with a list of authorization policies
Authorized
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Authorized: """Base class for models with a list of authorization policies""" def get_policy(self, uid): """Retrieve policy associated with a given actor. Args: uid: (str) id of actor Returns: (Policy) or None if no actor in auth list""" <|body_0|> def remove_policy(self...
stack_v2_sparse_classes_36k_train_016711
3,240
no_license
[ { "docstring": "Retrieve policy associated with a given actor. Args: uid: (str) id of actor Returns: (Policy) or None if no actor in auth list", "name": "get_policy", "signature": "def get_policy(self, uid)" }, { "docstring": "Remove access granted to actor Args: session: (DBSession) uid: (str) ...
3
stack_v2_sparse_classes_30k_train_006426
Implement the Python class `Authorized` described below. Class description: Base class for models with a list of authorization policies Method signatures and docstrings: - def get_policy(self, uid): Retrieve policy associated with a given actor. Args: uid: (str) id of actor Returns: (Policy) or None if no actor in au...
Implement the Python class `Authorized` described below. Class description: Base class for models with a list of authorization policies Method signatures and docstrings: - def get_policy(self, uid): Retrieve policy associated with a given actor. Args: uid: (str) id of actor Returns: (Policy) or None if no actor in au...
ff1feea27efa6544c0e443b953951bb50cbdd9bb
<|skeleton|> class Authorized: """Base class for models with a list of authorization policies""" def get_policy(self, uid): """Retrieve policy associated with a given actor. Args: uid: (str) id of actor Returns: (Policy) or None if no actor in auth list""" <|body_0|> def remove_policy(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Authorized: """Base class for models with a list of authorization policies""" def get_policy(self, uid): """Retrieve policy associated with a given actor. Args: uid: (str) id of actor Returns: (Policy) or None if no actor in auth list""" for pol in self.auth: if pol.actor == u...
the_stack_v2_python_sparse
seeweb/models/auth.py
pradal/seeweb
train
0
b73d7e5faafb0c90fd244e8862bb4af25afdfc21
[ "try:\n instance_message = await get_data_from_req(self.request).messages.get()\nexcept (ResourceNotFoundError, ResourceConflictError):\n return json_response(None)\nreturn json_response(instance_message)", "user_id = self.request['client'].user_id\ninstance_message = await get_data_from_req(self.request).m...
<|body_start_0|> try: instance_message = await get_data_from_req(self.request).messages.get() except (ResourceNotFoundError, ResourceConflictError): return json_response(None) return json_response(instance_message) <|end_body_0|> <|body_start_1|> user_id = self.r...
MessagesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MessagesView: async def get(self) -> r200[Optional[MessageResponse]]: """Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Successful operation""" <|body_0|> async def put(self, data: CreateMessageRequest) -> r200...
stack_v2_sparse_classes_36k_train_016712
2,470
permissive
[ { "docstring": "Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Successful operation", "name": "get", "signature": "async def get(self) -> r200[Optional[MessageResponse]]" }, { "docstring": "Create an administrative instance message...
3
stack_v2_sparse_classes_30k_val_000105
Implement the Python class `MessagesView` described below. Class description: Implement the MessagesView class. Method signatures and docstrings: - async def get(self) -> r200[Optional[MessageResponse]]: Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Su...
Implement the Python class `MessagesView` described below. Class description: Implement the MessagesView class. Method signatures and docstrings: - async def get(self) -> r200[Optional[MessageResponse]]: Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Su...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class MessagesView: async def get(self) -> r200[Optional[MessageResponse]]: """Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Successful operation""" <|body_0|> async def put(self, data: CreateMessageRequest) -> r200...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MessagesView: async def get(self) -> r200[Optional[MessageResponse]]: """Get the administrative instance message. Fetches the active administrative instance message. Status Codes: 200: Successful operation""" try: instance_message = await get_data_from_req(self.request).messages.ge...
the_stack_v2_python_sparse
virtool/messages/api.py
virtool/virtool
train
45
f166dde05c4a9e67334a5886995788809efade81
[ "user = self.get_current_user()\nif user:\n feature_ids = notifier.FeatureStar.get_user_stars(user.email())\nelse:\n feature_ids = []\ndata = {'featureIds': feature_ids}\nreturn data", "feature = self.get_specified_feature()\nstarred = self.get_bool_param('starred', default=True)\nuser = self.get_current_us...
<|body_start_0|> user = self.get_current_user() if user: feature_ids = notifier.FeatureStar.get_user_stars(user.email()) else: feature_ids = [] data = {'featureIds': feature_ids} return data <|end_body_0|> <|body_start_1|> feature = self.get_speci...
Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature.
StarsAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StarsAPI: """Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature.""" def do_get(self, **kwargs): """Return a list of all starred fea...
stack_v2_sparse_classes_36k_train_016713
1,719
permissive
[ { "docstring": "Return a list of all starred feature IDs for the signed-in user.", "name": "do_get", "signature": "def do_get(self, **kwargs)" }, { "docstring": "Set or clear a star on the specified feature.", "name": "do_post", "signature": "def do_post(self, **kwargs)" } ]
2
null
Implement the Python class `StarsAPI` described below. Class description: Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature. Method signatures and docstrings: - def...
Implement the Python class `StarsAPI` described below. Class description: Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature. Method signatures and docstrings: - def...
17f9886d064da5bda84006d5866077727646fff2
<|skeleton|> class StarsAPI: """Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature.""" def do_get(self, **kwargs): """Return a list of all starred fea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StarsAPI: """Users can star a feature by clicking a star icon. The client-side has logic to toggle the star icon. When a user has starred a feature, they will be sent notification emails about changes to that feature.""" def do_get(self, **kwargs): """Return a list of all starred feature IDs for ...
the_stack_v2_python_sparse
api/stars_api.py
GoogleChrome/chromium-dashboard
train
574
189aee25ee4d4969761b4e74750b80f6f3901232
[ "def visit(s1, s2):\n n = len(s1)\n m = len(s2)\n if n != m:\n return False\n if s1 == s2:\n return True\n if sorted(s1) != sorted(s2):\n return False\n if n < 4:\n return True\n for i in range(1, n):\n if visit(s1[:i], s2[:i]) and visit(s1[i:], s2[i:]) or (vi...
<|body_start_0|> def visit(s1, s2): n = len(s1) m = len(s2) if n != m: return False if s1 == s2: return True if sorted(s1) != sorted(s2): return False if n < 4: return True ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isScramble(self, s1: str, s2: str) -> bool: """Simply testing that both strings contain the same strings does not work: Counter example: "abcde" and "caebd". "ab" is in the inverted order "ba" but separated by "e" which is before "d" => There are two crossed inversions and ...
stack_v2_sparse_classes_36k_train_016714
2,808
no_license
[ { "docstring": "Simply testing that both strings contain the same strings does not work: Counter example: \"abcde\" and \"caebd\". \"ab\" is in the inverted order \"ba\" but separated by \"e\" which is before \"d\" => There are two crossed inversions and this is not valid (inversions cut the space) Algorithm 1 ...
2
stack_v2_sparse_classes_30k_train_012883
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isScramble(self, s1: str, s2: str) -> bool: Simply testing that both strings contain the same strings does not work: Counter example: "abcde" and "caebd". "ab" is in the inve...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isScramble(self, s1: str, s2: str) -> bool: Simply testing that both strings contain the same strings does not work: Counter example: "abcde" and "caebd". "ab" is in the inve...
3ffcfee5cedf421d5de6d0dec4ba53b0eecbbff8
<|skeleton|> class Solution: def isScramble(self, s1: str, s2: str) -> bool: """Simply testing that both strings contain the same strings does not work: Counter example: "abcde" and "caebd". "ab" is in the inverted order "ba" but separated by "e" which is before "d" => There are two crossed inversions and ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isScramble(self, s1: str, s2: str) -> bool: """Simply testing that both strings contain the same strings does not work: Counter example: "abcde" and "caebd". "ab" is in the inverted order "ba" but separated by "e" which is before "d" => There are two crossed inversions and this is not va...
the_stack_v2_python_sparse
backtrack/ScrambleStrings.py
QuentinDuval/PythonExperiments
train
3
2944d7b9804845f3cdc732a8449737134101d294
[ "self.designate = designate\nself.parameter = parameter\nself.answers = [Path(answer) for answer in answers]\nself.default = Path(default)\nself.question = question\nself.logical_unit = next(self._logic_unit)\nself.value = self.default", "question = tag.find('question').text\ndefault = tag.find('answer').text\nan...
<|body_start_0|> self.designate = designate self.parameter = parameter self.answers = [Path(answer) for answer in answers] self.default = Path(default) self.question = question self.logical_unit = next(self._logic_unit) self.value = self.default <|end_body_0|> <|...
ExternalFile class. The External File Specification allows the user to associate a TRNSYS parameter ( typically a logical unit) with an external file through the use of the TRNSYS ASSIGN, FILES, or DESIGNATE statements. This feature allows the author to describe a question that will be asked in the assembly window. If ...
ExternalFile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExternalFile: """ExternalFile class. The External File Specification allows the user to associate a TRNSYS parameter ( typically a logical unit) with an external file through the use of the TRNSYS ASSIGN, FILES, or DESIGNATE statements. This feature allows the author to describe a question that w...
stack_v2_sparse_classes_36k_train_016715
2,637
permissive
[ { "docstring": "Initialize object from arguments. Args: question (str): Question to ask. default (str): Default answer. answers (list of str): List of possible answers. parameter (str): The parameter associated with the external file. designate (bool): If True, the external files are assigned to logical unit nu...
2
stack_v2_sparse_classes_30k_train_005981
Implement the Python class `ExternalFile` described below. Class description: ExternalFile class. The External File Specification allows the user to associate a TRNSYS parameter ( typically a logical unit) with an external file through the use of the TRNSYS ASSIGN, FILES, or DESIGNATE statements. This feature allows t...
Implement the Python class `ExternalFile` described below. Class description: ExternalFile class. The External File Specification allows the user to associate a TRNSYS parameter ( typically a logical unit) with an external file through the use of the TRNSYS ASSIGN, FILES, or DESIGNATE statements. This feature allows t...
f2deb5eb340a2814722eead5f8b6278a945c730d
<|skeleton|> class ExternalFile: """ExternalFile class. The External File Specification allows the user to associate a TRNSYS parameter ( typically a logical unit) with an external file through the use of the TRNSYS ASSIGN, FILES, or DESIGNATE statements. This feature allows the author to describe a question that w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExternalFile: """ExternalFile class. The External File Specification allows the user to associate a TRNSYS parameter ( typically a logical unit) with an external file through the use of the TRNSYS ASSIGN, FILES, or DESIGNATE statements. This feature allows the author to describe a question that will be asked ...
the_stack_v2_python_sparse
trnsystor/externalfile.py
sturmianseq/trnsystor
train
0
3e601976403ceac10bef638c213c0148ab34bc1c
[ "super().__init__(input_shape, filters, kernel_size, stride, dilation, groups, bias)\nif isinstance(padding, (*INT_TYPES, *FLOAT_TYPES)):\n self.padding_mode = 'constant'\n self._padding_value = padding\nelse:\n self.padding_mode = padding\n self._padding_value = 0.0\nif self.padding_mode == 'valid' or ...
<|body_start_0|> super().__init__(input_shape, filters, kernel_size, stride, dilation, groups, bias) if isinstance(padding, (*INT_TYPES, *FLOAT_TYPES)): self.padding_mode = 'constant' self._padding_value = padding else: self.padding_mode = padding ...
Conv
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Conv: def __init__(self, input_shape, filters, kernel_size=3, stride=1, dilation=1, groups=1, padding='constant', bias=False): """Direct convolution layer generalized for different dims. This layer slightly extends functionality of original torch.nn.Conv* modules in four main aspects: 1)...
stack_v2_sparse_classes_36k_train_016716
13,566
no_license
[ { "docstring": "Direct convolution layer generalized for different dims. This layer slightly extends functionality of original torch.nn.Conv* modules in four main aspects: 1) Shape of the input tensor is passed as argument of constructor. 2) Shape of the output tensor can be accessed by 'output_shape' property ...
3
stack_v2_sparse_classes_30k_train_008231
Implement the Python class `Conv` described below. Class description: Implement the Conv class. Method signatures and docstrings: - def __init__(self, input_shape, filters, kernel_size=3, stride=1, dilation=1, groups=1, padding='constant', bias=False): Direct convolution layer generalized for different dims. This lay...
Implement the Python class `Conv` described below. Class description: Implement the Conv class. Method signatures and docstrings: - def __init__(self, input_shape, filters, kernel_size=3, stride=1, dilation=1, groups=1, padding='constant', bias=False): Direct convolution layer generalized for different dims. This lay...
9554e0f96703a37a9a41fc70dc8e70e45c6181a2
<|skeleton|> class Conv: def __init__(self, input_shape, filters, kernel_size=3, stride=1, dilation=1, groups=1, padding='constant', bias=False): """Direct convolution layer generalized for different dims. This layer slightly extends functionality of original torch.nn.Conv* modules in four main aspects: 1)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Conv: def __init__(self, input_shape, filters, kernel_size=3, stride=1, dilation=1, groups=1, padding='constant', bias=False): """Direct convolution layer generalized for different dims. This layer slightly extends functionality of original torch.nn.Conv* modules in four main aspects: 1) Shape of the ...
the_stack_v2_python_sparse
dnn_backend/radio_dep/models/models/pytorch/layers/conv.py
theVmagnificient/radiology_web
train
0
1c502a7a980e08d8ceb7b3a23fef094e82f18e77
[ "with open(path) as f:\n data = f.read()\nif not preamble in data:\n if data.startswith('#!'):\n lines = data.splitlines(keepends=True)\n text = f\"{lines[0]}{preamble}{''.join(lines[1:])}\"\n else:\n text = f'{preamble}{data}'\n with open(path, 'wt') as f:\n f.write(text)", ...
<|body_start_0|> with open(path) as f: data = f.read() if not preamble in data: if data.startswith('#!'): lines = data.splitlines(keepends=True) text = f"{lines[0]}{preamble}{''.join(lines[1:])}" else: text = f'{preamble...
ApplyCopyrightCommand
[ "MIT", "MIT-0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApplyCopyrightCommand: def _check_add_copyright(self, path, preamble): """Check that the given file has the provided copyright and add it in case it is not present.""" <|body_0|> def run(self): """Execution of the command action.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k_train_016717
14,165
permissive
[ { "docstring": "Check that the given file has the provided copyright and add it in case it is not present.", "name": "_check_add_copyright", "signature": "def _check_add_copyright(self, path, preamble)" }, { "docstring": "Execution of the command action.", "name": "run", "signature": "de...
2
stack_v2_sparse_classes_30k_val_000763
Implement the Python class `ApplyCopyrightCommand` described below. Class description: Implement the ApplyCopyrightCommand class. Method signatures and docstrings: - def _check_add_copyright(self, path, preamble): Check that the given file has the provided copyright and add it in case it is not present. - def run(sel...
Implement the Python class `ApplyCopyrightCommand` described below. Class description: Implement the ApplyCopyrightCommand class. Method signatures and docstrings: - def _check_add_copyright(self, path, preamble): Check that the given file has the provided copyright and add it in case it is not present. - def run(sel...
fa6808a6ca8063751da92f683f2b810a0690a462
<|skeleton|> class ApplyCopyrightCommand: def _check_add_copyright(self, path, preamble): """Check that the given file has the provided copyright and add it in case it is not present.""" <|body_0|> def run(self): """Execution of the command action.""" <|body_1|> <|end_skeleton...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApplyCopyrightCommand: def _check_add_copyright(self, path, preamble): """Check that the given file has the provided copyright and add it in case it is not present.""" with open(path) as f: data = f.read() if not preamble in data: if data.startswith('#!'): ...
the_stack_v2_python_sparse
setup.py
mramospe/minkit
train
0
f116f971af060012a99300b9af7568fb2a74b3f6
[ "def process():\n for n, values in enumerate(data):\n funct7, in0, in1, expected = values if len(values) == 4 else (0,) + values\n yield self.dut.funct7.eq(funct7)\n yield self.dut.in0.eq(in0)\n yield self.dut.in1.eq(in1)\n yield self.dut.start.eq(1)\n yield\n yie...
<|body_start_0|> def process(): for n, values in enumerate(data): funct7, in0, in1, expected = values if len(values) == 4 else (0,) + values yield self.dut.funct7.eq(funct7) yield self.dut.in0.eq(in0) yield self.dut.in1.eq(in1) ...
Base test class, suitable for testing simple instructions.
InstructionTestBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstructionTestBase: """Base test class, suitable for testing simple instructions.""" def verify(self, data, trace=False): """Verifies instruction given explicit lists of inputs and outputs Parameters ---------- data: list of 3-tuples (in0, in1, out) or 4-tuples (funct7, in0, in1, ou...
stack_v2_sparse_classes_36k_train_016718
13,874
permissive
[ { "docstring": "Verifies instruction given explicit lists of inputs and outputs Parameters ---------- data: list of 3-tuples (in0, in1, out) or 4-tuples (funct7, in0, in1, out)", "name": "verify", "signature": "def verify(self, data, trace=False)" }, { "docstring": "Verifies that our instruction...
2
stack_v2_sparse_classes_30k_train_017567
Implement the Python class `InstructionTestBase` described below. Class description: Base test class, suitable for testing simple instructions. Method signatures and docstrings: - def verify(self, data, trace=False): Verifies instruction given explicit lists of inputs and outputs Parameters ---------- data: list of 3...
Implement the Python class `InstructionTestBase` described below. Class description: Base test class, suitable for testing simple instructions. Method signatures and docstrings: - def verify(self, data, trace=False): Verifies instruction given explicit lists of inputs and outputs Parameters ---------- data: list of 3...
d4f660ad81f8807558120bbd311371eff1a0ce3b
<|skeleton|> class InstructionTestBase: """Base test class, suitable for testing simple instructions.""" def verify(self, data, trace=False): """Verifies instruction given explicit lists of inputs and outputs Parameters ---------- data: list of 3-tuples (in0, in1, out) or 4-tuples (funct7, in0, in1, ou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InstructionTestBase: """Base test class, suitable for testing simple instructions.""" def verify(self, data, trace=False): """Verifies instruction given explicit lists of inputs and outputs Parameters ---------- data: list of 3-tuples (in0, in1, out) or 4-tuples (funct7, in0, in1, out)""" ...
the_stack_v2_python_sparse
python/nmigen_cfu/cfu.py
JosephBushagour/CFU-Playground
train
1
f26fb5fd9e1dfb042c6507e76c23a6d50398b547
[ "if not node:\n return\nif node.val == V:\n if is_left_path:\n self.t2 = node\n else:\n self.t2 = node.right\nif is_left_path and node.val < V:\n self.t2 = node\nif not is_left_path and node.val > V:\n self.t2 = node\nif V < node.val:\n self.t1 = node\n self.find_split_point(node....
<|body_start_0|> if not node: return if node.val == V: if is_left_path: self.t2 = node else: self.t2 = node.right if is_left_path and node.val < V: self.t2 = node if not is_left_path and node.val > V: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def find_split_point(self, node, is_left_path, V): """find the split point where both trees will be separated""" <|body_0|> def splitBST(self, root, V): """:type root: TreeNode :type V: int :rtype: List[TreeNode]""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_016719
3,186
no_license
[ { "docstring": "find the split point where both trees will be separated", "name": "find_split_point", "signature": "def find_split_point(self, node, is_left_path, V)" }, { "docstring": ":type root: TreeNode :type V: int :rtype: List[TreeNode]", "name": "splitBST", "signature": "def split...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_split_point(self, node, is_left_path, V): find the split point where both trees will be separated - def splitBST(self, root, V): :type root: TreeNode :type V: int :rtype...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_split_point(self, node, is_left_path, V): find the split point where both trees will be separated - def splitBST(self, root, V): :type root: TreeNode :type V: int :rtype...
877933424e6d2c590d6ac53db18bee951a3d9de4
<|skeleton|> class Solution: def find_split_point(self, node, is_left_path, V): """find the split point where both trees will be separated""" <|body_0|> def splitBST(self, root, V): """:type root: TreeNode :type V: int :rtype: List[TreeNode]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def find_split_point(self, node, is_left_path, V): """find the split point where both trees will be separated""" if not node: return if node.val == V: if is_left_path: self.t2 = node else: self.t2 = node.righ...
the_stack_v2_python_sparse
leetcode/776.split-bst-messsss.py
siddhism/leetcode
train
0
29d15c4c250ca4850556ce4ef32048387d4e4249
[ "e = data_types.WebTestExpectation('test*', ['tag1'], 'Failure')\nself.assertTrue(e._CompareWildcard('testing123'))\nself.assertTrue(e._CompareWildcard('virtual/some-identifier/testing123'))\nself.assertTrue(e._CompareWildcard('test'))\nself.assertTrue(e._CompareWildcard('virtual/some-identifier/test'))\nself.asser...
<|body_start_0|> e = data_types.WebTestExpectation('test*', ['tag1'], 'Failure') self.assertTrue(e._CompareWildcard('testing123')) self.assertTrue(e._CompareWildcard('virtual/some-identifier/testing123')) self.assertTrue(e._CompareWildcard('test')) self.assertTrue(e._CompareWildc...
WebTestExpectationUnittest
[ "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", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebTestExpectationUnittest: def testCompareWildcard(self): """Tests that wildcard comparisons work as expected.""" <|body_0|> def testCompareNonWildcard(self): """Tests that non-wildcard comparisons work as expected.""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_016720
10,707
permissive
[ { "docstring": "Tests that wildcard comparisons work as expected.", "name": "testCompareWildcard", "signature": "def testCompareWildcard(self)" }, { "docstring": "Tests that non-wildcard comparisons work as expected.", "name": "testCompareNonWildcard", "signature": "def testCompareNonWil...
2
stack_v2_sparse_classes_30k_train_005764
Implement the Python class `WebTestExpectationUnittest` described below. Class description: Implement the WebTestExpectationUnittest class. Method signatures and docstrings: - def testCompareWildcard(self): Tests that wildcard comparisons work as expected. - def testCompareNonWildcard(self): Tests that non-wildcard c...
Implement the Python class `WebTestExpectationUnittest` described below. Class description: Implement the WebTestExpectationUnittest class. Method signatures and docstrings: - def testCompareWildcard(self): Tests that wildcard comparisons work as expected. - def testCompareNonWildcard(self): Tests that non-wildcard c...
fd8a8914ca0183f0add65ae55f04e287543c7d4a
<|skeleton|> class WebTestExpectationUnittest: def testCompareWildcard(self): """Tests that wildcard comparisons work as expected.""" <|body_0|> def testCompareNonWildcard(self): """Tests that non-wildcard comparisons work as expected.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebTestExpectationUnittest: def testCompareWildcard(self): """Tests that wildcard comparisons work as expected.""" e = data_types.WebTestExpectation('test*', ['tag1'], 'Failure') self.assertTrue(e._CompareWildcard('testing123')) self.assertTrue(e._CompareWildcard('virtual/some-...
the_stack_v2_python_sparse
third_party/blink/tools/blinkpy/web_tests/stale_expectation_removal/data_types_unittest.py
SREERAGI18/chromium
train
1
d8399a088f67a1c4e3a9ba57bbb791d7c5c8b632
[ "j = len(num2) - 1\na2 = 0\nb2 = 0\nwhile 0 != j:\n a2 = num2[j]\n for k in range(0, j):\n b2 = num2[k]\n if a2 + b2 + re1 + re2 == target:\n C.add((re1, re2, b2, a2))\n j = j - 1\nreturn C", "i = 0\ntmp3 = len(num3) - 2\nwhile i < tmp3:\n i = i + 1\n lennum = tmp3 - i + 1\...
<|body_start_0|> j = len(num2) - 1 a2 = 0 b2 = 0 while 0 != j: a2 = num2[j] for k in range(0, j): b2 = num2[k] if a2 + b2 + re1 + re2 == target: C.add((re1, re2, b2, a2)) j = j - 1 return C <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, num2, re1, re2, C, target): """:type nums: List[int] :rtype: set()""" <|body_0|> def threeSum(self, num3, re1, C, target): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> def fourSum(self, nums, target): ...
stack_v2_sparse_classes_36k_train_016721
1,209
no_license
[ { "docstring": ":type nums: List[int] :rtype: set()", "name": "twoSum", "signature": "def twoSum(self, num2, re1, re2, C, target)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "threeSum", "signature": "def threeSum(self, num3, re1, C, target)" }, { "...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, num2, re1, re2, C, target): :type nums: List[int] :rtype: set() - def threeSum(self, num3, re1, C, target): :type nums: List[int] :rtype: List[List[int]] - def f...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, num2, re1, re2, C, target): :type nums: List[int] :rtype: set() - def threeSum(self, num3, re1, C, target): :type nums: List[int] :rtype: List[List[int]] - def f...
9752533bc76ce5ecb881f61e33a3bc4b20dcf666
<|skeleton|> class Solution: def twoSum(self, num2, re1, re2, C, target): """:type nums: List[int] :rtype: set()""" <|body_0|> def threeSum(self, num3, re1, C, target): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> def fourSum(self, nums, target): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, num2, re1, re2, C, target): """:type nums: List[int] :rtype: set()""" j = len(num2) - 1 a2 = 0 b2 = 0 while 0 != j: a2 = num2[j] for k in range(0, j): b2 = num2[k] if a2 + b2 + re1 + re2 ...
the_stack_v2_python_sparse
018. 4Sum/18. 4Sum.py
603lzy/LeetCode
train
3
09ff974d03ba24a1dcb439dca17d475edb2ab07b
[ "entity_normalizer_kwargs = _resolve_kwargs(kwargs=entity_normalizer_kwargs, default_kwargs=self.default_entity_normalizer_kwargs)\nentity_initializer_kwargs = self._update_embedding_init_with_default(entity_initializer_kwargs, embedding_dim=embedding_dim)\nrelation_initializer_kwargs = self._update_embedding_init_...
<|body_start_0|> entity_normalizer_kwargs = _resolve_kwargs(kwargs=entity_normalizer_kwargs, default_kwargs=self.default_entity_normalizer_kwargs) entity_initializer_kwargs = self._update_embedding_init_with_default(entity_initializer_kwargs, embedding_dim=embedding_dim) relation_initializer_kwa...
An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE
PairRE
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PairRE: """An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE""" def __init__(self, embedding_dim: int=200, p: int=1, power_norm: bool=False, entity_i...
stack_v2_sparse_classes_36k_train_016722
6,053
permissive
[ { "docstring": "Initialize PairRE via the :class:`pykeen.nn.modules.PairREInteraction` interaction. :param embedding_dim: The entity embedding dimension $d$. :param p: The $l_p$ norm. :param power_norm: Should the power norm be used? :param entity_initializer: Entity initializer function. Defaults to :func:`tor...
2
null
Implement the Python class `PairRE` described below. Class description: An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE Method signatures and docstrings: - def __init__(self...
Implement the Python class `PairRE` described below. Class description: An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE Method signatures and docstrings: - def __init__(self...
5ff3597b18ab9a220e34361d3c3f262060811df1
<|skeleton|> class PairRE: """An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE""" def __init__(self, embedding_dim: int=200, p: int=1, power_norm: bool=False, entity_i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PairRE: """An implementation of PairRE from [chao2020]_. --- citation: author: Chao year: 2020 link: http://arxiv.org/abs/2011.03798 github: alipay/KnowledgeGraphEmbeddingsViaPairedRelationVectors_PairRE""" def __init__(self, embedding_dim: int=200, p: int=1, power_norm: bool=False, entity_initializer: H...
the_stack_v2_python_sparse
src/pykeen/models/unimodal/pair_re.py
pykeen/pykeen
train
1,308
7b8abec9f678cb3e13ef70ff6673518bd730bc38
[ "res = []\nl = len(s)\nfor i in range(1, l):\n if s[i] == s[i - 1] == '+':\n res.append(s[:i - 1] + '--' + s[i + 1:])\nreturn res", "firstmove = self.generatePossibleNextMoves(s)\nif len(firstmove) == 0:\n return False\nfor move in firstmove:\n if not self.canWin(move):\n return True\nretur...
<|body_start_0|> res = [] l = len(s) for i in range(1, l): if s[i] == s[i - 1] == '+': res.append(s[:i - 1] + '--' + s[i + 1:]) return res <|end_body_0|> <|body_start_1|> firstmove = self.generatePossibleNextMoves(s) if len(firstmove) == 0: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generatePossibleNextMoves(self, s): """:type s: str :rtype: List[str]""" <|body_0|> def canWin(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = [] l = len(s) for i in range(1,...
stack_v2_sparse_classes_36k_train_016723
650
no_license
[ { "docstring": ":type s: str :rtype: List[str]", "name": "generatePossibleNextMoves", "signature": "def generatePossibleNextMoves(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "canWin", "signature": "def canWin(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generatePossibleNextMoves(self, s): :type s: str :rtype: List[str] - def canWin(self, s): :type s: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generatePossibleNextMoves(self, s): :type s: str :rtype: List[str] - def canWin(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def generatePossibleNex...
ef8c9422c481aa3c482933318c785ad28dd7703e
<|skeleton|> class Solution: def generatePossibleNextMoves(self, s): """:type s: str :rtype: List[str]""" <|body_0|> def canWin(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def generatePossibleNextMoves(self, s): """:type s: str :rtype: List[str]""" res = [] l = len(s) for i in range(1, l): if s[i] == s[i - 1] == '+': res.append(s[:i - 1] + '--' + s[i + 1:]) return res def canWin(self, s): ...
the_stack_v2_python_sparse
python/filp_game_II.py
pzmrzy/LeetCode
train
2
0f8d2ecef4f95c75a59ceaa6267a8841fd9c93e8
[ "p_list = list(p)\nif isinstance(p[1], dict):\n p[0] = p[1]\n if 'NO' in p_list:\n p[0]['encrypt']['salt'] = False\n elif 'USING' in p_list:\n p[0]['encrypt']['encryption_algorithm'] = p_list[-1]\n elif 'SALT' not in p_list:\n p[0]['encrypt']['integrity_algorithm'] = p_list[-1]\nels...
<|body_start_0|> p_list = list(p) if isinstance(p[1], dict): p[0] = p[1] if 'NO' in p_list: p[0]['encrypt']['salt'] = False elif 'USING' in p_list: p[0]['encrypt']['encryption_algorithm'] = p_list[-1] elif 'SALT' not in p_li...
Oracle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Oracle: def p_encrypt(self, p): """encrypt : ENCRYPT | encrypt NO SALT | encrypt SALT | encrypt USING STRING | encrypt STRING""" <|body_0|> def p_storage(self, p): """storage : STORAGE LP | storage id id | storage id id RP""" <|body_1|> def p_expr_storag...
stack_v2_sparse_classes_36k_train_016724
1,438
permissive
[ { "docstring": "encrypt : ENCRYPT | encrypt NO SALT | encrypt SALT | encrypt USING STRING | encrypt STRING", "name": "p_encrypt", "signature": "def p_encrypt(self, p)" }, { "docstring": "storage : STORAGE LP | storage id id | storage id id RP", "name": "p_storage", "signature": "def p_st...
3
stack_v2_sparse_classes_30k_train_001003
Implement the Python class `Oracle` described below. Class description: Implement the Oracle class. Method signatures and docstrings: - def p_encrypt(self, p): encrypt : ENCRYPT | encrypt NO SALT | encrypt SALT | encrypt USING STRING | encrypt STRING - def p_storage(self, p): storage : STORAGE LP | storage id id | st...
Implement the Python class `Oracle` described below. Class description: Implement the Oracle class. Method signatures and docstrings: - def p_encrypt(self, p): encrypt : ENCRYPT | encrypt NO SALT | encrypt SALT | encrypt USING STRING | encrypt STRING - def p_storage(self, p): storage : STORAGE LP | storage id id | st...
8f69c9c3b58990f0d47dbe868fe4a572d51e2de7
<|skeleton|> class Oracle: def p_encrypt(self, p): """encrypt : ENCRYPT | encrypt NO SALT | encrypt SALT | encrypt USING STRING | encrypt STRING""" <|body_0|> def p_storage(self, p): """storage : STORAGE LP | storage id id | storage id id RP""" <|body_1|> def p_expr_storag...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Oracle: def p_encrypt(self, p): """encrypt : ENCRYPT | encrypt NO SALT | encrypt SALT | encrypt USING STRING | encrypt STRING""" p_list = list(p) if isinstance(p[1], dict): p[0] = p[1] if 'NO' in p_list: p[0]['encrypt']['salt'] = False ...
the_stack_v2_python_sparse
simple_ddl_parser/dialects/oracle.py
bjmc/simple-ddl-parser
train
0
6c1ccf4bbf6f4e3e80c43ccc498b8f96a2d13788
[ "super().__init__()\nself.flatten = nn.Flatten()\nself.out_channels = style_channels\nself.downsample = None\nif in_channels != style_channels:\n self.downsample = ChannelPool(in_channels=in_channels, out_channels=style_channels, convolution=convolution, normalization=normalization)", "if self.downsample is no...
<|body_start_0|> super().__init__() self.flatten = nn.Flatten() self.out_channels = style_channels self.downsample = None if in_channels != style_channels: self.downsample = ChannelPool(in_channels=in_channels, out_channels=style_channels, convolution=convolution, nor...
StyleReshape
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StyleReshape: def __init__(self, in_channels: int, style_channels: int, normalization: str='bn', convolution: str='conv', **kwargs) -> None: """Reshape feature-map into a style-vector. See Cellpose. Cellpose: - https://www.nature.com/articles/s41592-020-01018-x Takes in a feature map (B,...
stack_v2_sparse_classes_36k_train_016725
5,285
permissive
[ { "docstring": "Reshape feature-map into a style-vector. See Cellpose. Cellpose: - https://www.nature.com/articles/s41592-020-01018-x Takes in a feature map (B, C, H, W). Then averages, and normalizes it into to a style feature vector. Parameters ---------- in_channels : int Number of input channels. style_chan...
2
stack_v2_sparse_classes_30k_train_001255
Implement the Python class `StyleReshape` described below. Class description: Implement the StyleReshape class. Method signatures and docstrings: - def __init__(self, in_channels: int, style_channels: int, normalization: str='bn', convolution: str='conv', **kwargs) -> None: Reshape feature-map into a style-vector. Se...
Implement the Python class `StyleReshape` described below. Class description: Implement the StyleReshape class. Method signatures and docstrings: - def __init__(self, in_channels: int, style_channels: int, normalization: str='bn', convolution: str='conv', **kwargs) -> None: Reshape feature-map into a style-vector. Se...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class StyleReshape: def __init__(self, in_channels: int, style_channels: int, normalization: str='bn', convolution: str='conv', **kwargs) -> None: """Reshape feature-map into a style-vector. See Cellpose. Cellpose: - https://www.nature.com/articles/s41592-020-01018-x Takes in a feature map (B,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StyleReshape: def __init__(self, in_channels: int, style_channels: int, normalization: str='bn', convolution: str='conv', **kwargs) -> None: """Reshape feature-map into a style-vector. See Cellpose. Cellpose: - https://www.nature.com/articles/s41592-020-01018-x Takes in a feature map (B, C, H, W). The...
the_stack_v2_python_sparse
cellseg_models_pytorch/modules/misc_modules.py
okunator/cellseg_models.pytorch
train
43
b5f32f84124af5ab1349b23a8d6ccc05ade5e833
[ "super().__init__()\nself.predict_ntype = predict_ntype\nself.adapt_fcs = nn.ModuleDict({ntype: nn.Linear(in_dim, hidden_dim) for ntype, in_dim in in_dims.items()})\nself.layers = nn.ModuleList([HGTLayer(hidden_dim, hidden_dim, num_heads, ntypes, etypes, dropout, use_norm) for _ in range(num_layers)])\nself.predict...
<|body_start_0|> super().__init__() self.predict_ntype = predict_ntype self.adapt_fcs = nn.ModuleDict({ntype: nn.Linear(in_dim, hidden_dim) for ntype, in_dim in in_dims.items()}) self.layers = nn.ModuleList([HGTLayer(hidden_dim, hidden_dim, num_heads, ntypes, etypes, dropout, use_norm) f...
HGT
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HGT: def __init__(self, in_dims, hidden_dim, out_dim, num_heads, ntypes, etypes, predict_ntype, num_layers, dropout=0.2, use_norm=True): """HGT模型 :param in_dims: Dict[str, int] 顶点类型到输入特征维数的映射 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param nty...
stack_v2_sparse_classes_36k_train_016726
8,548
no_license
[ { "docstring": "HGT模型 :param in_dims: Dict[str, int] 顶点类型到输入特征维数的映射 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param ntypes: List[str] 顶点类型列表 :param etypes: List[(str, str, str)] 规范边类型列表 :param predict_ntype: str 待预测顶点类型 :param num_layers: int 层数 :param dropout: dropo...
2
stack_v2_sparse_classes_30k_train_014963
Implement the Python class `HGT` described below. Class description: Implement the HGT class. Method signatures and docstrings: - def __init__(self, in_dims, hidden_dim, out_dim, num_heads, ntypes, etypes, predict_ntype, num_layers, dropout=0.2, use_norm=True): HGT模型 :param in_dims: Dict[str, int] 顶点类型到输入特征维数的映射 :par...
Implement the Python class `HGT` described below. Class description: Implement the HGT class. Method signatures and docstrings: - def __init__(self, in_dims, hidden_dim, out_dim, num_heads, ntypes, etypes, predict_ntype, num_layers, dropout=0.2, use_norm=True): HGT模型 :param in_dims: Dict[str, int] 顶点类型到输入特征维数的映射 :par...
b40071dc9f9fb20f081f4ed4944a7b65de919c18
<|skeleton|> class HGT: def __init__(self, in_dims, hidden_dim, out_dim, num_heads, ntypes, etypes, predict_ntype, num_layers, dropout=0.2, use_norm=True): """HGT模型 :param in_dims: Dict[str, int] 顶点类型到输入特征维数的映射 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param nty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HGT: def __init__(self, in_dims, hidden_dim, out_dim, num_heads, ntypes, etypes, predict_ntype, num_layers, dropout=0.2, use_norm=True): """HGT模型 :param in_dims: Dict[str, int] 顶点类型到输入特征维数的映射 :param hidden_dim: int 隐含特征维数 :param out_dim: int 输出特征维数 :param num_heads: int 注意力头数K :param ntypes: List[str]...
the_stack_v2_python_sparse
gnn/hgt/model.py
deepdumbo/pytorch-tutorial-1
train
0
65faf6d1b9d2b7c2c348ad115c20fc840e0dcd4c
[ "if isinstance(key, int):\n return ESPTransformSuite(key)\nif key not in ESPTransformSuite._member_map_:\n return extend_enum(ESPTransformSuite, key, default)\nreturn ESPTransformSuite[key]", "if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls...
<|body_start_0|> if isinstance(key, int): return ESPTransformSuite(key) if key not in ESPTransformSuite._member_map_: return extend_enum(ESPTransformSuite, key, default) return ESPTransformSuite[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) ...
[ESPTransformSuite] ESP Transform Suite IDs
ESPTransformSuite
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ESPTransformSuite: """[ESPTransformSuite] ESP Transform Suite IDs""" def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|>...
stack_v2_sparse_classes_36k_train_016727
2,727
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite'" }, { "docstring": "Lookup function used when value is not ...
2
null
Implement the Python class `ESPTransformSuite` described below. Class description: [ESPTransformSuite] ESP Transform Suite IDs Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite': Backport support for original codes. Args: key: Key to get enum item. default: Default...
Implement the Python class `ESPTransformSuite` described below. Class description: [ESPTransformSuite] ESP Transform Suite IDs Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite': Backport support for original codes. Args: key: Key to get enum item. default: Default...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class ESPTransformSuite: """[ESPTransformSuite] ESP Transform Suite IDs""" def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ESPTransformSuite: """[ESPTransformSuite] ESP Transform Suite IDs""" def get(key: 'int | str', default: 'int'=-1) -> 'ESPTransformSuite': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isinstance(key, int)...
the_stack_v2_python_sparse
pcapkit/const/hip/esp_transform_suite.py
JarryShaw/PyPCAPKit
train
204
a6a99ba75e9744fd4886bb06b052b77bea153e13
[ "res = self.sumNumbers_(root)\nres = [int(i) for i in res]\nreturn sum(res)", "if root is None:\n return []\nif root.left is None and root.right is None:\n return [str(root.val)]\nleft_sum: List[str] = self.sumNumbers_(root.left)\nres = []\nfor i in left_sum:\n res.append(str(root.val) + str(i))\nprint(r...
<|body_start_0|> res = self.sumNumbers_(root) res = [int(i) for i in res] return sum(res) <|end_body_0|> <|body_start_1|> if root is None: return [] if root.left is None and root.right is None: return [str(root.val)] left_sum: List[str] = self.sum...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def sumNumbers(self, root: TreeNode) -> int: """从根节点到叶子节点的数字之和""" <|body_0|> def sumNumbers_(self, root: TreeNode) -> List[str]: """创建这个函数的原因是 # 输入:root = [4,9,0,5,1] 左边有两个路径495,491 那么左边应该返回是一个List [95,91], 然后再去加上根节点, 用List[str]的原因是中间有00的情况,转化为int会丢掉 :rtype...
stack_v2_sparse_classes_36k_train_016728
2,100
no_license
[ { "docstring": "从根节点到叶子节点的数字之和", "name": "sumNumbers", "signature": "def sumNumbers(self, root: TreeNode) -> int" }, { "docstring": "创建这个函数的原因是 # 输入:root = [4,9,0,5,1] 左边有两个路径495,491 那么左边应该返回是一个List [95,91], 然后再去加上根节点, 用List[str]的原因是中间有00的情况,转化为int会丢掉 :rtype: object", "name": "sumNumbers_", ...
2
stack_v2_sparse_classes_30k_train_019763
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumNumbers(self, root: TreeNode) -> int: 从根节点到叶子节点的数字之和 - def sumNumbers_(self, root: TreeNode) -> List[str]: 创建这个函数的原因是 # 输入:root = [4,9,0,5,1] 左边有两个路径495,491 那么左边应该返回是一个Lis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def sumNumbers(self, root: TreeNode) -> int: 从根节点到叶子节点的数字之和 - def sumNumbers_(self, root: TreeNode) -> List[str]: 创建这个函数的原因是 # 输入:root = [4,9,0,5,1] 左边有两个路径495,491 那么左边应该返回是一个Lis...
cd46cf08a580c418cc40a68bf9b32371fc69a803
<|skeleton|> class Solution: def sumNumbers(self, root: TreeNode) -> int: """从根节点到叶子节点的数字之和""" <|body_0|> def sumNumbers_(self, root: TreeNode) -> List[str]: """创建这个函数的原因是 # 输入:root = [4,9,0,5,1] 左边有两个路径495,491 那么左边应该返回是一个List [95,91], 然后再去加上根节点, 用List[str]的原因是中间有00的情况,转化为int会丢掉 :rtype...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def sumNumbers(self, root: TreeNode) -> int: """从根节点到叶子节点的数字之和""" res = self.sumNumbers_(root) res = [int(i) for i in res] return sum(res) def sumNumbers_(self, root: TreeNode) -> List[str]: """创建这个函数的原因是 # 输入:root = [4,9,0,5,1] 左边有两个路径495,491 那么左边应该返回是一个...
the_stack_v2_python_sparse
tree/129 sumNumbers.py
pangyouzhen/data-structure
train
0
697296e524064e82a251c7e26e7ad5629104e8b0
[ "question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nmy_survey.store_response('English')\nself.assertIn('English', my_survey.responses)", "question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nresponses = ['english', 'spanish'...
<|body_start_0|> question = 'What language did you first learn to speak?' my_survey = AnonymousSurvey(question) my_survey.store_response('English') self.assertIn('English', my_survey.responses) <|end_body_0|> <|body_start_1|> question = 'What language did you first learn to spea...
Tests for the class AnonymousSurvey
TestAnonymousSurvey
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAnonymousSurvey: """Tests for the class AnonymousSurvey""" def test_store_single_response(self): """Test that a single response is stored properly""" <|body_0|> def test_store_three_responses(self): """Test that a single response is stored properly""" ...
stack_v2_sparse_classes_36k_train_016729
980
no_license
[ { "docstring": "Test that a single response is stored properly", "name": "test_store_single_response", "signature": "def test_store_single_response(self)" }, { "docstring": "Test that a single response is stored properly", "name": "test_store_three_responses", "signature": "def test_stor...
2
stack_v2_sparse_classes_30k_train_012784
Implement the Python class `TestAnonymousSurvey` described below. Class description: Tests for the class AnonymousSurvey Method signatures and docstrings: - def test_store_single_response(self): Test that a single response is stored properly - def test_store_three_responses(self): Test that a single response is store...
Implement the Python class `TestAnonymousSurvey` described below. Class description: Tests for the class AnonymousSurvey Method signatures and docstrings: - def test_store_single_response(self): Test that a single response is stored properly - def test_store_three_responses(self): Test that a single response is store...
81160304d8ef66ecde1bfd194261a5164cc934dd
<|skeleton|> class TestAnonymousSurvey: """Tests for the class AnonymousSurvey""" def test_store_single_response(self): """Test that a single response is stored properly""" <|body_0|> def test_store_three_responses(self): """Test that a single response is stored properly""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAnonymousSurvey: """Tests for the class AnonymousSurvey""" def test_store_single_response(self): """Test that a single response is stored properly""" question = 'What language did you first learn to speak?' my_survey = AnonymousSurvey(question) my_survey.store_response...
the_stack_v2_python_sparse
chapter_11/test_survey.py
Raihan9797/Python-Crash-Course
train
0
2125b2483ac6a846fa5c12e4ed03d12e74be0b07
[ "r, phi = param_util.cart2polar(x, y, center_x=center_x, center_y=center_y)\nf_ = r * a_m / (1 - m ** 2) * np.cos(m * (phi - phi_m))\nreturn f_", "r, phi = param_util.cart2polar(x, y, center_x=center_x, center_y=center_y)\nf_x = np.cos(phi) * a_m / (1 - m ** 2) * np.cos(m * (phi - phi_m)) + np.sin(phi) * m * a_m ...
<|body_start_0|> r, phi = param_util.cart2polar(x, y, center_x=center_x, center_y=center_y) f_ = r * a_m / (1 - m ** 2) * np.cos(m * (phi - phi_m)) return f_ <|end_body_0|> <|body_start_1|> r, phi = param_util.cart2polar(x, y, center_x=center_x, center_y=center_y) f_x = np.cos(p...
This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole strength phi_m : float, multipole orientation in radian
Multipole
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Multipole: """This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole strength phi_m : float, multipole orientat...
stack_v2_sparse_classes_36k_train_016730
3,657
permissive
[ { "docstring": "Lensing potential of multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf :param x: x-coordinate to evaluate function :param y: y-coordinate to evaluate function :param m: int, multipole order, m>=...
3
stack_v2_sparse_classes_30k_train_011808
Implement the Python class `Multipole` described below. Class description: This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole str...
Implement the Python class `Multipole` described below. Class description: This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole str...
902a0f318da46bd444d408853f40f744603e2f35
<|skeleton|> class Multipole: """This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole strength phi_m : float, multipole orientat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Multipole: """This class contains a multipole contribution (for 1 component with m>=2) This uses the same definitions as Xu et al.(2013) in Appendix B3 https://arxiv.org/pdf/1307.4220.pdf Equation B12 m : int, multipole order, m>=2 a_m : float, multipole strength phi_m : float, multipole orientation in radian...
the_stack_v2_python_sparse
lenstronomy/LensModel/Profiles/multipole.py
sibirrer/lenstronomy
train
115
76dbc748f8e3aeace1c514cb0b485559fe636073
[ "self._logger = logging.getLogger(__name__)\n'Logger: The logger for this class.'\nself._job_store = job_store\n'The JobStore to obtain jobs from.'\nself._username = None\n'The remote user to connect as.'\nself._remote_cwlrunner = remote_cwlrunner\n'str: The remote path to the cwl runner executable.'\nself._sched =...
<|body_start_0|> self._logger = logging.getLogger(__name__) 'Logger: The logger for this class.' self._job_store = job_store 'The JobStore to obtain jobs from.' self._username = None 'The remote user to connect as.' self._remote_cwlrunner = remote_cwlrunner ...
JobRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobRunner: def __init__(self, job_store: SQLiteJobStore, config: Config, remote_cwlrunner: str) -> None: """Create a JobRunner object. Args: job_store: The job store to get jobs from. config: The configuration. remote_cwlrunner: The location of the CWL runner to use.""" <|body_0|...
stack_v2_sparse_classes_36k_train_016731
5,414
permissive
[ { "docstring": "Create a JobRunner object. Args: job_store: The job store to get jobs from. config: The configuration. remote_cwlrunner: The location of the CWL runner to use.", "name": "__init__", "signature": "def __init__(self, job_store: SQLiteJobStore, config: Config, remote_cwlrunner: str) -> None...
4
stack_v2_sparse_classes_30k_train_019154
Implement the Python class `JobRunner` described below. Class description: Implement the JobRunner class. Method signatures and docstrings: - def __init__(self, job_store: SQLiteJobStore, config: Config, remote_cwlrunner: str) -> None: Create a JobRunner object. Args: job_store: The job store to get jobs from. config...
Implement the Python class `JobRunner` described below. Class description: Implement the JobRunner class. Method signatures and docstrings: - def __init__(self, job_store: SQLiteJobStore, config: Config, remote_cwlrunner: str) -> None: Create a JobRunner object. Args: job_store: The job store to get jobs from. config...
f8ff51629d1198200bd84d59e78ca456321af940
<|skeleton|> class JobRunner: def __init__(self, job_store: SQLiteJobStore, config: Config, remote_cwlrunner: str) -> None: """Create a JobRunner object. Args: job_store: The job store to get jobs from. config: The configuration. remote_cwlrunner: The location of the CWL runner to use.""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobRunner: def __init__(self, job_store: SQLiteJobStore, config: Config, remote_cwlrunner: str) -> None: """Create a JobRunner object. Args: job_store: The job store to get jobs from. config: The configuration. remote_cwlrunner: The location of the CWL runner to use.""" self._logger = logging....
the_stack_v2_python_sparse
cerise/back_end/job_runner.py
MD-Studio/cerise
train
10
1be1735112a3fcd166c986e007ac6ba66be0ffe3
[ "title = 'Commission'\ndate_str = ''\nyear_str = ''\nfor item in response.css('.ms-rtestate-field > *'):\n if item.root.tag == 'h2':\n title = item.xpath('./text()').extract_first()\n continue\n if item.root.tag == 'h3':\n year_str = item.xpath('./text()').extract_first()\n continu...
<|body_start_0|> title = 'Commission' date_str = '' year_str = '' for item in response.css('.ms-rtestate-field > *'): if item.root.tag == 'h2': title = item.xpath('./text()').extract_first() continue if item.root.tag == 'h3': ...
IlEnvironmentalJusticeSpider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IlEnvironmentalJusticeSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_classification(self, title): """Parse or generate clas...
stack_v2_sparse_classes_36k_train_016732
4,301
permissive
[ { "docstring": "`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.", "name": "parse", "signature": "def parse(self, response)" }, { "docstring": "Parse or generate classification from allowed options.", "name": "_pa...
4
null
Implement the Python class `IlEnvironmentalJusticeSpider` described below. Class description: Implement the IlEnvironmentalJusticeSpider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your...
Implement the Python class `IlEnvironmentalJusticeSpider` described below. Class description: Implement the IlEnvironmentalJusticeSpider class. Method signatures and docstrings: - def parse(self, response): `parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your...
611fce6a2705446e25a2fc33e32090a571eb35d1
<|skeleton|> class IlEnvironmentalJusticeSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" <|body_0|> def _parse_classification(self, title): """Parse or generate clas...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IlEnvironmentalJusticeSpider: def parse(self, response): """`parse` should always `yield` Meeting items. Change the `_parse_title`, `_parse_start`, etc methods to fit your scraping needs.""" title = 'Commission' date_str = '' year_str = '' for item in response.css('.ms-...
the_stack_v2_python_sparse
city_scrapers/spiders/il_environmental_justice.py
City-Bureau/city-scrapers
train
308
4cec7813fa60b0c381cb6fe43b878b12905d9fc3
[ "results = []\nallInts = Int + Uint\nfor function in contract.functions_declared:\n f_results = set()\n for node in function.nodes:\n for ir in node.irs:\n if isinstance(ir, Binary) and ir.type in self.flip_table:\n if isinstance(ir.variable_left, Constant):\n ...
<|body_start_0|> results = [] allInts = Int + Uint for function in contract.functions_declared: f_results = set() for node in function.nodes: for ir in node.irs: if isinstance(ir, Binary) and ir.type in self.flip_table: ...
Type-based tautology or contradiction
TypeBasedTautology
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TypeBasedTautology: """Type-based tautology or contradiction""" def detect_type_based_tautologies(self, contract): """Detects and returns all nodes with tautology/contradiction comparisons (based on type alone). :param contract: Contract to detect assignment within. :return: A list o...
stack_v2_sparse_classes_36k_train_016733
5,484
no_license
[ { "docstring": "Detects and returns all nodes with tautology/contradiction comparisons (based on type alone). :param contract: Contract to detect assignment within. :return: A list of nodes with tautolgies/contradictions.", "name": "detect_type_based_tautologies", "signature": "def detect_type_based_tau...
2
null
Implement the Python class `TypeBasedTautology` described below. Class description: Type-based tautology or contradiction Method signatures and docstrings: - def detect_type_based_tautologies(self, contract): Detects and returns all nodes with tautology/contradiction comparisons (based on type alone). :param contract...
Implement the Python class `TypeBasedTautology` described below. Class description: Type-based tautology or contradiction Method signatures and docstrings: - def detect_type_based_tautologies(self, contract): Detects and returns all nodes with tautology/contradiction comparisons (based on type alone). :param contract...
7a55877bdde0d6adabe3ce9c4f92e8ba20b4b3cc
<|skeleton|> class TypeBasedTautology: """Type-based tautology or contradiction""" def detect_type_based_tautologies(self, contract): """Detects and returns all nodes with tautology/contradiction comparisons (based on type alone). :param contract: Contract to detect assignment within. :return: A list o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TypeBasedTautology: """Type-based tautology or contradiction""" def detect_type_based_tautologies(self, contract): """Detects and returns all nodes with tautology/contradiction comparisons (based on type alone). :param contract: Contract to detect assignment within. :return: A list of nodes with ...
the_stack_v2_python_sparse
fortress/detectors/statements/type_based_tautology.py
bydolson/fortress-security-audit-engine
train
0
33aeb53524132e3e81b43fd854f442af1cf8ce2b
[ "super().__init__(*args, **kwargs)\nself._callback_fn = callback_fn\nself._current_task_info = None", "task_name = task['name']\nif task_name == 'resource':\n return self._callback_fn['deal_with_resource']()\nelif task_name == 'collector_start_task':\n self._current_task_info = task['task_info']\n self._...
<|body_start_0|> super().__init__(*args, **kwargs) self._callback_fn = callback_fn self._current_task_info = None <|end_body_0|> <|body_start_1|> task_name = task['name'] if task_name == 'resource': return self._callback_fn['deal_with_resource']() elif task_n...
Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task
CollectorSlave
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectorSlave: """Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task""" def __init__(self, *args, callback_fn: Dict[str, Callable], **kwargs) -> None: """Overview: Init callback functions a...
stack_v2_sparse_classes_36k_train_016734
8,845
permissive
[ { "docstring": "Overview: Init callback functions additionally. Callback functions are methods in comm collector.", "name": "__init__", "signature": "def __init__(self, *args, callback_fn: Dict[str, Callable], **kwargs) -> None" }, { "docstring": "Overview: Process a task according to input task...
2
stack_v2_sparse_classes_30k_train_012080
Implement the Python class `CollectorSlave` described below. Class description: Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task Method signatures and docstrings: - def __init__(self, *args, callback_fn: Dict[str, Callable...
Implement the Python class `CollectorSlave` described below. Class description: Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task Method signatures and docstrings: - def __init__(self, *args, callback_fn: Dict[str, Callable...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class CollectorSlave: """Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task""" def __init__(self, *args, callback_fn: Dict[str, Callable], **kwargs) -> None: """Overview: Init callback functions a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollectorSlave: """Overview: A slave, whose master is coordinator. Used to pass message between comm collector and coordinator. Interfaces: __init__, _process_task""" def __init__(self, *args, callback_fn: Dict[str, Callable], **kwargs) -> None: """Overview: Init callback functions additionally. ...
the_stack_v2_python_sparse
ding/worker/collector/comm/flask_fs_collector.py
shengxuesun/DI-engine
train
1
ce20f94ac8a6b5ea5cebc5a581fe60168cbd28a3
[ "unconfirmed_orders = self.filtered(lambda so: so.state not in ['sale', 'done'])\nunconfirmed_orders.invoice_status = 'no'\nconfirmed_orders = self - unconfirmed_orders\nif not confirmed_orders:\n return\nline_invoice_status_all = [(d['order_id'][0], d['invoice_status']) for d in self.env['sale.order.line'].read...
<|body_start_0|> unconfirmed_orders = self.filtered(lambda so: so.state not in ['sale', 'done']) unconfirmed_orders.invoice_status = 'no' confirmed_orders = self - unconfirmed_orders if not confirmed_orders: return line_invoice_status_all = [(d['order_id'][0], d['invo...
SaleOrder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaleOrder: def _get_invoice_status(self): """Compute the invoice status of a SO. Possible statuses: - no: if the SO is not in status 'sale' or 'done', we consider that there is nothing to invoice. This is also the default value if the conditions of no other status is met. - to invoice: i...
stack_v2_sparse_classes_36k_train_016735
4,886
no_license
[ { "docstring": "Compute the invoice status of a SO. Possible statuses: - no: if the SO is not in status 'sale' or 'done', we consider that there is nothing to invoice. This is also the default value if the conditions of no other status is met. - to invoice: if any SO line is 'to invoice', the whole SO is 'to in...
2
stack_v2_sparse_classes_30k_train_007781
Implement the Python class `SaleOrder` described below. Class description: Implement the SaleOrder class. Method signatures and docstrings: - def _get_invoice_status(self): Compute the invoice status of a SO. Possible statuses: - no: if the SO is not in status 'sale' or 'done', we consider that there is nothing to in...
Implement the Python class `SaleOrder` described below. Class description: Implement the SaleOrder class. Method signatures and docstrings: - def _get_invoice_status(self): Compute the invoice status of a SO. Possible statuses: - no: if the SO is not in status 'sale' or 'done', we consider that there is nothing to in...
527ca57ace3d10f4f76ef0fd8a46f9f4a0581cc9
<|skeleton|> class SaleOrder: def _get_invoice_status(self): """Compute the invoice status of a SO. Possible statuses: - no: if the SO is not in status 'sale' or 'done', we consider that there is nothing to invoice. This is also the default value if the conditions of no other status is met. - to invoice: i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaleOrder: def _get_invoice_status(self): """Compute the invoice status of a SO. Possible statuses: - no: if the SO is not in status 'sale' or 'done', we consider that there is nothing to invoice. This is also the default value if the conditions of no other status is met. - to invoice: if any SO line ...
the_stack_v2_python_sparse
custom_modules/sale_report_custom/models/sale_invoice_status_custom.py
westlyou/foodsfortomorrow
train
0
63dd27f99a9810668af35ffa0b8ba9f3d173fb94
[ "self.root = Node()\nfor word in data:\n self.add(word)", "node = self.root\nfor c in word:\n if c not in node.children:\n node.children[c] = Node()\n node = node.children[c]\nnode.is_word = True", "node = self.root\nfor c in prefix:\n if c not in node.children:\n return False\n nod...
<|body_start_0|> self.root = Node() for word in data: self.add(word) <|end_body_0|> <|body_start_1|> node = self.root for c in word: if c not in node.children: node.children[c] = Node() node = node.children[c] node.is_word = Tr...
Dictionary class that looks like a trie
Dictionary
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dictionary: """Dictionary class that looks like a trie""" def __init__(self, data: List[str]): """:param data: list of words :type data: List[str]""" <|body_0|> def add(self, word): """Add the word into the dictionary""" <|body_1|> def is_prefix(self...
stack_v2_sparse_classes_36k_train_016736
1,379
no_license
[ { "docstring": ":param data: list of words :type data: List[str]", "name": "__init__", "signature": "def __init__(self, data: List[str])" }, { "docstring": "Add the word into the dictionary", "name": "add", "signature": "def add(self, word)" }, { "docstring": ":return: True if th...
4
stack_v2_sparse_classes_30k_train_006102
Implement the Python class `Dictionary` described below. Class description: Dictionary class that looks like a trie Method signatures and docstrings: - def __init__(self, data: List[str]): :param data: list of words :type data: List[str] - def add(self, word): Add the word into the dictionary - def is_prefix(self, pr...
Implement the Python class `Dictionary` described below. Class description: Dictionary class that looks like a trie Method signatures and docstrings: - def __init__(self, data: List[str]): :param data: list of words :type data: List[str] - def add(self, word): Add the word into the dictionary - def is_prefix(self, pr...
597964f0dbe07f335d8cd5a8a0f8439039940ea8
<|skeleton|> class Dictionary: """Dictionary class that looks like a trie""" def __init__(self, data: List[str]): """:param data: list of words :type data: List[str]""" <|body_0|> def add(self, word): """Add the word into the dictionary""" <|body_1|> def is_prefix(self...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dictionary: """Dictionary class that looks like a trie""" def __init__(self, data: List[str]): """:param data: list of words :type data: List[str]""" self.root = Node() for word in data: self.add(word) def add(self, word): """Add the word into the dictiona...
the_stack_v2_python_sparse
nfadeeva/assignment3/dictionary.py
flerdacodeu/CodeU-2018-Group7
train
0
6f9caafc549beea5b3756706faed5ee5ee719966
[ "self.ser = serial.Serial(port=serial_port, timeout=timeout, write_timeout=write_timeout)\nself._serial_port = serial_port\nself._attr_name = name\nself._attributes = {LAMP_HOURS: STATE_UNKNOWN, INPUT_SOURCE: STATE_UNKNOWN, ECO_MODE: STATE_UNKNOWN}", "ret = ''\ntry:\n if not self.ser.is_open:\n self.ser...
<|body_start_0|> self.ser = serial.Serial(port=serial_port, timeout=timeout, write_timeout=write_timeout) self._serial_port = serial_port self._attr_name = name self._attributes = {LAMP_HOURS: STATE_UNKNOWN, INPUT_SOURCE: STATE_UNKNOWN, ECO_MODE: STATE_UNKNOWN} <|end_body_0|> <|body_sta...
Represents an Acer Projector as a switch.
AcerSwitch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AcerSwitch: """Represents an Acer Projector as a switch.""" def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None: """Init of the Acer projector.""" <|body_0|> def _write_read(self, msg: str) -> str: """Write to the projector a...
stack_v2_sparse_classes_36k_train_016737
4,527
permissive
[ { "docstring": "Init of the Acer projector.", "name": "__init__", "signature": "def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None" }, { "docstring": "Write to the projector and read the return.", "name": "_write_read", "signature": "def _write_read...
6
stack_v2_sparse_classes_30k_train_013061
Implement the Python class `AcerSwitch` described below. Class description: Represents an Acer Projector as a switch. Method signatures and docstrings: - def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None: Init of the Acer projector. - def _write_read(self, msg: str) -> str: Wri...
Implement the Python class `AcerSwitch` described below. Class description: Represents an Acer Projector as a switch. Method signatures and docstrings: - def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None: Init of the Acer projector. - def _write_read(self, msg: str) -> str: Wri...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class AcerSwitch: """Represents an Acer Projector as a switch.""" def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None: """Init of the Acer projector.""" <|body_0|> def _write_read(self, msg: str) -> str: """Write to the projector a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AcerSwitch: """Represents an Acer Projector as a switch.""" def __init__(self, serial_port: str, name: str, timeout: int, write_timeout: int) -> None: """Init of the Acer projector.""" self.ser = serial.Serial(port=serial_port, timeout=timeout, write_timeout=write_timeout) self._s...
the_stack_v2_python_sparse
homeassistant/components/acer_projector/switch.py
home-assistant/core
train
35,501
e7c93a36e6cc5fbe90c6faaa7f64a7a79d8469cc
[ "self.protocol = self.dstype[datasourcetype]\nself.kwargs = kwargs\nmodule_ = importlib.import_module('contextmonkey.tracelayer.handlers.%s.%sRequestHandlerFactory' % (self.protocol.lower(), self.protocol))\nclass_ = getattr(module_, '%sRequestHandlerFactory' % self.protocol)\nself.datasourcehandlerconnection = cla...
<|body_start_0|> self.protocol = self.dstype[datasourcetype] self.kwargs = kwargs module_ = importlib.import_module('contextmonkey.tracelayer.handlers.%s.%sRequestHandlerFactory' % (self.protocol.lower(), self.protocol)) class_ = getattr(module_, '%sRequestHandlerFactory' % self.protocol...
Provide methods to fetch traces from file, model, and database.
DataSourceHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataSourceHandler: """Provide methods to fetch traces from file, model, and database.""" def __init__(self, datasourcetype, **kwargs): """Initialize appropriate source handler factory.""" <|body_0|> def executeFetch(self, uuid, modality): """Forward trace fetch r...
stack_v2_sparse_classes_36k_train_016738
4,232
no_license
[ { "docstring": "Initialize appropriate source handler factory.", "name": "__init__", "signature": "def __init__(self, datasourcetype, **kwargs)" }, { "docstring": "Forward trace fetch request to appropriate source handler factory.", "name": "executeFetch", "signature": "def executeFetch(...
2
stack_v2_sparse_classes_30k_test_000664
Implement the Python class `DataSourceHandler` described below. Class description: Provide methods to fetch traces from file, model, and database. Method signatures and docstrings: - def __init__(self, datasourcetype, **kwargs): Initialize appropriate source handler factory. - def executeFetch(self, uuid, modality): ...
Implement the Python class `DataSourceHandler` described below. Class description: Provide methods to fetch traces from file, model, and database. Method signatures and docstrings: - def __init__(self, datasourcetype, **kwargs): Initialize appropriate source handler factory. - def executeFetch(self, uuid, modality): ...
9974889a726d7f60c6da0d6ccab97113ce635a14
<|skeleton|> class DataSourceHandler: """Provide methods to fetch traces from file, model, and database.""" def __init__(self, datasourcetype, **kwargs): """Initialize appropriate source handler factory.""" <|body_0|> def executeFetch(self, uuid, modality): """Forward trace fetch r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataSourceHandler: """Provide methods to fetch traces from file, model, and database.""" def __init__(self, datasourcetype, **kwargs): """Initialize appropriate source handler factory.""" self.protocol = self.dstype[datasourcetype] self.kwargs = kwargs module_ = importlib....
the_stack_v2_python_sparse
contextmonkey/tracelayer/handlers/DataSourceHandler.py
manojrege/contextmonkey
train
6
a7bd2a80bcf6a27c11ef916604536f12ff6d21f2
[ "content = parent._content\nif content is not None:\n content = build_graves_on_subsection(content, path)\n if content is None:\n DocWarning(path, 'Listing element with empty content.')\nhead = parent._head\nif head is None:\n DocWarning(path, 'Listing element without empty head.')\nelse:\n head,...
<|body_start_0|> content = parent._content if content is not None: content = build_graves_on_subsection(content, path) if content is None: DocWarning(path, 'Listing element with empty content.') head = parent._head if head is None: DocW...
Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element.
GravedListingElement
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GravedListingElement: """Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element.""" def __new__(cls, parent, path): ...
stack_v2_sparse_classes_36k_train_016739
25,556
permissive
[ { "docstring": "Creates a new graved listing element. Parameters ---------- parent : ``TextListingElement`` The source listing element. path : ``QualPath`` The path of the respective docstring. Returns ------- self : `None`, ``GravedListingElement`` Returns `None`, if would have been creating an empty listing e...
2
stack_v2_sparse_classes_30k_train_010428
Implement the Python class `GravedListingElement` described below. Class description: Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element. Method ...
Implement the Python class `GravedListingElement` described below. Class description: Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element. Method ...
53f24fdb38459dc5a4fd04f11bdbfee8295b76a4
<|skeleton|> class GravedListingElement: """Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element.""" def __new__(cls, parent, path): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GravedListingElement: """Represents a graved listing element. Attributes ---------- content : `None`, `list` of (`str`, ``Grave``) The graved content of the listing element. head : `None`, `list` of (`str`, ``Grave``) The graved head of the element.""" def __new__(cls, parent, path): """Creates a...
the_stack_v2_python_sparse
hata/ext/patchouli/graver.py
HuyaneMatsu/hata
train
3
c08a846ebee5b57f0c4724033fc390764c341b61
[ "super().__init__(enclosure)\nself.redfish['ChassisType'] = 'Enclosure'\nself.redfish['Model'] = enclosure['enclosureModel']\nself.redfish['IndicatorLED'] = self._map_indicator_led(enclosure['uidState'])\nself.redfish['Links']['Contains'] = list()\nself._set_links_to_computer_system(enclosure['deviceBays'])\nself.r...
<|body_start_0|> super().__init__(enclosure) self.redfish['ChassisType'] = 'Enclosure' self.redfish['Model'] = enclosure['enclosureModel'] self.redfish['IndicatorLED'] = self._map_indicator_led(enclosure['uidState']) self.redfish['Links']['Contains'] = list() self._set_li...
Creates an Enclosure Chassis Redfish dict Populates self.redfish with some hardcoded Enclosure Chassis values and with the response of OneView enclosure resources.
EnclosureChassis
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnclosureChassis: """Creates an Enclosure Chassis Redfish dict Populates self.redfish with some hardcoded Enclosure Chassis values and with the response of OneView enclosure resources.""" def __init__(self, enclosure, environmental_configuration, manager_uuid): """Enclosure Chassis c...
stack_v2_sparse_classes_36k_train_016740
4,192
permissive
[ { "docstring": "Enclosure Chassis constructor Populates self.redfish with hardcoded Enclosure Chassis values and with the response of OneView enclosure. Args: enclosure: An object containing the Oneview enclosure to create the Redfish JSON. environmental_configuration: An object having information about the rac...
3
stack_v2_sparse_classes_30k_val_000352
Implement the Python class `EnclosureChassis` described below. Class description: Creates an Enclosure Chassis Redfish dict Populates self.redfish with some hardcoded Enclosure Chassis values and with the response of OneView enclosure resources. Method signatures and docstrings: - def __init__(self, enclosure, enviro...
Implement the Python class `EnclosureChassis` described below. Class description: Creates an Enclosure Chassis Redfish dict Populates self.redfish with some hardcoded Enclosure Chassis values and with the response of OneView enclosure resources. Method signatures and docstrings: - def __init__(self, enclosure, enviro...
ffc86ea0a9e5d192ab6a2fe21c1717957b55d1da
<|skeleton|> class EnclosureChassis: """Creates an Enclosure Chassis Redfish dict Populates self.redfish with some hardcoded Enclosure Chassis values and with the response of OneView enclosure resources.""" def __init__(self, enclosure, environmental_configuration, manager_uuid): """Enclosure Chassis c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EnclosureChassis: """Creates an Enclosure Chassis Redfish dict Populates self.redfish with some hardcoded Enclosure Chassis values and with the response of OneView enclosure resources.""" def __init__(self, enclosure, environmental_configuration, manager_uuid): """Enclosure Chassis constructor Po...
the_stack_v2_python_sparse
oneview_redfish_toolkit/api/enclosure_chassis.py
shobhit-sinha/oneview-redfish-toolkit
train
2
c17a8bce2977f8585dcf4b55dbd0d230813bf14b
[ "self.audit_log_dest = audit_log_dest\nself.bct_file_path = bct_file_path\nself.control_file_path_vec = control_file_path_vec\nself.db_config_file_path = db_config_file_path\nself.diag_dest = diag_dest\nself.enable_archive_log_mode = enable_archive_log_mode\nself.fra_dest = fra_dest\nself.fra_size_mb = fra_size_mb\...
<|body_start_0|> self.audit_log_dest = audit_log_dest self.bct_file_path = bct_file_path self.control_file_path_vec = control_file_path_vec self.db_config_file_path = db_config_file_path self.diag_dest = diag_dest self.enable_archive_log_mode = enable_archive_log_mode ...
Implementation of the 'OracleDBConfig' model. This proto captures the oracle database configuration for alternate DB restore. Attributes: audit_log_dest (string): Audit log destination. bct_file_path (string): BCT file path. control_file_path_vec (list of string): List of paths where the control file needs to be multip...
OracleDBConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OracleDBConfig: """Implementation of the 'OracleDBConfig' model. This proto captures the oracle database configuration for alternate DB restore. Attributes: audit_log_dest (string): Audit log destination. bct_file_path (string): BCT file path. control_file_path_vec (list of string): List of paths...
stack_v2_sparse_classes_36k_train_016741
5,676
permissive
[ { "docstring": "Constructor for the OracleDBConfig class", "name": "__init__", "signature": "def __init__(self, audit_log_dest=None, bct_file_path=None, control_file_path_vec=None, db_config_file_path=None, diag_dest=None, enable_archive_log_mode=None, fra_dest=None, fra_size_mb=None, num_tempfiles=None...
2
null
Implement the Python class `OracleDBConfig` described below. Class description: Implementation of the 'OracleDBConfig' model. This proto captures the oracle database configuration for alternate DB restore. Attributes: audit_log_dest (string): Audit log destination. bct_file_path (string): BCT file path. control_file_p...
Implement the Python class `OracleDBConfig` described below. Class description: Implementation of the 'OracleDBConfig' model. This proto captures the oracle database configuration for alternate DB restore. Attributes: audit_log_dest (string): Audit log destination. bct_file_path (string): BCT file path. control_file_p...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class OracleDBConfig: """Implementation of the 'OracleDBConfig' model. This proto captures the oracle database configuration for alternate DB restore. Attributes: audit_log_dest (string): Audit log destination. bct_file_path (string): BCT file path. control_file_path_vec (list of string): List of paths...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OracleDBConfig: """Implementation of the 'OracleDBConfig' model. This proto captures the oracle database configuration for alternate DB restore. Attributes: audit_log_dest (string): Audit log destination. bct_file_path (string): BCT file path. control_file_path_vec (list of string): List of paths where the co...
the_stack_v2_python_sparse
cohesity_management_sdk/models/oracle_db_config.py
cohesity/management-sdk-python
train
24
d8efa965b2c94d7618bd9fafe511a61f0614a385
[ "if not filepath:\n raise Exception('ERROR: Invalid dataset path.')\nself.type = type\nself.filepath = filepath\nself.up_sites = up_sites\nself.down_sites = down_sites\nself.donor_site = []\nself.acceptor_site = []\nself.neg_donor_site = []\nself.neg_acceptor_site = []\nif self.type not in {'train', 'test'}:\n ...
<|body_start_0|> if not filepath: raise Exception('ERROR: Invalid dataset path.') self.type = type self.filepath = filepath self.up_sites = up_sites self.down_sites = down_sites self.donor_site = [] self.acceptor_site = [] self.neg_donor_site =...
Sequence
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Sequence: def __init__(self, filepath: str, type: str='train', up_sites: int=5, down_sites: int=5) -> None: """All kinds of splice site sequences for training. Parameters ---------- filepath: str or path-like The directory path of the dataset. Files in which are txts containing one seque...
stack_v2_sparse_classes_36k_train_016742
5,098
no_license
[ { "docstring": "All kinds of splice site sequences for training. Parameters ---------- filepath: str or path-like The directory path of the dataset. Files in which are txts containing one sequence each. type: str (one of \"train\", \"test\") Set the data type. Way of reading would be different. up_sites: int, d...
4
stack_v2_sparse_classes_30k_train_006427
Implement the Python class `Sequence` described below. Class description: Implement the Sequence class. Method signatures and docstrings: - def __init__(self, filepath: str, type: str='train', up_sites: int=5, down_sites: int=5) -> None: All kinds of splice site sequences for training. Parameters ---------- filepath:...
Implement the Python class `Sequence` described below. Class description: Implement the Sequence class. Method signatures and docstrings: - def __init__(self, filepath: str, type: str='train', up_sites: int=5, down_sites: int=5) -> None: All kinds of splice site sequences for training. Parameters ---------- filepath:...
3302ff7222d191f632695f0b9465ec2555f1b0af
<|skeleton|> class Sequence: def __init__(self, filepath: str, type: str='train', up_sites: int=5, down_sites: int=5) -> None: """All kinds of splice site sequences for training. Parameters ---------- filepath: str or path-like The directory path of the dataset. Files in which are txts containing one seque...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Sequence: def __init__(self, filepath: str, type: str='train', up_sites: int=5, down_sites: int=5) -> None: """All kinds of splice site sequences for training. Parameters ---------- filepath: str or path-like The directory path of the dataset. Files in which are txts containing one sequence each. type...
the_stack_v2_python_sparse
Utils/extract.py
Newiz430/SplicePredictor
train
1
27030efc0c77340363f09947933f782e14d55a15
[ "if not any((key.startswith('cat_') for key in kwargs.keys())):\n kwargs['cat_pattern'] = CAT_PATTERN\nCategorizedCorpusReader.__init__(self, kwargs)\nCorpusReader.__init__(self, root, fileids, encoding)\nself.tags = tags", "if fileids is not None and categories is not None:\n raise ValueError('Specify file...
<|body_start_0|> if not any((key.startswith('cat_') for key in kwargs.keys())): kwargs['cat_pattern'] = CAT_PATTERN CategorizedCorpusReader.__init__(self, kwargs) CorpusReader.__init__(self, root, fileids, encoding) self.tags = tags <|end_body_0|> <|body_start_1|> if...
A corpus reader for raw HTML documents to enable preprocessing.
HTMLCorpusReader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTMLCorpusReader: """A corpus reader for raw HTML documents to enable preprocessing.""" def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs): """Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are ...
stack_v2_sparse_classes_36k_train_016743
3,637
permissive
[ { "docstring": "Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to the ``CategorizedCorpusReader`` constructor. The remaining arguments are passed to the ``CorpusReader`` constructor.", "name": "__init__", "signature": "def __init__(self...
4
null
Implement the Python class `HTMLCorpusReader` described below. Class description: A corpus reader for raw HTML documents to enable preprocessing. Method signatures and docstrings: - def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs): Initialize the corpus reader. Categorization argume...
Implement the Python class `HTMLCorpusReader` described below. Class description: A corpus reader for raw HTML documents to enable preprocessing. Method signatures and docstrings: - def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs): Initialize the corpus reader. Categorization argume...
43fd3317b641e0830905a734226afad3a0ea19f6
<|skeleton|> class HTMLCorpusReader: """A corpus reader for raw HTML documents to enable preprocessing.""" def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs): """Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HTMLCorpusReader: """A corpus reader for raw HTML documents to enable preprocessing.""" def __init__(self, root, fileids=DOC_PATTERN, encoding='utf8', tags=TAGS, **kwargs): """Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to the...
the_stack_v2_python_sparse
snippets/ch02/reader.py
foxbook/atap
train
401
ca813c490d8b9b04f642140945bdb8fe6c8f1aeb
[ "content_type = ContentType.objects.get_for_model(instance.__class__)\nqueryset = super(RateManager, self).filter(content_type=content_type, object_id=instance.id)\nreturn queryset", "try:\n my_avg = self.filter_by_model(instance).aggregate(Avg('rating'))\nexcept ZeroDivisionError:\n logging.error(error_han...
<|body_start_0|> content_type = ContentType.objects.get_for_model(instance.__class__) queryset = super(RateManager, self).filter(content_type=content_type, object_id=instance.id) return queryset <|end_body_0|> <|body_start_1|> try: my_avg = self.filter_by_model(instance).agg...
RateManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RateManager: def filter_by_model(self, instance): """filter kardane content bar assasse model""" <|body_0|> def avg_rate(self, instance, avg=0): """emtiaz dehi be post bar assasse rate entekhab shude (az 1 ta 5) taghsim bar tedad e user haey ke be in post emtiaz dada...
stack_v2_sparse_classes_36k_train_016744
2,877
permissive
[ { "docstring": "filter kardane content bar assasse model", "name": "filter_by_model", "signature": "def filter_by_model(self, instance)" }, { "docstring": "emtiaz dehi be post bar assasse rate entekhab shude (az 1 ta 5) taghsim bar tedad e user haey ke be in post emtiaz dadan", "name": "avg_...
2
stack_v2_sparse_classes_30k_train_004243
Implement the Python class `RateManager` described below. Class description: Implement the RateManager class. Method signatures and docstrings: - def filter_by_model(self, instance): filter kardane content bar assasse model - def avg_rate(self, instance, avg=0): emtiaz dehi be post bar assasse rate entekhab shude (az...
Implement the Python class `RateManager` described below. Class description: Implement the RateManager class. Method signatures and docstrings: - def filter_by_model(self, instance): filter kardane content bar assasse model - def avg_rate(self, instance, avg=0): emtiaz dehi be post bar assasse rate entekhab shude (az...
aef47922fdd6488550881ed9d42bf30a0d33a32a
<|skeleton|> class RateManager: def filter_by_model(self, instance): """filter kardane content bar assasse model""" <|body_0|> def avg_rate(self, instance, avg=0): """emtiaz dehi be post bar assasse rate entekhab shude (az 1 ta 5) taghsim bar tedad e user haey ke be in post emtiaz dada...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RateManager: def filter_by_model(self, instance): """filter kardane content bar assasse model""" content_type = ContentType.objects.get_for_model(instance.__class__) queryset = super(RateManager, self).filter(content_type=content_type, object_id=instance.id) return queryset ...
the_stack_v2_python_sparse
src/rates/models.py
m3h-D/Myinfoblog
train
0
93fd4d52773593a9dd25aa68a4c3e2c36261f1f6
[ "self.source = None\nself.data = None\nself.size = size\nself.choice_source = []\nself.weight = np.array([])", "self.source = data\nself.data = data\nself._handle_data_source()", "if isinstance(self.source, list):\n self.data = self.source\n self.weight = np.array([])\nelif isinstance(self.source, dict):\...
<|body_start_0|> self.source = None self.data = None self.size = size self.choice_source = [] self.weight = np.array([]) <|end_body_0|> <|body_start_1|> self.source = data self.data = data self._handle_data_source() <|end_body_1|> <|body_start_2|> ...
randomChoice
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class randomChoice: def __init__(self, size: int=5): """随机选择类 外部参数: :param size:生成的数据量总数""" <|body_0|> def add(self, data: [List[Any], Dict]): """添加数据集 :param data: 数据集 :return:""" <|body_1|> def _handle_data_source(self): """处理数据源""" <|body_2|...
stack_v2_sparse_classes_36k_train_016745
2,458
no_license
[ { "docstring": "随机选择类 外部参数: :param size:生成的数据量总数", "name": "__init__", "signature": "def __init__(self, size: int=5)" }, { "docstring": "添加数据集 :param data: 数据集 :return:", "name": "add", "signature": "def add(self, data: [List[Any], Dict])" }, { "docstring": "处理数据源", "name": "...
5
stack_v2_sparse_classes_30k_train_017574
Implement the Python class `randomChoice` described below. Class description: Implement the randomChoice class. Method signatures and docstrings: - def __init__(self, size: int=5): 随机选择类 外部参数: :param size:生成的数据量总数 - def add(self, data: [List[Any], Dict]): 添加数据集 :param data: 数据集 :return: - def _handle_data_source(self...
Implement the Python class `randomChoice` described below. Class description: Implement the randomChoice class. Method signatures and docstrings: - def __init__(self, size: int=5): 随机选择类 外部参数: :param size:生成的数据量总数 - def add(self, data: [List[Any], Dict]): 添加数据集 :param data: 数据集 :return: - def _handle_data_source(self...
a81c897e4481926daaafdbaf89d7087b793cd462
<|skeleton|> class randomChoice: def __init__(self, size: int=5): """随机选择类 外部参数: :param size:生成的数据量总数""" <|body_0|> def add(self, data: [List[Any], Dict]): """添加数据集 :param data: 数据集 :return:""" <|body_1|> def _handle_data_source(self): """处理数据源""" <|body_2|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class randomChoice: def __init__(self, size: int=5): """随机选择类 外部参数: :param size:生成的数据量总数""" self.source = None self.data = None self.size = size self.choice_source = [] self.weight = np.array([]) def add(self, data: [List[Any], Dict]): """添加数据集 :param dat...
the_stack_v2_python_sparse
backend/maybe/patterns/random_choice.py
HalfLeaf/Maybe
train
1
1b0f74feca4f6fe4f71e4405f11880a178f4e31c
[ "self.check_authenticator_managed_groups()\ngroup = self.find_group(group_name)\ndata = self.get_json_body()\nself._check_group_model(data)\nif 'users' not in data:\n raise web.HTTPError(400, 'Must specify users to add')\nself.log.info('Adding %i users to group %s', len(data['users']), group_name)\nself.log.debu...
<|body_start_0|> self.check_authenticator_managed_groups() group = self.find_group(group_name) data = self.get_json_body() self._check_group_model(data) if 'users' not in data: raise web.HTTPError(400, 'Must specify users to add') self.log.info('Adding %i user...
Modify a group's user list
GroupUsersAPIHandler
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupUsersAPIHandler: """Modify a group's user list""" def post(self, group_name): """POST adds users to a group""" <|body_0|> async def delete(self, group_name): """DELETE removes users from a group""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_016746
8,154
permissive
[ { "docstring": "POST adds users to a group", "name": "post", "signature": "def post(self, group_name)" }, { "docstring": "DELETE removes users from a group", "name": "delete", "signature": "async def delete(self, group_name)" } ]
2
stack_v2_sparse_classes_30k_train_016293
Implement the Python class `GroupUsersAPIHandler` described below. Class description: Modify a group's user list Method signatures and docstrings: - def post(self, group_name): POST adds users to a group - async def delete(self, group_name): DELETE removes users from a group
Implement the Python class `GroupUsersAPIHandler` described below. Class description: Modify a group's user list Method signatures and docstrings: - def post(self, group_name): POST adds users to a group - async def delete(self, group_name): DELETE removes users from a group <|skeleton|> class GroupUsersAPIHandler: ...
7757dea8a463e75d8a540e85deee45c1635dd273
<|skeleton|> class GroupUsersAPIHandler: """Modify a group's user list""" def post(self, group_name): """POST adds users to a group""" <|body_0|> async def delete(self, group_name): """DELETE removes users from a group""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupUsersAPIHandler: """Modify a group's user list""" def post(self, group_name): """POST adds users to a group""" self.check_authenticator_managed_groups() group = self.find_group(group_name) data = self.get_json_body() self._check_group_model(data) if 'u...
the_stack_v2_python_sparse
jupyterhub/apihandlers/groups.py
jupyterhub/jupyterhub
train
6,751
1aa9346fa138c7829dddd1202f8af83899087106
[ "try:\n return_data = ''\n return Response(json.dumps(return_data))\nexcept Exception as e:\n return_data = {'status': '404', 'result': str(e)}\n return Response(json.dumps(return_data))", "try:\n return_data = ''\n if type == 'log':\n return_data = RunManagerMoniter().get_view_obj_log(id...
<|body_start_0|> try: return_data = '' return Response(json.dumps(return_data)) except Exception as e: return_data = {'status': '404', 'result': str(e)} return Response(json.dumps(return_data)) <|end_body_0|> <|body_start_1|> try: retu...
RunManagerCelery
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunManagerCelery: def post(self, request, nnid): """CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)""" <|body_0|> def get(self, request, type, id, line): """CRUD of workflow informat...
stack_v2_sparse_classes_36k_train_016747
2,345
permissive
[ { "docstring": "CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)", "name": "post", "signature": "def post(self, request, nnid)" }, { "docstring": "CRUD of workflow information --- # Class Name : RunManagerWorkFlo...
4
stack_v2_sparse_classes_30k_test_000510
Implement the Python class `RunManagerCelery` described below. Class description: Implement the RunManagerCelery class. Method signatures and docstrings: - def post(self, request, nnid): CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet...
Implement the Python class `RunManagerCelery` described below. Class description: Implement the RunManagerCelery class. Method signatures and docstrings: - def post(self, request, nnid): CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet...
6ad2fbc7384e4dbe7e3e63bdb44c8ce0387f4b7f
<|skeleton|> class RunManagerCelery: def post(self, request, nnid): """CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)""" <|body_0|> def get(self, request, type, id, line): """CRUD of workflow informat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunManagerCelery: def post(self, request, nnid): """CRUD of workflow information --- # Class Name : RunManagerWorkFlow # Description: CRUD of workflow information (not implemented yet)""" try: return_data = '' return Response(json.dumps(return_data)) except Exce...
the_stack_v2_python_sparse
api/views/runmanager_celery.py
yurimkoo/tensormsa
train
1
1a75e952d9d3e270051b2c7f7aae701f30d74a93
[ "self.base_filters = filters or []\nself.polling_interval = polling_interval\nself.continue_interval = continue_interval or polling_interval\nself.should_continue = continue_func\nstart_timestamp = _GetTailStartingTimestamp(filters, num_prev_entries)\nlog.debug('start timestamp: {}'.format(start_timestamp))\nself.l...
<|body_start_0|> self.base_filters = filters or [] self.polling_interval = polling_interval self.continue_interval = continue_interval or polling_interval self.should_continue = continue_func start_timestamp = _GetTailStartingTimestamp(filters, num_prev_entries) log.debug...
A class which fetches job logs.
LogFetcher
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LogFetcher: """A class which fetches job logs.""" def __init__(self, filters=None, polling_interval=10, continue_func=lambda x: True, continue_interval=None, num_prev_entries=None): """Initializes the LogFetcher. Args: filters: list of string filters used in the API call. polling_int...
stack_v2_sparse_classes_36k_train_016748
9,319
permissive
[ { "docstring": "Initializes the LogFetcher. Args: filters: list of string filters used in the API call. polling_interval: amount of time to sleep between each poll. continue_func: One-arg function that takes in the number of empty polls and outputs a boolean to decide if we should keep polling or not. If not gi...
3
stack_v2_sparse_classes_30k_train_014302
Implement the Python class `LogFetcher` described below. Class description: A class which fetches job logs. Method signatures and docstrings: - def __init__(self, filters=None, polling_interval=10, continue_func=lambda x: True, continue_interval=None, num_prev_entries=None): Initializes the LogFetcher. Args: filters:...
Implement the Python class `LogFetcher` described below. Class description: A class which fetches job logs. Method signatures and docstrings: - def __init__(self, filters=None, polling_interval=10, continue_func=lambda x: True, continue_interval=None, num_prev_entries=None): Initializes the LogFetcher. Args: filters:...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class LogFetcher: """A class which fetches job logs.""" def __init__(self, filters=None, polling_interval=10, continue_func=lambda x: True, continue_interval=None, num_prev_entries=None): """Initializes the LogFetcher. Args: filters: list of string filters used in the API call. polling_int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LogFetcher: """A class which fetches job logs.""" def __init__(self, filters=None, polling_interval=10, continue_func=lambda x: True, continue_interval=None, num_prev_entries=None): """Initializes the LogFetcher. Args: filters: list of string filters used in the API call. polling_interval: amount...
the_stack_v2_python_sparse
google-cloud-sdk/lib/googlecloudsdk/command_lib/logs/stream.py
bopopescu/socialliteapp
train
0
2db7ed8951cad880e828dbb04b7ad6d53582d307
[ "super(DQNBase, self).__init__()\nencoder_kwargs, lstm_kwargs, head_kwargs = get_kwargs(kwargs)\nself._encoder = Encoder(obs_dim, embedding_dim, **encoder_kwargs)\nif lstm_kwargs['lstm_type'] != 'none':\n lstm_kwargs['input_size'] = embedding_dim\n lstm_kwargs['hidden_size'] = embedding_dim\n self._lstm = ...
<|body_start_0|> super(DQNBase, self).__init__() encoder_kwargs, lstm_kwargs, head_kwargs = get_kwargs(kwargs) self._encoder = Encoder(obs_dim, embedding_dim, **encoder_kwargs) if lstm_kwargs['lstm_type'] != 'none': lstm_kwargs['input_size'] = embedding_dim lstm_k...
Overview: Base class for DQN based models. Interface: __init__, forward, fast_timestep_forward
DQNBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DQNBase: """Overview: Base class for DQN based models. Interface: __init__, forward, fast_timestep_forward""" def __init__(self, obs_dim: Union[int, tuple], action_dim: tuple, embedding_dim: int=64, **kwargs) -> None: """Overview: Init the DQNBase according to arguments, including en...
stack_v2_sparse_classes_36k_train_016749
9,851
permissive
[ { "docstring": "Overview: Init the DQNBase according to arguments, including encoder, lstm(if needed) and head. Arguments: - obs_dim (:obj:`Union[int, tuple]`): a tuple of observation dim - action_dim (:obj:`int`): the num of action dim, \\\\ note that it can be a tuple containing more than one element - embedd...
3
stack_v2_sparse_classes_30k_train_004912
Implement the Python class `DQNBase` described below. Class description: Overview: Base class for DQN based models. Interface: __init__, forward, fast_timestep_forward Method signatures and docstrings: - def __init__(self, obs_dim: Union[int, tuple], action_dim: tuple, embedding_dim: int=64, **kwargs) -> None: Overvi...
Implement the Python class `DQNBase` described below. Class description: Overview: Base class for DQN based models. Interface: __init__, forward, fast_timestep_forward Method signatures and docstrings: - def __init__(self, obs_dim: Union[int, tuple], action_dim: tuple, embedding_dim: int=64, **kwargs) -> None: Overvi...
09d507c412235a2f0cf9c0b3485ec9ed15fb6421
<|skeleton|> class DQNBase: """Overview: Base class for DQN based models. Interface: __init__, forward, fast_timestep_forward""" def __init__(self, obs_dim: Union[int, tuple], action_dim: tuple, embedding_dim: int=64, **kwargs) -> None: """Overview: Init the DQNBase according to arguments, including en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DQNBase: """Overview: Base class for DQN based models. Interface: __init__, forward, fast_timestep_forward""" def __init__(self, obs_dim: Union[int, tuple], action_dim: tuple, embedding_dim: int=64, **kwargs) -> None: """Overview: Init the DQNBase according to arguments, including encoder, lstm(i...
the_stack_v2_python_sparse
ctools/model/dqn/dqn_network.py
LFhase/DI-star
train
1
15e4ab9e27e989001f959e55b15fea2a585346ff
[ "numsLen = len(nums)\nfor i in range(numsLen):\n while nums[i] < i + 1 and nums[i] > 0 and (nums[i] != nums[nums[i] - 1]):\n temp = nums[nums[i] - 1]\n nums[nums[i] - 1] = nums[i]\n nums[i] = temp\nfor i in range(numsLen):\n if nums[i] != i + 1:\n return i + 1\nreturn numsLen + 1",...
<|body_start_0|> numsLen = len(nums) for i in range(numsLen): while nums[i] < i + 1 and nums[i] > 0 and (nums[i] != nums[nums[i] - 1]): temp = nums[nums[i] - 1] nums[nums[i] - 1] = nums[i] nums[i] = temp for i in range(numsLen): ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int 根据正整数数组的特性, 在原数组的空间上做一次排序, 然后根据索引和值之间的关系得到结果 O(n) & O(k)""" <|body_0|> def firstMissingPositiveFast(self, nums): """:type nums: List[int] :rtype: int 简单易懂且高效 O(n)""" <|body_1...
stack_v2_sparse_classes_36k_train_016750
1,822
permissive
[ { "docstring": ":type nums: List[int] :rtype: int 根据正整数数组的特性, 在原数组的空间上做一次排序, 然后根据索引和值之间的关系得到结果 O(n) & O(k)", "name": "firstMissingPositive", "signature": "def firstMissingPositive(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 简单易懂且高效 O(n)", "name": "firstMissingPositiveFa...
2
stack_v2_sparse_classes_30k_train_018556
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive(self, nums): :type nums: List[int] :rtype: int 根据正整数数组的特性, 在原数组的空间上做一次排序, 然后根据索引和值之间的关系得到结果 O(n) & O(k) - def firstMissingPositiveFast(self, nums): :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def firstMissingPositive(self, nums): :type nums: List[int] :rtype: int 根据正整数数组的特性, 在原数组的空间上做一次排序, 然后根据索引和值之间的关系得到结果 O(n) & O(k) - def firstMissingPositiveFast(self, nums): :type...
9f49766a2b375a6c65f7bfa96df513875ddd772d
<|skeleton|> class Solution: def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int 根据正整数数组的特性, 在原数组的空间上做一次排序, 然后根据索引和值之间的关系得到结果 O(n) & O(k)""" <|body_0|> def firstMissingPositiveFast(self, nums): """:type nums: List[int] :rtype: int 简单易懂且高效 O(n)""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def firstMissingPositive(self, nums): """:type nums: List[int] :rtype: int 根据正整数数组的特性, 在原数组的空间上做一次排序, 然后根据索引和值之间的关系得到结果 O(n) & O(k)""" numsLen = len(nums) for i in range(numsLen): while nums[i] < i + 1 and nums[i] > 0 and (nums[i] != nums[nums[i] - 1]): ...
the_stack_v2_python_sparse
Leetcode/41.firstMissingPositive.py
Song2017/Leetcode_python
train
1
92f9e438254e9ca051e276306f955c51c96eeae1
[ "A = expand(root)\nA.append(val)\nreturn self.constructMaximumBinaryTree(A)", "if len(nums) == 0:\n return None\nif len(nums) == 1:\n return TreeNode(nums[0])\nmaxn = 0\nmaxi = -1\nfor i in range(len(nums)):\n if nums[i] > maxn:\n maxi = i\n maxn = nums[i]\nroot = TreeNode(maxn)\nroot.left ...
<|body_start_0|> A = expand(root) A.append(val) return self.constructMaximumBinaryTree(A) <|end_body_0|> <|body_start_1|> if len(nums) == 0: return None if len(nums) == 1: return TreeNode(nums[0]) maxn = 0 maxi = -1 for i in range(...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def insertIntoMaxTree(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" <|body_0|> def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_016751
1,283
no_license
[ { "docstring": ":type root: TreeNode :type val: int :rtype: TreeNode", "name": "insertIntoMaxTree", "signature": "def insertIntoMaxTree(self, root, val)" }, { "docstring": ":type nums: List[int] :rtype: TreeNode", "name": "constructMaximumBinaryTree", "signature": "def constructMaximumBi...
2
stack_v2_sparse_classes_30k_train_016137
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insertIntoMaxTree(self, root, val): :type root: TreeNode :type val: int :rtype: TreeNode - def constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def insertIntoMaxTree(self, root, val): :type root: TreeNode :type val: int :rtype: TreeNode - def constructMaximumBinaryTree(self, nums): :type nums: List[int] :rtype: TreeNode ...
70f16a872cb203f77eeddb812e734ad1d46df79d
<|skeleton|> class Solution: def insertIntoMaxTree(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" <|body_0|> def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def insertIntoMaxTree(self, root, val): """:type root: TreeNode :type val: int :rtype: TreeNode""" A = expand(root) A.append(val) return self.constructMaximumBinaryTree(A) def constructMaximumBinaryTree(self, nums): """:type nums: List[int] :rtype: TreeNo...
the_stack_v2_python_sparse
maximum-binary-tree-2.py
cannium/leetcode
train
0
0eb3fcd0d702d496a3a4fae9768d297b8e4949ee
[ "self.ev = ev\nself.weight = weight.weight()\nself.output = output\nself.selection = None\nself.addRow('entry', ak.ones_like(self.weight) == 1)", "if self.selection is None and selection is not None:\n self.selection = selection\nelif selection is not None and cumulative == False:\n selection = self.selecti...
<|body_start_0|> self.ev = ev self.weight = weight.weight() self.output = output self.selection = None self.addRow('entry', ak.ones_like(self.weight) == 1) <|end_body_0|> <|body_start_1|> if self.selection is None and selection is not None: self.selection = s...
Cutflow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cutflow: def __init__(self, output, ev, weight, selection=None): """output: the accumulator object ev: NanoEvent weight: coffea analysis_tools Weights object""" <|body_0|> def addRow(self, name, selection, cumulative=True): """If cumulative is set to False, the cut w...
stack_v2_sparse_classes_36k_train_016752
1,472
no_license
[ { "docstring": "output: the accumulator object ev: NanoEvent weight: coffea analysis_tools Weights object", "name": "__init__", "signature": "def __init__(self, output, ev, weight, selection=None)" }, { "docstring": "If cumulative is set to False, the cut will not be added to self.selection", ...
2
stack_v2_sparse_classes_30k_train_016216
Implement the Python class `Cutflow` described below. Class description: Implement the Cutflow class. Method signatures and docstrings: - def __init__(self, output, ev, weight, selection=None): output: the accumulator object ev: NanoEvent weight: coffea analysis_tools Weights object - def addRow(self, name, selection...
Implement the Python class `Cutflow` described below. Class description: Implement the Cutflow class. Method signatures and docstrings: - def __init__(self, output, ev, weight, selection=None): output: the accumulator object ev: NanoEvent weight: coffea analysis_tools Weights object - def addRow(self, name, selection...
e3b335c2e9a0dcb9e08ef56a2546dd7f40d276ba
<|skeleton|> class Cutflow: def __init__(self, output, ev, weight, selection=None): """output: the accumulator object ev: NanoEvent weight: coffea analysis_tools Weights object""" <|body_0|> def addRow(self, name, selection, cumulative=True): """If cumulative is set to False, the cut w...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cutflow: def __init__(self, output, ev, weight, selection=None): """output: the accumulator object ev: NanoEvent weight: coffea analysis_tools Weights object""" self.ev = ev self.weight = weight.weight() self.output = output self.selection = None self.addRow('en...
the_stack_v2_python_sparse
analysis/Tools/cutflow.py
danbarto/tW_scattering
train
0
b81b6ef019de45edc91a029c6ff65c4e0be8ac5c
[ "if len(result.affected_code) == 0:\n return 'The result is not associated with any source code.'\nfilenames = set((src.renamed_file(file_diff_dict) for src in result.affected_code))\nif any((exists(filename) for filename in filenames)):\n return True\nreturn \"The result is associated with source code that d...
<|body_start_0|> if len(result.affected_code) == 0: return 'The result is not associated with any source code.' filenames = set((src.renamed_file(file_diff_dict) for src in result.affected_code)) if any((exists(filename) for filename in filenames)): return True re...
IgnoreResultAction
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IgnoreResultAction: def is_applicable(result: Result, original_file_dict, file_diff_dict): """For being applicable, the result has to point to a number of files that have to exist i.e. have not been previously deleted.""" <|body_0|> def apply(self, result, original_file_dict...
stack_v2_sparse_classes_36k_train_016753
4,109
no_license
[ { "docstring": "For being applicable, the result has to point to a number of files that have to exist i.e. have not been previously deleted.", "name": "is_applicable", "signature": "def is_applicable(result: Result, original_file_dict, file_diff_dict)" }, { "docstring": "Add ignore comment", ...
3
stack_v2_sparse_classes_30k_train_021396
Implement the Python class `IgnoreResultAction` described below. Class description: Implement the IgnoreResultAction class. Method signatures and docstrings: - def is_applicable(result: Result, original_file_dict, file_diff_dict): For being applicable, the result has to point to a number of files that have to exist i...
Implement the Python class `IgnoreResultAction` described below. Class description: Implement the IgnoreResultAction class. Method signatures and docstrings: - def is_applicable(result: Result, original_file_dict, file_diff_dict): For being applicable, the result has to point to a number of files that have to exist i...
d494b3041069d377d6a7a9c296a14334f2fa5acc
<|skeleton|> class IgnoreResultAction: def is_applicable(result: Result, original_file_dict, file_diff_dict): """For being applicable, the result has to point to a number of files that have to exist i.e. have not been previously deleted.""" <|body_0|> def apply(self, result, original_file_dict...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IgnoreResultAction: def is_applicable(result: Result, original_file_dict, file_diff_dict): """For being applicable, the result has to point to a number of files that have to exist i.e. have not been previously deleted.""" if len(result.affected_code) == 0: return 'The result is not...
the_stack_v2_python_sparse
python/coala_coala/coala-master/coalib/results/result_actions/IgnoreResultAction.py
LiuFang816/SALSTM_py_data
train
10
152021b92f91f4c156ede394ffa98af52bf571a5
[ "lmodel = LangModel(logfile='lmwrap.log')\nnbest = 1.6\nwith self.assertRaises(NBestError) as er:\n lmodel.init(nbest=nbest)", "lmodel = LangModel(logfile='lmwrap.log')\nnbest = 2\nlmodel.init(nbest=nbest)\nevidence = ['t']\nreturn_mode = 'letter'\nwith self.assertRaises(EvidenceDataStructError) as er:\n lm...
<|body_start_0|> lmodel = LangModel(logfile='lmwrap.log') nbest = 1.6 with self.assertRaises(NBestError) as er: lmodel.init(nbest=nbest) <|end_body_0|> <|body_start_1|> lmodel = LangModel(logfile='lmwrap.log') nbest = 2 lmodel.init(nbest=nbest) eviden...
TestOCLM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestOCLM: def test_incorrect_nbest(self): """confirm an assertion error as the provided nbest arg is invalid""" <|body_0|> def test_incorrect_evidence(self): """confirm the process provides an error given an incorrect input""" <|body_1|> def test_valid_o...
stack_v2_sparse_classes_36k_train_016754
1,832
permissive
[ { "docstring": "confirm an assertion error as the provided nbest arg is invalid", "name": "test_incorrect_nbest", "signature": "def test_incorrect_nbest(self)" }, { "docstring": "confirm the process provides an error given an incorrect input", "name": "test_incorrect_evidence", "signatur...
3
null
Implement the Python class `TestOCLM` described below. Class description: Implement the TestOCLM class. Method signatures and docstrings: - def test_incorrect_nbest(self): confirm an assertion error as the provided nbest arg is invalid - def test_incorrect_evidence(self): confirm the process provides an error given a...
Implement the Python class `TestOCLM` described below. Class description: Implement the TestOCLM class. Method signatures and docstrings: - def test_incorrect_nbest(self): confirm an assertion error as the provided nbest arg is invalid - def test_incorrect_evidence(self): confirm the process provides an error given a...
397ce67c15a9e84d8a6c13f621fad3cf6b62df2e
<|skeleton|> class TestOCLM: def test_incorrect_nbest(self): """confirm an assertion error as the provided nbest arg is invalid""" <|body_0|> def test_incorrect_evidence(self): """confirm the process provides an error given an incorrect input""" <|body_1|> def test_valid_o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestOCLM: def test_incorrect_nbest(self): """confirm an assertion error as the provided nbest arg is invalid""" lmodel = LangModel(logfile='lmwrap.log') nbest = 1.6 with self.assertRaises(NBestError) as er: lmodel.init(nbest=nbest) def test_incorrect_evidence(s...
the_stack_v2_python_sparse
bcipy/language_model/integration/oclm_itest.py
nik-sm/BciPy
train
0
227b67acc3af1459d1f52eb6dea52e39782e2e39
[ "if not root:\n return None\nif key > root.val:\n root.right = self.deleteNode(root.right, key)\nelif key < root.val:\n root.left = self.deleteNode(root.left, key)\nelif not root.left and (not root.right):\n root = None\nelif root.right:\n root.val = self.successor(root)\n root.right = self.delete...
<|body_start_0|> if not root: return None if key > root.val: root.right = self.deleteNode(root.right, key) elif key < root.val: root.left = self.deleteNode(root.left, key) elif not root.left and (not root.right): root = None elif ro...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteNode(self, root, key): """:type root: TreeNode :type key: int :rtype: TreeNode""" <|body_0|> def successor(self, root): """One step right and then always left""" <|body_1|> def predecessor(self, root): """One step left and the...
stack_v2_sparse_classes_36k_train_016755
2,749
no_license
[ { "docstring": ":type root: TreeNode :type key: int :rtype: TreeNode", "name": "deleteNode", "signature": "def deleteNode(self, root, key)" }, { "docstring": "One step right and then always left", "name": "successor", "signature": "def successor(self, root)" }, { "docstring": "On...
3
stack_v2_sparse_classes_30k_train_002555
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteNode(self, root, key): :type root: TreeNode :type key: int :rtype: TreeNode - def successor(self, root): One step right and then always left - def predecessor(self, roo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteNode(self, root, key): :type root: TreeNode :type key: int :rtype: TreeNode - def successor(self, root): One step right and then always left - def predecessor(self, roo...
90c000c3be70727cde4f7494fbbb1c425bfd3da4
<|skeleton|> class Solution: def deleteNode(self, root, key): """:type root: TreeNode :type key: int :rtype: TreeNode""" <|body_0|> def successor(self, root): """One step right and then always left""" <|body_1|> def predecessor(self, root): """One step left and the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteNode(self, root, key): """:type root: TreeNode :type key: int :rtype: TreeNode""" if not root: return None if key > root.val: root.right = self.deleteNode(root.right, key) elif key < root.val: root.left = self.deleteNode(r...
the_stack_v2_python_sparse
450.delete-node-in-a-bst.py
chenjienan/python-leetcode
train
16
f6e5903a736af89c2246a2e369ceba279cdd0b0b
[ "x, y = (point[0], point[1])\nif neb_num == 8:\n return [(x - 1, y - 1), (x, y - 1), (x - 1, y), (x + 1, y), (x, y + 1), (x + 1, y + 1), (x + 1, y - 1), (x - 1, y + 1)]\nelif neb_num == 4:\n return [(x, y - 1), (x - 1, y), (x + 1, y), (x, y + 1)]\nelse:\n raise ValueError('neb_num can only be int 4 or 8')"...
<|body_start_0|> x, y = (point[0], point[1]) if neb_num == 8: return [(x - 1, y - 1), (x, y - 1), (x - 1, y), (x + 1, y), (x, y + 1), (x + 1, y + 1), (x + 1, y - 1), (x - 1, y + 1)] elif neb_num == 4: return [(x, y - 1), (x - 1, y), (x + 1, y), (x, y + 1)] else: ...
广度遍历得到斑块
GetPlaque
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetPlaque: """广度遍历得到斑块""" def __get_neb(point, neb_num=8): """4 邻接""" <|body_0|> def get_plaque_index_data(point_mat, ban_all): """获取斑块的 index 矩阵,每一个斑块获取一个唯一的 index""" <|body_1|> def get_plaque(point_mat, neb_num=8): """获取斑块""" <|body...
stack_v2_sparse_classes_36k_train_016756
2,943
no_license
[ { "docstring": "4 邻接", "name": "__get_neb", "signature": "def __get_neb(point, neb_num=8)" }, { "docstring": "获取斑块的 index 矩阵,每一个斑块获取一个唯一的 index", "name": "get_plaque_index_data", "signature": "def get_plaque_index_data(point_mat, ban_all)" }, { "docstring": "获取斑块", "name": "g...
3
null
Implement the Python class `GetPlaque` described below. Class description: 广度遍历得到斑块 Method signatures and docstrings: - def __get_neb(point, neb_num=8): 4 邻接 - def get_plaque_index_data(point_mat, ban_all): 获取斑块的 index 矩阵,每一个斑块获取一个唯一的 index - def get_plaque(point_mat, neb_num=8): 获取斑块
Implement the Python class `GetPlaque` described below. Class description: 广度遍历得到斑块 Method signatures and docstrings: - def __get_neb(point, neb_num=8): 4 邻接 - def get_plaque_index_data(point_mat, ban_all): 获取斑块的 index 矩阵,每一个斑块获取一个唯一的 index - def get_plaque(point_mat, neb_num=8): 获取斑块 <|skeleton|> class GetPlaque: ...
32e64be10a6cd2856850f6720d70b4c6e7033f4e
<|skeleton|> class GetPlaque: """广度遍历得到斑块""" def __get_neb(point, neb_num=8): """4 邻接""" <|body_0|> def get_plaque_index_data(point_mat, ban_all): """获取斑块的 index 矩阵,每一个斑块获取一个唯一的 index""" <|body_1|> def get_plaque(point_mat, neb_num=8): """获取斑块""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetPlaque: """广度遍历得到斑块""" def __get_neb(point, neb_num=8): """4 邻接""" x, y = (point[0], point[1]) if neb_num == 8: return [(x - 1, y - 1), (x, y - 1), (x - 1, y), (x + 1, y), (x, y + 1), (x + 1, y + 1), (x + 1, y - 1), (x - 1, y + 1)] elif neb_num == 4: ...
the_stack_v2_python_sparse
Algo/BFS/GetPlaque.py
newjokker/PyUtil
train
0
ebe141539dd6d2314dc63c5d9450aed1333338c3
[ "parser = super(GenericRequest, self).get_parser(prog_name)\nparser.add_argument('-m', '--method', choices=self.app.workspace.config.ALL_METHODS, help='override query method')\nparser.add_argument('-k', '--kwargs', type=lambda x: dict(yaml.safe_load(x)), help='payload/params to send. format is yaml')\nparser.add_ar...
<|body_start_0|> parser = super(GenericRequest, self).get_parser(prog_name) parser.add_argument('-m', '--method', choices=self.app.workspace.config.ALL_METHODS, help='override query method') parser.add_argument('-k', '--kwargs', type=lambda x: dict(yaml.safe_load(x)), help='payload/params to sen...
The generic request class for all requests
GenericRequest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenericRequest: """The generic request class for all requests""" def get_parser(self, prog_name): """Overriding parent method""" <|body_0|> def get_request(self, method, site_id, endpoint_id, args): """Get the request object""" <|body_1|> def update_...
stack_v2_sparse_classes_36k_train_016757
3,998
permissive
[ { "docstring": "Overriding parent method", "name": "get_parser", "signature": "def get_parser(self, prog_name)" }, { "docstring": "Get the request object", "name": "get_request", "signature": "def get_request(self, method, site_id, endpoint_id, args)" }, { "docstring": "Update th...
4
stack_v2_sparse_classes_30k_train_009007
Implement the Python class `GenericRequest` described below. Class description: The generic request class for all requests Method signatures and docstrings: - def get_parser(self, prog_name): Overriding parent method - def get_request(self, method, site_id, endpoint_id, args): Get the request object - def update_requ...
Implement the Python class `GenericRequest` described below. Class description: The generic request class for all requests Method signatures and docstrings: - def get_parser(self, prog_name): Overriding parent method - def get_request(self, method, site_id, endpoint_id, args): Get the request object - def update_requ...
f65fc86163c25f843a94341f09b20db28c1511d7
<|skeleton|> class GenericRequest: """The generic request class for all requests""" def get_parser(self, prog_name): """Overriding parent method""" <|body_0|> def get_request(self, method, site_id, endpoint_id, args): """Get the request object""" <|body_1|> def update_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenericRequest: """The generic request class for all requests""" def get_parser(self, prog_name): """Overriding parent method""" parser = super(GenericRequest, self).get_parser(prog_name) parser.add_argument('-m', '--method', choices=self.app.workspace.config.ALL_METHODS, help='ov...
the_stack_v2_python_sparse
resteasycli/cmd/generic_request.py
sayanarijit/RESTEasyCLI
train
1
4543fe908c8f40c729c61d69fbff56f825d7bfc6
[ "host = get_live_server_host()\nport = get_live_server_port()\nasync with websockets.serve(self.handler, host, port):\n await self.bus.run()", "channel_id = path.split('/')[-2]\nchannel_name = make_channel_group_name(channel_id)\nawait self.bus.subscribe(channel_name, websocket)\ntry:\n await websocket.wait...
<|body_start_0|> host = get_live_server_host() port = get_live_server_port() async with websockets.serve(self.handler, host, port): await self.bus.run() <|end_body_0|> <|body_start_1|> channel_id = path.split('/')[-2] channel_name = make_channel_group_name(channel_id...
WebsocketsPublisherApp
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WebsocketsPublisherApp: async def __call__(self): """Called once per session.""" <|body_0|> async def handler(self, websocket, path): """Called once per new connection. Adds/removes the websocket connection to/from the channel group corresponding to the channel id fo...
stack_v2_sparse_classes_36k_train_016758
1,271
permissive
[ { "docstring": "Called once per session.", "name": "__call__", "signature": "async def __call__(self)" }, { "docstring": "Called once per new connection. Adds/removes the websocket connection to/from the channel group corresponding to the channel id found in the request's path.", "name": "ha...
2
stack_v2_sparse_classes_30k_train_014811
Implement the Python class `WebsocketsPublisherApp` described below. Class description: Implement the WebsocketsPublisherApp class. Method signatures and docstrings: - async def __call__(self): Called once per session. - async def handler(self, websocket, path): Called once per new connection. Adds/removes the websoc...
Implement the Python class `WebsocketsPublisherApp` described below. Class description: Implement the WebsocketsPublisherApp class. Method signatures and docstrings: - async def __call__(self): Called once per session. - async def handler(self, websocket, path): Called once per new connection. Adds/removes the websoc...
dd769be089d457cf36db2506520028bc5f506ac3
<|skeleton|> class WebsocketsPublisherApp: async def __call__(self): """Called once per session.""" <|body_0|> async def handler(self, websocket, path): """Called once per new connection. Adds/removes the websocket connection to/from the channel group corresponding to the channel id fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WebsocketsPublisherApp: async def __call__(self): """Called once per session.""" host = get_live_server_host() port = get_live_server_port() async with websockets.serve(self.handler, host, port): await self.bus.run() async def handler(self, websocket, path): ...
the_stack_v2_python_sparse
src/wagtail_live/publishers/websockets/app.py
7saikat7/wagtail-live
train
0
81d5db8a0a780bde548e2ffd96bb277224830dea
[ "x = 2\nit = power_of(x)\nfor index in xrange(101):\n self.assertEqual(it.next(), pow(x, index))", "x = 3\nit = power_of(x)\nfor index in xrange(1001):\n self.assertEqual(it.next(), pow(x, index))", "x = 7\nit = power_of(x)\nfor index in xrange(10001):\n self.assertEqual(it.next(), pow(x, index))" ]
<|body_start_0|> x = 2 it = power_of(x) for index in xrange(101): self.assertEqual(it.next(), pow(x, index)) <|end_body_0|> <|body_start_1|> x = 3 it = power_of(x) for index in xrange(1001): self.assertEqual(it.next(), pow(x, index)) <|end_body_1|...
TestPowerOf
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPowerOf: def test_power_of_2(self): """Test power_of(2) until 100""" <|body_0|> def test_power_of_3(self): """Test power_of(3) until 1000""" <|body_1|> def test_power_of_7(self): """Test power_of(7) until 10000""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_36k_train_016759
1,221
no_license
[ { "docstring": "Test power_of(2) until 100", "name": "test_power_of_2", "signature": "def test_power_of_2(self)" }, { "docstring": "Test power_of(3) until 1000", "name": "test_power_of_3", "signature": "def test_power_of_3(self)" }, { "docstring": "Test power_of(7) until 10000", ...
3
null
Implement the Python class `TestPowerOf` described below. Class description: Implement the TestPowerOf class. Method signatures and docstrings: - def test_power_of_2(self): Test power_of(2) until 100 - def test_power_of_3(self): Test power_of(3) until 1000 - def test_power_of_7(self): Test power_of(7) until 10000
Implement the Python class `TestPowerOf` described below. Class description: Implement the TestPowerOf class. Method signatures and docstrings: - def test_power_of_2(self): Test power_of(2) until 100 - def test_power_of_3(self): Test power_of(3) until 1000 - def test_power_of_7(self): Test power_of(7) until 10000 <|...
8f082201e24f0f2b991d9388500fdbf95d6f073d
<|skeleton|> class TestPowerOf: def test_power_of_2(self): """Test power_of(2) until 100""" <|body_0|> def test_power_of_3(self): """Test power_of(3) until 1000""" <|body_1|> def test_power_of_7(self): """Test power_of(7) until 10000""" <|body_2|> <|end_sk...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPowerOf: def test_power_of_2(self): """Test power_of(2) until 100""" x = 2 it = power_of(x) for index in xrange(101): self.assertEqual(it.next(), pow(x, index)) def test_power_of_3(self): """Test power_of(3) until 1000""" x = 3 it = ...
the_stack_v2_python_sparse
advanced/exercises/mod_05_functools/tests_mod_05.py
garciacastano09/pycourse
train
0
2c0df9f03df95ff3c29592068e1eeef99b056058
[ "self.config_instance = config_instance\nself.exp_time = self.config_instance.config_file['credentials']['exp_time']\nif unit_test:\n sys.path.append('./')\nself.authentication_method = self.config_instance.config_file['credentials']['authentication_method']\nself.inf_renew_time = inf_renew_time\nself.unit_test ...
<|body_start_0|> self.config_instance = config_instance self.exp_time = self.config_instance.config_file['credentials']['exp_time'] if unit_test: sys.path.append('./') self.authentication_method = self.config_instance.config_file['credentials']['authentication_method'] ...
Credentials cache for XMLRPC services. Authenticated users are given a time-limited credential. Credentials map to Core instances, and can be used for repeated calls from a client. CredCaches also handle verifying credentials, and invoking API calls as those credentials.
CredCache
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CredCache: """Credentials cache for XMLRPC services. Authenticated users are given a time-limited credential. Credentials map to Core instances, and can be used for repeated calls from a client. CredCaches also handle verifying credentials, and invoking API calls as those credentials.""" def...
stack_v2_sparse_classes_36k_train_016760
7,720
permissive
[ { "docstring": "Constructs a new credential cache. Inputs: config_instance: instance of Config inf_renew_time: the that each credential is renewed (seconds) unit_test: boolean indicating a unit-test is being run.", "name": "__init__", "signature": "def __init__(self, config_instance, inf_renew_time, uni...
4
stack_v2_sparse_classes_30k_train_006119
Implement the Python class `CredCache` described below. Class description: Credentials cache for XMLRPC services. Authenticated users are given a time-limited credential. Credentials map to Core instances, and can be used for repeated calls from a client. CredCaches also handle verifying credentials, and invoking API ...
Implement the Python class `CredCache` described below. Class description: Credentials cache for XMLRPC services. Authenticated users are given a time-limited credential. Credentials map to Core instances, and can be used for repeated calls from a client. CredCaches also handle verifying credentials, and invoking API ...
794b24a84cdc71067f709fcd48b9312c5847af31
<|skeleton|> class CredCache: """Credentials cache for XMLRPC services. Authenticated users are given a time-limited credential. Credentials map to Core instances, and can be used for repeated calls from a client. CredCaches also handle verifying credentials, and invoking API calls as those credentials.""" def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CredCache: """Credentials cache for XMLRPC services. Authenticated users are given a time-limited credential. Credentials map to Core instances, and can be used for repeated calls from a client. CredCaches also handle verifying credentials, and invoking API calls as those credentials.""" def __init__(sel...
the_stack_v2_python_sparse
roster-server/roster_server/credentials.py
BackupGGCode/roster-dns-management
train
0
dc6b309a620b69181fb8544edb56021db5bbebf7
[ "self.hash_map = collections.defaultdict(list)\nfor i in range(len(nums)):\n self.hash_map[nums[i]].append(i)", "if target in self.hash_map:\n len_list = len(self.hash_map[target])\n r = random.randrange(len_list)\n return self.hash_map[target][r]\nreturn -1" ]
<|body_start_0|> self.hash_map = collections.defaultdict(list) for i in range(len(nums)): self.hash_map[nums[i]].append(i) <|end_body_0|> <|body_start_1|> if target in self.hash_map: len_list = len(self.hash_map[target]) r = random.randrange(len_list) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def pick(self, target): """:type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.hash_map = collections.defaultdict(list) for i in range(...
stack_v2_sparse_classes_36k_train_016761
735
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type target: int :rtype: int", "name": "pick", "signature": "def pick(self, target)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def pick(self, target): :type target: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def pick(self, target): :type target: int :rtype: int <|skeleton|> class Solution: def __init__(self, nums): """:t...
f05aac9aeadec1febe4c8323849c0a9f07a1fd1c
<|skeleton|> class Solution: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def pick(self, target): """:type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, nums): """:type nums: List[int]""" self.hash_map = collections.defaultdict(list) for i in range(len(nums)): self.hash_map[nums[i]].append(i) def pick(self, target): """:type target: int :rtype: int""" if target in self.hash_...
the_stack_v2_python_sparse
Mocks/Facebook/Medium/398.Random_Pick_index.py
ramakanthd92/LeetCode
train
2
aafacde07c280415d633cd7cea20a6198261e9f3
[ "driver = init_driver('https://www.olx.ua/uk/nedvizhimost/kvartiry-komnaty/arenda-kvartir-komnat/')\ndriver.execute_script('arguments[0].click();', driver.find_element_by_id('cityField'))\nsoup = BeautifulSoup(driver.page_source, 'html.parser')\nitems = soup.find_all('a', class_='link gray')\nurls = {}\nwith sessio...
<|body_start_0|> driver = init_driver('https://www.olx.ua/uk/nedvizhimost/kvartiry-komnaty/arenda-kvartir-komnat/') driver.execute_script('arguments[0].click();', driver.find_element_by_id('cityField')) soup = BeautifulSoup(driver.page_source, 'html.parser') items = soup.find_all('a', cl...
Class for filling db with state xref reference from olx
OlxStateXRefServicesLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OlxStateXRefServicesLoader: """Class for filling db with state xref reference from olx""" def get_states() -> dict: """Navigating through site olx.com and getting states :return: dict""" <|body_0|> def load(self, *args, **kwargs) -> int: """Load states from OLX R...
stack_v2_sparse_classes_36k_train_016762
7,788
no_license
[ { "docstring": "Navigating through site olx.com and getting states :return: dict", "name": "get_states", "signature": "def get_states() -> dict" }, { "docstring": "Load states from OLX Returns amount of fetched states :return: int", "name": "load", "signature": "def load(self, *args, **k...
2
null
Implement the Python class `OlxStateXRefServicesLoader` described below. Class description: Class for filling db with state xref reference from olx Method signatures and docstrings: - def get_states() -> dict: Navigating through site olx.com and getting states :return: dict - def load(self, *args, **kwargs) -> int: L...
Implement the Python class `OlxStateXRefServicesLoader` described below. Class description: Class for filling db with state xref reference from olx Method signatures and docstrings: - def get_states() -> dict: Navigating through site olx.com and getting states :return: dict - def load(self, *args, **kwargs) -> int: L...
80cd627f47e0499ddcb2c3313dbd67f1a90145c9
<|skeleton|> class OlxStateXRefServicesLoader: """Class for filling db with state xref reference from olx""" def get_states() -> dict: """Navigating through site olx.com and getting states :return: dict""" <|body_0|> def load(self, *args, **kwargs) -> int: """Load states from OLX R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OlxStateXRefServicesLoader: """Class for filling db with state xref reference from olx""" def get_states() -> dict: """Navigating through site olx.com and getting states :return: dict""" driver = init_driver('https://www.olx.ua/uk/nedvizhimost/kvartiry-komnaty/arenda-kvartir-komnat/') ...
the_stack_v2_python_sparse
service_api/services/olx/loaders.py
Project-Franchise/client-service
train
1
d3a43d6e492a02b34495ac2b3c7d7b20565b763e
[ "if K == 0:\n return 5\n\ndef trailingZeroes(n):\n if n == 0:\n return 0\n import math\n k = int(math.log(n, 5))\n ans = 0\n for i in range(1, k + 1):\n ans += n // 5 ** i\n return ans\nhight, low = (K * 5, 5)\nwhile low <= hight:\n mid = (low + hight) // 2\n a = trailingZer...
<|body_start_0|> if K == 0: return 5 def trailingZeroes(n): if n == 0: return 0 import math k = int(math.log(n, 5)) ans = 0 for i in range(1, k + 1): ans += n // 5 ** i return ans ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def preimageSizeFZF(self, K): """:type K: int :rtype: int 35MS""" <|body_0|> def preimageSizeFZF_1(self, K): """:type K: int :rtype: int 33ms""" <|body_1|> def preimageSizeFZF_2(self, K): """:type K: int :rtype: int 31ms""" <|bo...
stack_v2_sparse_classes_36k_train_016763
3,083
no_license
[ { "docstring": ":type K: int :rtype: int 35MS", "name": "preimageSizeFZF", "signature": "def preimageSizeFZF(self, K)" }, { "docstring": ":type K: int :rtype: int 33ms", "name": "preimageSizeFZF_1", "signature": "def preimageSizeFZF_1(self, K)" }, { "docstring": ":type K: int :rt...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preimageSizeFZF(self, K): :type K: int :rtype: int 35MS - def preimageSizeFZF_1(self, K): :type K: int :rtype: int 33ms - def preimageSizeFZF_2(self, K): :type K: int :rtype:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def preimageSizeFZF(self, K): :type K: int :rtype: int 35MS - def preimageSizeFZF_1(self, K): :type K: int :rtype: int 33ms - def preimageSizeFZF_2(self, K): :type K: int :rtype:...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def preimageSizeFZF(self, K): """:type K: int :rtype: int 35MS""" <|body_0|> def preimageSizeFZF_1(self, K): """:type K: int :rtype: int 33ms""" <|body_1|> def preimageSizeFZF_2(self, K): """:type K: int :rtype: int 31ms""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def preimageSizeFZF(self, K): """:type K: int :rtype: int 35MS""" if K == 0: return 5 def trailingZeroes(n): if n == 0: return 0 import math k = int(math.log(n, 5)) ans = 0 for i in range...
the_stack_v2_python_sparse
PreimageSizeOfFactorialZeroesFunction_HARD_793.py
953250587/leetcode-python
train
2
e2063b4154f217d2ff5041f56af8865f22ccaa65
[ "challenges: List[Dict[str, Any]] = []\nchallenges = WeeklyChallengesMP.Table(self, challenges)\nUtility.WriteFile(self, f'{self.eXAssets}/weeklyChallengesMP.json', challenges)\nlog.info(f'Compiled {len(challenges):,} Weekly Multiplayer Challenges')", "table: List[Dict[str, Any]] = Utility.ReadCSV(self, f'{self.i...
<|body_start_0|> challenges: List[Dict[str, Any]] = [] challenges = WeeklyChallengesMP.Table(self, challenges) Utility.WriteFile(self, f'{self.eXAssets}/weeklyChallengesMP.json', challenges) log.info(f'Compiled {len(challenges):,} Weekly Multiplayer Challenges') <|end_body_0|> <|body_st...
Weekly Multiplayer Challenges XAssets.
WeeklyChallengesMP
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeeklyChallengesMP: """Weekly Multiplayer Challenges XAssets.""" def Compile(self: Any) -> None: """Compile the Weekly Multiplayer Challenges XAssets.""" <|body_0|> def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]: """Compile the wee...
stack_v2_sparse_classes_36k_train_016764
13,794
permissive
[ { "docstring": "Compile the Weekly Multiplayer Challenges XAssets.", "name": "Compile", "signature": "def Compile(self: Any) -> None" }, { "docstring": "Compile the weekly_challenges.csv XAsset.", "name": "Table", "signature": "def Table(self: Any, challenges: List[Dict[str, Any]]) -> Li...
2
stack_v2_sparse_classes_30k_train_014666
Implement the Python class `WeeklyChallengesMP` described below. Class description: Weekly Multiplayer Challenges XAssets. Method signatures and docstrings: - def Compile(self: Any) -> None: Compile the Weekly Multiplayer Challenges XAssets. - def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, A...
Implement the Python class `WeeklyChallengesMP` described below. Class description: Weekly Multiplayer Challenges XAssets. Method signatures and docstrings: - def Compile(self: Any) -> None: Compile the Weekly Multiplayer Challenges XAssets. - def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, A...
82d3198a64eb2905e96dd536ce2f0acb52f9ce77
<|skeleton|> class WeeklyChallengesMP: """Weekly Multiplayer Challenges XAssets.""" def Compile(self: Any) -> None: """Compile the Weekly Multiplayer Challenges XAssets.""" <|body_0|> def Table(self: Any, challenges: List[Dict[str, Any]]) -> List[Dict[str, Any]]: """Compile the wee...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeeklyChallengesMP: """Weekly Multiplayer Challenges XAssets.""" def Compile(self: Any) -> None: """Compile the Weekly Multiplayer Challenges XAssets.""" challenges: List[Dict[str, Any]] = [] challenges = WeeklyChallengesMP.Table(self, challenges) Utility.WriteFile(self, f...
the_stack_v2_python_sparse
ModernWarfare/XAssets/challenges.py
dbuentello/Hyde
train
0
d214c48e10421e0d5014368ad970f76ec577805f
[ "super().__init__(**kwargs)\nself.density: float = kwargs.get('density', 1)\nself.specific_heat: float = kwargs.get('specific_heat', 4.184)\nself.min_flow_rate: float = kwargs.get('min_flow_rate', 0)\nself.power: Callable[[float], float] = kwargs.get('power', lambda x: 0)", "flow_rate = self.min_flow_rate\nif sel...
<|body_start_0|> super().__init__(**kwargs) self.density: float = kwargs.get('density', 1) self.specific_heat: float = kwargs.get('specific_heat', 4.184) self.min_flow_rate: float = kwargs.get('min_flow_rate', 0) self.power: Callable[[float], float] = kwargs.get('power', lambda x...
TwoPhaseImmersionCoolerPowerModel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoPhaseImmersionCoolerPowerModel: def __init__(self, **kwargs): """Two-Phase Immersion cooling system power consumption model. :param float density: Density of the fluid (in g/cm^3). By default, it is set to 1 (i.e., water). :param float specific_heat: Specific heat of the fluid (in J/g...
stack_v2_sparse_classes_36k_train_016765
3,314
permissive
[ { "docstring": "Two-Phase Immersion cooling system power consumption model. :param float density: Density of the fluid (in g/cm^3). By default, it is set to 1 (i.e., water). :param float specific_heat: Specific heat of the fluid (in J/gK). By default, it is set to 4.184 (i.e., water). :param float t_difference:...
2
null
Implement the Python class `TwoPhaseImmersionCoolerPowerModel` described below. Class description: Implement the TwoPhaseImmersionCoolerPowerModel class. Method signatures and docstrings: - def __init__(self, **kwargs): Two-Phase Immersion cooling system power consumption model. :param float density: Density of the f...
Implement the Python class `TwoPhaseImmersionCoolerPowerModel` described below. Class description: Implement the TwoPhaseImmersionCoolerPowerModel class. Method signatures and docstrings: - def __init__(self, **kwargs): Two-Phase Immersion cooling system power consumption model. :param float density: Density of the f...
cb425605de3341d27ce43fb326b300cb8ac781f6
<|skeleton|> class TwoPhaseImmersionCoolerPowerModel: def __init__(self, **kwargs): """Two-Phase Immersion cooling system power consumption model. :param float density: Density of the fluid (in g/cm^3). By default, it is set to 1 (i.e., water). :param float specific_heat: Specific heat of the fluid (in J/g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwoPhaseImmersionCoolerPowerModel: def __init__(self, **kwargs): """Two-Phase Immersion cooling system power consumption model. :param float density: Density of the fluid (in g/cm^3). By default, it is set to 1 (i.e., water). :param float specific_heat: Specific heat of the fluid (in J/gK). By default...
the_stack_v2_python_sparse
mercury/plugin/edc/cooler_power.py
greenlsi/mercury_mso_framework
train
2
e60bdf2928f121a623e928237f8ce8e684856c0d
[ "for x in range(30):\n for y in range(30):\n self.play_agent(x, y)\nfor x in range(30):\n for y in range(30):\n agent = self.board.at(x, y)\n agent.last_against = agent.curr_against\n agent.curr_against = {}\nfor x in range(30):\n for y in range(30):\n self.find_best_neig...
<|body_start_0|> for x in range(30): for y in range(30): self.play_agent(x, y) for x in range(30): for y in range(30): agent = self.board.at(x, y) agent.last_against = agent.curr_against agent.curr_against = {} ...
Runs a game using the imitation dynamics
ImitationGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImitationGame: """Runs a game using the imitation dynamics""" def update(self): """Updates a single round of the game. The phases of the round are as follows: 1. Each agent first plays against all of its neighbors. Payoffs are calculated as the average of payoffs against all neighbor...
stack_v2_sparse_classes_36k_train_016766
3,767
no_license
[ { "docstring": "Updates a single round of the game. The phases of the round are as follows: 1. Each agent first plays against all of its neighbors. Payoffs are calculated as the average of payoffs against all neighbors played (thus border agents are roughly equal to inner agents). 2. Update agent states. 3. Eac...
4
stack_v2_sparse_classes_30k_train_007709
Implement the Python class `ImitationGame` described below. Class description: Runs a game using the imitation dynamics Method signatures and docstrings: - def update(self): Updates a single round of the game. The phases of the round are as follows: 1. Each agent first plays against all of its neighbors. Payoffs are ...
Implement the Python class `ImitationGame` described below. Class description: Runs a game using the imitation dynamics Method signatures and docstrings: - def update(self): Updates a single round of the game. The phases of the round are as follows: 1. Each agent first plays against all of its neighbors. Payoffs are ...
52b27e36474afef3d8d24a7c39d0cbb879e0184d
<|skeleton|> class ImitationGame: """Runs a game using the imitation dynamics""" def update(self): """Updates a single round of the game. The phases of the round are as follows: 1. Each agent first plays against all of its neighbors. Payoffs are calculated as the average of payoffs against all neighbor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImitationGame: """Runs a game using the imitation dynamics""" def update(self): """Updates a single round of the game. The phases of the round are as follows: 1. Each agent first plays against all of its neighbors. Payoffs are calculated as the average of payoffs against all neighbors played (thu...
the_stack_v2_python_sparse
pyevo/imitation_game.py
nwoodbury/pyevo
train
0
1a1b4036aa581d87abc3673229fef35287eeef37
[ "tfrecord_cache_files = dataset_util.get_cache_files_coco(data_dir, cache_dir)\nif not tfrecord_cache_files.is_cached():\n label_map = dataset_util.get_label_map_coco(data_dir)\n cache_writer = dataset_util.COCOCacheFilesWriter(label_map=label_map, max_num_images=max_num_images)\n cache_writer.write_files(...
<|body_start_0|> tfrecord_cache_files = dataset_util.get_cache_files_coco(data_dir, cache_dir) if not tfrecord_cache_files.is_cached(): label_map = dataset_util.get_label_map_coco(data_dir) cache_writer = dataset_util.COCOCacheFilesWriter(label_map=label_map, max_num_images=max_n...
Dataset library for object detector.
Dataset
[ "Apache-2.0", "dtoa" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """Dataset library for object detector.""" def from_coco_folder(cls, data_dir: str, max_num_images: Optional[int]=None, cache_dir: Optional[str]=None) -> 'Dataset': """Loads images and labels from the given directory in COCO format. - https://cocodataset.org/#home Folder str...
stack_v2_sparse_classes_36k_train_016767
6,432
permissive
[ { "docstring": "Loads images and labels from the given directory in COCO format. - https://cocodataset.org/#home Folder structure should be: <data_dir>/ images/ <file0>.jpg ... labels.json The `labels.json` annotations file should should have the following format: { \"categories\": [{\"id\": 0, \"name\": \"back...
3
null
Implement the Python class `Dataset` described below. Class description: Dataset library for object detector. Method signatures and docstrings: - def from_coco_folder(cls, data_dir: str, max_num_images: Optional[int]=None, cache_dir: Optional[str]=None) -> 'Dataset': Loads images and labels from the given directory i...
Implement the Python class `Dataset` described below. Class description: Dataset library for object detector. Method signatures and docstrings: - def from_coco_folder(cls, data_dir: str, max_num_images: Optional[int]=None, cache_dir: Optional[str]=None) -> 'Dataset': Loads images and labels from the given directory i...
007824594bf1d07c7c1467df03a43886f8a4b3ad
<|skeleton|> class Dataset: """Dataset library for object detector.""" def from_coco_folder(cls, data_dir: str, max_num_images: Optional[int]=None, cache_dir: Optional[str]=None) -> 'Dataset': """Loads images and labels from the given directory in COCO format. - https://cocodataset.org/#home Folder str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """Dataset library for object detector.""" def from_coco_folder(cls, data_dir: str, max_num_images: Optional[int]=None, cache_dir: Optional[str]=None) -> 'Dataset': """Loads images and labels from the given directory in COCO format. - https://cocodataset.org/#home Folder structure should...
the_stack_v2_python_sparse
mediapipe/model_maker/python/vision/object_detector/dataset.py
google/mediapipe
train
23,940
07a1f87e7d6dd8af96372a79410b3f881c54ff0e
[ "MOD = int(1000000000.0 + 7)\ns = 0\nret = (0, 0)\n\ndef sum_tree(node):\n if not node:\n return 0\n cur = node.val + sum_tree(node.left) + sum_tree(node.right)\n nonlocal ret, s\n ret = max(ret, divmod(cur * (s - cur), MOD))\n return cur\ns = sum_tree(root)\nret = (0, 0)\nsum_tree(root)\nretu...
<|body_start_0|> MOD = int(1000000000.0 + 7) s = 0 ret = (0, 0) def sum_tree(node): if not node: return 0 cur = node.val + sum_tree(node.left) + sum_tree(node.right) nonlocal ret, s ret = max(ret, divmod(cur * (s - cur), MO...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProduct(self, root: Optional[TreeNode]) -> int: """Aug 26, 2021 01:12 Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def maxProduct(self, root: Optional[TreeNode]) -> int: """Dec 11, 2022 16:48""" <|body_1|> def maxProduct(se...
stack_v2_sparse_classes_36k_train_016768
13,179
no_license
[ { "docstring": "Aug 26, 2021 01:12 Time complexity: O(n) Space complexity: O(1)", "name": "maxProduct", "signature": "def maxProduct(self, root: Optional[TreeNode]) -> int" }, { "docstring": "Dec 11, 2022 16:48", "name": "maxProduct", "signature": "def maxProduct(self, root: Optional[Tre...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, root: Optional[TreeNode]) -> int: Aug 26, 2021 01:12 Time complexity: O(n) Space complexity: O(1) - def maxProduct(self, root: Optional[TreeNode]) -> int: De...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProduct(self, root: Optional[TreeNode]) -> int: Aug 26, 2021 01:12 Time complexity: O(n) Space complexity: O(1) - def maxProduct(self, root: Optional[TreeNode]) -> int: De...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def maxProduct(self, root: Optional[TreeNode]) -> int: """Aug 26, 2021 01:12 Time complexity: O(n) Space complexity: O(1)""" <|body_0|> def maxProduct(self, root: Optional[TreeNode]) -> int: """Dec 11, 2022 16:48""" <|body_1|> def maxProduct(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProduct(self, root: Optional[TreeNode]) -> int: """Aug 26, 2021 01:12 Time complexity: O(n) Space complexity: O(1)""" MOD = int(1000000000.0 + 7) s = 0 ret = (0, 0) def sum_tree(node): if not node: return 0 cur =...
the_stack_v2_python_sparse
leetcode/solved/1465_Maximum_Product_of_Splitted_Binary_Tree/solution.py
sungminoh/algorithms
train
0
e529a1fa3a382a175b227720b7096e6a023731ed
[ "if type(x) == list:\n self.x = np.array(x)\nelse:\n self.x = x\nself.E = E\nself.alpha = alpha\nself.R = R\nself.Rsig = Rsig\nself.dist = dist\nself.qc = qc\nself.qpar = qpar\nself.qparsig = qparsig\nself.norm = norm\nself.qoff = qoff\nself.bkg = bkg\nself.sig = sig\nself.N = N\nself.__mpar__ = mpar\nself.ch...
<|body_start_0|> if type(x) == list: self.x = np.array(x) else: self.x = x self.E = E self.alpha = alpha self.R = R self.Rsig = Rsig self.dist = dist self.qc = qc self.qpar = qpar self.qparsig = qparsig self....
Rod_Sphere
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rod_Sphere: def __init__(self, x=0, E=10.0, alpha=0.1, R=10.0, Rsig=1.0, dist='Gaussian', qc=0.0217, qpar=0.1, qparsig=0.0, N=50, sig=0.0, norm=1.0, qoff=0.0, bkg=0.0, mpar={}): """Provides rod scan from spherical objects dispersed on a substrate x : Array of Qz values of rod scan E : En...
stack_v2_sparse_classes_36k_train_016769
4,207
permissive
[ { "docstring": "Provides rod scan from spherical objects dispersed on a substrate x : Array of Qz values of rod scan E : Energy of X-ray in unit of keV alpha : incident angle in unit of degree R : Mean radius of spheres in inverse units of Qz Rsig : Width of distribution of spheres in inverse units of Qz dist :...
4
null
Implement the Python class `Rod_Sphere` described below. Class description: Implement the Rod_Sphere class. Method signatures and docstrings: - def __init__(self, x=0, E=10.0, alpha=0.1, R=10.0, Rsig=1.0, dist='Gaussian', qc=0.0217, qpar=0.1, qparsig=0.0, N=50, sig=0.0, norm=1.0, qoff=0.0, bkg=0.0, mpar={}): Provides...
Implement the Python class `Rod_Sphere` described below. Class description: Implement the Rod_Sphere class. Method signatures and docstrings: - def __init__(self, x=0, E=10.0, alpha=0.1, R=10.0, Rsig=1.0, dist='Gaussian', qc=0.0217, qpar=0.1, qparsig=0.0, N=50, sig=0.0, norm=1.0, qoff=0.0, bkg=0.0, mpar={}): Provides...
abbb091e703cfc3580a39b68070f5b60d3abb86b
<|skeleton|> class Rod_Sphere: def __init__(self, x=0, E=10.0, alpha=0.1, R=10.0, Rsig=1.0, dist='Gaussian', qc=0.0217, qpar=0.1, qparsig=0.0, N=50, sig=0.0, norm=1.0, qoff=0.0, bkg=0.0, mpar={}): """Provides rod scan from spherical objects dispersed on a substrate x : Array of Qz values of rod scan E : En...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rod_Sphere: def __init__(self, x=0, E=10.0, alpha=0.1, R=10.0, Rsig=1.0, dist='Gaussian', qc=0.0217, qpar=0.1, qparsig=0.0, N=50, sig=0.0, norm=1.0, qoff=0.0, bkg=0.0, mpar={}): """Provides rod scan from spherical objects dispersed on a substrate x : Array of Qz values of rod scan E : Energy of X-ray ...
the_stack_v2_python_sparse
Functions/GISAXS/Rod_Sphere.py
chemmatcars/XModFit
train
0
316f88510958c5181c8659b386d2c9a2ec5e1cd3
[ "max_position = 0\nfor i, n in enumerate(nums[:-1]):\n if max_position < i:\n break\n max_position = max(max_position, i + n)\nreturn max_position >= len(nums) - 1", "max_position = len(nums) - 1\nfor i in range(len(nums) - 2, -1, -1):\n if i + nums[i] >= max_position:\n max_position = i\nr...
<|body_start_0|> max_position = 0 for i, n in enumerate(nums[:-1]): if max_position < i: break max_position = max(max_position, i + n) return max_position >= len(nums) - 1 <|end_body_0|> <|body_start_1|> max_position = len(nums) - 1 for i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canJump(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canJump_reverse(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> max_position = 0 for i, n in enumer...
stack_v2_sparse_classes_36k_train_016770
1,393
no_license
[ { "docstring": ":type nums: List[int] :rtype: bool", "name": "canJump", "signature": "def canJump(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: bool", "name": "canJump_reverse", "signature": "def canJump_reverse(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums): :type nums: List[int] :rtype: bool - def canJump_reverse(self, nums): :type nums: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canJump(self, nums): :type nums: List[int] :rtype: bool - def canJump_reverse(self, nums): :type nums: List[int] :rtype: bool <|skeleton|> class Solution: def canJump(s...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def canJump(self, nums): """:type nums: List[int] :rtype: bool""" <|body_0|> def canJump_reverse(self, nums): """:type nums: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def canJump(self, nums): """:type nums: List[int] :rtype: bool""" max_position = 0 for i, n in enumerate(nums[:-1]): if max_position < i: break max_position = max(max_position, i + n) return max_position >= len(nums) - 1 de...
the_stack_v2_python_sparse
src/lt_55.py
oxhead/CodingYourWay
train
0
f7896acfd5ecdec01a4d3bce506150d34f945dd3
[ "level = []\n\ndef dfs(node, c):\n if c >= len(level):\n level.append([])\n if node is None:\n level[c].append('null')\n return\n level[c].append(node.val)\n dfs(node.left, c + 1)\n dfs(node.right, c + 1)\ndfs(root, 0)\ns = ''\nfor i in range(len(level)):\n for j in range(len(...
<|body_start_0|> level = [] def dfs(node, c): if c >= len(level): level.append([]) if node is None: level[c].append('null') return level[c].append(node.val) dfs(node.left, c + 1) dfs(node.right, ...
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_016771
1,832
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_001173
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:...
d376ca3a76254076f2b226f169b8296bdf44ad08
<|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""" level = [] def dfs(node, c): if c >= len(level): level.append([]) if node is None: level[c].append('null') ...
the_stack_v2_python_sparse
297. Serialize and Deserialize Binary Tree.py
nvnnv/Leetcode
train
0
bc81200a2e2b2f7dba09d85ff95f67f5d367c4ec
[ "self.driver.get(url)\nself.driver.max_window()\nself.driver.find_element(locator.HeaderLocator.about_button).click()\nself.driver.pause(3)\nself.driver.switch_to_window()\nabout_is_dispayed = self.driver.is_display(locator.HeaderLocator.about_title)\nself.driver.pause(3)\ntt_check.assertTrue(about_is_dispayed, '关于...
<|body_start_0|> self.driver.get(url) self.driver.max_window() self.driver.find_element(locator.HeaderLocator.about_button).click() self.driver.pause(3) self.driver.switch_to_window() about_is_dispayed = self.driver.is_display(locator.HeaderLocator.about_title) se...
about
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class about: def test_about(self): """测试首页底部关于淘车-跳转,@author:xulanzhong""" <|body_0|> def test_contact(self): """测试首页底部联系我们-跳转,@author:xulanzhong""" <|body_1|> def test_B_lisence(self): """测试首页底部营业执照-跳转,@author:xulanzhong""" <|body_2|> def ...
stack_v2_sparse_classes_36k_train_016772
2,780
no_license
[ { "docstring": "测试首页底部关于淘车-跳转,@author:xulanzhong", "name": "test_about", "signature": "def test_about(self)" }, { "docstring": "测试首页底部联系我们-跳转,@author:xulanzhong", "name": "test_contact", "signature": "def test_contact(self)" }, { "docstring": "测试首页底部营业执照-跳转,@author:xulanzhong", ...
5
stack_v2_sparse_classes_30k_val_000084
Implement the Python class `about` described below. Class description: Implement the about class. Method signatures and docstrings: - def test_about(self): 测试首页底部关于淘车-跳转,@author:xulanzhong - def test_contact(self): 测试首页底部联系我们-跳转,@author:xulanzhong - def test_B_lisence(self): 测试首页底部营业执照-跳转,@author:xulanzhong - def tes...
Implement the Python class `about` described below. Class description: Implement the about class. Method signatures and docstrings: - def test_about(self): 测试首页底部关于淘车-跳转,@author:xulanzhong - def test_contact(self): 测试首页底部联系我们-跳转,@author:xulanzhong - def test_B_lisence(self): 测试首页底部营业执照-跳转,@author:xulanzhong - def tes...
204856bd33c06d25f2970eba13799db75d4fd4fe
<|skeleton|> class about: def test_about(self): """测试首页底部关于淘车-跳转,@author:xulanzhong""" <|body_0|> def test_contact(self): """测试首页底部联系我们-跳转,@author:xulanzhong""" <|body_1|> def test_B_lisence(self): """测试首页底部营业执照-跳转,@author:xulanzhong""" <|body_2|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class about: def test_about(self): """测试首页底部关于淘车-跳转,@author:xulanzhong""" self.driver.get(url) self.driver.max_window() self.driver.find_element(locator.HeaderLocator.about_button).click() self.driver.pause(3) self.driver.switch_to_window() about_is_dispayed =...
the_stack_v2_python_sparse
mc/taochePC/test_crawler/test_homepage/test_about.py
boeai/mc
train
0
7870403d3f627a83170025084286e50f8a78e77b
[ "uf = UF(len(edges))\nres = None\nfor e in edges:\n n1, n2 = (e[0], e[1])\n if uf.connected(n1, n2):\n res = e[:]\n else:\n uf.union(n1, n2)\nreturn res", "n = len(edges)\nroots = [i for i in range(n + 1)]\n\ndef find(i):\n while roots[i] != i:\n roots[i] = roots[roots[i]]\n ...
<|body_start_0|> uf = UF(len(edges)) res = None for e in edges: n1, n2 = (e[0], e[1]) if uf.connected(n1, n2): res = e[:] else: uf.union(n1, n2) return res <|end_body_0|> <|body_start_1|> n = len(edges) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findRedundantConnection(self, edges): """:type edges: List[List[int]] :rtype: List[int]""" <|body_0|> def findRedundantConnectionUF(self, edges): """:type edges: List[List[int]] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_016773
2,038
no_license
[ { "docstring": ":type edges: List[List[int]] :rtype: List[int]", "name": "findRedundantConnection", "signature": "def findRedundantConnection(self, edges)" }, { "docstring": ":type edges: List[List[int]] :rtype: List[int]", "name": "findRedundantConnectionUF", "signature": "def findRedun...
2
stack_v2_sparse_classes_30k_train_016630
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRedundantConnection(self, edges): :type edges: List[List[int]] :rtype: List[int] - def findRedundantConnectionUF(self, edges): :type edges: List[List[int]] :rtype: List[i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findRedundantConnection(self, edges): :type edges: List[List[int]] :rtype: List[int] - def findRedundantConnectionUF(self, edges): :type edges: List[List[int]] :rtype: List[i...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def findRedundantConnection(self, edges): """:type edges: List[List[int]] :rtype: List[int]""" <|body_0|> def findRedundantConnectionUF(self, edges): """:type edges: List[List[int]] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findRedundantConnection(self, edges): """:type edges: List[List[int]] :rtype: List[int]""" uf = UF(len(edges)) res = None for e in edges: n1, n2 = (e[0], e[1]) if uf.connected(n1, n2): res = e[:] else: ...
the_stack_v2_python_sparse
R/RedundantConnection.py
bssrdf/pyleet
train
2
56eac98739988e25be08b22d52d2514cbda78dff
[ "super(GANLoss, self).__init__()\nself.register_buffer('real_label', torch.tensor(real_label))\nself.register_buffer('fake_label', torch.tensor(fake_label))\nself.gan_mode = gan_mode\nif gan_mode == 'vanilla':\n self.loss = nn.BCEWithLogitsLoss()\nelif gan_mode == 'lsgan':\n self.loss = nn.MSELoss()\nelif gan...
<|body_start_0|> super(GANLoss, self).__init__() self.register_buffer('real_label', torch.tensor(real_label)) self.register_buffer('fake_label', torch.tensor(fake_label)) self.gan_mode = gan_mode if gan_mode == 'vanilla': self.loss = nn.BCEWithLogitsLoss() eli...
GANLoss
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GANLoss: def __init__(self, gan_mode, real_label=1.0, fake_label=0.0): """Initialize the GANLoss class gan_mode: type of gan loss""" <|body_0|> def getLabelTensor(self, pred, targ_is_real): """Return the real label or fake label as a tensor with the same dimension as...
stack_v2_sparse_classes_36k_train_016774
3,750
no_license
[ { "docstring": "Initialize the GANLoss class gan_mode: type of gan loss", "name": "__init__", "signature": "def __init__(self, gan_mode, real_label=1.0, fake_label=0.0)" }, { "docstring": "Return the real label or fake label as a tensor with the same dimension as the prediction (from the discrim...
3
stack_v2_sparse_classes_30k_train_014806
Implement the Python class `GANLoss` described below. Class description: Implement the GANLoss class. Method signatures and docstrings: - def __init__(self, gan_mode, real_label=1.0, fake_label=0.0): Initialize the GANLoss class gan_mode: type of gan loss - def getLabelTensor(self, pred, targ_is_real): Return the rea...
Implement the Python class `GANLoss` described below. Class description: Implement the GANLoss class. Method signatures and docstrings: - def __init__(self, gan_mode, real_label=1.0, fake_label=0.0): Initialize the GANLoss class gan_mode: type of gan loss - def getLabelTensor(self, pred, targ_is_real): Return the rea...
14fdb90f84cc33ea1f59bc8e94cbf2214b9334d8
<|skeleton|> class GANLoss: def __init__(self, gan_mode, real_label=1.0, fake_label=0.0): """Initialize the GANLoss class gan_mode: type of gan loss""" <|body_0|> def getLabelTensor(self, pred, targ_is_real): """Return the real label or fake label as a tensor with the same dimension as...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GANLoss: def __init__(self, gan_mode, real_label=1.0, fake_label=0.0): """Initialize the GANLoss class gan_mode: type of gan loss""" super(GANLoss, self).__init__() self.register_buffer('real_label', torch.tensor(real_label)) self.register_buffer('fake_label', torch.tensor(fake...
the_stack_v2_python_sparse
models/losses.py
athena913/pix2pix
train
0
645036034bd3756d5f769ac8924989d2528edec3
[ "self.lat = lat\nself.lon = lon\nself.age = age\nself.beach_time = beach_time\nself.pt = Point(self.lon, self.lat)\nself.intervalo = None\nself.id_intervalo = None", "data = self.beach_time\ndif = data - data_inicio\ndelta = dif / datetime.timedelta(hours=dt)\nint_delta = int(delta)\nresult = data_inicio + dateti...
<|body_start_0|> self.lat = lat self.lon = lon self.age = age self.beach_time = beach_time self.pt = Point(self.lon, self.lat) self.intervalo = None self.id_intervalo = None <|end_body_0|> <|body_start_1|> data = self.beach_time dif = data - data_...
Class Lagrangian Partic
Partic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Partic: """Class Lagrangian Partic""" def __init__(self, lat, lon, age, beach_time): """inicia a clase Partic da partícula :param lat: latitude dunha particula no ficheiro de saída lagranxiana :param lon: lonxitude dunha particula no ficheiro de saída lagranxiana :param age: idade en...
stack_v2_sparse_classes_36k_train_016775
1,159
no_license
[ { "docstring": "inicia a clase Partic da partícula :param lat: latitude dunha particula no ficheiro de saída lagranxiana :param lon: lonxitude dunha particula no ficheiro de saída lagranxiana :param age: idade en segundos dunha particula no ficheiro de saída lagranxiana", "name": "__init__", "signature"...
2
stack_v2_sparse_classes_30k_test_000109
Implement the Python class `Partic` described below. Class description: Class Lagrangian Partic Method signatures and docstrings: - def __init__(self, lat, lon, age, beach_time): inicia a clase Partic da partícula :param lat: latitude dunha particula no ficheiro de saída lagranxiana :param lon: lonxitude dunha partic...
Implement the Python class `Partic` described below. Class description: Class Lagrangian Partic Method signatures and docstrings: - def __init__(self, lat, lon, age, beach_time): inicia a clase Partic da partícula :param lat: latitude dunha particula no ficheiro de saída lagranxiana :param lon: lonxitude dunha partic...
e3c577e6048d546706df0c6191a0d0d10a58d3d8
<|skeleton|> class Partic: """Class Lagrangian Partic""" def __init__(self, lat, lon, age, beach_time): """inicia a clase Partic da partícula :param lat: latitude dunha particula no ficheiro de saída lagranxiana :param lon: lonxitude dunha particula no ficheiro de saída lagranxiana :param age: idade en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Partic: """Class Lagrangian Partic""" def __init__(self, lat, lon, age, beach_time): """inicia a clase Partic da partícula :param lat: latitude dunha particula no ficheiro de saída lagranxiana :param lon: lonxitude dunha particula no ficheiro de saída lagranxiana :param age: idade en segundos dun...
the_stack_v2_python_sparse
cleanatlantic/partic.py
pedromontero/CLEANATLANTIC
train
1
1f07a9714ea50c7b34cb01050863600b811acce4
[ "super(Generator, self).__init__()\nself.rnn = nn.LSTM(input_size=vid_feat_size, hidden_size=hidden_size, bidirectional=True, num_layers=1)\nself.drop = nn.Dropout(p=dropout_p)\nself.linear = nn.Linear(hidden_size * 2, 2)\nself.tau = tau", "batch_size = vid_feats.shape[0]\nnum_frames = vid_feats.shape[1]\nout, _ ...
<|body_start_0|> super(Generator, self).__init__() self.rnn = nn.LSTM(input_size=vid_feat_size, hidden_size=hidden_size, bidirectional=True, num_layers=1) self.drop = nn.Dropout(p=dropout_p) self.linear = nn.Linear(hidden_size * 2, 2) self.tau = tau <|end_body_0|> <|body_start_1...
Generator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: def __init__(self, dropout_p, hidden_size, vid_feat_size, tau): """Args: dropout_p: Dropout probability for intermediate dropout layers hidden_size: Size of the intermediate linear layers vid_feat_size: Size of the video features tau: non-negative scalar temperature""" ...
stack_v2_sparse_classes_36k_train_016776
3,887
no_license
[ { "docstring": "Args: dropout_p: Dropout probability for intermediate dropout layers hidden_size: Size of the intermediate linear layers vid_feat_size: Size of the video features tau: non-negative scalar temperature", "name": "__init__", "signature": "def __init__(self, dropout_p, hidden_size, vid_feat_...
2
stack_v2_sparse_classes_30k_train_009291
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def __init__(self, dropout_p, hidden_size, vid_feat_size, tau): Args: dropout_p: Dropout probability for intermediate dropout layers hidden_size: Size of the intermediate linea...
Implement the Python class `Generator` described below. Class description: Implement the Generator class. Method signatures and docstrings: - def __init__(self, dropout_p, hidden_size, vid_feat_size, tau): Args: dropout_p: Dropout probability for intermediate dropout layers hidden_size: Size of the intermediate linea...
5f347de39f5583cd043c6f572178da08f7c0de94
<|skeleton|> class Generator: def __init__(self, dropout_p, hidden_size, vid_feat_size, tau): """Args: dropout_p: Dropout probability for intermediate dropout layers hidden_size: Size of the intermediate linear layers vid_feat_size: Size of the video features tau: non-negative scalar temperature""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Generator: def __init__(self, dropout_p, hidden_size, vid_feat_size, tau): """Args: dropout_p: Dropout probability for intermediate dropout layers hidden_size: Size of the intermediate linear layers vid_feat_size: Size of the video features tau: non-negative scalar temperature""" super(Generat...
the_stack_v2_python_sparse
model/RationaleNet.py
AmmieQi/pytorch-video-caption-rationale
train
0
1464e1d9a6998cf4778e568d0df48bdbe1670d3a
[ "super(GeM, self).__init__()\nself.power = power\nself.eps = 1e-06", "if axis is None:\n axis = [1, 2]\nreturn gem(x, power=self.power, eps=self.eps, axis=axis)" ]
<|body_start_0|> super(GeM, self).__init__() self.power = power self.eps = 1e-06 <|end_body_0|> <|body_start_1|> if axis is None: axis = [1, 2] return gem(x, power=self.power, eps=self.eps, axis=axis) <|end_body_1|>
Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference.
GeM
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeM: """Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference.""" def __init__(self, power=3.0): """Initialization of the generalized mean pooling (GeM) laye...
stack_v2_sparse_classes_36k_train_016777
6,125
permissive
[ { "docstring": "Initialization of the generalized mean pooling (GeM) layer. Args: power: Float power > 0 is an inverse exponent parameter, used during the generalized mean pooling computation. Setting this exponent as power > 1 increases the contrast of the pooled feature map and focuses on the salient features...
2
stack_v2_sparse_classes_30k_train_002752
Implement the Python class `GeM` described below. Class description: Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference. Method signatures and docstrings: - def __init__(self, power=3.0): ...
Implement the Python class `GeM` described below. Class description: Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference. Method signatures and docstrings: - def __init__(self, power=3.0): ...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class GeM: """Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference.""" def __init__(self, power=3.0): """Initialization of the generalized mean pooling (GeM) laye...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeM: """Generalized mean pooling (GeM) layer. Generalized Mean Pooling (GeM) computes the generalized mean of each channel in a tensor. See https://arxiv.org/abs/1711.02512 for a reference.""" def __init__(self, power=3.0): """Initialization of the generalized mean pooling (GeM) layer. Args: powe...
the_stack_v2_python_sparse
research/delf/delf/python/pooling_layers/pooling.py
jianzhnie/models
train
2
520fe00cc716b0d14c311139d797c94855f8d2f4
[ "config_info = common_utils.load_config_json(workspacer.CONFIG_FILE)\nself.assertEqual(len(config_info), 10)\nself.assertGreaterEqual(len(config_info['secret_info']), 3)", "test_bundles = {'image_win10_power_20210801_test': {'BundleId': 'abc-123123123'}, 'image_win10_power_20210803_test': {'BundleId': 'abc-123123...
<|body_start_0|> config_info = common_utils.load_config_json(workspacer.CONFIG_FILE) self.assertEqual(len(config_info), 10) self.assertGreaterEqual(len(config_info['secret_info']), 3) <|end_body_0|> <|body_start_1|> test_bundles = {'image_win10_power_20210801_test': {'BundleId': 'abc-12...
Standard test class, for all common_utils functions
TestCommonUtils
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestCommonUtils: """Standard test class, for all common_utils functions""" def test_load_config_json(self): """Test the method used for loading the config json Note if any config files diverge, a separate test should be added""" <|body_0|> def test_determine_team_bundle_...
stack_v2_sparse_classes_36k_train_016778
1,945
permissive
[ { "docstring": "Test the method used for loading the config json Note if any config files diverge, a separate test should be added", "name": "test_load_config_json", "signature": "def test_load_config_json(self)" }, { "docstring": "Test the method that returns the correct bundle_id", "name":...
2
stack_v2_sparse_classes_30k_train_020320
Implement the Python class `TestCommonUtils` described below. Class description: Standard test class, for all common_utils functions Method signatures and docstrings: - def test_load_config_json(self): Test the method used for loading the config json Note if any config files diverge, a separate test should be added -...
Implement the Python class `TestCommonUtils` described below. Class description: Standard test class, for all common_utils functions Method signatures and docstrings: - def test_load_config_json(self): Test the method used for loading the config json Note if any config files diverge, a separate test should be added -...
bcdd157023ee6e28016d10158f82fb02beea76b9
<|skeleton|> class TestCommonUtils: """Standard test class, for all common_utils functions""" def test_load_config_json(self): """Test the method used for loading the config json Note if any config files diverge, a separate test should be added""" <|body_0|> def test_determine_team_bundle_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestCommonUtils: """Standard test class, for all common_utils functions""" def test_load_config_json(self): """Test the method used for loading the config json Note if any config files diverge, a separate test should be added""" config_info = common_utils.load_config_json(workspacer.CONFI...
the_stack_v2_python_sparse
test_common_utils.py
BrionStone/aws_workspace_maker
train
0
96d8f0f1a34ee424dcf4ad70ead68b4a5097cf88
[ "with self.make_session() as session:\n profile = (yield as_future(session.query(Profile).filter(Profile.username == username).first))\n if profile:\n tasks = [task.to_dict() for task in profile.tasks]\n self.send_response({'username': profile.username, 'tasks': tasks})", "with self.make_sessi...
<|body_start_0|> with self.make_session() as session: profile = (yield as_future(session.query(Profile).filter(Profile.username == username).first)) if profile: tasks = [task.to_dict() for task in profile.tasks] self.send_response({'username': profile.user...
View for reading and adding new tasks.
TaskListView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskListView: """View for reading and adding new tasks.""" def get(self, username): """Get all tasks for an existing user.""" <|body_0|> def post(self, username): """Create a new task.""" <|body_1|> <|end_skeleton|> <|body_start_0|> with self.ma...
stack_v2_sparse_classes_36k_train_016779
1,647
no_license
[ { "docstring": "Get all tasks for an existing user.", "name": "get", "signature": "def get(self, username)" }, { "docstring": "Create a new task.", "name": "post", "signature": "def post(self, username)" } ]
2
null
Implement the Python class `TaskListView` described below. Class description: View for reading and adding new tasks. Method signatures and docstrings: - def get(self, username): Get all tasks for an existing user. - def post(self, username): Create a new task.
Implement the Python class `TaskListView` described below. Class description: View for reading and adding new tasks. Method signatures and docstrings: - def get(self, username): Get all tasks for an existing user. - def post(self, username): Create a new task. <|skeleton|> class TaskListView: """View for reading...
0f1badabba07fbe7f5f792b7e543c0748eecd6c7
<|skeleton|> class TaskListView: """View for reading and adding new tasks.""" def get(self, username): """Get all tasks for an existing user.""" <|body_0|> def post(self, username): """Create a new task.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskListView: """View for reading and adding new tasks.""" def get(self, username): """Get all tasks for an existing user.""" with self.make_session() as session: profile = (yield as_future(session.query(Profile).filter(Profile.username == username).first)) if prof...
the_stack_v2_python_sparse
tornadoPractice/archive/TaskListView.py
devendraprasad1984/python
train
0
58442ec5a3579557a6370bcd1c3cb39fc6271bfd
[ "super(EncoderDecoder, self).__init__()\nself.embed_size = 300\nself.hidden_size = 600\n'\\n Converting words to vectors\\n '\nself.embedding = nn.Embedding(len(vocabulary), self.embed_size)\ninitrange = 0.1\nself.embedding.weight.data.uniform_(-initrange, initrange)\n'\\n An RNN (LSTM) with dr...
<|body_start_0|> super(EncoderDecoder, self).__init__() self.embed_size = 300 self.hidden_size = 600 '\n Converting words to vectors\n ' self.embedding = nn.Embedding(len(vocabulary), self.embed_size) initrange = 0.1 self.embedding.weight.data.unifor...
EncoderDecoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderDecoder: def __init__(self): """Define all the parameters of the model""" <|body_0|> def forward(self, input, hidden=None): """Running the model :param input: :param hidden: :return hidden, decoded:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_016780
12,072
permissive
[ { "docstring": "Define all the parameters of the model", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Running the model :param input: :param hidden: :return hidden, decoded:", "name": "forward", "signature": "def forward(self, input, hidden=None)" } ]
2
stack_v2_sparse_classes_30k_train_009769
Implement the Python class `EncoderDecoder` described below. Class description: Implement the EncoderDecoder class. Method signatures and docstrings: - def __init__(self): Define all the parameters of the model - def forward(self, input, hidden=None): Running the model :param input: :param hidden: :return hidden, dec...
Implement the Python class `EncoderDecoder` described below. Class description: Implement the EncoderDecoder class. Method signatures and docstrings: - def __init__(self): Define all the parameters of the model - def forward(self, input, hidden=None): Running the model :param input: :param hidden: :return hidden, dec...
5f380a16be38217e87259f0d93da93c10c37b6a2
<|skeleton|> class EncoderDecoder: def __init__(self): """Define all the parameters of the model""" <|body_0|> def forward(self, input, hidden=None): """Running the model :param input: :param hidden: :return hidden, decoded:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderDecoder: def __init__(self): """Define all the parameters of the model""" super(EncoderDecoder, self).__init__() self.embed_size = 300 self.hidden_size = 600 '\n Converting words to vectors\n ' self.embedding = nn.Embedding(len(vocabulary), ...
the_stack_v2_python_sparse
Natural Language Processing/nlp.py
SpencerOfwiti/machine-learning-algorithms
train
2
ff1f6c94bb7828a74956ee36ac566edcd140bc73
[ "query = request.GET.get('query')\nqueryset = Release.objects.filter(projects=project, organization_id=project.organization_id).select_related('owner')\nif query:\n queryset = queryset.filter(version__istartswith=query)\nqueryset = queryset.extra(select={'sort': 'COALESCE(date_released, date_added)'})\nreturn se...
<|body_start_0|> query = request.GET.get('query') queryset = Release.objects.filter(projects=project, organization_id=project.organization_id).select_related('owner') if query: queryset = queryset.filter(version__istartswith=query) queryset = queryset.extra(select={'sort': 'C...
ProjectReleasesEndpoint
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProjectReleasesEndpoint: def get(self, request, project): """List a Project's Releases ````````````````````````` Retrieve a list of releases for a given project. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug o...
stack_v2_sparse_classes_36k_train_016781
6,430
permissive
[ { "docstring": "List a Project's Releases ````````````````````````` Retrieve a list of releases for a given project. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug of the project to list the releases of. :qparam string query: this par...
2
stack_v2_sparse_classes_30k_train_004259
Implement the Python class `ProjectReleasesEndpoint` described below. Class description: Implement the ProjectReleasesEndpoint class. Method signatures and docstrings: - def get(self, request, project): List a Project's Releases ````````````````````````` Retrieve a list of releases for a given project. :pparam string...
Implement the Python class `ProjectReleasesEndpoint` described below. Class description: Implement the ProjectReleasesEndpoint class. Method signatures and docstrings: - def get(self, request, project): List a Project's Releases ````````````````````````` Retrieve a list of releases for a given project. :pparam string...
b937615079d7b24dc225a83b99b1b65da932fc66
<|skeleton|> class ProjectReleasesEndpoint: def get(self, request, project): """List a Project's Releases ````````````````````````` Retrieve a list of releases for a given project. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProjectReleasesEndpoint: def get(self, request, project): """List a Project's Releases ````````````````````````` Retrieve a list of releases for a given project. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug of the project ...
the_stack_v2_python_sparse
src/sentry/api/endpoints/project_releases.py
atlassian/sentry
train
1
931c1ee02f9e339be91ec69cf54c9c4005651d63
[ "select_interro_options = [{'id': 'select_interro_test_empty', 'label': '-- Please choose --', 'value': '-'}] + [{'id': 'select_interro_{}'.format(interro.pk), 'label': interro.modele.description, 'value': interro.pk} for interro in Interrogation.objects.filter(user=request.user)]\ndata_step = data.get(wz_user_step...
<|body_start_0|> select_interro_options = [{'id': 'select_interro_test_empty', 'label': '-- Please choose --', 'value': '-'}] + [{'id': 'select_interro_{}'.format(interro.pk), 'label': interro.modele.description, 'value': interro.pk} for interro in Interrogation.objects.filter(user=request.user)] data_s...
WizardStepNewExamStep2
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WizardStepNewExamStep2: def get_content(self, request, wz_user_step, data, **kwargs): """Args: request: the current request wz_user_step: current wz_user_step model data: all data gathered step after step **kwargs: other arguments (company and uuid amongst others) Returns: Object that sh...
stack_v2_sparse_classes_36k_train_016782
6,848
permissive
[ { "docstring": "Args: request: the current request wz_user_step: current wz_user_step model data: all data gathered step after step **kwargs: other arguments (company and uuid amongst others) Returns: Object that should be returned as JSON", "name": "get_content", "signature": "def get_content(self, req...
3
null
Implement the Python class `WizardStepNewExamStep2` described below. Class description: Implement the WizardStepNewExamStep2 class. Method signatures and docstrings: - def get_content(self, request, wz_user_step, data, **kwargs): Args: request: the current request wz_user_step: current wz_user_step model data: all da...
Implement the Python class `WizardStepNewExamStep2` described below. Class description: Implement the WizardStepNewExamStep2 class. Method signatures and docstrings: - def get_content(self, request, wz_user_step, data, **kwargs): Args: request: the current request wz_user_step: current wz_user_step model data: all da...
7c76474ad41769804965a11550501321d7b1889b
<|skeleton|> class WizardStepNewExamStep2: def get_content(self, request, wz_user_step, data, **kwargs): """Args: request: the current request wz_user_step: current wz_user_step model data: all data gathered step after step **kwargs: other arguments (company and uuid amongst others) Returns: Object that sh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WizardStepNewExamStep2: def get_content(self, request, wz_user_step, data, **kwargs): """Args: request: the current request wz_user_step: current wz_user_step model data: all data gathered step after step **kwargs: other arguments (company and uuid amongst others) Returns: Object that should be return...
the_stack_v2_python_sparse
wizard/views/json/step/new_exam/step_2.py
olivierpons/evalr
train
0
c147a2b746def4c944fee5dd763cdf7043d1dddb
[ "session = Session()\ntry:\n query = session.query(Organization).order_by(Organization.legal_name, Organization.created_on)\n data, paging = get_collection_page(req, query)\n resp.media = {'data': data, 'paging': paging}\nfinally:\n session.close()", "session = Session()\ntry:\n errors = validate_p...
<|body_start_0|> session = Session() try: query = session.query(Organization).order_by(Organization.legal_name, Organization.created_on) data, paging = get_collection_page(req, query) resp.media = {'data': data, 'paging': paging} finally: session.c...
GET and POST organizations.
Collection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Collection: """GET and POST organizations.""" def on_get(self, req, resp): """GETs a paged collection of organizations. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation.""" <|body_0|> def on_post(self, req, resp): """Cr...
stack_v2_sparse_classes_36k_train_016783
7,046
no_license
[ { "docstring": "GETs a paged collection of organizations. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation.", "name": "on_get", "signature": "def on_get(self, req, resp)" }, { "docstring": "Creates a new organization. :param req: See Falcon Request doc...
2
stack_v2_sparse_classes_30k_train_016625
Implement the Python class `Collection` described below. Class description: GET and POST organizations. Method signatures and docstrings: - def on_get(self, req, resp): GETs a paged collection of organizations. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation. - def on_post...
Implement the Python class `Collection` described below. Class description: GET and POST organizations. Method signatures and docstrings: - def on_get(self, req, resp): GETs a paged collection of organizations. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation. - def on_post...
62723133595829230e5b589431a32cda3b092460
<|skeleton|> class Collection: """GET and POST organizations.""" def on_get(self, req, resp): """GETs a paged collection of organizations. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation.""" <|body_0|> def on_post(self, req, resp): """Cr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Collection: """GET and POST organizations.""" def on_get(self, req, resp): """GETs a paged collection of organizations. :param req: See Falcon Request documentation. :param resp: See Falcon Response documentation.""" session = Session() try: query = session.query(Organ...
the_stack_v2_python_sparse
knoweak/api/resources/organization.py
psvaiter/knoweak-api
train
0
d18644e26c23e697de22a4815419a5e4dae53723
[ "_LOG.info('Create the DB schema for: %s', engine)\nself._engine = engine\nself._meta = MetaData()\nself.experiment = Table('experiment', self._meta, Column('exp_id', String(255), nullable=False), Column('description', String(1024)), Column('root_env_config', String(1024), nullable=False), Column('git_repo', String...
<|body_start_0|> _LOG.info('Create the DB schema for: %s', engine) self._engine = engine self._meta = MetaData() self.experiment = Table('experiment', self._meta, Column('exp_id', String(255), nullable=False), Column('description', String(1024)), Column('root_env_config', String(1024), n...
A class to define and create the DB schema.
DbSchema
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbSchema: """A class to define and create the DB schema.""" def __init__(self, engine: Engine): """Declare the SQLAlchemy schema for the database.""" <|body_0|> def create(self) -> 'DbSchema': """Create the DB schema.""" <|body_1|> def __repr__(self)...
stack_v2_sparse_classes_36k_train_016784
6,611
permissive
[ { "docstring": "Declare the SQLAlchemy schema for the database.", "name": "__init__", "signature": "def __init__(self, engine: Engine)" }, { "docstring": "Create the DB schema.", "name": "create", "signature": "def create(self) -> 'DbSchema'" }, { "docstring": "Produce a string w...
3
stack_v2_sparse_classes_30k_train_008217
Implement the Python class `DbSchema` described below. Class description: A class to define and create the DB schema. Method signatures and docstrings: - def __init__(self, engine: Engine): Declare the SQLAlchemy schema for the database. - def create(self) -> 'DbSchema': Create the DB schema. - def __repr__(self) -> ...
Implement the Python class `DbSchema` described below. Class description: A class to define and create the DB schema. Method signatures and docstrings: - def __init__(self, engine: Engine): Declare the SQLAlchemy schema for the database. - def create(self) -> 'DbSchema': Create the DB schema. - def __repr__(self) -> ...
0db80043dad256d77dc4c2b4fc54aa0b0aa2597f
<|skeleton|> class DbSchema: """A class to define and create the DB schema.""" def __init__(self, engine: Engine): """Declare the SQLAlchemy schema for the database.""" <|body_0|> def create(self) -> 'DbSchema': """Create the DB schema.""" <|body_1|> def __repr__(self)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DbSchema: """A class to define and create the DB schema.""" def __init__(self, engine: Engine): """Declare the SQLAlchemy schema for the database.""" _LOG.info('Create the DB schema for: %s', engine) self._engine = engine self._meta = MetaData() self.experiment = T...
the_stack_v2_python_sparse
mlos_bench/mlos_bench/storage/sql/schema.py
microsoft/MLOS
train
109
138338e54292d88b340bd40a27dcc7fe96038bf9
[ "settings.addListsToRepository('skeinforge_tools.craft_plugins.home.html', '', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Home', self, '')\nself.openWikiManualHelpPage = settings.HelpPage().getOpenFromAbsolute('http://www.bits...
<|body_start_0|> settings.addListsToRepository('skeinforge_tools.craft_plugins.home.html', '', self) self.fileNameInput = settings.FileNameInput().getFromFileName(interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Home', self, '') self.openWikiManualHelpPage = settings.HelpPage().ge...
A class to handle the home settings.
HomeRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HomeRepository: """A class to handle the home settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Home button has been clicked.""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_016785
8,710
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Home button has been clicked.", "name": "execute", "signature": "def execute(self)" } ]
2
stack_v2_sparse_classes_30k_train_014193
Implement the Python class `HomeRepository` described below. Class description: A class to handle the home settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Home button has been clicked.
Implement the Python class `HomeRepository` described below. Class description: A class to handle the home settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Home button has been clicked. <|skeleton|> class HomeRepositor...
fd69d8e856780c826386dc973ceabcc03623f3e8
<|skeleton|> class HomeRepository: """A class to handle the home settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Home button has been clicked.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HomeRepository: """A class to handle the home settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" settings.addListsToRepository('skeinforge_tools.craft_plugins.home.html', '', self) self.fileNameInput = settings.FileNameInput().getFr...
the_stack_v2_python_sparse
skeinforge_tools/craft_plugins/home.py
bmander/skeinforge
train
34
19bdb62449eb1c3a44ee0e075d6c331c3a4d6ce8
[ "self.snmp_object = snmp_object\ntest_oid = '.1.3.6.1.2.1.1.1.0'\nsuper().__init__(snmp_object, test_oid, tags=['system'])", "data_dict = defaultdict(lambda: defaultdict(dict))\nfinal = {}\ngetvalues = [0]\nkey = 0\noidroot = '.1.3.6.1.2.1.1'\nfor node in range(1, 7):\n oid = '{}.{}.0'.format(oidroot, node)\n ...
<|body_start_0|> self.snmp_object = snmp_object test_oid = '.1.3.6.1.2.1.1.1.0' super().__init__(snmp_object, test_oid, tags=['system']) <|end_body_0|> <|body_start_1|> data_dict = defaultdict(lambda: defaultdict(dict)) final = {} getvalues = [0] key = 0 ...
Class interacts with devices supporting SNMPv2-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. system: Returns all relevant system information ...
Snmpv2Query
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Snmpv2Query: """Class interacts with devices supporting SNMPv2-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. system: R...
stack_v2_sparse_classes_36k_train_016786
2,947
permissive
[ { "docstring": "Function for intializing the class. Args: snmp_object: SNMP Interact class object from snmp_manager.py Returns: None", "name": "__init__", "signature": "def __init__(self, snmp_object)" }, { "docstring": "Get system data from device. Args: None Returns: final: Final results", ...
2
null
Implement the Python class `Snmpv2Query` described below. Class description: Class interacts with devices supporting SNMPv2-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a respo...
Implement the Python class `Snmpv2Query` described below. Class description: Class interacts with devices supporting SNMPv2-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a respo...
ae82589fbbab77fef6d6be09c1fcca5846f595a8
<|skeleton|> class Snmpv2Query: """Class interacts with devices supporting SNMPv2-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. system: R...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Snmpv2Query: """Class interacts with devices supporting SNMPv2-MIB. Args: None Returns: None Key Methods: supported: Queries the device to determine whether the MIB is supported using a known OID defined in the MIB. Returns True if the device returns a response to the OID, False if not. system: Returns all re...
the_stack_v2_python_sparse
switchmap/snmp/mib_snmpv2.py
PalisadoesFoundation/switchmap-ng
train
8
ed4eb0bcfc0bae64639a6bec0c52ce12cadc8aa9
[ "self.kids = dict()\nself.val = None\nself.isWord = False", "current_node = self\nfor idx, letter in enumerate(word):\n if letter not in current_node.kids:\n current_node.kids[letter] = WordDictionary()\n current_node.kids[letter].val = letter\n current_node = current_node.kids[letter]\n if...
<|body_start_0|> self.kids = dict() self.val = None self.isWord = False <|end_body_0|> <|body_start_1|> current_node = self for idx, letter in enumerate(word): if letter not in current_node.kids: current_node.kids[letter] = WordDictionary() ...
WordDictionary
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDictionary: def __init__(self): """Initialize your data structure here.""" <|body_0|> def addWord(self, word): """Adds a word into the data structure. :type word: str :rtype: void""" <|body_1|> def search(self, word): """Returns if the word i...
stack_v2_sparse_classes_36k_train_016787
2,131
permissive
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Adds a word into the data structure. :type word: str :rtype: void", "name": "addWord", "signature": "def addWord(self, word)" }, { "docstring": "Returns...
3
stack_v2_sparse_classes_30k_train_001111
Implement the Python class `WordDictionary` described below. Class description: Implement the WordDictionary class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def addWord(self, word): Adds a word into the data structure. :type word: str :rtype: void - def search(sel...
Implement the Python class `WordDictionary` described below. Class description: Implement the WordDictionary class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def addWord(self, word): Adds a word into the data structure. :type word: str :rtype: void - def search(sel...
f462b66ae849f4332a4b150f206dd49c7519e83b
<|skeleton|> class WordDictionary: def __init__(self): """Initialize your data structure here.""" <|body_0|> def addWord(self, word): """Adds a word into the data structure. :type word: str :rtype: void""" <|body_1|> def search(self, word): """Returns if the word i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordDictionary: def __init__(self): """Initialize your data structure here.""" self.kids = dict() self.val = None self.isWord = False def addWord(self, word): """Adds a word into the data structure. :type word: str :rtype: void""" current_node = self ...
the_stack_v2_python_sparse
LeetCode/DataStructure/trie/word_dictionary.py
hooyao/Coding-Py3
train
0
b2f0faf6733885316a14c0f06744044a03c59255
[ "task_id = request.GET.get('task_id', '')\nif not task_id:\n error_msg = 'task_id invalid.'\n return api_error(status.HTTP_400_BAD_REQUEST, error_msg)\nresp = query_dtable_io_status(task_id)\nif resp.status_code == 400:\n error_msg = 'task_id invalid.'\n return api_error(status.HTTP_400_BAD_REQUEST, err...
<|body_start_0|> task_id = request.GET.get('task_id', '') if not task_id: error_msg = 'task_id invalid.' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) resp = query_dtable_io_status(task_id) if resp.status_code == 400: error_msg = 'task_id in...
DTableIOStatus
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DTableIOStatus: def get(self, request): """Get task status by task id :param request: :return:""" <|body_0|> def delete(self, request): """Delete task by task_id :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> task_id = requ...
stack_v2_sparse_classes_36k_train_016788
12,942
no_license
[ { "docstring": "Get task status by task id :param request: :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Delete task by task_id :param request: :return:", "name": "delete", "signature": "def delete(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_019649
Implement the Python class `DTableIOStatus` described below. Class description: Implement the DTableIOStatus class. Method signatures and docstrings: - def get(self, request): Get task status by task id :param request: :return: - def delete(self, request): Delete task by task_id :param request: :return:
Implement the Python class `DTableIOStatus` described below. Class description: Implement the DTableIOStatus class. Method signatures and docstrings: - def get(self, request): Get task status by task id :param request: :return: - def delete(self, request): Delete task by task_id :param request: :return: <|skeleton|>...
3d08b64bf2a3724326eab9dfa771863bc6743bc2
<|skeleton|> class DTableIOStatus: def get(self, request): """Get task status by task id :param request: :return:""" <|body_0|> def delete(self, request): """Delete task by task_id :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DTableIOStatus: def get(self, request): """Get task status by task id :param request: :return:""" task_id = request.GET.get('task_id', '') if not task_id: error_msg = 'task_id invalid.' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) resp = quer...
the_stack_v2_python_sparse
seahub/api2/endpoints/dtable_io.py
flazx/dtable-web
train
0
9aaaac180142af446bacd842649be82a7963827e
[ "if vals.get('tax_ids'):\n if len(vals.get('tax_ids')[0][2]) > 1:\n raise UserError('A product can only have one tax')\nreturn super(InheritAccountInvoiceLine, self).create(vals)", "if vals.get('tax_ids'):\n if len(vals.get('tax_ids')[0][2]) > 1:\n raise UserError('A product can only have one ...
<|body_start_0|> if vals.get('tax_ids'): if len(vals.get('tax_ids')[0][2]) > 1: raise UserError('A product can only have one tax') return super(InheritAccountInvoiceLine, self).create(vals) <|end_body_0|> <|body_start_1|> if vals.get('tax_ids'): if len(va...
InheritAccountInvoiceLine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InheritAccountInvoiceLine: def create(self, vals): """Inheriting the core function, create to validate to stop adding two or more taxes to the product""" <|body_0|> def write(self, vals): """Inheriting the core function, write to validate to stop adding two or more t...
stack_v2_sparse_classes_36k_train_016789
1,589
no_license
[ { "docstring": "Inheriting the core function, create to validate to stop adding two or more taxes to the product", "name": "create", "signature": "def create(self, vals)" }, { "docstring": "Inheriting the core function, write to validate to stop adding two or more taxes to the product", "nam...
2
stack_v2_sparse_classes_30k_train_001238
Implement the Python class `InheritAccountInvoiceLine` described below. Class description: Implement the InheritAccountInvoiceLine class. Method signatures and docstrings: - def create(self, vals): Inheriting the core function, create to validate to stop adding two or more taxes to the product - def write(self, vals)...
Implement the Python class `InheritAccountInvoiceLine` described below. Class description: Implement the InheritAccountInvoiceLine class. Method signatures and docstrings: - def create(self, vals): Inheriting the core function, create to validate to stop adding two or more taxes to the product - def write(self, vals)...
9de7a2ce6a17d43107ee08085c9f83a525382798
<|skeleton|> class InheritAccountInvoiceLine: def create(self, vals): """Inheriting the core function, create to validate to stop adding two or more taxes to the product""" <|body_0|> def write(self, vals): """Inheriting the core function, write to validate to stop adding two or more t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InheritAccountInvoiceLine: def create(self, vals): """Inheriting the core function, create to validate to stop adding two or more taxes to the product""" if vals.get('tax_ids'): if len(vals.get('tax_ids')[0][2]) > 1: raise UserError('A product can only have one tax'...
the_stack_v2_python_sparse
custom_taxes/models/custom_invoice.py
EshangAllion/cenmetrix_v12
train
0
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a
[ "super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([bart_layer.self_attn.q_proj.weight, bart_layer.self_attn.k_proj.weight, bart_layer.self_attn.v_proj.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([bart_layer.self_attn.q_proj.bias, bart_layer.self_attn.k_proj.bias, bart_layer.self_attn...
<|body_start_0|> super().__init__(config) self.in_proj_weight = nn.Parameter(torch.cat([bart_layer.self_attn.q_proj.weight, bart_layer.self_attn.k_proj.weight, bart_layer.self_attn.v_proj.weight])) self.in_proj_bias = nn.Parameter(torch.cat([bart_layer.self_attn.q_proj.bias, bart_layer.self_attn...
BartEncoderLayerBetterTransformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BartEncoderLayerBetterTransformer: def __init__(self, bart_layer, config): """A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation. Args: bart_layer (`torch.nn.Module`): The original `BartEncoderLayer` where the weights needs to be retrieved.""" ...
stack_v2_sparse_classes_36k_train_016790
43,670
no_license
[ { "docstring": "A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation. Args: bart_layer (`torch.nn.Module`): The original `BartEncoderLayer` where the weights needs to be retrieved.", "name": "__init__", "signature": "def __init__(self, bart_layer, config)" }, { ...
2
stack_v2_sparse_classes_30k_train_004157
Implement the Python class `BartEncoderLayerBetterTransformer` described below. Class description: Implement the BartEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, bart_layer, config): A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation....
Implement the Python class `BartEncoderLayerBetterTransformer` described below. Class description: Implement the BartEncoderLayerBetterTransformer class. Method signatures and docstrings: - def __init__(self, bart_layer, config): A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation....
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class BartEncoderLayerBetterTransformer: def __init__(self, bart_layer, config): """A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation. Args: bart_layer (`torch.nn.Module`): The original `BartEncoderLayer` where the weights needs to be retrieved.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BartEncoderLayerBetterTransformer: def __init__(self, bart_layer, config): """A simple conversion of the `BartEncoderLayer` to its `BetterTransformer` implementation. Args: bart_layer (`torch.nn.Module`): The original `BartEncoderLayer` where the weights needs to be retrieved.""" super().__ini...
the_stack_v2_python_sparse
generated/test_huggingface_optimum.py
jansel/pytorch-jit-paritybench
train
35
07f361369e2d9dd9a11ce9a1eda5577e116772e9
[ "if not self._run_id:\n if self.config.pipelineRunId:\n self._run_id = str(self.config.pipelineRunId.__root__)\n else:\n self._run_id = str(uuid.uuid4())\nreturn self._run_id", "if self.config.ingestionPipelineFQN:\n if state in (PipelineState.queued, PipelineState.running):\n pipeli...
<|body_start_0|> if not self._run_id: if self.config.pipelineRunId: self._run_id = str(self.config.pipelineRunId.__root__) else: self._run_id = str(uuid.uuid4()) return self._run_id <|end_body_0|> <|body_start_1|> if self.config.ingestionP...
Helper methods to manage IngestionPipeline status and workflow run ID
WorkflowStatusMixin
[ "Apache-2.0", "BSD-3-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowStatusMixin: """Helper methods to manage IngestionPipeline status and workflow run ID""" def run_id(self) -> str: """If the config does not have an informed run id, we'll generate and assign one here.""" <|body_0|> def set_ingestion_pipeline_status(self, state: P...
stack_v2_sparse_classes_36k_train_016791
3,278
permissive
[ { "docstring": "If the config does not have an informed run id, we'll generate and assign one here.", "name": "run_id", "signature": "def run_id(self) -> str" }, { "docstring": "Method to set the pipeline status of current ingestion pipeline", "name": "set_ingestion_pipeline_status", "si...
3
stack_v2_sparse_classes_30k_train_005188
Implement the Python class `WorkflowStatusMixin` described below. Class description: Helper methods to manage IngestionPipeline status and workflow run ID Method signatures and docstrings: - def run_id(self) -> str: If the config does not have an informed run id, we'll generate and assign one here. - def set_ingestio...
Implement the Python class `WorkflowStatusMixin` described below. Class description: Helper methods to manage IngestionPipeline status and workflow run ID Method signatures and docstrings: - def run_id(self) -> str: If the config does not have an informed run id, we'll generate and assign one here. - def set_ingestio...
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
<|skeleton|> class WorkflowStatusMixin: """Helper methods to manage IngestionPipeline status and workflow run ID""" def run_id(self) -> str: """If the config does not have an informed run id, we'll generate and assign one here.""" <|body_0|> def set_ingestion_pipeline_status(self, state: P...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkflowStatusMixin: """Helper methods to manage IngestionPipeline status and workflow run ID""" def run_id(self) -> str: """If the config does not have an informed run id, we'll generate and assign one here.""" if not self._run_id: if self.config.pipelineRunId: ...
the_stack_v2_python_sparse
govern/data-meta/OpenMetadata/ingestion/src/metadata/workflow/workflow_status_mixin.py
alldatacenter/alldata
train
774
773cca7cfe72067d2b3179a17cf1aaf969be0f9a
[ "self.num_rnn_layers = hyper_parameters['model'].get('num_rnn_layers', 1)\nself.rnn_type = hyper_parameters['model'].get('rnn_type', 'LSTM')\nself.rnn_units = hyper_parameters['model'].get('rnn_units', 512)\nself.crf_mode = hyper_parameters['model'].get('crf_mode', 'reg')\nself.supports_masking = hyper_parameters['...
<|body_start_0|> self.num_rnn_layers = hyper_parameters['model'].get('num_rnn_layers', 1) self.rnn_type = hyper_parameters['model'].get('rnn_type', 'LSTM') self.rnn_units = hyper_parameters['model'].get('rnn_units', 512) self.crf_mode = hyper_parameters['model'].get('crf_mode', 'reg') ...
BilstmCRFGraph
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BilstmCRFGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" <|body_0|> def create_model(self, hyper_parameters): """构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_016792
3,345
permissive
[ { "docstring": "初始化 :param hyper_parameters: json,超参", "name": "__init__", "signature": "def __init__(self, hyper_parameters)" }, { "docstring": "构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl", "name": "create_model", "signature": "def create_mod...
3
stack_v2_sparse_classes_30k_train_020841
Implement the Python class `BilstmCRFGraph` described below. Class description: Implement the BilstmCRFGraph class. Method signatures and docstrings: - def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参 - def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper para...
Implement the Python class `BilstmCRFGraph` described below. Class description: Implement the BilstmCRFGraph class. Method signatures and docstrings: - def __init__(self, hyper_parameters): 初始化 :param hyper_parameters: json,超参 - def create_model(self, hyper_parameters): 构建神经网络 :param hyper_parameters:json, hyper para...
1d7b8f9938cb8b6d7744e9caabc3eb41c8891283
<|skeleton|> class BilstmCRFGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" <|body_0|> def create_model(self, hyper_parameters): """构建神经网络 :param hyper_parameters:json, hyper parameters of network :return: tensor, moedl""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BilstmCRFGraph: def __init__(self, hyper_parameters): """初始化 :param hyper_parameters: json,超参""" self.num_rnn_layers = hyper_parameters['model'].get('num_rnn_layers', 1) self.rnn_type = hyper_parameters['model'].get('rnn_type', 'LSTM') self.rnn_units = hyper_parameters['model']...
the_stack_v2_python_sparse
macropodus/network/graph/bilstm_crf.py
a627414850/Macropodus
train
0
6f64efdb14998a2bfd728bdcdedcea2ef27de6f6
[ "return_type = self.second\nwhile isinstance(return_type, ComplexType):\n return_type = return_type.second\nreturn return_type", "arguments = [self.first]\nremaining_type = self.second\nwhile isinstance(remaining_type, ComplexType):\n arguments.append(remaining_type.first)\n remaining_type = remaining_ty...
<|body_start_0|> return_type = self.second while isinstance(return_type, ComplexType): return_type = return_type.second return return_type <|end_body_0|> <|body_start_1|> arguments = [self.first] remaining_type = self.second while isinstance(remaining_type, C...
In NLTK, a ``ComplexType`` is a function. These functions are curried, so if you need multiple arguments for your function you nest ``ComplexTypes``. That currying makes things difficult for us, and we mitigate the problems by adding ``return_type`` and ``argument_type`` functions to ``ComplexType``.
ComplexType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComplexType: """In NLTK, a ``ComplexType`` is a function. These functions are curried, so if you need multiple arguments for your function you nest ``ComplexTypes``. That currying makes things difficult for us, and we mitigate the problems by adding ``return_type`` and ``argument_type`` functions...
stack_v2_sparse_classes_36k_train_016793
36,351
permissive
[ { "docstring": "Gives the final return type for this function. If the function takes a single argument, this is just ``self.second``. If the function takes multiple arguments and returns a basic type, this should be the final ``.second`` after following all complex types. That is the implementation here in the ...
3
null
Implement the Python class `ComplexType` described below. Class description: In NLTK, a ``ComplexType`` is a function. These functions are curried, so if you need multiple arguments for your function you nest ``ComplexTypes``. That currying makes things difficult for us, and we mitigate the problems by adding ``return...
Implement the Python class `ComplexType` described below. Class description: In NLTK, a ``ComplexType`` is a function. These functions are curried, so if you need multiple arguments for your function you nest ``ComplexTypes``. That currying makes things difficult for us, and we mitigate the problems by adding ``return...
ccf60824b28f0ce8ceda44a7ce52a0d117669115
<|skeleton|> class ComplexType: """In NLTK, a ``ComplexType`` is a function. These functions are curried, so if you need multiple arguments for your function you nest ``ComplexTypes``. That currying makes things difficult for us, and we mitigate the problems by adding ``return_type`` and ``argument_type`` functions...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComplexType: """In NLTK, a ``ComplexType`` is a function. These functions are curried, so if you need multiple arguments for your function you nest ``ComplexTypes``. That currying makes things difficult for us, and we mitigate the problems by adding ``return_type`` and ``argument_type`` functions to ``Complex...
the_stack_v2_python_sparse
allennlp/allennlp/semparse/type_declarations/type_declaration.py
ethanjperez/convince
train
27
bc7b2384045e28fe1f1254b8c95c8a36dcc45273
[ "self.name = name\nself.required = name in all_args\nself.validators = []\nif not isinstance(types, tuple):\n types = (types,)\nfor type_ in types:\n self.validators.append(type_() if type(type_) is type else type_)", "processed_value = value\nfor type_validator in self.validators:\n try:\n proces...
<|body_start_0|> self.name = name self.required = name in all_args self.validators = [] if not isinstance(types, tuple): types = (types,) for type_ in types: self.validators.append(type_() if type(type_) is type else type_) <|end_body_0|> <|body_start_1|>...
This class incapsulates metadata about parameter. It stores if parameter is mandatory and a list of validator and the name of the argument.
ParameterType
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParameterType: """This class incapsulates metadata about parameter. It stores if parameter is mandatory and a list of validator and the name of the argument.""" def __init__(self, name, types, all_args): """Constructor. :param str name: The name of the argument :param list types: The...
stack_v2_sparse_classes_36k_train_016794
8,864
permissive
[ { "docstring": "Constructor. :param str name: The name of the argument :param list types: The list of types (validators) which have to be applied to incoming parameter :param set all_args: The list of all arguments. This is required to check if parameter is mandatory or not.", "name": "__init__", "signa...
2
stack_v2_sparse_classes_30k_train_014088
Implement the Python class `ParameterType` described below. Class description: This class incapsulates metadata about parameter. It stores if parameter is mandatory and a list of validator and the name of the argument. Method signatures and docstrings: - def __init__(self, name, types, all_args): Constructor. :param ...
Implement the Python class `ParameterType` described below. Class description: This class incapsulates metadata about parameter. It stores if parameter is mandatory and a list of validator and the name of the argument. Method signatures and docstrings: - def __init__(self, name, types, all_args): Constructor. :param ...
bc0cfe3067bf1cbf26789f7443a36e7cdd2ac869
<|skeleton|> class ParameterType: """This class incapsulates metadata about parameter. It stores if parameter is mandatory and a list of validator and the name of the argument.""" def __init__(self, name, types, all_args): """Constructor. :param str name: The name of the argument :param list types: The...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParameterType: """This class incapsulates metadata about parameter. It stores if parameter is mandatory and a list of validator and the name of the argument.""" def __init__(self, name, types, all_args): """Constructor. :param str name: The name of the argument :param list types: The list of type...
the_stack_v2_python_sparse
backend/api/check_params.py
omarabdalhamid/boss
train
0
e5b98006f2d47e4b0183060427ccf1be69609c21
[ "self.error = ftol\nself.iterationMax = iterations_max\nself.correct_factor = correct_factor", "iteration = state['iteration']\nold_value = state['old_value']\nnew_value = state['new_value']\nold_parameters = state['old_parameters']\nnew_parameters = state['new_parameters']\nreturn iteration > self.iterationMax o...
<|body_start_0|> self.error = ftol self.iterationMax = iterations_max self.correct_factor = correct_factor <|end_body_0|> <|body_start_1|> iteration = state['iteration'] old_value = state['old_value'] new_value = state['new_value'] old_parameters = state['old_par...
The Akaike information criterion
AICCriterion
[ "BSD-3-Clause", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AICCriterion: """The Akaike information criterion""" def __init__(self, ftol, iterations_max, correct_factor=1.0): """Initializes the criterion with a max number of iterations and an error fraction for the monotony test - ftol is the relative tolerance of the AIC criterion - correct_...
stack_v2_sparse_classes_36k_train_016795
2,400
permissive
[ { "docstring": "Initializes the criterion with a max number of iterations and an error fraction for the monotony test - ftol is the relative tolerance of the AIC criterion - correct_factor is the modifiying factor for the weight of the parameters size", "name": "__init__", "signature": "def __init__(sel...
2
stack_v2_sparse_classes_30k_train_007707
Implement the Python class `AICCriterion` described below. Class description: The Akaike information criterion Method signatures and docstrings: - def __init__(self, ftol, iterations_max, correct_factor=1.0): Initializes the criterion with a max number of iterations and an error fraction for the monotony test - ftol ...
Implement the Python class `AICCriterion` described below. Class description: The Akaike information criterion Method signatures and docstrings: - def __init__(self, ftol, iterations_max, correct_factor=1.0): Initializes the criterion with a max number of iterations and an error fraction for the monotony test - ftol ...
3d298e908ff55340cd3612078508be0c791f63a8
<|skeleton|> class AICCriterion: """The Akaike information criterion""" def __init__(self, ftol, iterations_max, correct_factor=1.0): """Initializes the criterion with a max number of iterations and an error fraction for the monotony test - ftol is the relative tolerance of the AIC criterion - correct_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AICCriterion: """The Akaike information criterion""" def __init__(self, ftol, iterations_max, correct_factor=1.0): """Initializes the criterion with a max number of iterations and an error fraction for the monotony test - ftol is the relative tolerance of the AIC criterion - correct_factor is the...
the_stack_v2_python_sparse
PyDSTool/Toolbox/optimizers/criterion/information_criteria.py
mdlama/pydstool
train
2
b854e668d4929b5e271e62838ee82a045c7da417
[ "def _byte_size(i):\n for j in range(8):\n if 1 & data[i] >> 7 - j != 1:\n return j\n return 8\n\ndef _rec(i):\n if i == len(data):\n return True\n byte_size = _byte_size(i)\n if byte_size == 0:\n return _rec(i + 1)\n if byte_size == 1 or byte_size > 4 or i + byte_s...
<|body_start_0|> def _byte_size(i): for j in range(8): if 1 & data[i] >> 7 - j != 1: return j return 8 def _rec(i): if i == len(data): return True byte_size = _byte_size(i) if byte_size == 0:...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validUtf8(self, data: List[int]) -> bool: """04/20/2020 06:37""" <|body_0|> def validUtf8(self, data: List[int]) -> bool: """10/03/2022 21:32""" <|body_1|> <|end_skeleton|> <|body_start_0|> def _byte_size(i): for j in range...
stack_v2_sparse_classes_36k_train_016796
3,814
no_license
[ { "docstring": "04/20/2020 06:37", "name": "validUtf8", "signature": "def validUtf8(self, data: List[int]) -> bool" }, { "docstring": "10/03/2022 21:32", "name": "validUtf8", "signature": "def validUtf8(self, data: List[int]) -> bool" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validUtf8(self, data: List[int]) -> bool: 04/20/2020 06:37 - def validUtf8(self, data: List[int]) -> bool: 10/03/2022 21:32
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validUtf8(self, data: List[int]) -> bool: 04/20/2020 06:37 - def validUtf8(self, data: List[int]) -> bool: 10/03/2022 21:32 <|skeleton|> class Solution: def validUtf8(s...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def validUtf8(self, data: List[int]) -> bool: """04/20/2020 06:37""" <|body_0|> def validUtf8(self, data: List[int]) -> bool: """10/03/2022 21:32""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def validUtf8(self, data: List[int]) -> bool: """04/20/2020 06:37""" def _byte_size(i): for j in range(8): if 1 & data[i] >> 7 - j != 1: return j return 8 def _rec(i): if i == len(data): ...
the_stack_v2_python_sparse
leetcode/solved/393_UTF-8_Validation/solution.py
sungminoh/algorithms
train
0
74bc6036a6b7e0ec5031a7d1023a1b570f6948ab
[ "super().__init__()\nself.level1 = CBR(3, 16, 3, 2)\nself.sample1 = InputProjectionA(1)\nself.sample2 = InputProjectionA(2)\nself.b1 = BR(16 + 3)\nself.level2_0 = DownSamplerB(16 + 3, 64)\nself.level2 = nn.ModuleList()\nfor i in range(0, p):\n self.level2.append(DilatedParllelResidualBlockB(64, 64))\nself.b2 = B...
<|body_start_0|> super().__init__() self.level1 = CBR(3, 16, 3, 2) self.sample1 = InputProjectionA(1) self.sample2 = InputProjectionA(2) self.b1 = BR(16 + 3) self.level2_0 = DownSamplerB(16 + 3, 64) self.level2 = nn.ModuleList() for i in range(0, p): ...
This class defines the ESPNetX4-C network in the paper
ESPNetX4_Encoder
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ESPNetX4_Encoder: """This class defines the ESPNetX4-C network in the paper""" def __init__(self, classes=19, p=5, q=3): """:param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplier :param q: depth multiplier""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_016797
44,685
permissive
[ { "docstring": ":param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplier :param q: depth multiplier", "name": "__init__", "signature": "def __init__(self, classes=19, p=5, q=3)" }, { "docstring": ":param input: Receives the input RGB image :re...
2
null
Implement the Python class `ESPNetX4_Encoder` described below. Class description: This class defines the ESPNetX4-C network in the paper Method signatures and docstrings: - def __init__(self, classes=19, p=5, q=3): :param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth mult...
Implement the Python class `ESPNetX4_Encoder` described below. Class description: This class defines the ESPNetX4-C network in the paper Method signatures and docstrings: - def __init__(self, classes=19, p=5, q=3): :param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth mult...
27272e43126a507a6d93b21cd2372f5432f61237
<|skeleton|> class ESPNetX4_Encoder: """This class defines the ESPNetX4-C network in the paper""" def __init__(self, classes=19, p=5, q=3): """:param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplier :param q: depth multiplier""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ESPNetX4_Encoder: """This class defines the ESPNetX4-C network in the paper""" def __init__(self, classes=19, p=5, q=3): """:param classes: number of classes in the dataset. Default is 20 for the cityscapes :param p: depth multiplier :param q: depth multiplier""" super().__init__() ...
the_stack_v2_python_sparse
model/ESPNetX4.py
Ethan-ye/Efficient-Segmentation-Networks
train
0
6fa0e727342da59ddf1910e47a2e3312a0cfb782
[ "self.config_entry = config_entry\nself.data = dict(self.config_entry.data)\nself._all_region_codes_sorted: dict[str, str] = {}\nself.regions: dict[str, dict[str, Any]] = {}\nfor name in CONST_REGIONS:\n self.regions[name] = {}\n if name not in self.data:\n self.data[name] = []", "errors: dict[str, A...
<|body_start_0|> self.config_entry = config_entry self.data = dict(self.config_entry.data) self._all_region_codes_sorted: dict[str, str] = {} self.regions: dict[str, dict[str, Any]] = {} for name in CONST_REGIONS: self.regions[name] = {} if name not in sel...
Handle a option flow for nut.
OptionsFlowHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OptionsFlowHandler: """Handle a option flow for nut.""" def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Handle options flow.""" <|body_1|>...
stack_v2_sparse_classes_36k_train_016798
9,354
permissive
[ { "docstring": "Initialize options flow.", "name": "__init__", "signature": "def __init__(self, config_entry: config_entries.ConfigEntry) -> None" }, { "docstring": "Handle options flow.", "name": "async_step_init", "signature": "async def async_step_init(self, user_input=None)" } ]
2
stack_v2_sparse_classes_30k_train_014965
Implement the Python class `OptionsFlowHandler` described below. Class description: Handle a option flow for nut. Method signatures and docstrings: - def __init__(self, config_entry: config_entries.ConfigEntry) -> None: Initialize options flow. - async def async_step_init(self, user_input=None): Handle options flow.
Implement the Python class `OptionsFlowHandler` described below. Class description: Handle a option flow for nut. Method signatures and docstrings: - def __init__(self, config_entry: config_entries.ConfigEntry) -> None: Initialize options flow. - async def async_step_init(self, user_input=None): Handle options flow. ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class OptionsFlowHandler: """Handle a option flow for nut.""" def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" <|body_0|> async def async_step_init(self, user_input=None): """Handle options flow.""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OptionsFlowHandler: """Handle a option flow for nut.""" def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry self.data = dict(self.config_entry.data) self._all_region_codes_sorted: dict[str, s...
the_stack_v2_python_sparse
homeassistant/components/nina/config_flow.py
home-assistant/core
train
35,501
0199f93f852d0f1dad8dce51c4bd2c2f64898011
[ "timestamp_string = plist_key.get(plist_value_name, None)\nif not timestamp_string:\n return None\ntry:\n timestamp = float(timestamp_string)\nexcept (TypeError, ValueError):\n parser_mediator.ProduceExtractionWarning('unable to convert Cocoa timestamp: {0:s} to a floating-point value'.format(timestamp_str...
<|body_start_0|> timestamp_string = plist_key.get(plist_value_name, None) if not timestamp_string: return None try: timestamp = float(timestamp_string) except (TypeError, ValueError): parser_mediator.ProduceExtractionWarning('unable to convert Cocoa ti...
Plist parser plugin for Safari history plist files.
SafariHistoryPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SafariHistoryPlugin: """Plist parser plugin for Safari history plist files.""" def _GetDateTimeValueFromTimestamp(self, parser_mediator, plist_key, plist_value_name): """Retrieves a date and time value from a Cocoa timestamp. Args: parser_mediator (ParserMediator): mediates interacti...
stack_v2_sparse_classes_36k_train_016799
3,790
permissive
[ { "docstring": "Retrieves a date and time value from a Cocoa timestamp. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. plist_key (object): plist key. plist_value_name (str): name of the value in the plist key. Returns: dfdatetime.Ti...
2
null
Implement the Python class `SafariHistoryPlugin` described below. Class description: Plist parser plugin for Safari history plist files. Method signatures and docstrings: - def _GetDateTimeValueFromTimestamp(self, parser_mediator, plist_key, plist_value_name): Retrieves a date and time value from a Cocoa timestamp. A...
Implement the Python class `SafariHistoryPlugin` described below. Class description: Plist parser plugin for Safari history plist files. Method signatures and docstrings: - def _GetDateTimeValueFromTimestamp(self, parser_mediator, plist_key, plist_value_name): Retrieves a date and time value from a Cocoa timestamp. A...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class SafariHistoryPlugin: """Plist parser plugin for Safari history plist files.""" def _GetDateTimeValueFromTimestamp(self, parser_mediator, plist_key, plist_value_name): """Retrieves a date and time value from a Cocoa timestamp. Args: parser_mediator (ParserMediator): mediates interacti...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SafariHistoryPlugin: """Plist parser plugin for Safari history plist files.""" def _GetDateTimeValueFromTimestamp(self, parser_mediator, plist_key, plist_value_name): """Retrieves a date and time value from a Cocoa timestamp. Args: parser_mediator (ParserMediator): mediates interactions between p...
the_stack_v2_python_sparse
plaso/parsers/plist_plugins/safari_history.py
log2timeline/plaso
train
1,506