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
15a6e750bf7c510c90aaca33e9acb57fef87c0b2
[ "with pytest.raises(ValueError, match='Cannot request events with photon number below zero'):\n graph = nx.complete_graph(4)\n similarity.feature_vector_mc(graph, [-1, 4], 1)", "with pytest.raises(ValueError, match='Maximum number of photons per mode must be at least'):\n graph = nx.complete_graph(4)\n ...
<|body_start_0|> with pytest.raises(ValueError, match='Cannot request events with photon number below zero'): graph = nx.complete_graph(4) similarity.feature_vector_mc(graph, [-1, 4], 1) <|end_body_0|> <|body_start_1|> with pytest.raises(ValueError, match='Maximum number of phot...
Tests for the function ``strawberryfields.apps.graph.similarity.feature_vector_mc``
TestFeatureVectorMC
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFeatureVectorMC: """Tests for the function ``strawberryfields.apps.graph.similarity.feature_vector_mc``""" def test_bad_event_photon_numbers_mc(self): """Test if function raises a ``ValueError`` when input a minimum photon number that is below zero.""" <|body_0|> def...
stack_v2_sparse_classes_36k_train_027200
14,580
permissive
[ { "docstring": "Test if function raises a ``ValueError`` when input a minimum photon number that is below zero.", "name": "test_bad_event_photon_numbers_mc", "signature": "def test_bad_event_photon_numbers_mc(self)" }, { "docstring": "Test if function raises a ``ValueError`` when input a non-pos...
3
null
Implement the Python class `TestFeatureVectorMC` described below. Class description: Tests for the function ``strawberryfields.apps.graph.similarity.feature_vector_mc`` Method signatures and docstrings: - def test_bad_event_photon_numbers_mc(self): Test if function raises a ``ValueError`` when input a minimum photon ...
Implement the Python class `TestFeatureVectorMC` described below. Class description: Tests for the function ``strawberryfields.apps.graph.similarity.feature_vector_mc`` Method signatures and docstrings: - def test_bad_event_photon_numbers_mc(self): Test if function raises a ``ValueError`` when input a minimum photon ...
0c1c805fd5dfce465a8955ee3faf81037023a23e
<|skeleton|> class TestFeatureVectorMC: """Tests for the function ``strawberryfields.apps.graph.similarity.feature_vector_mc``""" def test_bad_event_photon_numbers_mc(self): """Test if function raises a ``ValueError`` when input a minimum photon number that is below zero.""" <|body_0|> def...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestFeatureVectorMC: """Tests for the function ``strawberryfields.apps.graph.similarity.feature_vector_mc``""" def test_bad_event_photon_numbers_mc(self): """Test if function raises a ``ValueError`` when input a minimum photon number that is below zero.""" with pytest.raises(ValueError, m...
the_stack_v2_python_sparse
artifacts/old_dataset_versions/original_commits_v02/strawberryfields/strawberryfields#194/after/test_similarity.py
MattePalte/Bugs-Quantum-Computing-Platforms
train
4
d490c244870ebe20a63289c8fdbc93370a2f2710
[ "self.ak = accesskey\nself.sk = secretkey\nself.region = region\nself.headtosign = ['Host', 'X-Sdk-Date']", "canonical_method = method.upper() if method else EMPTYSTRING\nuri = urlparse.urlparse(url).path\nuri = uri.replace(':', '%3A')\ncanonical_uri = uri if uri.endswith('/') else uri + '/'\nif params:\n resu...
<|body_start_0|> self.ak = accesskey self.sk = secretkey self.region = region self.headtosign = ['Host', 'X-Sdk-Date'] <|end_body_0|> <|body_start_1|> canonical_method = method.upper() if method else EMPTYSTRING uri = urlparse.urlparse(url).path uri = uri.replace...
AkSksignature
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AkSksignature: def __init__(self, accesskey=None, secretkey=None, region=None): """This class is used to sign the request header. The use method is to construct the class object and then call the signature method to generate the signature string. Create a signature for a ak sk session to...
stack_v2_sparse_classes_36k_train_027201
18,281
permissive
[ { "docstring": "This class is used to sign the request header. The use method is to construct the class object and then call the signature method to generate the signature string. Create a signature for a ak sk session to a cloud provider. The AkSksignature creates a :class:`~openstack.aksksession.AkSksignature...
5
stack_v2_sparse_classes_30k_train_003539
Implement the Python class `AkSksignature` described below. Class description: Implement the AkSksignature class. Method signatures and docstrings: - def __init__(self, accesskey=None, secretkey=None, region=None): This class is used to sign the request header. The use method is to construct the class object and then...
Implement the Python class `AkSksignature` described below. Class description: Implement the AkSksignature class. Method signatures and docstrings: - def __init__(self, accesskey=None, secretkey=None, region=None): This class is used to sign the request header. The use method is to construct the class object and then...
60d75438d71ffb7998f5dc407ffa890cc98d3171
<|skeleton|> class AkSksignature: def __init__(self, accesskey=None, secretkey=None, region=None): """This class is used to sign the request header. The use method is to construct the class object and then call the signature method to generate the signature string. Create a signature for a ak sk session to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AkSksignature: def __init__(self, accesskey=None, secretkey=None, region=None): """This class is used to sign the request header. The use method is to construct the class object and then call the signature method to generate the signature string. Create a signature for a ak sk session to a cloud provi...
the_stack_v2_python_sparse
openstack/aksksession.py
huaweicloudsdk/sdk-python
train
20
5513c0bd04c6232f6d7c5520c5dbc7348c9ed3ec
[ "best_buy = [float('-inf')] * (k + 1)\nbest_sell = [0] * (k + 1)\nfor i, price in enumerate(prices):\n for j in range(1, k + 1):\n best_buy[j] = max(best_buy[j], best_sell[j - 1] - price)\n best_sell[j] = max(best_sell[j], best_buy[j] + price)\nreturn best_sell[k]", "def max_profit_unlimited(pric...
<|body_start_0|> best_buy = [float('-inf')] * (k + 1) best_sell = [0] * (k + 1) for i, price in enumerate(prices): for j in range(1, k + 1): best_buy[j] = max(best_buy[j], best_sell[j - 1] - price) best_sell[j] = max(best_sell[j], best_buy[j] + price) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_optimized(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027202
2,800
no_license
[ { "docstring": ":type k: int :type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, k, prices)" }, { "docstring": ":type k: int :type prices: List[int] :rtype: int", "name": "maxProfit_optimized", "signature": "def maxProfit_optimized(self, k, prices...
2
stack_v2_sparse_classes_30k_train_006307
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int - def maxProfit_optimized(self, k, prices): :type k: int :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, k, prices): :type k: int :type prices: List[int] :rtype: int - def maxProfit_optimized(self, k, prices): :type k: int :type prices: List[int] :rtype: int <|s...
e60ba45fe2f2e5e3b3abfecec3db76f5ce1fde59
<|skeleton|> class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" <|body_0|> def maxProfit_optimized(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, k, prices): """:type k: int :type prices: List[int] :rtype: int""" best_buy = [float('-inf')] * (k + 1) best_sell = [0] * (k + 1) for i, price in enumerate(prices): for j in range(1, k + 1): best_buy[j] = max(best_buy[j]...
the_stack_v2_python_sparse
src/lt_188.py
oxhead/CodingYourWay
train
0
f0c9bd0e9b89962c6f417af23172ea536acfe5c9
[ "if current_user in self.event.guests:\n return jsonify({'status': 200, 'message': 'You are registered as a guest'})\nelif current_user in self.event.participants:\n return jsonify({'status': 200, 'message': 'You are registered as a participant'})\nelse:\n return jsonify({'status': 200, 'message': 'You are...
<|body_start_0|> if current_user in self.event.guests: return jsonify({'status': 200, 'message': 'You are registered as a guest'}) elif current_user in self.event.participants: return jsonify({'status': 200, 'message': 'You are registered as a participant'}) else: ...
Resource for registering and unregistering as a guest fo event
UserAsGuest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAsGuest: """Resource for registering and unregistering as a guest fo event""" def get(self, event_id: int) -> Response: """Method for checking registration as a guest Parameters ---------- event_id : int Event id Returns ------- Response Response message with status code""" ...
stack_v2_sparse_classes_36k_train_027203
6,917
no_license
[ { "docstring": "Method for checking registration as a guest Parameters ---------- event_id : int Event id Returns ------- Response Response message with status code", "name": "get", "signature": "def get(self, event_id: int) -> Response" }, { "docstring": "Method for registering as a guest Param...
3
stack_v2_sparse_classes_30k_train_019261
Implement the Python class `UserAsGuest` described below. Class description: Resource for registering and unregistering as a guest fo event Method signatures and docstrings: - def get(self, event_id: int) -> Response: Method for checking registration as a guest Parameters ---------- event_id : int Event id Returns --...
Implement the Python class `UserAsGuest` described below. Class description: Resource for registering and unregistering as a guest fo event Method signatures and docstrings: - def get(self, event_id: int) -> Response: Method for checking registration as a guest Parameters ---------- event_id : int Event id Returns --...
51e4d69f88c120cfc587fd007f21528a7bd661a0
<|skeleton|> class UserAsGuest: """Resource for registering and unregistering as a guest fo event""" def get(self, event_id: int) -> Response: """Method for checking registration as a guest Parameters ---------- event_id : int Event id Returns ------- Response Response message with status code""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserAsGuest: """Resource for registering and unregistering as a guest fo event""" def get(self, event_id: int) -> Response: """Method for checking registration as a guest Parameters ---------- event_id : int Event id Returns ------- Response Response message with status code""" if current...
the_stack_v2_python_sparse
flask_app/resources/guest.py
Kyrylo-Kotelevets/Flask_Events
train
0
6c921cedc11e8e67ca6e11221b1b5e1203b4c5f6
[ "super(Model, self).__init__()\nself.input_size_dyn = input_size_dyn\nself.input_size_stat = input_size_stat\nself.hidden_size = hidden_size\nself.initial_forget_bias = initial_forget_bias\nself.dropout_rate = dropout\nself.concat_static = concat_static\nself.no_static = no_static\nif self.concat_static or self.no_...
<|body_start_0|> super(Model, self).__init__() self.input_size_dyn = input_size_dyn self.input_size_stat = input_size_stat self.hidden_size = hidden_size self.initial_forget_bias = initial_forget_bias self.dropout_rate = dropout self.concat_static = concat_static ...
Wrapper class that connects LSTM/EA-LSTM with fully connceted layer
Model
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Model: """Wrapper class that connects LSTM/EA-LSTM with fully connceted layer""" def __init__(self, input_size_dyn: int, input_size_stat: int, hidden_size: int, initial_forget_bias: int=5, dropout: float=0.0, concat_static: bool=False, no_static: bool=False): """Initialize model. Par...
stack_v2_sparse_classes_36k_train_027204
26,253
permissive
[ { "docstring": "Initialize model. Parameters ---------- input_size_dyn: int Number of dynamic input features. input_size_stat: int Number of static input features (used in the EA-LSTM input gate). hidden_size: int Number of LSTM cells/hidden units. initial_forget_bias: int Value of the initial forget gate bias....
2
stack_v2_sparse_classes_30k_train_010754
Implement the Python class `Model` described below. Class description: Wrapper class that connects LSTM/EA-LSTM with fully connceted layer Method signatures and docstrings: - def __init__(self, input_size_dyn: int, input_size_stat: int, hidden_size: int, initial_forget_bias: int=5, dropout: float=0.0, concat_static: ...
Implement the Python class `Model` described below. Class description: Wrapper class that connects LSTM/EA-LSTM with fully connceted layer Method signatures and docstrings: - def __init__(self, input_size_dyn: int, input_size_stat: int, hidden_size: int, initial_forget_bias: int=5, dropout: float=0.0, concat_static: ...
88334091dec71ae43fe4256603d65045141936b5
<|skeleton|> class Model: """Wrapper class that connects LSTM/EA-LSTM with fully connceted layer""" def __init__(self, input_size_dyn: int, input_size_stat: int, hidden_size: int, initial_forget_bias: int=5, dropout: float=0.0, concat_static: bool=False, no_static: bool=False): """Initialize model. Par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Model: """Wrapper class that connects LSTM/EA-LSTM with fully connceted layer""" def __init__(self, input_size_dyn: int, input_size_stat: int, hidden_size: int, initial_forget_bias: int=5, dropout: float=0.0, concat_static: bool=False, no_static: bool=False): """Initialize model. Parameters -----...
the_stack_v2_python_sparse
src/evaluate/EALSTM_err_est_oversamp_norm2.py
jdwillard19/lake_conus_surface_temp_2021
train
0
544488cdea87a6adc270543132613ac171fec0ad
[ "super(DataQualityOperator, self).__init__(*args, **kwargs)\nself.redshift_conn_id = redshift_conn_id\nself.table = table\nself.sql_query = sql_query\nself.at_least = at_least\nself.equals = equals", "if self.at_least and type(self.at_least) is str:\n self.at_least = int(self.at_least)\nif self.equals and type...
<|body_start_0|> super(DataQualityOperator, self).__init__(*args, **kwargs) self.redshift_conn_id = redshift_conn_id self.table = table self.sql_query = sql_query self.at_least = at_least self.equals = equals <|end_body_0|> <|body_start_1|> if self.at_least and t...
The DataQualityOperator performs data validation on tables after data has been inserted. Data validation can be don either against the `at_least` or `equals` arguments.
DataQualityOperator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataQualityOperator: """The DataQualityOperator performs data validation on tables after data has been inserted. Data validation can be don either against the `at_least` or `equals` arguments.""" def __init__(self, redshift_conn_id='', table='', sql_query='', at_least=None, equals=None, *arg...
stack_v2_sparse_classes_36k_train_027205
2,983
no_license
[ { "docstring": "Init method for the operator Args: redshift_conn_id Connection information for the datbase table Name of table to check sql_query Query to execute for getting row count at_least At least this many rows need to exist in the table if value set. equals Row count in table must match specified value....
2
stack_v2_sparse_classes_30k_train_016948
Implement the Python class `DataQualityOperator` described below. Class description: The DataQualityOperator performs data validation on tables after data has been inserted. Data validation can be don either against the `at_least` or `equals` arguments. Method signatures and docstrings: - def __init__(self, redshift_...
Implement the Python class `DataQualityOperator` described below. Class description: The DataQualityOperator performs data validation on tables after data has been inserted. Data validation can be don either against the `at_least` or `equals` arguments. Method signatures and docstrings: - def __init__(self, redshift_...
27930a41a6de6049a05375f488c9ac94608ed2fe
<|skeleton|> class DataQualityOperator: """The DataQualityOperator performs data validation on tables after data has been inserted. Data validation can be don either against the `at_least` or `equals` arguments.""" def __init__(self, redshift_conn_id='', table='', sql_query='', at_least=None, equals=None, *arg...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataQualityOperator: """The DataQualityOperator performs data validation on tables after data has been inserted. Data validation can be don either against the `at_least` or `equals` arguments.""" def __init__(self, redshift_conn_id='', table='', sql_query='', at_least=None, equals=None, *args, **kwargs):...
the_stack_v2_python_sparse
06-capstone-project/airflow/plugins/operators/data_quality.py
mvillafuertem/udacity-data-engineer-nanodegree
train
0
a769aabb21e4f95eb3bd46093b24f4cd0406b2a2
[ "if x < 0:\n return False\ncount = 0\ny = x\nwhile y:\n count += 1\n y = y // 10\ncount -= 1\nwhile x and count:\n decimal = False\n if x >= 10:\n decimal = True\n up = x // 10 ** count\n x = x % 10 ** count\n if x == 0:\n if decimal:\n return False\n return T...
<|body_start_0|> if x < 0: return False count = 0 y = x while y: count += 1 y = y // 10 count -= 1 while x and count: decimal = False if x >= 10: decimal = True up = x // 10 ** count ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome_failed(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x < 0: return False count = 0 ...
stack_v2_sparse_classes_36k_train_027206
3,011
no_license
[ { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, x)" }, { "docstring": ":type x: int :rtype: bool", "name": "isPalindrome_failed", "signature": "def isPalindrome_failed(self, x)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome_failed(self, x): :type x: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome(self, x): :type x: int :rtype: bool - def isPalindrome_failed(self, x): :type x: int :rtype: bool <|skeleton|> class Solution: def isPalindrome(self, x): ...
93266095329e2e8e949a72371b88b07382a60e0d
<|skeleton|> class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" <|body_0|> def isPalindrome_failed(self, x): """:type x: int :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome(self, x): """:type x: int :rtype: bool""" if x < 0: return False count = 0 y = x while y: count += 1 y = y // 10 count -= 1 while x and count: decimal = False if x >= ...
the_stack_v2_python_sparse
isPalindrome_9.py
shivangi-prog/leetcode
train
0
02146d82c21ec828cfd31d3abd5dcadaa22d4923
[ "self._future = future\nself._callback = callback\nself._running_callback = False", "response = self._future.wait()\nself._running_callback = True\nreturn self._callback(response)", "if self._running_callback:\n return False\nreturn self._future.cancel()" ]
<|body_start_0|> self._future = future self._callback = callback self._running_callback = False <|end_body_0|> <|body_start_1|> response = self._future.wait() self._running_callback = True return self._callback(response) <|end_body_1|> <|body_start_2|> if self._...
Internal base class with common attributes for Result implementations. Subclasses will not inherit this docstring and should not use it. Instead, they should use _doc.
_Result
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Result: """Internal base class with common attributes for Result implementations. Subclasses will not inherit this docstring and should not use it. Instead, they should use _doc.""" def __init__(self, future, callback): """:arg original: The future this depends on. For example, a Tr...
stack_v2_sparse_classes_36k_train_027207
2,610
no_license
[ { "docstring": ":arg original: The future this depends on. For example, a Transfer which returns a Response from wait(). :arg callback: A callback which takes one argument. Whatever this returns will be returned by wait(). For example, a parse function which takes a Response and returns a Route.", "name": "...
3
stack_v2_sparse_classes_30k_train_000851
Implement the Python class `_Result` described below. Class description: Internal base class with common attributes for Result implementations. Subclasses will not inherit this docstring and should not use it. Instead, they should use _doc. Method signatures and docstrings: - def __init__(self, future, callback): :ar...
Implement the Python class `_Result` described below. Class description: Internal base class with common attributes for Result implementations. Subclasses will not inherit this docstring and should not use it. Instead, they should use _doc. Method signatures and docstrings: - def __init__(self, future, callback): :ar...
71db923df2862ff246755f1d819b0eecc76960ef
<|skeleton|> class _Result: """Internal base class with common attributes for Result implementations. Subclasses will not inherit this docstring and should not use it. Instead, they should use _doc.""" def __init__(self, future, callback): """:arg original: The future this depends on. For example, a Tr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Result: """Internal base class with common attributes for Result implementations. Subclasses will not inherit this docstring and should not use it. Instead, they should use _doc.""" def __init__(self, future, callback): """:arg original: The future this depends on. For example, a Transfer which ...
the_stack_v2_python_sparse
because/_future_base.py
jrbeckwith/because
train
3
e1ada5ffa37343f5d6ff2475231eeaf0e32d1efa
[ "citations.sort()\ncitations.reverse()\ncount = 0\nfor i, num in enumerate(citations, 1):\n if num >= i:\n count += 1\nreturn count", "table = [0] * (len(citations) + 1)\nfor num in citations:\n if num > len(citations):\n table[-1] += 1\n continue\n table[num] += 1\nresult = 0\nfor i...
<|body_start_0|> citations.sort() citations.reverse() count = 0 for i, num in enumerate(citations, 1): if num >= i: count += 1 return count <|end_body_0|> <|body_start_1|> table = [0] * (len(citations) + 1) for num in citations: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hIndex_slow(self, citations): """:type citations: List[int] :rtype: int""" <|body_0|> def hIndex_linear(self, citations): """:type citations: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> citations.sort() ...
stack_v2_sparse_classes_36k_train_027208
882
no_license
[ { "docstring": ":type citations: List[int] :rtype: int", "name": "hIndex_slow", "signature": "def hIndex_slow(self, citations)" }, { "docstring": ":type citations: List[int] :rtype: int", "name": "hIndex_linear", "signature": "def hIndex_linear(self, citations)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hIndex_slow(self, citations): :type citations: List[int] :rtype: int - def hIndex_linear(self, citations): :type citations: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hIndex_slow(self, citations): :type citations: List[int] :rtype: int - def hIndex_linear(self, citations): :type citations: List[int] :rtype: int <|skeleton|> class Solution...
e61776bcfd5d93c663b247d71e00f1b298683714
<|skeleton|> class Solution: def hIndex_slow(self, citations): """:type citations: List[int] :rtype: int""" <|body_0|> def hIndex_linear(self, citations): """:type citations: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hIndex_slow(self, citations): """:type citations: List[int] :rtype: int""" citations.sort() citations.reverse() count = 0 for i, num in enumerate(citations, 1): if num >= i: count += 1 return count def hIndex_linear...
the_stack_v2_python_sparse
bloomberg/h_index.py
Omega094/lc_practice
train
0
b38989d148a7bdbe085c2511acd1689c1b1fa96c
[ "if minfo is None:\n minfo = {}\nsuper(ResetStatsMessage, self).__init__(minfo)\nself.IsSystemMessage = False\nself.IsForward = True\nself.IsReliable = True\nself.DomainList = minfo.get('DomainList', [])\nself.MetricList = minfo.get('MetricList', [])", "result = super(ResetStatsMessage, self).dump()\nresult['D...
<|body_start_0|> if minfo is None: minfo = {} super(ResetStatsMessage, self).__init__(minfo) self.IsSystemMessage = False self.IsForward = True self.IsReliable = True self.DomainList = minfo.get('DomainList', []) self.MetricList = minfo.get('MetricList...
Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rules. IsForward (bool): Whether the message sho...
ResetStatsMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResetStatsMessage: """Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rul...
stack_v2_sparse_classes_36k_train_027209
13,482
permissive
[ { "docstring": "Constructor for the ResetStatsMessage class. Args: minfo (dict): Dictionary of values for message fields.", "name": "__init__", "signature": "def __init__(self, minfo=None)" }, { "docstring": "Dumps a dict containing object attributes. Returns: dict: A mapping of object attribute...
2
stack_v2_sparse_classes_30k_val_000454
Implement the Python class `ResetStatsMessage` described below. Class description: Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System mess...
Implement the Python class `ResetStatsMessage` described below. Class description: Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System mess...
8f4ca1aab54ef420a0db10c8ca822ec8686cd423
<|skeleton|> class ResetStatsMessage: """Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResetStatsMessage: """Reset stats messages are sent to a peer node to request it to reset statistics. Attributes: ResetStatsMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this is a system message. System messages have special delivery priority rules. IsForward...
the_stack_v2_python_sparse
validator/gossip/messages/gossip_debug.py
aludvik/sawtooth-core
train
0
b7256234838ebc0ff2cb38d2452c03ad780a3213
[ "account = Account.objects.create(firstname='Test', lastname='Test', email='test@email.com')\npost = Post.objects.create(title='Test Title', content='Test Content', account=account)\nPostComment.objects.create(post=post, account=account, comment='Comment 1')\nPostComment.objects.create(post=post, account=account, c...
<|body_start_0|> account = Account.objects.create(firstname='Test', lastname='Test', email='test@email.com') post = Post.objects.create(title='Test Title', content='Test Content', account=account) PostComment.objects.create(post=post, account=account, comment='Comment 1') PostComment.obj...
Test class for the PostCommentListView
PostCommentViewTests
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostCommentViewTests: """Test class for the PostCommentListView""" def setUp(self): """Set up variables for tests""" <|body_0|> def test_status_code(self): """Test status code response from endpoint""" <|body_1|> def test_list(self): """Test ...
stack_v2_sparse_classes_36k_train_027210
15,306
permissive
[ { "docstring": "Set up variables for tests", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test status code response from endpoint", "name": "test_status_code", "signature": "def test_status_code(self)" }, { "docstring": "Test list function in PostCommentView...
6
stack_v2_sparse_classes_30k_train_021329
Implement the Python class `PostCommentViewTests` described below. Class description: Test class for the PostCommentListView Method signatures and docstrings: - def setUp(self): Set up variables for tests - def test_status_code(self): Test status code response from endpoint - def test_list(self): Test list function i...
Implement the Python class `PostCommentViewTests` described below. Class description: Test class for the PostCommentListView Method signatures and docstrings: - def setUp(self): Set up variables for tests - def test_status_code(self): Test status code response from endpoint - def test_list(self): Test list function i...
a364e9997c1c91b09f5db8a004deb4df305fa8cf
<|skeleton|> class PostCommentViewTests: """Test class for the PostCommentListView""" def setUp(self): """Set up variables for tests""" <|body_0|> def test_status_code(self): """Test status code response from endpoint""" <|body_1|> def test_list(self): """Test ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostCommentViewTests: """Test class for the PostCommentListView""" def setUp(self): """Set up variables for tests""" account = Account.objects.create(firstname='Test', lastname='Test', email='test@email.com') post = Post.objects.create(title='Test Title', content='Test Content', a...
the_stack_v2_python_sparse
libStash/blogs/tests.py
Dev-Rem/libStash
train
0
821ced1924541beac87d68d2066ca75365cf22ed
[ "a1, a2 = ([], [])\nwhile l1:\n a1.append(l1.val)\n l1 = l1.next\nwhile l2:\n a2.append(l2.val)\n l2 = l2.next\ns1 = ''\nfor i in range(len(a1) - 1, -1, -1):\n s1 = s1 + str(a1[i])\ns2 = ''\nfor j in range(len(a2) - 1, -1, -1):\n s2 = s2 + str(a2[j])\nm1, m2 = (int(s1), int(s2))\nm3 = str(m1 + m2)...
<|body_start_0|> a1, a2 = ([], []) while l1: a1.append(l1.val) l1 = l1.next while l2: a2.append(l2.val) l2 = l2.next s1 = '' for i in range(len(a1) - 1, -1, -1): s1 = s1 + str(a1[i]) s2 = '' for j in rang...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: """正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串,并插入空链表,最后可返回结果链表 地址:https://leetcode-cn.com/problems/add-two-numbers/solution/liang-shu-xiang-ji...
stack_v2_sparse_classes_36k_train_027211
7,511
no_license
[ { "docstring": "正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串,并插入空链表,最后可返回结果链表 地址:https://leetcode-cn.com/problems/add-two-numbers/solution/liang-shu-xiang-jia-by-xing-yun-de-bei-ji-lang/ # 注意此思路没问题,结果有问题。。。。 :param l1: :param l2: :return:", ...
3
stack_v2_sparse_classes_30k_train_011128
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: 正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: 正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串...
51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a
<|skeleton|> class Solution: def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: """正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串,并插入空链表,最后可返回结果链表 地址:https://leetcode-cn.com/problems/add-two-numbers/solution/liang-shu-xiang-ji...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def addTwoNumbers1(self, l1: ListNode, l2: ListNode) -> ListNode: """正向思维,根据题意直推法,先将两个链表转换成列表形式 为了计算两个链表之和,将列表转成字符串形式,再将字符串转成 int型 此时计算出和,因为最后返回的是链表形式,所以计算出和之后,将和值转为字符串 然后再从后往前遍历字符串,并插入空链表,最后可返回结果链表 地址:https://leetcode-cn.com/problems/add-two-numbers/solution/liang-shu-xiang-jia-by-xing-yun-...
the_stack_v2_python_sparse
LeetCode_practice/LinkedList/0002_AddTwoNumbers.py
LeBron-Jian/BasicAlgorithmPractice
train
13
31960e3bc7f4660d6f8f35a3f50da1109ca5e881
[ "tmp = 0\nfor ele in nums:\n if ele == target:\n tmp += 1\nreturn tmp", "def find_target(target):\n i, j = (0, len(nums) - 1)\n while i <= j:\n mid = (i + j) // 2\n if nums[mid] <= target:\n i = mid + 1\n else:\n j = mid - 1\n return i\nreturn find_tar...
<|body_start_0|> tmp = 0 for ele in nums: if ele == target: tmp += 1 return tmp <|end_body_0|> <|body_start_1|> def find_target(target): i, j = (0, len(nums) - 1) while i <= j: mid = (i + j) // 2 if nums...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums: List[int], target: int) -> int: """遍历 :param nums: :param target: :return:""" <|body_0|> def search(self, nums: List[int], target: int) -> int: """排序树组, 所以可以用两次二分查找, 寻找左边界target-1和右边界target 如果最后一个数是target,找右边界时 i 必须等于 j, 所以while i<=j ...
stack_v2_sparse_classes_36k_train_027212
1,575
no_license
[ { "docstring": "遍历 :param nums: :param target: :return:", "name": "search", "signature": "def search(self, nums: List[int], target: int) -> int" }, { "docstring": "排序树组, 所以可以用两次二分查找, 寻找左边界target-1和右边界target 如果最后一个数是target,找右边界时 i 必须等于 j, 所以while i<=j :param nums: :param target: :return:", "n...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums: List[int], target: int) -> int: 遍历 :param nums: :param target: :return: - def search(self, nums: List[int], target: int) -> int: 排序树组, 所以可以用两次二分查找, 寻找左边界ta...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums: List[int], target: int) -> int: 遍历 :param nums: :param target: :return: - def search(self, nums: List[int], target: int) -> int: 排序树组, 所以可以用两次二分查找, 寻找左边界ta...
b1680014ce3f55ba952a1e64241c0cbb783cc436
<|skeleton|> class Solution: def search(self, nums: List[int], target: int) -> int: """遍历 :param nums: :param target: :return:""" <|body_0|> def search(self, nums: List[int], target: int) -> int: """排序树组, 所以可以用两次二分查找, 寻找左边界target-1和右边界target 如果最后一个数是target,找右边界时 i 必须等于 j, 所以while i<=j ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def search(self, nums: List[int], target: int) -> int: """遍历 :param nums: :param target: :return:""" tmp = 0 for ele in nums: if ele == target: tmp += 1 return tmp def search(self, nums: List[int], target: int) -> int: """排序树组,...
the_stack_v2_python_sparse
53_1.py
sun510001/leetcode_jianzhi_offer_2
train
0
f6c01432cbbf8dde67242911ff17c0f4114d67e7
[ "self.sess = requests.session()\nself.username = username\nself.password = password\nself.token = ''\nself.expiretime = -1\nself.special_topic_id = special_topic_id\nself.start_floor = start_floor", "login_data = {'client_id': '9a1fd200-8687-44b1-4c20-08d50a96e5cd', 'client_secret': '8b53f727-08e2-4509-8857-e34bf...
<|body_start_0|> self.sess = requests.session() self.username = username self.password = password self.token = '' self.expiretime = -1 self.special_topic_id = special_topic_id self.start_floor = start_floor <|end_body_0|> <|body_start_1|> login_data = {'c...
CC98
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CC98: def __init__(self, username, password, special_topic_id, start_floor): """初始化。 :param username: 用户名 :param password: 密码""" <|body_0|> def login(self): """发起登录请求 以获取access_token 存入self.token 并将过期时间写入self.expiretime""" <|body_1|> def get_topic_post(s...
stack_v2_sparse_classes_36k_train_027213
5,050
permissive
[ { "docstring": "初始化。 :param username: 用户名 :param password: 密码", "name": "__init__", "signature": "def __init__(self, username, password, special_topic_id, start_floor)" }, { "docstring": "发起登录请求 以获取access_token 存入self.token 并将过期时间写入self.expiretime", "name": "login", "signature": "def log...
5
stack_v2_sparse_classes_30k_train_020290
Implement the Python class `CC98` described below. Class description: Implement the CC98 class. Method signatures and docstrings: - def __init__(self, username, password, special_topic_id, start_floor): 初始化。 :param username: 用户名 :param password: 密码 - def login(self): 发起登录请求 以获取access_token 存入self.token 并将过期时间写入self.e...
Implement the Python class `CC98` described below. Class description: Implement the CC98 class. Method signatures and docstrings: - def __init__(self, username, password, special_topic_id, start_floor): 初始化。 :param username: 用户名 :param password: 密码 - def login(self): 发起登录请求 以获取access_token 存入self.token 并将过期时间写入self.e...
a98d2a2df168b93531c32c5bd57917c194421a00
<|skeleton|> class CC98: def __init__(self, username, password, special_topic_id, start_floor): """初始化。 :param username: 用户名 :param password: 密码""" <|body_0|> def login(self): """发起登录请求 以获取access_token 存入self.token 并将过期时间写入self.expiretime""" <|body_1|> def get_topic_post(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CC98: def __init__(self, username, password, special_topic_id, start_floor): """初始化。 :param username: 用户名 :param password: 密码""" self.sess = requests.session() self.username = username self.password = password self.token = '' self.expiretime = -1 self.sp...
the_stack_v2_python_sparse
8. CC98拼车信息批量汇总/pinche.py
2222RyanLee/ZJU-toolkit
train
0
2ca1ec20745f4cf0e43e5c0b22c205a1108d9f79
[ "self._checkpoint_every_n = checkpoint_every_n\nrun_experiment.Runner.__init__(self, base_dir, create_agent_fn, **kwargs)\nself._training_steps = int(self._training_steps * self._agent._gin_param_multiplier)", "self._checkpointer = checkpointer.Checkpointer(self._checkpoint_dir, checkpoint_file_prefix, checkpoint...
<|body_start_0|> self._checkpoint_every_n = checkpoint_every_n run_experiment.Runner.__init__(self, base_dir, create_agent_fn, **kwargs) self._training_steps = int(self._training_steps * self._agent._gin_param_multiplier) <|end_body_0|> <|body_start_1|> self._checkpointer = checkpointer...
Extends the base Runner for every-n-step checkpoint writing.
ElephantRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ElephantRunner: """Extends the base Runner for every-n-step checkpoint writing.""" def __init__(self, base_dir, create_agent_fn, checkpoint_every_n=1, **kwargs): """Initialize the Runner object in charge of running a full experiment. Args: base_dir: str, the base directory to host al...
stack_v2_sparse_classes_36k_train_027214
6,020
permissive
[ { "docstring": "Initialize the Runner object in charge of running a full experiment. Args: base_dir: str, the base directory to host all required sub-directories. create_agent_fn: A function that takes as args a Tensorflow session and an environment, and returns an agent. checkpoint_every_n: int, the frequency ...
3
stack_v2_sparse_classes_30k_train_020323
Implement the Python class `ElephantRunner` described below. Class description: Extends the base Runner for every-n-step checkpoint writing. Method signatures and docstrings: - def __init__(self, base_dir, create_agent_fn, checkpoint_every_n=1, **kwargs): Initialize the Runner object in charge of running a full exper...
Implement the Python class `ElephantRunner` described below. Class description: Extends the base Runner for every-n-step checkpoint writing. Method signatures and docstrings: - def __init__(self, base_dir, create_agent_fn, checkpoint_every_n=1, **kwargs): Initialize the Runner object in charge of running a full exper...
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
<|skeleton|> class ElephantRunner: """Extends the base Runner for every-n-step checkpoint writing.""" def __init__(self, base_dir, create_agent_fn, checkpoint_every_n=1, **kwargs): """Initialize the Runner object in charge of running a full experiment. Args: base_dir: str, the base directory to host al...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ElephantRunner: """Extends the base Runner for every-n-step checkpoint writing.""" def __init__(self, base_dir, create_agent_fn, checkpoint_every_n=1, **kwargs): """Initialize the Runner object in charge of running a full experiment. Args: base_dir: str, the base directory to host all required su...
the_stack_v2_python_sparse
experience_replay/run_experience_replay_experiment.py
Ayoob7/google-research
train
2
d9a3588699d934f25cedb6b3cd5b3bffc02a1cdf
[ "Parametre.__init__(self, 'dupliquer', 'duplicate')\nself.nom_groupe = 'administrateur'\nself.schema = '<nombre> <depuis:nombre>'\nself.aide_courte = 'marque un rapport comme dupliqué'\nself.aide_longue = \"Cette commande est un raccourci pour indiquer qu'un rapport est une duplication d'un autre rapport. Il attend...
<|body_start_0|> Parametre.__init__(self, 'dupliquer', 'duplicate') self.nom_groupe = 'administrateur' self.schema = '<nombre> <depuis:nombre>' self.aide_courte = 'marque un rapport comme dupliqué' self.aide_longue = "Cette commande est un raccourci pour indiquer qu'un rapport es...
Commande 'rapport dupliquer'
PrmDupliquer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PrmDupliquer: """Commande 'rapport dupliquer'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027215
3,853
permissive
[ { "docstring": "Constructeur du paramètre.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Méthode d'interprétation de commande", "name": "interpreter", "signature": "def interpreter(self, personnage, dic_masques)" } ]
2
null
Implement the Python class `PrmDupliquer` described below. Class description: Commande 'rapport dupliquer' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
Implement the Python class `PrmDupliquer` described below. Class description: Commande 'rapport dupliquer' Method signatures and docstrings: - def __init__(self): Constructeur du paramètre. - def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande <|skeleton|> class PrmDupliquer: """...
7e93bff08cdf891352efba587e89c40f3b4a2301
<|skeleton|> class PrmDupliquer: """Commande 'rapport dupliquer'""" def __init__(self): """Constructeur du paramètre.""" <|body_0|> def interpreter(self, personnage, dic_masques): """Méthode d'interprétation de commande""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PrmDupliquer: """Commande 'rapport dupliquer'""" def __init__(self): """Constructeur du paramètre.""" Parametre.__init__(self, 'dupliquer', 'duplicate') self.nom_groupe = 'administrateur' self.schema = '<nombre> <depuis:nombre>' self.aide_courte = 'marque un rappor...
the_stack_v2_python_sparse
src/secondaires/rapport/commandes/rapport/dupliquer.py
vincent-lg/tsunami
train
5
904ad16643d5390cce6f3eca7e91341367fa2cb0
[ "num_classes = 10\ninputs = np.random.rand(2, input_size, input_size, 3)\ntf.keras.backend.set_image_data_format('channels_last')\nbackbone = backbones.ResNet(model_id=50)\ndecoder = fpn.FPN(input_specs=backbone.output_specs, min_level=2, max_level=7)\nhead = segmentation_heads.SegmentationHead(num_classes, level=l...
<|body_start_0|> num_classes = 10 inputs = np.random.rand(2, input_size, input_size, 3) tf.keras.backend.set_image_data_format('channels_last') backbone = backbones.ResNet(model_id=50) decoder = fpn.FPN(input_specs=backbone.output_specs, min_level=2, max_level=7) head = s...
SegmentationNetworkTest
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SegmentationNetworkTest: def test_segmentation_network_creation(self, input_size, level): """Test for creation of a segmentation network.""" <|body_0|> def test_serialize_deserialize(self): """Validate the network can be serialized and deserialized.""" <|body...
stack_v2_sparse_classes_36k_train_027216
2,881
permissive
[ { "docstring": "Test for creation of a segmentation network.", "name": "test_segmentation_network_creation", "signature": "def test_segmentation_network_creation(self, input_size, level)" }, { "docstring": "Validate the network can be serialized and deserialized.", "name": "test_serialize_de...
2
null
Implement the Python class `SegmentationNetworkTest` described below. Class description: Implement the SegmentationNetworkTest class. Method signatures and docstrings: - def test_segmentation_network_creation(self, input_size, level): Test for creation of a segmentation network. - def test_serialize_deserialize(self)...
Implement the Python class `SegmentationNetworkTest` described below. Class description: Implement the SegmentationNetworkTest class. Method signatures and docstrings: - def test_segmentation_network_creation(self, input_size, level): Test for creation of a segmentation network. - def test_serialize_deserialize(self)...
6fc53292b1d3ce3c0340ce724c2c11c77e663d27
<|skeleton|> class SegmentationNetworkTest: def test_segmentation_network_creation(self, input_size, level): """Test for creation of a segmentation network.""" <|body_0|> def test_serialize_deserialize(self): """Validate the network can be serialized and deserialized.""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SegmentationNetworkTest: def test_segmentation_network_creation(self, input_size, level): """Test for creation of a segmentation network.""" num_classes = 10 inputs = np.random.rand(2, input_size, input_size, 3) tf.keras.backend.set_image_data_format('channels_last') ba...
the_stack_v2_python_sparse
models/official/vision/beta/modeling/segmentation_model_test.py
aboerzel/German_License_Plate_Recognition
train
34
71ea0b59ded2cafb3682c273ef8162b42e75a88c
[ "dummy = ListNode(-1)\ndummy.next = head\nprev_node = dummy\nwhile head and head.next:\n first_node = head\n second_node = head.next\n prev_node.next = second_node\n first_node.next = second_node.next\n second_node.next = first_node\n prev_node = first_node\n head = first_node.next\nreturn dumm...
<|body_start_0|> dummy = ListNode(-1) dummy.next = head prev_node = dummy while head and head.next: first_node = head second_node = head.next prev_node.next = second_node first_node.next = second_node.next second_node.next = fir...
LinkedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkedList: def swap_all_pairs(self, head: 'ListNode') -> 'ListNode': """Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :return:""" <|body_0|> def swap_pairs(self, head: 'ListNode') -> 'ListNode': """Approach: Recursion Time Complexity:...
stack_v2_sparse_classes_36k_train_027217
1,439
no_license
[ { "docstring": "Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :return:", "name": "swap_all_pairs", "signature": "def swap_all_pairs(self, head: 'ListNode') -> 'ListNode'" }, { "docstring": "Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param he...
2
null
Implement the Python class `LinkedList` described below. Class description: Implement the LinkedList class. Method signatures and docstrings: - def swap_all_pairs(self, head: 'ListNode') -> 'ListNode': Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :return: - def swap_pairs(self, head: ...
Implement the Python class `LinkedList` described below. Class description: Implement the LinkedList class. Method signatures and docstrings: - def swap_all_pairs(self, head: 'ListNode') -> 'ListNode': Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :return: - def swap_pairs(self, head: ...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class LinkedList: def swap_all_pairs(self, head: 'ListNode') -> 'ListNode': """Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :return:""" <|body_0|> def swap_pairs(self, head: 'ListNode') -> 'ListNode': """Approach: Recursion Time Complexity:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkedList: def swap_all_pairs(self, head: 'ListNode') -> 'ListNode': """Approach: Iterative Time Complexity: O(N) Space Complexity: O(1) :param head: :return:""" dummy = ListNode(-1) dummy.next = head prev_node = dummy while head and head.next: first_node =...
the_stack_v2_python_sparse
revisited/linked_list/swap_pairs_from_nodes.py
Shiv2157k/leet_code
train
1
876c4c5ad2e05d9566d11a448648a417ac961d7d
[ "request = self.context['request']\nLocationRelationContentTypeSerializer = location_relation_serializers['LocationRelationContentTypeSerializer']\nrelated_content = get_related_content(obj, LocationRelationContentTypeSerializer, obj.location_relation_relation, request)\nreturn related_content", "request = self.c...
<|body_start_0|> request = self.context['request'] LocationRelationContentTypeSerializer = location_relation_serializers['LocationRelationContentTypeSerializer'] related_content = get_related_content(obj, LocationRelationContentTypeSerializer, obj.location_relation_relation, request) ret...
Serialize an object based on a provided field
LocationFieldMethodSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationFieldMethodSerializer: """Serialize an object based on a provided field""" def get_climate_conditions(self, obj): """Get related object type data :param obj: Current record object :return: Related content type :rtype: Object/record""" <|body_0|> def get_soils(sel...
stack_v2_sparse_classes_36k_train_027218
7,095
permissive
[ { "docstring": "Get related object type data :param obj: Current record object :return: Related content type :rtype: Object/record", "name": "get_climate_conditions", "signature": "def get_climate_conditions(self, obj)" }, { "docstring": "Get related soil data :param obj: Current record object :...
3
stack_v2_sparse_classes_30k_train_012580
Implement the Python class `LocationFieldMethodSerializer` described below. Class description: Serialize an object based on a provided field Method signatures and docstrings: - def get_climate_conditions(self, obj): Get related object type data :param obj: Current record object :return: Related content type :rtype: O...
Implement the Python class `LocationFieldMethodSerializer` described below. Class description: Serialize an object based on a provided field Method signatures and docstrings: - def get_climate_conditions(self, obj): Get related object type data :param obj: Current record object :return: Related content type :rtype: O...
65a9c2b0f57828ca7e355018e1a6366e893ee836
<|skeleton|> class LocationFieldMethodSerializer: """Serialize an object based on a provided field""" def get_climate_conditions(self, obj): """Get related object type data :param obj: Current record object :return: Related content type :rtype: Object/record""" <|body_0|> def get_soils(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocationFieldMethodSerializer: """Serialize an object based on a provided field""" def get_climate_conditions(self, obj): """Get related object type data :param obj: Current record object :return: Related content type :rtype: Object/record""" request = self.context['request'] Loca...
the_stack_v2_python_sparse
csacompendium/locations/api/location/locationserializers.py
nkoech/csacompendium
train
1
3d3ad799f7567edc33596bba82f96f319225ce12
[ "if head == None or head.next == None:\n return False\nslow = head\nfast = head.next\nwhile slow != fast:\n if fast == None or fast.next == None:\n return False\n else:\n slow = slow.next\n fast = fast.next.next\nreturn True", "table = {}\nwhile head != None:\n if head in table.ke...
<|body_start_0|> if head == None or head.next == None: return False slow = head fast = head.next while slow != fast: if fast == None or fast.next == None: return False else: slow = slow.next fast = fast.n...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycleHash(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head == None or head.next == None: ...
stack_v2_sparse_classes_36k_train_027219
1,205
permissive
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycle", "signature": "def hasCycle(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "hasCycleHash", "signature": "def hasCycleHash(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_014857
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def hasCycleHash(self, head): :type head: ListNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): :type head: ListNode :rtype: bool - def hasCycleHash(self, head): :type head: ListNode :rtype: bool <|skeleton|> class Solution: def hasCycle(self...
0e4af391274e33a9bb9f999a9032b74d06fc878e
<|skeleton|> class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def hasCycleHash(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def hasCycle(self, head): """:type head: ListNode :rtype: bool""" if head == None or head.next == None: return False slow = head fast = head.next while slow != fast: if fast == None or fast.next == None: return False ...
the_stack_v2_python_sparse
leetcode/link-list/cycle.py
Gaurav-Pande/DataStructures
train
6
956f9e60f465d4f1a98167191b3b818c37ad776d
[ "super().__init__(*args, **kwargs)\nif ext_args == {}:\n self._freq = 1\nelse:\n self._freq = ext_args.freq", "if engine.rank == 0 and engine.last_iter.val % self._freq == 0:\n dirname = './ckpt_{}'.format(engine.name)\n if not os.path.exists(dirname):\n try:\n os.mkdir(dirname)\n ...
<|body_start_0|> super().__init__(*args, **kwargs) if ext_args == {}: self._freq = 1 else: self._freq = ext_args.freq <|end_body_0|> <|body_start_1|> if engine.rank == 0 and engine.last_iter.val % self._freq == 0: dirname = './ckpt_{}'.format(engine.n...
Overview: Hook to save checkpoint Interfaces: __init__, __call__ Property: name, priority, position
SaveCkptHook
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaveCkptHook: """Overview: Hook to save checkpoint Interfaces: __init__, __call__ Property: name, priority, position""" def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: """Overview: init SaveCkptHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, u...
stack_v2_sparse_classes_36k_train_027220
15,244
permissive
[ { "docstring": "Overview: init SaveCkptHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_args.freq to set save_ckpt_freq", "name": "__init__", "signature": "def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None" }, { "docstring": "Overview: Save checkpoint...
2
stack_v2_sparse_classes_30k_train_000347
Implement the Python class `SaveCkptHook` described below. Class description: Overview: Hook to save checkpoint Interfaces: __init__, __call__ Property: name, priority, position Method signatures and docstrings: - def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: Overview: init SaveCkptHook ...
Implement the Python class `SaveCkptHook` described below. Class description: Overview: Hook to save checkpoint Interfaces: __init__, __call__ Property: name, priority, position Method signatures and docstrings: - def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: Overview: init SaveCkptHook ...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class SaveCkptHook: """Overview: Hook to save checkpoint Interfaces: __init__, __call__ Property: name, priority, position""" def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: """Overview: init SaveCkptHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SaveCkptHook: """Overview: Hook to save checkpoint Interfaces: __init__, __call__ Property: name, priority, position""" def __init__(self, *args, ext_args: EasyDict=EasyDict(), **kwargs) -> None: """Overview: init SaveCkptHook Arguments: - ext_args (:obj:`EasyDict`): extended_args, use ext_args.f...
the_stack_v2_python_sparse
ding/worker/learner/learner_hook.py
shengxuesun/DI-engine
train
1
241bb6da6f869f43c7ba6e691e28c397a370ff40
[ "def serializeHelper(node, vals):\n if node:\n vals.append(node.val)\n serializeHelper(node.left, vals)\n serializeHelper(node.right, vals)\nvals = []\nserializeHelper(root, vals)\nreturn ' '.join(map(str, vals))", "def deserializeHelper(minVal, maxVal, vals):\n if not vals:\n re...
<|body_start_0|> def serializeHelper(node, vals): if node: vals.append(node.val) serializeHelper(node.left, vals) serializeHelper(node.right, vals) vals = [] serializeHelper(root, vals) return ' '.join(map(str, vals)) <|end_body...
Codec
[ "MIT" ]
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_027221
1,344
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_020447
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:...
4dc4e6642dc92f1983c13564cc0fd99917cab358
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def serializeHelper(node, vals): if node: vals.append(node.val) serializeHelper(node.left, vals) serializeHelper(node.right, v...
the_stack_v2_python_sparse
Python/serialize-and-deserialize-bst.py
kamyu104/LeetCode-Solutions
train
4,549
a394f74e40675c97b862ff3546411770a3c39ffd
[ "self.ri = ROACHInterface(pid)\nself.ri.set_coeffs(coeffs)\nself.host = host\nself.port = port", "sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\nsock.connect((self.host, self.port))\ntry:\n packetSize = 4096\n while True:\n self.ri.trig_data_bram()\n time.sleep(0.01)\n output ...
<|body_start_0|> self.ri = ROACHInterface(pid) self.ri.set_coeffs(coeffs) self.host = host self.port = port <|end_body_0|> <|body_start_1|> sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.connect((self.host, self.port)) try: packetSize = ...
@brief a class to read data from the ROACH and transmit to a client via User Datagram Protocol (UDP)
transmitUDP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class transmitUDP: """@brief a class to read data from the ROACH and transmit to a client via User Datagram Protocol (UDP)""" def __init__(self, pid, host='192.168.1.101', port=12345, coeffs=[0, 0, 0, 0]): """@brief initialize the class, given a process ID, host and port @param pid: the pr...
stack_v2_sparse_classes_36k_train_027222
7,870
no_license
[ { "docstring": "@brief initialize the class, given a process ID, host and port @param pid: the process ID of the running BOF file (int) @param host: the IP address of the client to transmit to (str) @param port: the port over which to communicate (int)", "name": "__init__", "signature": "def __init__(se...
3
stack_v2_sparse_classes_30k_train_021617
Implement the Python class `transmitUDP` described below. Class description: @brief a class to read data from the ROACH and transmit to a client via User Datagram Protocol (UDP) Method signatures and docstrings: - def __init__(self, pid, host='192.168.1.101', port=12345, coeffs=[0, 0, 0, 0]): @brief initialize the cl...
Implement the Python class `transmitUDP` described below. Class description: @brief a class to read data from the ROACH and transmit to a client via User Datagram Protocol (UDP) Method signatures and docstrings: - def __init__(self, pid, host='192.168.1.101', port=12345, coeffs=[0, 0, 0, 0]): @brief initialize the cl...
b96245b703618d309eb19cf965f8a9e1add4264e
<|skeleton|> class transmitUDP: """@brief a class to read data from the ROACH and transmit to a client via User Datagram Protocol (UDP)""" def __init__(self, pid, host='192.168.1.101', port=12345, coeffs=[0, 0, 0, 0]): """@brief initialize the class, given a process ID, host and port @param pid: the pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class transmitUDP: """@brief a class to read data from the ROACH and transmit to a client via User Datagram Protocol (UDP)""" def __init__(self, pid, host='192.168.1.101', port=12345, coeffs=[0, 0, 0, 0]): """@brief initialize the class, given a process ID, host and port @param pid: the process ID of t...
the_stack_v2_python_sparse
nickhand/python/fir_filter_udp_tx.py
AaronParsons/astro250
train
4
aa3e244372d5360abcc594cdcc213108b839aaf2
[ "self.engine = engine\nself.identity_name = identity_name\nself.job_id = job_id\nself._update_lock = threading.Lock()\nself.public_stickers = {}\nself.private_stickers = {}\nif public_stickers and isinstance(public_stickers, dict):\n self.public_stickers.update(public_stickers)\nif private_stickers and isinstanc...
<|body_start_0|> self.engine = engine self.identity_name = identity_name self.job_id = job_id self._update_lock = threading.Lock() self.public_stickers = {} self.private_stickers = {} if public_stickers and isinstance(public_stickers, dict): self.publi...
FLContextManager manages the creation and updates of FLContext objects for a run. NOTE: The engine may create a new FLContextManager object for each RUN!
FLContextManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FLContextManager: """FLContextManager manages the creation and updates of FLContext objects for a run. NOTE: The engine may create a new FLContextManager object for each RUN!""" def __init__(self, engine=None, identity_name: str='', job_id: str='', public_stickers=None, private_stickers=None...
stack_v2_sparse_classes_36k_train_027223
12,075
permissive
[ { "docstring": "Init the FLContextManager. Args: engine: the engine that created this FLContextManager object identity_name (str): identity name job_id: the job id public_stickers: public sticky properties that are copied into or copied from private_stickers: private sticky properties that are copied into or co...
5
null
Implement the Python class `FLContextManager` described below. Class description: FLContextManager manages the creation and updates of FLContext objects for a run. NOTE: The engine may create a new FLContextManager object for each RUN! Method signatures and docstrings: - def __init__(self, engine=None, identity_name:...
Implement the Python class `FLContextManager` described below. Class description: FLContextManager manages the creation and updates of FLContext objects for a run. NOTE: The engine may create a new FLContextManager object for each RUN! Method signatures and docstrings: - def __init__(self, engine=None, identity_name:...
1433290c203bd23f34c29e11795ce592bc067888
<|skeleton|> class FLContextManager: """FLContextManager manages the creation and updates of FLContext objects for a run. NOTE: The engine may create a new FLContextManager object for each RUN!""" def __init__(self, engine=None, identity_name: str='', job_id: str='', public_stickers=None, private_stickers=None...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FLContextManager: """FLContextManager manages the creation and updates of FLContext objects for a run. NOTE: The engine may create a new FLContextManager object for each RUN!""" def __init__(self, engine=None, identity_name: str='', job_id: str='', public_stickers=None, private_stickers=None): ""...
the_stack_v2_python_sparse
nvflare/apis/fl_context.py
NVIDIA/NVFlare
train
442
c6f948787986b71d67e4e784efde83a8339742c4
[ "self.n = 5\nself.m = 2\nself.L = L", "a = u[0]\nphidot = u[1]\ntheta = x[2]\nv = x[3]\nphi = x[4]\nL = self.L\nreturn np.array([v * np.cos(theta), v * np.sin(theta), v * np.tan(phi) / L, a, phidot]) + w", "theta = x[2]\nv = x[3]\nphi = x[4]\nL = self.L\nfx = np.array([[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [-v * np...
<|body_start_0|> self.n = 5 self.m = 2 self.L = L <|end_body_0|> <|body_start_1|> a = u[0] phidot = u[1] theta = x[2] v = x[3] phi = x[4] L = self.L return np.array([v * np.cos(theta), v * np.sin(theta), v * np.tan(phi) / L, a, phidot]) + ...
Simple car dynamics with controls as acceleration, steering rate
SimpleCarDynamics
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleCarDynamics: """Simple car dynamics with controls as acceleration, steering rate""" def __init__(self, L=1.0): """Constructor that initializes the order""" <|body_0|> def xdot(self, t, x, u, w): """x = [x, y, theta, v, phi] Basic dynamics of xdot = [v c_the...
stack_v2_sparse_classes_36k_train_027224
1,434
permissive
[ { "docstring": "Constructor that initializes the order", "name": "__init__", "signature": "def __init__(self, L=1.0)" }, { "docstring": "x = [x, y, theta, v, phi] Basic dynamics of xdot = [v c_theta, v sin_theta, v tan_phi/L, a, phidot] u = [a, phidot]", "name": "xdot", "signature": "def...
3
stack_v2_sparse_classes_30k_train_019646
Implement the Python class `SimpleCarDynamics` described below. Class description: Simple car dynamics with controls as acceleration, steering rate Method signatures and docstrings: - def __init__(self, L=1.0): Constructor that initializes the order - def xdot(self, t, x, u, w): x = [x, y, theta, v, phi] Basic dynami...
Implement the Python class `SimpleCarDynamics` described below. Class description: Simple car dynamics with controls as acceleration, steering rate Method signatures and docstrings: - def __init__(self, L=1.0): Constructor that initializes the order - def xdot(self, t, x, u, w): x = [x, y, theta, v, phi] Basic dynami...
4faa05317fb895575bc1b943d919e54355d56280
<|skeleton|> class SimpleCarDynamics: """Simple car dynamics with controls as acceleration, steering rate""" def __init__(self, L=1.0): """Constructor that initializes the order""" <|body_0|> def xdot(self, t, x, u, w): """x = [x, y, theta, v, phi] Basic dynamics of xdot = [v c_the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleCarDynamics: """Simple car dynamics with controls as acceleration, steering rate""" def __init__(self, L=1.0): """Constructor that initializes the order""" self.n = 5 self.m = 2 self.L = L def xdot(self, t, x, u, w): """x = [x, y, theta, v, phi] Basic dy...
the_stack_v2_python_sparse
src/ddp_sim_car_model/scripts/simple_car_dynamics.py
lipengfeizju/aoc_project
train
0
24eda61b4eb9bf82940f548487f7ff09425ca867
[ "if minfo is None:\n minfo = {}\nsuper(DumpJournalValueMessage, self).__init__(minfo)\nself.IsSystemMessage = False\nself.IsForward = True\nself.IsReliable = True\nself.TransactionType = minfo.get('TransactionType')\nself.Name = minfo.get('Name')", "result = super(DumpJournalValueMessage, self).dump()\nresult[...
<|body_start_0|> if minfo is None: minfo = {} super(DumpJournalValueMessage, self).__init__(minfo) self.IsSystemMessage = False self.IsForward = True self.IsReliable = True self.TransactionType = minfo.get('TransactionType') self.Name = minfo.get('Name...
Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system message. IsForward (bool): Whether or not this message is forwarded. IsReliable (bool): Whether ...
DumpJournalValueMessage
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DumpJournalValueMessage: """Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system message. IsForward (bool): Whether or not thi...
stack_v2_sparse_classes_36k_train_027225
5,835
permissive
[ { "docstring": "Constructor for the DumpJournalValueMessage class. Args: minfo (dict): A dict containing initial values for the new DumpJournalValueMessage.", "name": "__init__", "signature": "def __init__(self, minfo=None)" }, { "docstring": "Returns a dict containing information about the Dump...
2
stack_v2_sparse_classes_30k_train_007638
Implement the Python class `DumpJournalValueMessage` described below. Class description: Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system messag...
Implement the Python class `DumpJournalValueMessage` described below. Class description: Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system messag...
8f4ca1aab54ef420a0db10c8ca822ec8686cd423
<|skeleton|> class DumpJournalValueMessage: """Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system message. IsForward (bool): Whether or not thi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DumpJournalValueMessage: """Represents the message format for exchanging dump journal value messages. Attributes: DumpJournalValueMessage.MessageType (str): The class name of the message. IsSystemMessage (bool): Whether or not this message is a system message. IsForward (bool): Whether or not this message is ...
the_stack_v2_python_sparse
validator/journal/messages/journal_debug.py
aludvik/sawtooth-core
train
0
192e405449a4080e6b982be91eee43b39b9f9515
[ "self.code_value = None\nself.display_text = None\nself.abbreviation_text = None\nself.info_xml = None\nif xml is not None:\n self.parse_xml(xml)", "xmlutils = XmlUtils(xml)\nself.code_value = xmlutils.get_string_by_xpath('code-value')\nself.display_text = xmlutils.get_string_by_xpath('display-text')\nself.abb...
<|body_start_0|> self.code_value = None self.display_text = None self.abbreviation_text = None self.info_xml = None if xml is not None: self.parse_xml(xml) <|end_body_0|> <|body_start_1|> xmlutils = XmlUtils(xml) self.code_value = xmlutils.get_string_...
Describes an indivdual code item. Attributes: code_value This is the value associated with the item which uniquelyidentifies it within a vocabulary. display_text This is the display text of the item. abbreviation_text This is the abbreviation text of an item. info_xml Contains important auxillary information that can b...
VocabularyCodeItem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VocabularyCodeItem: """Describes an indivdual code item. Attributes: code_value This is the value associated with the item which uniquelyidentifies it within a vocabulary. display_text This is the display text of the item. abbreviation_text This is the abbreviation text of an item. info_xml Conta...
stack_v2_sparse_classes_36k_train_027226
1,487
permissive
[ { "docstring": ":param xml: lxml.etree.Element representing a single VocabularyItem", "name": "__init__", "signature": "def __init__(self, xml=None)" }, { "docstring": ":param xml: lxml.etree.Element representing a single VocabularyItem", "name": "parse_xml", "signature": "def parse_xml(...
2
stack_v2_sparse_classes_30k_train_013471
Implement the Python class `VocabularyCodeItem` described below. Class description: Describes an indivdual code item. Attributes: code_value This is the value associated with the item which uniquelyidentifies it within a vocabulary. display_text This is the display text of the item. abbreviation_text This is the abbre...
Implement the Python class `VocabularyCodeItem` described below. Class description: Describes an indivdual code item. Attributes: code_value This is the value associated with the item which uniquelyidentifies it within a vocabulary. display_text This is the display text of the item. abbreviation_text This is the abbre...
2b6fa7c1687300bcc2e501368883fbb13dc80495
<|skeleton|> class VocabularyCodeItem: """Describes an indivdual code item. Attributes: code_value This is the value associated with the item which uniquelyidentifies it within a vocabulary. display_text This is the display text of the item. abbreviation_text This is the abbreviation text of an item. info_xml Conta...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VocabularyCodeItem: """Describes an indivdual code item. Attributes: code_value This is the value associated with the item which uniquelyidentifies it within a vocabulary. display_text This is the display text of the item. abbreviation_text This is the abbreviation text of an item. info_xml Contains important...
the_stack_v2_python_sparse
src/healthvaultlib/objects/vocabularycodeitem.py
rajeevs1992/pyhealthvault
train
1
7f4a5857020dcfd981b4c7051abc58e4bf672be0
[ "requesition_obj = self.pool.get('purchase.requisition')\nrequesition = requesition_obj.browse(cr, uid, context['request_id'])\nsubject = 'RFQ For ' + requesition.name\nir_mail = self.pool.get('ir.mail_server')\npartner_obj = self.pool.get('res.partner')\npartner_ids = requesition_obj.get_partner_ids(cr, uid, ids, ...
<|body_start_0|> requesition_obj = self.pool.get('purchase.requisition') requesition = requesition_obj.browse(cr, uid, context['request_id']) subject = 'RFQ For ' + requesition.name ir_mail = self.pool.get('ir.mail_server') partner_obj = self.pool.get('res.partner') partn...
purchase_send_email_quotation_wizard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class purchase_send_email_quotation_wizard: def send_message(self, cr, uid, ids, context=None): """This Method for send Email For Suppliers""" <|body_0|> def default_get(self, cr, uid, fields, context=None): """To get default values for the object. @return: A dictionary wh...
stack_v2_sparse_classes_36k_train_027227
3,800
no_license
[ { "docstring": "This Method for send Email For Suppliers", "name": "send_message", "signature": "def send_message(self, cr, uid, ids, context=None)" }, { "docstring": "To get default values for the object. @return: A dictionary which of fields with values.", "name": "default_get", "signa...
2
null
Implement the Python class `purchase_send_email_quotation_wizard` described below. Class description: Implement the purchase_send_email_quotation_wizard class. Method signatures and docstrings: - def send_message(self, cr, uid, ids, context=None): This Method for send Email For Suppliers - def default_get(self, cr, u...
Implement the Python class `purchase_send_email_quotation_wizard` described below. Class description: Implement the purchase_send_email_quotation_wizard class. Method signatures and docstrings: - def send_message(self, cr, uid, ids, context=None): This Method for send Email For Suppliers - def default_get(self, cr, u...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class purchase_send_email_quotation_wizard: def send_message(self, cr, uid, ids, context=None): """This Method for send Email For Suppliers""" <|body_0|> def default_get(self, cr, uid, fields, context=None): """To get default values for the object. @return: A dictionary wh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class purchase_send_email_quotation_wizard: def send_message(self, cr, uid, ids, context=None): """This Method for send Email For Suppliers""" requesition_obj = self.pool.get('purchase.requisition') requesition = requesition_obj.browse(cr, uid, context['request_id']) subject = 'RFQ F...
the_stack_v2_python_sparse
v_7/Dongola/ntc/purchase_send_email_quotation/wizard/purchase_send_email_quotation_wizard.py
musabahmed/baba
train
0
72bf3ca78c47c383c695c4644f4b366813895f9d
[ "if bool(vocab_path) == bool(spm_model_path):\n raise ValueError('Exactly 1 of `vocab_path` or `spm_model_path` must be specified, not both.')\nself.vocab_path = vocab_path\nself.do_lower_case = do_lower_case\nself.spm_model_path = spm_model_path\nself.generate_document_ids = generate_document_ids", "def file_...
<|body_start_0|> if bool(vocab_path) == bool(spm_model_path): raise ValueError('Exactly 1 of `vocab_path` or `spm_model_path` must be specified, not both.') self.vocab_path = vocab_path self.do_lower_case = do_lower_case self.spm_model_path = spm_model_path self.gener...
PTransform for reading text files into tokenized documents.
ReadFilesToTokenizedDocuments
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadFilesToTokenizedDocuments: """PTransform for reading text files into tokenized documents.""" def __init__(self, vocab_path=None, do_lower_case=True, spm_model_path=None, generate_document_ids=False): """Initialization. Args: vocab_path: Path to the BERT vocabulary file to use wit...
stack_v2_sparse_classes_36k_train_027228
24,441
permissive
[ { "docstring": "Initialization. Args: vocab_path: Path to the BERT vocabulary file to use with the BERT tokenizer. Leave as None or set to empty string if using `spm_model_path` instead. do_lower_case: Whether to lowercase all text for BERT tokenization (default True). Must match assumption in `vocab_path`. Ign...
2
stack_v2_sparse_classes_30k_train_020227
Implement the Python class `ReadFilesToTokenizedDocuments` described below. Class description: PTransform for reading text files into tokenized documents. Method signatures and docstrings: - def __init__(self, vocab_path=None, do_lower_case=True, spm_model_path=None, generate_document_ids=False): Initialization. Args...
Implement the Python class `ReadFilesToTokenizedDocuments` described below. Class description: PTransform for reading text files into tokenized documents. Method signatures and docstrings: - def __init__(self, vocab_path=None, do_lower_case=True, spm_model_path=None, generate_document_ids=False): Initialization. Args...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class ReadFilesToTokenizedDocuments: """PTransform for reading text files into tokenized documents.""" def __init__(self, vocab_path=None, do_lower_case=True, spm_model_path=None, generate_document_ids=False): """Initialization. Args: vocab_path: Path to the BERT vocabulary file to use wit...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadFilesToTokenizedDocuments: """PTransform for reading text files into tokenized documents.""" def __init__(self, vocab_path=None, do_lower_case=True, spm_model_path=None, generate_document_ids=False): """Initialization. Args: vocab_path: Path to the BERT vocabulary file to use with the BERT to...
the_stack_v2_python_sparse
readtwice/data_utils/beam_utils.py
Jimmy-INL/google-research
train
1
453b540ab2ea15c18dd1b44086fd04c9aa595456
[ "self.auto_lock_duration_usecs = auto_lock_duration_usecs\nself.coexisting_lock_mode = coexisting_lock_mode\nself.default_retention_duration_usecs = default_retention_duration_usecs\nself.default_retention_duration_years = default_retention_duration_years\nself.hold_timestamp_usecs = hold_timestamp_usecs\nself.igno...
<|body_start_0|> self.auto_lock_duration_usecs = auto_lock_duration_usecs self.coexisting_lock_mode = coexisting_lock_mode self.default_retention_duration_usecs = default_retention_duration_usecs self.default_retention_duration_years = default_retention_duration_years self.hold_t...
Implementation of the 'ViewIdMappingProto_FileLevelDataLockConfig' model. TODO: type description here. Attributes: auto_lock_duration_usecs (long|int): Auto-lock automatically commit files to WORM state in the filesystem if they have not been modified for an administrator-specified period of time. When the auto-lock is...
ViewIdMappingProto_FileLevelDataLockConfig
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ViewIdMappingProto_FileLevelDataLockConfig: """Implementation of the 'ViewIdMappingProto_FileLevelDataLockConfig' model. TODO: type description here. Attributes: auto_lock_duration_usecs (long|int): Auto-lock automatically commit files to WORM state in the filesystem if they have not been modifie...
stack_v2_sparse_classes_36k_train_027229
7,275
permissive
[ { "docstring": "Constructor for the ViewIdMappingProto_FileLevelDataLockConfig class", "name": "__init__", "signature": "def __init__(self, auto_lock_duration_usecs=None, coexisting_lock_mode=None, default_retention_duration_usecs=None, default_retention_duration_years=None, hold_timestamp_usecs=None, i...
2
null
Implement the Python class `ViewIdMappingProto_FileLevelDataLockConfig` described below. Class description: Implementation of the 'ViewIdMappingProto_FileLevelDataLockConfig' model. TODO: type description here. Attributes: auto_lock_duration_usecs (long|int): Auto-lock automatically commit files to WORM state in the f...
Implement the Python class `ViewIdMappingProto_FileLevelDataLockConfig` described below. Class description: Implementation of the 'ViewIdMappingProto_FileLevelDataLockConfig' model. TODO: type description here. Attributes: auto_lock_duration_usecs (long|int): Auto-lock automatically commit files to WORM state in the f...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ViewIdMappingProto_FileLevelDataLockConfig: """Implementation of the 'ViewIdMappingProto_FileLevelDataLockConfig' model. TODO: type description here. Attributes: auto_lock_duration_usecs (long|int): Auto-lock automatically commit files to WORM state in the filesystem if they have not been modifie...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ViewIdMappingProto_FileLevelDataLockConfig: """Implementation of the 'ViewIdMappingProto_FileLevelDataLockConfig' model. TODO: type description here. Attributes: auto_lock_duration_usecs (long|int): Auto-lock automatically commit files to WORM state in the filesystem if they have not been modified for an admi...
the_stack_v2_python_sparse
cohesity_management_sdk/models/view_id_mapping_proto_file_level_data_lock_config.py
cohesity/management-sdk-python
train
24
882f05fee0ca61119a447aa523b611feae24f2c6
[ "if len(index) == 0:\n return ''\nelif len(index) == 1:\n return str(index[0])\nelse:\n return str(index[1])", "if len(index) == 0:\n return 10\nelif len(index) == 1:\n return 3000\nelse:\n return 0" ]
<|body_start_0|> if len(index) == 0: return '' elif len(index) == 1: return str(index[0]) else: return str(index[1]) <|end_body_0|> <|body_start_1|> if len(index) == 0: return 10 elif len(index) == 1: return 3000 ...
Virtual tree control
MyTree
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyTree: """Virtual tree control""" def OnGetItemText(self, index): """index is tuple of 0-based (root, child, child, ...) indices. An empty tuple () represents the hidden root item""" <|body_0|> def OnGetChildrenCount(self, index): """index is tuple of 0-based (r...
stack_v2_sparse_classes_36k_train_027230
1,354
permissive
[ { "docstring": "index is tuple of 0-based (root, child, child, ...) indices. An empty tuple () represents the hidden root item", "name": "OnGetItemText", "signature": "def OnGetItemText(self, index)" }, { "docstring": "index is tuple of 0-based (root, child, child, ...) indices. An empty tuple (...
2
stack_v2_sparse_classes_30k_train_013162
Implement the Python class `MyTree` described below. Class description: Virtual tree control Method signatures and docstrings: - def OnGetItemText(self, index): index is tuple of 0-based (root, child, child, ...) indices. An empty tuple () represents the hidden root item - def OnGetChildrenCount(self, index): index i...
Implement the Python class `MyTree` described below. Class description: Virtual tree control Method signatures and docstrings: - def OnGetItemText(self, index): index is tuple of 0-based (root, child, child, ...) indices. An empty tuple () represents the hidden root item - def OnGetChildrenCount(self, index): index i...
7d49a4c7841fe6611591cff2dc49586e079831e5
<|skeleton|> class MyTree: """Virtual tree control""" def OnGetItemText(self, index): """index is tuple of 0-based (root, child, child, ...) indices. An empty tuple () represents the hidden root item""" <|body_0|> def OnGetChildrenCount(self, index): """index is tuple of 0-based (r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyTree: """Virtual tree control""" def OnGetItemText(self, index): """index is tuple of 0-based (root, child, child, ...) indices. An empty tuple () represents the hidden root item""" if len(index) == 0: return '' elif len(index) == 1: return str(index[0]) ...
the_stack_v2_python_sparse
demo/virtualtree.py
spyke/spyke
train
24
6de0436abd47ba94fac9bb05fdbe77550bf7c91f
[ "self.column_names: List[str] = kargs.pop('column_names')\nsuper().__init__(*args, **kargs)\nself.set_fields_from_dict(['item_column', 'confirm_items', 'send_confirmation', 'track_read'])\nitem_column_name = self.fields['item_column'].initial\nif item_column_name is None:\n item_column_name = next((cname for cna...
<|body_start_0|> self.column_names: List[str] = kargs.pop('column_names') super().__init__(*args, **kargs) self.set_fields_from_dict(['item_column', 'confirm_items', 'send_confirmation', 'track_read']) item_column_name = self.fields['item_column'].initial if item_column_name is N...
Form to edit the Send Email action.
EmailActionForm
[ "MIT", "LGPL-2.0-or-later", "Python-2.0", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailActionForm: """Form to edit the Send Email action.""" def __init__(self, *args, **kargs): """Store column names and adjust initial values.""" <|body_0|> def clean(self): """Verify email values.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_027231
20,237
permissive
[ { "docstring": "Store column names and adjust initial values.", "name": "__init__", "signature": "def __init__(self, *args, **kargs)" }, { "docstring": "Verify email values.", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_012499
Implement the Python class `EmailActionForm` described below. Class description: Form to edit the Send Email action. Method signatures and docstrings: - def __init__(self, *args, **kargs): Store column names and adjust initial values. - def clean(self): Verify email values.
Implement the Python class `EmailActionForm` described below. Class description: Form to edit the Send Email action. Method signatures and docstrings: - def __init__(self, *args, **kargs): Store column names and adjust initial values. - def clean(self): Verify email values. <|skeleton|> class EmailActionForm: ""...
5473e9faa24c71a2a1102d47ebc2cbf27608e42a
<|skeleton|> class EmailActionForm: """Form to edit the Send Email action.""" def __init__(self, *args, **kargs): """Store column names and adjust initial values.""" <|body_0|> def clean(self): """Verify email values.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailActionForm: """Form to edit the Send Email action.""" def __init__(self, *args, **kargs): """Store column names and adjust initial values.""" self.column_names: List[str] = kargs.pop('column_names') super().__init__(*args, **kargs) self.set_fields_from_dict(['item_col...
the_stack_v2_python_sparse
ontask/action/forms/run.py
LucasFranciscoCorreia/ontask_b
train
0
8fc8de9e109627902332dfd948543c191d9b840c
[ "super().__init__()\nself.nikola = nikola\nself.quiet = quiet", "if self.quiet:\n doit_config = {'verbosity': 0, 'reporter': 'zero'}\nelse:\n doit_config = {'reporter': ExecutedOnlyReporter, 'outfile': sys.stderr}\ndoit_config['default_tasks'] = ['render_site', 'post_render']\ndoit_config.update(self.nikola...
<|body_start_0|> super().__init__() self.nikola = nikola self.quiet = quiet <|end_body_0|> <|body_start_1|> if self.quiet: doit_config = {'verbosity': 0, 'reporter': 'zero'} else: doit_config = {'reporter': ExecutedOnlyReporter, 'outfile': sys.stderr} ...
Nikola-specific task loader.
NikolaTaskLoader
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NikolaTaskLoader: """Nikola-specific task loader.""" def __init__(self, nikola, quiet=False): """Initialize the loader.""" <|body_0|> def load_doit_config(self): """Load doit configuration.""" <|body_1|> def load_tasks(self, cmd, pos_args): "...
stack_v2_sparse_classes_36k_train_027232
16,687
permissive
[ { "docstring": "Initialize the loader.", "name": "__init__", "signature": "def __init__(self, nikola, quiet=False)" }, { "docstring": "Load doit configuration.", "name": "load_doit_config", "signature": "def load_doit_config(self)" }, { "docstring": "Load Nikola tasks.", "nam...
3
null
Implement the Python class `NikolaTaskLoader` described below. Class description: Nikola-specific task loader. Method signatures and docstrings: - def __init__(self, nikola, quiet=False): Initialize the loader. - def load_doit_config(self): Load doit configuration. - def load_tasks(self, cmd, pos_args): Load Nikola t...
Implement the Python class `NikolaTaskLoader` described below. Class description: Nikola-specific task loader. Method signatures and docstrings: - def __init__(self, nikola, quiet=False): Initialize the loader. - def load_doit_config(self): Load doit configuration. - def load_tasks(self, cmd, pos_args): Load Nikola t...
2b10e9952bac5a1119e6845c7a2c28273aca9775
<|skeleton|> class NikolaTaskLoader: """Nikola-specific task loader.""" def __init__(self, nikola, quiet=False): """Initialize the loader.""" <|body_0|> def load_doit_config(self): """Load doit configuration.""" <|body_1|> def load_tasks(self, cmd, pos_args): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NikolaTaskLoader: """Nikola-specific task loader.""" def __init__(self, nikola, quiet=False): """Initialize the loader.""" super().__init__() self.nikola = nikola self.quiet = quiet def load_doit_config(self): """Load doit configuration.""" if self.qui...
the_stack_v2_python_sparse
nikola/__main__.py
getnikola/nikola
train
2,142
80a78379f029f5c9b321a37559c7cf8169ba0538
[ "super().__init__()\nself.n_guesses = n_guesses\nself.queues = queues\nself.logger = logging.getLogger(self.__class__.__name__)", "self.queues.send_inputs(uniform(0, 10))\nself.logger.info('Submitted initial random guess')\ntrain_X = []\ntrain_y = []\ngpr = GaussianProcessRegressor(normalize_y=True, kernel=kernel...
<|body_start_0|> super().__init__() self.n_guesses = n_guesses self.queues = queues self.logger = logging.getLogger(self.__class__.__name__) <|end_body_0|> <|body_start_1|> self.queues.send_inputs(uniform(0, 10)) self.logger.info('Submitted initial random guess') ...
Tool that monitors results of simulations and calls for new ones, as appropriate
Thinker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Thinker: """Tool that monitors results of simulations and calls for new ones, as appropriate""" def __init__(self, queues: ClientQueues, n_guesses: int=10): """Args: n_guesses (int): Number of guesses the Thinker can make queues (ClientQueues): Queues for communicating with method se...
stack_v2_sparse_classes_36k_train_027233
5,039
no_license
[ { "docstring": "Args: n_guesses (int): Number of guesses the Thinker can make queues (ClientQueues): Queues for communicating with method server", "name": "__init__", "signature": "def __init__(self, queues: ClientQueues, n_guesses: int=10)" }, { "docstring": "Connects to the Redis queue with th...
2
stack_v2_sparse_classes_30k_train_001710
Implement the Python class `Thinker` described below. Class description: Tool that monitors results of simulations and calls for new ones, as appropriate Method signatures and docstrings: - def __init__(self, queues: ClientQueues, n_guesses: int=10): Args: n_guesses (int): Number of guesses the Thinker can make queue...
Implement the Python class `Thinker` described below. Class description: Tool that monitors results of simulations and calls for new ones, as appropriate Method signatures and docstrings: - def __init__(self, queues: ClientQueues, n_guesses: int=10): Args: n_guesses (int): Number of guesses the Thinker can make queue...
042ce37e5acc8a240845b8cce11effe832c1c913
<|skeleton|> class Thinker: """Tool that monitors results of simulations and calls for new ones, as appropriate""" def __init__(self, queues: ClientQueues, n_guesses: int=10): """Args: n_guesses (int): Number of guesses the Thinker can make queues (ClientQueues): Queues for communicating with method se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Thinker: """Tool that monitors results of simulations and calls for new ones, as appropriate""" def __init__(self, queues: ClientQueues, n_guesses: int=10): """Args: n_guesses (int): Number of guesses the Thinker can make queues (ClientQueues): Queues for communicating with method server""" ...
the_stack_v2_python_sparse
demo_apps/gpr_local/gpr_local.py
tskluzac/colmena
train
0
1b09ef1681c4b7a75b25f40c56e2fe8ce1d0bbd6
[ "self.heap = []\nself.k = k\nfor i in range(len(nums)):\n self.add(nums[i])", "if self.k == 0:\n if self.heap[0] <= val:\n heapq.heapreplace(self.heap, val)\n return self.heap[0]\nelse:\n self.k = self.k - 1\n heapq.heappush(self.heap, val)\n if self.k == 0:\n return self.heap[0]\n...
<|body_start_0|> self.heap = [] self.k = k for i in range(len(nums)): self.add(nums[i]) <|end_body_0|> <|body_start_1|> if self.k == 0: if self.heap[0] <= val: heapq.heapreplace(self.heap, val) return self.heap[0] else: ...
KthLargest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.heap = [] self.k = k for i in range(l...
stack_v2_sparse_classes_36k_train_027234
769
permissive
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
null
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
e7a6906ecc5bce665dec5d0f057b302a64d50f40
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.heap = [] self.k = k for i in range(len(nums)): self.add(nums[i]) def add(self, val): """:type val: int :rtype: int""" if self.k == 0: if self.hea...
the_stack_v2_python_sparse
practise/thekelement.py
mengyangbai/leetcode
train
0
52199d5344bb74983cb53ee0493b9ae79490b3d4
[ "username = request.user.get_username()\nserializer = RowLevelSecuritySerializer(username=username)\npolicy_id = int(policy_id)\nrow = serializer.find_security_policies(policy_id=policy_id)[0]\npolicy = request.data.get('policy', row['policy'])\npolicy_type = request.data.get('policy_type', row['policy_type'])\ngra...
<|body_start_0|> username = request.user.get_username() serializer = RowLevelSecuritySerializer(username=username) policy_id = int(policy_id) row = serializer.find_security_policies(policy_id=policy_id)[0] policy = request.data.get('policy', row['policy']) policy_type = r...
manage the RLS table based on row IDs
RowLevelSecurityById
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RowLevelSecurityById: """manage the RLS table based on row IDs""" def patch(self, request, policy_id, format=None): """Update a security policy of the specified id. Ignores additional URL params, and just uses body --- omit_serializer: true parameters: - name: policy in: body descrip...
stack_v2_sparse_classes_36k_train_027235
31,465
permissive
[ { "docstring": "Update a security policy of the specified id. Ignores additional URL params, and just uses body --- omit_serializer: true parameters: - name: policy in: body description: New SQL Condition that governs access to the table. e.g. \"accessible = 1\" type: string required: false - name: policy_type ...
2
stack_v2_sparse_classes_30k_train_001828
Implement the Python class `RowLevelSecurityById` described below. Class description: manage the RLS table based on row IDs Method signatures and docstrings: - def patch(self, request, policy_id, format=None): Update a security policy of the specified id. Ignores additional URL params, and just uses body --- omit_ser...
Implement the Python class `RowLevelSecurityById` described below. Class description: manage the RLS table based on row IDs Method signatures and docstrings: - def patch(self, request, policy_id, format=None): Update a security policy of the specified id. Ignores additional URL params, and just uses body --- omit_ser...
f066b472c2b66cc3b868bbe433aed2d4557aea32
<|skeleton|> class RowLevelSecurityById: """manage the RLS table based on row IDs""" def patch(self, request, policy_id, format=None): """Update a security policy of the specified id. Ignores additional URL params, and just uses body --- omit_serializer: true parameters: - name: policy in: body descrip...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RowLevelSecurityById: """manage the RLS table based on row IDs""" def patch(self, request, policy_id, format=None): """Update a security policy of the specified id. Ignores additional URL params, and just uses body --- omit_serializer: true parameters: - name: policy in: body description: New SQL...
the_stack_v2_python_sparse
src/api/views.py
datahuborg/datahub
train
199
c919586f4590e88eeb6f8257c07bd686f2da2238
[ "self.child_number = child_number\nself.text = text\nself.note = note\nself.text_tag = text_tag\nself.note_tag = note_tag", "outline_node = node_list_item.node\nmatch = True\nif self.child_number is not None and self.child_number != node_list_item.child_number:\n match = False\nelif self.text is not None and s...
<|body_start_0|> self.child_number = child_number self.text = text self.note = note self.text_tag = text_tag self.note_tag = note_tag <|end_body_0|> <|body_start_1|> outline_node = node_list_item.node match = True if self.child_number is not None and self...
Used to identify the nodes in the outline which match a given set of criteria, so that node can be used as an extracted field for further processing or output. Stores a set of criteria against which a given node can be matched, and the method to determine whether a supplied outline node matches it. Where one of the sup...
NodeAncestryMatchingCriteria
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NodeAncestryMatchingCriteria: """Used to identify the nodes in the outline which match a given set of criteria, so that node can be used as an extracted field for further processing or output. Stores a set of criteria against which a given node can be matched, and the method to determine whether ...
stack_v2_sparse_classes_36k_train_027236
2,825
no_license
[ { "docstring": "Args: child_number: The sequence number of this child within all the children of the parent node. text: The value of the text attribute to match with (after separating out the tag_text value). note: The value of the note attribute to match with (after separating out the tag_note value). text_tag...
2
stack_v2_sparse_classes_30k_val_000513
Implement the Python class `NodeAncestryMatchingCriteria` described below. Class description: Used to identify the nodes in the outline which match a given set of criteria, so that node can be used as an extracted field for further processing or output. Stores a set of criteria against which a given node can be matche...
Implement the Python class `NodeAncestryMatchingCriteria` described below. Class description: Used to identify the nodes in the outline which match a given set of criteria, so that node can be used as an extracted field for further processing or output. Stores a set of criteria against which a given node can be matche...
d7671cb41f0fe9b17f5cdff202b7616ea2a85bcf
<|skeleton|> class NodeAncestryMatchingCriteria: """Used to identify the nodes in the outline which match a given set of criteria, so that node can be used as an extracted field for further processing or output. Stores a set of criteria against which a given node can be matched, and the method to determine whether ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NodeAncestryMatchingCriteria: """Used to identify the nodes in the outline which match a given set of criteria, so that node can be used as an extracted field for further processing or output. Stores a set of criteria against which a given node can be matched, and the method to determine whether a supplied ou...
the_stack_v2_python_sparse
outlines_unleashed/node_ancestry_matching_criteria.py
sevire/outlines-unleashed
train
2
3981485afd9c87ed6b42bdfb18a2a8e1f3dd0ead
[ "kinect_y_offset = -0.092\nfirst_attempt = 'right'\nsecond_attempt = 'left'\nif -object_position.x + kinect_y_offset > 0:\n first_attempt = 'left'\n second_attempt = 'right'\nreturn (first_attempt, second_attempt)", "rospy.loginfo('Asking object recognition service for object location')\nobject_recog_client...
<|body_start_0|> kinect_y_offset = -0.092 first_attempt = 'right' second_attempt = 'left' if -object_position.x + kinect_y_offset > 0: first_attempt = 'left' second_attempt = 'right' return (first_attempt, second_attempt) <|end_body_0|> <|body_start_1|> ...
GraspingHandlerClient
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GraspingHandlerClient: def limb_move_order(self, object_position): """Chooses the order of which limbs to use to grab object. This is based on the object's position relative to the center of the robot :param object_position: geometry_msgs/Point, coordinates of object :return: string firs...
stack_v2_sparse_classes_36k_train_027237
3,945
permissive
[ { "docstring": "Chooses the order of which limbs to use to grab object. This is based on the object's position relative to the center of the robot :param object_position: geometry_msgs/Point, coordinates of object :return: string first_attempt, string second_attempt", "name": "limb_move_order", "signatu...
2
stack_v2_sparse_classes_30k_train_003336
Implement the Python class `GraspingHandlerClient` described below. Class description: Implement the GraspingHandlerClient class. Method signatures and docstrings: - def limb_move_order(self, object_position): Chooses the order of which limbs to use to grab object. This is based on the object's position relative to t...
Implement the Python class `GraspingHandlerClient` described below. Class description: Implement the GraspingHandlerClient class. Method signatures and docstrings: - def limb_move_order(self, object_position): Chooses the order of which limbs to use to grab object. This is based on the object's position relative to t...
1f9d05b7232cb9e76eff975e5ef1c8bf3fb5cde6
<|skeleton|> class GraspingHandlerClient: def limb_move_order(self, object_position): """Chooses the order of which limbs to use to grab object. This is based on the object's position relative to the center of the robot :param object_position: geometry_msgs/Point, coordinates of object :return: string firs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GraspingHandlerClient: def limb_move_order(self, object_position): """Chooses the order of which limbs to use to grab object. This is based on the object's position relative to the center of the robot :param object_position: geometry_msgs/Point, coordinates of object :return: string first_attempt, str...
the_stack_v2_python_sparse
grasping/src/grasping_handler_client.py
Hankfirst/de_niro
train
1
c3086ff33796e71dcaf293e35a4b2d1e0e338cea
[ "self.entity_name = entity_name\nself.model_dir = None\nself.read_model_from_s3 = read_model_from_s3\nself.read_embeddings_from_remote_url = read_embeddings_from_remote_url", "trainer = pycrfsuite.Trainer(verbose=False)\nfor x_seq, y_seq in zip(x, y):\n trainer.append(x_seq, y_seq)\ntrainer.set_params({'c1': c...
<|body_start_0|> self.entity_name = entity_name self.model_dir = None self.read_model_from_s3 = read_model_from_s3 self.read_embeddings_from_remote_url = read_embeddings_from_remote_url <|end_body_0|> <|body_start_1|> trainer = pycrfsuite.Trainer(verbose=False) for x_seq...
This class is used to train a Linear Chain Crf Model using Word Embeddings to carry out Named Entity Recognition (NER).
CrfTrain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrfTrain: """This class is used to train a Linear Chain Crf Model using Word Embeddings to carry out Named Entity Recognition (NER).""" def __init__(self, entity_name, read_model_from_s3=False, read_embeddings_from_remote_url=False): """Args: entity_name (str): The destination path f...
stack_v2_sparse_classes_36k_train_027238
7,737
no_license
[ { "docstring": "Args: entity_name (str): The destination path for saving the trained model. read_model_from_s3 (bool): To indicate if cloud storage settings is required. read_embeddings_from_remote_url (bool): To indicate if cloud embeddings is active", "name": "__init__", "signature": "def __init__(sel...
6
stack_v2_sparse_classes_30k_train_002155
Implement the Python class `CrfTrain` described below. Class description: This class is used to train a Linear Chain Crf Model using Word Embeddings to carry out Named Entity Recognition (NER). Method signatures and docstrings: - def __init__(self, entity_name, read_model_from_s3=False, read_embeddings_from_remote_ur...
Implement the Python class `CrfTrain` described below. Class description: This class is used to train a Linear Chain Crf Model using Word Embeddings to carry out Named Entity Recognition (NER). Method signatures and docstrings: - def __init__(self, entity_name, read_model_from_s3=False, read_embeddings_from_remote_ur...
b2ffe0413fd3622530779bedd103cca97ccbb1d6
<|skeleton|> class CrfTrain: """This class is used to train a Linear Chain Crf Model using Word Embeddings to carry out Named Entity Recognition (NER).""" def __init__(self, entity_name, read_model_from_s3=False, read_embeddings_from_remote_url=False): """Args: entity_name (str): The destination path f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrfTrain: """This class is used to train a Linear Chain Crf Model using Word Embeddings to carry out Named Entity Recognition (NER).""" def __init__(self, entity_name, read_model_from_s3=False, read_embeddings_from_remote_url=False): """Args: entity_name (str): The destination path for saving the...
the_stack_v2_python_sparse
models/crf_v2/crf_train.py
saishashank85/chatbot_challengers
train
0
8c97c77cf471a7ab19e73df0d6ade833039a011b
[ "input_text = input_text.strip().replace(' ', ' ').replace(' ', ' ')\ninput_text_list = input_text.split()\nword_count = 0\ncolumn_count = 1\ncolumns_since_space = 1\nfor column in input_text:\n if column.isspace():\n word_count += 1\n columns_since_space = 0\n if (column_count / self.LINE_WI...
<|body_start_0|> input_text = input_text.strip().replace(' ', ' ').replace(' ', ' ') input_text_list = input_text.split() word_count = 0 column_count = 1 columns_since_space = 1 for column in input_text: if column.isspace(): word_count += 1 ...
This class contains methods for formatting text.
FormatLine
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormatLine: """This class contains methods for formatting text.""" def breakLine(self, input_text): """Creates line breaks at or before the value of self.LINE_WIDTH.""" <|body_0|> def blockText(self, input_text): """Formats text into a block-style.""" <|b...
stack_v2_sparse_classes_36k_train_027239
6,993
no_license
[ { "docstring": "Creates line breaks at or before the value of self.LINE_WIDTH.", "name": "breakLine", "signature": "def breakLine(self, input_text)" }, { "docstring": "Formats text into a block-style.", "name": "blockText", "signature": "def blockText(self, input_text)" }, { "doc...
3
stack_v2_sparse_classes_30k_train_014150
Implement the Python class `FormatLine` described below. Class description: This class contains methods for formatting text. Method signatures and docstrings: - def breakLine(self, input_text): Creates line breaks at or before the value of self.LINE_WIDTH. - def blockText(self, input_text): Formats text into a block-...
Implement the Python class `FormatLine` described below. Class description: This class contains methods for formatting text. Method signatures and docstrings: - def breakLine(self, input_text): Creates line breaks at or before the value of self.LINE_WIDTH. - def blockText(self, input_text): Formats text into a block-...
c0ddd8c01e083912e2dd891c963912fabc296d25
<|skeleton|> class FormatLine: """This class contains methods for formatting text.""" def breakLine(self, input_text): """Creates line breaks at or before the value of self.LINE_WIDTH.""" <|body_0|> def blockText(self, input_text): """Formats text into a block-style.""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormatLine: """This class contains methods for formatting text.""" def breakLine(self, input_text): """Creates line breaks at or before the value of self.LINE_WIDTH.""" input_text = input_text.strip().replace(' ', ' ').replace(' ', ' ') input_text_list = input_text.split() ...
the_stack_v2_python_sparse
old/gamesrc/tools/old_format_line_generic.py
pixel-parrot/MD
train
0
17d6169090f2bcd7b73f08bb21894e3c940a14ee
[ "nodes_used_final = 0\ncores_used = gpus_used = nodes_used = 0\nfor nsets, tasks, cpus_per_task, gpus in resource_sets:\n if not parallel:\n cores_used = gpus_used = nodes_used = 0\n for _ in range(nsets):\n cores_used += tasks * cpus_per_task\n gpus_used += gpus\n while cores_used...
<|body_start_0|> nodes_used_final = 0 cores_used = gpus_used = nodes_used = 0 for nsets, tasks, cpus_per_task, gpus in resource_sets: if not parallel: cores_used = gpus_used = nodes_used = 0 for _ in range(nsets): cores_used += tasks * cpus...
Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args": '--smpiargs="-gpu"', # extra jsrun arguments }) def my_operation(job): ... https:/...
SummitEnvironment
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SummitEnvironment: """Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args": '--smpiargs="-gpu"', # extra jsrun ar...
stack_v2_sparse_classes_36k_train_027240
10,994
permissive
[ { "docstring": "Compute the number of nodes needed. Parameters ---------- resource_sets : iterable of tuples Resource sets for each operation, as a sequence of tuples of *(Number of resource sets, tasks (MPI Ranks) per resource set, physical cores (CPUs) per resource set, GPUs per resource set)*. parallel : boo...
4
stack_v2_sparse_classes_30k_train_020518
Implement the Python class `SummitEnvironment` described below. Class description: Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args"...
Implement the Python class `SummitEnvironment` described below. Class description: Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args"...
845865c5f34135243ac21800495c46c915662c64
<|skeleton|> class SummitEnvironment: """Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args": '--smpiargs="-gpu"', # extra jsrun ar...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SummitEnvironment: """Environment profile for the Summit supercomputer. Example:: @Project.operation(directives={ "nranks": 3, # 3 MPI ranks per operation "ngpu": 3, # 3 GPUs "np": 3, # 3 CPU cores "rs_tasks": 3, # 3 tasks per resource set "extra_jsrun_args": '--smpiargs="-gpu"', # extra jsrun arguments }) de...
the_stack_v2_python_sparse
flow/environments/incite.py
glotzerlab/signac-flow
train
54
40b2f7bc6cab45259948d6f2f70a07fae7082e5c
[ "out = field.name + ' '\ntype = field.type\ndefault = field.default\nif field.auto_increment:\n assert is_int.search(type)\n type = re.sub(is_int, 'serial', type)\nout += type\nif default is not None:\n out += ' DEFAULT ' + default\nif not field.null:\n out += ' NOT NULL'\nreturn out", "func = index.f...
<|body_start_0|> out = field.name + ' ' type = field.type default = field.default if field.auto_increment: assert is_int.search(type) type = re.sub(is_int, 'serial', type) out += type if default is not None: out += ' DEFAULT ' + default...
exporter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class exporter: def field(self, field): """return the column-specific fraction of the CREATE TABLE""" <|body_0|> def index(self, index): """return the CREATE INDEX for the specified index""" <|body_1|> def alter_table(self, table): """return the ALTER ...
stack_v2_sparse_classes_36k_train_027241
2,687
no_license
[ { "docstring": "return the column-specific fraction of the CREATE TABLE", "name": "field", "signature": "def field(self, field)" }, { "docstring": "return the CREATE INDEX for the specified index", "name": "index", "signature": "def index(self, index)" }, { "docstring": "return t...
3
stack_v2_sparse_classes_30k_train_020012
Implement the Python class `exporter` described below. Class description: Implement the exporter class. Method signatures and docstrings: - def field(self, field): return the column-specific fraction of the CREATE TABLE - def index(self, index): return the CREATE INDEX for the specified index - def alter_table(self, ...
Implement the Python class `exporter` described below. Class description: Implement the exporter class. Method signatures and docstrings: - def field(self, field): return the column-specific fraction of the CREATE TABLE - def index(self, index): return the CREATE INDEX for the specified index - def alter_table(self, ...
642ff7f4ac31695e225445389325a26bdeab4ec7
<|skeleton|> class exporter: def field(self, field): """return the column-specific fraction of the CREATE TABLE""" <|body_0|> def index(self, index): """return the CREATE INDEX for the specified index""" <|body_1|> def alter_table(self, table): """return the ALTER ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class exporter: def field(self, field): """return the column-specific fraction of the CREATE TABLE""" out = field.name + ' ' type = field.type default = field.default if field.auto_increment: assert is_int.search(type) type = re.sub(is_int, 'serial', t...
the_stack_v2_python_sparse
branches/cimarron/yoryo-branch/fvl/xot/Exporters/Pg.py
BackupTheBerlios/luca-erp-svn
train
0
df5d2e0541397e5c8c6863ced056aa9a5711873f
[ "query = self.session.query(VTradehistory.o_time, VTradehistory.o_deal, VTradehistory.login, VTradehistory.symbol, VTradehistory.o_action, VTradehistory.volume, VTradehistory.o_price, VTradehistory.o_commission, VTradehistory.positionid, VTradehistory.c_time, VTradehistory.c_deal, VTradehistory.volumeclosed, VTrade...
<|body_start_0|> query = self.session.query(VTradehistory.o_time, VTradehistory.o_deal, VTradehistory.login, VTradehistory.symbol, VTradehistory.o_action, VTradehistory.volume, VTradehistory.o_price, VTradehistory.o_commission, VTradehistory.positionid, VTradehistory.c_time, VTradehistory.c_deal, VTradehistory....
v_tradehistory视图操作
VTradehistoryDao
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VTradehistoryDao: """v_tradehistory视图操作""" def search_by_uid(self, uid, start, end, mtlogin, page=None): """已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset""" <|body_0|> def searchsum_by_uid(self, uid, start, end, mt...
stack_v2_sparse_classes_36k_train_027242
26,694
permissive
[ { "docstring": "已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset", "name": "search_by_uid", "signature": "def search_by_uid(self, uid, start, end, mtlogin, page=None)" }, { "docstring": "已知用户id,根据时间段,查询总和 :param uid: 用户id :param start: 开始时间 :...
2
stack_v2_sparse_classes_30k_train_009878
Implement the Python class `VTradehistoryDao` described below. Class description: v_tradehistory视图操作 Method signatures and docstrings: - def search_by_uid(self, uid, start, end, mtlogin, page=None): 已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset - def searchsum_...
Implement the Python class `VTradehistoryDao` described below. Class description: v_tradehistory视图操作 Method signatures and docstrings: - def search_by_uid(self, uid, start, end, mtlogin, page=None): 已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset - def searchsum_...
1fadeecf31f1d25e258dc5d70c47a785f7b33961
<|skeleton|> class VTradehistoryDao: """v_tradehistory视图操作""" def search_by_uid(self, uid, start, end, mtlogin, page=None): """已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset""" <|body_0|> def searchsum_by_uid(self, uid, start, end, mt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VTradehistoryDao: """v_tradehistory视图操作""" def search_by_uid(self, uid, start, end, mtlogin, page=None): """已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset""" query = self.session.query(VTradehistory.o_time, VTradehistory.o_deal, VTra...
the_stack_v2_python_sparse
xwcrm/model/views.py
MSUNorg/XWCRM
train
0
d31cbc1f89c6b8c834a1e819fd9c0cbcdeb545c0
[ "if not isinstance(network, NN.BackPropagationNetwork):\n raise ValueError('Bad parameter {network}')\nself.Network = network\nself.DataSet = dataSet", "for i in range(self.MaxIterations):\n error = bpn.TrainEpoch(self.DataSet[0], self.DataSet[1], **kwags)\n if error <= min_error:\n break\n if ...
<|body_start_0|> if not isinstance(network, NN.BackPropagationNetwork): raise ValueError('Bad parameter {network}') self.Network = network self.DataSet = dataSet <|end_body_0|> <|body_start_1|> for i in range(self.MaxIterations): error = bpn.TrainEpoch(self.DataS...
This is a class which trains neural networks
NetworkTrainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworkTrainer: """This is a class which trains neural networks""" def __init__(self, network, dataSet): """Set up the trainer class""" <|body_0|> def TrainNetwork(self, min_error=0.1, display=True, **kwags): """Train the network until a specific error is reached...
stack_v2_sparse_classes_36k_train_027243
2,291
no_license
[ { "docstring": "Set up the trainer class", "name": "__init__", "signature": "def __init__(self, network, dataSet)" }, { "docstring": "Train the network until a specific error is reached", "name": "TrainNetwork", "signature": "def TrainNetwork(self, min_error=0.1, display=True, **kwags)" ...
2
stack_v2_sparse_classes_30k_train_001795
Implement the Python class `NetworkTrainer` described below. Class description: This is a class which trains neural networks Method signatures and docstrings: - def __init__(self, network, dataSet): Set up the trainer class - def TrainNetwork(self, min_error=0.1, display=True, **kwags): Train the network until a spec...
Implement the Python class `NetworkTrainer` described below. Class description: This is a class which trains neural networks Method signatures and docstrings: - def __init__(self, network, dataSet): Set up the trainer class - def TrainNetwork(self, min_error=0.1, display=True, **kwags): Train the network until a spec...
8f7f107a93bb7578a00d531123ee7f5db61d807e
<|skeleton|> class NetworkTrainer: """This is a class which trains neural networks""" def __init__(self, network, dataSet): """Set up the trainer class""" <|body_0|> def TrainNetwork(self, min_error=0.1, display=True, **kwags): """Train the network until a specific error is reached...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NetworkTrainer: """This is a class which trains neural networks""" def __init__(self, network, dataSet): """Set up the trainer class""" if not isinstance(network, NN.BackPropagationNetwork): raise ValueError('Bad parameter {network}') self.Network = network sel...
the_stack_v2_python_sparse
Advanced/NeuralNetwork/TestScript.py
jsa4000/Getting-Started-Python
train
0
59fb990cd7daafd55c010cf346c5c540891ce2ae
[ "pygame.init()\nwidth, height = Display_Config['BATTLE_SIZE']\nheight += Display_Config['LOG_SIZE'][1]\nheight += Display_Config['SELECT_SIZE'][1]\nif state['use_agent'] and Display_Config['VISUALIZE_AGENT_INFO']:\n width *= 2\nSCREEN_SIZE = (width, height)\nself.SCREEN = display.set_mode(scale(SCREEN_SIZE))\ndi...
<|body_start_0|> pygame.init() width, height = Display_Config['BATTLE_SIZE'] height += Display_Config['LOG_SIZE'][1] height += Display_Config['SELECT_SIZE'][1] if state['use_agent'] and Display_Config['VISUALIZE_AGENT_INFO']: width *= 2 SCREEN_SIZE = (width, h...
Window
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Window: def __init__(self, state): """Args: state ('dict of class:Pokemon'): A dictionary with all the information needed to display the a battle. Note: This dict have as key: "Ally_0", "Ally_1", "Foe_0" and "Foe_1" with the corresponding pokemon as a value. Action: Create and execute a ...
stack_v2_sparse_classes_36k_train_027244
6,184
no_license
[ { "docstring": "Args: state ('dict of class:Pokemon'): A dictionary with all the information needed to display the a battle. Note: This dict have as key: \"Ally_0\", \"Ally_1\", \"Foe_0\" and \"Foe_1\" with the corresponding pokemon as a value. Action: Create and execute a window where the 'state' of a battle i...
6
stack_v2_sparse_classes_30k_train_014480
Implement the Python class `Window` described below. Class description: Implement the Window class. Method signatures and docstrings: - def __init__(self, state): Args: state ('dict of class:Pokemon'): A dictionary with all the information needed to display the a battle. Note: This dict have as key: "Ally_0", "Ally_1...
Implement the Python class `Window` described below. Class description: Implement the Window class. Method signatures and docstrings: - def __init__(self, state): Args: state ('dict of class:Pokemon'): A dictionary with all the information needed to display the a battle. Note: This dict have as key: "Ally_0", "Ally_1...
aa9defc6387788fc57d50dfdff7e4c43e8a1c358
<|skeleton|> class Window: def __init__(self, state): """Args: state ('dict of class:Pokemon'): A dictionary with all the information needed to display the a battle. Note: This dict have as key: "Ally_0", "Ally_1", "Foe_0" and "Foe_1" with the corresponding pokemon as a value. Action: Create and execute a ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Window: def __init__(self, state): """Args: state ('dict of class:Pokemon'): A dictionary with all the information needed to display the a battle. Note: This dict have as key: "Ally_0", "Ally_1", "Foe_0" and "Foe_1" with the corresponding pokemon as a value. Action: Create and execute a window where t...
the_stack_v2_python_sparse
Game/display/window.py
dieguigram/Pokemon-Python
train
0
178b9feef02172cf624586a2297447f07cb94888
[ "self.site_envs = site_envs\nself.unique_site_types: List[str] = [env.sitetypes[0] for env in self.site_envs]\nself.ns = ns\nself.na = na\nself.aos = aos\nself.eigen_tol = eigen_tol\nself.pbc = pbc\nself.cutoff = cutoff", "oss = [species for species in struct.site_properties['oss'] if species != '-1']\nXSites = n...
<|body_start_0|> self.site_envs = site_envs self.unique_site_types: List[str] = [env.sitetypes[0] for env in self.site_envs] self.ns = ns self.na = na self.aos = aos self.eigen_tol = eigen_tol self.pbc = pbc self.cutoff = cutoff <|end_body_0|> <|body_star...
_SiteEnvironments
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SiteEnvironments: def __init__(self, site_envs: List[_SiteEnvironment], ns: int, na: int, aos: List[str], eigen_tol: float, pbc: np.typing.ArrayLike, cutoff: float): """Initialize Use Load to initialize this class. Parameters ---------- site_envs : List[_SiteEnvironment] list of _SiteEn...
stack_v2_sparse_classes_36k_train_027245
28,058
permissive
[ { "docstring": "Initialize Use Load to initialize this class. Parameters ---------- site_envs : List[_SiteEnvironment] list of _SiteEnvironment object ns : int number of spectator sites types na : int number of active sites types aos : List[str] Available occupational states for active sites string should be th...
3
null
Implement the Python class `_SiteEnvironments` described below. Class description: Implement the _SiteEnvironments class. Method signatures and docstrings: - def __init__(self, site_envs: List[_SiteEnvironment], ns: int, na: int, aos: List[str], eigen_tol: float, pbc: np.typing.ArrayLike, cutoff: float): Initialize U...
Implement the Python class `_SiteEnvironments` described below. Class description: Implement the _SiteEnvironments class. Method signatures and docstrings: - def __init__(self, site_envs: List[_SiteEnvironment], ns: int, na: int, aos: List[str], eigen_tol: float, pbc: np.typing.ArrayLike, cutoff: float): Initialize U...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class _SiteEnvironments: def __init__(self, site_envs: List[_SiteEnvironment], ns: int, na: int, aos: List[str], eigen_tol: float, pbc: np.typing.ArrayLike, cutoff: float): """Initialize Use Load to initialize this class. Parameters ---------- site_envs : List[_SiteEnvironment] list of _SiteEn...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _SiteEnvironments: def __init__(self, site_envs: List[_SiteEnvironment], ns: int, na: int, aos: List[str], eigen_tol: float, pbc: np.typing.ArrayLike, cutoff: float): """Initialize Use Load to initialize this class. Parameters ---------- site_envs : List[_SiteEnvironment] list of _SiteEnvironment obje...
the_stack_v2_python_sparse
deepchem/feat/material_featurizers/lcnn_featurizer.py
deepchem/deepchem
train
4,876
94ee02b8bd646e085100725fb7389e78ad1fb518
[ "headers = {}\nif status:\n headers['x-image-meta-status'] = status\nurl = '/v1/images/' + image_id\nresponse = self._put(url, headers)\nresponse.raise_for_status()", "response = self._head('/v1/images/{}'.format(image_id))\nresponse.raise_for_status()\ndata = self._retrieve_data(response)\nreturn Resource(sel...
<|body_start_0|> headers = {} if status: headers['x-image-meta-status'] = status url = '/v1/images/' + image_id response = self._put(url, headers) response.raise_for_status() <|end_body_0|> <|body_start_1|> response = self._head('/v1/images/{}'.format(image_i...
Glance API client v1.
ApiClientV1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiClientV1: """Glance API client v1.""" def images_update(self, image_id, status=None): """Update image via API call.""" <|body_0|> def images_get(self, image_id): """Get image via API call. Args: image id (str): image ID Returns: Resource: image""" <|bo...
stack_v2_sparse_classes_36k_train_027246
1,422
no_license
[ { "docstring": "Update image via API call.", "name": "images_update", "signature": "def images_update(self, image_id, status=None)" }, { "docstring": "Get image via API call. Args: image id (str): image ID Returns: Resource: image", "name": "images_get", "signature": "def images_get(self...
2
null
Implement the Python class `ApiClientV1` described below. Class description: Glance API client v1. Method signatures and docstrings: - def images_update(self, image_id, status=None): Update image via API call. - def images_get(self, image_id): Get image via API call. Args: image id (str): image ID Returns: Resource: ...
Implement the Python class `ApiClientV1` described below. Class description: Glance API client v1. Method signatures and docstrings: - def images_update(self, image_id, status=None): Update image via API call. - def images_get(self, image_id): Get image via API call. Args: image id (str): image ID Returns: Resource: ...
e7583444cd24893ec6ae237b47db7c605b99b0c5
<|skeleton|> class ApiClientV1: """Glance API client v1.""" def images_update(self, image_id, status=None): """Update image via API call.""" <|body_0|> def images_get(self, image_id): """Get image via API call. Args: image id (str): image ID Returns: Resource: image""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ApiClientV1: """Glance API client v1.""" def images_update(self, image_id, status=None): """Update image via API call.""" headers = {} if status: headers['x-image-meta-status'] = status url = '/v1/images/' + image_id response = self._put(url, headers) ...
the_stack_v2_python_sparse
stepler/glance/api_clients/v1.py
Mirantis/stepler
train
16
b4b0bb45cb9dd83973be2dc4ac1f50f87524f7ad
[ "sale_order_obj = self.pool.get('sale.order')\nsale_order_brws = sale_order_obj.browse(cr, uid, values['order_id'], context)\nproduct_brws = self.pool.get('product.product').browse(cr, uid, values['product_id'], context)\nfields_to_default = ['product_uom', 'discount', 'product_uom_qty', 'product_uos_qty', 'state']...
<|body_start_0|> sale_order_obj = self.pool.get('sale.order') sale_order_brws = sale_order_obj.browse(cr, uid, values['order_id'], context) product_brws = self.pool.get('product.product').browse(cr, uid, values['product_id'], context) fields_to_default = ['product_uom', 'discount', 'prod...
sale_order_line
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class sale_order_line: def create_and_update_prices(self, cr, uid, values, context={}): """Create and update prices :param cr: :param uid: :param values: Must contain order_id, product_id, name, product_uom_qty :param context: :return:""" <|body_0|> def write_and_update_prices(sel...
stack_v2_sparse_classes_36k_train_027247
11,160
no_license
[ { "docstring": "Create and update prices :param cr: :param uid: :param values: Must contain order_id, product_id, name, product_uom_qty :param context: :return:", "name": "create_and_update_prices", "signature": "def create_and_update_prices(self, cr, uid, values, context={})" }, { "docstring": ...
2
null
Implement the Python class `sale_order_line` described below. Class description: Implement the sale_order_line class. Method signatures and docstrings: - def create_and_update_prices(self, cr, uid, values, context={}): Create and update prices :param cr: :param uid: :param values: Must contain order_id, product_id, n...
Implement the Python class `sale_order_line` described below. Class description: Implement the sale_order_line class. Method signatures and docstrings: - def create_and_update_prices(self, cr, uid, values, context={}): Create and update prices :param cr: :param uid: :param values: Must contain order_id, product_id, n...
bb925edf7eaee44a96da12cbb86263ece0ae052c
<|skeleton|> class sale_order_line: def create_and_update_prices(self, cr, uid, values, context={}): """Create and update prices :param cr: :param uid: :param values: Must contain order_id, product_id, name, product_uom_qty :param context: :return:""" <|body_0|> def write_and_update_prices(sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class sale_order_line: def create_and_update_prices(self, cr, uid, values, context={}): """Create and update prices :param cr: :param uid: :param values: Must contain order_id, product_id, name, product_uom_qty :param context: :return:""" sale_order_obj = self.pool.get('sale.order') sale_ord...
the_stack_v2_python_sparse
ax_ws_sale_order/models/sale_order_line.py
davidts-leathergoods/odoo7
train
0
28410eb18f8f161b2be122b87dabeef18baa25cd
[ "left = 0\nright = len(nums) - 1\nwhile left <= right:\n mid = (left + right) // 2\n if nums[mid] == target:\n return mid\n elif nums[mid] < target:\n left = mid + 1\n else:\n right = mid - 1\nreturn -1", "left = 0\nright = len(nums) - 1\nwhile left <= right:\n mid = (left + ri...
<|body_start_0|> left = 0 right = len(nums) - 1 while left <= right: mid = (left + right) // 2 if nums[mid] == target: return mid elif nums[mid] < target: left = mid + 1 else: right = mid - 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def binarySearch(self, nums, target): """二查搜索,找到则返回索引,否则返回-1""" <|body_0|> def left_bound(self, nums, target): """寻找左侧边界的二分搜索""" <|body_1|> def right_bound(self, nums, target): """寻找左侧边界的二分搜索""" <|body_2|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_027248
1,555
no_license
[ { "docstring": "二查搜索,找到则返回索引,否则返回-1", "name": "binarySearch", "signature": "def binarySearch(self, nums, target)" }, { "docstring": "寻找左侧边界的二分搜索", "name": "left_bound", "signature": "def left_bound(self, nums, target)" }, { "docstring": "寻找左侧边界的二分搜索", "name": "right_bound", ...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binarySearch(self, nums, target): 二查搜索,找到则返回索引,否则返回-1 - def left_bound(self, nums, target): 寻找左侧边界的二分搜索 - def right_bound(self, nums, target): 寻找左侧边界的二分搜索
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def binarySearch(self, nums, target): 二查搜索,找到则返回索引,否则返回-1 - def left_bound(self, nums, target): 寻找左侧边界的二分搜索 - def right_bound(self, nums, target): 寻找左侧边界的二分搜索 <|skeleton|> class...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class Solution: def binarySearch(self, nums, target): """二查搜索,找到则返回索引,否则返回-1""" <|body_0|> def left_bound(self, nums, target): """寻找左侧边界的二分搜索""" <|body_1|> def right_bound(self, nums, target): """寻找左侧边界的二分搜索""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def binarySearch(self, nums, target): """二查搜索,找到则返回索引,否则返回-1""" left = 0 right = len(nums) - 1 while left <= right: mid = (left + right) // 2 if nums[mid] == target: return mid elif nums[mid] < target: ...
the_stack_v2_python_sparse
fuck/算法思维/二分法.py
2226171237/Algorithmpractice
train
0
4465bedab331f4fc1378cddb2d4933ed199d76f4
[ "super(DNET_COLORED, self).__init__()\nself.nc = 3\nself.ef_dim = nef\nself.df_dim = ndf\nself.define_module()", "nef = self.ef_dim\nndf = self.df_dim\nself.netD_1 = nn.Sequential(conv4x4(self.nc, ndf), nn.BatchNorm2d(num_features=ndf), nn.LeakyReLU(negative_slope=0.2, inplace=True), conv4x4(ndf, ndf * 2), nn.Bat...
<|body_start_0|> super(DNET_COLORED, self).__init__() self.nc = 3 self.ef_dim = nef self.df_dim = ndf self.define_module() <|end_body_0|> <|body_start_1|> nef = self.ef_dim ndf = self.df_dim self.netD_1 = nn.Sequential(conv4x4(self.nc, ndf), nn.BatchNorm2...
Discriminator class for the ENCOLOR stage. Args: - ndf (int, optional): Number of discriminator filters in the first convolutional layer. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128)
DNET_COLORED
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DNET_COLORED: """Discriminator class for the ENCOLOR stage. Args: - ndf (int, optional): Number of discriminator filters in the first convolutional layer. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128)""" def __init__(self, ndf=64, nef=128): """I...
stack_v2_sparse_classes_36k_train_027249
22,492
no_license
[ { "docstring": "Initialize the ENCOLOR stage discriminator. Other attributes: - nc (int): Number of channels.", "name": "__init__", "signature": "def __init__(self, ndf=64, nef=128)" }, { "docstring": "Define stage 2 discriminator's model.", "name": "define_module", "signature": "def def...
3
stack_v2_sparse_classes_30k_train_002130
Implement the Python class `DNET_COLORED` described below. Class description: Discriminator class for the ENCOLOR stage. Args: - ndf (int, optional): Number of discriminator filters in the first convolutional layer. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128) Method signatures...
Implement the Python class `DNET_COLORED` described below. Class description: Discriminator class for the ENCOLOR stage. Args: - ndf (int, optional): Number of discriminator filters in the first convolutional layer. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128) Method signatures...
70d344d80425e7bbcc7984737dbe50a6638293c9
<|skeleton|> class DNET_COLORED: """Discriminator class for the ENCOLOR stage. Args: - ndf (int, optional): Number of discriminator filters in the first convolutional layer. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128)""" def __init__(self, ndf=64, nef=128): """I...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DNET_COLORED: """Discriminator class for the ENCOLOR stage. Args: - ndf (int, optional): Number of discriminator filters in the first convolutional layer. (Default: 64) - nef (int, optional): Projected embeddings dimensions. (Default: 128)""" def __init__(self, ndf=64, nef=128): """Initialize the...
the_stack_v2_python_sparse
TeleGAN/model.py
ails-lab/teleGAN
train
1
6387c095a5ec6b367f22e096f4b47a3f26ff66e7
[ "self.nodes = []\nhead = point = ListNode(0)\nfor l in lists:\n while l:\n self.nodes.append(l.val)\n l = l.next\nfor x in sorted(self.nodes):\n point.next = ListNode(x)\n point = point.next\nreturn head.next", "def merge(lis1, lis2):\n result = pt = ListNode(0)\n while lis1 and lis2:...
<|body_start_0|> self.nodes = [] head = point = ListNode(0) for l in lists: while l: self.nodes.append(l.val) l = l.next for x in sorted(self.nodes): point.next = ListNode(x) point = point.next return head.next <...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> def mergeKLists(self, lists): """:type lists: List[L...
stack_v2_sparse_classes_36k_train_027250
2,864
no_license
[ { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" }, { "docstring":...
3
stack_v2_sparse_classes_30k_val_001031
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeKLists(self, li...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode - def mergeKLists(self, li...
62ad010a992c031e8c0fe4d1a9b6f9364f96ed4c
<|skeleton|> class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> def mergeKLists(self, lists): """:type lists: List[L...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" self.nodes = [] head = point = ListNode(0) for l in lists: while l: self.nodes.append(l.val) l = l.next for x in sorted(self.nodes): ...
the_stack_v2_python_sparse
leetcode/solved/023_.py
usnnu/python_foundation
train
0
f1b06aeb6215bbceb5127b1c6f7f8d733ac74891
[ "if head is None:\n return None\ndummyHead = ListNode(0)\nh1 = dummyHead\nh1.next = head\nh1 = h1.next\nh2 = h1.next\nwhile h2:\n if h2.val != h1.val:\n h1.next = h2\n h1 = h1.next\n h2 = h2.next\nh1.next = None\nreturn dummyHead.next", "if head is None:\n return None\nh1 = head\nh2 = h1...
<|body_start_0|> if head is None: return None dummyHead = ListNode(0) h1 = dummyHead h1.next = head h1 = h1.next h2 = h1.next while h2: if h2.val != h1.val: h1.next = h2 h1 = h1.next h2 = h2.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head is None: ...
stack_v2_sparse_classes_36k_train_027251
1,561
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates", "signature": "def deleteDuplicates(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "deleteDuplicates2", "signature": "def deleteDuplicates2(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates2(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteDuplicates(self, head): :type head: ListNode :rtype: ListNode - def deleteDuplicates2(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: ...
c34b55bb42dc44a9026a902f6afcc018b4154662
<|skeleton|> class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def deleteDuplicates2(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def deleteDuplicates(self, head): """:type head: ListNode :rtype: ListNode""" if head is None: return None dummyHead = ListNode(0) h1 = dummyHead h1.next = head h1 = h1.next h2 = h1.next while h2: if h2.val != h1...
the_stack_v2_python_sparse
Algorithm/Remove Duplicates from Sorted List.py
superpigBB/Happy-Coding
train
0
527d05accf5ec186ab6d4c7bbb87c205f8a14da0
[ "self.what = what\nself.directory = directory\nif not os.path.exists(f'{settings.CONFIG_FOLDER}/.build_state'):\n os.makedirs(f'{settings.CONFIG_FOLDER}/.build_state')\nself.state_file_name = f'{settings.CONFIG_FOLDER}/.build_state/last_change_{what}.txt'", "try:\n os.remove(self.state_file_name)\nexcept:\n...
<|body_start_0|> self.what = what self.directory = directory if not os.path.exists(f'{settings.CONFIG_FOLDER}/.build_state'): os.makedirs(f'{settings.CONFIG_FOLDER}/.build_state') self.state_file_name = f'{settings.CONFIG_FOLDER}/.build_state/last_change_{what}.txt' <|end_bod...
Try not to re-do what doesn't need to be redone
BuildState
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildState: """Try not to re-do what doesn't need to be redone""" def __init__(self, what: str, directory: str) -> None: """Set initial state""" <|body_0|> def oh_never_mind(self) -> None: """If a task fails, we don't care if it didn't change since last, re-run,"...
stack_v2_sparse_classes_36k_train_027252
8,201
permissive
[ { "docstring": "Set initial state", "name": "__init__", "signature": "def __init__(self, what: str, directory: str) -> None" }, { "docstring": "If a task fails, we don't care if it didn't change since last, re-run,", "name": "oh_never_mind", "signature": "def oh_never_mind(self) -> None"...
3
stack_v2_sparse_classes_30k_train_012366
Implement the Python class `BuildState` described below. Class description: Try not to re-do what doesn't need to be redone Method signatures and docstrings: - def __init__(self, what: str, directory: str) -> None: Set initial state - def oh_never_mind(self) -> None: If a task fails, we don't care if it didn't change...
Implement the Python class `BuildState` described below. Class description: Try not to re-do what doesn't need to be redone Method signatures and docstrings: - def __init__(self, what: str, directory: str) -> None: Set initial state - def oh_never_mind(self) -> None: If a task fails, we don't care if it didn't change...
d2771ae80994032bffa398baa246a9520e1a2e48
<|skeleton|> class BuildState: """Try not to re-do what doesn't need to be redone""" def __init__(self, what: str, directory: str) -> None: """Set initial state""" <|body_0|> def oh_never_mind(self) -> None: """If a task fails, we don't care if it didn't change since last, re-run,"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BuildState: """Try not to re-do what doesn't need to be redone""" def __init__(self, what: str, directory: str) -> None: """Set initial state""" self.what = what self.directory = directory if not os.path.exists(f'{settings.CONFIG_FOLDER}/.build_state'): os.make...
the_stack_v2_python_sparse
navio_tasks/build_state.py
matthewdeanmartin/cheese_grader
train
9
fe53b5ab6aaacdafae2d2d97b37f545b51b62eac
[ "self.jsonService = JsonService()\nself.dataFrame = pandas.read_csv(csvFile)\nself.dataFrame.dropna(inplace=True)", "properties = dict()\nfor index, row in self.dataFrame.iterrows():\n func(properties, row)\nprint(properties)\nself.jsonService.save(jsonFile, properties)" ]
<|body_start_0|> self.jsonService = JsonService() self.dataFrame = pandas.read_csv(csvFile) self.dataFrame.dropna(inplace=True) <|end_body_0|> <|body_start_1|> properties = dict() for index, row in self.dataFrame.iterrows(): func(properties, row) print(proper...
处理 CSV 文件为 JSON 文件
CsvHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CsvHandler: """处理 CSV 文件为 JSON 文件""" def __init__(self, csvFile): """初始化 新建对象时默认执行 参数值: csvFile (str): 要读取的 CSV 文件""" <|body_0|> def operate(self, func, jsonFile): """处理 CSV 文件为 JSON 文件 参数值: func (func(dict, row)): 处理规则函数 函数参数要求: dict(dict): JSON 文件格式 row(pandas....
stack_v2_sparse_classes_36k_train_027253
2,353
no_license
[ { "docstring": "初始化 新建对象时默认执行 参数值: csvFile (str): 要读取的 CSV 文件", "name": "__init__", "signature": "def __init__(self, csvFile)" }, { "docstring": "处理 CSV 文件为 JSON 文件 参数值: func (func(dict, row)): 处理规则函数 函数参数要求: dict(dict): JSON 文件格式 row(pandas.series): CSV 文件的每一列 jsonFile (str): 要存储为的 JSON 文件", ...
2
stack_v2_sparse_classes_30k_train_001092
Implement the Python class `CsvHandler` described below. Class description: 处理 CSV 文件为 JSON 文件 Method signatures and docstrings: - def __init__(self, csvFile): 初始化 新建对象时默认执行 参数值: csvFile (str): 要读取的 CSV 文件 - def operate(self, func, jsonFile): 处理 CSV 文件为 JSON 文件 参数值: func (func(dict, row)): 处理规则函数 函数参数要求: dict(dict): ...
Implement the Python class `CsvHandler` described below. Class description: 处理 CSV 文件为 JSON 文件 Method signatures and docstrings: - def __init__(self, csvFile): 初始化 新建对象时默认执行 参数值: csvFile (str): 要读取的 CSV 文件 - def operate(self, func, jsonFile): 处理 CSV 文件为 JSON 文件 参数值: func (func(dict, row)): 处理规则函数 函数参数要求: dict(dict): ...
105caf2288435c50ae693ff12a0e4e72822587d6
<|skeleton|> class CsvHandler: """处理 CSV 文件为 JSON 文件""" def __init__(self, csvFile): """初始化 新建对象时默认执行 参数值: csvFile (str): 要读取的 CSV 文件""" <|body_0|> def operate(self, func, jsonFile): """处理 CSV 文件为 JSON 文件 参数值: func (func(dict, row)): 处理规则函数 函数参数要求: dict(dict): JSON 文件格式 row(pandas....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CsvHandler: """处理 CSV 文件为 JSON 文件""" def __init__(self, csvFile): """初始化 新建对象时默认执行 参数值: csvFile (str): 要读取的 CSV 文件""" self.jsonService = JsonService() self.dataFrame = pandas.read_csv(csvFile) self.dataFrame.dropna(inplace=True) def operate(self, func, jsonFile): ...
the_stack_v2_python_sparse
CsvHandler.py
YuanLinStudio/Inspection-Record-Consolidating-System
train
0
ffe8e6e878bca9a8f4771447b78f105f74b32c7b
[ "self.tolerance2 = tolerance ** 2.0\nself.pointList = pointList\nself.coords = [[point[0] for point in pointList], [point[1] for point in pointList], [point[2] for point in pointList]]\nself.mins = [10000, 10000, 10000]\nself.maxs = [-10000, -10000, -10000]\nfor dimension in xrange(3):\n self.mins[dimension] = i...
<|body_start_0|> self.tolerance2 = tolerance ** 2.0 self.pointList = pointList self.coords = [[point[0] for point in pointList], [point[1] for point in pointList], [point[2] for point in pointList]] self.mins = [10000, 10000, 10000] self.maxs = [-10000, -10000, -10000] fo...
buckets class is used for fast 3d point overlapping puts all points into buckets in each dimension only compare to reasonably nearby points assumes tolerance <<<< 1 angstrom
Bucket3d
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Bucket3d: """buckets class is used for fast 3d point overlapping puts all points into buckets in each dimension only compare to reasonably nearby points assumes tolerance <<<< 1 angstrom""" def __init__(self, pointList, tolerance): """takes the point list and makes buckets for search...
stack_v2_sparse_classes_36k_train_027254
4,829
permissive
[ { "docstring": "takes the point list and makes buckets for searching later. O(n)", "name": "__init__", "signature": "def __init__(self, pointList, tolerance)" }, { "docstring": "souped up for speed version of code. puts nearby points into the unionfind data structure 'clusters'. does every possi...
3
stack_v2_sparse_classes_30k_train_001988
Implement the Python class `Bucket3d` described below. Class description: buckets class is used for fast 3d point overlapping puts all points into buckets in each dimension only compare to reasonably nearby points assumes tolerance <<<< 1 angstrom Method signatures and docstrings: - def __init__(self, pointList, tole...
Implement the Python class `Bucket3d` described below. Class description: buckets class is used for fast 3d point overlapping puts all points into buckets in each dimension only compare to reasonably nearby points assumes tolerance <<<< 1 angstrom Method signatures and docstrings: - def __init__(self, pointList, tole...
5b930ce2fdf5def49444f1953457745af964efe9
<|skeleton|> class Bucket3d: """buckets class is used for fast 3d point overlapping puts all points into buckets in each dimension only compare to reasonably nearby points assumes tolerance <<<< 1 angstrom""" def __init__(self, pointList, tolerance): """takes the point list and makes buckets for search...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Bucket3d: """buckets class is used for fast 3d point overlapping puts all points into buckets in each dimension only compare to reasonably nearby points assumes tolerance <<<< 1 angstrom""" def __init__(self, pointList, tolerance): """takes the point list and makes buckets for searching later. O(...
the_stack_v2_python_sparse
KCNQ/docking/scripts/common/buckets.py
jilimcaoco/MPProjects
train
0
de31272b0541e67565800a46e2d4dc62e1ad32d8
[ "if id:\n activity = session.restclient.lookup_activity(str(id))\n if '_attributes' not in activity.keys():\n raise NotFoundError(f'Activity not found: {id}')\nself.request_href = activity['_links']['request']['href']\nself.href = activity['_links']['self']['href']\nself.workitem_href = activity['_link...
<|body_start_0|> if id: activity = session.restclient.lookup_activity(str(id)) if '_attributes' not in activity.keys(): raise NotFoundError(f'Activity not found: {id}') self.request_href = activity['_links']['request']['href'] self.href = activity['_links'...
Activity
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Activity: def __init__(self, session: 'Session', activity=None, id: str=None): """Represents an ISIM Activity. Can do lookup using the id attribute. Args: session (Session): Active ISIM Session activity (zeep.WSActivity, optional): Activity object returned from ISIM REST API. Defaults to...
stack_v2_sparse_classes_36k_train_027255
2,619
permissive
[ { "docstring": "Represents an ISIM Activity. Can do lookup using the id attribute. Args: session (Session): Active ISIM Session activity (zeep.WSActivity, optional): Activity object returned from ISIM REST API. Defaults to None. id (str, optional): Activity ID for lookup. Defaults to None.", "name": "__init...
2
stack_v2_sparse_classes_30k_train_002802
Implement the Python class `Activity` described below. Class description: Implement the Activity class. Method signatures and docstrings: - def __init__(self, session: 'Session', activity=None, id: str=None): Represents an ISIM Activity. Can do lookup using the id attribute. Args: session (Session): Active ISIM Sessi...
Implement the Python class `Activity` described below. Class description: Implement the Activity class. Method signatures and docstrings: - def __init__(self, session: 'Session', activity=None, id: str=None): Represents an ISIM Activity. Can do lookup using the id attribute. Args: session (Session): Active ISIM Sessi...
c86e87ab1ca7e39169a1a8e565de2afc7ff49d52
<|skeleton|> class Activity: def __init__(self, session: 'Session', activity=None, id: str=None): """Represents an ISIM Activity. Can do lookup using the id attribute. Args: session (Session): Active ISIM Session activity (zeep.WSActivity, optional): Activity object returned from ISIM REST API. Defaults to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Activity: def __init__(self, session: 'Session', activity=None, id: str=None): """Represents an ISIM Activity. Can do lookup using the id attribute. Args: session (Session): Active ISIM Session activity (zeep.WSActivity, optional): Activity object returned from ISIM REST API. Defaults to None. id (str...
the_stack_v2_python_sparse
pyisim/entities/activity.py
cazdlt/pyisim
train
1
bf244c8d59f7592201f06cb1c6b38b4b540dd931
[ "if not request.user.has_perm('Users.prop_get'):\n return HttpResponseForbidden()\nuser = user_backend.get(username=name)\nvalue = property_backend.get(user=user, key=subname)\nreturn HttpRestAuthResponse(request, value)", "if not request.user.has_perm('Users.prop_set'):\n return HttpResponseForbidden()\nva...
<|body_start_0|> if not request.user.has_perm('Users.prop_get'): return HttpResponseForbidden() user = user_backend.get(username=name) value = property_backend.get(user=user, key=subname) return HttpRestAuthResponse(request, value) <|end_body_0|> <|body_start_1|> if ...
Handle requests to ``/users/<user>/props/<prop>/``.
UserPropHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserPropHandler: """Handle requests to ``/users/<user>/props/<prop>/``.""" def get(self, request, largs, name, subname): """Get value of a single property.""" <|body_0|> def put(self, request, largs, name, subname): """Set value of a single property.""" <...
stack_v2_sparse_classes_36k_train_027256
9,743
no_license
[ { "docstring": "Get value of a single property.", "name": "get", "signature": "def get(self, request, largs, name, subname)" }, { "docstring": "Set value of a single property.", "name": "put", "signature": "def put(self, request, largs, name, subname)" }, { "docstring": "Delete a...
3
stack_v2_sparse_classes_30k_train_004090
Implement the Python class `UserPropHandler` described below. Class description: Handle requests to ``/users/<user>/props/<prop>/``. Method signatures and docstrings: - def get(self, request, largs, name, subname): Get value of a single property. - def put(self, request, largs, name, subname): Set value of a single p...
Implement the Python class `UserPropHandler` described below. Class description: Handle requests to ``/users/<user>/props/<prop>/``. Method signatures and docstrings: - def get(self, request, largs, name, subname): Get value of a single property. - def put(self, request, largs, name, subname): Set value of a single p...
60769f6b4965836b2220878cfa2e1bc403d8f8a3
<|skeleton|> class UserPropHandler: """Handle requests to ``/users/<user>/props/<prop>/``.""" def get(self, request, largs, name, subname): """Get value of a single property.""" <|body_0|> def put(self, request, largs, name, subname): """Set value of a single property.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserPropHandler: """Handle requests to ``/users/<user>/props/<prop>/``.""" def get(self, request, largs, name, subname): """Get value of a single property.""" if not request.user.has_perm('Users.prop_get'): return HttpResponseForbidden() user = user_backend.get(usernam...
the_stack_v2_python_sparse
env/lib/python3.6/site-packages/RestAuth/Users/views.py
sachinlokesh05/login-registration-forgotpassword-and-resetpassword-using-django-rest-framework-
train
3
49894df219e40238550e88364f9285d77d9ed199
[ "def searchrow(start, end):\n if start > end:\n return -1\n mid = start + (end - start) // 2\n if matrix[mid][0] <= target <= matrix[mid][-1]:\n return mid\n elif target < matrix[mid][0]:\n return searchrow(start, mid - 1)\n else:\n return searchrow(mid + 1, end)\n\ndef se...
<|body_start_0|> def searchrow(start, end): if start > end: return -1 mid = start + (end - start) // 2 if matrix[mid][0] <= target <= matrix[mid][-1]: return mid elif target < matrix[mid][0]: return searchrow(start, ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94%""" <|body_0|> def searchMatrix1(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool 一次二分搜...
stack_v2_sparse_classes_36k_train_027257
3,120
no_license
[ { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94%", "name": "searchMatrix", "signature": "def searchMatrix(self, matrix, target)" }, { "docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool 一次二分搜索 时间击败62.95%,内存击败13.28%",...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94% - def searchMatrix1(self, matrix, target): :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94% - def searchMatrix1(self, matrix, target): :type...
2dc982e690b153c33bc7e27a63604f754a0df90c
<|skeleton|> class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94%""" <|body_0|> def searchMatrix1(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool 一次二分搜...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def searchMatrix(self, matrix, target): """:type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94%""" def searchrow(start, end): if start > end: return -1 mid = start + (end - start) // 2 if matrix[...
the_stack_v2_python_sparse
74_search-a-2d-matrix.py
95275059/Algorithm
train
0
627d36c735d93da8c56ff51b2646df9bf1a8d284
[ "super().__init__(coordinator)\nself.entity_description = description\nself._attr_name = f'{name} {description.name}'\nself._attr_unique_id = f'{station_id}_{description.key}'\nself.station_id = f'{station_id}'\nself._attr_device_info = DeviceInfo(entry_type=DeviceEntryType.SERVICE, identifiers={(DOMAIN, station_id...
<|body_start_0|> super().__init__(coordinator) self.entity_description = description self._attr_name = f'{name} {description.name}' self._attr_unique_id = f'{station_id}_{description.key}' self.station_id = f'{station_id}' self._attr_device_info = DeviceInfo(entry_type=De...
Implementation of a ZAMG sensor.
ZamgSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ZamgSensor: """Implementation of a ZAMG sensor.""" def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None: """Initialize the sensor.""" <|body_0|> def native_value(self) -> StateType: ...
stack_v2_sparse_classes_36k_train_027258
7,261
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None" }, { "docstring": "Return the state of the sensor.", "name": "native_value", ...
3
stack_v2_sparse_classes_30k_train_014629
Implement the Python class `ZamgSensor` described below. Class description: Implementation of a ZAMG sensor. Method signatures and docstrings: - def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None: Initialize the sensor. - def native...
Implement the Python class `ZamgSensor` described below. Class description: Implementation of a ZAMG sensor. Method signatures and docstrings: - def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None: Initialize the sensor. - def native...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class ZamgSensor: """Implementation of a ZAMG sensor.""" def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None: """Initialize the sensor.""" <|body_0|> def native_value(self) -> StateType: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ZamgSensor: """Implementation of a ZAMG sensor.""" def __init__(self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str, description: ZamgSensorEntityDescription) -> None: """Initialize the sensor.""" super().__init__(coordinator) self.entity_description = descrip...
the_stack_v2_python_sparse
homeassistant/components/zamg/sensor.py
home-assistant/core
train
35,501
2aa37973f000896d6317b2964e0783f309c6e0c6
[ "seen = set()\nnum = list(str(n))\nsum = 0\nwhile True:\n for i in num:\n sum += int(i) ** 2\n if sum == 1:\n return True\n if sum in seen:\n return False\n seen.add(sum)\n num = list(str(sum))\n sum = 0", "def get_next(n):\n sum = 0\n num = list(str(n))\n for i in ...
<|body_start_0|> seen = set() num = list(str(n)) sum = 0 while True: for i in num: sum += int(i) ** 2 if sum == 1: return True if sum in seen: return False seen.add(sum) num = list...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isHappy_1(self, n): """*使用set 检查数字是否在哈希集中需要O(1)的时间,而对于其他数据结构,则需要O(n)的时间。选择正确的数据结构是解决这些问题的关键部分。 时间复杂度 o(logn) 空间复杂度 o(logn)""" <|body_0|> def isHappy_2(self, n): """*使用两个指针 时间复杂度 o(logn) 空间复杂度 o(1)""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_027259
1,243
no_license
[ { "docstring": "*使用set 检查数字是否在哈希集中需要O(1)的时间,而对于其他数据结构,则需要O(n)的时间。选择正确的数据结构是解决这些问题的关键部分。 时间复杂度 o(logn) 空间复杂度 o(logn)", "name": "isHappy_1", "signature": "def isHappy_1(self, n)" }, { "docstring": "*使用两个指针 时间复杂度 o(logn) 空间复杂度 o(1)", "name": "isHappy_2", "signature": "def isHappy_2(self, n)...
2
stack_v2_sparse_classes_30k_train_020491
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy_1(self, n): *使用set 检查数字是否在哈希集中需要O(1)的时间,而对于其他数据结构,则需要O(n)的时间。选择正确的数据结构是解决这些问题的关键部分。 时间复杂度 o(logn) 空间复杂度 o(logn) - def isHappy_2(self, n): *使用两个指针 时间复杂度 o(logn) 空间复杂度 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isHappy_1(self, n): *使用set 检查数字是否在哈希集中需要O(1)的时间,而对于其他数据结构,则需要O(n)的时间。选择正确的数据结构是解决这些问题的关键部分。 时间复杂度 o(logn) 空间复杂度 o(logn) - def isHappy_2(self, n): *使用两个指针 时间复杂度 o(logn) 空间复杂度 ...
ebf9503d4bc6d4335c463aa2b4622dd7df55fb87
<|skeleton|> class Solution: def isHappy_1(self, n): """*使用set 检查数字是否在哈希集中需要O(1)的时间,而对于其他数据结构,则需要O(n)的时间。选择正确的数据结构是解决这些问题的关键部分。 时间复杂度 o(logn) 空间复杂度 o(logn)""" <|body_0|> def isHappy_2(self, n): """*使用两个指针 时间复杂度 o(logn) 空间复杂度 o(1)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isHappy_1(self, n): """*使用set 检查数字是否在哈希集中需要O(1)的时间,而对于其他数据结构,则需要O(n)的时间。选择正确的数据结构是解决这些问题的关键部分。 时间复杂度 o(logn) 空间复杂度 o(logn)""" seen = set() num = list(str(n)) sum = 0 while True: for i in num: sum += int(i) ** 2 if su...
the_stack_v2_python_sparse
202_happy_number.py
huuu97/LeetCode
train
0
662482f17739f20dbe58adc46aeb496bf9e4a96f
[ "if not os.path.isfile(imgDest):\n shutil.copy2(imgSrc, imgDest)\n im = Image.open(imgDest)\n startWidth, startHeight = im.size\n newWidth, newHeight = self.computeThumbnailSize(startWidth, startHeight, float(maxHeigth), float(maxWidth))\n im.thumbnail((newWidth, newHeight), Image.ANTIALIAS)\n im....
<|body_start_0|> if not os.path.isfile(imgDest): shutil.copy2(imgSrc, imgDest) im = Image.open(imgDest) startWidth, startHeight = im.size newWidth, newHeight = self.computeThumbnailSize(startWidth, startHeight, float(maxHeigth), float(maxWidth)) im.thu...
Creates thumbnail of images
Thubmnailer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Thubmnailer: """Creates thumbnail of images""" def cacheImg(self, imgSrc, imgDest, maxHeigth=800, maxWidth=600): """Given the src and dst of the image create the thumbnail""" <|body_0|> def computeThumbnailSize(self, startWidth, startHeight, maxHeight, maxWidth): ...
stack_v2_sparse_classes_36k_train_027260
1,124
no_license
[ { "docstring": "Given the src and dst of the image create the thumbnail", "name": "cacheImg", "signature": "def cacheImg(self, imgSrc, imgDest, maxHeigth=800, maxWidth=600)" }, { "docstring": "Compute the size of the thumbnail", "name": "computeThumbnailSize", "signature": "def computeTh...
2
stack_v2_sparse_classes_30k_train_003134
Implement the Python class `Thubmnailer` described below. Class description: Creates thumbnail of images Method signatures and docstrings: - def cacheImg(self, imgSrc, imgDest, maxHeigth=800, maxWidth=600): Given the src and dst of the image create the thumbnail - def computeThumbnailSize(self, startWidth, startHeigh...
Implement the Python class `Thubmnailer` described below. Class description: Creates thumbnail of images Method signatures and docstrings: - def cacheImg(self, imgSrc, imgDest, maxHeigth=800, maxWidth=600): Given the src and dst of the image create the thumbnail - def computeThumbnailSize(self, startWidth, startHeigh...
16c7a637b9a5dd4d854feb7ddc3d2aac308a46a0
<|skeleton|> class Thubmnailer: """Creates thumbnail of images""" def cacheImg(self, imgSrc, imgDest, maxHeigth=800, maxWidth=600): """Given the src and dst of the image create the thumbnail""" <|body_0|> def computeThumbnailSize(self, startWidth, startHeight, maxHeight, maxWidth): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Thubmnailer: """Creates thumbnail of images""" def cacheImg(self, imgSrc, imgDest, maxHeigth=800, maxWidth=600): """Given the src and dst of the image create the thumbnail""" if not os.path.isfile(imgDest): shutil.copy2(imgSrc, imgDest) im = Image.open(imgDest) ...
the_stack_v2_python_sparse
webapp/webapp/thumbnailer.py
slackeater/cca
train
1
cd2f4524b8b0f1bf5869c7228957671d012236c2
[ "super().__init__()\nchannels = size + size\nself.kernel_size = kernel_size\nif causal:\n self.lorder = kernel_size - 1\n padding = 0\nelse:\n self.lorder = 0\n padding = (kernel_size - 1) // 2\nself.conv = torch.nn.Conv1d(channels, channels, kernel_size, stride=1, padding=padding, groups=channels)", ...
<|body_start_0|> super().__init__() channels = size + size self.kernel_size = kernel_size if causal: self.lorder = kernel_size - 1 padding = 0 else: self.lorder = 0 padding = (kernel_size - 1) // 2 self.conv = torch.nn.Conv1...
Depth-wise Convolution module definition. Args: size: Initial size to determine the number of channels. kernel_size: Size of the convolving kernel. causal: Whether to use causal convolution (set to True if streaming).
DepthwiseConvolution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DepthwiseConvolution: """Depth-wise Convolution module definition. Args: size: Initial size to determine the number of channels. kernel_size: Size of the convolving kernel. causal: Whether to use causal convolution (set to True if streaming).""" def __init__(self, size: int, kernel_size: int...
stack_v2_sparse_classes_36k_train_027261
7,416
permissive
[ { "docstring": "Construct a DepthwiseConvolution object.", "name": "__init__", "signature": "def __init__(self, size: int, kernel_size: int, causal: bool=False) -> None" }, { "docstring": "Compute convolution module. Args: x: DepthwiseConvolution input sequences. (B, T, D_hidden) mask: Source ma...
2
null
Implement the Python class `DepthwiseConvolution` described below. Class description: Depth-wise Convolution module definition. Args: size: Initial size to determine the number of channels. kernel_size: Size of the convolving kernel. causal: Whether to use causal convolution (set to True if streaming). Method signatu...
Implement the Python class `DepthwiseConvolution` described below. Class description: Depth-wise Convolution module definition. Args: size: Initial size to determine the number of channels. kernel_size: Size of the convolving kernel. causal: Whether to use causal convolution (set to True if streaming). Method signatu...
bcd20948db7846ee523443ef9fd78c7a1248c95e
<|skeleton|> class DepthwiseConvolution: """Depth-wise Convolution module definition. Args: size: Initial size to determine the number of channels. kernel_size: Size of the convolving kernel. causal: Whether to use causal convolution (set to True if streaming).""" def __init__(self, size: int, kernel_size: int...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DepthwiseConvolution: """Depth-wise Convolution module definition. Args: size: Initial size to determine the number of channels. kernel_size: Size of the convolving kernel. causal: Whether to use causal convolution (set to True if streaming).""" def __init__(self, size: int, kernel_size: int, causal: boo...
the_stack_v2_python_sparse
espnet2/asr_transducer/encoder/modules/convolution.py
espnet/espnet
train
7,242
a626a9a56a02f87d97b7dc242bbcc957c99f69ad
[ "all_candidate_embs = [item.vectors for item in prf_candidates]\nnew_emb_qs = np.mean(np.vstack((emb_qs, all_candidate_embs)), axis=0)\nreturn new_emb_qs", "qids = list()\nnew_emb_qs = list()\nfor index, topic_id in enumerate(topic_ids):\n qids.append(topic_id)\n new_emb_qs.append(self.get_prf_q_emb(emb_qs[...
<|body_start_0|> all_candidate_embs = [item.vectors for item in prf_candidates] new_emb_qs = np.mean(np.vstack((emb_qs, all_candidate_embs)), axis=0) return new_emb_qs <|end_body_0|> <|body_start_1|> qids = list() new_emb_qs = list() for index, topic_id in enumerate(topi...
DenseVectorAveragePrf
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DenseVectorAveragePrf: def get_prf_q_emb(self, emb_qs: np.ndarray=None, prf_candidates: List[PRFDenseSearchResult]=None): """Perform Average PRF with Dense Vectors Parameters ---------- emb_qs : np.ndarray Query embedding prf_candidates : List[PRFDenseSearchResult] List of PRFDenseSearch...
stack_v2_sparse_classes_36k_train_027262
7,539
permissive
[ { "docstring": "Perform Average PRF with Dense Vectors Parameters ---------- emb_qs : np.ndarray Query embedding prf_candidates : List[PRFDenseSearchResult] List of PRFDenseSearchResult, contains document embeddings. Returns ------- np.ndarray return new query embeddings", "name": "get_prf_q_emb", "sign...
2
stack_v2_sparse_classes_30k_train_014369
Implement the Python class `DenseVectorAveragePrf` described below. Class description: Implement the DenseVectorAveragePrf class. Method signatures and docstrings: - def get_prf_q_emb(self, emb_qs: np.ndarray=None, prf_candidates: List[PRFDenseSearchResult]=None): Perform Average PRF with Dense Vectors Parameters ---...
Implement the Python class `DenseVectorAveragePrf` described below. Class description: Implement the DenseVectorAveragePrf class. Method signatures and docstrings: - def get_prf_q_emb(self, emb_qs: np.ndarray=None, prf_candidates: List[PRFDenseSearchResult]=None): Perform Average PRF with Dense Vectors Parameters ---...
42b354914b230880c91b2e4e70605b472441a9a1
<|skeleton|> class DenseVectorAveragePrf: def get_prf_q_emb(self, emb_qs: np.ndarray=None, prf_candidates: List[PRFDenseSearchResult]=None): """Perform Average PRF with Dense Vectors Parameters ---------- emb_qs : np.ndarray Query embedding prf_candidates : List[PRFDenseSearchResult] List of PRFDenseSearch...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DenseVectorAveragePrf: def get_prf_q_emb(self, emb_qs: np.ndarray=None, prf_candidates: List[PRFDenseSearchResult]=None): """Perform Average PRF with Dense Vectors Parameters ---------- emb_qs : np.ndarray Query embedding prf_candidates : List[PRFDenseSearchResult] List of PRFDenseSearchResult, contai...
the_stack_v2_python_sparse
pyserini/search/faiss/_prf.py
castorini/pyserini
train
1,070
d20e257168e6df054aacb4aa5603647dd664d013
[ "super(GradientDescent, self).__init__(data, missing_values_mask, orthogonality_constraint, use_projection, regularizations, RSE_flag, dtype)\nnew_GS = []\nfor Gi, g_Gi in zip(self.G, self.g_G):\n new_GS.append(tf.assign(Gi, Gi - lr * g_Gi))\nfor Si, g_Si in zip(self.Sf, self.g_S):\n new_GS.append(tf.assign(S...
<|body_start_0|> super(GradientDescent, self).__init__(data, missing_values_mask, orthogonality_constraint, use_projection, regularizations, RSE_flag, dtype) new_GS = [] for Gi, g_Gi in zip(self.G, self.g_G): new_GS.append(tf.assign(Gi, Gi - lr * g_Gi)) for Si, g_Si in zip(se...
Class that is able to perform ordinary gradient descent.
GradientDescent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GradientDescent: """Class that is able to perform ordinary gradient descent.""" def __init__(self, data, missing_values_mask=None, orthogonality_constraint=False, use_projection=False, regularizations=[], lr=10, RSE_flag=True, dtype=tf.float64): """Constructs tensorflow computational...
stack_v2_sparse_classes_36k_train_027263
28,488
no_license
[ { "docstring": "Constructs tensorflow computational graph for ordinary gradient descent.", "name": "__init__", "signature": "def __init__(self, data, missing_values_mask=None, orthogonality_constraint=False, use_projection=False, regularizations=[], lr=10, RSE_flag=True, dtype=tf.float64)" }, { ...
2
stack_v2_sparse_classes_30k_train_020301
Implement the Python class `GradientDescent` described below. Class description: Class that is able to perform ordinary gradient descent. Method signatures and docstrings: - def __init__(self, data, missing_values_mask=None, orthogonality_constraint=False, use_projection=False, regularizations=[], lr=10, RSE_flag=Tru...
Implement the Python class `GradientDescent` described below. Class description: Class that is able to perform ordinary gradient descent. Method signatures and docstrings: - def __init__(self, data, missing_values_mask=None, orthogonality_constraint=False, use_projection=False, regularizations=[], lr=10, RSE_flag=Tru...
6068f7ec1e01d4cfd0d293a7fa9f484e897dd06b
<|skeleton|> class GradientDescent: """Class that is able to perform ordinary gradient descent.""" def __init__(self, data, missing_values_mask=None, orthogonality_constraint=False, use_projection=False, regularizations=[], lr=10, RSE_flag=True, dtype=tf.float64): """Constructs tensorflow computational...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GradientDescent: """Class that is able to perform ordinary gradient descent.""" def __init__(self, data, missing_values_mask=None, orthogonality_constraint=False, use_projection=False, regularizations=[], lr=10, RSE_flag=True, dtype=tf.float64): """Constructs tensorflow computational graph for or...
the_stack_v2_python_sparse
local_search.py
GP-IJS/IJS-Data-Fusion
train
0
5a38a44b295b0a50c2e572998ffad20fb7baf644
[ "run = models.InteractivePipelineRun.query.filter_by(run_uuid=run_uuid).one_or_none()\nif run is None:\n abort(404, description='Run not found')\nreturn run.__dict__", "post_data = request.get_json()\nres = models.InteractivePipelineRun.query.filter_by(run_uuid=run_uuid).update({'status': post_data['status']})...
<|body_start_0|> run = models.InteractivePipelineRun.query.filter_by(run_uuid=run_uuid).one_or_none() if run is None: abort(404, description='Run not found') return run.__dict__ <|end_body_0|> <|body_start_1|> post_data = request.get_json() res = models.InteractivePi...
Run
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Run: def get(self, run_uuid): """Fetches an interactive pipeline run given its UUID.""" <|body_0|> def put(self, run_uuid): """Sets the status of a pipeline run.""" <|body_1|> def delete(self, run_uuid): """Stops a pipeline run given its UUID."""...
stack_v2_sparse_classes_36k_train_027264
9,599
permissive
[ { "docstring": "Fetches an interactive pipeline run given its UUID.", "name": "get", "signature": "def get(self, run_uuid)" }, { "docstring": "Sets the status of a pipeline run.", "name": "put", "signature": "def put(self, run_uuid)" }, { "docstring": "Stops a pipeline run given ...
3
null
Implement the Python class `Run` described below. Class description: Implement the Run class. Method signatures and docstrings: - def get(self, run_uuid): Fetches an interactive pipeline run given its UUID. - def put(self, run_uuid): Sets the status of a pipeline run. - def delete(self, run_uuid): Stops a pipeline ru...
Implement the Python class `Run` described below. Class description: Implement the Run class. Method signatures and docstrings: - def get(self, run_uuid): Fetches an interactive pipeline run given its UUID. - def put(self, run_uuid): Sets the status of a pipeline run. - def delete(self, run_uuid): Stops a pipeline ru...
0d78bf21e6da84754bd8ba8ebe4ff0d6631a92f9
<|skeleton|> class Run: def get(self, run_uuid): """Fetches an interactive pipeline run given its UUID.""" <|body_0|> def put(self, run_uuid): """Sets the status of a pipeline run.""" <|body_1|> def delete(self, run_uuid): """Stops a pipeline run given its UUID."""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Run: def get(self, run_uuid): """Fetches an interactive pipeline run given its UUID.""" run = models.InteractivePipelineRun.query.filter_by(run_uuid=run_uuid).one_or_none() if run is None: abort(404, description='Run not found') return run.__dict__ def put(self...
the_stack_v2_python_sparse
data/codefile/orchest@orchest__6b629d0__services$orchest-api$app$app$apis$namespace_runs.py.target.py
ualberta-smr/PyMigBench
train
1
6e6e2d47512cdbd5432c4001855a5b23687540ae
[ "self.net_desc = descript\nself.block = _prune_basic_block\nself.encoding = descript.get('encoding')\nself.chn = descript.get('chn')\nself.chn_node = descript.get('chn_node')\nself.chn_mask = descript.get('chn_mask', None)\nself.chn_node_mask = descript.get('chn_node_mask', None)\nself.num_blocks = descript.get('nu...
<|body_start_0|> self.net_desc = descript self.block = _prune_basic_block self.encoding = descript.get('encoding') self.chn = descript.get('chn') self.chn_node = descript.get('chn_node') self.chn_mask = descript.get('chn_mask', None) self.chn_node_mask = descript....
PruneResNet. :param descript: network desc :type descript: dict
PruneResNet
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PruneResNet: """PruneResNet. :param descript: network desc :type descript: dict""" def __init__(self, descript): """Init PruneResNet.""" <|body_0|> def _forward_prune_block(self, x, bottleneck, block, planes, inner_planes, num_blocks, stride, training, name): """...
stack_v2_sparse_classes_36k_train_027265
3,242
permissive
[ { "docstring": "Init PruneResNet.", "name": "__init__", "signature": "def __init__(self, descript)" }, { "docstring": "Create resolution block of ResNet.", "name": "_forward_prune_block", "signature": "def _forward_prune_block(self, x, bottleneck, block, planes, inner_planes, num_blocks,...
3
null
Implement the Python class `PruneResNet` described below. Class description: PruneResNet. :param descript: network desc :type descript: dict Method signatures and docstrings: - def __init__(self, descript): Init PruneResNet. - def _forward_prune_block(self, x, bottleneck, block, planes, inner_planes, num_blocks, stri...
Implement the Python class `PruneResNet` described below. Class description: PruneResNet. :param descript: network desc :type descript: dict Method signatures and docstrings: - def __init__(self, descript): Init PruneResNet. - def _forward_prune_block(self, x, bottleneck, block, planes, inner_planes, num_blocks, stri...
df51ed9c1d6dbde1deef63f2a037a369f8554406
<|skeleton|> class PruneResNet: """PruneResNet. :param descript: network desc :type descript: dict""" def __init__(self, descript): """Init PruneResNet.""" <|body_0|> def _forward_prune_block(self, x, bottleneck, block, planes, inner_planes, num_blocks, stride, training, name): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PruneResNet: """PruneResNet. :param descript: network desc :type descript: dict""" def __init__(self, descript): """Init PruneResNet.""" self.net_desc = descript self.block = _prune_basic_block self.encoding = descript.get('encoding') self.chn = descript.get('chn')...
the_stack_v2_python_sparse
built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/search_space/networks/tensorflow/backbones/prune_resnet.py
Huawei-Ascend/modelzoo
train
1
b68c803b0d7409a155d5fdd3aa706f1d1f540f7c
[ "l = len(nums)\nif l <= 1:\n return l\ntemp = nums[0]\nself.mark = 1\ncount = 1\nfor i in nums[1:]:\n if i > temp:\n self.mark = 1\n break\n elif i < temp:\n self.mark = -1\n break\n else:\n self.mark = 0\n temp = i\n count += 1\nif self.mark == 0:\n return 1\...
<|body_start_0|> l = len(nums) if l <= 1: return l temp = nums[0] self.mark = 1 count = 1 for i in nums[1:]: if i > temp: self.mark = 1 break elif i < temp: self.mark = -1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wiggleMaxLength(self, nums): """:type nums: List[int] :rtype: int 32ms""" <|body_0|> def wiggleMaxLength_1(self, nums): """:type nums: List[int] :rtype: int 29ms""" <|body_1|> <|end_skeleton|> <|body_start_0|> l = len(nums) if ...
stack_v2_sparse_classes_36k_train_027266
3,075
no_license
[ { "docstring": ":type nums: List[int] :rtype: int 32ms", "name": "wiggleMaxLength", "signature": "def wiggleMaxLength(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 29ms", "name": "wiggleMaxLength_1", "signature": "def wiggleMaxLength_1(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wiggleMaxLength(self, nums): :type nums: List[int] :rtype: int 32ms - def wiggleMaxLength_1(self, nums): :type nums: List[int] :rtype: int 29ms
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wiggleMaxLength(self, nums): :type nums: List[int] :rtype: int 32ms - def wiggleMaxLength_1(self, nums): :type nums: List[int] :rtype: int 29ms <|skeleton|> class Solution: ...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution: def wiggleMaxLength(self, nums): """:type nums: List[int] :rtype: int 32ms""" <|body_0|> def wiggleMaxLength_1(self, nums): """:type nums: List[int] :rtype: int 29ms""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wiggleMaxLength(self, nums): """:type nums: List[int] :rtype: int 32ms""" l = len(nums) if l <= 1: return l temp = nums[0] self.mark = 1 count = 1 for i in nums[1:]: if i > temp: self.mark = 1 ...
the_stack_v2_python_sparse
WiggleSubsequence_MID_376.py
953250587/leetcode-python
train
2
969cd429a2f1ed38233465f3efcfcd2348eb8cdb
[ "logging.debug('%s', request)\nbot_id = request.bot_id\nrealms.check_bot_get_acl(bot_id)\nbot = bot_management.get_info_key(bot_id).get()\ndeleted = False\nif not bot:\n events = bot_management.get_events_query(bot_id).fetch(1)\n if not events:\n raise endpoints.NotFoundException('%s not found.' % bot_...
<|body_start_0|> logging.debug('%s', request) bot_id = request.bot_id realms.check_bot_get_acl(bot_id) bot = bot_management.get_info_key(bot_id).get() deleted = False if not bot: events = bot_management.get_events_query(bot_id).fetch(1) if not even...
Bot-related API. Permits querying information about the bot's properties
SwarmingBotService
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwarmingBotService: """Bot-related API. Permits querying information about the bot's properties""" def get(self, request): """Returns information about a known bot. This includes its state and dimensions, and if it is currently running a task.""" <|body_0|> def delete(se...
stack_v2_sparse_classes_36k_train_027267
42,982
permissive
[ { "docstring": "Returns information about a known bot. This includes its state and dimensions, and if it is currently running a task.", "name": "get", "signature": "def get(self, request)" }, { "docstring": "Deletes the bot corresponding to a provided bot_id. At that point, the bot will not appe...
5
null
Implement the Python class `SwarmingBotService` described below. Class description: Bot-related API. Permits querying information about the bot's properties Method signatures and docstrings: - def get(self, request): Returns information about a known bot. This includes its state and dimensions, and if it is currently...
Implement the Python class `SwarmingBotService` described below. Class description: Bot-related API. Permits querying information about the bot's properties Method signatures and docstrings: - def get(self, request): Returns information about a known bot. This includes its state and dimensions, and if it is currently...
10cc5fdcca53e2a1690867acbe6fce099273f092
<|skeleton|> class SwarmingBotService: """Bot-related API. Permits querying information about the bot's properties""" def get(self, request): """Returns information about a known bot. This includes its state and dimensions, and if it is currently running a task.""" <|body_0|> def delete(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SwarmingBotService: """Bot-related API. Permits querying information about the bot's properties""" def get(self, request): """Returns information about a known bot. This includes its state and dimensions, and if it is currently running a task.""" logging.debug('%s', request) bot_i...
the_stack_v2_python_sparse
appengine/swarming/handlers_endpoints.py
luci/luci-py
train
84
1fe4cabbb4f4a39dbd98fc8783d192f90489670f
[ "array_len = len(array)\nif array_len == 0:\n return [-1, -1]\nmax_val = -9999\nmin_val = 9999\nfirst_pos = -1\nlast_pos = -1\nfor i in range(array_len):\n if max_val <= array[i]:\n max_val = max(array[i], max_val)\n else:\n last_pos = i\nfor i in range(array_len - 1, -1, -1):\n if min_val...
<|body_start_0|> array_len = len(array) if array_len == 0: return [-1, -1] max_val = -9999 min_val = 9999 first_pos = -1 last_pos = -1 for i in range(array_len): if max_val <= array[i]: max_val = max(array[i], max_val) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def subSort1(self, array: List[int]) -> List[int]: """方法:左右指针 【两遍遍历】""" <|body_0|> def subSort(self, array: List[int]) -> List[int]: """方法:左右指针 【一遍遍历】""" <|body_1|> <|end_skeleton|> <|body_start_0|> array_len = len(array) if array_...
stack_v2_sparse_classes_36k_train_027268
1,820
no_license
[ { "docstring": "方法:左右指针 【两遍遍历】", "name": "subSort1", "signature": "def subSort1(self, array: List[int]) -> List[int]" }, { "docstring": "方法:左右指针 【一遍遍历】", "name": "subSort", "signature": "def subSort(self, array: List[int]) -> List[int]" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subSort1(self, array: List[int]) -> List[int]: 方法:左右指针 【两遍遍历】 - def subSort(self, array: List[int]) -> List[int]: 方法:左右指针 【一遍遍历】
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def subSort1(self, array: List[int]) -> List[int]: 方法:左右指针 【两遍遍历】 - def subSort(self, array: List[int]) -> List[int]: 方法:左右指针 【一遍遍历】 <|skeleton|> class Solution: def subSor...
f831fd9603592ae5bee3679924f962a3ebce381c
<|skeleton|> class Solution: def subSort1(self, array: List[int]) -> List[int]: """方法:左右指针 【两遍遍历】""" <|body_0|> def subSort(self, array: List[int]) -> List[int]: """方法:左右指针 【一遍遍历】""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def subSort1(self, array: List[int]) -> List[int]: """方法:左右指针 【两遍遍历】""" array_len = len(array) if array_len == 0: return [-1, -1] max_val = -9999 min_val = 9999 first_pos = -1 last_pos = -1 for i in range(array_len): ...
the_stack_v2_python_sparse
topic25_left_right_pointer/MS1616_subSort1/interview.py
GongFuXiong/leetcode
train
0
e28302e637fe6c223cf456d6e9fdbba18ebdef25
[ "if not root:\n return\nself.flatten(root.left)\nself.flatten(root.right)\ntmp = root.right\nroot.right = root.left\nroot.left = None\nwhile root.right:\n root = root.right\nroot.right = tmp", "cur = root\nwhile cur:\n if cur.left:\n p = cur.left\n while p.right:\n p = p.right\n ...
<|body_start_0|> if not root: return self.flatten(root.left) self.flatten(root.right) tmp = root.right root.right = root.left root.left = None while root.right: root = root.right root.right = tmp <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def flatten(self, root): """Do not return anything, modify root in-place instead.""" <|body_0|> def flatten(self, root) -> None: """Do not return anything, modify root in-place instead.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if no...
stack_v2_sparse_classes_36k_train_027269
841
no_license
[ { "docstring": "Do not return anything, modify root in-place instead.", "name": "flatten", "signature": "def flatten(self, root)" }, { "docstring": "Do not return anything, modify root in-place instead.", "name": "flatten", "signature": "def flatten(self, root) -> None" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): Do not return anything, modify root in-place instead. - def flatten(self, root) -> None: Do not return anything, modify root in-place instead.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def flatten(self, root): Do not return anything, modify root in-place instead. - def flatten(self, root) -> None: Do not return anything, modify root in-place instead. <|skeleto...
18e6ac79573b3f535ca5e3eaa477eac0e60bf510
<|skeleton|> class Solution: def flatten(self, root): """Do not return anything, modify root in-place instead.""" <|body_0|> def flatten(self, root) -> None: """Do not return anything, modify root in-place instead.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def flatten(self, root): """Do not return anything, modify root in-place instead.""" if not root: return self.flatten(root.left) self.flatten(root.right) tmp = root.right root.right = root.left root.left = None while root.ri...
the_stack_v2_python_sparse
leetcode_树_二叉树展开为链表.py
cmychina/Leetcode
train
0
e0f8954cac756eec29f1296797de34f8e8f65155
[ "if variable in self:\n return super(_VariableBackups, self).__getitem__(variable)\nvalue = self[variable] = _RegisteredAddons(variable)\nreturn value", "if not variable in self:\n return\nServerVar(variable).set(self[variable].default)\nsuper(_VariableBackups, self).__delitem__(variable)" ]
<|body_start_0|> if variable in self: return super(_VariableBackups, self).__getitem__(variable) value = self[variable] = _RegisteredAddons(variable) return value <|end_body_0|> <|body_start_1|> if not variable in self: return ServerVar(variable).set(self...
Class used to store variables with their default value
_VariableBackups
[ "Artistic-1.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _VariableBackups: """Class used to store variables with their default value""" def __getitem__(self, variable): """Gets the variable's instance and adds it if not in the dictionary""" <|body_0|> def __delitem__(self, variable): """Removes the variable from the di...
stack_v2_sparse_classes_36k_train_027270
2,938
permissive
[ { "docstring": "Gets the variable's instance and adds it if not in the dictionary", "name": "__getitem__", "signature": "def __getitem__(self, variable)" }, { "docstring": "Removes the variable from the dictionary, and sets it back to the default value", "name": "__delitem__", "signature...
2
stack_v2_sparse_classes_30k_train_010931
Implement the Python class `_VariableBackups` described below. Class description: Class used to store variables with their default value Method signatures and docstrings: - def __getitem__(self, variable): Gets the variable's instance and adds it if not in the dictionary - def __delitem__(self, variable): Removes the...
Implement the Python class `_VariableBackups` described below. Class description: Class used to store variables with their default value Method signatures and docstrings: - def __getitem__(self, variable): Gets the variable's instance and adds it if not in the dictionary - def __delitem__(self, variable): Removes the...
ebf4624626266f552189a32612b8d09cd5b4c5a3
<|skeleton|> class _VariableBackups: """Class used to store variables with their default value""" def __getitem__(self, variable): """Gets the variable's instance and adds it if not in the dictionary""" <|body_0|> def __delitem__(self, variable): """Removes the variable from the di...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _VariableBackups: """Class used to store variables with their default value""" def __getitem__(self, variable): """Gets the variable's instance and adds it if not in the dictionary""" if variable in self: return super(_VariableBackups, self).__getitem__(variable) value...
the_stack_v2_python_sparse
cstrike/addons/eventscripts/gungame51/modules/backups.py
GunGame-Dev-Team/GunGame51
train
0
0529cef78c2e3222f88562fe3bec9d906b7c2a79
[ "self.cluster = cluster\nself.kubeconfig_path = os.path.join(config.ENV_DATA['cluster_path'], config.RUN['kubeconfig_location'])\nself.kubeadmin_password_path = os.path.join(config.ENV_DATA['cluster_path'], config.RUN['password_location'])\nabs_path = os.path.expanduser(self.kubeconfig_path)\nbase_path = os.path.di...
<|body_start_0|> self.cluster = cluster self.kubeconfig_path = os.path.join(config.ENV_DATA['cluster_path'], config.RUN['kubeconfig_location']) self.kubeadmin_password_path = os.path.join(config.ENV_DATA['cluster_path'], config.RUN['password_location']) abs_path = os.path.expanduser(self...
A helper class for Managed Service ROSA Cluster in Production Environment
ROSAProdEnvCluster
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ROSAProdEnvCluster: """A helper class for Managed Service ROSA Cluster in Production Environment""" def __init__(self, cluster): """Initialize required variables Args: cluster (str): Name of the cluster in production environment""" <|body_0|> def create_admin_and_login(s...
stack_v2_sparse_classes_36k_train_027271
4,092
permissive
[ { "docstring": "Initialize required variables Args: cluster (str): Name of the cluster in production environment", "name": "__init__", "signature": "def __init__(self, cluster)" }, { "docstring": "creates admin account for cluster and login", "name": "create_admin_and_login", "signature"...
6
null
Implement the Python class `ROSAProdEnvCluster` described below. Class description: A helper class for Managed Service ROSA Cluster in Production Environment Method signatures and docstrings: - def __init__(self, cluster): Initialize required variables Args: cluster (str): Name of the cluster in production environmen...
Implement the Python class `ROSAProdEnvCluster` described below. Class description: A helper class for Managed Service ROSA Cluster in Production Environment Method signatures and docstrings: - def __init__(self, cluster): Initialize required variables Args: cluster (str): Name of the cluster in production environmen...
5e9e504957403148e413326f65c3769bf9d8eb39
<|skeleton|> class ROSAProdEnvCluster: """A helper class for Managed Service ROSA Cluster in Production Environment""" def __init__(self, cluster): """Initialize required variables Args: cluster (str): Name of the cluster in production environment""" <|body_0|> def create_admin_and_login(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ROSAProdEnvCluster: """A helper class for Managed Service ROSA Cluster in Production Environment""" def __init__(self, cluster): """Initialize required variables Args: cluster (str): Name of the cluster in production environment""" self.cluster = cluster self.kubeconfig_path = os....
the_stack_v2_python_sparse
ocs_ci/deployment/helpers/rosa_prod_cluster_helpers.py
red-hat-storage/ocs-ci
train
146
6b6a862dff02b9df8b39debdaf08a21de4b7e589
[ "self.validate_parameters(consumer_id=consumer_id, portfolio_id=portfolio_id, accept=accept, content_type=content_type)\n_url_path = '/decisioning/v1/consumers/{consumerId}/portfolios/{portfolioId}'\n_url_path = APIHelper.append_url_with_template_parameters(_url_path, {'consumerId': consumer_id, 'portfolioId': port...
<|body_start_0|> self.validate_parameters(consumer_id=consumer_id, portfolio_id=portfolio_id, accept=accept, content_type=content_type) _url_path = '/decisioning/v1/consumers/{consumerId}/portfolios/{portfolioId}' _url_path = APIHelper.append_url_with_template_parameters(_url_path, {'consumerId'...
A Controller to access Endpoints in the finicityapi API.
GetPortfoliosController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetPortfoliosController: """A Controller to access Endpoints in the finicityapi API.""" def get_portfolio_by_consumer(self, consumer_id, portfolio_id, accept, content_type): """Does a GET request to /decisioning/v1/consumers/{consumerId}/portfolios/{portfolioId}. Returns a portfolio ...
stack_v2_sparse_classes_36k_train_027272
7,011
permissive
[ { "docstring": "Does a GET request to /decisioning/v1/consumers/{consumerId}/portfolios/{portfolioId}. Returns a portfolio of most recently generated report for each report type for a specified consumer. If there are multiple reports that were generated for a report type (VOA, VOI, etc), only the most recently ...
2
stack_v2_sparse_classes_30k_train_001783
Implement the Python class `GetPortfoliosController` described below. Class description: A Controller to access Endpoints in the finicityapi API. Method signatures and docstrings: - def get_portfolio_by_consumer(self, consumer_id, portfolio_id, accept, content_type): Does a GET request to /decisioning/v1/consumers/{c...
Implement the Python class `GetPortfoliosController` described below. Class description: A Controller to access Endpoints in the finicityapi API. Method signatures and docstrings: - def get_portfolio_by_consumer(self, consumer_id, portfolio_id, accept, content_type): Does a GET request to /decisioning/v1/consumers/{c...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class GetPortfoliosController: """A Controller to access Endpoints in the finicityapi API.""" def get_portfolio_by_consumer(self, consumer_id, portfolio_id, accept, content_type): """Does a GET request to /decisioning/v1/consumers/{consumerId}/portfolios/{portfolioId}. Returns a portfolio ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetPortfoliosController: """A Controller to access Endpoints in the finicityapi API.""" def get_portfolio_by_consumer(self, consumer_id, portfolio_id, accept, content_type): """Does a GET request to /decisioning/v1/consumers/{consumerId}/portfolios/{portfolioId}. Returns a portfolio of most recen...
the_stack_v2_python_sparse
finicityapi/controllers/get_portfolios_controller.py
monarchmoney/finicity-python
train
0
bf2f9dabaef386cfb111b6cf0ed56d5f13d1b638
[ "if maxdate and (not isinstance(maxdate, datetime)):\n raise ValueError('Expected a datetime object')\nreturn self.filter(id__in=self.get_interaction_per_client_ids(maxdate, active_only))", "from django.db import connection\ncursor = connection.cursor()\ncfilter = 'expiration is null'\nsql = 'select reports_in...
<|body_start_0|> if maxdate and (not isinstance(maxdate, datetime)): raise ValueError('Expected a datetime object') return self.filter(id__in=self.get_interaction_per_client_ids(maxdate, active_only)) <|end_body_0|> <|body_start_1|> from django.db import connection cursor = ...
Manages interactions objects.
InteractiveManager
[ "LicenseRef-scancode-unknown-license-reference", "mpich2", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InteractiveManager: """Manages interactions objects.""" def interaction_per_client(self, maxdate=None, active_only=True): """Returns the most recent interactions for clients as of a date Arguments: maxdate -- datetime object. Most recent date to pull. (dafault None) active_only -- In...
stack_v2_sparse_classes_36k_train_027273
14,270
permissive
[ { "docstring": "Returns the most recent interactions for clients as of a date Arguments: maxdate -- datetime object. Most recent date to pull. (dafault None) active_only -- Include only active clients (default True)", "name": "interaction_per_client", "signature": "def interaction_per_client(self, maxda...
2
stack_v2_sparse_classes_30k_train_011167
Implement the Python class `InteractiveManager` described below. Class description: Manages interactions objects. Method signatures and docstrings: - def interaction_per_client(self, maxdate=None, active_only=True): Returns the most recent interactions for clients as of a date Arguments: maxdate -- datetime object. M...
Implement the Python class `InteractiveManager` described below. Class description: Manages interactions objects. Method signatures and docstrings: - def interaction_per_client(self, maxdate=None, active_only=True): Returns the most recent interactions for clients as of a date Arguments: maxdate -- datetime object. M...
8605cd3d0cb4d549cb8b43de945d447f6d82892a
<|skeleton|> class InteractiveManager: """Manages interactions objects.""" def interaction_per_client(self, maxdate=None, active_only=True): """Returns the most recent interactions for clients as of a date Arguments: maxdate -- datetime object. Most recent date to pull. (dafault None) active_only -- In...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InteractiveManager: """Manages interactions objects.""" def interaction_per_client(self, maxdate=None, active_only=True): """Returns the most recent interactions for clients as of a date Arguments: maxdate -- datetime object. Most recent date to pull. (dafault None) active_only -- Include only ac...
the_stack_v2_python_sparse
src/lib/Bcfg2/Server/Reports/reports/models.py
Bcfg2/bcfg2
train
56
f1f8b1d6f0a0890fb394dcec08c17e282adbd96b
[ "super().__init__(ccdata, *args, **kwargs)\nself.required_attrs = ('natom', 'atomcoords', 'atomnos')\nself.do_firstgeom = firstgeom\nself.do_lastgeom = lastgeom\nself.do_allgeom = allgeom\nself.natom = str(self.ccdata.natom)\nself.element_list = [self.pt.element[Z] for Z in self.ccdata.atomnos]", "xyzblock = []\n...
<|body_start_0|> super().__init__(ccdata, *args, **kwargs) self.required_attrs = ('natom', 'atomcoords', 'atomnos') self.do_firstgeom = firstgeom self.do_lastgeom = lastgeom self.do_allgeom = allgeom self.natom = str(self.ccdata.natom) self.element_list = [self.pt...
A writer for XYZ (Cartesian coordinate) files.
XYZ
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XYZ: """A writer for XYZ (Cartesian coordinate) files.""" def __init__(self, ccdata: ccData, splitfiles: bool=False, firstgeom: bool=False, lastgeom: bool=False, allgeom: bool=False, *args, **kwargs) -> None: """Initialize the XYZ writer object. Inputs: ccdata - An instance of ccData...
stack_v2_sparse_classes_36k_train_027274
4,169
permissive
[ { "docstring": "Initialize the XYZ writer object. Inputs: ccdata - An instance of ccData, parse from a logfile. splitfiles - Boolean to write multiple files if multiple files are requested. [TODO] firstgeom - Boolean to write the first available geometry from the logfile. lastgeom - Boolean to write the last av...
3
stack_v2_sparse_classes_30k_train_007810
Implement the Python class `XYZ` described below. Class description: A writer for XYZ (Cartesian coordinate) files. Method signatures and docstrings: - def __init__(self, ccdata: ccData, splitfiles: bool=False, firstgeom: bool=False, lastgeom: bool=False, allgeom: bool=False, *args, **kwargs) -> None: Initialize the ...
Implement the Python class `XYZ` described below. Class description: A writer for XYZ (Cartesian coordinate) files. Method signatures and docstrings: - def __init__(self, ccdata: ccData, splitfiles: bool=False, firstgeom: bool=False, lastgeom: bool=False, allgeom: bool=False, *args, **kwargs) -> None: Initialize the ...
b8d42a163ce9bafd4b660e2a933f56a8cc54fd9b
<|skeleton|> class XYZ: """A writer for XYZ (Cartesian coordinate) files.""" def __init__(self, ccdata: ccData, splitfiles: bool=False, firstgeom: bool=False, lastgeom: bool=False, allgeom: bool=False, *args, **kwargs) -> None: """Initialize the XYZ writer object. Inputs: ccdata - An instance of ccData...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XYZ: """A writer for XYZ (Cartesian coordinate) files.""" def __init__(self, ccdata: ccData, splitfiles: bool=False, firstgeom: bool=False, lastgeom: bool=False, allgeom: bool=False, *args, **kwargs) -> None: """Initialize the XYZ writer object. Inputs: ccdata - An instance of ccData, parse from ...
the_stack_v2_python_sparse
cclib/io/xyzwriter.py
cclib/cclib
train
285
30f9d4225e51ca2e53fa89b8bc1fbbf65d449b3a
[ "q = DatabaseSessionManager.get_session().query(db.Node)\nauth_org_id = self.obtain_organization_id()\nargs = request.args\nfor param in ['organization_id', 'collaboration_id', 'status', 'ip']:\n if param in args:\n q = q.filter(getattr(db.Node, param) == args[param])\nif 'name' in args:\n q = q.filter...
<|body_start_0|> q = DatabaseSessionManager.get_session().query(db.Node) auth_org_id = self.obtain_organization_id() args = request.args for param in ['organization_id', 'collaboration_id', 'status', 'ip']: if param in args: q = q.filter(getattr(db.Node, param...
Nodes
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Nodes: def get(self): """Returns a list of nodes --- description: >- Returns a list of nodes which are part of the organization to which the user or node belongs. In case an administrator account makes this request, all nodes from all organizations are returned. ### Permission Table |Rul...
stack_v2_sparse_classes_36k_train_027275
13,811
permissive
[ { "docstring": "Returns a list of nodes --- description: >- Returns a list of nodes which are part of the organization to which the user or node belongs. In case an administrator account makes this request, all nodes from all organizations are returned. ### Permission Table |Rule name|Scope|Operation|Node|Conta...
2
stack_v2_sparse_classes_30k_train_015518
Implement the Python class `Nodes` described below. Class description: Implement the Nodes class. Method signatures and docstrings: - def get(self): Returns a list of nodes --- description: >- Returns a list of nodes which are part of the organization to which the user or node belongs. In case an administrator accoun...
Implement the Python class `Nodes` described below. Class description: Implement the Nodes class. Method signatures and docstrings: - def get(self): Returns a list of nodes --- description: >- Returns a list of nodes which are part of the organization to which the user or node belongs. In case an administrator accoun...
3326c51a56e5a6be7c67954aaf65a7d07b07ae74
<|skeleton|> class Nodes: def get(self): """Returns a list of nodes --- description: >- Returns a list of nodes which are part of the organization to which the user or node belongs. In case an administrator account makes this request, all nodes from all organizations are returned. ### Permission Table |Rul...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Nodes: def get(self): """Returns a list of nodes --- description: >- Returns a list of nodes which are part of the organization to which the user or node belongs. In case an administrator account makes this request, all nodes from all organizations are returned. ### Permission Table |Rule name|Scope|O...
the_stack_v2_python_sparse
vantage6/server/resource/node.py
IKNL/vantage6-server
train
2
08093afd721ae8ecc2e218e36588a86febae0bd9
[ "tests = [('foo[[1-5]]', ['foo1', 'foo2', 'foo5'], ['foo', 'foo0', 'foo10']), ('[[10-99]]foo', ['10foo', '99foo', '25foo'], ['foo', '1foo', '999foo', '110foo']), ('foo[[1,3,5-10]]bar', ['foo1bar', 'foo7bar', 'foo10bar'], ['foo2bar', 'foobar', 'foo3', '5bar']), ('[[9-15]]foo[[16-20]]', ['9foo18', '13foo17'], ['8foo2...
<|body_start_0|> tests = [('foo[[1-5]]', ['foo1', 'foo2', 'foo5'], ['foo', 'foo0', 'foo10']), ('[[10-99]]foo', ['10foo', '99foo', '25foo'], ['foo', '1foo', '999foo', '110foo']), ('foo[[1,3,5-10]]bar', ['foo1bar', 'foo7bar', 'foo10bar'], ['foo2bar', 'foobar', 'foo3', '5bar']), ('[[9-15]]foo[[16-20]]', ['9foo18',...
TestPatternMap
[ "mpich2", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestPatternMap: def test_ranges(self): """test processing NameRange patterns""" <|body_0|> def test_simple_patterns(self): """test processing NamePatterns without backreferences""" <|body_1|> def test_backref_patterns(self): """test NamePatterns ...
stack_v2_sparse_classes_36k_train_027276
5,288
permissive
[ { "docstring": "test processing NameRange patterns", "name": "test_ranges", "signature": "def test_ranges(self)" }, { "docstring": "test processing NamePatterns without backreferences", "name": "test_simple_patterns", "signature": "def test_simple_patterns(self)" }, { "docstring"...
3
stack_v2_sparse_classes_30k_train_003533
Implement the Python class `TestPatternMap` described below. Class description: Implement the TestPatternMap class. Method signatures and docstrings: - def test_ranges(self): test processing NameRange patterns - def test_simple_patterns(self): test processing NamePatterns without backreferences - def test_backref_pat...
Implement the Python class `TestPatternMap` described below. Class description: Implement the TestPatternMap class. Method signatures and docstrings: - def test_ranges(self): test processing NameRange patterns - def test_simple_patterns(self): test processing NamePatterns without backreferences - def test_backref_pat...
dc5ec0f8899f2a15aea34468899b7b9237874828
<|skeleton|> class TestPatternMap: def test_ranges(self): """test processing NameRange patterns""" <|body_0|> def test_simple_patterns(self): """test processing NamePatterns without backreferences""" <|body_1|> def test_backref_patterns(self): """test NamePatterns ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestPatternMap: def test_ranges(self): """test processing NameRange patterns""" tests = [('foo[[1-5]]', ['foo1', 'foo2', 'foo5'], ['foo', 'foo0', 'foo10']), ('[[10-99]]foo', ['10foo', '99foo', '25foo'], ['foo', '1foo', '999foo', '110foo']), ('foo[[1,3,5-10]]bar', ['foo1bar', 'foo7bar', 'foo10b...
the_stack_v2_python_sparse
testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py
dikim33/bcfg2
train
0
b7a6db7d5160ee083d221fa7e6384e1b238defa1
[ "super().save_model(request, obj, form, change)\nfrom celery_tasks.tasks import generate_static_index_html\ngenerate_static_index_html.delay()\ncache.delete('index_page_data')", "super().delete_model(request, obj)\nfrom celery_tasks.tasks import generate_static_index_html\ngenerate_static_index_html.delay()\ncach...
<|body_start_0|> super().save_model(request, obj, form, change) from celery_tasks.tasks import generate_static_index_html generate_static_index_html.delay() cache.delete('index_page_data') <|end_body_0|> <|body_start_1|> super().delete_model(request, obj) from celery_tas...
BaseModelAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseModelAdmin: def save_model(self, request, obj, form, change): """新增或更新表中的数据时调用""" <|body_0|> def delete_model(self, request, obj): """删除表中的数据时调用""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().save_model(request, obj, form, change) ...
stack_v2_sparse_classes_36k_train_027277
2,214
no_license
[ { "docstring": "新增或更新表中的数据时调用", "name": "save_model", "signature": "def save_model(self, request, obj, form, change)" }, { "docstring": "删除表中的数据时调用", "name": "delete_model", "signature": "def delete_model(self, request, obj)" } ]
2
stack_v2_sparse_classes_30k_train_008098
Implement the Python class `BaseModelAdmin` described below. Class description: Implement the BaseModelAdmin class. Method signatures and docstrings: - def save_model(self, request, obj, form, change): 新增或更新表中的数据时调用 - def delete_model(self, request, obj): 删除表中的数据时调用
Implement the Python class `BaseModelAdmin` described below. Class description: Implement the BaseModelAdmin class. Method signatures and docstrings: - def save_model(self, request, obj, form, change): 新增或更新表中的数据时调用 - def delete_model(self, request, obj): 删除表中的数据时调用 <|skeleton|> class BaseModelAdmin: def save_m...
ae2b067da0394470269de97e1df52b33465d0de4
<|skeleton|> class BaseModelAdmin: def save_model(self, request, obj, form, change): """新增或更新表中的数据时调用""" <|body_0|> def delete_model(self, request, obj): """删除表中的数据时调用""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseModelAdmin: def save_model(self, request, obj, form, change): """新增或更新表中的数据时调用""" super().save_model(request, obj, form, change) from celery_tasks.tasks import generate_static_index_html generate_static_index_html.delay() cache.delete('index_page_data') def del...
the_stack_v2_python_sparse
untitled/6.0-全栈开发阶段/Django框架/dailyfresh/apps/goods/admin.py
giant-xf/python
train
0
9d318f494b535b2c707b19efd886542b4ec0ba0d
[ "super(DQN, self).__init__()\nself.fc1 = nn.Linear(state_size, fc1_units)\nself.fc2 = nn.Linear(fc1_units, fc2_units)\nself.fc3 = nn.Linear(fc2_units, action_size)", "x = F.relu(self.fc1(state))\nx = F.relu(self.fc2(x))\nx = self.fc3(x)\nreturn x" ]
<|body_start_0|> super(DQN, self).__init__() self.fc1 = nn.Linear(state_size, fc1_units) self.fc2 = nn.Linear(fc1_units, fc2_units) self.fc3 = nn.Linear(fc2_units, action_size) <|end_body_0|> <|body_start_1|> x = F.relu(self.fc1(state)) x = F.relu(self.fc2(x)) x ...
DQN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DQN: def __init__(self, state_size, action_size, fc1_units=64, fc2_units=64): """Initialize parameters and build model. Args: state_size (int): Dimension of each state action_size (int): Dimension of each action fc1_units (int): Number of nodes in first hidden layer fc2_units (int): Numb...
stack_v2_sparse_classes_36k_train_027278
11,094
no_license
[ { "docstring": "Initialize parameters and build model. Args: state_size (int): Dimension of each state action_size (int): Dimension of each action fc1_units (int): Number of nodes in first hidden layer fc2_units (int): Number of nodes in second hidden layer", "name": "__init__", "signature": "def __init...
2
stack_v2_sparse_classes_30k_train_008205
Implement the Python class `DQN` described below. Class description: Implement the DQN class. Method signatures and docstrings: - def __init__(self, state_size, action_size, fc1_units=64, fc2_units=64): Initialize parameters and build model. Args: state_size (int): Dimension of each state action_size (int): Dimension...
Implement the Python class `DQN` described below. Class description: Implement the DQN class. Method signatures and docstrings: - def __init__(self, state_size, action_size, fc1_units=64, fc2_units=64): Initialize parameters and build model. Args: state_size (int): Dimension of each state action_size (int): Dimension...
533380c7207f66d3a31d0bf744448ec2d4eb4c8f
<|skeleton|> class DQN: def __init__(self, state_size, action_size, fc1_units=64, fc2_units=64): """Initialize parameters and build model. Args: state_size (int): Dimension of each state action_size (int): Dimension of each action fc1_units (int): Number of nodes in first hidden layer fc2_units (int): Numb...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DQN: def __init__(self, state_size, action_size, fc1_units=64, fc2_units=64): """Initialize parameters and build model. Args: state_size (int): Dimension of each state action_size (int): Dimension of each action fc1_units (int): Number of nodes in first hidden layer fc2_units (int): Number of nodes in...
the_stack_v2_python_sparse
rl/net/net.py
haonguyen1915/RL
train
2
7939ac8a4964012ed3504b395d8e172c8787c94f
[ "completed_process = subprocess.run(command, executable='/bin/bash', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, timeout=timeout)\nif completed_process.returncode != 0:\n raise Exception(completed_process.stderr)\nreturn completed_process.stdout.strip('\\n')", "process ...
<|body_start_0|> completed_process = subprocess.run(command, executable='/bin/bash', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, timeout=timeout) if completed_process.returncode != 0: raise Exception(completed_process.stderr) return completed_...
Wrapper class of subprocess, with CliException integrated.
Subprocess
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Subprocess: """Wrapper class of subprocess, with CliException integrated.""" def run(command: str, timeout: int=None) -> str: """Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. Returns: str: return stdout of ...
stack_v2_sparse_classes_36k_train_027279
1,834
permissive
[ { "docstring": "Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. Returns: str: return stdout of the command.", "name": "run", "signature": "def run(command: str, timeout: int=None) -> str" }, { "docstring": "Run one-time ...
2
null
Implement the Python class `Subprocess` described below. Class description: Wrapper class of subprocess, with CliException integrated. Method signatures and docstrings: - def run(command: str, timeout: int=None) -> str: Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (...
Implement the Python class `Subprocess` described below. Class description: Wrapper class of subprocess, with CliException integrated. Method signatures and docstrings: - def run(command: str, timeout: int=None) -> str: Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (...
b3c6a589ad9036b03221e776a6929b2bc1eb4680
<|skeleton|> class Subprocess: """Wrapper class of subprocess, with CliException integrated.""" def run(command: str, timeout: int=None) -> str: """Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. Returns: str: return stdout of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Subprocess: """Wrapper class of subprocess, with CliException integrated.""" def run(command: str, timeout: int=None) -> str: """Run one-time command with subprocess.run(). Args: command (str): command to be executed. timeout (int): timeout in seconds. Returns: str: return stdout of the command."...
the_stack_v2_python_sparse
maro/cli/grass/lib/scripts/utils/subprocess.py
microsoft/maro
train
764
522ad99d82653dba2719507d8e27aa692ab49f1f
[ "self.key = key\nif L is None:\n self.head = None\n return\nif not len(L[:1]):\n self.head = None\n return\nnode = Node(L[0])\nself.head = node\nfor e in L[1:]:\n node.next_node = Node(e)\n node = node.next_node", "if not self.head:\n self.head = Node(value)\n return\nnode = self.head\nwhi...
<|body_start_0|> self.key = key if L is None: self.head = None return if not len(L[:1]): self.head = None return node = Node(L[0]) self.head = node for e in L[1:]: node.next_node = Node(e) node = node...
LinkedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkedList: def __init__(self, L=None, key=lambda x: x): """Creates an empty list or a list built from a subscriptable object, the key of each value being by default the value itself. >>> LinkedList().print() >>> LinkedList([]).print() >>> LinkedList((0,)).print() 0 >>> LinkedList(range(...
stack_v2_sparse_classes_36k_train_027280
2,815
no_license
[ { "docstring": "Creates an empty list or a list built from a subscriptable object, the key of each value being by default the value itself. >>> LinkedList().print() >>> LinkedList([]).print() >>> LinkedList((0,)).print() 0 >>> LinkedList(range(4)).print() 0, 1, 2, 3", "name": "__init__", "signature": "d...
4
stack_v2_sparse_classes_30k_train_020522
Implement the Python class `LinkedList` described below. Class description: Implement the LinkedList class. Method signatures and docstrings: - def __init__(self, L=None, key=lambda x: x): Creates an empty list or a list built from a subscriptable object, the key of each value being by default the value itself. >>> L...
Implement the Python class `LinkedList` described below. Class description: Implement the LinkedList class. Method signatures and docstrings: - def __init__(self, L=None, key=lambda x: x): Creates an empty list or a list built from a subscriptable object, the key of each value being by default the value itself. >>> L...
40066e70922c912bb24c5add6e3678fadbb3343d
<|skeleton|> class LinkedList: def __init__(self, L=None, key=lambda x: x): """Creates an empty list or a list built from a subscriptable object, the key of each value being by default the value itself. >>> LinkedList().print() >>> LinkedList([]).print() >>> LinkedList((0,)).print() 0 >>> LinkedList(range(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinkedList: def __init__(self, L=None, key=lambda x: x): """Creates an empty list or a list built from a subscriptable object, the key of each value being by default the value itself. >>> LinkedList().print() >>> LinkedList([]).print() >>> LinkedList((0,)).print() 0 >>> LinkedList(range(4)).print() 0,...
the_stack_v2_python_sparse
lecture/Lecture_8/test1.py
DARRENSKY/COMP9021
train
4
39269808181188a1b7a3e12542475db7d6bd7cec
[ "dp = [float('inf') for _ in range(amount + 1)]\ndp[0] = 0\nfor i in range(1, amount + 1):\n if i in coins:\n dp[i] = 1\n else:\n for j in range(1, i / 2 + 1):\n dp[i] = min(dp[i], dp[j] + dp[i - j])\nif dp[amount] == float('inf'):\n return -1\nelse:\n return dp[amount]", "dp ...
<|body_start_0|> dp = [float('inf') for _ in range(amount + 1)] dp[0] = 0 for i in range(1, amount + 1): if i in coins: dp[i] = 1 else: for j in range(1, i / 2 + 1): dp[i] = min(dp[i], dp[j] + dp[i - j]) if dp[am...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChangeSol(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_027281
1,308
no_license
[ { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChange", "signature": "def coinChange(self, coins, amount)" }, { "docstring": ":type coins: List[int] :type amount: int :rtype: int", "name": "coinChangeSol", "signature": "def coinChangeSol(self, coins, ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChangeSol(self, coins, amount): :type coins: List[int] :type amount: int :rtyp...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int - def coinChangeSol(self, coins, amount): :type coins: List[int] :type amount: int :rtyp...
7fa160362ebb58e7286b490012542baa2d51e5c9
<|skeleton|> class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_0|> def coinChangeSol(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def coinChange(self, coins, amount): """:type coins: List[int] :type amount: int :rtype: int""" dp = [float('inf') for _ in range(amount + 1)] dp[0] = 0 for i in range(1, amount + 1): if i in coins: dp[i] = 1 else: ...
the_stack_v2_python_sparse
dp/coin_change.py
gerrycfchang/leetcode-python
train
2
611b86dcd5d5c9047a307205d910633053ff4893
[ "super().__init__(coordinator)\nself.entity_description = description\nself._attr_unique_id = f'{coordinator.unique_id}_{description.key}'\nself._attr_device_info = DeviceInfo(identifiers={(DOMAIN, coordinator.unique_id)}, manufacturer='Solar-Log', name=coordinator.name, configuration_url=coordinator.host)", "raw...
<|body_start_0|> super().__init__(coordinator) self.entity_description = description self._attr_unique_id = f'{coordinator.unique_id}_{description.key}' self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, coordinator.unique_id)}, manufacturer='Solar-Log', name=coordinator.name, con...
Representation of a Sensor.
SolarlogSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SolarlogSensor: """Representation of a Sensor.""" def __init__(self, coordinator: SolarlogData, description: SolarLogSensorEntityDescription) -> None: """Initialize the sensor.""" <|body_0|> def native_value(self): """Return the native sensor value.""" <|...
stack_v2_sparse_classes_36k_train_027282
8,831
permissive
[ { "docstring": "Initialize the sensor.", "name": "__init__", "signature": "def __init__(self, coordinator: SolarlogData, description: SolarLogSensorEntityDescription) -> None" }, { "docstring": "Return the native sensor value.", "name": "native_value", "signature": "def native_value(self...
2
null
Implement the Python class `SolarlogSensor` described below. Class description: Representation of a Sensor. Method signatures and docstrings: - def __init__(self, coordinator: SolarlogData, description: SolarLogSensorEntityDescription) -> None: Initialize the sensor. - def native_value(self): Return the native sensor...
Implement the Python class `SolarlogSensor` described below. Class description: Representation of a Sensor. Method signatures and docstrings: - def __init__(self, coordinator: SolarlogData, description: SolarLogSensorEntityDescription) -> None: Initialize the sensor. - def native_value(self): Return the native sensor...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SolarlogSensor: """Representation of a Sensor.""" def __init__(self, coordinator: SolarlogData, description: SolarLogSensorEntityDescription) -> None: """Initialize the sensor.""" <|body_0|> def native_value(self): """Return the native sensor value.""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SolarlogSensor: """Representation of a Sensor.""" def __init__(self, coordinator: SolarlogData, description: SolarLogSensorEntityDescription) -> None: """Initialize the sensor.""" super().__init__(coordinator) self.entity_description = description self._attr_unique_id = f'...
the_stack_v2_python_sparse
homeassistant/components/solarlog/sensor.py
home-assistant/core
train
35,501
caa6a6ac0fe59627a6ea889972f66422774f7bb8
[ "params = super().get_default_params(with_embedding=True, with_multi_layer_perceptron=True)\nparams.add(engine.Param(name='mask_value', value=-1, desc='The value to be masked from inputs.'))\nparams['optimizer'] = 'adam'\nparams['input_shapes'] = [(5,), (5, 30)]\nreturn params", "query = keras.layers.Input(name='...
<|body_start_0|> params = super().get_default_params(with_embedding=True, with_multi_layer_perceptron=True) params.add(engine.Param(name='mask_value', value=-1, desc='The value to be masked from inputs.')) params['optimizer'] = 'adam' params['input_shapes'] = [(5,), (5, 30)] retu...
DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() >>> model.compile()
DRMM
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DRMM: """DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() >>> model.co...
stack_v2_sparse_classes_36k_train_027283
4,114
permissive
[ { "docstring": ":return: model default parameters.", "name": "get_default_params", "signature": "def get_default_params(cls) -> engine.ParamTable" }, { "docstring": "Build model structure.", "name": "build", "signature": "def build(self)" }, { "docstring": "Performs attention on ...
3
stack_v2_sparse_classes_30k_train_000787
Implement the Python class `DRMM` described below. Class description: DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(ve...
Implement the Python class `DRMM` described below. Class description: DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(ve...
1fe2afca7bc2aa0fd8af8f80df84a2665367d13c
<|skeleton|> class DRMM: """DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() >>> model.co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DRMM: """DRMM Model. Examples: >>> model = DRMM() >>> model.params['mlp_num_layers'] = 1 >>> model.params['mlp_num_units'] = 5 >>> model.params['mlp_num_fan_out'] = 1 >>> model.params['mlp_activation_func'] = 'tanh' >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() >>> model.compile()""" ...
the_stack_v2_python_sparse
matchzoo/models/drmm.py
zhanzecheng/MatchZoo
train
2
5dc5837ff9dca9fd1a89e86f56e844740d996ce7
[ "database = None\nhost = 'localhost'\nport = 5432\nuse_ssl = self._config.get('use_ssl', False)\nusername = None\npassword = None\nif 'database_host' in self._config:\n host = self._config['database_host']\nif 'database_port' in self._config:\n port = self._config['database_port']\nif 'database_name' in self....
<|body_start_0|> database = None host = 'localhost' port = 5432 use_ssl = self._config.get('use_ssl', False) username = None password = None if 'database_host' in self._config: host = self._config['database_host'] if 'database_port' in self._co...
# PostgreSQL Import performance and usage data from a PostgreSQL server. An [Agent Plugin](https://app.scalyr.com/help/scalyr-agent#plugins) is a component of the Scalyr Agent, enabling the collection of more data. The source code for each plugin is available on [Github](https://github.com/scalyr/scalyr-agent-2/tree/ma...
PostgresMonitor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostgresMonitor: """# PostgreSQL Import performance and usage data from a PostgreSQL server. An [Agent Plugin](https://app.scalyr.com/help/scalyr-agent#plugins) is a component of the Scalyr Agent, enabling the collection of more data. The source code for each plugin is available on [Github](https...
stack_v2_sparse_classes_36k_train_027284
22,940
permissive
[ { "docstring": "Performs monitor-specific initialization.", "name": "_initialize", "signature": "def _initialize(self)" }, { "docstring": "Invoked once per sample interval to gather a statistic.", "name": "gather_sample", "signature": "def gather_sample(self)" } ]
2
null
Implement the Python class `PostgresMonitor` described below. Class description: # PostgreSQL Import performance and usage data from a PostgreSQL server. An [Agent Plugin](https://app.scalyr.com/help/scalyr-agent#plugins) is a component of the Scalyr Agent, enabling the collection of more data. The source code for eac...
Implement the Python class `PostgresMonitor` described below. Class description: # PostgreSQL Import performance and usage data from a PostgreSQL server. An [Agent Plugin](https://app.scalyr.com/help/scalyr-agent#plugins) is a component of the Scalyr Agent, enabling the collection of more data. The source code for eac...
5099a498edc47ab841965b483c2c32af49eb7dae
<|skeleton|> class PostgresMonitor: """# PostgreSQL Import performance and usage data from a PostgreSQL server. An [Agent Plugin](https://app.scalyr.com/help/scalyr-agent#plugins) is a component of the Scalyr Agent, enabling the collection of more data. The source code for each plugin is available on [Github](https...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostgresMonitor: """# PostgreSQL Import performance and usage data from a PostgreSQL server. An [Agent Plugin](https://app.scalyr.com/help/scalyr-agent#plugins) is a component of the Scalyr Agent, enabling the collection of more data. The source code for each plugin is available on [Github](https://github.com...
the_stack_v2_python_sparse
scalyr_agent/builtin_monitors/postgres_monitor.py
scalyr/scalyr-agent-2
train
75
db9fe8b81beb54a31cd720913b4e27eb1c01e8d4
[ "node_type = request.query_params.get('type')\nif node_type == 'parent':\n needed = ['parent']\nelif node_type == 'children':\n needed = ['children']\nelse:\n needed = ['children', 'parent']\nparent_dict = {}\nchildren_list = []\nif 'parent' in needed:\n parent = models.Node.objects.filter(agent=request...
<|body_start_0|> node_type = request.query_params.get('type') if node_type == 'parent': needed = ['parent'] elif node_type == 'children': needed = ['children'] else: needed = ['children', 'parent'] parent_dict = {} children_list = [] ...
系统中心
SystemNodeList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SystemNodeList: """系统中心""" def get(self, request): """获取当前中心的上下级数据 :param request: :param type: 中心类型 :return:""" <|body_0|> def post(self, request): """添加 :param request: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> node_type = reque...
stack_v2_sparse_classes_36k_train_027285
29,724
no_license
[ { "docstring": "获取当前中心的上下级数据 :param request: :param type: 中心类型 :return:", "name": "get", "signature": "def get(self, request)" }, { "docstring": "添加 :param request: :return:", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `SystemNodeList` described below. Class description: 系统中心 Method signatures and docstrings: - def get(self, request): 获取当前中心的上下级数据 :param request: :param type: 中心类型 :return: - def post(self, request): 添加 :param request: :return:
Implement the Python class `SystemNodeList` described below. Class description: 系统中心 Method signatures and docstrings: - def get(self, request): 获取当前中心的上下级数据 :param request: :param type: 中心类型 :return: - def post(self, request): 添加 :param request: :return: <|skeleton|> class SystemNodeList: """系统中心""" def ge...
d6e025d7e9d9e3aecfd399c77f376130edd8a2df
<|skeleton|> class SystemNodeList: """系统中心""" def get(self, request): """获取当前中心的上下级数据 :param request: :param type: 中心类型 :return:""" <|body_0|> def post(self, request): """添加 :param request: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SystemNodeList: """系统中心""" def get(self, request): """获取当前中心的上下级数据 :param request: :param type: 中心类型 :return:""" node_type = request.query_params.get('type') if node_type == 'parent': needed = ['parent'] elif node_type == 'children': needed = ['chil...
the_stack_v2_python_sparse
soc_system/views/node_views.py
sundw2015/841
train
4
4e005d18fac4e5616b1779e7848b850439ad9694
[ "super().__init__()\nGatedGraphConv.global_count += 1\nself.name = name if name else 'GatedGraphConv_{}'.format(GatedGraphConv.global_count)\nself.output_channels = output_channels\nself.rnn = lbann.modules.GRU(output_channels)\nself.num_layers = num_layers\nself.data_layout = data_layout\nself.weights = []\nfor i ...
<|body_start_0|> super().__init__() GatedGraphConv.global_count += 1 self.name = name if name else 'GatedGraphConv_{}'.format(GatedGraphConv.global_count) self.output_channels = output_channels self.rnn = lbann.modules.GRU(output_channels) self.num_layers = num_layers ...
Gated Graph Convolution layer. For kernel details, see: https://arxiv.org/abs/1511.05493 Implementation in the spirit of: https://github.com/rusty1s/pytorch_geometric/blob/ master/torch_geometric/nn/conv/gated_graph_conv.py
GatedGraphConv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GatedGraphConv: """Gated Graph Convolution layer. For kernel details, see: https://arxiv.org/abs/1511.05493 Implementation in the spirit of: https://github.com/rusty1s/pytorch_geometric/blob/ master/torch_geometric/nn/conv/gated_graph_conv.py""" def __init__(self, output_channels, num_layers...
stack_v2_sparse_classes_36k_train_027286
3,942
permissive
[ { "docstring": "Initialize GatedGraph layer Args: output_channels (int): The output size of the node features num_layers (int): Number of passes through the GRU (default: 1) name (str): Name of the layers and prefix to use for the layers. data_layout (str): Data layout (default: data parallel)", "name": "__...
2
stack_v2_sparse_classes_30k_train_015727
Implement the Python class `GatedGraphConv` described below. Class description: Gated Graph Convolution layer. For kernel details, see: https://arxiv.org/abs/1511.05493 Implementation in the spirit of: https://github.com/rusty1s/pytorch_geometric/blob/ master/torch_geometric/nn/conv/gated_graph_conv.py Method signatu...
Implement the Python class `GatedGraphConv` described below. Class description: Gated Graph Convolution layer. For kernel details, see: https://arxiv.org/abs/1511.05493 Implementation in the spirit of: https://github.com/rusty1s/pytorch_geometric/blob/ master/torch_geometric/nn/conv/gated_graph_conv.py Method signatu...
57116ecc030c0d17bc941f81131c1a335bc2c4ad
<|skeleton|> class GatedGraphConv: """Gated Graph Convolution layer. For kernel details, see: https://arxiv.org/abs/1511.05493 Implementation in the spirit of: https://github.com/rusty1s/pytorch_geometric/blob/ master/torch_geometric/nn/conv/gated_graph_conv.py""" def __init__(self, output_channels, num_layers...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GatedGraphConv: """Gated Graph Convolution layer. For kernel details, see: https://arxiv.org/abs/1511.05493 Implementation in the spirit of: https://github.com/rusty1s/pytorch_geometric/blob/ master/torch_geometric/nn/conv/gated_graph_conv.py""" def __init__(self, output_channels, num_layers=1, name=None...
the_stack_v2_python_sparse
python/lbann/modules/graph/sparse/GatedGraphConv.py
oyamay/lbann
train
0
565556e3aa2d5aa33593ebf13e18d8a2043670b4
[ "data = tfds.load('ted_hrlr_translate/pt_to_en', as_supervised=True)\nself.data_train = data['train']\nself.data_valid = data['validation']\ntokenizer_pt, tokenizer_en = self.tokenize_dataset(self.data_train)\nself.tokenizer_pt = tokenizer_pt\nself.tokenizer_en = tokenizer_en", "encoder = tfds.deprecated.text.Sub...
<|body_start_0|> data = tfds.load('ted_hrlr_translate/pt_to_en', as_supervised=True) self.data_train = data['train'] self.data_valid = data['validation'] tokenizer_pt, tokenizer_en = self.tokenize_dataset(self.data_train) self.tokenizer_pt = tokenizer_pt self.tokenizer_en...
Class to load an prepare a dataset for machine translation
Dataset
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Dataset: """Class to load an prepare a dataset for machine translation""" def __init__(self): """Init""" <|body_0|> def tokenize_dataset(self, data): """Creates sub-word tokenizers for a dataset data: tf.data.Dataset whose examples are formatted as a table (pt, e...
stack_v2_sparse_classes_36k_train_027287
1,427
no_license
[ { "docstring": "Init", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Creates sub-word tokenizers for a dataset data: tf.data.Dataset whose examples are formatted as a table (pt, en) pt: tf.Tensor containing the Portuguese sentence en: tf.Tensor containing the English s...
2
null
Implement the Python class `Dataset` described below. Class description: Class to load an prepare a dataset for machine translation Method signatures and docstrings: - def __init__(self): Init - def tokenize_dataset(self, data): Creates sub-word tokenizers for a dataset data: tf.data.Dataset whose examples are format...
Implement the Python class `Dataset` described below. Class description: Class to load an prepare a dataset for machine translation Method signatures and docstrings: - def __init__(self): Init - def tokenize_dataset(self, data): Creates sub-word tokenizers for a dataset data: tf.data.Dataset whose examples are format...
2757c8526290197d45a4de33cda71e686ddcbf1c
<|skeleton|> class Dataset: """Class to load an prepare a dataset for machine translation""" def __init__(self): """Init""" <|body_0|> def tokenize_dataset(self, data): """Creates sub-word tokenizers for a dataset data: tf.data.Dataset whose examples are formatted as a table (pt, e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Dataset: """Class to load an prepare a dataset for machine translation""" def __init__(self): """Init""" data = tfds.load('ted_hrlr_translate/pt_to_en', as_supervised=True) self.data_train = data['train'] self.data_valid = data['validation'] tokenizer_pt, tokenizer...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/0-dataset.py
95ktsmith/holbertonschool-machine_learning
train
0
b6880a38e4b3c47987ace83bf5be200767f17ec0
[ "self.name = name\nself.type = type\nself.label = label\nself.desc = desc\nself.default = default", "para = OrderedDict()\npara[self.TYPE] = self.type\nif self.type:\n para[self.TYPE] = self.type\nif self.desc:\n para[self.DESCRIPTION] = self.desc\nif self.default:\n para[self.DEFAULT] = self.default\nif...
<|body_start_0|> self.name = name self.type = type self.label = label self.desc = desc self.default = default <|end_body_0|> <|body_start_1|> para = OrderedDict() para[self.TYPE] = self.type if self.type: para[self.TYPE] = self.type if...
HOT Parameter Attr
Parameter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Parameter: """HOT Parameter Attr""" def __init__(self, name, type, label=None, desc=None, default=None): """Init a HOT parameter""" <|body_0|> def get_output_dict(self): """Output a parameter as a nested dict""" <|body_1|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_36k_train_027288
6,215
no_license
[ { "docstring": "Init a HOT parameter", "name": "__init__", "signature": "def __init__(self, name, type, label=None, desc=None, default=None)" }, { "docstring": "Output a parameter as a nested dict", "name": "get_output_dict", "signature": "def get_output_dict(self)" } ]
2
stack_v2_sparse_classes_30k_train_003169
Implement the Python class `Parameter` described below. Class description: HOT Parameter Attr Method signatures and docstrings: - def __init__(self, name, type, label=None, desc=None, default=None): Init a HOT parameter - def get_output_dict(self): Output a parameter as a nested dict
Implement the Python class `Parameter` described below. Class description: HOT Parameter Attr Method signatures and docstrings: - def __init__(self, name, type, label=None, desc=None, default=None): Init a HOT parameter - def get_output_dict(self): Output a parameter as a nested dict <|skeleton|> class Parameter: ...
103d9ffb67e98c6e912a5861b73ad0f06d9df80c
<|skeleton|> class Parameter: """HOT Parameter Attr""" def __init__(self, name, type, label=None, desc=None, default=None): """Init a HOT parameter""" <|body_0|> def get_output_dict(self): """Output a parameter as a nested dict""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Parameter: """HOT Parameter Attr""" def __init__(self, name, type, label=None, desc=None, default=None): """Init a HOT parameter""" self.name = name self.type = type self.label = label self.desc = desc self.default = default def get_output_dict(self): ...
the_stack_v2_python_sparse
sfc-ostack/sfcostack/hot.py
stevelorenz/sfc-ostack
train
4
b04ac777fedc2201e0f2e3d0aba2a9e62f45b686
[ "self.database = database\nself.notifications = set()\nself.last_update = 0\nself.update_notification_set()\nself.database.create_table('user_notification_id', ['`chat_id` INT UNSIGNED PRIMARY KEY NOT NULL', '`notification_id` INT UNSIGNED NOT NULL'])", "now = int(time.time())\nparams = db.get_request_struct()\np...
<|body_start_0|> self.database = database self.notifications = set() self.last_update = 0 self.update_notification_set() self.database.create_table('user_notification_id', ['`chat_id` INT UNSIGNED PRIMARY KEY NOT NULL', '`notification_id` INT UNSIGNED NOT NULL']) <|end_body_0|> ...
Class for online monitoring users notifications
NotificationDaemon
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationDaemon: """Class for online monitoring users notifications""" def __init__(self, database): """Initialize class :param database.Database database: database""" <|body_0|> def update_notification_set(self): """Loads notifications from the database and p...
stack_v2_sparse_classes_36k_train_027289
2,859
no_license
[ { "docstring": "Initialize class :param database.Database database: database", "name": "__init__", "signature": "def __init__(self, database)" }, { "docstring": "Loads notifications from the database and puts them in the class structure", "name": "update_notification_set", "signature": "...
3
stack_v2_sparse_classes_30k_train_020489
Implement the Python class `NotificationDaemon` described below. Class description: Class for online monitoring users notifications Method signatures and docstrings: - def __init__(self, database): Initialize class :param database.Database database: database - def update_notification_set(self): Loads notifications fr...
Implement the Python class `NotificationDaemon` described below. Class description: Class for online monitoring users notifications Method signatures and docstrings: - def __init__(self, database): Initialize class :param database.Database database: database - def update_notification_set(self): Loads notifications fr...
460ab221b6afff976dea4527ca357a756c817d95
<|skeleton|> class NotificationDaemon: """Class for online monitoring users notifications""" def __init__(self, database): """Initialize class :param database.Database database: database""" <|body_0|> def update_notification_set(self): """Loads notifications from the database and p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NotificationDaemon: """Class for online monitoring users notifications""" def __init__(self, database): """Initialize class :param database.Database database: database""" self.database = database self.notifications = set() self.last_update = 0 self.update_notificat...
the_stack_v2_python_sparse
notification_daemon.py
rust379/bot_tgm
train
0
defce6771f3c747bb26af5b3e0de29b0f1874a5e
[ "cross = tensor([[[0, 1, 0], [1, 1, 1], [0, 1, 0]]])\nkernel = cross * 0.2\nreturn kernel[None]", "if pred.dim() != 4:\n raise ValueError(f'Only 2D images supported. Got {pred.dim()}.')\nif not (target.max() < pred.size(1) and target.min() >= 0 and (target.dtype == torch.long)):\n raise ValueError(f'Expect ...
<|body_start_0|> cross = tensor([[[0, 1, 0], [1, 1, 1], [0, 1, 0]]]) kernel = cross * 0.2 return kernel[None] <|end_body_0|> <|body_start_1|> if pred.dim() != 4: raise ValueError(f'Only 2D images supported. Got {pred.dim()}.') if not (target.max() < pred.size(1) and ...
Binary Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the one-sided HD from X to Y is defined as: .. math:: hd(X,Y) = \\max_{x \\in X} \\min_{y \\i...
HausdorffERLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HausdorffERLoss: """Binary Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the one-sided HD from X to Y is defined as: .. mat...
stack_v2_sparse_classes_36k_train_027290
9,826
permissive
[ { "docstring": "Get kernel for image morphology convolution.", "name": "get_kernel", "signature": "def get_kernel(self) -> Tensor" }, { "docstring": "Compute Hausdorff loss. Args: pred: predicted tensor with a shape of :math:`(B, C, H, W)`. Each channel is as binary as: 1 -> fg, 0 -> bg. target:...
2
stack_v2_sparse_classes_30k_train_020512
Implement the Python class `HausdorffERLoss` described below. Class description: Binary Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the one-sid...
Implement the Python class `HausdorffERLoss` described below. Class description: Binary Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the one-sid...
1e0f8baa7318c05b17ea6dbb48605691bca8972f
<|skeleton|> class HausdorffERLoss: """Binary Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the one-sided HD from X to Y is defined as: .. mat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HausdorffERLoss: """Binary Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the one-sided HD from X to Y is defined as: .. math:: hd(X,Y) =...
the_stack_v2_python_sparse
kornia/losses/hausdorff.py
kornia/kornia
train
7,351
16fd747ee5f16cf98994a4d8e07665d345c83694
[ "if not matrix:\n return 0\nm, n = (len(matrix), len(matrix[0]))\ncache = [[-1 for _ in range(n)] for _ in range(m)]\nlong = 0\nfor i in range(m):\n for j in range(n):\n long = max(long, self.longest(matrix, cache, m, n, i, j))\nreturn long", "dirs = ((-1, 0), (1, 0), (0, -1), (0, 1))\nif cache[i][j]...
<|body_start_0|> if not matrix: return 0 m, n = (len(matrix), len(matrix[0])) cache = [[-1 for _ in range(n)] for _ in range(m)] long = 0 for i in range(m): for j in range(n): long = max(long, self.longest(matrix, cache, m, n, i, j)) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestIncreasingPath(self, matrix): """:type matrix: List[List[int]] :rtype: int""" <|body_0|> def longest(self, matrix, cache, m, n, i, j): """Strictly increasing, thus no need to have a visited matrix""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_027291
1,691
no_license
[ { "docstring": ":type matrix: List[List[int]] :rtype: int", "name": "longestIncreasingPath", "signature": "def longestIncreasingPath(self, matrix)" }, { "docstring": "Strictly increasing, thus no need to have a visited matrix", "name": "longest", "signature": "def longest(self, matrix, c...
2
stack_v2_sparse_classes_30k_train_002059
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestIncreasingPath(self, matrix): :type matrix: List[List[int]] :rtype: int - def longest(self, matrix, cache, m, n, i, j): Strictly increasing, thus no need to have a vis...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestIncreasingPath(self, matrix): :type matrix: List[List[int]] :rtype: int - def longest(self, matrix, cache, m, n, i, j): Strictly increasing, thus no need to have a vis...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class Solution: def longestIncreasingPath(self, matrix): """:type matrix: List[List[int]] :rtype: int""" <|body_0|> def longest(self, matrix, cache, m, n, i, j): """Strictly increasing, thus no need to have a visited matrix""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestIncreasingPath(self, matrix): """:type matrix: List[List[int]] :rtype: int""" if not matrix: return 0 m, n = (len(matrix), len(matrix[0])) cache = [[-1 for _ in range(n)] for _ in range(m)] long = 0 for i in range(m): ...
the_stack_v2_python_sparse
L/LongestIncreasingPathinaMatrix.py
bssrdf/pyleet
train
2
14a16f0e3cf291476ee60a8a73f61bb4100d20c1
[ "self.Wh = np.random.normal(size=(i + h, h))\nself.Wy = np.random.normal(size=(h, o))\nself.bh = np.zeros((1, h))\nself.by = np.zeros((1, o))", "h_x = np.concatenate((h_prev, x_t), axis=1)\nh_next = np.tanh(np.matmul(h_x, self.Wh) + self.bh)\ny = np.matmul(h_next, self.Wy) + self.by\ny = np.exp(y) / np.sum(np.exp...
<|body_start_0|> self.Wh = np.random.normal(size=(i + h, h)) self.Wy = np.random.normal(size=(h, o)) self.bh = np.zeros((1, h)) self.by = np.zeros((1, o)) <|end_body_0|> <|body_start_1|> h_x = np.concatenate((h_prev, x_t), axis=1) h_next = np.tanh(np.matmul(h_x, self.Wh)...
RNN class
RNNCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNCell: """RNN class""" def __init__(self, i, h, o): """class constructor: - i: dimensionality of the data - h: dimensionality of the hidden state - o: dimensionality of the outputs Creates the public instance attributes Wh, Wy, bh, by that represent the weights and biases of the ce...
stack_v2_sparse_classes_36k_train_027292
1,753
no_license
[ { "docstring": "class constructor: - i: dimensionality of the data - h: dimensionality of the hidden state - o: dimensionality of the outputs Creates the public instance attributes Wh, Wy, bh, by that represent the weights and biases of the cell - Wh and bh are for the concatenated hidden state and input data -...
2
null
Implement the Python class `RNNCell` described below. Class description: RNN class Method signatures and docstrings: - def __init__(self, i, h, o): class constructor: - i: dimensionality of the data - h: dimensionality of the hidden state - o: dimensionality of the outputs Creates the public instance attributes Wh, W...
Implement the Python class `RNNCell` described below. Class description: RNN class Method signatures and docstrings: - def __init__(self, i, h, o): class constructor: - i: dimensionality of the data - h: dimensionality of the hidden state - o: dimensionality of the outputs Creates the public instance attributes Wh, W...
cd386dd814ccb4869d33551b3ab8c3dd774fddf9
<|skeleton|> class RNNCell: """RNN class""" def __init__(self, i, h, o): """class constructor: - i: dimensionality of the data - h: dimensionality of the hidden state - o: dimensionality of the outputs Creates the public instance attributes Wh, Wy, bh, by that represent the weights and biases of the ce...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNCell: """RNN class""" def __init__(self, i, h, o): """class constructor: - i: dimensionality of the data - h: dimensionality of the hidden state - o: dimensionality of the outputs Creates the public instance attributes Wh, Wy, bh, by that represent the weights and biases of the cell - Wh and b...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/0-rnn_cell.py
Noeuclides/holbertonschool-machine_learning
train
0
8710286d65041308dffa1e0cf81ef916ca3e8f70
[ "parser.add_argument('BUCKET_ID', help='The id of the bucket to update.')\nparser.add_argument('--retention-days', type=int, help='A new retention period for the bucket.')\nparser.add_argument('--display-name', help='A new display name for the bucket.')\nparser.add_argument('--description', help='A new description ...
<|body_start_0|> parser.add_argument('BUCKET_ID', help='The id of the bucket to update.') parser.add_argument('--retention-days', type=int, help='A new retention period for the bucket.') parser.add_argument('--display-name', help='A new display name for the bucket.') parser.add_argument(...
Updates a bucket. Changes one or more proprties associated with a bucket.
Update
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Update: """Updates a bucket. Changes one or more proprties associated with a 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 n...
stack_v2_sparse_classes_36k_train_027293
3,052
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: The updated...
2
stack_v2_sparse_classes_30k_train_010788
Implement the Python class `Update` described below. Class description: Updates a bucket. Changes one or more proprties associated with a 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...
Implement the Python class `Update` described below. Class description: Updates a bucket. Changes one or more proprties associated with a 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...
85bb264e273568b5a0408f733b403c56373e2508
<|skeleton|> class Update: """Updates a bucket. Changes one or more proprties associated with a 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 n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Update: """Updates a bucket. Changes one or more proprties associated with a bucket.""" def Args(parser): """Register flags for this command.""" parser.add_argument('BUCKET_ID', help='The id of the bucket to update.') parser.add_argument('--retention-days', type=int, help='A new r...
the_stack_v2_python_sparse
google-cloud-sdk/lib/surface/logging/buckets/update.py
bopopescu/socialliteapp
train
0
1594a09317edb4bc228dbb1cfb1cf4998336d3d8
[ "try:\n respone = super().post(request, *args, **kwargs)\n complaint = request.data['complaint']\n comp = ComplaintModel.objects.get(id=complaint)\n comp.like_count += 1\n comp.save()\nexcept Exception as e:\n raise e\nelse:\n return respone", "complaint_like = self.queryset.filter(complaint=...
<|body_start_0|> try: respone = super().post(request, *args, **kwargs) complaint = request.data['complaint'] comp = ComplaintModel.objects.get(id=complaint) comp.like_count += 1 comp.save() except Exception as e: raise e els...
吐槽点赞
ComplaintLikeView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComplaintLikeView: """吐槽点赞""" def post(self, request, *args, **kwargs): """点赞""" <|body_0|> def destroy(self, request, complaint, *args, **kwargs): """取消点赞""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: respone = super().post(r...
stack_v2_sparse_classes_36k_train_027294
9,460
no_license
[ { "docstring": "点赞", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "取消点赞", "name": "destroy", "signature": "def destroy(self, request, complaint, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_005389
Implement the Python class `ComplaintLikeView` described below. Class description: 吐槽点赞 Method signatures and docstrings: - def post(self, request, *args, **kwargs): 点赞 - def destroy(self, request, complaint, *args, **kwargs): 取消点赞
Implement the Python class `ComplaintLikeView` described below. Class description: 吐槽点赞 Method signatures and docstrings: - def post(self, request, *args, **kwargs): 点赞 - def destroy(self, request, complaint, *args, **kwargs): 取消点赞 <|skeleton|> class ComplaintLikeView: """吐槽点赞""" def post(self, request, *ar...
c0df44858d0951e345de245505ae8f71f8b5e1b6
<|skeleton|> class ComplaintLikeView: """吐槽点赞""" def post(self, request, *args, **kwargs): """点赞""" <|body_0|> def destroy(self, request, complaint, *args, **kwargs): """取消点赞""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComplaintLikeView: """吐槽点赞""" def post(self, request, *args, **kwargs): """点赞""" try: respone = super().post(request, *args, **kwargs) complaint = request.data['complaint'] comp = ComplaintModel.objects.get(id=complaint) comp.like_count += 1...
the_stack_v2_python_sparse
mlh/apps/complaints/views.py
AmirHuang/mlh
train
0
b378de7e2afbe5990b28523d265c89072028d95a
[ "super(YearModel, self).__init__()\nself.config = config\nself.vocab = vocab\nself.dim = 1", "if len(m1['y']) == 1 and len(m2['y']) == 1:\n return abs(int(list(m1['y'])[0]) - int(list(m2['y'])[0]))\nelse:\n return 0.0", "if len(m1['y']) == 1 and len(m2['y']) == 0:\n return 1.0\nelif len(m1['y']) == 0 a...
<|body_start_0|> super(YearModel, self).__init__() self.config = config self.vocab = vocab self.dim = 1 <|end_body_0|> <|body_start_1|> if len(m1['y']) == 1 and len(m2['y']) == 1: return abs(int(list(m1['y'])[0]) - int(list(m2['y'])[0])) else: ret...
YearModel
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YearModel: def __init__(self, config, vocab): """Init.""" <|body_0|> def year_span(self, m1, m2): """(max year - min year)""" <|body_1|> def one_year_missing(self, m1, m2): """Return 1.0 if one of the mentions doesn't have a year.""" <|bo...
stack_v2_sparse_classes_36k_train_027295
1,967
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, config, vocab)" }, { "docstring": "(max year - min year)", "name": "year_span", "signature": "def year_span(self, m1, m2)" }, { "docstring": "Return 1.0 if one of the mentions doesn't have a year.", ...
5
null
Implement the Python class `YearModel` described below. Class description: Implement the YearModel class. Method signatures and docstrings: - def __init__(self, config, vocab): Init. - def year_span(self, m1, m2): (max year - min year) - def one_year_missing(self, m1, m2): Return 1.0 if one of the mentions doesn't ha...
Implement the Python class `YearModel` described below. Class description: Implement the YearModel class. Method signatures and docstrings: - def __init__(self, config, vocab): Init. - def year_span(self, m1, m2): (max year - min year) - def one_year_missing(self, m1, m2): Return 1.0 if one of the mentions doesn't ha...
542659170897ad05f7612639cb918886859ae9d6
<|skeleton|> class YearModel: def __init__(self, config, vocab): """Init.""" <|body_0|> def year_span(self, m1, m2): """(max year - min year)""" <|body_1|> def one_year_missing(self, m1, m2): """Return 1.0 if one of the mentions doesn't have a year.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class YearModel: def __init__(self, config, vocab): """Init.""" super(YearModel, self).__init__() self.config = config self.vocab = vocab self.dim = 1 def year_span(self, m1, m2): """(max year - min year)""" if len(m1['y']) == 1 and len(m2['y']) == 1: ...
the_stack_v2_python_sparse
src/python/coref/models/pw/YearModel.py
nmonath/coref_tools
train
0
83d52b4822fbf72ed90a62edf07fc51341102b8c
[ "self.rows = rows\nself.cols = cols\nself.body = []\nself.body.append(self.initialize_snake())\nself.directions = collections.deque()", "snake_row = self.rows // 2\nsnake_col = 1\nreturn (snake_row, snake_col)", "for i, pos in enumerate(self.body):\n direct = self.directions[i]\n if direct == 'left':\n ...
<|body_start_0|> self.rows = rows self.cols = cols self.body = [] self.body.append(self.initialize_snake()) self.directions = collections.deque() <|end_body_0|> <|body_start_1|> snake_row = self.rows // 2 snake_col = 1 return (snake_row, snake_col) <|end_...
Class that represents the snake in Snake Game. It is instatiated from within the SnakeGame class Attributes: self.rows: The number of rows in the grid of the game self.cols: The number of columns in the grid of the game self.body: A list of poisitions in the grid of the Snake's body self.directions: A double-ended queu...
Snake
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Snake: """Class that represents the snake in Snake Game. It is instatiated from within the SnakeGame class Attributes: self.rows: The number of rows in the grid of the game self.cols: The number of columns in the grid of the game self.body: A list of poisitions in the grid of the Snake's body sel...
stack_v2_sparse_classes_36k_train_027296
2,882
no_license
[ { "docstring": "Initializes Snake class", "name": "__init__", "signature": "def __init__(self, rows, cols)" }, { "docstring": "Initializes the first position for the snake. Returns: A tuple representing the position for the snake in the format of (row, column).", "name": "initialize_snake", ...
4
stack_v2_sparse_classes_30k_train_008191
Implement the Python class `Snake` described below. Class description: Class that represents the snake in Snake Game. It is instatiated from within the SnakeGame class Attributes: self.rows: The number of rows in the grid of the game self.cols: The number of columns in the grid of the game self.body: A list of poisiti...
Implement the Python class `Snake` described below. Class description: Class that represents the snake in Snake Game. It is instatiated from within the SnakeGame class Attributes: self.rows: The number of rows in the grid of the game self.cols: The number of columns in the grid of the game self.body: A list of poisiti...
f9e23dad0beec83dde6fec3b3224b07f27f4bca9
<|skeleton|> class Snake: """Class that represents the snake in Snake Game. It is instatiated from within the SnakeGame class Attributes: self.rows: The number of rows in the grid of the game self.cols: The number of columns in the grid of the game self.body: A list of poisitions in the grid of the Snake's body sel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Snake: """Class that represents the snake in Snake Game. It is instatiated from within the SnakeGame class Attributes: self.rows: The number of rows in the grid of the game self.cols: The number of columns in the grid of the game self.body: A list of poisitions in the grid of the Snake's body self.directions:...
the_stack_v2_python_sparse
helpers/snake.py
Shadowissobad/AI-for-Snake-Game
train
0
c0a86a17a14e0e7ce30c8f49cd241e537dc88345
[ "self.winners, self.times = ([], times)\nvote_count, counts = (0, collections.defaultdict(int))\nfor person in persons:\n counts[person] += 1\n if counts[person] >= vote_count:\n vote_count = counts[person]\n winner = person\n self.winners.append(winner)", "i, j = (0, len(self.times))\nwhil...
<|body_start_0|> self.winners, self.times = ([], times) vote_count, counts = (0, collections.defaultdict(int)) for person in persons: counts[person] += 1 if counts[person] >= vote_count: vote_count = counts[person] winner = person ...
TopVotedCandidate
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" <|body_0|> def q(self, t): """:type t: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.winners, self.times = ([], times...
stack_v2_sparse_classes_36k_train_027297
823
no_license
[ { "docstring": ":type persons: List[int] :type times: List[int]", "name": "__init__", "signature": "def __init__(self, persons, times)" }, { "docstring": ":type t: int :rtype: int", "name": "q", "signature": "def q(self, t)" } ]
2
stack_v2_sparse_classes_30k_train_002439
Implement the Python class `TopVotedCandidate` described below. Class description: Implement the TopVotedCandidate class. Method signatures and docstrings: - def __init__(self, persons, times): :type persons: List[int] :type times: List[int] - def q(self, t): :type t: int :rtype: int
Implement the Python class `TopVotedCandidate` described below. Class description: Implement the TopVotedCandidate class. Method signatures and docstrings: - def __init__(self, persons, times): :type persons: List[int] :type times: List[int] - def q(self, t): :type t: int :rtype: int <|skeleton|> class TopVotedCandi...
fa1ed20d266b9c226f10fdb64528ffae0a595aa4
<|skeleton|> class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" <|body_0|> def q(self, t): """:type t: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TopVotedCandidate: def __init__(self, persons, times): """:type persons: List[int] :type times: List[int]""" self.winners, self.times = ([], times) vote_count, counts = (0, collections.defaultdict(int)) for person in persons: counts[person] += 1 if count...
the_stack_v2_python_sparse
medium_911. Online Election.py
sdksfo/leetcode
train
0
3b41021e1434699f938f9064cfd501fddf627282
[ "data = [graden, sleep]\nservo = FRICP(FRICP.Request.HARDWARE_SET_SERVO_POSITION, FRICP.Owner.PROCESSING, FRICP.Owner.HARDWARE, FRICP.Response.REQUEST, data)\nresponse = servo.send()\nreturn response.response", "distance = FRICP(FRICP.Request.HARDWARE_GET_SERVO_POSITION, FRICP.Owner.PROCESSING, FRICP.Owner.HARDWA...
<|body_start_0|> data = [graden, sleep] servo = FRICP(FRICP.Request.HARDWARE_SET_SERVO_POSITION, FRICP.Owner.PROCESSING, FRICP.Owner.HARDWARE, FRICP.Response.REQUEST, data) response = servo.send() return response.response <|end_body_0|> <|body_start_1|> distance = FRICP(FRICP.Re...
Servo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Servo: def set_position(graden: int, sleep: float=0.4) -> FRICP.Response: """verstuurd `HARDWARE_SET_SERVO_POSITION` naar de Hardware FRICP server. Draai de servo naar `graden`. kan een FRICP.ValidationError exception throwen Args: graden(int): naar welke graad moet hij draaien Returns: ...
stack_v2_sparse_classes_36k_train_027298
2,869
no_license
[ { "docstring": "verstuurd `HARDWARE_SET_SERVO_POSITION` naar de Hardware FRICP server. Draai de servo naar `graden`. kan een FRICP.ValidationError exception throwen Args: graden(int): naar welke graad moet hij draaien Returns: FRICP.Response: response van de server", "name": "set_position", "signature":...
2
stack_v2_sparse_classes_30k_train_013887
Implement the Python class `Servo` described below. Class description: Implement the Servo class. Method signatures and docstrings: - def set_position(graden: int, sleep: float=0.4) -> FRICP.Response: verstuurd `HARDWARE_SET_SERVO_POSITION` naar de Hardware FRICP server. Draai de servo naar `graden`. kan een FRICP.Va...
Implement the Python class `Servo` described below. Class description: Implement the Servo class. Method signatures and docstrings: - def set_position(graden: int, sleep: float=0.4) -> FRICP.Response: verstuurd `HARDWARE_SET_SERVO_POSITION` naar de Hardware FRICP server. Draai de servo naar `graden`. kan een FRICP.Va...
84e6f9c44876e71644ffa0786a6009b0f7f45843
<|skeleton|> class Servo: def set_position(graden: int, sleep: float=0.4) -> FRICP.Response: """verstuurd `HARDWARE_SET_SERVO_POSITION` naar de Hardware FRICP server. Draai de servo naar `graden`. kan een FRICP.ValidationError exception throwen Args: graden(int): naar welke graad moet hij draaien Returns: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Servo: def set_position(graden: int, sleep: float=0.4) -> FRICP.Response: """verstuurd `HARDWARE_SET_SERVO_POSITION` naar de Hardware FRICP server. Draai de servo naar `graden`. kan een FRICP.ValidationError exception throwen Args: graden(int): naar welke graad moet hij draaien Returns: FRICP.Response...
the_stack_v2_python_sparse
src/thread/hardware.py
thomas-w-nl/fotoroulette
train
0
1c167d7a407a586d34d00d8b82634e28c27759a0
[ "self.line_search = LineSearch(c1, c2, beta, tol)\nself.tad = TorchAutoDiff()\nself.f_all = []", "x_k = x0\nfor k in range(maxit):\n self.f_all.append(fun(x_k).detach().numpy())\n grad_k = self.tad.compute_gradient(fun, x_k)\n if use_btls:\n alpha_k = self.line_search.btls(fun, x_k, -grad_k, grad_...
<|body_start_0|> self.line_search = LineSearch(c1, c2, beta, tol) self.tad = TorchAutoDiff() self.f_all = [] <|end_body_0|> <|body_start_1|> x_k = x0 for k in range(maxit): self.f_all.append(fun(x_k).detach().numpy()) grad_k = self.tad.compute_gradient(fu...
SteepestDescent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SteepestDescent: def __init__(self, c1, c2, beta, tol=1e-05): """Implementation of the steepest descent algorithm Input: c1 : parameter used for line search wolfe condition 1 c2 : parameter used for line search wolfe condition 2 beta : used in back tracking line search tol : value to che...
stack_v2_sparse_classes_36k_train_027299
2,463
no_license
[ { "docstring": "Implementation of the steepest descent algorithm Input: c1 : parameter used for line search wolfe condition 1 c2 : parameter used for line search wolfe condition 2 beta : used in back tracking line search tol : value to check equality condition (refer to line search for details)", "name": "_...
3
stack_v2_sparse_classes_30k_val_000906
Implement the Python class `SteepestDescent` described below. Class description: Implement the SteepestDescent class. Method signatures and docstrings: - def __init__(self, c1, c2, beta, tol=1e-05): Implementation of the steepest descent algorithm Input: c1 : parameter used for line search wolfe condition 1 c2 : para...
Implement the Python class `SteepestDescent` described below. Class description: Implement the SteepestDescent class. Method signatures and docstrings: - def __init__(self, c1, c2, beta, tol=1e-05): Implementation of the steepest descent algorithm Input: c1 : parameter used for line search wolfe condition 1 c2 : para...
160f6bcef64d17c622fb9cb017bd4faa65afd858
<|skeleton|> class SteepestDescent: def __init__(self, c1, c2, beta, tol=1e-05): """Implementation of the steepest descent algorithm Input: c1 : parameter used for line search wolfe condition 1 c2 : parameter used for line search wolfe condition 2 beta : used in back tracking line search tol : value to che...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SteepestDescent: def __init__(self, c1, c2, beta, tol=1e-05): """Implementation of the steepest descent algorithm Input: c1 : parameter used for line search wolfe condition 1 c2 : parameter used for line search wolfe condition 2 beta : used in back tracking line search tol : value to check equality co...
the_stack_v2_python_sparse
python/py_solvers/unconstrained/gradient_descent.py
avadesh02/Non-Linear-Optimization-Solvers-Package
train
4