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
9b46eb50a050afc043d861837998c4a9c917e3fe
[ "self.dtype = dtype\nself.input_dim = input_dim\nself.hidden1_dim = hidden1_dim\nself.hidden2_dim = hidden2_dim\nself.W1 = numx.random.randn(input_dim, hidden1_dim) * 0.01\nself.W2 = numx.random.randn(hidden1_dim, hidden2_dim) * 0.01\nself.o1 = numx.zeros((1, input_dim))\nself.o2 = numx.zeros((1, hidden1_dim))\nsel...
<|body_start_0|> self.dtype = dtype self.input_dim = input_dim self.hidden1_dim = hidden1_dim self.hidden2_dim = hidden2_dim self.W1 = numx.random.randn(input_dim, hidden1_dim) * 0.01 self.W2 = numx.random.randn(hidden1_dim, hidden2_dim) * 0.01 self.o1 = numx.zero...
BinaryBinaryDBM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryBinaryDBM: def __init__(self, input_dim, hidden1_dim, hidden2_dim, offset_typ, data, dtype=numx.float64): """Initializes the network :Parameters: input_dim: Number of input dimensions. -type: int hidden1_dim: Number of hidden dimensions for the first hidden layer. -type: int hidden...
stack_v2_sparse_classes_36k_train_020800
7,061
no_license
[ { "docstring": "Initializes the network :Parameters: input_dim: Number of input dimensions. -type: int hidden1_dim: Number of hidden dimensions for the first hidden layer. -type: int hidden2_dim: Number of hidden dimensions for the first hidden layer. -type: int offset_typ: Typs of offset values used for specif...
4
stack_v2_sparse_classes_30k_train_005722
Implement the Python class `BinaryBinaryDBM` described below. Class description: Implement the BinaryBinaryDBM class. Method signatures and docstrings: - def __init__(self, input_dim, hidden1_dim, hidden2_dim, offset_typ, data, dtype=numx.float64): Initializes the network :Parameters: input_dim: Number of input dimen...
Implement the Python class `BinaryBinaryDBM` described below. Class description: Implement the BinaryBinaryDBM class. Method signatures and docstrings: - def __init__(self, input_dim, hidden1_dim, hidden2_dim, offset_typ, data, dtype=numx.float64): Initializes the network :Parameters: input_dim: Number of input dimen...
997879373110b2ee69fba921d46a309443c8e374
<|skeleton|> class BinaryBinaryDBM: def __init__(self, input_dim, hidden1_dim, hidden2_dim, offset_typ, data, dtype=numx.float64): """Initializes the network :Parameters: input_dim: Number of input dimensions. -type: int hidden1_dim: Number of hidden dimensions for the first hidden layer. -type: int hidden...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinaryBinaryDBM: def __init__(self, input_dim, hidden1_dim, hidden2_dim, offset_typ, data, dtype=numx.float64): """Initializes the network :Parameters: input_dim: Number of input dimensions. -type: int hidden1_dim: Number of hidden dimensions for the first hidden layer. -type: int hidden2_dim: Number ...
the_stack_v2_python_sparse
pydeep/dbm/binary3Layer/model.py
MelJan/PyDeep
train
50
7f9335ddca10a3ee38c897d2fe124757df4832be
[ "if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0):\n raise Exception('server_ip和server_port必须同时指定')\nself._server_ip = server_ip\nself._server_port = server_port\nself._service_name = service_name\nself._host = host", "headers = {'org': org, 'user': user}\nroute_name = ''\nserv...
<|body_start_0|> if server_ip == '' and server_port != 0 or (server_ip != '' and server_port == 0): raise Exception('server_ip和server_port必须同时指定') self._server_ip = server_ip self._server_port = server_port self._service_name = service_name self._host = host <|end_bod...
CollectorHistoryClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CollectorHistoryClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server...
stack_v2_sparse_classes_36k_train_020801
3,038
permissive
[ { "docstring": "初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_name同时设置,server_ip优先级更高 :param host: 指定sdk请求服务的host名称, 如cmdb.easyops-only.com", "name": "__ini...
2
stack_v2_sparse_classes_30k_train_005649
Implement the Python class `CollectorHistoryClient` described below. Class description: Implement the CollectorHistoryClient class. Method signatures and docstrings: - def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port...
Implement the Python class `CollectorHistoryClient` described below. Class description: Implement the CollectorHistoryClient class. Method signatures and docstrings: - def __init__(self, server_ip='', server_port=0, service_name='', host=''): 初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port...
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
<|skeleton|> class CollectorHistoryClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CollectorHistoryClient: def __init__(self, server_ip='', server_port=0, service_name='', host=''): """初始化client :param server_ip: 指定sdk请求的server_ip,为空时走名字服务路由 :param server_port: 指定sdk请求的server_port,与server_ip一起使用, 为空时走名字服务路由 :param service_name: 指定sdk请求的service_name, 为空时按契约名称路由。如果server_ip和service_na...
the_stack_v2_python_sparse
resource_manage_sdk/api/collector_history/collector_history_client.py
easyopsapis/easyops-api-python
train
5
52aa5b094ad7d6d55a448f1c8fb7f9dbccb8dcbe
[ "super(StorPerf, self).__init__()\nself.scenario_cfg = scenario_cfg\nself.context_cfg = context_cfg\nself.options = self.scenario_cfg['options']\nself.target = self.options.get('StorPerf_ip', None)\nself.query_interval = self.options.get('query_interval', 10)\nself.timeout = self.options.get('timeout', 3600)\nself....
<|body_start_0|> super(StorPerf, self).__init__() self.scenario_cfg = scenario_cfg self.context_cfg = context_cfg self.options = self.scenario_cfg['options'] self.target = self.options.get('StorPerf_ip', None) self.query_interval = self.options.get('query_interval', 10) ...
Execute StorPerf benchmark. Once the StorPerf container has been started and the ReST API exposed, you can interact directly with it using the ReST API. StorPerf comes with a Swagger interface that is accessible through the exposed port at: http://StorPerf:5000/swagger/index.html Command line options: target = [device ...
StorPerf
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorPerf: """Execute StorPerf benchmark. Once the StorPerf container has been started and the ReST API exposed, you can interact directly with it using the ReST API. StorPerf comes with a Swagger interface that is accessible through the exposed port at: http://StorPerf:5000/swagger/index.html Com...
stack_v2_sparse_classes_36k_train_020802
8,336
permissive
[ { "docstring": "Scenario construction.", "name": "__init__", "signature": "def __init__(self, scenario_cfg, context_cfg)" }, { "docstring": "Query the stack status.", "name": "_query_setup_state", "signature": "def _query_setup_state(self)" }, { "docstring": "Set the configuratio...
6
stack_v2_sparse_classes_30k_train_013737
Implement the Python class `StorPerf` described below. Class description: Execute StorPerf benchmark. Once the StorPerf container has been started and the ReST API exposed, you can interact directly with it using the ReST API. StorPerf comes with a Swagger interface that is accessible through the exposed port at: http...
Implement the Python class `StorPerf` described below. Class description: Execute StorPerf benchmark. Once the StorPerf container has been started and the ReST API exposed, you can interact directly with it using the ReST API. StorPerf comes with a Swagger interface that is accessible through the exposed port at: http...
7a89a01cdb1b3569d0b67451572edbae0f3d05aa
<|skeleton|> class StorPerf: """Execute StorPerf benchmark. Once the StorPerf container has been started and the ReST API exposed, you can interact directly with it using the ReST API. StorPerf comes with a Swagger interface that is accessible through the exposed port at: http://StorPerf:5000/swagger/index.html Com...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StorPerf: """Execute StorPerf benchmark. Once the StorPerf container has been started and the ReST API exposed, you can interact directly with it using the ReST API. StorPerf comes with a Swagger interface that is accessible through the exposed port at: http://StorPerf:5000/swagger/index.html Command line opt...
the_stack_v2_python_sparse
yardstick/benchmark/scenarios/storage/storperf.py
alexnemes/yardstick
train
1
0cf1cb9a338cd5383b6517e138ec2ae033a02419
[ "plugin = WeightAndBlend('forecast_reference_time', 'linear', y0val=1, ynval=1)\nself.assertEqual(plugin.blend_coord, 'forecast_reference_time')\nself.assertEqual(plugin.wts_calc_method, 'linear')\nself.assertIsNone(plugin.weighting_coord)\nself.assertAlmostEqual(plugin.y0val, 1.0)\nself.assertAlmostEqual(plugin.yn...
<|body_start_0|> plugin = WeightAndBlend('forecast_reference_time', 'linear', y0val=1, ynval=1) self.assertEqual(plugin.blend_coord, 'forecast_reference_time') self.assertEqual(plugin.wts_calc_method, 'linear') self.assertIsNone(plugin.weighting_coord) self.assertAlmostEqual(plug...
Test the __init__ method
Test__init__
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__init__: """Test the __init__ method""" def test_cycle(self): """Test initialisation for cycle blending""" <|body_0|> def test_model(self): """Test initialisation for model blending""" <|body_1|> def test_unrecognised_weighting_type_error(self):...
stack_v2_sparse_classes_36k_train_020803
30,096
permissive
[ { "docstring": "Test initialisation for cycle blending", "name": "test_cycle", "signature": "def test_cycle(self)" }, { "docstring": "Test initialisation for model blending", "name": "test_model", "signature": "def test_model(self)" }, { "docstring": "Test error if wts_calc_metho...
3
null
Implement the Python class `Test__init__` described below. Class description: Test the __init__ method Method signatures and docstrings: - def test_cycle(self): Test initialisation for cycle blending - def test_model(self): Test initialisation for model blending - def test_unrecognised_weighting_type_error(self): Tes...
Implement the Python class `Test__init__` described below. Class description: Test the __init__ method Method signatures and docstrings: - def test_cycle(self): Test initialisation for cycle blending - def test_model(self): Test initialisation for model blending - def test_unrecognised_weighting_type_error(self): Tes...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__init__: """Test the __init__ method""" def test_cycle(self): """Test initialisation for cycle blending""" <|body_0|> def test_model(self): """Test initialisation for model blending""" <|body_1|> def test_unrecognised_weighting_type_error(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test__init__: """Test the __init__ method""" def test_cycle(self): """Test initialisation for cycle blending""" plugin = WeightAndBlend('forecast_reference_time', 'linear', y0val=1, ynval=1) self.assertEqual(plugin.blend_coord, 'forecast_reference_time') self.assertEqual(p...
the_stack_v2_python_sparse
improver_tests/blending/calculate_weights_and_blend/test_WeightAndBlend.py
metoppv/improver
train
101
91027aa95194d01b6b1eaea001e68fc218e608d4
[ "self.initVars = initVars\nself.sellPct = initVars['sellPct']\nif 'dateRange' in initVars:\n self.dateRange = initVars['dateRange']\nelse:\n self.dateRange = None\nif 'server' in initVars:\n self.server = initVars['server']\nelse:\n self.server = None", "if self.server is None:\n return yahooInterf...
<|body_start_0|> self.initVars = initVars self.sellPct = initVars['sellPct'] if 'dateRange' in initVars: self.dateRange = initVars['dateRange'] else: self.dateRange = None if 'server' in initVars: self.server = initVars['server'] else: ...
--------------------------------------------------------------------------------------------------------------- This class must contain 3 functions in order to work: getInfo must be a function that returns info that will be passed to the other functions ------------------------------------------------------------------...
peakFuncs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class peakFuncs: """--------------------------------------------------------------------------------------------------------------- This class must contain 3 functions in order to work: getInfo must be a function that returns info that will be passed to the other functions -----------------------------...
stack_v2_sparse_classes_36k_train_020804
14,691
no_license
[ { "docstring": "---------------------------------------------------------------------------------------------------------------- WARNING if you want to change any values within the class slightly for testing purposes I suggest passing them in on initialization. --------------------------------------------------...
4
stack_v2_sparse_classes_30k_train_013594
Implement the Python class `peakFuncs` described below. Class description: --------------------------------------------------------------------------------------------------------------- This class must contain 3 functions in order to work: getInfo must be a function that returns info that will be passed to the other ...
Implement the Python class `peakFuncs` described below. Class description: --------------------------------------------------------------------------------------------------------------- This class must contain 3 functions in order to work: getInfo must be a function that returns info that will be passed to the other ...
79107c0fe0f21403bc875e5b0affa659ec1e6279
<|skeleton|> class peakFuncs: """--------------------------------------------------------------------------------------------------------------- This class must contain 3 functions in order to work: getInfo must be a function that returns info that will be passed to the other functions -----------------------------...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class peakFuncs: """--------------------------------------------------------------------------------------------------------------- This class must contain 3 functions in order to work: getInfo must be a function that returns info that will be passed to the other functions ------------------------------------------...
the_stack_v2_python_sparse
testStratPeak.py
blakebiz/StockTraderV1.1
train
1
098599617ef2409f798cb63be7728e36d6a792d7
[ "self.sv_dim = sv_dim\nself.meas_dim = meas_dim\nself._init_matrices(1)\nself.q_mat = numpy.eye(self.sv_dim)\nself.r_mat = numpy.eye(self.meas_dim)\nself.update = update\nself.update_jacobian = update_jacobian\nself.measure = measure\nself.measure_jacobian = measure_jacobian\nself.seed = seed", "self.sv_sv_matsh ...
<|body_start_0|> self.sv_dim = sv_dim self.meas_dim = meas_dim self._init_matrices(1) self.q_mat = numpy.eye(self.sv_dim) self.r_mat = numpy.eye(self.meas_dim) self.update = update self.update_jacobian = update_jacobian self.measure = measure self....
A class that defines a general extended Kalman filter. Attributes ---------- sv_dim : The dimension of the state vector meas_dim : The dimension of the measurement vector q_mat : The process noise covariance matrix r_mat : The measurement noise covariance matrix xhat : The a posteriori state estimate p_mat : The estima...
KalmanFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KalmanFilter: """A class that defines a general extended Kalman filter. Attributes ---------- sv_dim : The dimension of the state vector meas_dim : The dimension of the measurement vector q_mat : The process noise covariance matrix r_mat : The measurement noise covariance matrix xhat : The a post...
stack_v2_sparse_classes_36k_train_020805
4,175
no_license
[ { "docstring": "Initializes the class. Arguments --------- sv_dim : The dimension of the state vector meas_dim : The dimension of the measurement vector update : A callback function for estimating the next state vector jacobian : A callback function for estimating the Jacobian of the update function", "name...
3
stack_v2_sparse_classes_30k_train_021056
Implement the Python class `KalmanFilter` described below. Class description: A class that defines a general extended Kalman filter. Attributes ---------- sv_dim : The dimension of the state vector meas_dim : The dimension of the measurement vector q_mat : The process noise covariance matrix r_mat : The measurement no...
Implement the Python class `KalmanFilter` described below. Class description: A class that defines a general extended Kalman filter. Attributes ---------- sv_dim : The dimension of the state vector meas_dim : The dimension of the measurement vector q_mat : The process noise covariance matrix r_mat : The measurement no...
8809d26c8659a02cabe4735df732b6f0a4d647bf
<|skeleton|> class KalmanFilter: """A class that defines a general extended Kalman filter. Attributes ---------- sv_dim : The dimension of the state vector meas_dim : The dimension of the measurement vector q_mat : The process noise covariance matrix r_mat : The measurement noise covariance matrix xhat : The a post...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KalmanFilter: """A class that defines a general extended Kalman filter. Attributes ---------- sv_dim : The dimension of the state vector meas_dim : The dimension of the measurement vector q_mat : The process noise covariance matrix r_mat : The measurement noise covariance matrix xhat : The a posteriori state ...
the_stack_v2_python_sparse
pytpc/kalman.py
ATTPC/pytpc
train
1
ce46255db03f2fc01ce96a8ce2c0637d10d83c23
[ "super().__init__()\nself.nhead = nhead\nself.in_proj_container = in_proj_container\nself.attention_layer = attention_layer\nself.out_proj = out_proj", "tgt_len, src_len, bsz, embed_dim = (query.size(-3), key.size(-3), query.size(-2), query.size(-1))\nq, k, v = self.in_proj_container(query, key, value)\nassert q....
<|body_start_0|> super().__init__() self.nhead = nhead self.in_proj_container = in_proj_container self.attention_layer = attention_layer self.out_proj = out_proj <|end_body_0|> <|body_start_1|> tgt_len, src_len, bsz, embed_dim = (query.size(-3), key.size(-3), query.size(...
MultiheadAttentionContainer
[ "BSD-3-Clause", "BSD-2-Clause", "LicenseRef-scancode-secret-labs-2011", "LicenseRef-scancode-generic-cla", "BSL-1.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiheadAttentionContainer: def __init__(self, nhead, in_proj_container, attention_layer, out_proj): """A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Li...
stack_v2_sparse_classes_36k_train_020806
26,389
permissive
[ { "docstring": "A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Linear). attention_layer: The attention layer. out_proj: The multi-head out-projection layer (a.k.a nn.Linear). Exa...
2
null
Implement the Python class `MultiheadAttentionContainer` described below. Class description: Implement the MultiheadAttentionContainer class. Method signatures and docstrings: - def __init__(self, nhead, in_proj_container, attention_layer, out_proj): A multi-head attention container Args: nhead: the number of heads i...
Implement the Python class `MultiheadAttentionContainer` described below. Class description: Implement the MultiheadAttentionContainer class. Method signatures and docstrings: - def __init__(self, nhead, in_proj_container, attention_layer, out_proj): A multi-head attention container Args: nhead: the number of heads i...
a6f7dd4707ac116c0f5fb5f44f42429f38d23ab4
<|skeleton|> class MultiheadAttentionContainer: def __init__(self, nhead, in_proj_container, attention_layer, out_proj): """A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Li...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiheadAttentionContainer: def __init__(self, nhead, in_proj_container, attention_layer, out_proj): """A multi-head attention container Args: nhead: the number of heads in the multiheadattention model in_proj_container: A container of multi-head in-projection linear layers (a.k.a nn.Linear). attenti...
the_stack_v2_python_sparse
benchmarks/functional_autograd_benchmark/torchaudio_models.py
pytorch/pytorch
train
77,092
4e7ec8c30460b533ed42be795accc18263e58348
[ "ret = []\ni = j = 0\nwhile i < len(firstList) and j < len(secondList):\n lo = max(firstList[i][0], secondList[j][0])\n hi = min(firstList[i][1], secondList[j][1])\n if lo <= hi:\n ret.append([lo, hi])\n if firstList[i][1] < secondList[j][1]:\n i += 1\n else:\n j += 1\nreturn ret...
<|body_start_0|> ret = [] i = j = 0 while i < len(firstList) and j < len(secondList): lo = max(firstList[i][0], secondList[j][0]) hi = min(firstList[i][1], secondList[j][1]) if lo <= hi: ret.append([lo, hi]) if firstList[i][1] < sec...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intervalIntersection(self, firstList, secondList): """:type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merge part of merge sort, use 2 pointers. a trick to use, max(a2,b2) and min(a1,b2) to check if they ...
stack_v2_sparse_classes_36k_train_020807
3,412
no_license
[ { "docstring": ":type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merge part of merge sort, use 2 pointers. a trick to use, max(a2,b2) and min(a1,b2) to check if they have intersection. 08/11/2022 12:11 Accepted 118 ms 14.2 MB python < 08/11/2...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intervalIntersection(self, firstList, secondList): :type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merg...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intervalIntersection(self, firstList, secondList): :type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merg...
02726da394971ef02616a038dadc126c6ff260de
<|skeleton|> class Solution: def intervalIntersection(self, firstList, secondList): """:type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merge part of merge sort, use 2 pointers. a trick to use, max(a2,b2) and min(a1,b2) to check if they ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intervalIntersection(self, firstList, secondList): """:type firstList: List[List[int]] :type secondList: List[List[int]] :rtype: List[List[int]] better solution is like the merge part of merge sort, use 2 pointers. a trick to use, max(a2,b2) and min(a1,b2) to check if they have intersect...
the_stack_v2_python_sparse
intervals/N986_IntervalListIntersections.py
zerghua/leetcode-python
train
2
50108bb4abdbde0a4433781c7ec232b9b8204af7
[ "m3 = dstrip(self.beads.m3)\nfor i in range(self.nsteps_o):\n self.thermostat.step()\n p = dstrip(self.beads.p)\n self.ensemble.eens += np.dot(p.flatten(), (p / m3).flatten()) * 0.5\n self.proj_cotangent()\n p = dstrip(self.beads.p).copy()\n self.ensemble.eens -= np.dot(p.flatten(), (p / m3).flatt...
<|body_start_0|> m3 = dstrip(self.beads.m3) for i in range(self.nsteps_o): self.thermostat.step() p = dstrip(self.beads.p) self.ensemble.eens += np.dot(p.flatten(), (p / m3).flatten()) * 0.5 self.proj_cotangent() p = dstrip(self.beads.p).copy()...
Constrained integrator object for constant temperature simulations. Has the relevant conserved quantity for the constant temperature ensemble. Contains a thermostat object that keeps the temperature constant. Implementation details: B. Leimkuhler, C. Matthews Proc. R. Soc. A 472, 20160138, (2016) Attributes: thermostat...
NVTConstrainedIntegrator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NVTConstrainedIntegrator: """Constrained integrator object for constant temperature simulations. Has the relevant conserved quantity for the constant temperature ensemble. Contains a thermostat object that keeps the temperature constant. Implementation details: B. Leimkuhler, C. Matthews Proc. R....
stack_v2_sparse_classes_36k_train_020808
19,035
no_license
[ { "docstring": "Constrained stochastic propagation. We solve the problem that the thermostat and the projective step do not necessarily commute (e.g. in GLE) by doing a MTS splitting scheme", "name": "step_Oc", "signature": "def step_Oc(self)" }, { "docstring": "Does one simulation time step.", ...
2
null
Implement the Python class `NVTConstrainedIntegrator` described below. Class description: Constrained integrator object for constant temperature simulations. Has the relevant conserved quantity for the constant temperature ensemble. Contains a thermostat object that keeps the temperature constant. Implementation detai...
Implement the Python class `NVTConstrainedIntegrator` described below. Class description: Constrained integrator object for constant temperature simulations. Has the relevant conserved quantity for the constant temperature ensemble. Contains a thermostat object that keeps the temperature constant. Implementation detai...
57f255266d4668bafef0881d1e7cbf8a27270ddd
<|skeleton|> class NVTConstrainedIntegrator: """Constrained integrator object for constant temperature simulations. Has the relevant conserved quantity for the constant temperature ensemble. Contains a thermostat object that keeps the temperature constant. Implementation details: B. Leimkuhler, C. Matthews Proc. R....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NVTConstrainedIntegrator: """Constrained integrator object for constant temperature simulations. Has the relevant conserved quantity for the constant temperature ensemble. Contains a thermostat object that keeps the temperature constant. Implementation details: B. Leimkuhler, C. Matthews Proc. R. Soc. A 472, ...
the_stack_v2_python_sparse
ipi/engine/motion/constrained_dynamics.py
i-pi/i-pi
train
170
22137a9f593b615b474b0755edcb3e7c4786999d
[ "self.device = device\nself.ip = ip\nself.netapp_user = user\nself.netapp_password = password\nself.path_prefix = prefix\nself.publish_metric = pm\nself._netapp_login()\nfilers_xml = self.get_netapp_data()\nfor volume in filers_xml:\n max_inodes = volume.find('files-total').text\n used_inodes = volume.find('f...
<|body_start_0|> self.device = device self.ip = ip self.netapp_user = user self.netapp_password = password self.path_prefix = prefix self.publish_metric = pm self._netapp_login() filers_xml = self.get_netapp_data() for volume in filers_xml: ...
Our netapp_inode Collector
netapp_inodeCol
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class netapp_inodeCol: """Our netapp_inode Collector""" def __init__(self, device, ip, user, password, prefix, pm): """Instantiate _our_ stuff""" <|body_0|> def push(self, metric_name=None, metric_value=None, volume=None): """Ship that shit off to graphite broski""" ...
stack_v2_sparse_classes_36k_train_020809
3,492
permissive
[ { "docstring": "Instantiate _our_ stuff", "name": "__init__", "signature": "def __init__(self, device, ip, user, password, prefix, pm)" }, { "docstring": "Ship that shit off to graphite broski", "name": "push", "signature": "def push(self, metric_name=None, metric_value=None, volume=None...
4
null
Implement the Python class `netapp_inodeCol` described below. Class description: Our netapp_inode Collector Method signatures and docstrings: - def __init__(self, device, ip, user, password, prefix, pm): Instantiate _our_ stuff - def push(self, metric_name=None, metric_value=None, volume=None): Ship that shit off to ...
Implement the Python class `netapp_inodeCol` described below. Class description: Our netapp_inode Collector Method signatures and docstrings: - def __init__(self, device, ip, user, password, prefix, pm): Instantiate _our_ stuff - def push(self, metric_name=None, metric_value=None, volume=None): Ship that shit off to ...
461caf29e84db8cbf46f9fc4c895f56353e10c61
<|skeleton|> class netapp_inodeCol: """Our netapp_inode Collector""" def __init__(self, device, ip, user, password, prefix, pm): """Instantiate _our_ stuff""" <|body_0|> def push(self, metric_name=None, metric_value=None, volume=None): """Ship that shit off to graphite broski""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class netapp_inodeCol: """Our netapp_inode Collector""" def __init__(self, device, ip, user, password, prefix, pm): """Instantiate _our_ stuff""" self.device = device self.ip = ip self.netapp_user = user self.netapp_password = password self.path_prefix = prefix ...
the_stack_v2_python_sparse
src/collectors/netapp/netapp_inode.py
python-diamond/Diamond
train
1,874
3741bf53a69284f089f7a83e209b33de91b3751f
[ "event = cls.objects.create(event_type=event_type, **kwargs)\nif inventory_changes:\n event._process_by_event_type(inventory_changes)\nreturn event", "processes = EVENT_TYPE_PROCESS[self.event_type]\nfor process in processes:\n for inventorychange in inventory_changes:\n product_id = inventorychange....
<|body_start_0|> event = cls.objects.create(event_type=event_type, **kwargs) if inventory_changes: event._process_by_event_type(inventory_changes) return event <|end_body_0|> <|body_start_1|> processes = EVENT_TYPE_PROCESS[self.event_type] for process in processes: ...
EventMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventMixin: def create_instance(cls, event_type, inventory_changes=None, **kwargs): """이벤트 인스턴스 생성""" <|body_0|> def _process_by_event_type(self, inventory_changes) -> None: """이벤트타입에 따른 재고 처리""" <|body_1|> <|end_skeleton|> <|body_start_0|> event = ...
stack_v2_sparse_classes_36k_train_020810
2,069
no_license
[ { "docstring": "이벤트 인스턴스 생성", "name": "create_instance", "signature": "def create_instance(cls, event_type, inventory_changes=None, **kwargs)" }, { "docstring": "이벤트타입에 따른 재고 처리", "name": "_process_by_event_type", "signature": "def _process_by_event_type(self, inventory_changes) -> None"...
2
stack_v2_sparse_classes_30k_train_002004
Implement the Python class `EventMixin` described below. Class description: Implement the EventMixin class. Method signatures and docstrings: - def create_instance(cls, event_type, inventory_changes=None, **kwargs): 이벤트 인스턴스 생성 - def _process_by_event_type(self, inventory_changes) -> None: 이벤트타입에 따른 재고 처리
Implement the Python class `EventMixin` described below. Class description: Implement the EventMixin class. Method signatures and docstrings: - def create_instance(cls, event_type, inventory_changes=None, **kwargs): 이벤트 인스턴스 생성 - def _process_by_event_type(self, inventory_changes) -> None: 이벤트타입에 따른 재고 처리 <|skeleton...
7b994f34837cf7c9f3e87684ddbf9aa61bee64f5
<|skeleton|> class EventMixin: def create_instance(cls, event_type, inventory_changes=None, **kwargs): """이벤트 인스턴스 생성""" <|body_0|> def _process_by_event_type(self, inventory_changes) -> None: """이벤트타입에 따른 재고 처리""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventMixin: def create_instance(cls, event_type, inventory_changes=None, **kwargs): """이벤트 인스턴스 생성""" event = cls.objects.create(event_type=event_type, **kwargs) if inventory_changes: event._process_by_event_type(inventory_changes) return event def _process_by_...
the_stack_v2_python_sparse
server/events/mixins/model_mixins.py
jinimong/inventory-manager
train
0
d44ee11b31b99b9e325a3fc195c5f95565ecedb0
[ "self.model = model\nself.hyperparams = hyperparams\nself.folds = folds\nself.max_parallel = max_parallel\nkeys, values = zip(*hyperparams.items())\nself.experiments: List[Dict[str, Any]] = [dict(zip(keys, v)) for v in product(*values)]", "compute_scores_and_append = _ResultsAccumulator(measures)\nmodels = [self....
<|body_start_0|> self.model = model self.hyperparams = hyperparams self.folds = folds self.max_parallel = max_parallel keys, values = zip(*hyperparams.items()) self.experiments: List[Dict[str, Any]] = [dict(zip(keys, v)) for v in product(*values)] <|end_body_0|> <|body_s...
Object used to run cross-validation on a model.
CrossValidator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrossValidator: """Object used to run cross-validation on a model.""" def __init__(self, model: Type[InAlgorithm], hyperparams: Mapping[str, Sequence[Any]], folds: int=3, max_parallel: int=0): """The constructor takes the following arguments. Args: model: the class (not an instance) ...
stack_v2_sparse_classes_36k_train_020811
8,837
no_license
[ { "docstring": "The constructor takes the following arguments. Args: model: the class (not an instance) of the model for cross validation hyperparams: a dictionary where the keys are the names of hyperparameters and the values are lists of possible values for the hyperparameters folds: the number of folds max_p...
3
stack_v2_sparse_classes_30k_train_001277
Implement the Python class `CrossValidator` described below. Class description: Object used to run cross-validation on a model. Method signatures and docstrings: - def __init__(self, model: Type[InAlgorithm], hyperparams: Mapping[str, Sequence[Any]], folds: int=3, max_parallel: int=0): The constructor takes the follo...
Implement the Python class `CrossValidator` described below. Class description: Object used to run cross-validation on a model. Method signatures and docstrings: - def __init__(self, model: Type[InAlgorithm], hyperparams: Mapping[str, Sequence[Any]], folds: int=3, max_parallel: int=0): The constructor takes the follo...
3aecb7642d9611ae0a61cd47948931f8f47b6f76
<|skeleton|> class CrossValidator: """Object used to run cross-validation on a model.""" def __init__(self, model: Type[InAlgorithm], hyperparams: Mapping[str, Sequence[Any]], folds: int=3, max_parallel: int=0): """The constructor takes the following arguments. Args: model: the class (not an instance) ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrossValidator: """Object used to run cross-validation on a model.""" def __init__(self, model: Type[InAlgorithm], hyperparams: Mapping[str, Sequence[Any]], folds: int=3, max_parallel: int=0): """The constructor takes the following arguments. Args: model: the class (not an instance) of the model ...
the_stack_v2_python_sparse
ethicml/evaluators/cross_validator.py
anonymous-iclr-3518/code-for-submission
train
0
2574455db9e6b481b9e5e87ed5387344dd0e3569
[ "content = '\\n Your Vinely Party Request Has Been Submitted!\\n\\n Hey {{ party.host.first_name }},\\n\\n We\\'re thrilled about your interest in hosting a Vinely Taste Party! You have requested <b>{{ party.title }}</b> to be scheduled on <b>{{ party.event_date|date:\"F j, o\" }}</b> at <b>{{ ...
<|body_start_0|> content = '\n Your Vinely Party Request Has Been Submitted!\n\n Hey {{ party.host.first_name }},\n\n We\'re thrilled about your interest in hosting a Vinely Taste Party! You have requested <b>{{ party.title }}</b> to be scheduled on <b>{{ party.event_date|date:"F j, o" }}</...
Migration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|> <|body_start_0|> content = '\n Your Vinely Party Request Has...
stack_v2_sparse_classes_36k_train_020812
4,326
no_license
[ { "docstring": "Write your forwards methods here.", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Write your backwards methods here.", "name": "backwards", "signature": "def backwards(self, orm)" } ]
2
stack_v2_sparse_classes_30k_train_015394
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here.
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here. <|skeleton|> class Migration: def forwards(self,...
c5c7d8a0b1a297e07302870017d3fb03c5dbb009
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Write your forwards methods here.""" content = '\n Your Vinely Party Request Has Been Submitted!\n\n Hey {{ party.host.first_name }},\n\n We\'re thrilled about your interest in hosting a Vinely Taste Party! You have requested <b>{{ pa...
the_stack_v2_python_sparse
cms/migrations/0012_added_new_party_scheduled_by_host_no_pro_email.py
RSV3/nuvine
train
0
eead3b120194122cd0becadb59fe8f67ab04433d
[ "self.red = 0\nself.green = 0\nself.blue = 0\nself.yellow = 0\nself.raven = 0\nself.basket = 0", "augen = random.randint(1, 6)\nif augen == 1:\n self.red += 1\n return 'red'\nelif augen == 2:\n self.green += 1\n return 'green'\nelif augen == 3:\n self.blue += 1\n return 'blue'\nelif augen == 4:\...
<|body_start_0|> self.red = 0 self.green = 0 self.blue = 0 self.yellow = 0 self.raven = 0 self.basket = 0 <|end_body_0|> <|body_start_1|> augen = random.randint(1, 6) if augen == 1: self.red += 1 return 'red' elif augen == ...
a dict for obstgarten
Dice
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dice: """a dict for obstgarten""" def __init__(self): """init elements for dict statistic""" <|body_0|> def roll_the_dice(self) -> str: """returns the dicted value and increment value for statistic""" <|body_1|> def get_statistic(self) -> None: ...
stack_v2_sparse_classes_36k_train_020813
4,435
permissive
[ { "docstring": "init elements for dict statistic", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "returns the dicted value and increment value for statistic", "name": "roll_the_dice", "signature": "def roll_the_dice(self) -> str" }, { "docstring": "print...
3
stack_v2_sparse_classes_30k_train_004594
Implement the Python class `Dice` described below. Class description: a dict for obstgarten Method signatures and docstrings: - def __init__(self): init elements for dict statistic - def roll_the_dice(self) -> str: returns the dicted value and increment value for statistic - def get_statistic(self) -> None: print dic...
Implement the Python class `Dice` described below. Class description: a dict for obstgarten Method signatures and docstrings: - def __init__(self): init elements for dict statistic - def roll_the_dice(self) -> str: returns the dicted value and increment value for statistic - def get_statistic(self) -> None: print dic...
efe04c4299171fd978f705dcd767a15605355364
<|skeleton|> class Dice: """a dict for obstgarten""" def __init__(self): """init elements for dict statistic""" <|body_0|> def roll_the_dice(self) -> str: """returns the dicted value and increment value for statistic""" <|body_1|> def get_statistic(self) -> None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dice: """a dict for obstgarten""" def __init__(self): """init elements for dict statistic""" self.red = 0 self.green = 0 self.blue = 0 self.yellow = 0 self.raven = 0 self.basket = 0 def roll_the_dice(self) -> str: """returns the dicted ...
the_stack_v2_python_sparse
Projects_in_Python/Obstgarten/Obstgarten.py
vedantbahel/Mini_Python_Projects
train
1
7ae19a18b4c5fb7d095a1bca020a7ca7d3230f86
[ "with remote_access.ChromiumOSDeviceHandler('1.1.1.1') as device:\n CrOS_AU = auto_updater.ChromiumOSFlashUpdater(device, self.payload_dir, do_stateful_update=False)\n CrOS_AU.RunUpdate()\n self.assertTrue(self.transfer_mock.patched['TransferDevServerPackage'].called)\n self.assertTrue(self.transfer_moc...
<|body_start_0|> with remote_access.ChromiumOSDeviceHandler('1.1.1.1') as device: CrOS_AU = auto_updater.ChromiumOSFlashUpdater(device, self.payload_dir, do_stateful_update=False) CrOS_AU.RunUpdate() self.assertTrue(self.transfer_mock.patched['TransferDevServerPackage'].calle...
Test the transfer code path.
ChromiumOSUpdateTransferTest
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChromiumOSUpdateTransferTest: """Test the transfer code path.""" def testTransferForRootfs(self): """Test transfer functions for rootfs update. When rootfs update is enabled, Devserver and rootfs update payload are transferred. Stateful update payload is not.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_020814
20,190
permissive
[ { "docstring": "Test transfer functions for rootfs update. When rootfs update is enabled, Devserver and rootfs update payload are transferred. Stateful update payload is not.", "name": "testTransferForRootfs", "signature": "def testTransferForRootfs(self)" }, { "docstring": "Test Transfer functi...
2
null
Implement the Python class `ChromiumOSUpdateTransferTest` described below. Class description: Test the transfer code path. Method signatures and docstrings: - def testTransferForRootfs(self): Test transfer functions for rootfs update. When rootfs update is enabled, Devserver and rootfs update payload are transferred....
Implement the Python class `ChromiumOSUpdateTransferTest` described below. Class description: Test the transfer code path. Method signatures and docstrings: - def testTransferForRootfs(self): Test transfer functions for rootfs update. When rootfs update is enabled, Devserver and rootfs update payload are transferred....
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class ChromiumOSUpdateTransferTest: """Test the transfer code path.""" def testTransferForRootfs(self): """Test transfer functions for rootfs update. When rootfs update is enabled, Devserver and rootfs update payload are transferred. Stateful update payload is not.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ChromiumOSUpdateTransferTest: """Test the transfer code path.""" def testTransferForRootfs(self): """Test transfer functions for rootfs update. When rootfs update is enabled, Devserver and rootfs update payload are transferred. Stateful update payload is not.""" with remote_access.Chromiu...
the_stack_v2_python_sparse
third_party/chromite/lib/auto_updater_unittest.py
metux/chromium-suckless
train
5
09dff362ed6c7d29acc698a10599708a5b6c87ac
[ "super(Kinect2Camera, self).__init__(configs=configs)\nself.DepthMapFactor = float(self.configs.CAMERA.DEPTH_MAP_FACTOR)\nself.intrinsic_mat = None", "rgb_im, depth_im = self.get_rgb_depth()\ndepth = depth_im.reshape(-1) / self.DepthMapFactor\nrgb = rgb_im.reshape(-1, 3)\nif self.intrinsic_mat is None:\n self....
<|body_start_0|> super(Kinect2Camera, self).__init__(configs=configs) self.DepthMapFactor = float(self.configs.CAMERA.DEPTH_MAP_FACTOR) self.intrinsic_mat = None <|end_body_0|> <|body_start_1|> rgb_im, depth_im = self.get_rgb_depth() depth = depth_im.reshape(-1) / self.DepthMapF...
This is camera class that interfaces with the KinectV2 camera
Kinect2Camera
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kinect2Camera: """This is camera class that interfaces with the KinectV2 camera""" def __init__(self, configs): """Constructor of the KinectV2Camera class. :param configs: Camera specific configuration object :type configs: YACS CfgNode""" <|body_0|> def get_current_pcd(...
stack_v2_sparse_classes_36k_train_020815
4,235
permissive
[ { "docstring": "Constructor of the KinectV2Camera class. :param configs: Camera specific configuration object :type configs: YACS CfgNode", "name": "__init__", "signature": "def __init__(self, configs)" }, { "docstring": "Return the point cloud at current time step (one frame only) :returns: tup...
3
null
Implement the Python class `Kinect2Camera` described below. Class description: This is camera class that interfaces with the KinectV2 camera Method signatures and docstrings: - def __init__(self, configs): Constructor of the KinectV2Camera class. :param configs: Camera specific configuration object :type configs: YAC...
Implement the Python class `Kinect2Camera` described below. Class description: This is camera class that interfaces with the KinectV2 camera Method signatures and docstrings: - def __init__(self, configs): Constructor of the KinectV2Camera class. :param configs: Camera specific configuration object :type configs: YAC...
b334b60842271d9d8f4ed7a97bc4e5efe8bb72d6
<|skeleton|> class Kinect2Camera: """This is camera class that interfaces with the KinectV2 camera""" def __init__(self, configs): """Constructor of the KinectV2Camera class. :param configs: Camera specific configuration object :type configs: YACS CfgNode""" <|body_0|> def get_current_pcd(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Kinect2Camera: """This is camera class that interfaces with the KinectV2 camera""" def __init__(self, configs): """Constructor of the KinectV2Camera class. :param configs: Camera specific configuration object :type configs: YACS CfgNode""" super(Kinect2Camera, self).__init__(configs=confi...
the_stack_v2_python_sparse
src/pyrobot/kinect2/camera.py
facebookresearch/pyrobot
train
2,314
0c240ab1089768b8091acd1d4e20e74faaf7dd8c
[ "self.args = args\nif args is not None:\n self.save_path, self.load_path = common.read_save_load_args(args)\n load_path = self.load_path\nif load_path is None:\n assert len(ranges) == EFFECTIVE_DIM\n assert len(n_bins) == EFFECTIVE_DIM\n self.n_bins = n_bins\n self.ranges = ranges\n self.d = co...
<|body_start_0|> self.args = args if args is not None: self.save_path, self.load_path = common.read_save_load_args(args) load_path = self.load_path if load_path is None: assert len(ranges) == EFFECTIVE_DIM assert len(n_bins) == EFFECTIVE_DIM ...
Learn using value iteration on a discretized version of the simulator. Note: it is based on the false assumptions that the discretized model is still deterministic and markovic.
ValueIteration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ValueIteration: """Learn using value iteration on a discretized version of the simulator. Note: it is based on the false assumptions that the discretized model is still deterministic and markovic.""" def __init__(self, args=None, ranges=None, n_bins=None, load_path=None): """Create a...
stack_v2_sparse_classes_36k_train_020816
5,255
permissive
[ { "docstring": "Create a ValueIteration instance using args. ranges is a list of pairs (min value, max value) for each dimentions. n_bins is a list of ints telling how many bins to have in each dimention.", "name": "__init__", "signature": "def __init__(self, args=None, ranges=None, n_bins=None, load_pa...
5
stack_v2_sparse_classes_30k_train_004192
Implement the Python class `ValueIteration` described below. Class description: Learn using value iteration on a discretized version of the simulator. Note: it is based on the false assumptions that the discretized model is still deterministic and markovic. Method signatures and docstrings: - def __init__(self, args=...
Implement the Python class `ValueIteration` described below. Class description: Learn using value iteration on a discretized version of the simulator. Note: it is based on the false assumptions that the discretized model is still deterministic and markovic. Method signatures and docstrings: - def __init__(self, args=...
bf0474cd141d51f40af12ee5aba9b7c911ccc4d2
<|skeleton|> class ValueIteration: """Learn using value iteration on a discretized version of the simulator. Note: it is based on the false assumptions that the discretized model is still deterministic and markovic.""" def __init__(self, args=None, ranges=None, n_bins=None, load_path=None): """Create a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ValueIteration: """Learn using value iteration on a discretized version of the simulator. Note: it is based on the false assumptions that the discretized model is still deterministic and markovic.""" def __init__(self, args=None, ranges=None, n_bins=None, load_path=None): """Create a ValueIterati...
the_stack_v2_python_sparse
ApproxiPong-master/pong/learning/value_iteration.py
bareluz93/exam
train
0
5b5fc3d25eb1f9824107e236f6e1fd1034a7c5c9
[ "if not head or not head.next:\n return head\nfor _ in range(k):\n tail = head\n while tail.next and tail.next.next:\n tail = tail.next\n start = tail.next\n start.next = head\n tail.next = None\n head = start\nreturn head", "n = 0\nlast = head\nwhile last:\n last = last.next\n n...
<|body_start_0|> if not head or not head.next: return head for _ in range(k): tail = head while tail.next and tail.next.next: tail = tail.next start = tail.next start.next = head tail.next = None head = s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotateRight_1(self, head: ListNode, k: int) -> ListNode: """1. 暴力法 超时""" <|body_0|> def rotateRight(self, head: ListNode, k: int) -> ListNode: """2. 直接寻找到旋转点""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head or not head.next:...
stack_v2_sparse_classes_36k_train_020817
1,971
no_license
[ { "docstring": "1. 暴力法 超时", "name": "rotateRight_1", "signature": "def rotateRight_1(self, head: ListNode, k: int) -> ListNode" }, { "docstring": "2. 直接寻找到旋转点", "name": "rotateRight", "signature": "def rotateRight(self, head: ListNode, k: int) -> ListNode" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotateRight_1(self, head: ListNode, k: int) -> ListNode: 1. 暴力法 超时 - def rotateRight(self, head: ListNode, k: int) -> ListNode: 2. 直接寻找到旋转点
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotateRight_1(self, head: ListNode, k: int) -> ListNode: 1. 暴力法 超时 - def rotateRight(self, head: ListNode, k: int) -> ListNode: 2. 直接寻找到旋转点 <|skeleton|> class Solution: ...
4732fb80710a08a715c3e7080c394f5298b8326d
<|skeleton|> class Solution: def rotateRight_1(self, head: ListNode, k: int) -> ListNode: """1. 暴力法 超时""" <|body_0|> def rotateRight(self, head: ListNode, k: int) -> ListNode: """2. 直接寻找到旋转点""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotateRight_1(self, head: ListNode, k: int) -> ListNode: """1. 暴力法 超时""" if not head or not head.next: return head for _ in range(k): tail = head while tail.next and tail.next.next: tail = tail.next start = t...
the_stack_v2_python_sparse
02-linkedlist/61.旋转链表.py
xiaoruijiang/algorithm
train
0
b0ffd70e0e1cea349858efc831a4dd864dab47cb
[ "result = super(SettingsManager, self).get_queryset().filter(name=name)\nif result.count() == 0:\n raise DatabaseError('Cannot find matching setting object.')\nelif result.count() > 1:\n raise DatabaseError('Multi setting objects are found.')\nreturn result.values()[0]['value']", "queryset = super(SettingsM...
<|body_start_0|> result = super(SettingsManager, self).get_queryset().filter(name=name) if result.count() == 0: raise DatabaseError('Cannot find matching setting object.') elif result.count() > 1: raise DatabaseError('Multi setting objects are found.') return resu...
SettingsManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SettingsManager: def get_setting(self, name): """获取设置 返回该设置项的value, 为str类型 :param name: 返回指定的设置项的value :return: str""" <|body_0|> def get_setting_dict(self): """获取设置dict :return: dict""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = super(Se...
stack_v2_sparse_classes_36k_train_020818
1,478
no_license
[ { "docstring": "获取设置 返回该设置项的value, 为str类型 :param name: 返回指定的设置项的value :return: str", "name": "get_setting", "signature": "def get_setting(self, name)" }, { "docstring": "获取设置dict :return: dict", "name": "get_setting_dict", "signature": "def get_setting_dict(self)" } ]
2
stack_v2_sparse_classes_30k_train_018500
Implement the Python class `SettingsManager` described below. Class description: Implement the SettingsManager class. Method signatures and docstrings: - def get_setting(self, name): 获取设置 返回该设置项的value, 为str类型 :param name: 返回指定的设置项的value :return: str - def get_setting_dict(self): 获取设置dict :return: dict
Implement the Python class `SettingsManager` described below. Class description: Implement the SettingsManager class. Method signatures and docstrings: - def get_setting(self, name): 获取设置 返回该设置项的value, 为str类型 :param name: 返回指定的设置项的value :return: str - def get_setting_dict(self): 获取设置dict :return: dict <|skeleton|> c...
d52681a84bc75615dcfd7a373e579833e1ebece8
<|skeleton|> class SettingsManager: def get_setting(self, name): """获取设置 返回该设置项的value, 为str类型 :param name: 返回指定的设置项的value :return: str""" <|body_0|> def get_setting_dict(self): """获取设置dict :return: dict""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SettingsManager: def get_setting(self, name): """获取设置 返回该设置项的value, 为str类型 :param name: 返回指定的设置项的value :return: str""" result = super(SettingsManager, self).get_queryset().filter(name=name) if result.count() == 0: raise DatabaseError('Cannot find matching setting object.') ...
the_stack_v2_python_sparse
citi/system/settings/models.py
doraemonext/citi
train
0
e4bdbf2a4998f27860b792cef24e10410af57dcd
[ "self.contact_id = contact_id\nself.object_id = object_id\nself.affiliate_id = affiliate_id\nself.billing_address = billing_address\nself.charge_now = charge_now\nself.gateway_id = gateway_id\nself.invoice_template = invoice_template\nself.offer = offer\nself.payer = payer\nself.names = {'contact_id': 'contact_id',...
<|body_start_0|> self.contact_id = contact_id self.object_id = object_id self.affiliate_id = affiliate_id self.billing_address = billing_address self.charge_now = charge_now self.gateway_id = gateway_id self.invoice_template = invoice_template self.offer =...
Implementation of the 'Order' model. TODO: type model description here. Attributes: contact_id (int): TODO: type description here. object_id (int): TODO: type description here. affiliate_id (int): Affiliate ID. billing_address (Address): TODO: type description here. charge_now (ChargeNowEnum): TODO: type description he...
Order
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Order: """Implementation of the 'Order' model. TODO: type model description here. Attributes: contact_id (int): TODO: type description here. object_id (int): TODO: type description here. affiliate_id (int): Affiliate ID. billing_address (Address): TODO: type description here. charge_now (ChargeNo...
stack_v2_sparse_classes_36k_train_020819
4,069
permissive
[ { "docstring": "Constructor for the Order class", "name": "__init__", "signature": "def __init__(self, contact_id=None, object_id=None, affiliate_id=None, billing_address=None, charge_now=None, gateway_id=None, invoice_template=None, offer=None, payer=None)" }, { "docstring": "Creates an instanc...
2
stack_v2_sparse_classes_30k_train_005811
Implement the Python class `Order` described below. Class description: Implementation of the 'Order' model. TODO: type model description here. Attributes: contact_id (int): TODO: type description here. object_id (int): TODO: type description here. affiliate_id (int): Affiliate ID. billing_address (Address): TODO: type...
Implement the Python class `Order` described below. Class description: Implementation of the 'Order' model. TODO: type model description here. Attributes: contact_id (int): TODO: type description here. object_id (int): TODO: type description here. affiliate_id (int): Affiliate ID. billing_address (Address): TODO: type...
fb4834e89b897dce3475c89c7e6c34bf8756880e
<|skeleton|> class Order: """Implementation of the 'Order' model. TODO: type model description here. Attributes: contact_id (int): TODO: type description here. object_id (int): TODO: type description here. affiliate_id (int): Affiliate ID. billing_address (Address): TODO: type description here. charge_now (ChargeNo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Order: """Implementation of the 'Order' model. TODO: type model description here. Attributes: contact_id (int): TODO: type description here. object_id (int): TODO: type description here. affiliate_id (int): Affiliate ID. billing_address (Address): TODO: type description here. charge_now (ChargeNowEnum): TODO:...
the_stack_v2_python_sparse
ontraportlib/models/order.py
LifePosts/ontraportlib
train
0
802b140501e2e4fa4a08c5199ede2efb439cba17
[ "dp = [i for i in range(n + 1)]\nsquares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)]\nfor i in range(1, n + 1):\n for s in squares:\n if i < s:\n break\n dp[i] = min(dp[i], dp[i - s] + 1)\nreturn dp[-1]", "visited = [False] * (n + 1)\nqueue = [n]\nsquares = {i: i ** 2 for i in rang...
<|body_start_0|> dp = [i for i in range(n + 1)] squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)] for i in range(1, n + 1): for s in squares: if i < s: break dp[i] = min(dp[i], dp[i - s] + 1) return dp[-1] <|end_body_0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquaresBFS(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = [i for i in range(n + 1)] squares = [i ** 2 for i in ra...
stack_v2_sparse_classes_36k_train_020820
1,657
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "numSquares", "signature": "def numSquares(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "numSquaresBFS", "signature": "def numSquaresBFS(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_021152
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int - def numSquaresBFS(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSquares(self, n): :type n: int :rtype: int - def numSquaresBFS(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def numSquares(self, n): """:t...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def numSquares(self, n): """:type n: int :rtype: int""" <|body_0|> def numSquaresBFS(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numSquares(self, n): """:type n: int :rtype: int""" dp = [i for i in range(n + 1)] squares = [i ** 2 for i in range(1, int(n ** 0.5) + 1)] for i in range(1, n + 1): for s in squares: if i < s: break d...
the_stack_v2_python_sparse
cs_notes/BFS/perfect_squares.py
hwc1824/LeetCodeSolution
train
0
2cb3965bdfaccb31775ae508cc5f77ff3e4370d7
[ "jvm = spatialRDD._jvm\nsc = spatialRDD._sc\nsrdd = jvm.JoinQuery.SpatialJoinQuery(spatialRDD._srdd, queryRDD._srdd, useIndex, considerBoundaryIntersection)\nserlialized = jvm.GeoSerializerData.serializeToPythonHashSet(srdd)\nreturn RDD(serlialized, sc, GeoSparkPickler())", "jvm = spatialRDD._jvm\nsc = spatialRDD...
<|body_start_0|> jvm = spatialRDD._jvm sc = spatialRDD._sc srdd = jvm.JoinQuery.SpatialJoinQuery(spatialRDD._srdd, queryRDD._srdd, useIndex, considerBoundaryIntersection) serlialized = jvm.GeoSerializerData.serializeToPythonHashSet(srdd) return RDD(serlialized, sc, GeoSparkPickle...
JoinQuery
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JoinQuery: def SpatialJoinQuery(cls, spatialRDD: SpatialRDD, queryRDD: SpatialRDD, useIndex: bool, considerBoundaryIntersection: bool) -> RDD: """:param spatialRDD: :param queryRDD: :param useIndex: :param considerBoundaryIntersection: :return:""" <|body_0|> def DistanceJoin...
stack_v2_sparse_classes_36k_train_020821
3,977
permissive
[ { "docstring": ":param spatialRDD: :param queryRDD: :param useIndex: :param considerBoundaryIntersection: :return:", "name": "SpatialJoinQuery", "signature": "def SpatialJoinQuery(cls, spatialRDD: SpatialRDD, queryRDD: SpatialRDD, useIndex: bool, considerBoundaryIntersection: bool) -> RDD" }, { ...
5
stack_v2_sparse_classes_30k_train_004611
Implement the Python class `JoinQuery` described below. Class description: Implement the JoinQuery class. Method signatures and docstrings: - def SpatialJoinQuery(cls, spatialRDD: SpatialRDD, queryRDD: SpatialRDD, useIndex: bool, considerBoundaryIntersection: bool) -> RDD: :param spatialRDD: :param queryRDD: :param u...
Implement the Python class `JoinQuery` described below. Class description: Implement the JoinQuery class. Method signatures and docstrings: - def SpatialJoinQuery(cls, spatialRDD: SpatialRDD, queryRDD: SpatialRDD, useIndex: bool, considerBoundaryIntersection: bool) -> RDD: :param spatialRDD: :param queryRDD: :param u...
26da16d48168789c5f2bb75b5fdec1f515bf9cb1
<|skeleton|> class JoinQuery: def SpatialJoinQuery(cls, spatialRDD: SpatialRDD, queryRDD: SpatialRDD, useIndex: bool, considerBoundaryIntersection: bool) -> RDD: """:param spatialRDD: :param queryRDD: :param useIndex: :param considerBoundaryIntersection: :return:""" <|body_0|> def DistanceJoin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JoinQuery: def SpatialJoinQuery(cls, spatialRDD: SpatialRDD, queryRDD: SpatialRDD, useIndex: bool, considerBoundaryIntersection: bool) -> RDD: """:param spatialRDD: :param queryRDD: :param useIndex: :param considerBoundaryIntersection: :return:""" jvm = spatialRDD._jvm sc = spatialRDD....
the_stack_v2_python_sparse
geo_pyspark/core/spatialOperator/join_query.py
Imbruced/geo_pyspark
train
8
cfe39d4fe3842f1c1a8a268abb61be7c34dda5be
[ "self._multFE = ',' in self._how\nif self._multFE:\n self._sepFE = self._how.split(', ')\nelse:\n self._sepFE = self._how\nif self._multFE:\n self._boolCombFE = ['x' in FE for FE in self._sepFE]\nelse:\n self._boolCombFE = 'x' in self._sepFE\nreturn self", "if not self._multFE:\n if self._boolCombF...
<|body_start_0|> self._multFE = ',' in self._how if self._multFE: self._sepFE = self._how.split(', ') else: self._sepFE = self._how if self._multFE: self._boolCombFE = ['x' in FE for FE in self._sepFE] else: self._boolCombFE = 'x' i...
Transformation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformation: def inventorizeFE(self): """Function to determine how to transform""" <|body_0|> def FEColumns(self): """Creates the correct FE columns. If there are any combinations of FE the method creates a new column""" <|body_1|> def dataTransformat...
stack_v2_sparse_classes_36k_train_020822
35,310
no_license
[ { "docstring": "Function to determine how to transform", "name": "inventorizeFE", "signature": "def inventorizeFE(self)" }, { "docstring": "Creates the correct FE columns. If there are any combinations of FE the method creates a new column", "name": "FEColumns", "signature": "def FEColum...
4
stack_v2_sparse_classes_30k_train_001486
Implement the Python class `Transformation` described below. Class description: Implement the Transformation class. Method signatures and docstrings: - def inventorizeFE(self): Function to determine how to transform - def FEColumns(self): Creates the correct FE columns. If there are any combinations of FE the method ...
Implement the Python class `Transformation` described below. Class description: Implement the Transformation class. Method signatures and docstrings: - def inventorizeFE(self): Function to determine how to transform - def FEColumns(self): Creates the correct FE columns. If there are any combinations of FE the method ...
fd00afeae5ea691ca060c1e2b4fa9683a5c1f039
<|skeleton|> class Transformation: def inventorizeFE(self): """Function to determine how to transform""" <|body_0|> def FEColumns(self): """Creates the correct FE columns. If there are any combinations of FE the method creates a new column""" <|body_1|> def dataTransformat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transformation: def inventorizeFE(self): """Function to determine how to transform""" self._multFE = ',' in self._how if self._multFE: self._sepFE = self._how.split(', ') else: self._sepFE = self._how if self._multFE: self._boolCombFE...
the_stack_v2_python_sparse
Help_functions/MD_panel_estimation.py
MARQyie/PhD_project2_distance
train
0
ea9deb272d5ca1636b099675c39c47086e2dd3fa
[ "state = self.hass.states.get(entity_id)\nif state:\n return self.json(state)\nelse:\n return self.json_message('Entity not found', HTTP_NOT_FOUND)", "try:\n new_state = request.json['state']\nexcept KeyError:\n return self.json_message('No state specified', HTTP_BAD_REQUEST)\nattributes = request.jso...
<|body_start_0|> state = self.hass.states.get(entity_id) if state: return self.json(state) else: return self.json_message('Entity not found', HTTP_NOT_FOUND) <|end_body_0|> <|body_start_1|> try: new_state = request.json['state'] except KeyErro...
View to handle EntityState requests.
APIEntityStateView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APIEntityStateView: """View to handle EntityState requests.""" def get(self, request, entity_id): """Retrieve state of entity.""" <|body_0|> def post(self, request, entity_id): """Update state of entity.""" <|body_1|> def delete(self, request, entity...
stack_v2_sparse_classes_36k_train_020823
12,334
permissive
[ { "docstring": "Retrieve state of entity.", "name": "get", "signature": "def get(self, request, entity_id)" }, { "docstring": "Update state of entity.", "name": "post", "signature": "def post(self, request, entity_id)" }, { "docstring": "Remove entity.", "name": "delete", ...
3
null
Implement the Python class `APIEntityStateView` described below. Class description: View to handle EntityState requests. Method signatures and docstrings: - def get(self, request, entity_id): Retrieve state of entity. - def post(self, request, entity_id): Update state of entity. - def delete(self, request, entity_id)...
Implement the Python class `APIEntityStateView` described below. Class description: View to handle EntityState requests. Method signatures and docstrings: - def get(self, request, entity_id): Retrieve state of entity. - def post(self, request, entity_id): Update state of entity. - def delete(self, request, entity_id)...
ca0e92aba83de2fd6cb1cc4d14f3b4471f17cf3d
<|skeleton|> class APIEntityStateView: """View to handle EntityState requests.""" def get(self, request, entity_id): """Retrieve state of entity.""" <|body_0|> def post(self, request, entity_id): """Update state of entity.""" <|body_1|> def delete(self, request, entity...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class APIEntityStateView: """View to handle EntityState requests.""" def get(self, request, entity_id): """Retrieve state of entity.""" state = self.hass.states.get(entity_id) if state: return self.json(state) else: return self.json_message('Entity not fo...
the_stack_v2_python_sparse
homeassistant/components/api.py
Smart-Torvy/torvy-home-assistant
train
2
affc393a2f60eea6cfb11bebeece75a85f7801f8
[ "self.cap = capacity\nself.min = -1\nself.vals = {}\nself.counts = {}\nself.lists = defaultdict(OrderedDict)", "if key not in self.vals:\n return -1\ncount = self.counts[key]\nself.counts[key] = count + 1\nself.lists[count].pop(key)\nself.lists[count + 1].update({key: None})\nif count == self.min and len(self....
<|body_start_0|> self.cap = capacity self.min = -1 self.vals = {} self.counts = {} self.lists = defaultdict(OrderedDict) <|end_body_0|> <|body_start_1|> if key not in self.vals: return -1 count = self.counts[key] self.counts[key] = count + 1 ...
LFUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_020824
1,835
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_021637
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
f234bd7b62cb7bc2150faa764bf05a9095e19192
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.cap = capacity self.min = -1 self.vals = {} self.counts = {} self.lists = defaultdict(OrderedDict) def get(self, key): """:type key: int :rtype: int""" if key not in self...
the_stack_v2_python_sparse
alg/LFU_cache.py
nyannko/leetcode-python
train
0
5826b018b9ac8ae864a49adf88ee7914c69d040d
[ "res = Simulation.objects.all()\nif scenario_id:\n rs = RoadSegment.objects.filter(scenario__id__exact=scenario_id)\n res = res.filter(Q(simulation_scenes__simulation_scene_events__road_segment__in=rs)).distinct()\nif simulation_id:\n res = res.filter(Q(id__exact=simulation_id))\nif name:\n res = res.fi...
<|body_start_0|> res = Simulation.objects.all() if scenario_id: rs = RoadSegment.objects.filter(scenario__id__exact=scenario_id) res = res.filter(Q(simulation_scenes__simulation_scene_events__road_segment__in=rs)).distinct() if simulation_id: res = res.filter(...
Query
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Query: def resolve_simulations(self, info, simulation_id=None, name=None, desc=None, scene_id=None, scenario_id=None, **kwargs): """Queries simulations from the database :param info: :param simulation_id: The simulation ID to filter on :param name: The (part of the) name to filter on :pa...
stack_v2_sparse_classes_36k_train_020825
13,405
no_license
[ { "docstring": "Queries simulations from the database :param info: :param simulation_id: The simulation ID to filter on :param name: The (part of the) name to filter on :param desc: The (part of the) description to filter on :param scene_id: The scene ID to filter on :param kwargs: :return: All (filtered) simul...
3
stack_v2_sparse_classes_30k_train_000519
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def resolve_simulations(self, info, simulation_id=None, name=None, desc=None, scene_id=None, scenario_id=None, **kwargs): Queries simulations from the database :param info: :param simu...
Implement the Python class `Query` described below. Class description: Implement the Query class. Method signatures and docstrings: - def resolve_simulations(self, info, simulation_id=None, name=None, desc=None, scene_id=None, scenario_id=None, **kwargs): Queries simulations from the database :param info: :param simu...
618440303dcbf819cd61aa5e593b4b50483f0070
<|skeleton|> class Query: def resolve_simulations(self, info, simulation_id=None, name=None, desc=None, scene_id=None, scenario_id=None, **kwargs): """Queries simulations from the database :param info: :param simulation_id: The simulation ID to filter on :param name: The (part of the) name to filter on :pa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Query: def resolve_simulations(self, info, simulation_id=None, name=None, desc=None, scene_id=None, scenario_id=None, **kwargs): """Queries simulations from the database :param info: :param simulation_id: The simulation ID to filter on :param name: The (part of the) name to filter on :param desc: The ...
the_stack_v2_python_sparse
backend/api/simulations/schema.py
Rohan-Deshamudre/Smart-traffic-management-system
train
0
e69d03e7647e89e088d8e6320fbcc69b0b41c6b3
[ "from nitpick.app import NitpickApp\nfrom nitpick.exceptions import NitpickError\nerror = NitpickError()\nerror.error_base_number = self.error_base_number\nerror.error_prefix = self.error_prefix\nerror.number = number\nerror.message = message\nif suggestion:\n error.suggestion = suggestion\nerror.add_to_base_num...
<|body_start_0|> from nitpick.app import NitpickApp from nitpick.exceptions import NitpickError error = NitpickError() error.error_base_number = self.error_base_number error.error_prefix = self.error_prefix error.number = number error.message = message if ...
Mixin to raise flake8 errors.
NitpickMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NitpickMixin: """Mixin to raise flake8 errors.""" def flake8_error(self, number: int, message: str, suggestion: str=None, add_to_base_number=True) -> Flake8Error: """Return a flake8 error as a tuple.""" <|body_0|> def warn_missing_different(self, comparison: Comparison, ...
stack_v2_sparse_classes_36k_train_020826
1,558
permissive
[ { "docstring": "Return a flake8 error as a tuple.", "name": "flake8_error", "signature": "def flake8_error(self, number: int, message: str, suggestion: str=None, add_to_base_number=True) -> Flake8Error" }, { "docstring": "Warn about missing and different keys.", "name": "warn_missing_differe...
2
stack_v2_sparse_classes_30k_train_015445
Implement the Python class `NitpickMixin` described below. Class description: Mixin to raise flake8 errors. Method signatures and docstrings: - def flake8_error(self, number: int, message: str, suggestion: str=None, add_to_base_number=True) -> Flake8Error: Return a flake8 error as a tuple. - def warn_missing_differen...
Implement the Python class `NitpickMixin` described below. Class description: Mixin to raise flake8 errors. Method signatures and docstrings: - def flake8_error(self, number: int, message: str, suggestion: str=None, add_to_base_number=True) -> Flake8Error: Return a flake8 error as a tuple. - def warn_missing_differen...
cf00d741d4d52d7591dffa4af0211bc652ba2e55
<|skeleton|> class NitpickMixin: """Mixin to raise flake8 errors.""" def flake8_error(self, number: int, message: str, suggestion: str=None, add_to_base_number=True) -> Flake8Error: """Return a flake8 error as a tuple.""" <|body_0|> def warn_missing_different(self, comparison: Comparison, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NitpickMixin: """Mixin to raise flake8 errors.""" def flake8_error(self, number: int, message: str, suggestion: str=None, add_to_base_number=True) -> Flake8Error: """Return a flake8 error as a tuple.""" from nitpick.app import NitpickApp from nitpick.exceptions import NitpickError...
the_stack_v2_python_sparse
src/nitpick/mixin.py
admdev8/nitpick
train
0
ba805584c4da990698932610b1f9b705b0c1ab8b
[ "super(CumulativeLayerNorm, self).__init__()\nself.eps = eps\nself.gain = nn.Parameter(torch.ones(1, dimension, 1))\nself.bias = nn.Parameter(torch.zeros(1, dimension, 1))", "mean = torch.mean(X, dim=1, keepdim=True)\nvar = torch.var(X, dim=1, keepdim=True, unbiased=False)\nstd = torch.sqrt(var + self.eps)\nX = s...
<|body_start_0|> super(CumulativeLayerNorm, self).__init__() self.eps = eps self.gain = nn.Parameter(torch.ones(1, dimension, 1)) self.bias = nn.Parameter(torch.zeros(1, dimension, 1)) <|end_body_0|> <|body_start_1|> mean = torch.mean(X, dim=1, keepdim=True) var = torch....
Cumulative Layer Normalization (cLN) Implementation of the cLN as described in Conv-TasNet paper: - https://arxiv.org/pdf/1809.07454.pdf Attributes: eps {float} -- epsilon value to avoid 0 division (default: {1e-8}) gain {torch.Tensor} -- gain weights (gamma) bias {torch.Tensor} -- bias weights (beta)
CumulativeLayerNorm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CumulativeLayerNorm: """Cumulative Layer Normalization (cLN) Implementation of the cLN as described in Conv-TasNet paper: - https://arxiv.org/pdf/1809.07454.pdf Attributes: eps {float} -- epsilon value to avoid 0 division (default: {1e-8}) gain {torch.Tensor} -- gain weights (gamma) bias {torch.T...
stack_v2_sparse_classes_36k_train_020827
9,814
permissive
[ { "docstring": "Initialization Arguments: dimension {int} -- layer size Keyword Arguments: eps {float} -- epsilon value to avoid 0 division (default: {1e-8})", "name": "__init__", "signature": "def __init__(self: 'CumulativeLayerNorm', dimension: int, eps: float=1e-08) -> None" }, { "docstring":...
2
stack_v2_sparse_classes_30k_train_012769
Implement the Python class `CumulativeLayerNorm` described below. Class description: Cumulative Layer Normalization (cLN) Implementation of the cLN as described in Conv-TasNet paper: - https://arxiv.org/pdf/1809.07454.pdf Attributes: eps {float} -- epsilon value to avoid 0 division (default: {1e-8}) gain {torch.Tensor...
Implement the Python class `CumulativeLayerNorm` described below. Class description: Cumulative Layer Normalization (cLN) Implementation of the cLN as described in Conv-TasNet paper: - https://arxiv.org/pdf/1809.07454.pdf Attributes: eps {float} -- epsilon value to avoid 0 division (default: {1e-8}) gain {torch.Tensor...
2415502fa8a38d4624b1c71e926f1723bdc8535c
<|skeleton|> class CumulativeLayerNorm: """Cumulative Layer Normalization (cLN) Implementation of the cLN as described in Conv-TasNet paper: - https://arxiv.org/pdf/1809.07454.pdf Attributes: eps {float} -- epsilon value to avoid 0 division (default: {1e-8}) gain {torch.Tensor} -- gain weights (gamma) bias {torch.T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CumulativeLayerNorm: """Cumulative Layer Normalization (cLN) Implementation of the cLN as described in Conv-TasNet paper: - https://arxiv.org/pdf/1809.07454.pdf Attributes: eps {float} -- epsilon value to avoid 0 division (default: {1e-8}) gain {torch.Tensor} -- gain weights (gamma) bias {torch.Tensor} -- bia...
the_stack_v2_python_sparse
SPK_SP_Master/wass/convtasnet/modules.py
adamwhitakerwilson/speaker_separation
train
0
400594ef30b70c494f8249cae5ab982b4e25936c
[ "self.length = length\nself.mass = mass\nself.deck_space = deck_space", "key = 'blade_fasten_time'\ntime = kwargs.get(key, pt[key])\nreturn ('Fasten Blade', time)", "key = 'blade_release_time'\ntime = kwargs.get(key, pt[key])\nreturn ('Release Blade', time)" ]
<|body_start_0|> self.length = length self.mass = mass self.deck_space = deck_space <|end_body_0|> <|body_start_1|> key = 'blade_fasten_time' time = kwargs.get(key, pt[key]) return ('Fasten Blade', time) <|end_body_1|> <|body_start_2|> key = 'blade_release_time'...
Blade Cargo
Blade
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Blade: """Blade Cargo""" def __init__(self, length=None, mass=None, deck_space=None, **kwargs): """Creates an instance of `Blade`.""" <|body_0|> def fasten(**kwargs): """Returns time required to fasten a blade at port.""" <|body_1|> def release(**kwa...
stack_v2_sparse_classes_36k_train_020828
7,645
permissive
[ { "docstring": "Creates an instance of `Blade`.", "name": "__init__", "signature": "def __init__(self, length=None, mass=None, deck_space=None, **kwargs)" }, { "docstring": "Returns time required to fasten a blade at port.", "name": "fasten", "signature": "def fasten(**kwargs)" }, { ...
3
stack_v2_sparse_classes_30k_train_002767
Implement the Python class `Blade` described below. Class description: Blade Cargo Method signatures and docstrings: - def __init__(self, length=None, mass=None, deck_space=None, **kwargs): Creates an instance of `Blade`. - def fasten(**kwargs): Returns time required to fasten a blade at port. - def release(**kwargs)...
Implement the Python class `Blade` described below. Class description: Blade Cargo Method signatures and docstrings: - def __init__(self, length=None, mass=None, deck_space=None, **kwargs): Creates an instance of `Blade`. - def fasten(**kwargs): Returns time required to fasten a blade at port. - def release(**kwargs)...
d7270ebe1c554293a9d36730d67ab555c071cb17
<|skeleton|> class Blade: """Blade Cargo""" def __init__(self, length=None, mass=None, deck_space=None, **kwargs): """Creates an instance of `Blade`.""" <|body_0|> def fasten(**kwargs): """Returns time required to fasten a blade at port.""" <|body_1|> def release(**kwa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Blade: """Blade Cargo""" def __init__(self, length=None, mass=None, deck_space=None, **kwargs): """Creates an instance of `Blade`.""" self.length = length self.mass = mass self.deck_space = deck_space def fasten(**kwargs): """Returns time required to fasten a ...
the_stack_v2_python_sparse
wisdem/orbit/phases/install/turbine_install/common.py
WISDEM/WISDEM
train
120
eb5f7fbe47d6475aa218edec5072073087264c1c
[ "data_frame = self.result.pd_frame()\ncategories = set(['pedestrian', 'rider', 'car', 'truck', 'bus', 'train', 'motorcycle', 'bicycle', 'OVERALL'])\nself.assertSetEqual(categories, set(data_frame.index.values))\ndata_arr = data_frame.to_numpy()\nAPs = np.array([100.0, 90.0, 15.81683168, -1.0, -1.0, -1.0, -1.0, -1.0...
<|body_start_0|> data_frame = self.result.pd_frame() categories = set(['pedestrian', 'rider', 'car', 'truck', 'bus', 'train', 'motorcycle', 'bicycle', 'OVERALL']) self.assertSetEqual(categories, set(data_frame.index.values)) data_arr = data_frame.to_numpy() APs = np.array([100.0,...
Test cases for BDD100K detection evaluation.
TestBDD100KInsSegEval
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestBDD100KInsSegEval: """Test cases for BDD100K detection evaluation.""" def test_frame(self) -> None: """Test case for the function frame().""" <|body_0|> def test_summary(self) -> None: """Check evaluation scores' correctness.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_020829
5,629
permissive
[ { "docstring": "Test case for the function frame().", "name": "test_frame", "signature": "def test_frame(self) -> None" }, { "docstring": "Check evaluation scores' correctness.", "name": "test_summary", "signature": "def test_summary(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_007515
Implement the Python class `TestBDD100KInsSegEval` described below. Class description: Test cases for BDD100K detection evaluation. Method signatures and docstrings: - def test_frame(self) -> None: Test case for the function frame(). - def test_summary(self) -> None: Check evaluation scores' correctness.
Implement the Python class `TestBDD100KInsSegEval` described below. Class description: Test cases for BDD100K detection evaluation. Method signatures and docstrings: - def test_frame(self) -> None: Test case for the function frame(). - def test_summary(self) -> None: Check evaluation scores' correctness. <|skeleton|...
a4bfa9dc0c79abe90b2c06d20e84b79fbd9f2e38
<|skeleton|> class TestBDD100KInsSegEval: """Test cases for BDD100K detection evaluation.""" def test_frame(self) -> None: """Test case for the function frame().""" <|body_0|> def test_summary(self) -> None: """Check evaluation scores' correctness.""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestBDD100KInsSegEval: """Test cases for BDD100K detection evaluation.""" def test_frame(self) -> None: """Test case for the function frame().""" data_frame = self.result.pd_frame() categories = set(['pedestrian', 'rider', 'car', 'truck', 'bus', 'train', 'motorcycle', 'bicycle', '...
the_stack_v2_python_sparse
bdd100k/eval/ins_seg_test.py
navcul3108/bdd100k
train
0
e3c88a6465c474fd5f106c0862951b9ed13c632c
[ "b = d.lower()\nif b == 'chrome' or b == 'c':\n option = webdriver.ChromeOptions()\n option.add_argument('disable-infobars')\n option.add_argument('--window-size=' + x + ',' + y)\n driver = webdriver.Chrome(chrome_options=option, executable_path=chrome_path)\n print('driver=chrome')\nelif b == 'firef...
<|body_start_0|> b = d.lower() if b == 'chrome' or b == 'c': option = webdriver.ChromeOptions() option.add_argument('disable-infobars') option.add_argument('--window-size=' + x + ',' + y) driver = webdriver.Chrome(chrome_options=option, executable_path=chr...
browserdriver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class browserdriver: def brower_driver(d='chrome', x=x, y=y): """:param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值为配置文件config中所配置的值 :return: 返回一个有配置的driver""" <|body_0|> def brower_driver_no_gui(d='chrom...
stack_v2_sparse_classes_36k_train_020830
4,122
no_license
[ { "docstring": ":param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值为配置文件config中所配置的值 :return: 返回一个有配置的driver", "name": "brower_driver", "signature": "def brower_driver(d='chrome', x=x, y=y)" }, { "docstring": "工具方法,无界面操作...
2
stack_v2_sparse_classes_30k_train_009853
Implement the Python class `browserdriver` described below. Class description: Implement the browserdriver class. Method signatures and docstrings: - def brower_driver(d='chrome', x=x, y=y): :param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值...
Implement the Python class `browserdriver` described below. Class description: Implement the browserdriver class. Method signatures and docstrings: - def brower_driver(d='chrome', x=x, y=y): :param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值...
1e2ed4aa169cbe8d19f6aecc5cf8d96b274eea4d
<|skeleton|> class browserdriver: def brower_driver(d='chrome', x=x, y=y): """:param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值为配置文件config中所配置的值 :return: 返回一个有配置的driver""" <|body_0|> def brower_driver_no_gui(d='chrom...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class browserdriver: def brower_driver(d='chrome', x=x, y=y): """:param s: 浏览器启动,值为chrome,Firefox和ie,或第一个字母也可以例如 c,f,i,大小写都可以已做处理 :param x: 值为屏幕X轴大小,默认值为配置文件config中所配置的值 :param y: 值为屏幕Y轴大小,默认值为配置文件config中所配置的值 :return: 返回一个有配置的driver""" b = d.lower() if b == 'chrome' or b == 'c': ...
the_stack_v2_python_sparse
object/brower_driver.py
q739369242/webUItest
train
1
b3218b1f63512719bf13a8f67966abd43290d8ef
[ "if model._meta.app_label in UltraTech_APP:\n return self.using\nreturn None", "if model._meta.app_label in UltraTech_APP:\n return self.using\nreturn None", "if obj1._meta.app_label in UltraTech_APP or obj2._meta.app_label in UltraTech_APP:\n return True\nreturn None", "if app_label in UltraTech_APP...
<|body_start_0|> if model._meta.app_label in UltraTech_APP: return self.using return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in UltraTech_APP: return self.using return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label in ...
A router to control all database operations on models in the auth application.
UltraTechRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UltraTechRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write ...
stack_v2_sparse_classes_36k_train_020831
3,768
no_license
[ { "docstring": "Attempts to read auth models go to auth_db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth models go to auth_db.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, ...
4
null
Implement the Python class `UltraTechRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints...
Implement the Python class `UltraTechRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints...
23d31fbeddcd303a7dc90ac9cfbe2c762d61c61e
<|skeleton|> class UltraTechRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UltraTechRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" if model._meta.app_label in UltraTech_APP: return self.using return None ...
the_stack_v2_python_sparse
ultratech_fare/settings/routers.py
KONASANI-0143/Dev
train
0
e4b0a2a7e3b9bb95b11a5fdeb9169d7eed891d3d
[ "if len(nums) == 1:\n return False\nfor i in range(0, len(nums)):\n for j in range(1, k + 1):\n if i + j >= len(nums):\n break\n if nums[i] == nums[i + j]:\n return True\nreturn False", "nums_dictionary = {}\nfor i, v in enumerate(nums):\n if v in nums_dictionary and i...
<|body_start_0|> if len(nums) == 1: return False for i in range(0, len(nums)): for j in range(1, k + 1): if i + j >= len(nums): break if nums[i] == nums[i + j]: return True return False <|end_body_0|>...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_020832
1,186
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate", "signature": "def containsNearbyDuplicate(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: bool", "name": "containsNearbyDuplicate", "signature": "def contain...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtyp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool - def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtyp...
6de551327f96ec4d4b63d0045281b65bbb4f5d0f
<|skeleton|> class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_0|> def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def containsNearbyDuplicate(self, nums, k): """:type nums: List[int] :type k: int :rtype: bool""" if len(nums) == 1: return False for i in range(0, len(nums)): for j in range(1, k + 1): if i + j >= len(nums): break ...
the_stack_v2_python_sparse
containsNearbyDuplicate.py
JingweiTu/leetcode
train
0
47d998761b39ce2a5ede3ef27f9acbebd01ae065
[ "if SensorResource.__instance == None:\n SensorResource()\nreturn SensorResource.__instance", "if SensorResource.__instance != None:\n raise Exception('This class is a singleton!')\nelse:\n SensorResource.__instance = self" ]
<|body_start_0|> if SensorResource.__instance == None: SensorResource() return SensorResource.__instance <|end_body_0|> <|body_start_1|> if SensorResource.__instance != None: raise Exception('This class is a singleton!') else: SensorResource.__instanc...
Singleton class, used as a shared resource to store some raw data read from the sensor and to signal the current state of the sensor. Does not require to use locks because only one class, i.e. SerialCommunicator will write to this, and everything else will just read
SensorResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SensorResource: """Singleton class, used as a shared resource to store some raw data read from the sensor and to signal the current state of the sensor. Does not require to use locks because only one class, i.e. SerialCommunicator will write to this, and everything else will just read""" def...
stack_v2_sparse_classes_36k_train_020833
1,061
no_license
[ { "docstring": "Static access method.", "name": "getInstance", "signature": "def getInstance()" }, { "docstring": "Virtually private constructor.", "name": "__init__", "signature": "def __init__(self)" } ]
2
stack_v2_sparse_classes_30k_train_010157
Implement the Python class `SensorResource` described below. Class description: Singleton class, used as a shared resource to store some raw data read from the sensor and to signal the current state of the sensor. Does not require to use locks because only one class, i.e. SerialCommunicator will write to this, and eve...
Implement the Python class `SensorResource` described below. Class description: Singleton class, used as a shared resource to store some raw data read from the sensor and to signal the current state of the sensor. Does not require to use locks because only one class, i.e. SerialCommunicator will write to this, and eve...
dfd5fd8c757cae8b1306ae3e4eb2cfc9bf124fee
<|skeleton|> class SensorResource: """Singleton class, used as a shared resource to store some raw data read from the sensor and to signal the current state of the sensor. Does not require to use locks because only one class, i.e. SerialCommunicator will write to this, and everything else will just read""" def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SensorResource: """Singleton class, used as a shared resource to store some raw data read from the sensor and to signal the current state of the sensor. Does not require to use locks because only one class, i.e. SerialCommunicator will write to this, and everything else will just read""" def getInstance(...
the_stack_v2_python_sparse
apps/project/lib/SensorResource.py
mnk400/iot-device
train
0
813e0c173aa860149f4474a2b4e4a9f0fd45c80b
[ "if not data['publication_date']:\n try:\n x = re.findall('&data=(\\\\d+)\\\\-(\\\\d+)\\\\-(\\\\d+)&', data['dre_url'])[0]\n except IndexError:\n return None\n date = datetime.date(year=int(x[0]), month=int(x[1]), day=int(x[2]))\n return date\nelse:\n return data['publication_date']", ...
<|body_start_0|> if not data['publication_date']: try: x = re.findall('&data=(\\d+)\\-(\\d+)\\-(\\d+)&', data['dre_url'])[0] except IndexError: return None date = datetime.date(year=int(x[0]), month=int(x[1]), day=int(x[2])) return ...
TenderForm
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenderForm: def prepare_publication_date(data): """When publication_date is not available, we try to get it from the URL.""" <|body_0|> def clean_deadline_date(self): """Deadline requires knowledge of publication date.""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_020834
8,067
permissive
[ { "docstring": "When publication_date is not available, we try to get it from the URL.", "name": "prepare_publication_date", "signature": "def prepare_publication_date(data)" }, { "docstring": "Deadline requires knowledge of publication date.", "name": "clean_deadline_date", "signature":...
2
stack_v2_sparse_classes_30k_train_011809
Implement the Python class `TenderForm` described below. Class description: Implement the TenderForm class. Method signatures and docstrings: - def prepare_publication_date(data): When publication_date is not available, we try to get it from the URL. - def clean_deadline_date(self): Deadline requires knowledge of pub...
Implement the Python class `TenderForm` described below. Class description: Implement the TenderForm class. Method signatures and docstrings: - def prepare_publication_date(data): When publication_date is not available, we try to get it from the URL. - def clean_deadline_date(self): Deadline requires knowledge of pub...
3107ddc007f3574ce19aaa2223399484bc6b1382
<|skeleton|> class TenderForm: def prepare_publication_date(data): """When publication_date is not available, we try to get it from the URL.""" <|body_0|> def clean_deadline_date(self): """Deadline requires knowledge of publication date.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TenderForm: def prepare_publication_date(data): """When publication_date is not available, we try to get it from the URL.""" if not data['publication_date']: try: x = re.findall('&data=(\\d+)\\-(\\d+)\\-(\\d+)&', data['dre_url'])[0] except IndexError: ...
the_stack_v2_python_sparse
contracts/crawler_forms.py
jorgecarleitao/public-contracts
train
26
7a939bacdfd2d137bad4580a020380cd12ccd82b
[ "jobs = sorted(zip(startTime, endTime, profit), key=lambda v: v[1])\ndp = [[0, 0]]\nfor s, e, p in jobs:\n i = bisect.bisect(dp, [s + 1]) - 1\n if dp[i][1] + p > dp[-1][1]:\n dp.append([e, dp[i][1] + p])\nreturn dp[-1][1]", "jobs = sorted(zip(startTime, endTime, profit), key=lambda v: (v[0], v[1]))\n...
<|body_start_0|> jobs = sorted(zip(startTime, endTime, profit), key=lambda v: v[1]) dp = [[0, 0]] for s, e, p in jobs: i = bisect.bisect(dp, [s + 1]) - 1 if dp[i][1] + p > dp[-1][1]: dp.append([e, dp[i][1] + p]) return dp[-1][1] <|end_body_0|> <|b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def jobScheduling(self, startTime, endTime, profit): """:type startTime: List[int] :type endTime: List[int] :type profit: List[int] :rtype: int""" <|body_0|> def jobScheduling2(self, startTime, endTime, profit): """:type startTime: List[int] :type endTime: ...
stack_v2_sparse_classes_36k_train_020835
4,017
no_license
[ { "docstring": ":type startTime: List[int] :type endTime: List[int] :type profit: List[int] :rtype: int", "name": "jobScheduling", "signature": "def jobScheduling(self, startTime, endTime, profit)" }, { "docstring": ":type startTime: List[int] :type endTime: List[int] :type profit: List[int] :rt...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jobScheduling(self, startTime, endTime, profit): :type startTime: List[int] :type endTime: List[int] :type profit: List[int] :rtype: int - def jobScheduling2(self, startTime,...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def jobScheduling(self, startTime, endTime, profit): :type startTime: List[int] :type endTime: List[int] :type profit: List[int] :rtype: int - def jobScheduling2(self, startTime,...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def jobScheduling(self, startTime, endTime, profit): """:type startTime: List[int] :type endTime: List[int] :type profit: List[int] :rtype: int""" <|body_0|> def jobScheduling2(self, startTime, endTime, profit): """:type startTime: List[int] :type endTime: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def jobScheduling(self, startTime, endTime, profit): """:type startTime: List[int] :type endTime: List[int] :type profit: List[int] :rtype: int""" jobs = sorted(zip(startTime, endTime, profit), key=lambda v: v[1]) dp = [[0, 0]] for s, e, p in jobs: i = bis...
the_stack_v2_python_sparse
M/MaximumProfitinJobScheduling.py
bssrdf/pyleet
train
2
edc06ce2aab9d882a9685ef01bbc52c50681b51b
[ "super().__init__(FILTER_NAME_TIME_SMA, window_size, precision=precision, entity=entity)\nself._time_window = window_size\nself.last_leak: FilterState | None = None\nself.queue = deque[FilterState]()", "while self.queue:\n if self.queue[0].timestamp + self._time_window <= left_boundary:\n self.last_leak...
<|body_start_0|> super().__init__(FILTER_NAME_TIME_SMA, window_size, precision=precision, entity=entity) self._time_window = window_size self.last_leak: FilterState | None = None self.queue = deque[FilterState]() <|end_body_0|> <|body_start_1|> while self.queue: if s...
Simple Moving Average (SMA) Filter. The window_size is determined by time, and SMA is time weighted.
TimeSMAFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeSMAFilter: """Simple Moving Average (SMA) Filter. The window_size is determined by time, and SMA is time weighted.""" def __init__(self, *, window_size: timedelta, entity: str, type: str, precision: int=DEFAULT_PRECISION) -> None: """Initialize Filter. :param type: type of algori...
stack_v2_sparse_classes_36k_train_020836
23,958
permissive
[ { "docstring": "Initialize Filter. :param type: type of algorithm used to connect discrete values", "name": "__init__", "signature": "def __init__(self, *, window_size: timedelta, entity: str, type: str, precision: int=DEFAULT_PRECISION) -> None" }, { "docstring": "Remove timeouted elements.", ...
3
null
Implement the Python class `TimeSMAFilter` described below. Class description: Simple Moving Average (SMA) Filter. The window_size is determined by time, and SMA is time weighted. Method signatures and docstrings: - def __init__(self, *, window_size: timedelta, entity: str, type: str, precision: int=DEFAULT_PRECISION...
Implement the Python class `TimeSMAFilter` described below. Class description: Simple Moving Average (SMA) Filter. The window_size is determined by time, and SMA is time weighted. Method signatures and docstrings: - def __init__(self, *, window_size: timedelta, entity: str, type: str, precision: int=DEFAULT_PRECISION...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class TimeSMAFilter: """Simple Moving Average (SMA) Filter. The window_size is determined by time, and SMA is time weighted.""" def __init__(self, *, window_size: timedelta, entity: str, type: str, precision: int=DEFAULT_PRECISION) -> None: """Initialize Filter. :param type: type of algori...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeSMAFilter: """Simple Moving Average (SMA) Filter. The window_size is determined by time, and SMA is time weighted.""" def __init__(self, *, window_size: timedelta, entity: str, type: str, precision: int=DEFAULT_PRECISION) -> None: """Initialize Filter. :param type: type of algorithm used to c...
the_stack_v2_python_sparse
homeassistant/components/filter/sensor.py
home-assistant/core
train
35,501
204a359d3c7bcfc76c4052125f8cc8199ed730a3
[ "if 'z' in kwargs:\n self.z = float(kwargs['z'])\n self.distance = None\nelif 'redshift' in kwargs:\n self.z = float(kwargs['redshift'])\n self.distance = None\nelif 'distance' in kwargs:\n if 'distanceUnits' not in kwargs:\n raise ValueError(\"If you specify 'distance', you must also specify ...
<|body_start_0|> if 'z' in kwargs: self.z = float(kwargs['z']) self.distance = None elif 'redshift' in kwargs: self.z = float(kwargs['redshift']) self.distance = None elif 'distance' in kwargs: if 'distanceUnits' not in kwargs: ...
Represents an RA, Dec[, z | physical distance] coordinate system.
EquatorialCoordinates
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EquatorialCoordinates: """Represents an RA, Dec[, z | physical distance] coordinate system.""" def __init__(self, ra, dec, **kwargs): """A few notes: - if the ra/dec specified are not geometry.Angle() objects, they are assumed to be in units degrees, and converted to Angle() objects....
stack_v2_sparse_classes_36k_train_020837
21,382
permissive
[ { "docstring": "A few notes: - if the ra/dec specified are not geometry.Angle() objects, they are assumed to be in units degrees, and converted to Angle() objects. - if you specify distance=blah, corresponding to a physical distance to the object, you must also specify 'distanceUnits' to be pc, kpc, mpc, ly, m,...
2
null
Implement the Python class `EquatorialCoordinates` described below. Class description: Represents an RA, Dec[, z | physical distance] coordinate system. Method signatures and docstrings: - def __init__(self, ra, dec, **kwargs): A few notes: - if the ra/dec specified are not geometry.Angle() objects, they are assumed ...
Implement the Python class `EquatorialCoordinates` described below. Class description: Represents an RA, Dec[, z | physical distance] coordinate system. Method signatures and docstrings: - def __init__(self, ra, dec, **kwargs): A few notes: - if the ra/dec specified are not geometry.Angle() objects, they are assumed ...
f7d3ef3ccfecd87b50ce05cf6af5a564679f15f5
<|skeleton|> class EquatorialCoordinates: """Represents an RA, Dec[, z | physical distance] coordinate system.""" def __init__(self, ra, dec, **kwargs): """A few notes: - if the ra/dec specified are not geometry.Angle() objects, they are assumed to be in units degrees, and converted to Angle() objects....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EquatorialCoordinates: """Represents an RA, Dec[, z | physical distance] coordinate system.""" def __init__(self, ra, dec, **kwargs): """A few notes: - if the ra/dec specified are not geometry.Angle() objects, they are assumed to be in units degrees, and converted to Angle() objects. - if you spe...
the_stack_v2_python_sparse
python/sdssdb/sqlalchemy/operationsdb/tools/geometry.py
sdss/sdssdb
train
9
a803fb6c4809773d1e7d5f48f6d2c905cc15b4dc
[ "if not nums:\n return nums\ncnt = {}\nfor n in nums:\n cnt.setdefault(n, 0)\n cnt[n] += 1\nmax_count = max(cnt.items(), key=lambda key: cnt[key[0]])[1]\nif max_count == 1:\n return 1\ncandidates = [k for k, d in cnt.items() if d == max_count]\nlen_n = len(nums)\nret = 50001\nfor c in candidates:\n l...
<|body_start_0|> if not nums: return nums cnt = {} for n in nums: cnt.setdefault(n, 0) cnt[n] += 1 max_count = max(cnt.items(), key=lambda key: cnt[key[0]])[1] if max_count == 1: return 1 candidates = [k for k, d in cnt.item...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findShortestSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findShortestSubArrayRough(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: ...
stack_v2_sparse_classes_36k_train_020838
1,554
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "findShortestSubArray", "signature": "def findShortestSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "findShortestSubArrayRough", "signature": "def findShortestSubArrayRough(self, nums)" }...
2
stack_v2_sparse_classes_30k_train_013763
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findShortestSubArray(self, nums): :type nums: List[int] :rtype: int - def findShortestSubArrayRough(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findShortestSubArray(self, nums): :type nums: List[int] :rtype: int - def findShortestSubArrayRough(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solutio...
ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd
<|skeleton|> class Solution: def findShortestSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def findShortestSubArrayRough(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findShortestSubArray(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return nums cnt = {} for n in nums: cnt.setdefault(n, 0) cnt[n] += 1 max_count = max(cnt.items(), key=lambda key: cnt[key[0]])[1] ...
the_stack_v2_python_sparse
cs_notes/arrays/degree_of_an_array.py
hwc1824/LeetCodeSolution
train
0
9c9a74ebe344f32c01ed31ab2d9b5e4d94686d34
[ "BaseNeo.__init__(self, name=name, file_origin=file_origin, description=description, **annotations)\nif times is None:\n times = np.array([]) * pq.s\nif durations is None:\n durations = np.array([]) * pq.s\nif labels is None:\n labels = np.array([], dtype='S')\nself.times = times\nself.durations = duration...
<|body_start_0|> BaseNeo.__init__(self, name=name, file_origin=file_origin, description=description, **annotations) if times is None: times = np.array([]) * pq.s if durations is None: durations = np.array([]) * pq.s if labels is None: labels = np.array...
Array of epochs. Introduced for performance reason. An :class:`EpochArray` is prefered to a list of :class:`Epoch` objects. *Usage*:: >>> from neo.core import EpochArray >>> from quantities import s, ms >>> import numpy as np >>> >>> epcarr = EpochArray(times=np.arange(0, 30, 10)*s, ... durations=[10, 5, 7]*ms, ... lab...
EpochArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EpochArray: """Array of epochs. Introduced for performance reason. An :class:`EpochArray` is prefered to a list of :class:`Epoch` objects. *Usage*:: >>> from neo.core import EpochArray >>> from quantities import s, ms >>> import numpy as np >>> >>> epcarr = EpochArray(times=np.arange(0, 30, 10)*s...
stack_v2_sparse_classes_36k_train_020839
4,621
no_license
[ { "docstring": "Initialize a new :class:`EpochArray` instance.", "name": "__init__", "signature": "def __init__(self, times=None, durations=None, labels=None, name=None, description=None, file_origin=None, **annotations)" }, { "docstring": "Returns a string representing the :class:`EpochArray`."...
3
stack_v2_sparse_classes_30k_train_012452
Implement the Python class `EpochArray` described below. Class description: Array of epochs. Introduced for performance reason. An :class:`EpochArray` is prefered to a list of :class:`Epoch` objects. *Usage*:: >>> from neo.core import EpochArray >>> from quantities import s, ms >>> import numpy as np >>> >>> epcarr = ...
Implement the Python class `EpochArray` described below. Class description: Array of epochs. Introduced for performance reason. An :class:`EpochArray` is prefered to a list of :class:`Epoch` objects. *Usage*:: >>> from neo.core import EpochArray >>> from quantities import s, ms >>> import numpy as np >>> >>> epcarr = ...
4c7b22771289b848edaa666e0b4e47469aab5b74
<|skeleton|> class EpochArray: """Array of epochs. Introduced for performance reason. An :class:`EpochArray` is prefered to a list of :class:`Epoch` objects. *Usage*:: >>> from neo.core import EpochArray >>> from quantities import s, ms >>> import numpy as np >>> >>> epcarr = EpochArray(times=np.arange(0, 30, 10)*s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EpochArray: """Array of epochs. Introduced for performance reason. An :class:`EpochArray` is prefered to a list of :class:`Epoch` objects. *Usage*:: >>> from neo.core import EpochArray >>> from quantities import s, ms >>> import numpy as np >>> >>> epcarr = EpochArray(times=np.arange(0, 30, 10)*s, ... duratio...
the_stack_v2_python_sparse
core/epocharray.py
srsummerson/analysis
train
0
0d0f0669dff277982599a0fad23940d6e8c13f1d
[ "self.db.damage_range = (15, 25)\nself.db.accuracy_bonus = 0\nself.db.weapon_type_name = 'weapon'", "if dropper.db.wielded_weapon == self:\n dropper.db.wielded_weapon = None\n dropper.location.msg_contents('%s stops wielding %s.' % (dropper, self))", "if giver.db.wielded_weapon == self:\n giver.db.wiel...
<|body_start_0|> self.db.damage_range = (15, 25) self.db.accuracy_bonus = 0 self.db.weapon_type_name = 'weapon' <|end_body_0|> <|body_start_1|> if dropper.db.wielded_weapon == self: dropper.db.wielded_weapon = None dropper.location.msg_contents('%s stops wielding...
A weapon which can be wielded in combat with the 'wield' command.
TBEWeapon
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TBEWeapon: """A weapon which can be wielded in combat with the 'wield' command.""" def at_object_creation(self): """Called once, when this object is first created. This is the normal hook to overload for most object types.""" <|body_0|> def at_drop(self, dropper): ...
stack_v2_sparse_classes_36k_train_020840
23,139
permissive
[ { "docstring": "Called once, when this object is first created. This is the normal hook to overload for most object types.", "name": "at_object_creation", "signature": "def at_object_creation(self)" }, { "docstring": "Stop being wielded if dropped.", "name": "at_drop", "signature": "def ...
3
null
Implement the Python class `TBEWeapon` described below. Class description: A weapon which can be wielded in combat with the 'wield' command. Method signatures and docstrings: - def at_object_creation(self): Called once, when this object is first created. This is the normal hook to overload for most object types. - de...
Implement the Python class `TBEWeapon` described below. Class description: A weapon which can be wielded in combat with the 'wield' command. Method signatures and docstrings: - def at_object_creation(self): Called once, when this object is first created. This is the normal hook to overload for most object types. - de...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class TBEWeapon: """A weapon which can be wielded in combat with the 'wield' command.""" def at_object_creation(self): """Called once, when this object is first created. This is the normal hook to overload for most object types.""" <|body_0|> def at_drop(self, dropper): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TBEWeapon: """A weapon which can be wielded in combat with the 'wield' command.""" def at_object_creation(self): """Called once, when this object is first created. This is the normal hook to overload for most object types.""" self.db.damage_range = (15, 25) self.db.accuracy_bonus ...
the_stack_v2_python_sparse
evennia/contrib/game_systems/turnbattle/tb_equip.py
evennia/evennia
train
1,781
233fc8ea9367b935ae68b99e20e6b760bf11f316
[ "length = len(height)\ndeq = deque(range(1, length + 1))\ndic = {height[i]: i + 1 for i in range(length)}\nheapify(height)\nmaxarea = 0\nwhile height:\n ch = heappop(height)\n area = max(ch * (dic[ch] - deq[0]), ch * (deq[-1] - dic[ch]))\n if area > maxarea:\n maxarea = area\n deq.remove(dic[ch])...
<|body_start_0|> length = len(height) deq = deque(range(1, length + 1)) dic = {height[i]: i + 1 for i in range(length)} heapify(height) maxarea = 0 while height: ch = heappop(height) area = max(ch * (dic[ch] - deq[0]), ch * (deq[-1] - dic[ch])) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea(self, height): """A bad complex one. This works for no-duplicate height, while costs lots of extra space.""" <|body_0|> def maxArea2(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_020841
1,418
no_license
[ { "docstring": "A bad complex one. This works for no-duplicate height, while costs lots of extra space.", "name": "maxArea", "signature": "def maxArea(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea2", "signature": "def maxArea2(self, height)" }...
2
stack_v2_sparse_classes_30k_train_000529
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): A bad complex one. This works for no-duplicate height, while costs lots of extra space. - def maxArea2(self, height): :type height: List[int] :rtype: i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea(self, height): A bad complex one. This works for no-duplicate height, while costs lots of extra space. - def maxArea2(self, height): :type height: List[int] :rtype: i...
11942efcf481ab79a1c4a7e020e4353e0e0d3901
<|skeleton|> class Solution: def maxArea(self, height): """A bad complex one. This works for no-duplicate height, while costs lots of extra space.""" <|body_0|> def maxArea2(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxArea(self, height): """A bad complex one. This works for no-duplicate height, while costs lots of extra space.""" length = len(height) deq = deque(range(1, length + 1)) dic = {height[i]: i + 1 for i in range(length)} heapify(height) maxarea = 0 ...
the_stack_v2_python_sparse
python/solveleet/mostWater.py
clumsyme/learn
train
0
7a8bb2005a21974171ed36617195bc873b499240
[ "flags.AddParentFlagsToParser(parser)\nparser.add_argument('--location', metavar='LOCATION', required=True, help='Location')\nparser.add_argument('--recommender', metavar='RECOMMENDER', required=False, help='Recommender to list recommendations for. If no recommender is specified, recommendations for all supported r...
<|body_start_0|> flags.AddParentFlagsToParser(parser) parser.add_argument('--location', metavar='LOCATION', required=True, help='Location') parser.add_argument('--recommender', metavar='RECOMMENDER', required=False, help='Recommender to list recommendations for. If no recommender is specified, r...
List operations for a recommendation. This command lists all recommendations for a given cloud_entity_id, location and recommender. Supported recommenders can be found here: https://cloud.google.com/recommender/docs/recommenders. Currently the following cloud_entity_types are supported: project, billing_account, folder...
List
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class List: """List operations for a recommendation. This command lists all recommendations for a given cloud_entity_id, location and recommender. Supported recommenders can be found here: https://cloud.google.com/recommender/docs/recommenders. Currently the following cloud_entity_types are supported: ...
stack_v2_sparse_classes_36k_train_020842
6,552
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "Run 'gcloud recommender recomme...
2
null
Implement the Python class `List` described below. Class description: List operations for a recommendation. This command lists all recommendations for a given cloud_entity_id, location and recommender. Supported recommenders can be found here: https://cloud.google.com/recommender/docs/recommenders. Currently the follo...
Implement the Python class `List` described below. Class description: List operations for a recommendation. This command lists all recommendations for a given cloud_entity_id, location and recommender. Supported recommenders can be found here: https://cloud.google.com/recommender/docs/recommenders. Currently the follo...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class List: """List operations for a recommendation. This command lists all recommendations for a given cloud_entity_id, location and recommender. Supported recommenders can be found here: https://cloud.google.com/recommender/docs/recommenders. Currently the following cloud_entity_types are supported: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class List: """List operations for a recommendation. This command lists all recommendations for a given cloud_entity_id, location and recommender. Supported recommenders can be found here: https://cloud.google.com/recommender/docs/recommenders. Currently the following cloud_entity_types are supported: project, bill...
the_stack_v2_python_sparse
lib/surface/recommender/recommendations/list.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
b71a1b22ae30567ed7a662c8aa59f06caf1651f3
[ "app.config['TESTING'] = True\napp.testing = True\nself.client = app.test_client()", "ret = self.client.post('/login', data={})\nresp = ret.data\nresp = json.loads(resp)\nself.assertIn('code', resp)\nself.assertEqual(resp['code'], 1)\nret = self.client.post('/login', data={'user_name': 'admin'})\nresp = ret.data\...
<|body_start_0|> app.config['TESTING'] = True app.testing = True self.client = app.test_client() <|end_body_0|> <|body_start_1|> ret = self.client.post('/login', data={}) resp = ret.data resp = json.loads(resp) self.assertIn('code', resp) self.assertEqual...
构造单元测试案例
LoginTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoginTest: """构造单元测试案例""" def setUp(self): """在测试之前,先被执行""" <|body_0|> def test_empty_name_password(self): """测试用户名密码不完整的情况""" <|body_1|> def test_wrong_user_name_password(self): """测试用户名家和密码错误""" <|body_2|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_020843
2,624
no_license
[ { "docstring": "在测试之前,先被执行", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "测试用户名密码不完整的情况", "name": "test_empty_name_password", "signature": "def test_empty_name_password(self)" }, { "docstring": "测试用户名家和密码错误", "name": "test_wrong_user_name_password", ...
3
stack_v2_sparse_classes_30k_train_003669
Implement the Python class `LoginTest` described below. Class description: 构造单元测试案例 Method signatures and docstrings: - def setUp(self): 在测试之前,先被执行 - def test_empty_name_password(self): 测试用户名密码不完整的情况 - def test_wrong_user_name_password(self): 测试用户名家和密码错误
Implement the Python class `LoginTest` described below. Class description: 构造单元测试案例 Method signatures and docstrings: - def setUp(self): 在测试之前,先被执行 - def test_empty_name_password(self): 测试用户名密码不完整的情况 - def test_wrong_user_name_password(self): 测试用户名家和密码错误 <|skeleton|> class LoginTest: """构造单元测试案例""" def setU...
217d594a3c0cba1e52550f74d100cc5023fb415b
<|skeleton|> class LoginTest: """构造单元测试案例""" def setUp(self): """在测试之前,先被执行""" <|body_0|> def test_empty_name_password(self): """测试用户名密码不完整的情况""" <|body_1|> def test_wrong_user_name_password(self): """测试用户名家和密码错误""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoginTest: """构造单元测试案例""" def setUp(self): """在测试之前,先被执行""" app.config['TESTING'] = True app.testing = True self.client = app.test_client() def test_empty_name_password(self): """测试用户名密码不完整的情况""" ret = self.client.post('/login', data={}) resp =...
the_stack_v2_python_sparse
Flask_Heima/Day04/test.py
biabulinxi/Python-ML-DL
train
0
361912bcaedc3b6c1f0d0dd022a54700621a88a6
[ "if needle == '':\n return 0\nhaystack = '#' + haystack\nn = len(haystack)\nneedle = '#' + needle\nm = len(needle)\npos = self.compute_prefix_func(needle)\nq = 0\nfor i in range(1, n):\n while q > 0 and needle[q + 1] != haystack[i]:\n q = pos[q]\n if needle[q + 1] == haystack[i]:\n q = q + 1\...
<|body_start_0|> if needle == '': return 0 haystack = '#' + haystack n = len(haystack) needle = '#' + needle m = len(needle) pos = self.compute_prefix_func(needle) q = 0 for i in range(1, n): while q > 0 and needle[q + 1] != haystac...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_0|> def compute_prefix_func(self, pattern): """:param pattern: str :return: list[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> if nee...
stack_v2_sparse_classes_36k_train_020844
1,631
no_license
[ { "docstring": ":type haystack: str :type needle: str :rtype: int", "name": "strStr", "signature": "def strStr(self, haystack, needle)" }, { "docstring": ":param pattern: str :return: list[int]", "name": "compute_prefix_func", "signature": "def compute_prefix_func(self, pattern)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def strStr(self, haystack, needle): :type haystack: str :type needle: str :rtype: int - def compute_prefix_func(self, pattern): :param pattern: str :return: list[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def strStr(self, haystack, needle): :type haystack: str :type needle: str :rtype: int - def compute_prefix_func(self, pattern): :param pattern: str :return: list[int] <|skeleton...
1520e1e9bb0c428797a3e5234e5b328110472c20
<|skeleton|> class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" <|body_0|> def compute_prefix_func(self, pattern): """:param pattern: str :return: list[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def strStr(self, haystack, needle): """:type haystack: str :type needle: str :rtype: int""" if needle == '': return 0 haystack = '#' + haystack n = len(haystack) needle = '#' + needle m = len(needle) pos = self.compute_prefix_func(n...
the_stack_v2_python_sparse
Array/28. Implement strStr().py
tinkle1129/Leetcode_Solution
train
0
7445109bfe9000a2d2680b2b9da59ffe0e2c1b9e
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
An API for retrieving and managing error statistics as well as data for individual events.
ErrorStatsServiceServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ErrorStatsServiceServicer: """An API for retrieving and managing error statistics as well as data for individual events.""" def ListGroupStats(self, request, context): """Lists the specified groups.""" <|body_0|> def ListEvents(self, request, context): """Lists t...
stack_v2_sparse_classes_36k_train_020845
4,264
no_license
[ { "docstring": "Lists the specified groups.", "name": "ListGroupStats", "signature": "def ListGroupStats(self, request, context)" }, { "docstring": "Lists the specified events.", "name": "ListEvents", "signature": "def ListEvents(self, request, context)" }, { "docstring": "Delete...
3
stack_v2_sparse_classes_30k_train_008365
Implement the Python class `ErrorStatsServiceServicer` described below. Class description: An API for retrieving and managing error statistics as well as data for individual events. Method signatures and docstrings: - def ListGroupStats(self, request, context): Lists the specified groups. - def ListEvents(self, reque...
Implement the Python class `ErrorStatsServiceServicer` described below. Class description: An API for retrieving and managing error statistics as well as data for individual events. Method signatures and docstrings: - def ListGroupStats(self, request, context): Lists the specified groups. - def ListEvents(self, reque...
d7424d21aa0dc121acc4d64b427ba365a3581a20
<|skeleton|> class ErrorStatsServiceServicer: """An API for retrieving and managing error statistics as well as data for individual events.""" def ListGroupStats(self, request, context): """Lists the specified groups.""" <|body_0|> def ListEvents(self, request, context): """Lists t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ErrorStatsServiceServicer: """An API for retrieving and managing error statistics as well as data for individual events.""" def ListGroupStats(self, request, context): """Lists the specified groups.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not...
the_stack_v2_python_sparse
google/devtools/clouderrorreporting/v1beta1/error_stats_service_pb2_grpc.py
msachtler/bazel-event-protocol-parser
train
1
5a66b20110b2947aefb4afa75292115957e03ecd
[ "try:\n return Member.objects.get(pk=pk)\nexcept Member.DoesNotExist:\n raise Http404", "if pk is not None:\n member = self.get_member(int(pk))\nelse:\n member = None\nself.check_object_permissions(request, member)\ndeposits = SavingsWithdrawal.get_withdrawals(member)\nserializer = SavingsWithdrawalMi...
<|body_start_0|> try: return Member.objects.get(pk=pk) except Member.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> if pk is not None: member = self.get_member(int(pk)) else: member = None self.check_object_permissions...
SavingsWithdrawalView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SavingsWithdrawalView: def get_member(self, pk): """Get a member.""" <|body_0|> def get(self, request, pk, format=None): """List Member's savings Deposits --- serializer: savings.serializers.SavingsWithdrawalMinimalSerializer""" <|body_1|> def post(self,...
stack_v2_sparse_classes_36k_train_020846
5,809
no_license
[ { "docstring": "Get a member.", "name": "get_member", "signature": "def get_member(self, pk)" }, { "docstring": "List Member's savings Deposits --- serializer: savings.serializers.SavingsWithdrawalMinimalSerializer", "name": "get", "signature": "def get(self, request, pk, format=None)" ...
3
stack_v2_sparse_classes_30k_train_015662
Implement the Python class `SavingsWithdrawalView` described below. Class description: Implement the SavingsWithdrawalView class. Method signatures and docstrings: - def get_member(self, pk): Get a member. - def get(self, request, pk, format=None): List Member's savings Deposits --- serializer: savings.serializers.Sa...
Implement the Python class `SavingsWithdrawalView` described below. Class description: Implement the SavingsWithdrawalView class. Method signatures and docstrings: - def get_member(self, pk): Get a member. - def get(self, request, pk, format=None): List Member's savings Deposits --- serializer: savings.serializers.Sa...
c5ac11e40a628c93c3865363e97b4f255a104ca8
<|skeleton|> class SavingsWithdrawalView: def get_member(self, pk): """Get a member.""" <|body_0|> def get(self, request, pk, format=None): """List Member's savings Deposits --- serializer: savings.serializers.SavingsWithdrawalMinimalSerializer""" <|body_1|> def post(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SavingsWithdrawalView: def get_member(self, pk): """Get a member.""" try: return Member.objects.get(pk=pk) except Member.DoesNotExist: raise Http404 def get(self, request, pk, format=None): """List Member's savings Deposits --- serializer: savings.s...
the_stack_v2_python_sparse
savings/views.py
lubegamark/gosacco
train
2
860cdc0d8dac6067c0e6381f25ece38a043ca80d
[ "try:\n self.db = pymysql.connect(host, username, password, database, charset='utf8', port=port)\n self.cursor = self.db.cursor()\nexcept pymysql.MySQLError as e:\n print(e.args)", "keys = ','.join(data.keys())\nvalues = ','.join(['%s'] * len(data))\nsql_query = 'insert into %s (%s) values (%s)' % (table...
<|body_start_0|> try: self.db = pymysql.connect(host, username, password, database, charset='utf8', port=port) self.cursor = self.db.cursor() except pymysql.MySQLError as e: print(e.args) <|end_body_0|> <|body_start_1|> keys = ','.join(data.keys()) va...
MySQL连接
Mysql
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mysql: """MySQL连接""" def __init__(self, host=MYSQL_HOST, username=MYSQL_USER, password=MYSQL_PASSWORD, port=MYSQL_PORT, database=MYSQL_DATABASE): """初始化数据库连接""" <|body_0|> def insert(self, table, data): """数据插入""" <|body_1|> <|end_skeleton|> <|body_star...
stack_v2_sparse_classes_36k_train_020847
11,930
no_license
[ { "docstring": "初始化数据库连接", "name": "__init__", "signature": "def __init__(self, host=MYSQL_HOST, username=MYSQL_USER, password=MYSQL_PASSWORD, port=MYSQL_PORT, database=MYSQL_DATABASE)" }, { "docstring": "数据插入", "name": "insert", "signature": "def insert(self, table, data)" } ]
2
null
Implement the Python class `Mysql` described below. Class description: MySQL连接 Method signatures and docstrings: - def __init__(self, host=MYSQL_HOST, username=MYSQL_USER, password=MYSQL_PASSWORD, port=MYSQL_PORT, database=MYSQL_DATABASE): 初始化数据库连接 - def insert(self, table, data): 数据插入
Implement the Python class `Mysql` described below. Class description: MySQL连接 Method signatures and docstrings: - def __init__(self, host=MYSQL_HOST, username=MYSQL_USER, password=MYSQL_PASSWORD, port=MYSQL_PORT, database=MYSQL_DATABASE): 初始化数据库连接 - def insert(self, table, data): 数据插入 <|skeleton|> class Mysql: ...
f49a93c1cab5716d4dafecb7479a3be2a4af91ad
<|skeleton|> class Mysql: """MySQL连接""" def __init__(self, host=MYSQL_HOST, username=MYSQL_USER, password=MYSQL_PASSWORD, port=MYSQL_PORT, database=MYSQL_DATABASE): """初始化数据库连接""" <|body_0|> def insert(self, table, data): """数据插入""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mysql: """MySQL连接""" def __init__(self, host=MYSQL_HOST, username=MYSQL_USER, password=MYSQL_PASSWORD, port=MYSQL_PORT, database=MYSQL_DATABASE): """初始化数据库连接""" try: self.db = pymysql.connect(host, username, password, database, charset='utf8', port=port) self.curso...
the_stack_v2_python_sparse
Sec_9/9.5/weixin_spider.py
WiconWang/spider_project
train
0
bb6c6cd2a6d470fa38c9ed66d3e79796ef5b83eb
[ "dp = [0] * (K + 1)\nm = 0\nwhile dp[K] < N:\n m += 1\n for k in range(K, 0, -1):\n dp[k] = dp[k - 1] + dp[k] + 1\nreturn m", "if N == 0:\n return 0\nif K == 1:\n return N\nans = min([max([self.superEggDrop(K, N - i), self.superEggDrop(K - 1, i - 1)]) for i in range(1, N + 1)]) + 1\nreturn ans"...
<|body_start_0|> dp = [0] * (K + 1) m = 0 while dp[K] < N: m += 1 for k in range(K, 0, -1): dp[k] = dp[k - 1] + dp[k] + 1 return m <|end_body_0|> <|body_start_1|> if N == 0: return 0 if K == 1: return N ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def superEggDrop0(self, K, N): """dp[k][m] 的含义是k个鸡蛋 移动m次最多能够确定多少楼层 这个角度思考 dp[k][m] 最多能够确定的楼层数为L 那么我选定第一个扔的楼层之后,我要么碎,要么不碎 这就是把L分成3段 左边是碎的那段 长度是dp[k][m - 1] 右边是没碎的那段 长度是dp[k-1][m - 1] 因为已经碎了一个了 中间是我选定扔的楼层 是1 所以递推公式是 dp[k][m] = dp[k - 1][m - 1] + dp[k][m - 1] + 1 根据递推公式 如果采用k倒着从大到...
stack_v2_sparse_classes_36k_train_020848
4,564
no_license
[ { "docstring": "dp[k][m] 的含义是k个鸡蛋 移动m次最多能够确定多少楼层 这个角度思考 dp[k][m] 最多能够确定的楼层数为L 那么我选定第一个扔的楼层之后,我要么碎,要么不碎 这就是把L分成3段 左边是碎的那段 长度是dp[k][m - 1] 右边是没碎的那段 长度是dp[k-1][m - 1] 因为已经碎了一个了 中间是我选定扔的楼层 是1 所以递推公式是 dp[k][m] = dp[k - 1][m - 1] + dp[k][m - 1] + 1 根据递推公式 如果采用k倒着从大到小计算 就可以只存一行的dp[k] 直接原地更新dp[k] 不影响后续计算 只需要O(K)空间复杂度 O...
3
stack_v2_sparse_classes_30k_train_016610
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def superEggDrop0(self, K, N): dp[k][m] 的含义是k个鸡蛋 移动m次最多能够确定多少楼层 这个角度思考 dp[k][m] 最多能够确定的楼层数为L 那么我选定第一个扔的楼层之后,我要么碎,要么不碎 这就是把L分成3段 左边是碎的那段 长度是dp[k][m - 1] 右边是没碎的那段 长度是dp[k-1][m - 1]...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def superEggDrop0(self, K, N): dp[k][m] 的含义是k个鸡蛋 移动m次最多能够确定多少楼层 这个角度思考 dp[k][m] 最多能够确定的楼层数为L 那么我选定第一个扔的楼层之后,我要么碎,要么不碎 这就是把L分成3段 左边是碎的那段 长度是dp[k][m - 1] 右边是没碎的那段 长度是dp[k-1][m - 1]...
b8f705a77cfcdb7d498d3422f9c4ee88fd61a3b3
<|skeleton|> class Solution: def superEggDrop0(self, K, N): """dp[k][m] 的含义是k个鸡蛋 移动m次最多能够确定多少楼层 这个角度思考 dp[k][m] 最多能够确定的楼层数为L 那么我选定第一个扔的楼层之后,我要么碎,要么不碎 这就是把L分成3段 左边是碎的那段 长度是dp[k][m - 1] 右边是没碎的那段 长度是dp[k-1][m - 1] 因为已经碎了一个了 中间是我选定扔的楼层 是1 所以递推公式是 dp[k][m] = dp[k - 1][m - 1] + dp[k][m - 1] + 1 根据递推公式 如果采用k倒着从大到...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def superEggDrop0(self, K, N): """dp[k][m] 的含义是k个鸡蛋 移动m次最多能够确定多少楼层 这个角度思考 dp[k][m] 最多能够确定的楼层数为L 那么我选定第一个扔的楼层之后,我要么碎,要么不碎 这就是把L分成3段 左边是碎的那段 长度是dp[k][m - 1] 右边是没碎的那段 长度是dp[k-1][m - 1] 因为已经碎了一个了 中间是我选定扔的楼层 是1 所以递推公式是 dp[k][m] = dp[k - 1][m - 1] + dp[k][m - 1] + 1 根据递推公式 如果采用k倒着从大到小计算 就可以只存一行的dp...
the_stack_v2_python_sparse
LeetcodePython/Base/算法面试题2018/1-5-鸡蛋掉落.py
selonsy/leetcode
train
0
05e30fb880eb841c828cbd062efdc755935388cd
[ "caller = self.caller\nif hasattr(self.caller.location, 'get_detail'):\n detail = self.caller.location.get_detail(self.args, looker=self.caller)\n if detail:\n caller.location.msg_contents(f'$You() $conj(look) closely at {self.args}.\\n', from_obj=caller, exclude=caller)\n caller.msg(detail)\n ...
<|body_start_0|> caller = self.caller if hasattr(self.caller.location, 'get_detail'): detail = self.caller.location.get_detail(self.args, looker=self.caller) if detail: caller.location.msg_contents(f'$You() $conj(look) closely at {self.args}.\n', from_obj=caller, ...
look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity.
CmdExtendedRoomLook
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmdExtendedRoomLook: """look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity.""" def look_detail(self): """Look for detail on room.""" <|body_0|> def func(self): """Handle the ...
stack_v2_sparse_classes_36k_train_020849
34,295
permissive
[ { "docstring": "Look for detail on room.", "name": "look_detail", "signature": "def look_detail(self)" }, { "docstring": "Handle the looking.", "name": "func", "signature": "def func(self)" } ]
2
stack_v2_sparse_classes_30k_train_002975
Implement the Python class `CmdExtendedRoomLook` described below. Class description: look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity. Method signatures and docstrings: - def look_detail(self): Look for detail on room. - def fu...
Implement the Python class `CmdExtendedRoomLook` described below. Class description: look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity. Method signatures and docstrings: - def look_detail(self): Look for detail on room. - def fu...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class CmdExtendedRoomLook: """look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity.""" def look_detail(self): """Look for detail on room.""" <|body_0|> def func(self): """Handle the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CmdExtendedRoomLook: """look Usage: look look <obj> look <room detail> look *<account> Observes your location, details at your location or objects in your vicinity.""" def look_detail(self): """Look for detail on room.""" caller = self.caller if hasattr(self.caller.location, 'get_...
the_stack_v2_python_sparse
evennia/contrib/grid/extended_room/extended_room.py
evennia/evennia
train
1,781
126841737e9e2420e363ae8fa32669bbe08c6de6
[ "self.scr = scr\nself.screensize = screensize\nself.hp = 60\nself.lose = final.Lose(self.scr, self.screensize)", "gun_surf = pg.image.load(os.path.join('Images', 'gun.png'))\ngun_rect = gun_surf.get_rect()\npg.mouse.set_cursor(*pg.cursors.diamond)\ngun_surf = pg.transform.scale(gun_surf, (2 * gun_rect[2], 2 * gun...
<|body_start_0|> self.scr = scr self.screensize = screensize self.hp = 60 self.lose = final.Lose(self.scr, self.screensize) <|end_body_0|> <|body_start_1|> gun_surf = pg.image.load(os.path.join('Images', 'gun.png')) gun_rect = gun_surf.get_rect() pg.mouse.set_cur...
Pushkin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Pushkin: def __init__(self, scr, screensize): """Pushkin object class Parametrs: **scr** - game screen **screensize** - game screen""" <|body_0|> def mouse_gun(self): """Function visualizing Pushkin's gun.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_020850
2,771
no_license
[ { "docstring": "Pushkin object class Parametrs: **scr** - game screen **screensize** - game screen", "name": "__init__", "signature": "def __init__(self, scr, screensize)" }, { "docstring": "Function visualizing Pushkin's gun.", "name": "mouse_gun", "signature": "def mouse_gun(self)" }...
2
stack_v2_sparse_classes_30k_train_006892
Implement the Python class `Pushkin` described below. Class description: Implement the Pushkin class. Method signatures and docstrings: - def __init__(self, scr, screensize): Pushkin object class Parametrs: **scr** - game screen **screensize** - game screen - def mouse_gun(self): Function visualizing Pushkin's gun.
Implement the Python class `Pushkin` described below. Class description: Implement the Pushkin class. Method signatures and docstrings: - def __init__(self, scr, screensize): Pushkin object class Parametrs: **scr** - game screen **screensize** - game screen - def mouse_gun(self): Function visualizing Pushkin's gun. ...
9d813cfb7995f47953d653f9c450f7921dc26fe5
<|skeleton|> class Pushkin: def __init__(self, scr, screensize): """Pushkin object class Parametrs: **scr** - game screen **screensize** - game screen""" <|body_0|> def mouse_gun(self): """Function visualizing Pushkin's gun.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Pushkin: def __init__(self, scr, screensize): """Pushkin object class Parametrs: **scr** - game screen **screensize** - game screen""" self.scr = scr self.screensize = screensize self.hp = 60 self.lose = final.Lose(self.scr, self.screensize) def mouse_gun(self): ...
the_stack_v2_python_sparse
duel_ily_zassal/modules/fighters.py
python-practice-b02-006/Power.Rangers
train
0
26569b34fe1422bfdf7c5821268d7d0cf443a57e
[ "Action.__init__(self, p_game_state)\nassert isinstance(p_player_id, int)\nassert PLAYER_PER_TEAM >= p_player_id >= 0\nself.player_id = p_player_id", "move_destination = None\nkick_strength = 0\nreturn AICommand(self.player_id, AICommandType.STOP)" ]
<|body_start_0|> Action.__init__(self, p_game_state) assert isinstance(p_player_id, int) assert PLAYER_PER_TEAM >= p_player_id >= 0 self.player_id = p_player_id <|end_body_0|> <|body_start_1|> move_destination = None kick_strength = 0 return AICommand(self.player...
Action Stop: Arrête le robot Méthodes : exec(self): Retourne la position du joueur qui l'a appelé Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur
Idle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Idle: """Action Stop: Arrête le robot Méthodes : exec(self): Retourne la position du joueur qui l'a appelé Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur""" def __init__(self, p_game_state, p_player_id): """:param p_game_state: L'état courant du jeu. :para...
stack_v2_sparse_classes_36k_train_020851
1,209
permissive
[ { "docstring": ":param p_game_state: L'état courant du jeu. :param p_player_id: Identifiant du joueur qui s'arrête", "name": "__init__", "signature": "def __init__(self, p_game_state, p_player_id)" }, { "docstring": "Exécute l'arrêt :return: Un tuple (None, kick) où None pour activer une command...
2
stack_v2_sparse_classes_30k_val_000396
Implement the Python class `Idle` described below. Class description: Action Stop: Arrête le robot Méthodes : exec(self): Retourne la position du joueur qui l'a appelé Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur Method signatures and docstrings: - def __init__(self, p_game_state, p_play...
Implement the Python class `Idle` described below. Class description: Action Stop: Arrête le robot Méthodes : exec(self): Retourne la position du joueur qui l'a appelé Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur Method signatures and docstrings: - def __init__(self, p_game_state, p_play...
7e20de8b2213d9b9b46be16d6b4800d767da1b00
<|skeleton|> class Idle: """Action Stop: Arrête le robot Méthodes : exec(self): Retourne la position du joueur qui l'a appelé Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur""" def __init__(self, p_game_state, p_player_id): """:param p_game_state: L'état courant du jeu. :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Idle: """Action Stop: Arrête le robot Méthodes : exec(self): Retourne la position du joueur qui l'a appelé Attributs (en plus de ceux de Action): player_id : L'identifiant du joueur""" def __init__(self, p_game_state, p_player_id): """:param p_game_state: L'état courant du jeu. :param p_player_id...
the_stack_v2_python_sparse
ai/STA/Action/Idle.py
etibuteau/StrategyIA
train
0
d857deb39821d9ef9e0c9979dc256fdc30c7988d
[ "super().__init__(group_norm)\nself.output_levels = output_levels\nself.conv1 = nn.ModuleList()\nself.conv2 = nn.ModuleList()\nself.maxpool = nn.MaxPool2d(kernel_size=1, stride=2, padding=0)\nself.scales_in = scales_in\nself.scales_out = scales_in\nself.dims_in = dims_in\nself.dim_out = dim_out\ndims_out = dim_out\...
<|body_start_0|> super().__init__(group_norm) self.output_levels = output_levels self.conv1 = nn.ModuleList() self.conv2 = nn.ModuleList() self.maxpool = nn.MaxPool2d(kernel_size=1, stride=2, padding=0) self.scales_in = scales_in self.scales_out = scales_in ...
Feature bottom-up-path-augmentation with usual 2d convolutions 3x3
BottomUpPathAugmentation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BottomUpPathAugmentation: """Feature bottom-up-path-augmentation with usual 2d convolutions 3x3""" def __init__(self, output_levels, dims_in, scales_in, dim_out, group_norm): """Initialization with the next parameters: :param output_levels: number of levels (feature maps) from FPN :p...
stack_v2_sparse_classes_36k_train_020852
16,312
permissive
[ { "docstring": "Initialization with the next parameters: :param output_levels: number of levels (feature maps) from FPN :param dims_in: number of channels in input feature maps :param scales_in: scale of each input feature map :param dim_out: number of channels in output feature maps :param group_norm: if True,...
2
stack_v2_sparse_classes_30k_train_013602
Implement the Python class `BottomUpPathAugmentation` described below. Class description: Feature bottom-up-path-augmentation with usual 2d convolutions 3x3 Method signatures and docstrings: - def __init__(self, output_levels, dims_in, scales_in, dim_out, group_norm): Initialization with the next parameters: :param o...
Implement the Python class `BottomUpPathAugmentation` described below. Class description: Feature bottom-up-path-augmentation with usual 2d convolutions 3x3 Method signatures and docstrings: - def __init__(self, output_levels, dims_in, scales_in, dim_out, group_norm): Initialization with the next parameters: :param o...
c553a56088f0055baba838b68c9299e19683227e
<|skeleton|> class BottomUpPathAugmentation: """Feature bottom-up-path-augmentation with usual 2d convolutions 3x3""" def __init__(self, output_levels, dims_in, scales_in, dim_out, group_norm): """Initialization with the next parameters: :param output_levels: number of levels (feature maps) from FPN :p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BottomUpPathAugmentation: """Feature bottom-up-path-augmentation with usual 2d convolutions 3x3""" def __init__(self, output_levels, dims_in, scales_in, dim_out, group_norm): """Initialization with the next parameters: :param output_levels: number of levels (feature maps) from FPN :param dims_in:...
the_stack_v2_python_sparse
pytorch_toolkit/instance_segmentation/segmentoly/rcnn/panet.py
DmitriySidnev/openvino_training_extensions
train
0
205748b941dfe8bdaa322345a11ceb5aa0b242b0
[ "super().__init__(parent=parent)\nself.setTitle('Digitizer pulse integrals')\nself.setLabel('left', 'Pulse integral (arb.)')\nself.setLabel('bottom', 'Pulse index')\nself.addLegend(offset=(-40, 60))\nself._plots = []\nfor ch, c in zip(_DIGITIZER_CHANNEL_NAMES, _DIGITIZER_CHANNEL_COLORS):\n self._plots.append(sel...
<|body_start_0|> super().__init__(parent=parent) self.setTitle('Digitizer pulse integrals') self.setLabel('left', 'Pulse integral (arb.)') self.setLabel('bottom', 'Pulse index') self.addLegend(offset=(-40, 60)) self._plots = [] for ch, c in zip(_DIGITIZER_CHANNEL_...
XasTimDigitizerPulsePlot class. Visualize pulse integral of each channel of the digitizer in the current train.
XasTimDigitizerPulsePlot
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XasTimDigitizerPulsePlot: """XasTimDigitizerPulsePlot class. Visualize pulse integral of each channel of the digitizer in the current train.""" def __init__(self, *, parent=None): """Initialization.""" <|body_0|> def updateF(self, data): """Override.""" <...
stack_v2_sparse_classes_36k_train_020853
13,999
permissive
[ { "docstring": "Initialization.", "name": "__init__", "signature": "def __init__(self, *, parent=None)" }, { "docstring": "Override.", "name": "updateF", "signature": "def updateF(self, data)" } ]
2
null
Implement the Python class `XasTimDigitizerPulsePlot` described below. Class description: XasTimDigitizerPulsePlot class. Visualize pulse integral of each channel of the digitizer in the current train. Method signatures and docstrings: - def __init__(self, *, parent=None): Initialization. - def updateF(self, data): O...
Implement the Python class `XasTimDigitizerPulsePlot` described below. Class description: XasTimDigitizerPulsePlot class. Visualize pulse integral of each channel of the digitizer in the current train. Method signatures and docstrings: - def __init__(self, *, parent=None): Initialization. - def updateF(self, data): O...
a6ee28040b15ae8d110570bd9f3c37e5a3e70fc0
<|skeleton|> class XasTimDigitizerPulsePlot: """XasTimDigitizerPulsePlot class. Visualize pulse integral of each channel of the digitizer in the current train.""" def __init__(self, *, parent=None): """Initialization.""" <|body_0|> def updateF(self, data): """Override.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XasTimDigitizerPulsePlot: """XasTimDigitizerPulsePlot class. Visualize pulse integral of each channel of the digitizer in the current train.""" def __init__(self, *, parent=None): """Initialization.""" super().__init__(parent=parent) self.setTitle('Digitizer pulse integrals') ...
the_stack_v2_python_sparse
extra_foam/special_suite/xas_tim_w.py
European-XFEL/EXtra-foam
train
8
e3cb5d49288c0335426c48c218cd742c6a3ca0be
[ "super(TokenMember, self).init()\nallowed = self.param.get('allowed')\nif allowed:\n self._allowed = dict.fromkeys([token.lower() for token in allowed])\nelse:\n self._allowed = None", "if isinstance(value, str):\n value = unicode(value, self.CHARSET)\nelif not isinstance(value, unicode):\n raise Type...
<|body_start_0|> super(TokenMember, self).init() allowed = self.param.get('allowed') if allowed: self._allowed = dict.fromkeys([token.lower() for token in allowed]) else: self._allowed = None <|end_body_0|> <|body_start_1|> if isinstance(value, str): ...
Unicode token storage :ivar `_allowed`: List of allowed tokens (or ``None``) - saved in a dict for faster lookup :type `_allowed`: ``dict``
TokenMember
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenMember: """Unicode token storage :ivar `_allowed`: List of allowed tokens (or ``None``) - saved in a dict for faster lookup :type `_allowed`: ``dict``""" def init(self): """Custom initialization""" <|body_0|> def doTransform(self, value): """Transforms the v...
stack_v2_sparse_classes_36k_train_020854
18,259
permissive
[ { "docstring": "Custom initialization", "name": "init", "signature": "def init(self)" }, { "docstring": "Transforms the value to unicode if it wasn't already :Exceptions: - `TypeError`: The supplied value is neither ``str`` nor ``unicode`` - `UnicodeError`: The supplied value is a string and can...
2
stack_v2_sparse_classes_30k_train_011743
Implement the Python class `TokenMember` described below. Class description: Unicode token storage :ivar `_allowed`: List of allowed tokens (or ``None``) - saved in a dict for faster lookup :type `_allowed`: ``dict`` Method signatures and docstrings: - def init(self): Custom initialization - def doTransform(self, val...
Implement the Python class `TokenMember` described below. Class description: Unicode token storage :ivar `_allowed`: List of allowed tokens (or ``None``) - saved in a dict for faster lookup :type `_allowed`: ``dict`` Method signatures and docstrings: - def init(self): Custom initialization - def doTransform(self, val...
faecefdabd8fbf6d40738a24004772020c244f64
<|skeleton|> class TokenMember: """Unicode token storage :ivar `_allowed`: List of allowed tokens (or ``None``) - saved in a dict for faster lookup :type `_allowed`: ``dict``""" def init(self): """Custom initialization""" <|body_0|> def doTransform(self, value): """Transforms the v...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TokenMember: """Unicode token storage :ivar `_allowed`: List of allowed tokens (or ``None``) - saved in a dict for faster lookup :type `_allowed`: ``dict``""" def init(self): """Custom initialization""" super(TokenMember, self).init() allowed = self.param.get('allowed') if...
the_stack_v2_python_sparse
src/lib/svnmailer/settings/_accessors.py
m-tmatma/svnmailer
train
1
f952ed54cf19d626af7cf03c698f095065886c6d
[ "meeting_user = dict()\nmeeting_user['is_accepted'] = is_accepted\nmeeting_user['may_join'] = may_join\nmeeting_user['is_coordinator'] = is_coordinator\nmeeting_user['user_id'] = user_id\nreturn meeting_user", "meeting_user = dict()\nmeeting_user['is_coordinator'] = True\nmeeting_user['is_accepted'] = 1\nmeeting_...
<|body_start_0|> meeting_user = dict() meeting_user['is_accepted'] = is_accepted meeting_user['may_join'] = may_join meeting_user['is_coordinator'] = is_coordinator meeting_user['user_id'] = user_id return meeting_user <|end_body_0|> <|body_start_1|> meeting_user...
UpdateMeetingAttendees
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateMeetingAttendees: def _form_attendee(self, user_id: int, is_accepted=False, may_join=False, is_coordinator=False): """Create MeetingUser dictionaries for update MeetingModel :param user_id: :param is_accepted: :param may_join: :param is_coordinator: :return:""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_020855
1,024
no_license
[ { "docstring": "Create MeetingUser dictionaries for update MeetingModel :param user_id: :param is_accepted: :param may_join: :param is_coordinator: :return:", "name": "_form_attendee", "signature": "def _form_attendee(self, user_id: int, is_accepted=False, may_join=False, is_coordinator=False)" }, {...
2
null
Implement the Python class `UpdateMeetingAttendees` described below. Class description: Implement the UpdateMeetingAttendees class. Method signatures and docstrings: - def _form_attendee(self, user_id: int, is_accepted=False, may_join=False, is_coordinator=False): Create MeetingUser dictionaries for update MeetingMod...
Implement the Python class `UpdateMeetingAttendees` described below. Class description: Implement the UpdateMeetingAttendees class. Method signatures and docstrings: - def _form_attendee(self, user_id: int, is_accepted=False, may_join=False, is_coordinator=False): Create MeetingUser dictionaries for update MeetingMod...
214cb14eb23f3aa1e32616d666c14d041a2c7dc7
<|skeleton|> class UpdateMeetingAttendees: def _form_attendee(self, user_id: int, is_accepted=False, may_join=False, is_coordinator=False): """Create MeetingUser dictionaries for update MeetingModel :param user_id: :param is_accepted: :param may_join: :param is_coordinator: :return:""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateMeetingAttendees: def _form_attendee(self, user_id: int, is_accepted=False, may_join=False, is_coordinator=False): """Create MeetingUser dictionaries for update MeetingModel :param user_id: :param is_accepted: :param may_join: :param is_coordinator: :return:""" meeting_user = dict() ...
the_stack_v2_python_sparse
backend/src/api/pool/decorators/meeting_decorators/libs_meeting_decorator/meeting_attendee_libs/attendee_update.py
enixdark/meeting-training-app
train
0
e2f491c1a6cb5886bffe28e86cd5c690fe201599
[ "if not matrix or not matrix[0]:\n self.sum = None\n return\nh, w = (len(matrix), len(matrix[0]))\nself.sum = [[0] * w for i in range(h)]\nfor i in range(h):\n tmp = 0\n for j in range(w):\n tmp2 = 0 if i == 0 else self.sum[i - 1][j]\n self.sum[i][j] = tmp + matrix[i][j] + tmp2\n tm...
<|body_start_0|> if not matrix or not matrix[0]: self.sum = None return h, w = (len(matrix), len(matrix[0])) self.sum = [[0] * w for i in range(h)] for i in range(h): tmp = 0 for j in range(w): tmp2 = 0 if i == 0 else self.s...
NumMatrix3
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix3: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_020856
37,656
no_license
[ { "docstring": ":type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": ":type row1: int :type col1: int :type row2: int :type col2: int :rtype: int", "name": "sumRegion", "signature": "def sumRegion(self, row1, col1, row2, col2)" ...
2
stack_v2_sparse_classes_30k_train_016027
Implement the Python class `NumMatrix3` described below. Class description: Implement the NumMatrix3 class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtyp...
Implement the Python class `NumMatrix3` described below. Class description: Implement the NumMatrix3 class. Method signatures and docstrings: - def __init__(self, matrix): :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): :type row1: int :type col1: int :type row2: int :type col2: int :rtyp...
2711bc08f15266bec4ca135e8e3e629df46713eb
<|skeleton|> class NumMatrix3: def __init__(self, matrix): """:type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """:type row1: int :type col1: int :type row2: int :type col2: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix3: def __init__(self, matrix): """:type matrix: List[List[int]]""" if not matrix or not matrix[0]: self.sum = None return h, w = (len(matrix), len(matrix[0])) self.sum = [[0] * w for i in range(h)] for i in range(h): tmp = 0 ...
the_stack_v2_python_sparse
0.算法/20180804.py
unlimitediw/CheckCode
train
0
6d630a1d642c165be92d9a1b29c563976f692ff1
[ "if name in ['E', 'X', 'Z']:\n raise ValueError('you are attempting to redefine %s; but you should never redefine E, X or Z in gap3 (because things will break!)' % name)\nsuper(GAP3Element, self).__init__(parent, value, is_name, name)\nparent._synchronize()\nif parent.eval('IsRec(%s)' % self._name) == 'true':\n ...
<|body_start_0|> if name in ['E', 'X', 'Z']: raise ValueError('you are attempting to redefine %s; but you should never redefine E, X or Z in gap3 (because things will break!)' % name) super(GAP3Element, self).__init__(parent, value, is_name, name) parent._synchronize() if par...
A GAP3 element .. NOTE:: If the corresponding GAP3 element is a GAP3 record, then the class is changed to a ``GAP3Record``. INPUT: - ``parent`` -- the GAP3 session - ``value`` -- the GAP3 command as a string - ``is_name`` -- bool (default: False); if True, then ``value`` is the variable name for the object - ``name`` -...
GAP3Element
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GAP3Element: """A GAP3 element .. NOTE:: If the corresponding GAP3 element is a GAP3 record, then the class is changed to a ``GAP3Record``. INPUT: - ``parent`` -- the GAP3 session - ``value`` -- the GAP3 command as a string - ``is_name`` -- bool (default: False); if True, then ``value`` is the va...
stack_v2_sparse_classes_36k_train_020857
34,820
no_license
[ { "docstring": "See ``GAP3Element`` for full documentation. EXAMPLES:: sage: from sage.interfaces.gap3 import GAP3Element #optional - gap3 sage: gap3 = Gap3() #optional - gap3 sage: GAP3Element(gap3, value='3+2') #optional - gap3 5 sage: GAP3Element(gap3, value='sage0', is_name=True) #optional - gap3 5 TESTS:: ...
3
null
Implement the Python class `GAP3Element` described below. Class description: A GAP3 element .. NOTE:: If the corresponding GAP3 element is a GAP3 record, then the class is changed to a ``GAP3Record``. INPUT: - ``parent`` -- the GAP3 session - ``value`` -- the GAP3 command as a string - ``is_name`` -- bool (default: Fa...
Implement the Python class `GAP3Element` described below. Class description: A GAP3 element .. NOTE:: If the corresponding GAP3 element is a GAP3 record, then the class is changed to a ``GAP3Record``. INPUT: - ``parent`` -- the GAP3 session - ``value`` -- the GAP3 command as a string - ``is_name`` -- bool (default: Fa...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class GAP3Element: """A GAP3 element .. NOTE:: If the corresponding GAP3 element is a GAP3 record, then the class is changed to a ``GAP3Record``. INPUT: - ``parent`` -- the GAP3 session - ``value`` -- the GAP3 command as a string - ``is_name`` -- bool (default: False); if True, then ``value`` is the va...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GAP3Element: """A GAP3 element .. NOTE:: If the corresponding GAP3 element is a GAP3 record, then the class is changed to a ``GAP3Record``. INPUT: - ``parent`` -- the GAP3 session - ``value`` -- the GAP3 command as a string - ``is_name`` -- bool (default: False); if True, then ``value`` is the variable name f...
the_stack_v2_python_sparse
sage/src/sage/interfaces/gap3.py
bopopescu/geosci
train
0
82ae17cdc5863bf5bf0f52f8fd4bc6763614ff28
[ "self.parent = parent\nself.press = None\nself.background = None\nself.y = y\nself.line = Axis.axhline(y)\nself.line.set_linewidth(0.2)\nself.connect()", "self.cidpress1 = self.line.figure.canvas.mpl_connect('button_press_event', self.on_press)\nself.cidrelease1 = self.line.figure.canvas.mpl_connect('button_relea...
<|body_start_0|> self.parent = parent self.press = None self.background = None self.y = y self.line = Axis.axhline(y) self.line.set_linewidth(0.2) self.connect() <|end_body_0|> <|body_start_1|> self.cidpress1 = self.line.figure.canvas.mpl_connect('button_...
This is a class to create an horizontal line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matplotlib pyplot is gridded into. press : This attribu...
HorizontalDraggableLine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HorizontalDraggableLine: """This is a class to create an horizontal line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matp...
stack_v2_sparse_classes_36k_train_020858
32,818
no_license
[ { "docstring": "The constructor for the HorizontalDraggableLine Class. Parameters: parent : tkinter Frame object where the object is placed in. y : Initial position of your horizontal line on the y axis Axis : axis of your pyplot graphic that will contain this line.", "name": "__init__", "signature": "d...
6
stack_v2_sparse_classes_30k_train_006869
Implement the Python class `HorizontalDraggableLine` described below. Class description: This is a class to create an horizontal line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: p...
Implement the Python class `HorizontalDraggableLine` described below. Class description: This is a class to create an horizontal line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: p...
6e479850a21c337c0c47379538f002bca97e03f1
<|skeleton|> class HorizontalDraggableLine: """This is a class to create an horizontal line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HorizontalDraggableLine: """This is a class to create an horizontal line that can be drag in a vertical fashion. Documentation of this part is not torough as it does not come from me. I took some part of another code and adapted it to this one. Attributes: parent : tkinter frame in which the matplotlib pyplot...
the_stack_v2_python_sparse
Labo_Env/ultrafastGUI/Graphic.py
UltraFastQ/femtoQ-Intruments
train
2
d1bd666538526a5164051b8e37846b8b62aadc79
[ "if 'modifier' in kwargs:\n self.modifier = kwargs['modifier']\nelif len(args) > 2:\n self.modifier = args[2]\n args = args[:2]\nelse:\n self.modifier = lambda x: x\nif not callable(self.modifier):\n raise TypeError('modify_iter(o, modifier): modifier must be callable')\nsuper().__init__(*args)", "...
<|body_start_0|> if 'modifier' in kwargs: self.modifier = kwargs['modifier'] elif len(args) > 2: self.modifier = args[2] args = args[:2] else: self.modifier = lambda x: x if not callable(self.modifier): raise TypeError('modify_i...
An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a collection object which supports either the iteration protocol or the sequence...
modify_iter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class modify_iter: """An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a collection object which supports either...
stack_v2_sparse_classes_36k_train_020859
22,562
permissive
[ { "docstring": "__init__(o, sentinel=None, modifier=lambda x: x)", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Cache `n` modified items. If `n` is 0 or None, 1 item is cached. Each item returned by the iterator is passed through the `modify_iter.modi...
2
stack_v2_sparse_classes_30k_train_005337
Implement the Python class `modify_iter` described below. Class description: An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a ...
Implement the Python class `modify_iter` described below. Class description: An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a ...
59e1ca2f4b15ca3d1bc814330ab8ef0beb8d9af0
<|skeleton|> class modify_iter: """An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a collection object which supports either...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class modify_iter: """An iterator object that supports modifying items as they are returned. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a collection object which supports either the iteratio...
the_stack_v2_python_sparse
moldesign/utils/docparsers/google.py
maxbates/molecular-design-toolkit
train
1
4060f62f62d6c2be35572e1196817f3ada349a98
[ "super(TurntableCrawler, self).__init__(*args, **kwargs)\nparts = self.var('name').split('_')\nself.setVar('assetName', parts[1], True)\nself.setVar('step', parts[2], True)\nself.setVar('variant', parts[3], True)\nself.setVar('pass', parts[4], True)\nself.setVar('renderName', '{}-{}-{}'.format(self.var('assetName')...
<|body_start_0|> super(TurntableCrawler, self).__init__(*args, **kwargs) parts = self.var('name').split('_') self.setVar('assetName', parts[1], True) self.setVar('step', parts[2], True) self.setVar('variant', parts[3], True) self.setVar('pass', parts[4], True) sel...
Custom crawler used to detect turntable renders.
TurntableCrawler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TurntableCrawler: """Custom crawler used to detect turntable renders.""" def __init__(self, *args, **kwargs): """Create a TurntableCrawler object.""" <|body_0|> def test(cls, pathHolder, parentCrawler): """Test if the path holder contains a turntable.""" ...
stack_v2_sparse_classes_36k_train_020860
1,277
permissive
[ { "docstring": "Create a TurntableCrawler object.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Test if the path holder contains a turntable.", "name": "test", "signature": "def test(cls, pathHolder, parentCrawler)" } ]
2
stack_v2_sparse_classes_30k_train_003987
Implement the Python class `TurntableCrawler` described below. Class description: Custom crawler used to detect turntable renders. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Create a TurntableCrawler object. - def test(cls, pathHolder, parentCrawler): Test if the path holder contains a t...
Implement the Python class `TurntableCrawler` described below. Class description: Custom crawler used to detect turntable renders. Method signatures and docstrings: - def __init__(self, *args, **kwargs): Create a TurntableCrawler object. - def test(cls, pathHolder, parentCrawler): Test if the path holder contains a t...
046dbb0c1b4ff20ea5f2e1679f8d89f3089b6aa4
<|skeleton|> class TurntableCrawler: """Custom crawler used to detect turntable renders.""" def __init__(self, *args, **kwargs): """Create a TurntableCrawler object.""" <|body_0|> def test(cls, pathHolder, parentCrawler): """Test if the path holder contains a turntable.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TurntableCrawler: """Custom crawler used to detect turntable renders.""" def __init__(self, *args, **kwargs): """Create a TurntableCrawler object.""" super(TurntableCrawler, self).__init__(*args, **kwargs) parts = self.var('name').split('_') self.setVar('assetName', parts[...
the_stack_v2_python_sparse
src/lib/kombi/Crawler/Fs/Render/TurntableCrawler.py
kombiHQ/kombi
train
2
e79ea0ba090ace826ae05528a567088197f7861a
[ "if path.endswith('/'):\n path = path[:-1]\nreturn Bip32PathParser.__ParseElements(list(filter(None, path.split('/'))))", "if len(path_elems) > 0 and path_elems[0] == Bip32PathConst.MASTER_CHAR:\n path_elems = path_elems[1:]\n is_absolute = True\nelse:\n is_absolute = False\nparsed_elems = list(map(Bi...
<|body_start_0|> if path.endswith('/'): path = path[:-1] return Bip32PathParser.__ParseElements(list(filter(None, path.split('/')))) <|end_body_0|> <|body_start_1|> if len(path_elems) > 0 and path_elems[0] == Bip32PathConst.MASTER_CHAR: path_elems = path_elems[1:] ...
BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object.
Bip32PathParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bip32PathParser: """BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object.""" def Parse(path: str) -> Bip32Path: """Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Path object: Bip32Path object Raises: Bip32PathError: If th...
stack_v2_sparse_classes_36k_train_020861
7,181
permissive
[ { "docstring": "Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Path object: Bip32Path object Raises: Bip32PathError: If the path is not valid", "name": "Parse", "signature": "def Parse(path: str) -> Bip32Path" }, { "docstring": "Parse path elements and return a ...
3
stack_v2_sparse_classes_30k_train_016924
Implement the Python class `Bip32PathParser` described below. Class description: BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object. Method signatures and docstrings: - def Parse(path: str) -> Bip32Path: Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Pa...
Implement the Python class `Bip32PathParser` described below. Class description: BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object. Method signatures and docstrings: - def Parse(path: str) -> Bip32Path: Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Pa...
d15c75ddd74e4838c396a0d036ef6faf11b06a4b
<|skeleton|> class Bip32PathParser: """BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object.""" def Parse(path: str) -> Bip32Path: """Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Path object: Bip32Path object Raises: Bip32PathError: If th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bip32PathParser: """BIP32 path parser class. It parses a BIP-0032 path and returns a Bip32Path object.""" def Parse(path: str) -> Bip32Path: """Parse a path and return a Bip32Path object. Args: path (str): Path Returns: Bip32Path object: Bip32Path object Raises: Bip32PathError: If the path is not...
the_stack_v2_python_sparse
bip_utils/bip/bip32/bip32_path.py
ebellocchia/bip_utils
train
244
0451006a1922b3474ce88b0dcd67c401f0be408d
[ "if not strs:\n return 0\nsize = len(strs)\ndp = [[[0 for _ in range(n + 1)] for _ in range(m + 1)] for _ in range(size + 1)]\nfor i in range(1, size + 1):\n count_0, count_1 = (strs[i - 1].count('0'), strs[i - 1].count('1'))\n for M in range(m + 1):\n for N in range(n + 1):\n dp[i][M][N]...
<|body_start_0|> if not strs: return 0 size = len(strs) dp = [[[0 for _ in range(n + 1)] for _ in range(m + 1)] for _ in range(size + 1)] for i in range(1, size + 1): count_0, count_1 = (strs[i - 1].count('0'), strs[i - 1].count('1')) for M in range(m ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """三维动态规划 没有进行状态压缩时,会超时""" <|body_0|> def findMaxForm_1(self, strs: List[str], m: int, n: int) -> int: """进行状态压缩""" <|body_1|> def findMaxForm_2(self, strs: List[str], m: int, n: in...
stack_v2_sparse_classes_36k_train_020862
3,121
no_license
[ { "docstring": "三维动态规划 没有进行状态压缩时,会超时", "name": "findMaxForm", "signature": "def findMaxForm(self, strs: List[str], m: int, n: int) -> int" }, { "docstring": "进行状态压缩", "name": "findMaxForm_1", "signature": "def findMaxForm_1(self, strs: List[str], m: int, n: int) -> int" }, { "doc...
3
stack_v2_sparse_classes_30k_train_018949
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm(self, strs: List[str], m: int, n: int) -> int: 三维动态规划 没有进行状态压缩时,会超时 - def findMaxForm_1(self, strs: List[str], m: int, n: int) -> int: 进行状态压缩 - def findMaxForm_2(...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMaxForm(self, strs: List[str], m: int, n: int) -> int: 三维动态规划 没有进行状态压缩时,会超时 - def findMaxForm_1(self, strs: List[str], m: int, n: int) -> int: 进行状态压缩 - def findMaxForm_2(...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """三维动态规划 没有进行状态压缩时,会超时""" <|body_0|> def findMaxForm_1(self, strs: List[str], m: int, n: int) -> int: """进行状态压缩""" <|body_1|> def findMaxForm_2(self, strs: List[str], m: int, n: in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMaxForm(self, strs: List[str], m: int, n: int) -> int: """三维动态规划 没有进行状态压缩时,会超时""" if not strs: return 0 size = len(strs) dp = [[[0 for _ in range(n + 1)] for _ in range(m + 1)] for _ in range(size + 1)] for i in range(1, size + 1): ...
the_stack_v2_python_sparse
algorithm/leetcode/dp/29-零和一.py
lxconfig/UbuntuCode_bak
train
0
457e5735eebf7917dada1e28f6dbe8ded0d354c6
[ "if nums1 == [] or nums2 == []:\n return []\nlist1 = sorted(nums1)\nlist2 = sorted(nums2)\nintersection = []\ni = 0\nj = 0\nwhile 1:\n while list1[i] < list2[j]:\n i += 1\n if i >= len(list1):\n return intersection\n while list1[i] > list2[j]:\n j += 1\n if j >= len(l...
<|body_start_0|> if nums1 == [] or nums2 == []: return [] list1 = sorted(nums1) list2 = sorted(nums2) intersection = [] i = 0 j = 0 while 1: while list1[i] < list2[j]: i += 1 if i >= len(list1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int] 先排序,然后遍历两个列表找并集""" <|body_0|> def intersect2(self, nums1, nums2): """先用字典储存nums1中的值以及它出现的次数 再遍历nums2,若其中的值存在于字典的键,则把该键加入结果列表,该键对应的值-1""" <|body_1|>...
stack_v2_sparse_classes_36k_train_020863
1,677
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :rtype: List[int] 先排序,然后遍历两个列表找并集", "name": "intersect", "signature": "def intersect(self, nums1, nums2)" }, { "docstring": "先用字典储存nums1中的值以及它出现的次数 再遍历nums2,若其中的值存在于字典的键,则把该键加入结果列表,该键对应的值-1", "name": "intersect2", "signature":...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] 先排序,然后遍历两个列表找并集 - def intersect2(self, nums1, nums2): 先用字典储存nums1中的值以及它出现的次数 再遍...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def intersect(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] :rtype: List[int] 先排序,然后遍历两个列表找并集 - def intersect2(self, nums1, nums2): 先用字典储存nums1中的值以及它出现的次数 再遍...
95dddb78bccd169d9d219a473627361fe739ab5e
<|skeleton|> class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int] 先排序,然后遍历两个列表找并集""" <|body_0|> def intersect2(self, nums1, nums2): """先用字典储存nums1中的值以及它出现的次数 再遍历nums2,若其中的值存在于字典的键,则把该键加入结果列表,该键对应的值-1""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def intersect(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int] :rtype: List[int] 先排序,然后遍历两个列表找并集""" if nums1 == [] or nums2 == []: return [] list1 = sorted(nums1) list2 = sorted(nums2) intersection = [] i = 0 j ...
the_stack_v2_python_sparse
ArrayOperation/Intersection.py
Philex5/codingPractice
train
0
e3dc829c466922d1f15e0a197797c8dde2d4500f
[ "self.key2valfreq = {}\nself.count2node = defaultdict(OrderedDict)\nself.capacity = capacity\nself.min_freq = 1", "if key not in self.key2valfreq:\n return -1\nval, freq = self.key2valfreq.pop(key)\nself.count2node[freq].pop(key)\nif len(self.count2node[freq]) == 0 and freq == self.min_freq:\n self.min_freq...
<|body_start_0|> self.key2valfreq = {} self.count2node = defaultdict(OrderedDict) self.capacity = capacity self.min_freq = 1 <|end_body_0|> <|body_start_1|> if key not in self.key2valfreq: return -1 val, freq = self.key2valfreq.pop(key) self.count2nod...
LFUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_020864
1,656
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_005737
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
2dde64842ecd73a581d7605d05a07fda4e3774bf
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.key2valfreq = {} self.count2node = defaultdict(OrderedDict) self.capacity = capacity self.min_freq = 1 def get(self, key): """:type key: int :rtype: int""" if key not in self.key...
the_stack_v2_python_sparse
Design/460.LFU_Cache/LFU_Cache.py
zach96guan/Stupid_LeetCoder
train
8
21c703ebdc5d1bfac40c91a1982bcf23150bb7fb
[ "assert isinstance(code, str), 'Invalid code %s' % code\nassert isinstance(isSuccess, bool), 'Invalid success flag %s' % isSuccess\nself.code = code\nself.isSuccess = isSuccess", "assert isinstance(context, Coded), 'Invalid context %s' % context\ncontext.code = self.code\ncontext.isSuccess = self.isSuccess" ]
<|body_start_0|> assert isinstance(code, str), 'Invalid code %s' % code assert isinstance(isSuccess, bool), 'Invalid success flag %s' % isSuccess self.code = code self.isSuccess = isSuccess <|end_body_0|> <|body_start_1|> assert isinstance(context, Coded), 'Invalid context %s' %...
Contains the response code.
Code
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Code: """Contains the response code.""" def __init__(self, code, isSuccess): """Constructs the code. @param code: string The code text corresponding to this code. @param isSuccess: boolean Flag indicating if the code is a fail or success code.""" <|body_0|> def set(self,...
stack_v2_sparse_classes_36k_train_020865
2,468
no_license
[ { "docstring": "Constructs the code. @param code: string The code text corresponding to this code. @param isSuccess: boolean Flag indicating if the code is a fail or success code.", "name": "__init__", "signature": "def __init__(self, code, isSuccess)" }, { "docstring": "Set the code on the prov...
2
null
Implement the Python class `Code` described below. Class description: Contains the response code. Method signatures and docstrings: - def __init__(self, code, isSuccess): Constructs the code. @param code: string The code text corresponding to this code. @param isSuccess: boolean Flag indicating if the code is a fail ...
Implement the Python class `Code` described below. Class description: Contains the response code. Method signatures and docstrings: - def __init__(self, code, isSuccess): Constructs the code. @param code: string The code text corresponding to this code. @param isSuccess: boolean Flag indicating if the code is a fail ...
e0b3466b34d31548996d57be4a9dac134d904380
<|skeleton|> class Code: """Contains the response code.""" def __init__(self, code, isSuccess): """Constructs the code. @param code: string The code text corresponding to this code. @param isSuccess: boolean Flag indicating if the code is a fail or success code.""" <|body_0|> def set(self,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Code: """Contains the response code.""" def __init__(self, code, isSuccess): """Constructs the code. @param code: string The code text corresponding to this code. @param isSuccess: boolean Flag indicating if the code is a fail or success code.""" assert isinstance(code, str), 'Invalid cod...
the_stack_v2_python_sparse
components/ally-core/ally/core/spec/codes.py
cristidomsa/Ally-Py
train
0
ba1595173b666a2e8df43e7d98f8f1992e633586
[ "self.big_queue = []\nself.small_queue = []\nheapq.heapify(self.big_queue)\nheapq.heapify(self.small_queue)", "if not self.big_queue:\n heapq.heappush(self.big_queue, -num)\n return\nif len(self.big_queue) == len(self.small_queue):\n if num < -self.big_queue[0]:\n heapq.heappush(self.big_queue, -n...
<|body_start_0|> self.big_queue = [] self.small_queue = [] heapq.heapify(self.big_queue) heapq.heapify(self.small_queue) <|end_body_0|> <|body_start_1|> if not self.big_queue: heapq.heappush(self.big_queue, -num) return if len(self.big_queue) == l...
MedianFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_020866
1,582
no_license
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: void", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
stack_v2_sparse_classes_30k_train_004084
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float <|skeleton|> class Me...
f87b018f7abcdc6e7ae7532810688f9a9d8cbb41
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MedianFinder: def __init__(self): """initialize your data structure here.""" self.big_queue = [] self.small_queue = [] heapq.heapify(self.big_queue) heapq.heapify(self.small_queue) def addNum(self, num): """:type num: int :rtype: void""" if not self...
the_stack_v2_python_sparse
solution/295/solution.py
youjiajia/learn-leetcode
train
0
dbbfea490feb1d073b3e1613ed993d8c5b3ed5a5
[ "if self.obtain_marks > self.maximum_marks:\n raise ValidationError(_('The obtained marks\\n\\t\\t\\tshould not extend maximum marks!.'))\nif self.minimum_marks > self.maximum_marks:\n raise ValidationError(_('The minimum marks\\n\\t\\t\\tshould not extend maximum marks!.'))\nif self.marks_reeval > self.maxim...
<|body_start_0|> if self.obtain_marks > self.maximum_marks: raise ValidationError(_('The obtained marks\n\t\t\tshould not extend maximum marks!.')) if self.minimum_marks > self.maximum_marks: raise ValidationError(_('The minimum marks\n\t\t\tshould not extend maximum marks!.')) ...
ExamSubject
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExamSubject: def _validate_marks(self): """Method to validate marks""" <|body_0|> def _compute_percen(self): """Method to compute percentage""" <|body_1|> def _compute_grade(self): """Method to compute grade after re-evaluation""" <|body_...
stack_v2_sparse_classes_36k_train_020867
32,055
no_license
[ { "docstring": "Method to validate marks", "name": "_validate_marks", "signature": "def _validate_marks(self)" }, { "docstring": "Method to compute percentage", "name": "_compute_percen", "signature": "def _compute_percen(self)" }, { "docstring": "Method to compute grade after re...
4
null
Implement the Python class `ExamSubject` described below. Class description: Implement the ExamSubject class. Method signatures and docstrings: - def _validate_marks(self): Method to validate marks - def _compute_percen(self): Method to compute percentage - def _compute_grade(self): Method to compute grade after re-e...
Implement the Python class `ExamSubject` described below. Class description: Implement the ExamSubject class. Method signatures and docstrings: - def _validate_marks(self): Method to validate marks - def _compute_percen(self): Method to compute percentage - def _compute_grade(self): Method to compute grade after re-e...
043857268cccf78e96bcd236245f24c172d0dde8
<|skeleton|> class ExamSubject: def _validate_marks(self): """Method to validate marks""" <|body_0|> def _compute_percen(self): """Method to compute percentage""" <|body_1|> def _compute_grade(self): """Method to compute grade after re-evaluation""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ExamSubject: def _validate_marks(self): """Method to validate marks""" if self.obtain_marks > self.maximum_marks: raise ValidationError(_('The obtained marks\n\t\t\tshould not extend maximum marks!.')) if self.minimum_marks > self.maximum_marks: raise Validation...
the_stack_v2_python_sparse
meli_mis/addons/exam/models/exam.py
ponnamsandy/karimi
train
0
55d66298ccb3ecfa1070287fe780bf3563017231
[ "self.head = ListNode(-1, -1)\nself.tail = self.head\nself.key2node = {}\nself.capacity = capacity\nself.length = 0", "if key not in self.key2node:\n return -1\nnode = self.key2node[key]\nval = node.val\nif node.next:\n node.prev.next = node.next\n node.next.prev = node.prev\n self.tail.next = node\n ...
<|body_start_0|> self.head = ListNode(-1, -1) self.tail = self.head self.key2node = {} self.capacity = capacity self.length = 0 <|end_body_0|> <|body_start_1|> if key not in self.key2node: return -1 node = self.key2node[key] val = node.val ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_020868
2,775
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_012468
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
5f71ba34f7198841fefaa68eee5b95f2f989296b
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.head = ListNode(-1, -1) self.tail = self.head self.key2node = {} self.capacity = capacity self.length = 0 def get(self, key): """:type key: int :rtype: int""" if key not ...
the_stack_v2_python_sparse
LeetCode/medium/17_LRUcache.py
Kohdz/Algorithms
train
5
3e3aca015824756569f67e0ed4b9c5f2751f600d
[ "dp = [[0 for _ in range(n)] for _ in range(m)]\nfor j in range(n):\n for i in range(m):\n if j == 0:\n dp[i][j] = 1\n else:\n temp = 0\n for cursor in range(m):\n temp += dp[cursor][j - 1]\n dp[i][j] = temp\nprint(dp)\nreturn dp[-1][-1]", ...
<|body_start_0|> dp = [[0 for _ in range(n)] for _ in range(m)] for j in range(n): for i in range(m): if j == 0: dp[i][j] = 1 else: temp = 0 for cursor in range(m): temp += dp[...
PossiblePath
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PossiblePath: def left_up_right_up(self, m, n): """move to right, up, down""" <|body_0|> def count_path(self, m, n): """move to right, right up, right down""" <|body_1|> def count_path_followup(self, m, n, points): """Credit: Yuan Copyright: Yuan...
stack_v2_sparse_classes_36k_train_020869
1,994
no_license
[ { "docstring": "move to right, up, down", "name": "left_up_right_up", "signature": "def left_up_right_up(self, m, n)" }, { "docstring": "move to right, right up, right down", "name": "count_path", "signature": "def count_path(self, m, n)" }, { "docstring": "Credit: Yuan Copyright...
3
stack_v2_sparse_classes_30k_train_006738
Implement the Python class `PossiblePath` described below. Class description: Implement the PossiblePath class. Method signatures and docstrings: - def left_up_right_up(self, m, n): move to right, up, down - def count_path(self, m, n): move to right, right up, right down - def count_path_followup(self, m, n, points):...
Implement the Python class `PossiblePath` described below. Class description: Implement the PossiblePath class. Method signatures and docstrings: - def left_up_right_up(self, m, n): move to right, up, down - def count_path(self, m, n): move to right, right up, right down - def count_path_followup(self, m, n, points):...
1a3c1f4d6e9d3444039f087763b93241f4ba7892
<|skeleton|> class PossiblePath: def left_up_right_up(self, m, n): """move to right, up, down""" <|body_0|> def count_path(self, m, n): """move to right, right up, right down""" <|body_1|> def count_path_followup(self, m, n, points): """Credit: Yuan Copyright: Yuan...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PossiblePath: def left_up_right_up(self, m, n): """move to right, up, down""" dp = [[0 for _ in range(n)] for _ in range(m)] for j in range(n): for i in range(m): if j == 0: dp[i][j] = 1 else: temp = 0 ...
the_stack_v2_python_sparse
Algorithm/9901_Possible_Paths.py
Gi1ia/TechNoteBook
train
7
86f36cced25211060eb700f305cef822ffd18378
[ "now = now or OSAUtil.get_now()\nbasetime = DateTimeUtil.toLoginTime(now)\nreturn basetime <= self.ltime", "if self.isToday(now=now):\n return self.point\nelse:\n return 0", "if self.isToday(now=now):\n return self.win\nelse:\n return 0", "if self.isToday(now=now):\n return self.winmax\nelse:\n...
<|body_start_0|> now = now or OSAUtil.get_now() basetime = DateTimeUtil.toLoginTime(now) return basetime <= self.ltime <|end_body_0|> <|body_start_1|> if self.isToday(now=now): return self.point else: return 0 <|end_body_1|> <|body_start_2|> if s...
プレイヤーのスコア情報.
BattleEventScore
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BattleEventScore: """プレイヤーのスコア情報.""" def isToday(self, now=None): """今日のスコアなのか判定.""" <|body_0|> def getPointToday(self, now=None): """本日獲得ポイントの取得.""" <|body_1|> def getWinToday(self, now=None): """本日現在連勝数の取得.""" <|body_2|> def ge...
stack_v2_sparse_classes_36k_train_020870
37,034
no_license
[ { "docstring": "今日のスコアなのか判定.", "name": "isToday", "signature": "def isToday(self, now=None)" }, { "docstring": "本日獲得ポイントの取得.", "name": "getPointToday", "signature": "def getPointToday(self, now=None)" }, { "docstring": "本日現在連勝数の取得.", "name": "getWinToday", "signature": "d...
6
stack_v2_sparse_classes_30k_train_006508
Implement the Python class `BattleEventScore` described below. Class description: プレイヤーのスコア情報. Method signatures and docstrings: - def isToday(self, now=None): 今日のスコアなのか判定. - def getPointToday(self, now=None): 本日獲得ポイントの取得. - def getWinToday(self, now=None): 本日現在連勝数の取得. - def getWinMaxToday(self, now=None): 本日最大連勝数の取得...
Implement the Python class `BattleEventScore` described below. Class description: プレイヤーのスコア情報. Method signatures and docstrings: - def isToday(self, now=None): 今日のスコアなのか判定. - def getPointToday(self, now=None): 本日獲得ポイントの取得. - def getWinToday(self, now=None): 本日現在連勝数の取得. - def getWinMaxToday(self, now=None): 本日最大連勝数の取得...
492bf477ac00c380f2b2758c86b46aa7e58bbad9
<|skeleton|> class BattleEventScore: """プレイヤーのスコア情報.""" def isToday(self, now=None): """今日のスコアなのか判定.""" <|body_0|> def getPointToday(self, now=None): """本日獲得ポイントの取得.""" <|body_1|> def getWinToday(self, now=None): """本日現在連勝数の取得.""" <|body_2|> def ge...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BattleEventScore: """プレイヤーのスコア情報.""" def isToday(self, now=None): """今日のスコアなのか判定.""" now = now or OSAUtil.get_now() basetime = DateTimeUtil.toLoginTime(now) return basetime <= self.ltime def getPointToday(self, now=None): """本日獲得ポイントの取得.""" if self.isT...
the_stack_v2_python_sparse
src/dprj/platinumegg/app/cabaret/models/battleevent/BattleEvent.py
hitandaway100/caba
train
0
07491ce20c12d8728e8ccb5dd92ff3abb98a0389
[ "if isinstance(source, (etree._ElementTree, etree._Element)):\n ctx = etree.iterwalk(source, EVENTS)\nelif self.parser.config.process_xinclude:\n tree = etree.parse(source, base_url=self.parser.config.base_url)\n tree.xinclude()\n ctx = etree.iterwalk(tree, EVENTS)\nelse:\n ctx = etree.iterparse(sour...
<|body_start_0|> if isinstance(source, (etree._ElementTree, etree._Element)): ctx = etree.iterwalk(source, EVENTS) elif self.parser.config.process_xinclude: tree = etree.parse(source, base_url=self.parser.config.base_url) tree.xinclude() ctx = etree.iterwa...
Event handler based on :class:`lxml.etree.iterparse` api. :param parser: The parser instance to feed with events :param clazz: The target binding model, auto located if omitted.
LxmlEventHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LxmlEventHandler: """Event handler based on :class:`lxml.etree.iterparse` api. :param parser: The parser instance to feed with events :param clazz: The target binding model, auto located if omitted.""" def parse(self, source: Any) -> Any: """Parse an XML document from a system identi...
stack_v2_sparse_classes_36k_train_020871
2,782
permissive
[ { "docstring": "Parse an XML document from a system identifier or an InputSource or directly from a lxml Element or Tree. When Source is a lxml Element or Tree the handler will switch to the :class:`lxml.etree.iterwalk` api. When source is a system identifier or an InputSource the parser will ignore comments an...
2
null
Implement the Python class `LxmlEventHandler` described below. Class description: Event handler based on :class:`lxml.etree.iterparse` api. :param parser: The parser instance to feed with events :param clazz: The target binding model, auto located if omitted. Method signatures and docstrings: - def parse(self, source...
Implement the Python class `LxmlEventHandler` described below. Class description: Event handler based on :class:`lxml.etree.iterparse` api. :param parser: The parser instance to feed with events :param clazz: The target binding model, auto located if omitted. Method signatures and docstrings: - def parse(self, source...
31f672af84fd040a97996871916a41b1046fe46b
<|skeleton|> class LxmlEventHandler: """Event handler based on :class:`lxml.etree.iterparse` api. :param parser: The parser instance to feed with events :param clazz: The target binding model, auto located if omitted.""" def parse(self, source: Any) -> Any: """Parse an XML document from a system identi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LxmlEventHandler: """Event handler based on :class:`lxml.etree.iterparse` api. :param parser: The parser instance to feed with events :param clazz: The target binding model, auto located if omitted.""" def parse(self, source: Any) -> Any: """Parse an XML document from a system identifier or an In...
the_stack_v2_python_sparse
xsdata/formats/dataclass/parsers/handlers/lxml.py
tefra/xsdata
train
243
2fc34223ff7e19ba468a622f26857279da92dbc6
[ "super().__init__()\nself.N_freqs = N_freqs\nself.funcs = [torch.sin, torch.cos]\nif logscale:\n self.freq_bands = 2 ** torch.linspace(0, n_freqs - 1, N_freqs)\nelse:\n self.freq_bands = torch.linspace(1, 2 ** (n_freqs - 1), N_freqs)", "out = [x]\nfor freq in self.freq_bands:\n for func in self.funcs:\n ...
<|body_start_0|> super().__init__() self.N_freqs = N_freqs self.funcs = [torch.sin, torch.cos] if logscale: self.freq_bands = 2 ** torch.linspace(0, n_freqs - 1, N_freqs) else: self.freq_bands = torch.linspace(1, 2 ** (n_freqs - 1), N_freqs) <|end_body_0|>...
Freq Embedding. Attributes: N_freqs: funcs: freq_bands:
Embedding
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Embedding: """Freq Embedding. Attributes: N_freqs: funcs: freq_bands:""" def __init__(self, N_freqs, logscale=True): """Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels (3 for both xyz and direction)""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_020872
8,749
permissive
[ { "docstring": "Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels (3 for both xyz and direction)", "name": "__init__", "signature": "def __init__(self, N_freqs, logscale=True)" }, { "docstring": "Embeds x to (x, sin(2^k x), cos(2^k x), ......
2
null
Implement the Python class `Embedding` described below. Class description: Freq Embedding. Attributes: N_freqs: funcs: freq_bands: Method signatures and docstrings: - def __init__(self, N_freqs, logscale=True): Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels ...
Implement the Python class `Embedding` described below. Class description: Freq Embedding. Attributes: N_freqs: funcs: freq_bands: Method signatures and docstrings: - def __init__(self, N_freqs, logscale=True): Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels ...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class Embedding: """Freq Embedding. Attributes: N_freqs: funcs: freq_bands:""" def __init__(self, N_freqs, logscale=True): """Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels (3 for both xyz and direction)""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Embedding: """Freq Embedding. Attributes: N_freqs: funcs: freq_bands:""" def __init__(self, N_freqs, logscale=True): """Defines a function that embeds x to (x, sin(2^k x), cos(2^k x), ...) in_channels: number of input channels (3 for both xyz and direction)""" super().__init__() s...
the_stack_v2_python_sparse
nerflets/models/nerf.py
Jimmy-INL/google-research
train
1
4a4d476322af18b2a234d0cbdc72c13b320f00a6
[ "self.header.append(CDF_LABEL)\nkey_list = []\nfor cube in self.cube_list:\n scenario = self.vocab.get_collection_term_label(InputType.SCENARIO, cube.attributes['scenario'])\n var = self.input_data.get_value_label(InputType.VARIABLE)[0].encode('utf-8')\n self.header.append('{var}({scenario})'.format(scenar...
<|body_start_0|> self.header.append(CDF_LABEL) key_list = [] for cube in self.cube_list: scenario = self.vocab.get_collection_term_label(InputType.SCENARIO, cube.attributes['scenario']) var = self.input_data.get_value_label(InputType.VARIABLE)[0].encode('utf-8') ...
The CDF CSV writer class. This class extends BaseCsvWriter with a _write_csv(self).
CdfCsvWriter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CdfCsvWriter: """The CDF CSV writer class. This class extends BaseCsvWriter with a _write_csv(self).""" def _write_csv(self): """Write out the data, in CSV format, associated with a CDF plot.""" <|body_0|> def _read_percentile_cube(self, cube, key_list): """Slice...
stack_v2_sparse_classes_36k_train_020873
1,782
permissive
[ { "docstring": "Write out the data, in CSV format, associated with a CDF plot.", "name": "_write_csv", "signature": "def _write_csv(self)" }, { "docstring": "Slice the cube over 'percentile' and update data_dict", "name": "_read_percentile_cube", "signature": "def _read_percentile_cube(s...
2
stack_v2_sparse_classes_30k_train_014641
Implement the Python class `CdfCsvWriter` described below. Class description: The CDF CSV writer class. This class extends BaseCsvWriter with a _write_csv(self). Method signatures and docstrings: - def _write_csv(self): Write out the data, in CSV format, associated with a CDF plot. - def _read_percentile_cube(self, c...
Implement the Python class `CdfCsvWriter` described below. Class description: The CDF CSV writer class. This class extends BaseCsvWriter with a _write_csv(self). Method signatures and docstrings: - def _write_csv(self): Write out the data, in CSV format, associated with a CDF plot. - def _read_percentile_cube(self, c...
e400e97feffe6ea59b4f75a32b93f686168d1d58
<|skeleton|> class CdfCsvWriter: """The CDF CSV writer class. This class extends BaseCsvWriter with a _write_csv(self).""" def _write_csv(self): """Write out the data, in CSV format, associated with a CDF plot.""" <|body_0|> def _read_percentile_cube(self, cube, key_list): """Slice...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CdfCsvWriter: """The CDF CSV writer class. This class extends BaseCsvWriter with a _write_csv(self).""" def _write_csv(self): """Write out the data, in CSV format, associated with a CDF plot.""" self.header.append(CDF_LABEL) key_list = [] for cube in self.cube_list: ...
the_stack_v2_python_sparse
ukcp_dp/file_writers/_write_csv_cdf.py
tim779281/ukcp-data-processor
train
0
554ae97c8208d1dba00268b3fa54c725d7ebd40c
[ "context = req.environ['nova.context']\ncompute_nodes = objects.ComputeNodeList.get_all(context)\nresults = {}\nfor node in compute_nodes:\n results[node.uuid] = {}\n results[node.uuid]['id'] = node.id\n results[node.uuid]['host'] = node.host\nreturn results", "context = req.environ['nova.context']\ncomp...
<|body_start_0|> context = req.environ['nova.context'] compute_nodes = objects.ComputeNodeList.get_all(context) results = {} for node in compute_nodes: results[node.uuid] = {} results[node.uuid]['id'] = node.id results[node.uuid]['host'] = node.host ...
Flavor controller for the OpenStack API.
FlavorsController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlavorsController: """Flavor controller for the OpenStack API.""" def index(self, req): """Return all flavors in brief.""" <|body_0|> def detail(self, req): """Return all flavors in detail.""" <|body_1|> def show(self, req, id): """Return dat...
stack_v2_sparse_classes_36k_train_020874
3,546
no_license
[ { "docstring": "Return all flavors in brief.", "name": "index", "signature": "def index(self, req)" }, { "docstring": "Return all flavors in detail.", "name": "detail", "signature": "def detail(self, req)" }, { "docstring": "Return data about the given flavor id.", "name": "s...
3
stack_v2_sparse_classes_30k_val_000732
Implement the Python class `FlavorsController` described below. Class description: Flavor controller for the OpenStack API. Method signatures and docstrings: - def index(self, req): Return all flavors in brief. - def detail(self, req): Return all flavors in detail. - def show(self, req, id): Return data about the giv...
Implement the Python class `FlavorsController` described below. Class description: Flavor controller for the OpenStack API. Method signatures and docstrings: - def index(self, req): Return all flavors in brief. - def detail(self, req): Return all flavors in detail. - def show(self, req, id): Return data about the giv...
61d4e0ccd7328a6aa543af3b75e5f7fedf98bf8e
<|skeleton|> class FlavorsController: """Flavor controller for the OpenStack API.""" def index(self, req): """Return all flavors in brief.""" <|body_0|> def detail(self, req): """Return all flavors in detail.""" <|body_1|> def show(self, req, id): """Return dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlavorsController: """Flavor controller for the OpenStack API.""" def index(self, req): """Return all flavors in brief.""" context = req.environ['nova.context'] compute_nodes = objects.ComputeNodeList.get_all(context) results = {} for node in compute_nodes: ...
the_stack_v2_python_sparse
nova/api/openstack/compute/slaves.py
KevinKaiQian/polar-bear
train
2
42653acb8513b0b03aa48d708df49d2499e0bf16
[ "while True:\n word = raw_input('Pick a word: ')\n word = word.lower()\n if word in self.wordlist:\n return word\n else:\n print('Word not recognized, please try again')", "while True:\n ch = raw_input('Next guess: ')\n if ch in self.available:\n self.available.remove(ch)\n ...
<|body_start_0|> while True: word = raw_input('Pick a word: ') word = word.lower() if word in self.wordlist: return word else: print('Word not recognized, please try again') <|end_body_0|> <|body_start_1|> while True: ...
HumanAgent asks user for input using the command line interface
HumanAgent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HumanAgent: """HumanAgent asks user for input using the command line interface""" def getWord(self): """Query the user for a word, making sure it is in the word list""" <|body_0|> def getGuess(self, hiddenWord): """Query the user for a character as guess""" ...
stack_v2_sparse_classes_36k_train_020875
3,600
no_license
[ { "docstring": "Query the user for a word, making sure it is in the word list", "name": "getWord", "signature": "def getWord(self)" }, { "docstring": "Query the user for a character as guess", "name": "getGuess", "signature": "def getGuess(self, hiddenWord)" } ]
2
null
Implement the Python class `HumanAgent` described below. Class description: HumanAgent asks user for input using the command line interface Method signatures and docstrings: - def getWord(self): Query the user for a word, making sure it is in the word list - def getGuess(self, hiddenWord): Query the user for a charac...
Implement the Python class `HumanAgent` described below. Class description: HumanAgent asks user for input using the command line interface Method signatures and docstrings: - def getWord(self): Query the user for a word, making sure it is in the word list - def getGuess(self, hiddenWord): Query the user for a charac...
cd8a18778101d49607cb3e4d9e59e5698c9c89c0
<|skeleton|> class HumanAgent: """HumanAgent asks user for input using the command line interface""" def getWord(self): """Query the user for a word, making sure it is in the word list""" <|body_0|> def getGuess(self, hiddenWord): """Query the user for a character as guess""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HumanAgent: """HumanAgent asks user for input using the command line interface""" def getWord(self): """Query the user for a word, making sure it is in the word list""" while True: word = raw_input('Pick a word: ') word = word.lower() if word in self.wo...
the_stack_v2_python_sparse
hangman-master/hangman/agent.py
Elik0010/hachshara
train
0
7dc5dc6e47167b28c919141b7b6ecde369b39959
[ "self.config = config_\nself.logger = logging.getLogger('cuda_logger')\nself.data_exporter = DataExporter(self.config)", "self.logger.info('Starting job: RunRLTestingJob\\n')\nself.logger.info('RL testing parameters:')\nrl_tester = RLTester(self.config)\nresult = rl_tester.run()\nself.logger.info('Finished job: R...
<|body_start_0|> self.config = config_ self.logger = logging.getLogger('cuda_logger') self.data_exporter = DataExporter(self.config) <|end_body_0|> <|body_start_1|> self.logger.info('Starting job: RunRLTestingJob\n') self.logger.info('RL testing parameters:') rl_tester =...
This class implements a job to run the RL testing
RunRLTestingJob
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunRLTestingJob: """This class implements a job to run the RL testing""" def __init__(self, config_): """Constructor :param config_: :return:""" <|body_0|> def run(self): """This method executes the job :param: :return:""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_020876
986
no_license
[ { "docstring": "Constructor :param config_: :return:", "name": "__init__", "signature": "def __init__(self, config_)" }, { "docstring": "This method executes the job :param: :return:", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_006834
Implement the Python class `RunRLTestingJob` described below. Class description: This class implements a job to run the RL testing Method signatures and docstrings: - def __init__(self, config_): Constructor :param config_: :return: - def run(self): This method executes the job :param: :return:
Implement the Python class `RunRLTestingJob` described below. Class description: This class implements a job to run the RL testing Method signatures and docstrings: - def __init__(self, config_): Constructor :param config_: :return: - def run(self): This method executes the job :param: :return: <|skeleton|> class Ru...
f7fcd2cc1d6ba18b199d176d4d39193f025ee281
<|skeleton|> class RunRLTestingJob: """This class implements a job to run the RL testing""" def __init__(self, config_): """Constructor :param config_: :return:""" <|body_0|> def run(self): """This method executes the job :param: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunRLTestingJob: """This class implements a job to run the RL testing""" def __init__(self, config_): """Constructor :param config_: :return:""" self.config = config_ self.logger = logging.getLogger('cuda_logger') self.data_exporter = DataExporter(self.config) def run...
the_stack_v2_python_sparse
learn_to_earn_framework/jobs/rl_testing.py
transparent-framework/optimize-ride-sharing-earnings
train
7
37f3e84b4abfa2fb7be18fac9b05db8da0055e60
[ "if support_regional_security_policy or support_net_lb:\n cls.NAME_ARG = flags.PriorityArgument('describe')\n cls.NAME_ARG.AddArgument(parser, operation_type='describe', cust_metavar='PRIORITY')\n flags.AddRegionFlag(parser, 'describe')\n cls.SECURITY_POLICY_ARG = security_policy_flags.SecurityPolicyMul...
<|body_start_0|> if support_regional_security_policy or support_net_lb: cls.NAME_ARG = flags.PriorityArgument('describe') cls.NAME_ARG.AddArgument(parser, operation_type='describe', cust_metavar='PRIORITY') flags.AddRegionFlag(parser, 'describe') cls.SECURITY_POLI...
Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy
DescribeHelper
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DescribeHelper: """Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy""" def Args(cls, parser, support_regional_security_...
stack_v2_sparse_classes_36k_train_020877
7,354
permissive
[ { "docstring": "Generates the flagset for a Describe command.", "name": "Args", "signature": "def Args(cls, parser, support_regional_security_policy, support_net_lb)" }, { "docstring": "Validates arguments and describes a security policy rule.", "name": "Run", "signature": "def Run(cls, ...
2
null
Implement the Python class `DescribeHelper` described below. Class description: Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy Method signature...
Implement the Python class `DescribeHelper` described below. Class description: Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy Method signature...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class DescribeHelper: """Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy""" def Args(cls, parser, support_regional_security_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DescribeHelper: """Describe a Compute Engine security policy rule. *{command}* displays all data associated with a security policy rule. ## EXAMPLES To describe the rule at priority 1000, run: $ {command} 1000 \\ --security-policy=my-policy""" def Args(cls, parser, support_regional_security_policy, suppo...
the_stack_v2_python_sparse
lib/surface/compute/security_policies/rules/describe.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
c54e494bde8431da383e56609a14e252bee0e4b3
[ "for i in range(len(nums)):\n if i and nums[i - 1] < nums[i]:\n break\nelse:\n for i in range(len(nums) / 2):\n nums[i], nums[len(nums) - 1 - i] = (nums[len(nums) - 1 - i], nums[i])\n return\nfor i in range(len(nums) - 2, -1, -1):\n for j in range(i, len(nums)):\n if j < len(nums) -...
<|body_start_0|> for i in range(len(nums)): if i and nums[i - 1] < nums[i]: break else: for i in range(len(nums) / 2): nums[i], nums[len(nums) - 1 - i] = (nums[len(nums) - 1 - i], nums[i]) return for i in range(len(nums) - 2, -1...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place i...
stack_v2_sparse_classes_36k_train_020878
3,024
permissive
[ { "docstring": ":type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.", "name": "_nextPermutation", "signature": "def _nextPermutation(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.", ...
2
stack_v2_sparse_classes_30k_train_000833
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _nextPermutation(self, nums): :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def nextPermutation(self, nums): :type nums: List[int...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _nextPermutation(self, nums): :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. - def nextPermutation(self, nums): :type nums: List[int...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" <|body_0|> def nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _nextPermutation(self, nums): """:type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead.""" for i in range(len(nums)): if i and nums[i - 1] < nums[i]: break else: for i in range(len(nums) / 2): ...
the_stack_v2_python_sparse
31.next-permutation.py
windard/leeeeee
train
0
ebba3d383ed20c3a9cf4020f63018afbac565da2
[ "if not root:\n return ''\nqueue = [root]\nans = []\nwhile queue:\n cur_node = queue.pop(0)\n if cur_node:\n queue.append(cur_node.left)\n queue.append(cur_node.right)\n ans.append(str(cur_node.val) if cur_node else '#')\nreturn ','.join(ans)", "if not data:\n return None\ndata = data...
<|body_start_0|> if not root: return '' queue = [root] ans = [] while queue: cur_node = queue.pop(0) if cur_node: queue.append(cur_node.left) queue.append(cur_node.right) ans.append(str(cur_node.val) if cur_n...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: ...
stack_v2_sparse_classes_36k_train_020879
1,550
no_license
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
stack_v2_sparse_classes_30k_train_012291
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
3a83c0b0bcc43f458f7fc54764f60e1104fcc12e
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" if not root: return '' queue = [root] ans = [] while queue: cur_node = queue.pop(0) if cur_node: queue.append(cur_node.left) ...
the_stack_v2_python_sparse
200111/Serialize_Deserialize_BST.py
Jsonghh/leetcode
train
0
1f5787212828b7dac5b14cec4eace88093eaed32
[ "i = 0\nminVal, maxVal = (0, n)\nwhile True:\n i += 1\n t = round((minVal + maxVal) / 2)\n evl = guess(t)\n if evl == 0:\n return t\n elif evl == 1:\n minVal = t\n elif evl == -1:\n maxVal = t\n else:\n print('error')\n return False", "l, h = (1, n)\nmid = (...
<|body_start_0|> i = 0 minVal, maxVal = (0, n) while True: i += 1 t = round((minVal + maxVal) / 2) evl = guess(t) if evl == 0: return t elif evl == 1: minVal = t elif evl == -1: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def guessNumber(self, n): """:type n: int :rtype: int""" <|body_0|> def mySolution(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> i = 0 minVal, maxVal = (0, n) while True: ...
stack_v2_sparse_classes_36k_train_020880
1,150
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "guessNumber", "signature": "def guessNumber(self, n)" }, { "docstring": ":type n: int :rtype: int", "name": "mySolution", "signature": "def mySolution(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_004034
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def guessNumber(self, n): :type n: int :rtype: int - def mySolution(self, n): :type n: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def guessNumber(self, n): :type n: int :rtype: int - def mySolution(self, n): :type n: int :rtype: int <|skeleton|> class Solution: def guessNumber(self, n): """:ty...
11c8fc663888b48b5417256aab1bf872190267ba
<|skeleton|> class Solution: def guessNumber(self, n): """:type n: int :rtype: int""" <|body_0|> def mySolution(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def guessNumber(self, n): """:type n: int :rtype: int""" i = 0 minVal, maxVal = (0, n) while True: i += 1 t = round((minVal + maxVal) / 2) evl = guess(t) if evl == 0: return t elif evl == 1: ...
the_stack_v2_python_sparse
Guess Number Higher or Lower.py
lfdyf20/Leetcode
train
1
b56572cbbc25e2bb12d0592645c7d1e03eed8b4a
[ "result = dateutil.parser.parse(field, default=self.PREVENT_DEFAULT_DAY_MON_SEED1)\nresult_other = dateutil.parser.parse(field, default=self.PREVENT_DEFAULT_DAY_MON_SEED2)\nif result != result_other:\n log.warning(f'Field {self.name} is missing month or day')\n return None\nif result.tzinfo is None:\n resu...
<|body_start_0|> result = dateutil.parser.parse(field, default=self.PREVENT_DEFAULT_DAY_MON_SEED1) result_other = dateutil.parser.parse(field, default=self.PREVENT_DEFAULT_DAY_MON_SEED2) if result != result_other: log.warning(f'Field {self.name} is missing month or day') ...
Date fields know how to parse and produce json (iso) compatible formats. Converts to tz aware datetimes.
Date
[ "AGPL-3.0-only", "AGPL-3.0-or-later", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Date: """Date fields know how to parse and produce json (iso) compatible formats. Converts to tz aware datetimes.""" def _parse_date_wo_default_month_day(self, field): """Parse the field as an iso string but prevent dateutils from defaulting the day or month while allowing it to defa...
stack_v2_sparse_classes_36k_train_020881
10,966
permissive
[ { "docstring": "Parse the field as an iso string but prevent dateutils from defaulting the day or month while allowing it to default the other fields.", "name": "_parse_date_wo_default_month_day", "signature": "def _parse_date_wo_default_month_day(self, field)" }, { "docstring": "Parse an option...
3
null
Implement the Python class `Date` described below. Class description: Date fields know how to parse and produce json (iso) compatible formats. Converts to tz aware datetimes. Method signatures and docstrings: - def _parse_date_wo_default_month_day(self, field): Parse the field as an iso string but prevent dateutils f...
Implement the Python class `Date` described below. Class description: Date fields know how to parse and produce json (iso) compatible formats. Converts to tz aware datetimes. Method signatures and docstrings: - def _parse_date_wo_default_month_day(self, field): Parse the field as an iso string but prevent dateutils f...
5809eaca7079a15ee56b0b7fcfea425337046c97
<|skeleton|> class Date: """Date fields know how to parse and produce json (iso) compatible formats. Converts to tz aware datetimes.""" def _parse_date_wo_default_month_day(self, field): """Parse the field as an iso string but prevent dateutils from defaulting the day or month while allowing it to defa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Date: """Date fields know how to parse and produce json (iso) compatible formats. Converts to tz aware datetimes.""" def _parse_date_wo_default_month_day(self, field): """Parse the field as an iso string but prevent dateutils from defaulting the day or month while allowing it to default the other...
the_stack_v2_python_sparse
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/lib/xmodule/xmodule/fields.py
luque/better-ways-of-thinking-about-software
train
3
aeb8f36f3c65e8ee2cda8049a7ce42133d18b5ec
[ "super().__init__(debug, config_path, file_list, vt_api_key)\nif self.os_name:\n try:\n self._WORKERS = self.config_dict[self.os_name]['scanner']['hash']['threads']\n self._HASH_STORAGE = self.config_dict[self.os_name]['update']['hash']['storage']\n except KeyError:\n self.logger.log('Cou...
<|body_start_0|> super().__init__(debug, config_path, file_list, vt_api_key) if self.os_name: try: self._WORKERS = self.config_dict[self.os_name]['scanner']['hash']['threads'] self._HASH_STORAGE = self.config_dict[self.os_name]['update']['hash']['storage'] ...
HashScanner class.
HashScanner
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashScanner: """HashScanner class.""" def __init__(self, debug=False, config_path=None, file_list=None, vt_api_key=None): """Initialize HashScanner. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path file_list (list): List of files to scan vt_a...
stack_v2_sparse_classes_36k_train_020882
3,268
permissive
[ { "docstring": "Initialize HashScanner. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path file_list (list): List of files to scan vt_api_key (str): Virus Total API Key Raises: None Returns: None", "name": "__init__", "signature": "def __init__(self, debug=False, ...
2
stack_v2_sparse_classes_30k_train_004499
Implement the Python class `HashScanner` described below. Class description: HashScanner class. Method signatures and docstrings: - def __init__(self, debug=False, config_path=None, file_list=None, vt_api_key=None): Initialize HashScanner. Args: debug (bool): Log on terminal or not config_path (str): Configuration JS...
Implement the Python class `HashScanner` described below. Class description: HashScanner class. Method signatures and docstrings: - def __init__(self, debug=False, config_path=None, file_list=None, vt_api_key=None): Initialize HashScanner. Args: debug (bool): Log on terminal or not config_path (str): Configuration JS...
43dec187e5848b9ced8a6b4957b6e9028d4d43cd
<|skeleton|> class HashScanner: """HashScanner class.""" def __init__(self, debug=False, config_path=None, file_list=None, vt_api_key=None): """Initialize HashScanner. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path file_list (list): List of files to scan vt_a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HashScanner: """HashScanner class.""" def __init__(self, debug=False, config_path=None, file_list=None, vt_api_key=None): """Initialize HashScanner. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path file_list (list): List of files to scan vt_api_key (str):...
the_stack_v2_python_sparse
securetea/lib/antivirus/scanner/hash_scanner.py
rejahrehim/SecureTea-Project
train
1
aa511bcdceb466eae4e2a0f0e3d087b8dd1413b0
[ "super(ResidualBlock, self).__init__()\nself.conv1 = conv(base_channel, base_channel, kernel_size, padding=kernel_size // 2)\nself.conv2 = conv(base_channel, base_channel, kernel_size, padding=(kernel_size - 1) // 2)\nself.leaky_relu = ops.LeakyReLU(inplace=True)\ninitialize_weights([self.conv1, self.conv2], 0.1)",...
<|body_start_0|> super(ResidualBlock, self).__init__() self.conv1 = conv(base_channel, base_channel, kernel_size, padding=kernel_size // 2) self.conv2 = conv(base_channel, base_channel, kernel_size, padding=(kernel_size - 1) // 2) self.leaky_relu = ops.LeakyReLU(inplace=True) ini...
Basic block with channel number and kernel size as variable.
ResidualBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResidualBlock: """Basic block with channel number and kernel size as variable.""" def __init__(self, kernel_size=3, base_channel=64): """Construct the ResidualBlock class. :param kernel_size: kernel size of conv layers :param base_channel: number of input (and output) channels""" ...
stack_v2_sparse_classes_36k_train_020883
5,337
permissive
[ { "docstring": "Construct the ResidualBlock class. :param kernel_size: kernel size of conv layers :param base_channel: number of input (and output) channels", "name": "__init__", "signature": "def __init__(self, kernel_size=3, base_channel=64)" }, { "docstring": "Calculate the output of the mode...
2
null
Implement the Python class `ResidualBlock` described below. Class description: Basic block with channel number and kernel size as variable. Method signatures and docstrings: - def __init__(self, kernel_size=3, base_channel=64): Construct the ResidualBlock class. :param kernel_size: kernel size of conv layers :param b...
Implement the Python class `ResidualBlock` described below. Class description: Basic block with channel number and kernel size as variable. Method signatures and docstrings: - def __init__(self, kernel_size=3, base_channel=64): Construct the ResidualBlock class. :param kernel_size: kernel size of conv layers :param b...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class ResidualBlock: """Basic block with channel number and kernel size as variable.""" def __init__(self, kernel_size=3, base_channel=64): """Construct the ResidualBlock class. :param kernel_size: kernel size of conv layers :param base_channel: number of input (and output) channels""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResidualBlock: """Basic block with channel number and kernel size as variable.""" def __init__(self, kernel_size=3, base_channel=64): """Construct the ResidualBlock class. :param kernel_size: kernel size of conv layers :param base_channel: number of input (and output) channels""" super(Re...
the_stack_v2_python_sparse
zeus/networks/mtm_sr.py
huawei-noah/xingtian
train
308
5a5333ae12496d1ff99033ec928eb96fd66cf6bc
[ "m = len(s1)\nn = len(s2)\nif m + n != len(s3):\n return False\ndp = [[False for _ in xrange(n + 1)] for _ in xrange(m + 1)]\ndp[0][0] = True\nfor i in xrange(1, m + 1):\n dp[i][0] = dp[i - 1][0] and s3[i + 0 - 1] == s1[i - 1]\nfor j in xrange(1, n + 1):\n dp[0][j] = dp[0][j - 1] and s3[0 + j - 1] == s2[j ...
<|body_start_0|> m = len(s1) n = len(s2) if m + n != len(s3): return False dp = [[False for _ in xrange(n + 1)] for _ in xrange(m + 1)] dp[0][0] = True for i in xrange(1, m + 1): dp[i][0] = dp[i - 1][0] and s3[i + 0 - 1] == s1[i - 1] for j ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isInterleave(self, s1, s2, s3): """dfs dp dp[i][j], for s3[:i+j] interleaved by s1[:i], s2[:j] - d b b c a - T F F F F F a T F F F F F a T T T T T F b F T T F T F c F F T T T T c F F F T F T notice the boundary condition Thought: dfs, easy to come up, but high space complex...
stack_v2_sparse_classes_36k_train_020884
2,718
permissive
[ { "docstring": "dfs dp dp[i][j], for s3[:i+j] interleaved by s1[:i], s2[:j] - d b b c a - T F F F F F a T F F F F F a T T T T T F b F T T F T F c F F T T T T c F F F T F T notice the boundary condition Thought: dfs, easy to come up, but high space complexity thus, dp f[i][j] represents s3[:i+j] comes from s1[:i...
2
stack_v2_sparse_classes_30k_train_011643
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isInterleave(self, s1, s2, s3): dfs dp dp[i][j], for s3[:i+j] interleaved by s1[:i], s2[:j] - d b b c a - T F F F F F a T F F F F F a T T T T T F b F T T F T F c F F T T T T ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isInterleave(self, s1, s2, s3): dfs dp dp[i][j], for s3[:i+j] interleaved by s1[:i], s2[:j] - d b b c a - T F F F F F a T F F F F F a T T T T T F b F T T F T F c F F T T T T ...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class Solution: def isInterleave(self, s1, s2, s3): """dfs dp dp[i][j], for s3[:i+j] interleaved by s1[:i], s2[:j] - d b b c a - T F F F F F a T F F F F F a T T T T T F b F T T F T F c F F T T T T c F F F T F T notice the boundary condition Thought: dfs, easy to come up, but high space complex...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isInterleave(self, s1, s2, s3): """dfs dp dp[i][j], for s3[:i+j] interleaved by s1[:i], s2[:j] - d b b c a - T F F F F F a T F F F F F a T T T T T F b F T T F T F c F F T T T T c F F F T F T notice the boundary condition Thought: dfs, easy to come up, but high space complexity thus, dp f...
the_stack_v2_python_sparse
097 Interleaving String.py
Aminaba123/LeetCode
train
1
fdb1d69cd5a706c1121f30d91d518436ba5b954c
[ "k %= len(nums)\nwhile k > 0:\n pre = nums[len(nums) - 1]\n for i in range(len(nums)):\n nums[i], pre = (pre, nums[i])\n k -= 1", "k %= len(nums)\nwhile k > 0:\n e = nums.pop()\n nums.insert(0, e)\n k -= 1", "def reverse(a, i, j):\n \"\"\"\n 数组反转操作\n a:数...
<|body_start_0|> k %= len(nums) while k > 0: pre = nums[len(nums) - 1] for i in range(len(nums)): nums[i], pre = (pre, nums[i]) k -= 1 <|end_body_0|> <|body_start_1|> k %= len(nums) while k > 0: e = nums.pop() n...
给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4] 示例 2: 输入: [-1,-100,3,99] 和 k = 2 输出: [3,99,-1,-100] 解释: 向右旋转 1 步: [99,-1,-100,3] 向右旋转 2 步: [3,99,-1,-100] 说明: 尽可能想出更多的解决方案,至少有三种不同的方法可以解决这个问题。 要求使用空...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4] 示例 2: 输入: [-1,-100,3,99] 和 k = 2 输出: [3,99,-1,-100] 解释: 向右旋转 1 步: [99,-1,-100,3] 向右旋转 2 步: [3,99,-1,-100] 说明: 尽可...
stack_v2_sparse_classes_36k_train_020885
3,307
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: None Do not return anything, modify nums in-place instead. 时间复杂度:O(k * n) 空间复杂度:O(1)", "name": "rotate1", "signature": "def rotate1(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: None Do not return anything...
3
stack_v2_sparse_classes_30k_train_007118
Implement the Python class `Solution` described below. Class description: 给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4] 示例 2: 输入: [-1,-100,3,99] 和 k = 2 输出: [3,99,-1,-100] 解释: 向右旋转 1 步: [99,-1,...
Implement the Python class `Solution` described below. Class description: 给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4] 示例 2: 输入: [-1,-100,3,99] 和 k = 2 输出: [3,99,-1,-100] 解释: 向右旋转 1 步: [99,-1,...
2c534185854c1a6f5ffdb2698f9db9989f30a25b
<|skeleton|> class Solution: """给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4] 示例 2: 输入: [-1,-100,3,99] 和 k = 2 输出: [3,99,-1,-100] 解释: 向右旋转 1 步: [99,-1,-100,3] 向右旋转 2 步: [3,99,-1,-100] 说明: 尽可...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4] 示例 2: 输入: [-1,-100,3,99] 和 k = 2 输出: [3,99,-1,-100] 解释: 向右旋转 1 步: [99,-1,-100,3] 向右旋转 2 步: [3,99,-1,-100] 说明: 尽可能想出更多的解决方案,至少...
the_stack_v2_python_sparse
Week 01/id_668/leetcode_189_668.py
Carryours/algorithm004-03
train
2
4f1a973162ef7e40e5b8619b1bfe7c9065a05dea
[ "super(JobNodeDiff, self).__init__(job_node, diff_can_be_reprocessed, status)\nself.job_type_name = job_node.job_type_name\nself.job_type_version = job_node.job_type_version\nself.revision_num = job_node.revision_num\nself.prev_job_type_name = None\nself.prev_job_type_version = None\nself.prev_revision_num = None",...
<|body_start_0|> super(JobNodeDiff, self).__init__(job_node, diff_can_be_reprocessed, status) self.job_type_name = job_node.job_type_name self.job_type_version = job_node.job_type_version self.revision_num = job_node.revision_num self.prev_job_type_name = None self.prev_j...
Represents a diff for a job node within a recipe definition
JobNodeDiff
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JobNodeDiff: """Represents a diff for a job node within a recipe definition""" def __init__(self, job_node, diff_can_be_reprocessed, status=NodeDiff.NEW): """Constructor :param job_node: The job node from the recipe definition :type job_node: :class:`recipe.definition.node.JobNodeDef...
stack_v2_sparse_classes_36k_train_020886
17,326
permissive
[ { "docstring": "Constructor :param job_node: The job node from the recipe definition :type job_node: :class:`recipe.definition.node.JobNodeDefinition` :param diff_can_be_reprocessed: Whether the top-level diff can be reprocessed :type diff_can_be_reprocessed: bool :param status: The diff status, defaults to NEW...
3
null
Implement the Python class `JobNodeDiff` described below. Class description: Represents a diff for a job node within a recipe definition Method signatures and docstrings: - def __init__(self, job_node, diff_can_be_reprocessed, status=NodeDiff.NEW): Constructor :param job_node: The job node from the recipe definition ...
Implement the Python class `JobNodeDiff` described below. Class description: Represents a diff for a job node within a recipe definition Method signatures and docstrings: - def __init__(self, job_node, diff_can_be_reprocessed, status=NodeDiff.NEW): Constructor :param job_node: The job node from the recipe definition ...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class JobNodeDiff: """Represents a diff for a job node within a recipe definition""" def __init__(self, job_node, diff_can_be_reprocessed, status=NodeDiff.NEW): """Constructor :param job_node: The job node from the recipe definition :type job_node: :class:`recipe.definition.node.JobNodeDef...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JobNodeDiff: """Represents a diff for a job node within a recipe definition""" def __init__(self, job_node, diff_can_be_reprocessed, status=NodeDiff.NEW): """Constructor :param job_node: The job node from the recipe definition :type job_node: :class:`recipe.definition.node.JobNodeDefinition` :par...
the_stack_v2_python_sparse
scale/recipe/diff/node.py
kfconsultant/scale
train
0
7b65e94561f3e63be754cbcfd733623c3f4aaed0
[ "if model._meta.app_label in self.auth_apps:\n return 'default'\nreturn None", "if model._meta.app_label in self.auth_apps:\n return 'default'\nreturn None", "if obj1._meta.app_label in self.auth_apps or obj2._meta.app_label in self.auth_apps:\n return True\nreturn None", "if app_label == 'auth':\n ...
<|body_start_0|> if model._meta.app_label in self.auth_apps: return 'default' return None <|end_body_0|> <|body_start_1|> if model._meta.app_label in self.auth_apps: return 'default' return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label in ...
A router to control all database operations on models in the auth application.
AuthRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write auth ...
stack_v2_sparse_classes_36k_train_020887
3,782
no_license
[ { "docstring": "Attempts to read auth models go to auth_db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write auth models go to auth_db.", "name": "db_for_write", "signature": "def db_for_write(self, model, **hints)" }, ...
4
stack_v2_sparse_classes_30k_train_008882
Implement the Python class `AuthRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints): At...
Implement the Python class `AuthRouter` described below. Class description: A router to control all database operations on models in the auth application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read auth models go to auth_db. - def db_for_write(self, model, **hints): At...
9858638344366fd60e9b75a299326f951e7e66d0
<|skeleton|> class AuthRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempts to write auth ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthRouter: """A router to control all database operations on models in the auth application.""" def db_for_read(self, model, **hints): """Attempts to read auth models go to auth_db.""" if model._meta.app_label in self.auth_apps: return 'default' return None def d...
the_stack_v2_python_sparse
aqi_backend/common/database_routers.py
dschurholz/myaqi-backend
train
0
07df5f5592a74de3695956be89e8efe1d1044529
[ "self.cmd = None\nself.data = None\nself.sender_metadata = sender_metadata", "self.cmd = cmd\nself.data = data\nreturn self" ]
<|body_start_0|> self.cmd = None self.data = None self.sender_metadata = sender_metadata <|end_body_0|> <|body_start_1|> self.cmd = cmd self.data = data return self <|end_body_1|>
Object to be used for pool-worker communication.
Message
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Message: """Object to be used for pool-worker communication.""" def __init__(self, **sender_metadata: Dict) -> None: """Create a new message object that contains sender information. :param sender_metadata: Useful key-value information by sender.""" <|body_0|> def make(se...
stack_v2_sparse_classes_36k_train_020888
1,214
permissive
[ { "docstring": "Create a new message object that contains sender information. :param sender_metadata: Useful key-value information by sender.", "name": "__init__", "signature": "def __init__(self, **sender_metadata: Dict) -> None" }, { "docstring": "Crete a new message for communication. :param ...
2
stack_v2_sparse_classes_30k_train_013902
Implement the Python class `Message` described below. Class description: Object to be used for pool-worker communication. Method signatures and docstrings: - def __init__(self, **sender_metadata: Dict) -> None: Create a new message object that contains sender information. :param sender_metadata: Useful key-value info...
Implement the Python class `Message` described below. Class description: Object to be used for pool-worker communication. Method signatures and docstrings: - def __init__(self, **sender_metadata: Dict) -> None: Create a new message object that contains sender information. :param sender_metadata: Useful key-value info...
69c082d2bf9b9985db77d1d25a3f423ecf016e00
<|skeleton|> class Message: """Object to be used for pool-worker communication.""" def __init__(self, **sender_metadata: Dict) -> None: """Create a new message object that contains sender information. :param sender_metadata: Useful key-value information by sender.""" <|body_0|> def make(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Message: """Object to be used for pool-worker communication.""" def __init__(self, **sender_metadata: Dict) -> None: """Create a new message object that contains sender information. :param sender_metadata: Useful key-value information by sender.""" self.cmd = None self.data = None...
the_stack_v2_python_sparse
testplan/runners/pools/communication.py
morganstanley/testplan
train
78
62f52b2d1f8fbe33b13288871f640cb2a9600fb1
[ "len_1 = 0\nlen_2 = 0\nnum1 = 0\nnum2 = 0\nwhile l1.next:\n num1 += 10 ** len_1 * l1.val\n len_1 += 1\n l1 = l1.next\nnum1 += 10 ** len_1 * l1.val\nwhile l2.next:\n num2 += 10 ** len_2 * l2.val\n len_2 += 1\n l2 = l2.next\nnum2 += 10 ** len_2 * l2.val\nprint(num1, num2)\nans = num1 + num2\nprint(l...
<|body_start_0|> len_1 = 0 len_2 = 0 num1 = 0 num2 = 0 while l1.next: num1 += 10 ** len_1 * l1.val len_1 += 1 l1 = l1.next num1 += 10 ** len_1 * l1.val while l2.next: num2 += 10 ** len_2 * l2.val len_2 +=...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def addTwoNumbers1(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_020889
1,988
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "addTwoNumbers", "signature": "def addTwoNumbers(self, l1, l2)" }, { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "addTwoNumbers1", "signature": "def addTwoNumbers1(self, l1...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def addTwoNumbers1(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def addTwoNumbers1(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode...
d181f2075c6c3881772dfbf54df3ac3390936079
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def addTwoNumbers1(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addTwoNumbers(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" len_1 = 0 len_2 = 0 num1 = 0 num2 = 0 while l1.next: num1 += 10 ** len_1 * l1.val len_1 += 1 l1 = l1.next num1 += ...
the_stack_v2_python_sparse
2. Add Two Numbers.py
melekoktay/Leetcode-Practice
train
0
7c94225a320ec166b77c7607aaf172e5c171ee63
[ "self.height = 75\nself.width = 75\nself.cwd = os.getcwd()\ni = len(cwd)\nself.cwd = self.cwd[0:i - 5]\nself.path = self.cwd + '/Pick A Brick_LEGO_All_Bricks'\nself.filenames = ['Brick yellow', 'Bright blue', 'Bright orange', 'Bright red', 'Bright reddish violet', 'Bright yellow', 'Bright yellowish green', 'Dark gr...
<|body_start_0|> self.height = 75 self.width = 75 self.cwd = os.getcwd() i = len(cwd) self.cwd = self.cwd[0:i - 5] self.path = self.cwd + '/Pick A Brick_LEGO_All_Bricks' self.filenames = ['Brick yellow', 'Bright blue', 'Bright orange', 'Bright red', 'Bright reddis...
Brick
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Brick: def __init__(self): """Initialize the class, Brick.""" <|body_0|> def load(self): """Load image of each brick color.""" <|body_1|> def get_colors(self): """Get a list and dictionary of the RGB values of the middle pixels of each LEGO brick...
stack_v2_sparse_classes_36k_train_020890
1,836
no_license
[ { "docstring": "Initialize the class, Brick.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Load image of each brick color.", "name": "load", "signature": "def load(self)" }, { "docstring": "Get a list and dictionary of the RGB values of the middle pix...
3
stack_v2_sparse_classes_30k_test_000965
Implement the Python class `Brick` described below. Class description: Implement the Brick class. Method signatures and docstrings: - def __init__(self): Initialize the class, Brick. - def load(self): Load image of each brick color. - def get_colors(self): Get a list and dictionary of the RGB values of the middle pix...
Implement the Python class `Brick` described below. Class description: Implement the Brick class. Method signatures and docstrings: - def __init__(self): Initialize the class, Brick. - def load(self): Load image of each brick color. - def get_colors(self): Get a list and dictionary of the RGB values of the middle pix...
91ece548fe777a0838d0d473cb4fb48235565947
<|skeleton|> class Brick: def __init__(self): """Initialize the class, Brick.""" <|body_0|> def load(self): """Load image of each brick color.""" <|body_1|> def get_colors(self): """Get a list and dictionary of the RGB values of the middle pixels of each LEGO brick...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Brick: def __init__(self): """Initialize the class, Brick.""" self.height = 75 self.width = 75 self.cwd = os.getcwd() i = len(cwd) self.cwd = self.cwd[0:i - 5] self.path = self.cwd + '/Pick A Brick_LEGO_All_Bricks' self.filenames = ['Brick yellow...
the_stack_v2_python_sparse
Code/brick_color_class.py
kmmcconnaughay/teamLEGGO
train
0
1ec0e4fd20f1038da65dad85de6e3094b5ad0425
[ "today_date = fields.Date.context_today(self)\nfor tenancy in self:\n if not tenancy.paid:\n ten_date = tenancy.start_date\n if tenancy.tenancy_id.penalty_day != 0:\n ten_date = ten_date + relativedelta(days=int(tenancy.tenancy_id.penalty_day))\n if ten_date < today_date:\n ...
<|body_start_0|> today_date = fields.Date.context_today(self) for tenancy in self: if not tenancy.paid: ten_date = tenancy.start_date if tenancy.tenancy_id.penalty_day != 0: ten_date = ten_date + relativedelta(days=int(tenancy.tenancy_id.pe...
TenancyRentSchedule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenancyRentSchedule: def calculate_penalty(self): """This Method is used to calculate penalty. ----------------------------------------- @param self: The object pointer""" <|body_0|> def get_invloice_lines(self): """TO GET THE INVOICE LINES""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_020891
2,284
no_license
[ { "docstring": "This Method is used to calculate penalty. ----------------------------------------- @param self: The object pointer", "name": "calculate_penalty", "signature": "def calculate_penalty(self)" }, { "docstring": "TO GET THE INVOICE LINES", "name": "get_invloice_lines", "signa...
2
null
Implement the Python class `TenancyRentSchedule` described below. Class description: Implement the TenancyRentSchedule class. Method signatures and docstrings: - def calculate_penalty(self): This Method is used to calculate penalty. ----------------------------------------- @param self: The object pointer - def get_i...
Implement the Python class `TenancyRentSchedule` described below. Class description: Implement the TenancyRentSchedule class. Method signatures and docstrings: - def calculate_penalty(self): This Method is used to calculate penalty. ----------------------------------------- @param self: The object pointer - def get_i...
163136f382faa8607db8fb6cda42a5ba07c4076b
<|skeleton|> class TenancyRentSchedule: def calculate_penalty(self): """This Method is used to calculate penalty. ----------------------------------------- @param self: The object pointer""" <|body_0|> def get_invloice_lines(self): """TO GET THE INVOICE LINES""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TenancyRentSchedule: def calculate_penalty(self): """This Method is used to calculate penalty. ----------------------------------------- @param self: The object pointer""" today_date = fields.Date.context_today(self) for tenancy in self: if not tenancy.paid: ...
the_stack_v2_python_sparse
property_penalty_ee/models/property_penalty.py
maarejsys/Roya
train
0
d59f4502d400858c79e71d37651894ddf94ebb51
[ "self.feature_overusage = feature_overusage\nself.free_setup_mode = free_setup_mode\nself.is_trial = is_trial\nself.last_12_months_avg_entitlement = last_12_months_avg_entitlement\nself.last_12_months_avg_usage = last_12_months_avg_usage\nself.last_30_days_entitlement = last_30_days_entitlement\nself.last_30_days_u...
<|body_start_0|> self.feature_overusage = feature_overusage self.free_setup_mode = free_setup_mode self.is_trial = is_trial self.last_12_months_avg_entitlement = last_12_months_avg_entitlement self.last_12_months_avg_usage = last_12_months_avg_usage self.last_30_days_enti...
Implementation of the 'LicenseAccountUsageRsp' model. Structure to hold account usage response Attributes: feature_overusage (list of Overusage): Holds information about consumption usage of overused features free_setup_mode (bool): Free Setup Mode is_trial (bool): Check if trial license. last_12_months_avg_entitlement...
LicenseAccountUsageRsp
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LicenseAccountUsageRsp: """Implementation of the 'LicenseAccountUsageRsp' model. Structure to hold account usage response Attributes: feature_overusage (list of Overusage): Holds information about consumption usage of overused features free_setup_mode (bool): Free Setup Mode is_trial (bool): Chec...
stack_v2_sparse_classes_36k_train_020892
5,304
permissive
[ { "docstring": "Constructor for the LicenseAccountUsageRsp class", "name": "__init__", "signature": "def __init__(self, feature_overusage=None, free_setup_mode=None, is_trial=None, last_12_months_avg_entitlement=None, last_12_months_avg_usage=None, last_30_days_entitlement=None, last_30_days_usage=None,...
2
null
Implement the Python class `LicenseAccountUsageRsp` described below. Class description: Implementation of the 'LicenseAccountUsageRsp' model. Structure to hold account usage response Attributes: feature_overusage (list of Overusage): Holds information about consumption usage of overused features free_setup_mode (bool)...
Implement the Python class `LicenseAccountUsageRsp` described below. Class description: Implementation of the 'LicenseAccountUsageRsp' model. Structure to hold account usage response Attributes: feature_overusage (list of Overusage): Holds information about consumption usage of overused features free_setup_mode (bool)...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class LicenseAccountUsageRsp: """Implementation of the 'LicenseAccountUsageRsp' model. Structure to hold account usage response Attributes: feature_overusage (list of Overusage): Holds information about consumption usage of overused features free_setup_mode (bool): Free Setup Mode is_trial (bool): Chec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LicenseAccountUsageRsp: """Implementation of the 'LicenseAccountUsageRsp' model. Structure to hold account usage response Attributes: feature_overusage (list of Overusage): Holds information about consumption usage of overused features free_setup_mode (bool): Free Setup Mode is_trial (bool): Check if trial li...
the_stack_v2_python_sparse
cohesity_management_sdk/models/license_account_usage_rsp.py
cohesity/management-sdk-python
train
24
d5e575e421185418e5fe35d18c9c6f1aaae9dd29
[ "if not root:\n return ''\nq, v = ([root], [])\nj = 0\nwhile j < len(q):\n top = q[j]\n j += 1\n if not top:\n v.append('#')\n continue\n v.append(str(top.val))\n q.append(top.left)\n q.append(top.right)\nreturn '.'.join(v)", "if not data:\n return None\nv = data.split('.')\n...
<|body_start_0|> if not root: return '' q, v = ([root], []) j = 0 while j < len(q): top = q[j] j += 1 if not top: v.append('#') continue v.append(str(top.val)) q.append(top.left) ...
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_020893
2,284
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
46ab03e23d15ebd5434ef4dd5ae99130000b00a5
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return '' q, v = ([root], []) j = 0 while j < len(q): top = q[j] j += 1 if not top: v...
the_stack_v2_python_sparse
剑指offer/37_h_g_序列化二叉树.py
zhulf0804/Coding.Python
train
3
eca9b34b267e00712d798e7bdd47afb5cfbd5cdd
[ "super(PIDTimedLoop, self).__init__(period, num_period)\nself._pid = pid\nself._is_active = pid.poll() is None", "if not self._is_active:\n raise StopIteration\ntry:\n self._pid.wait(timeout=timeout)\n self._is_active = False\nexcept subprocess.TimeoutExpired:\n pass" ]
<|body_start_0|> super(PIDTimedLoop, self).__init__(period, num_period) self._pid = pid self._is_active = pid.poll() is None <|end_body_0|> <|body_start_1|> if not self._is_active: raise StopIteration try: self._pid.wait(timeout=timeout) self....
PIDTimedLoop
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PIDTimedLoop: def __init__(self, pid, period, num_period=None): """Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of time intervals requested, and that the first iteration is not delayed. The total amount of time spanned...
stack_v2_sparse_classes_36k_train_020894
13,068
permissive
[ { "docstring": "Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of time intervals requested, and that the first iteration is not delayed. The total amount of time spanned by the loop is the product of the two input parameters. To create an infin...
2
stack_v2_sparse_classes_30k_train_021520
Implement the Python class `PIDTimedLoop` described below. Class description: Implement the PIDTimedLoop class. Method signatures and docstrings: - def __init__(self, pid, period, num_period=None): Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of ti...
Implement the Python class `PIDTimedLoop` described below. Class description: Implement the PIDTimedLoop class. Method signatures and docstrings: - def __init__(self, pid, period, num_period=None): Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of ti...
8acb57ab057104612e24d436a92c3fc1a1aa37c0
<|skeleton|> class PIDTimedLoop: def __init__(self, pid, period, num_period=None): """Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of time intervals requested, and that the first iteration is not delayed. The total amount of time spanned...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PIDTimedLoop: def __init__(self, pid, period, num_period=None): """Similar to the TimedLoop but stop when subprocess ends The number of loops executed is one greater than the number of time intervals requested, and that the first iteration is not delayed. The total amount of time spanned by the loop i...
the_stack_v2_python_sparse
service/geopmdpy/runtime.py
dannosliwcd/geopm
train
0
26e18ad67eca384933d7128193e1b72cb95fb89a
[ "for val in nums:\n val = abs(val)\n if nums[val - 1] < 0:\n return val\n else:\n nums[val - 1] = -nums[val - 1]\nraise ValueError", "head = 0\ntail = len(nums) - 1\nwhile head < tail:\n mid = (tail - head) / 2 + head\n count = 0\n for num in nums:\n if num <= mid:\n ...
<|body_start_0|> for val in nums: val = abs(val) if nums[val - 1] < 0: return val else: nums[val - 1] = -nums[val - 1] raise ValueError <|end_body_0|> <|body_start_1|> head = 0 tail = len(nums) - 1 while head < ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicate(self, nums): """Since the element range will fit in the arr index range, and all value are positive, we can use the convert the value from positive to negative and negative value indicates that this index as a elemeng is seen already. Usually then asked for sp...
stack_v2_sparse_classes_36k_train_020895
2,401
no_license
[ { "docstring": "Since the element range will fit in the arr index range, and all value are positive, we can use the convert the value from positive to negative and negative value indicates that this index as a elemeng is seen already. Usually then asked for space complexity O(1), you need to modify the arr or m...
2
stack_v2_sparse_classes_30k_train_010730
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): Since the element range will fit in the arr index range, and all value are positive, we can use the convert the value from positive to negative and...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate(self, nums): Since the element range will fit in the arr index range, and all value are positive, we can use the convert the value from positive to negative and...
33c623f226981942780751554f0593f2c71cf458
<|skeleton|> class Solution: def findDuplicate(self, nums): """Since the element range will fit in the arr index range, and all value are positive, we can use the convert the value from positive to negative and negative value indicates that this index as a elemeng is seen already. Usually then asked for sp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findDuplicate(self, nums): """Since the element range will fit in the arr index range, and all value are positive, we can use the convert the value from positive to negative and negative value indicates that this index as a elemeng is seen already. Usually then asked for space complexity...
the_stack_v2_python_sparse
search/leetcode_Find_The_Duplicate_Number.py
monkeylyf/interviewjam
train
59
82381db6c92600a6f97e118455a8dcd1f7018200
[ "parser.add_argument('LINK_ID', help='ID of the linked dataset to create.')\nparser.add_argument('--description', help='A textual description for the linked dataset.')\nutil.AddParentArgs(parser, 'linked dataset to create')\nutil.AddBucketLocationArg(parser, True, 'Location of the bucket that will hold the linked d...
<|body_start_0|> parser.add_argument('LINK_ID', help='ID of the linked dataset to create.') parser.add_argument('--description', help='A textual description for the linked dataset.') util.AddParentArgs(parser, 'linked dataset to create') util.AddBucketLocationArg(parser, True, 'Location ...
Create a linked dataset on an analytics log bucket.
Create
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create: """Create a linked dataset on an analytics log bucket.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the argu...
stack_v2_sparse_classes_36k_train_020896
3,633
permissive
[ { "docstring": "Register flags for this command.", "name": "Args", "signature": "def Args(parser)" }, { "docstring": "This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Returns: Linked data...
2
null
Implement the Python class `Create` described below. Class description: Create a linked dataset on an analytics log bucket. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse na...
Implement the Python class `Create` described below. Class description: Create a linked dataset on an analytics log bucket. Method signatures and docstrings: - def Args(parser): Register flags for this command. - def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse na...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Create: """Create a linked dataset on an analytics log bucket.""" def Args(parser): """Register flags for this command.""" <|body_0|> def Run(self, args): """This is what gets called when the user runs this command. Args: args: an argparse namespace. All the argu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Create: """Create a linked dataset on an analytics log bucket.""" def Args(parser): """Register flags for this command.""" parser.add_argument('LINK_ID', help='ID of the linked dataset to create.') parser.add_argument('--description', help='A textual description for the linked dat...
the_stack_v2_python_sparse
lib/surface/logging/links/create.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
18149781f8d34af5b23ef5321bee6c4bf434b1c3
[ "if not hasattr(self, 'likes'):\n return 0\nreturn len(self.likes.all())", "if not hasattr(self, 'likes'):\n return False\nfor like in self.likes.all():\n if like.user.pk == user.pk:\n return True\nreturn False" ]
<|body_start_0|> if not hasattr(self, 'likes'): return 0 return len(self.likes.all()) <|end_body_0|> <|body_start_1|> if not hasattr(self, 'likes'): return False for like in self.likes.all(): if like.user.pk == user.pk: return True ...
Abstract class for models contain `likes`
LikeMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LikeMixin: """Abstract class for models contain `likes`""" def number_of_like(self): """Computed property, return the number of like""" <|body_0|> def is_liked_by_user(self, user): """Check if a user is liked this media""" <|body_1|> <|end_skeleton|> <|...
stack_v2_sparse_classes_36k_train_020897
1,902
no_license
[ { "docstring": "Computed property, return the number of like", "name": "number_of_like", "signature": "def number_of_like(self)" }, { "docstring": "Check if a user is liked this media", "name": "is_liked_by_user", "signature": "def is_liked_by_user(self, user)" } ]
2
stack_v2_sparse_classes_30k_train_011420
Implement the Python class `LikeMixin` described below. Class description: Abstract class for models contain `likes` Method signatures and docstrings: - def number_of_like(self): Computed property, return the number of like - def is_liked_by_user(self, user): Check if a user is liked this media
Implement the Python class `LikeMixin` described below. Class description: Abstract class for models contain `likes` Method signatures and docstrings: - def number_of_like(self): Computed property, return the number of like - def is_liked_by_user(self, user): Check if a user is liked this media <|skeleton|> class Li...
2f50b3815474845dd8c08f2a6f0213d5da3a5413
<|skeleton|> class LikeMixin: """Abstract class for models contain `likes`""" def number_of_like(self): """Computed property, return the number of like""" <|body_0|> def is_liked_by_user(self, user): """Check if a user is liked this media""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LikeMixin: """Abstract class for models contain `likes`""" def number_of_like(self): """Computed property, return the number of like""" if not hasattr(self, 'likes'): return 0 return len(self.likes.all()) def is_liked_by_user(self, user): """Check if a use...
the_stack_v2_python_sparse
utils/models.py
raviteja2250/tabletop-backend-develop
train
0
711f71d8d6a8742fa7e90fe73dd1413ef9e953ee
[ "contact = Contacts.query.order_by(desc(Contacts.Created)).first_or_404()\ncontent = jsonify({'contacts': [{'id': contact.ContactsID, 'email': contact.Email, 'techRider': contact.TechRider, 'inputList': contact.InputList, 'backline': contact.Backline, 'createdAt': contact.Created, 'updatedAt': contact.Updated}]})\n...
<|body_start_0|> contact = Contacts.query.order_by(desc(Contacts.Created)).first_or_404() content = jsonify({'contacts': [{'id': contact.ContactsID, 'email': contact.Email, 'techRider': contact.TechRider, 'inputList': contact.InputList, 'backline': contact.Backline, 'createdAt': contact.Created, 'update...
ContactsView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContactsView: def index(self): """Return the newest Contacts entry.""" <|body_0|> def post(self): """Add a new Contacts entry.""" <|body_1|> def patch(self): """Partially modify the newest contact.""" <|body_2|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_020898
2,412
permissive
[ { "docstring": "Return the newest Contacts entry.", "name": "index", "signature": "def index(self)" }, { "docstring": "Add a new Contacts entry.", "name": "post", "signature": "def post(self)" }, { "docstring": "Partially modify the newest contact.", "name": "patch", "sig...
3
stack_v2_sparse_classes_30k_train_017697
Implement the Python class `ContactsView` described below. Class description: Implement the ContactsView class. Method signatures and docstrings: - def index(self): Return the newest Contacts entry. - def post(self): Add a new Contacts entry. - def patch(self): Partially modify the newest contact.
Implement the Python class `ContactsView` described below. Class description: Implement the ContactsView class. Method signatures and docstrings: - def index(self): Return the newest Contacts entry. - def post(self): Add a new Contacts entry. - def patch(self): Partially modify the newest contact. <|skeleton|> class...
62f8e8e904e379541193f0cbb91a8434b47f538f
<|skeleton|> class ContactsView: def index(self): """Return the newest Contacts entry.""" <|body_0|> def post(self): """Add a new Contacts entry.""" <|body_1|> def patch(self): """Partially modify the newest contact.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContactsView: def index(self): """Return the newest Contacts entry.""" contact = Contacts.query.order_by(desc(Contacts.Created)).first_or_404() content = jsonify({'contacts': [{'id': contact.ContactsID, 'email': contact.Email, 'techRider': contact.TechRider, 'inputList': contact.InputL...
the_stack_v2_python_sparse
apps/contacts/views.py
Torniojaws/vortech-backend
train
0
8a4de9d85f86018c8ad2dae69f42da9d10f9af3b
[ "if not p and (not q):\n return True\nif not p or not q:\n return False\nif p.val != q.val:\n return self.isSameTree(p.left, q.left) and self.isSameTree(q.right, q.right)", "if not p and (not q):\n return True\nif not p or not q:\n return False\nqueue1 = collections.deque([q])\nqueue2 = collections...
<|body_start_0|> if not p and (not q): return True if not p or not q: return False if p.val != q.val: return self.isSameTree(p.left, q.left) and self.isSameTree(q.right, q.right) <|end_body_0|> <|body_start_1|> if not p and (not q): return...
题解思路:利用递归,暴力思路 如果q,p全空,那么自然完全相等返回True 如果有一个空,那么返回False 递归判断下一个节点
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """题解思路:利用递归,暴力思路 如果q,p全空,那么自然完全相等返回True 如果有一个空,那么返回False 递归判断下一个节点""" def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: """DFS 时间复杂度: O(min(m,n)) m和n 是p和q的深度 空间复杂度: O(min(m,n)) m和n 是p和q的深度 :param p: :param q: :return:""" <|body_0|> def isSameTree2(self, ...
stack_v2_sparse_classes_36k_train_020899
2,168
no_license
[ { "docstring": "DFS 时间复杂度: O(min(m,n)) m和n 是p和q的深度 空间复杂度: O(min(m,n)) m和n 是p和q的深度 :param p: :param q: :return:", "name": "isSameTree", "signature": "def isSameTree(self, p: TreeNode, q: TreeNode) -> bool" }, { "docstring": "BFS c :param p: :param q: :return:", "name": "isSameTree2", "sig...
2
stack_v2_sparse_classes_30k_train_004172
Implement the Python class `Solution` described below. Class description: 题解思路:利用递归,暴力思路 如果q,p全空,那么自然完全相等返回True 如果有一个空,那么返回False 递归判断下一个节点 Method signatures and docstrings: - def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: DFS 时间复杂度: O(min(m,n)) m和n 是p和q的深度 空间复杂度: O(min(m,n)) m和n 是p和q的深度 :param p: :param q: :...
Implement the Python class `Solution` described below. Class description: 题解思路:利用递归,暴力思路 如果q,p全空,那么自然完全相等返回True 如果有一个空,那么返回False 递归判断下一个节点 Method signatures and docstrings: - def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: DFS 时间复杂度: O(min(m,n)) m和n 是p和q的深度 空间复杂度: O(min(m,n)) m和n 是p和q的深度 :param p: :param q: :...
578cacff5851c5c2522981693c34e3c318002d30
<|skeleton|> class Solution: """题解思路:利用递归,暴力思路 如果q,p全空,那么自然完全相等返回True 如果有一个空,那么返回False 递归判断下一个节点""" def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: """DFS 时间复杂度: O(min(m,n)) m和n 是p和q的深度 空间复杂度: O(min(m,n)) m和n 是p和q的深度 :param p: :param q: :return:""" <|body_0|> def isSameTree2(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """题解思路:利用递归,暴力思路 如果q,p全空,那么自然完全相等返回True 如果有一个空,那么返回False 递归判断下一个节点""" def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: """DFS 时间复杂度: O(min(m,n)) m和n 是p和q的深度 空间复杂度: O(min(m,n)) m和n 是p和q的深度 :param p: :param q: :return:""" if not p and (not q): return True ...
the_stack_v2_python_sparse
相同的树.py
cjrzs/MyLeetCode
train
8