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
e22cb5c450bb485ee827652db4542779e3b0b79a
[ "app_lable__model_name = model_name_map.get(model_name)\nif not app_lable__model_name:\n raise APIError(10008)\nmodel = apps.get_model(app_lable__model_name)\nreturn model", "model_name = kwargs.get('model_name')\nmodel = self.get_model(model_name)\n_id = kwargs.get('id')\nif _id:\n data = model.objects.act...
<|body_start_0|> app_lable__model_name = model_name_map.get(model_name) if not app_lable__model_name: raise APIError(10008) model = apps.get_model(app_lable__model_name) return model <|end_body_0|> <|body_start_1|> model_name = kwargs.get('model_name') model ...
通用Restful API接口
QueryView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryView: """通用Restful API接口""" def get_model(self, model_name: str) -> BaseModel: """从指定模型中获取Django模型对象,未指定抛出APIError Args: model_name (str): 已定义对象名称,参考model_name_map Raises: APIError: 会被中间件捕获返回指定错误码的错误消息 Returns: Model: DJango Model对象""" <|body_0|> def get(self, r, *a...
stack_v2_sparse_classes_36k_train_018900
3,261
no_license
[ { "docstring": "从指定模型中获取Django模型对象,未指定抛出APIError Args: model_name (str): 已定义对象名称,参考model_name_map Raises: APIError: 会被中间件捕获返回指定错误码的错误消息 Returns: Model: DJango Model对象", "name": "get_model", "signature": "def get_model(self, model_name: str) -> BaseModel" }, { "docstring": "HTTP GET方法 Args: r (re...
4
stack_v2_sparse_classes_30k_train_018261
Implement the Python class `QueryView` described below. Class description: 通用Restful API接口 Method signatures and docstrings: - def get_model(self, model_name: str) -> BaseModel: 从指定模型中获取Django模型对象,未指定抛出APIError Args: model_name (str): 已定义对象名称,参考model_name_map Raises: APIError: 会被中间件捕获返回指定错误码的错误消息 Returns: Model: DJan...
Implement the Python class `QueryView` described below. Class description: 通用Restful API接口 Method signatures and docstrings: - def get_model(self, model_name: str) -> BaseModel: 从指定模型中获取Django模型对象,未指定抛出APIError Args: model_name (str): 已定义对象名称,参考model_name_map Raises: APIError: 会被中间件捕获返回指定错误码的错误消息 Returns: Model: DJan...
da79506169573df7d48784f5f109be61e59edc7b
<|skeleton|> class QueryView: """通用Restful API接口""" def get_model(self, model_name: str) -> BaseModel: """从指定模型中获取Django模型对象,未指定抛出APIError Args: model_name (str): 已定义对象名称,参考model_name_map Raises: APIError: 会被中间件捕获返回指定错误码的错误消息 Returns: Model: DJango Model对象""" <|body_0|> def get(self, r, *a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueryView: """通用Restful API接口""" def get_model(self, model_name: str) -> BaseModel: """从指定模型中获取Django模型对象,未指定抛出APIError Args: model_name (str): 已定义对象名称,参考model_name_map Raises: APIError: 会被中间件捕获返回指定错误码的错误消息 Returns: Model: DJango Model对象""" app_lable__model_name = model_name_map.get(model...
the_stack_v2_python_sparse
blog/cqi/views.py
wangjiancn/back-end_blog
train
1
874dbeffc3a6c99b07837c4dfa9ac138d6a2b4d6
[ "self._app = app\nself._collection = collection\nself._kv = kv\nself._owner = owner", "excludes_search = 'NOT ' + '(' + ' OR '.join(['type=\"%s\"' % i for i in excludes_list]) + ')'\ngetargs = {'output_mode': 'json', 'search': excludes_search, 'count': 0}\nupdate_times = {}\nresponse, content = splunk.rest.simple...
<|body_start_0|> self._app = app self._collection = collection self._kv = kv self._owner = owner <|end_body_0|> <|body_start_1|> excludes_search = 'NOT ' + '(' + ' OR '.join(['type="%s"' % i for i in excludes_list]) + ')' getargs = {'output_mode': 'json', 'search': exclu...
ThreatIntelMeta
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThreatIntelMeta: def __init__(self, app, collection, kv, owner): """Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is housed. collection - The name of the collection. kv - a KVStoreHandler object. owner - The owner of the ...
stack_v2_sparse_classes_36k_train_018901
39,192
no_license
[ { "docstring": "Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is housed. collection - The name of the collection. kv - a KVStoreHandler object. owner - The owner of the collection", "name": "__init__", "signature": "def __init__(self, ap...
4
null
Implement the Python class `ThreatIntelMeta` described below. Class description: Implement the ThreatIntelMeta class. Method signatures and docstrings: - def __init__(self, app, collection, kv, owner): Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is ...
Implement the Python class `ThreatIntelMeta` described below. Class description: Implement the ThreatIntelMeta class. Method signatures and docstrings: - def __init__(self, app, collection, kv, owner): Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is ...
70689c54d1a67e809bf134dd586b2ea05ff4c431
<|skeleton|> class ThreatIntelMeta: def __init__(self, app, collection, kv, owner): """Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is housed. collection - The name of the collection. kv - a KVStoreHandler object. owner - The owner of the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ThreatIntelMeta: def __init__(self, app, collection, kv, owner): """Initialize a class for handling of threat intel metadata. Arguments: app - The app where the metadata collection is housed. collection - The name of the collection. kv - a KVStoreHandler object. owner - The owner of the collection""" ...
the_stack_v2_python_sparse
DA-ESS-ThreatIntelligence/bin/threat_intelligence_manager.py
reza/es_eventgens
train
0
74f152c6f1c0b1b497fec4f5b1185c1a4c3a4356
[ "user = request.user\nif user:\n ser = self.serializer_class(user)\n return Response({'data': ser.data}, status=status.HTTP_200_OK)\nelse:\n return Response({'status': status.HTTP_404_NOT_FOUND, 'error': 'User not found'})", "ser_params = self.serializer_class(data=request.data)\nser_params.is_valid(rais...
<|body_start_0|> user = request.user if user: ser = self.serializer_class(user) return Response({'data': ser.data}, status=status.HTTP_200_OK) else: return Response({'status': status.HTTP_404_NOT_FOUND, 'error': 'User not found'}) <|end_body_0|> <|body_start_...
AuthViewSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthViewSet: def user(self, request): """User profile information""" <|body_0|> def register(self, request): """User registration""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = request.user if user: ser = self.serializer_...
stack_v2_sparse_classes_36k_train_018902
3,325
permissive
[ { "docstring": "User profile information", "name": "user", "signature": "def user(self, request)" }, { "docstring": "User registration", "name": "register", "signature": "def register(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_009139
Implement the Python class `AuthViewSet` described below. Class description: Implement the AuthViewSet class. Method signatures and docstrings: - def user(self, request): User profile information - def register(self, request): User registration
Implement the Python class `AuthViewSet` described below. Class description: Implement the AuthViewSet class. Method signatures and docstrings: - def user(self, request): User profile information - def register(self, request): User registration <|skeleton|> class AuthViewSet: def user(self, request): ""...
05daac6bc1504658909dc396e48cc8100ec1747c
<|skeleton|> class AuthViewSet: def user(self, request): """User profile information""" <|body_0|> def register(self, request): """User registration""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthViewSet: def user(self, request): """User profile information""" user = request.user if user: ser = self.serializer_class(user) return Response({'data': ser.data}, status=status.HTTP_200_OK) else: return Response({'status': status.HTTP_40...
the_stack_v2_python_sparse
backend/authentication/views.py
vindem22/work-hour-registration
train
0
3aff865c6ffbbb3a66def0db7691dbf3c4d9cf81
[ "self.ca_certificate = ca_certificate\nself.client_certificate = client_certificate\nself.client_key = client_key\nself.kmip_protocol_version = kmip_protocol_version\nself.server_ip = server_ip\nself.server_name = server_name\nself.server_port = server_port\nself.server_type = server_type", "if dictionary is None...
<|body_start_0|> self.ca_certificate = ca_certificate self.client_certificate = client_certificate self.client_key = client_key self.kmip_protocol_version = kmip_protocol_version self.server_ip = server_ip self.server_name = server_name self.server_port = server_p...
Implementation of the 'KmsConfiguration' model. Specifies the parameters for KMS configuration. Attributes: ca_certificate (string): Specifies the CA certificate in PEM format. client_certificate (string): Specifies the client certificate. It is in PEM format. client_key (string): Specifies the client private key. kmip...
KmsConfiguration
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KmsConfiguration: """Implementation of the 'KmsConfiguration' model. Specifies the parameters for KMS configuration. Attributes: ca_certificate (string): Specifies the CA certificate in PEM format. client_certificate (string): Specifies the client certificate. It is in PEM format. client_key (str...
stack_v2_sparse_classes_36k_train_018903
3,598
permissive
[ { "docstring": "Constructor for the KmsConfiguration class", "name": "__init__", "signature": "def __init__(self, ca_certificate=None, client_certificate=None, client_key=None, kmip_protocol_version=None, server_ip=None, server_name=None, server_port=None, server_type=None)" }, { "docstring": "C...
2
null
Implement the Python class `KmsConfiguration` described below. Class description: Implementation of the 'KmsConfiguration' model. Specifies the parameters for KMS configuration. Attributes: ca_certificate (string): Specifies the CA certificate in PEM format. client_certificate (string): Specifies the client certificat...
Implement the Python class `KmsConfiguration` described below. Class description: Implementation of the 'KmsConfiguration' model. Specifies the parameters for KMS configuration. Attributes: ca_certificate (string): Specifies the CA certificate in PEM format. client_certificate (string): Specifies the client certificat...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class KmsConfiguration: """Implementation of the 'KmsConfiguration' model. Specifies the parameters for KMS configuration. Attributes: ca_certificate (string): Specifies the CA certificate in PEM format. client_certificate (string): Specifies the client certificate. It is in PEM format. client_key (str...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KmsConfiguration: """Implementation of the 'KmsConfiguration' model. Specifies the parameters for KMS configuration. Attributes: ca_certificate (string): Specifies the CA certificate in PEM format. client_certificate (string): Specifies the client certificate. It is in PEM format. client_key (string): Specifi...
the_stack_v2_python_sparse
cohesity_management_sdk/models/kms_configuration.py
cohesity/management-sdk-python
train
24
8313bc6b7a9a6d8c1d645f97e48e95ddf8c0d392
[ "self.textctrl = wx.TextCtrl(sctpanel, -1, '', wx.DefaultPosition, wx.Size(1000, 10))\nhbox = wx.BoxSizer(wx.HORIZONTAL)\nbutton_fetch_file = wx.Button(sctpanel, -1, label=label)\nbutton_fetch_file.Bind(wx.EVT_BUTTON, self.get_highlighted_file_name)\nhbox.Add(button_fetch_file, proportion=0, flag=wx.ALIGN_LEFT | wx...
<|body_start_0|> self.textctrl = wx.TextCtrl(sctpanel, -1, '', wx.DefaultPosition, wx.Size(1000, 10)) hbox = wx.BoxSizer(wx.HORIZONTAL) button_fetch_file = wx.Button(sctpanel, -1, label=label) button_fetch_file.Bind(wx.EVT_BUTTON, self.get_highlighted_file_name) hbox.Add(button_f...
Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl.GetValue()
TextBox
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextBox: """Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl.GetValue()""" def __init__(self, s...
stack_v2_sparse_classes_36k_train_018904
24,507
permissive
[ { "docstring": ":param sctpanel: SCTPanel Class :param label: Label to display on the button", "name": "__init__", "signature": "def __init__(self, sctpanel, label='')" }, { "docstring": "Fetch path to file highlighted in the Overlay list.", "name": "get_highlighted_file_name", "signatur...
2
stack_v2_sparse_classes_30k_train_015520
Implement the Python class `TextBox` described below. Class description: Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl....
Implement the Python class `TextBox` described below. Class description: Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl....
81ebad505180ab18270eb926cca4a134996f8c45
<|skeleton|> class TextBox: """Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl.GetValue()""" def __init__(self, s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextBox: """Create a horizontal box composed of a button (left) and a text box (right). When the button is pressed, the file name highlighted in the list of overlay is fetched and passed into the text box. This file name can be accessed by: TextBox.textctrl.GetValue()""" def __init__(self, sctpanel, labe...
the_stack_v2_python_sparse
contrib/fsl_integration/sct_plugin.py
PaulBautin/spinalcordtoolbox
train
1
0d1a91f758befa621202cf39fc72bd2d25b63f34
[ "self.left_max_len = left_max_len\nself.right_max_len = right_max_len\nself.hidden_dim = hidden_dim", "att_left = tf.contrib.layers.fully_connected(inputs=left_tensor, num_outputs=self.hidden_dim, activation_fn=None, scope='att_keys')\natt_right = tf.contrib.layers.fully_connected(inputs=right_tensor, num_outputs...
<|body_start_0|> self.left_max_len = left_max_len self.right_max_len = right_max_len self.hidden_dim = hidden_dim <|end_body_0|> <|body_start_1|> att_left = tf.contrib.layers.fully_connected(inputs=left_tensor, num_outputs=self.hidden_dim, activation_fn=None, scope='att_keys') a...
CrossAttentionLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CrossAttentionLayer: def __init__(self, left_max_len, right_max_len, hidden_dim): """:param left_max_len: max length of left tensor (T1) :param right_max_len: max length of right tensor (T2) :param hidden_dim: a number""" <|body_0|> def compute_attention(self, left_tensor, l...
stack_v2_sparse_classes_36k_train_018905
12,216
no_license
[ { "docstring": ":param left_max_len: max length of left tensor (T1) :param right_max_len: max length of right tensor (T2) :param hidden_dim: a number", "name": "__init__", "signature": "def __init__(self, left_max_len, right_max_len, hidden_dim)" }, { "docstring": ":param left_tensor: [B, T1, di...
2
stack_v2_sparse_classes_30k_val_001030
Implement the Python class `CrossAttentionLayer` described below. Class description: Implement the CrossAttentionLayer class. Method signatures and docstrings: - def __init__(self, left_max_len, right_max_len, hidden_dim): :param left_max_len: max length of left tensor (T1) :param right_max_len: max length of right t...
Implement the Python class `CrossAttentionLayer` described below. Class description: Implement the CrossAttentionLayer class. Method signatures and docstrings: - def __init__(self, left_max_len, right_max_len, hidden_dim): :param left_max_len: max length of left tensor (T1) :param right_max_len: max length of right t...
4bb2abc40428373481909e02543062a7388615bd
<|skeleton|> class CrossAttentionLayer: def __init__(self, left_max_len, right_max_len, hidden_dim): """:param left_max_len: max length of left tensor (T1) :param right_max_len: max length of right tensor (T2) :param hidden_dim: a number""" <|body_0|> def compute_attention(self, left_tensor, l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CrossAttentionLayer: def __init__(self, left_max_len, right_max_len, hidden_dim): """:param left_max_len: max length of left tensor (T1) :param right_max_len: max length of right tensor (T2) :param hidden_dim: a number""" self.left_max_len = left_max_len self.right_max_len = right_max_...
the_stack_v2_python_sparse
src/xusheng/model/attention.py
Zjhao666/CompQA
train
0
380553d086b7d99757d069992c809501142f8f4b
[ "result = stack.pop() if stack else 0\nwhile stack and stack[-1] != ')':\n sign = stack.pop()\n if sign == '+':\n result += stack.pop()\n else:\n result -= stack.pop()\nreturn result", "stack = []\noperand = number_count = 0\nfor idx in range(len(string) - 1, -1, -1):\n char = string[idx...
<|body_start_0|> result = stack.pop() if stack else 0 while stack and stack[-1] != ')': sign = stack.pop() if sign == '+': result += stack.pop() else: result -= stack.pop() return result <|end_body_0|> <|body_start_1|> ...
BasicCalculator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicCalculator: def evaluate(self, stack: List[Union[int, str]]) -> int: """Evaluates the stack and calculates the results respectively. :param stack: :return:""" <|body_0|> def get_result(self, string: str) -> int: """Approach: Using Stack Time Complexity: O(N) Spa...
stack_v2_sparse_classes_36k_train_018906
2,749
no_license
[ { "docstring": "Evaluates the stack and calculates the results respectively. :param stack: :return:", "name": "evaluate", "signature": "def evaluate(self, stack: List[Union[int, str]]) -> int" }, { "docstring": "Approach: Using Stack Time Complexity: O(N) Space Complexity: O(N) :param string: :r...
2
null
Implement the Python class `BasicCalculator` described below. Class description: Implement the BasicCalculator class. Method signatures and docstrings: - def evaluate(self, stack: List[Union[int, str]]) -> int: Evaluates the stack and calculates the results respectively. :param stack: :return: - def get_result(self, ...
Implement the Python class `BasicCalculator` described below. Class description: Implement the BasicCalculator class. Method signatures and docstrings: - def evaluate(self, stack: List[Union[int, str]]) -> int: Evaluates the stack and calculates the results respectively. :param stack: :return: - def get_result(self, ...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class BasicCalculator: def evaluate(self, stack: List[Union[int, str]]) -> int: """Evaluates the stack and calculates the results respectively. :param stack: :return:""" <|body_0|> def get_result(self, string: str) -> int: """Approach: Using Stack Time Complexity: O(N) Spa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicCalculator: def evaluate(self, stack: List[Union[int, str]]) -> int: """Evaluates the stack and calculates the results respectively. :param stack: :return:""" result = stack.pop() if stack else 0 while stack and stack[-1] != ')': sign = stack.pop() if sign ...
the_stack_v2_python_sparse
revisited/math_and_strings/stack/basic_calculator.py
Shiv2157k/leet_code
train
1
e125e655a8febcb816ca069eaaa3bbd2076ae4e7
[ "super(TasNet, self).__init__()\nassert sr * 4 % L == 0\nself.N = N\nself.stride = W\nself.out_channels = 1\nself.C = 4\nself.encoder = Encoder(self.N, L, W, args.filters, args.num_mels, sr)\nself.decoder = Decoder(self.N, L, W, args.filters)\nself.dropout = nn.Dropout2d(args.dropout)\nself.mask = MaskingModule(not...
<|body_start_0|> super(TasNet, self).__init__() assert sr * 4 % L == 0 self.N = N self.stride = W self.out_channels = 1 self.C = 4 self.encoder = Encoder(self.N, L, W, args.filters, args.num_mels, sr) self.decoder = Decoder(self.N, L, W, args.filters) ...
One stage of encoder->mask->decoder for a single sampling rate
TasNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TasNet: """One stage of encoder->mask->decoder for a single sampling rate""" def __init__(self, independent_params, N, L, W, B, H, sr, partial_input, args): """Arguments: independent_params {bool} -- False if you want to use the generated weights N {int} -- Dimension of the latent ma...
stack_v2_sparse_classes_36k_train_018907
37,269
no_license
[ { "docstring": "Arguments: independent_params {bool} -- False if you want to use the generated weights N {int} -- Dimension of the latent matrix L {int} -- Dimension of the latent representation W {int} -- Kernel size of the en/decoder transfomation B {int} -- Dimension of the bottleneck convolution in the mask...
3
stack_v2_sparse_classes_30k_train_017808
Implement the Python class `TasNet` described below. Class description: One stage of encoder->mask->decoder for a single sampling rate Method signatures and docstrings: - def __init__(self, independent_params, N, L, W, B, H, sr, partial_input, args): Arguments: independent_params {bool} -- False if you want to use th...
Implement the Python class `TasNet` described below. Class description: One stage of encoder->mask->decoder for a single sampling rate Method signatures and docstrings: - def __init__(self, independent_params, N, L, W, B, H, sr, partial_input, args): Arguments: independent_params {bool} -- False if you want to use th...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class TasNet: """One stage of encoder->mask->decoder for a single sampling rate""" def __init__(self, independent_params, N, L, W, B, H, sr, partial_input, args): """Arguments: independent_params {bool} -- False if you want to use the generated weights N {int} -- Dimension of the latent ma...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TasNet: """One stage of encoder->mask->decoder for a single sampling rate""" def __init__(self, independent_params, N, L, W, B, H, sr, partial_input, args): """Arguments: independent_params {bool} -- False if you want to use the generated weights N {int} -- Dimension of the latent matrix L {int} ...
the_stack_v2_python_sparse
generated/test_pfnet_research_meta_tasnet.py
jansel/pytorch-jit-paritybench
train
35
e6272ef93d4353d773bbea0a369090364c83a9b3
[ "for test_point in vectors:\n entropy_input = int(test_point['EntropyInput'], 16)\n received = sp.test_point_gen(entropy_input)\n self.assertEqual(test_point, received)", "test_point = vectors[secrets.randbelow(15)]\noffset = 8 * secrets.randbelow(32)\nwidth = secrets.randbelow(256)\nReturnedBits = int(t...
<|body_start_0|> for test_point in vectors: entropy_input = int(test_point['EntropyInput'], 16) received = sp.test_point_gen(entropy_input) self.assertEqual(test_point, received) <|end_body_0|> <|body_start_1|> test_point = vectors[secrets.randbelow(15)] offs...
TestNistOfficial
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNistOfficial: def test_compare(self): """Ensure that known seeds generate the expected results.""" <|body_0|> def test_getrandbits(self): """Test secure_random.getrandbits() using test vectors Reseed PRNG using entropy_input. Use sp.getrandbits to forward the gen...
stack_v2_sparse_classes_36k_train_018908
13,435
permissive
[ { "docstring": "Ensure that known seeds generate the expected results.", "name": "test_compare", "signature": "def test_compare(self)" }, { "docstring": "Test secure_random.getrandbits() using test vectors Reseed PRNG using entropy_input. Use sp.getrandbits to forward the generator to a randomly...
2
stack_v2_sparse_classes_30k_val_001131
Implement the Python class `TestNistOfficial` described below. Class description: Implement the TestNistOfficial class. Method signatures and docstrings: - def test_compare(self): Ensure that known seeds generate the expected results. - def test_getrandbits(self): Test secure_random.getrandbits() using test vectors R...
Implement the Python class `TestNistOfficial` described below. Class description: Implement the TestNistOfficial class. Method signatures and docstrings: - def test_compare(self): Ensure that known seeds generate the expected results. - def test_getrandbits(self): Test secure_random.getrandbits() using test vectors R...
51f6017b8425b14d5a4aa9abace8fe5a25ef08c8
<|skeleton|> class TestNistOfficial: def test_compare(self): """Ensure that known seeds generate the expected results.""" <|body_0|> def test_getrandbits(self): """Test secure_random.getrandbits() using test vectors Reseed PRNG using entropy_input. Use sp.getrandbits to forward the gen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestNistOfficial: def test_compare(self): """Ensure that known seeds generate the expected results.""" for test_point in vectors: entropy_input = int(test_point['EntropyInput'], 16) received = sp.test_point_gen(entropy_input) self.assertEqual(test_point, rec...
the_stack_v2_python_sparse
util/topgen/secure_prng_test.py
lowRISC/opentitan
train
2,077
21c0d4b91d270f66c63a82d1516db505b0292d72
[ "super().__init__(params=params)\nself.isonline = bool(isonline)\nself.devices = dict()\nself.analysis = dict()\nself.pvs = dict()", "conn = all([dev.connected for dev in self.devices.values()])\nconn &= all([pv.connected for pv in self.pvs.values()])\nreturn conn", "obs = list(self.devices.values()) + list(sel...
<|body_start_0|> super().__init__(params=params) self.isonline = bool(isonline) self.devices = dict() self.analysis = dict() self.pvs = dict() <|end_body_0|> <|body_start_1|> conn = all([dev.connected for dev in self.devices.values()]) conn &= all([pv.connected f...
.
MeasBaseClass
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeasBaseClass: """.""" def __init__(self, params=None, isonline=True): """.""" <|body_0|> def connected(self): """.""" <|body_1|> def wait_for_connection(self, timeout=None): """.""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_018909
5,325
permissive
[ { "docstring": ".", "name": "__init__", "signature": "def __init__(self, params=None, isonline=True)" }, { "docstring": ".", "name": "connected", "signature": "def connected(self)" }, { "docstring": ".", "name": "wait_for_connection", "signature": "def wait_for_connection...
3
stack_v2_sparse_classes_30k_train_017208
Implement the Python class `MeasBaseClass` described below. Class description: . Method signatures and docstrings: - def __init__(self, params=None, isonline=True): . - def connected(self): . - def wait_for_connection(self, timeout=None): .
Implement the Python class `MeasBaseClass` described below. Class description: . Method signatures and docstrings: - def __init__(self, params=None, isonline=True): . - def connected(self): . - def wait_for_connection(self, timeout=None): . <|skeleton|> class MeasBaseClass: """.""" def __init__(self, params...
39644161d98964a3a3d80d63269201f0a1712e82
<|skeleton|> class MeasBaseClass: """.""" def __init__(self, params=None, isonline=True): """.""" <|body_0|> def connected(self): """.""" <|body_1|> def wait_for_connection(self, timeout=None): """.""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MeasBaseClass: """.""" def __init__(self, params=None, isonline=True): """.""" super().__init__(params=params) self.isonline = bool(isonline) self.devices = dict() self.analysis = dict() self.pvs = dict() def connected(self): """.""" co...
the_stack_v2_python_sparse
apsuite/utils.py
lnls-fac/apsuite
train
1
627444ee897698b3f743a4f161cb2b9351e10dc1
[ "if not s:\n return 0\ntwoChars, i, j, n, maxLength, counter = (set(), 0, 0, len(s), 0, 0)\nwhile j < n:\n if len(twoChars) == 2 and s[j] not in twoChars:\n twoChars.clear()\n twoChars.add(s[i])\n twoChars.add(s[j])\n maxLength = max(maxLength, counter)\n counter = j - i\n ...
<|body_start_0|> if not s: return 0 twoChars, i, j, n, maxLength, counter = (set(), 0, 0, len(s), 0, 0) while j < n: if len(twoChars) == 2 and s[j] not in twoChars: twoChars.clear() twoChars.add(s[i]) twoChars.add(s[j]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstringTwoDistinct(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstringTwoDistinct2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not s: ...
stack_v2_sparse_classes_36k_train_018910
1,984
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstringTwoDistinct", "signature": "def lengthOfLongestSubstringTwoDistinct(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "lengthOfLongestSubstringTwoDistinct2", "signature": "def lengthOfLongestSubstri...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstringTwoDistinct(self, s): :type s: str :rtype: int - def lengthOfLongestSubstringTwoDistinct2(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstringTwoDistinct(self, s): :type s: str :rtype: int - def lengthOfLongestSubstringTwoDistinct2(self, s): :type s: str :rtype: int <|skeleton|> class Solut...
75aef2f6c42aeb51261b9450a24099957a084d51
<|skeleton|> class Solution: def lengthOfLongestSubstringTwoDistinct(self, s): """:type s: str :rtype: int""" <|body_0|> def lengthOfLongestSubstringTwoDistinct2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLongestSubstringTwoDistinct(self, s): """:type s: str :rtype: int""" if not s: return 0 twoChars, i, j, n, maxLength, counter = (set(), 0, 0, len(s), 0, 0) while j < n: if len(twoChars) == 2 and s[j] not in twoChars: ...
the_stack_v2_python_sparse
Python/0159_LongestSubstringWithAtMostTwoDistinctCharacters/lengthOfLongestSubstringTwoDistinct.py
mtmmy/Leetcode
train
3
1235dae40b6b80a7b628aef66350bc5ac64a313b
[ "n, m = (len(matrix), len(matrix[0]))\nfor i in range(1, n):\n for j in range(1, m):\n if matrix[i][j] != matrix[i - 1][j - 1]:\n return False\nreturn True", "n, m = (len(matrix), len(matrix[0]))\nfor i in range(n - 1):\n if matrix[i][:-1] != matrix[i + 1][1:]:\n return False\nretur...
<|body_start_0|> n, m = (len(matrix), len(matrix[0])) for i in range(1, n): for j in range(1, m): if matrix[i][j] != matrix[i - 1][j - 1]: return False return True <|end_body_0|> <|body_start_1|> n, m = (len(matrix), len(matrix[0])) ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool: """从第二行第二列开始遍历,依次判断 [i,j] 位置的值是否等于 [i-1,j-1]位置的值""" <|body_0|> def isToeplitzMatrix2(self, matrix: List[List[int]]) -> bool: """从第一行开始遍历,依次判断 [i:j] 位置的值是否等于 [i+1:j]位置的值 也就是利用 Python 自带的切片,判断第一行前 n...
stack_v2_sparse_classes_36k_train_018911
1,079
permissive
[ { "docstring": "从第二行第二列开始遍历,依次判断 [i,j] 位置的值是否等于 [i-1,j-1]位置的值", "name": "isToeplitzMatrix", "signature": "def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool" }, { "docstring": "从第一行开始遍历,依次判断 [i:j] 位置的值是否等于 [i+1:j]位置的值 也就是利用 Python 自带的切片,判断第一行前 n 个数字是否与下一行的后 n 个数字是否一致", "name": "isTo...
2
stack_v2_sparse_classes_30k_train_014089
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool: 从第二行第二列开始遍历,依次判断 [i,j] 位置的值是否等于 [i-1,j-1]位置的值 - def isToeplitzMatrix2(self, matrix: List[List[int]]) -> bool: 从第一行开始遍...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool: 从第二行第二列开始遍历,依次判断 [i,j] 位置的值是否等于 [i-1,j-1]位置的值 - def isToeplitzMatrix2(self, matrix: List[List[int]]) -> bool: 从第一行开始遍...
27185d382a891f4667f67701a60c796fa3a6c1ac
<|skeleton|> class Solution: def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool: """从第二行第二列开始遍历,依次判断 [i,j] 位置的值是否等于 [i-1,j-1]位置的值""" <|body_0|> def isToeplitzMatrix2(self, matrix: List[List[int]]) -> bool: """从第一行开始遍历,依次判断 [i:j] 位置的值是否等于 [i+1:j]位置的值 也就是利用 Python 自带的切片,判断第一行前 n...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isToeplitzMatrix(self, matrix: List[List[int]]) -> bool: """从第二行第二列开始遍历,依次判断 [i,j] 位置的值是否等于 [i-1,j-1]位置的值""" n, m = (len(matrix), len(matrix[0])) for i in range(1, n): for j in range(1, m): if matrix[i][j] != matrix[i - 1][j - 1]: ...
the_stack_v2_python_sparse
Leetcode/其他/766-托普利茨矩阵-e.py
JackeyGuo/Algorithms
train
1
abc4e4ef09fd4da1cc6df66a3f00982d0f022ea4
[ "if graph.is_directed():\n raise ValueError('the graph is directed')\nself.graph = graph\nfor edge in self.graph.iteredges():\n if edge.source == edge.target:\n raise ValueError('a loop detected')\nself.independent_set = set()\nself.cardinality = 0\nself.source = None", "used = dict(((node, False) fo...
<|body_start_0|> if graph.is_directed(): raise ValueError('the graph is directed') self.graph = graph for edge in self.graph.iteredges(): if edge.source == edge.target: raise ValueError('a loop detected') self.independent_set = set() self.c...
Find a maximal independent set.
UnorderedSequentialIndependentSet2
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnorderedSequentialIndependentSet2: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, source=None): """Executable pseudocode.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_018912
3,887
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, source=None)" } ]
2
stack_v2_sparse_classes_30k_train_012015
Implement the Python class `UnorderedSequentialIndependentSet2` described below. Class description: Find a maximal independent set. Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, source=None): Executable pseudocode.
Implement the Python class `UnorderedSequentialIndependentSet2` described below. Class description: Find a maximal independent set. Method signatures and docstrings: - def __init__(self, graph): The algorithm initialization. - def run(self, source=None): Executable pseudocode. <|skeleton|> class UnorderedSequentialI...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class UnorderedSequentialIndependentSet2: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" <|body_0|> def run(self, source=None): """Executable pseudocode.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UnorderedSequentialIndependentSet2: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" if graph.is_directed(): raise ValueError('the graph is directed') self.graph = graph for edge in self.graph.iteredges(): ...
the_stack_v2_python_sparse
graphtheory/independentsets/isetus.py
kgashok/graphs-dict
train
0
e7dbab7330e823a635f7d49d0565782b92884f1f
[ "def gen_next(x, y):\n yield (y, n - 1 - x)\n yield (n - 1 - x, n - 1 - y)\n yield (n - 1 - y, x)\nn = len(matrix)\nif n <= 1:\n return\nfor d in range(0, n // 2):\n for i in range(d, n - d - 1):\n tmp = matrix[d][i]\n for a, b in gen_next(d, i):\n matrix[a][b], tmp = (tmp, m...
<|body_start_0|> def gen_next(x, y): yield (y, n - 1 - x) yield (n - 1 - x, n - 1 - y) yield (n - 1 - y, x) n = len(matrix) if n <= 1: return for d in range(0, n // 2): for i in range(d, n - d - 1): tmp = matrix[...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace""" <|body_0|> def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, ...
stack_v2_sparse_classes_36k_train_018913
2,631
no_license
[ { "docstring": "Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace", "name": "rotate", "signature": "def rotate(self, matrix: List[List[int]]) -> None" }, { "docstring": "Do not return anything, modify matrix in-place instead.", "na...
2
stack_v2_sparse_classes_30k_train_016257
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace - def rotate(sel...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rotate(self, matrix: List[List[int]]) -> None: Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace - def rotate(sel...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace""" <|body_0|> def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rotate(self, matrix: List[List[int]]) -> None: """Do not return anything, modify matrix in-place instead. Time complexity: O(n^2) Space complexity: O(1) inplace""" def gen_next(x, y): yield (y, n - 1 - x) yield (n - 1 - x, n - 1 - y) yield (n -...
the_stack_v2_python_sparse
leetcode/solved/48_Rotate_Image/solution.py
sungminoh/algorithms
train
0
e25a80afb4b062a6ef54f844d859d3eebc21bd2d
[ "init_log = idaeslog.getInitLogger(self.name, outlvl, tag='properties')\nsolve_log = idaeslog.getSolveLogger(self.name, outlvl, tag='properties')\nopt = get_solver(solver, optarg)\nflags = fix_state_vars(self, state_args)\nfor k in self.keys():\n dof = degrees_of_freedom(self[k])\n if dof != 0:\n raise...
<|body_start_0|> init_log = idaeslog.getInitLogger(self.name, outlvl, tag='properties') solve_log = idaeslog.getSolveLogger(self.name, outlvl, tag='properties') opt = get_solver(solver, optarg) flags = fix_state_vars(self, state_args) for k in self.keys(): dof = degre...
_SopStateBlock
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SopStateBlock: def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=None): """Initialization routine for property package. Keyword Arguments: state_args : Dictionary with initial guesses for the state vars chosen. No...
stack_v2_sparse_classes_36k_train_018914
22,105
permissive
[ { "docstring": "Initialization routine for property package. Keyword Arguments: state_args : Dictionary with initial guesses for the state vars chosen. Note that if this method is triggered through the control volume, and if initial guesses were not provided at the unit model level, the control volume passes th...
2
stack_v2_sparse_classes_30k_train_019983
Implement the Python class `_SopStateBlock` described below. Class description: Implement the _SopStateBlock class. Method signatures and docstrings: - def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=None): Initialization routine for property...
Implement the Python class `_SopStateBlock` described below. Class description: Implement the _SopStateBlock class. Method signatures and docstrings: - def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=None): Initialization routine for property...
14dc1a8906230747ce8f3edcb88641ac587be968
<|skeleton|> class _SopStateBlock: def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=None): """Initialization routine for property package. Keyword Arguments: state_args : Dictionary with initial guesses for the state vars chosen. No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _SopStateBlock: def initialize(self, state_args=None, state_vars_fixed=False, hold_state=False, outlvl=idaeslog.NOTSET, solver=None, optarg=None): """Initialization routine for property package. Keyword Arguments: state_args : Dictionary with initial guesses for the state vars chosen. Note that if thi...
the_stack_v2_python_sparse
watertap/property_models/selective_oil_permeation_prop_pack.py
watertap-org/watertap
train
20
9693defee08a77e9ee2e94b800a3b62433a78c2e
[ "super(TwolayerNet, self).__init__()\nself.linear1 = torch.nn.Linear(D_in, H)\nself.relu = torch.nn.ReLU()\nself.linear2 = torch.nn.Linear(H, D_out)", "h_relu = self.linear1(x).clamp(min=0)\ny_pred = self.linear2(h_relu)\nreturn y_pred" ]
<|body_start_0|> super(TwolayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.relu = torch.nn.ReLU() self.linear2 = torch.nn.Linear(H, D_out) <|end_body_0|> <|body_start_1|> h_relu = self.linear1(x).clamp(min=0) y_pred = self.linear2(h_relu) r...
TwolayerNet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwolayerNet: def __init__(self, D_in, H, D_out): """we assign the follwoing paramenters: :param D_in: :param H: :param D_out:""" <|body_0|> def forward(self, x): """in the forward function we accept a Tensor of input datand we must return a tensor of output data. We ...
stack_v2_sparse_classes_36k_train_018915
1,879
no_license
[ { "docstring": "we assign the follwoing paramenters: :param D_in: :param H: :param D_out:", "name": "__init__", "signature": "def __init__(self, D_in, H, D_out)" }, { "docstring": "in the forward function we accept a Tensor of input datand we must return a tensor of output data. We can use Modul...
2
stack_v2_sparse_classes_30k_train_021065
Implement the Python class `TwolayerNet` described below. Class description: Implement the TwolayerNet class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): we assign the follwoing paramenters: :param D_in: :param H: :param D_out: - def forward(self, x): in the forward function we accept a Te...
Implement the Python class `TwolayerNet` described below. Class description: Implement the TwolayerNet class. Method signatures and docstrings: - def __init__(self, D_in, H, D_out): we assign the follwoing paramenters: :param D_in: :param H: :param D_out: - def forward(self, x): in the forward function we accept a Te...
1e19b21ecfc05218f6201da88854231300378905
<|skeleton|> class TwolayerNet: def __init__(self, D_in, H, D_out): """we assign the follwoing paramenters: :param D_in: :param H: :param D_out:""" <|body_0|> def forward(self, x): """in the forward function we accept a Tensor of input datand we must return a tensor of output data. We ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TwolayerNet: def __init__(self, D_in, H, D_out): """we assign the follwoing paramenters: :param D_in: :param H: :param D_out:""" super(TwolayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.relu = torch.nn.ReLU() self.linear2 = torch.nn.Linear(H, D_o...
the_stack_v2_python_sparse
neural_network/pytorch_custom_learning.py
Bannerli/Machine_Learning_Algorithms
train
0
c65202139a2349f4634690195a93f3f433673a1d
[ "import_info.pop(CONF_MONITORED_CONDITIONS, None)\nimport_info.pop(CONF_NICS, None)\nimport_info.pop(CONF_DRIVES, None)\nimport_info.pop(CONF_VOLUMES, None)\nreturn await self.async_step_user(import_info)", "errors = {}\nif user_input is not None:\n host = user_input[CONF_HOST]\n protocol = 'https' if user_...
<|body_start_0|> import_info.pop(CONF_MONITORED_CONDITIONS, None) import_info.pop(CONF_NICS, None) import_info.pop(CONF_DRIVES, None) import_info.pop(CONF_VOLUMES, None) return await self.async_step_user(import_info) <|end_body_0|> <|body_start_1|> errors = {} if...
Qnap configuration flow.
QnapConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QnapConfigFlow: """Qnap configuration flow.""" async def async_step_import(self, import_info: dict[str, Any]) -> FlowResult: """Set the config entry up from yaml.""" <|body_0|> async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: ...
stack_v2_sparse_classes_36k_train_018916
3,220
permissive
[ { "docstring": "Set the config entry up from yaml.", "name": "async_step_import", "signature": "async def async_step_import(self, import_info: dict[str, Any]) -> FlowResult" }, { "docstring": "Handle a flow initialized by the user.", "name": "async_step_user", "signature": "async def asy...
2
stack_v2_sparse_classes_30k_train_018440
Implement the Python class `QnapConfigFlow` described below. Class description: Qnap configuration flow. Method signatures and docstrings: - async def async_step_import(self, import_info: dict[str, Any]) -> FlowResult: Set the config entry up from yaml. - async def async_step_user(self, user_input: dict[str, Any] | N...
Implement the Python class `QnapConfigFlow` described below. Class description: Qnap configuration flow. Method signatures and docstrings: - async def async_step_import(self, import_info: dict[str, Any]) -> FlowResult: Set the config entry up from yaml. - async def async_step_user(self, user_input: dict[str, Any] | N...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class QnapConfigFlow: """Qnap configuration flow.""" async def async_step_import(self, import_info: dict[str, Any]) -> FlowResult: """Set the config entry up from yaml.""" <|body_0|> async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QnapConfigFlow: """Qnap configuration flow.""" async def async_step_import(self, import_info: dict[str, Any]) -> FlowResult: """Set the config entry up from yaml.""" import_info.pop(CONF_MONITORED_CONDITIONS, None) import_info.pop(CONF_NICS, None) import_info.pop(CONF_DRIV...
the_stack_v2_python_sparse
homeassistant/components/qnap/config_flow.py
home-assistant/core
train
35,501
81c5025444b4700a88f39b9173f6bd13bf73fd75
[ "import heapq\nself._min_heap = []\nself._max_heap = []", "if not self._min_heap or num < self._min_heap[0]:\n heapq.heappush(self._max_heap, -num)\nelse:\n heapq.heappush(self._min_heap, num)\nwhile len(self._min_heap) > len(self._max_heap) + 1:\n heapq.heappush(self._max_heap, -heapq.heappop(self._min_...
<|body_start_0|> import heapq self._min_heap = [] self._max_heap = [] <|end_body_0|> <|body_start_1|> if not self._min_heap or num < self._min_heap[0]: heapq.heappush(self._max_heap, -num) else: heapq.heappush(self._min_heap, num) while len(self._...
MedianFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_018917
1,209
no_license
[ { "docstring": "initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type num: int :rtype: void", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": ":rtype: float", "name": "findMedian", "s...
3
stack_v2_sparse_classes_30k_train_004325
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): initialize your data structure here. - def addNum(self, num): :type num: int :rtype: void - def findMedian(self): :rtype: float <|skeleton|> class Me...
33b6b68a8136109d2aaa26bb8bf9e873f995d5ab
<|skeleton|> class MedianFinder: def __init__(self): """initialize your data structure here.""" <|body_0|> def addNum(self, num): """:type num: int :rtype: void""" <|body_1|> def findMedian(self): """:rtype: float""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MedianFinder: def __init__(self): """initialize your data structure here.""" import heapq self._min_heap = [] self._max_heap = [] def addNum(self, num): """:type num: int :rtype: void""" if not self._min_heap or num < self._min_heap[0]: heapq.he...
the_stack_v2_python_sparse
python2/l0295_find_median_from_data_stream.py
sprax/1337
train
0
8b208bf3a284d5782f2906755dfdca28b6e155a3
[ "domain = kwargs.pop('domain', None)\nsuper(RayBackProjection, self).__init__(reco_space=range, proj_space=domain, geometry=geometry, variant='backward', **kwargs)\nif self.impl.startswith('astra'):\n backend, data_impl = self.impl.split('_')\n if data_impl == 'cuda':\n if self._astra_wrapper is None:\...
<|body_start_0|> domain = kwargs.pop('domain', None) super(RayBackProjection, self).__init__(reco_space=range, proj_space=domain, geometry=geometry, variant='backward', **kwargs) if self.impl.startswith('astra'): backend, data_impl = self.impl.split('_') if data_impl == '...
Adjoint of the discrete Ray transform between L^p spaces.
RayBackProjection
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RayBackProjection: """Adjoint of the discrete Ray transform between L^p spaces.""" def __init__(self, range, geometry, **kwargs): """Initialize a new instance. Parameters ---------- range : `DiscreteLp` Discretized reconstruction space, the range of the backprojection operator. geome...
stack_v2_sparse_classes_36k_train_018918
23,312
permissive
[ { "docstring": "Initialize a new instance. Parameters ---------- range : `DiscreteLp` Discretized reconstruction space, the range of the backprojection operator. geometry : `Geometry` Geometry of the transform, containing information about the operator domain (projection/sinogram space). Other Parameters ------...
3
stack_v2_sparse_classes_30k_train_004561
Implement the Python class `RayBackProjection` described below. Class description: Adjoint of the discrete Ray transform between L^p spaces. Method signatures and docstrings: - def __init__(self, range, geometry, **kwargs): Initialize a new instance. Parameters ---------- range : `DiscreteLp` Discretized reconstructi...
Implement the Python class `RayBackProjection` described below. Class description: Adjoint of the discrete Ray transform between L^p spaces. Method signatures and docstrings: - def __init__(self, range, geometry, **kwargs): Initialize a new instance. Parameters ---------- range : `DiscreteLp` Discretized reconstructi...
cb9f08f105285a56337fa21f275aa3a15fcd74ab
<|skeleton|> class RayBackProjection: """Adjoint of the discrete Ray transform between L^p spaces.""" def __init__(self, range, geometry, **kwargs): """Initialize a new instance. Parameters ---------- range : `DiscreteLp` Discretized reconstruction space, the range of the backprojection operator. geome...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RayBackProjection: """Adjoint of the discrete Ray transform between L^p spaces.""" def __init__(self, range, geometry, **kwargs): """Initialize a new instance. Parameters ---------- range : `DiscreteLp` Discretized reconstruction space, the range of the backprojection operator. geometry : `Geomet...
the_stack_v2_python_sparse
fastatomography/tomo/operators/ray_trafo.py
PhilippPelz/fasta-tomography
train
2
48cd774e133b620203e7c99677bdeb5ceac7cddf
[ "from nestedworld_api.db import MonsterAttack as DbMonsterAttack\nattacks = DbMonsterAttack.query.filter(DbMonsterAttack.monster_id == monster_id)\nreturn attacks", "from nestedworld_api.db import db\nfrom nestedworld_api.db import MonsterAttack\nchoosedAttack = Attack.query.filter(Attack.name == data['attack'])....
<|body_start_0|> from nestedworld_api.db import MonsterAttack as DbMonsterAttack attacks = DbMonsterAttack.query.filter(DbMonsterAttack.monster_id == monster_id) return attacks <|end_body_0|> <|body_start_1|> from nestedworld_api.db import db from nestedworld_api.db import Monst...
MonsterAttacks
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MonsterAttacks: def get(self, monster_id): """Retrieve a monster's attacks This request is used for retrieve the attacks of a specific monster.""" <|body_0|> def post(self, monster_id, data): """Add an attack to a monster This request is used for link an existing att...
stack_v2_sparse_classes_36k_train_018919
3,837
no_license
[ { "docstring": "Retrieve a monster's attacks This request is used for retrieve the attacks of a specific monster.", "name": "get", "signature": "def get(self, monster_id)" }, { "docstring": "Add an attack to a monster This request is used for link an existing attack to an existing monster (Only ...
2
stack_v2_sparse_classes_30k_train_005388
Implement the Python class `MonsterAttacks` described below. Class description: Implement the MonsterAttacks class. Method signatures and docstrings: - def get(self, monster_id): Retrieve a monster's attacks This request is used for retrieve the attacks of a specific monster. - def post(self, monster_id, data): Add a...
Implement the Python class `MonsterAttacks` described below. Class description: Implement the MonsterAttacks class. Method signatures and docstrings: - def get(self, monster_id): Retrieve a monster's attacks This request is used for retrieve the attacks of a specific monster. - def post(self, monster_id, data): Add a...
af2262742b04c823d2cf6e0fa40fa0fc6456671e
<|skeleton|> class MonsterAttacks: def get(self, monster_id): """Retrieve a monster's attacks This request is used for retrieve the attacks of a specific monster.""" <|body_0|> def post(self, monster_id, data): """Add an attack to a monster This request is used for link an existing att...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MonsterAttacks: def get(self, monster_id): """Retrieve a monster's attacks This request is used for retrieve the attacks of a specific monster.""" from nestedworld_api.db import MonsterAttack as DbMonsterAttack attacks = DbMonsterAttack.query.filter(DbMonsterAttack.monster_id == monste...
the_stack_v2_python_sparse
nestedworld_api/views/api/v1/monster/attacks.py
NestedWorld/NestedWorld-Server-API
train
1
0fb7eda85772ee271125c7618f462b5c42ba46cc
[ "try:\n if not isinstance(tag_id, int) and tag_id < 0:\n raise ValueError('Invalid Tag ID or TagID must me an integer value')\n if algorithm is None:\n raise ValueError('Algorithm must be specified')\n self.tag_id = tag_id\n self.algorithm = algorithm\n self.instance = None\n if algo...
<|body_start_0|> try: if not isinstance(tag_id, int) and tag_id < 0: raise ValueError('Invalid Tag ID or TagID must me an integer value') if algorithm is None: raise ValueError('Algorithm must be specified') self.tag_id = tag_id sel...
This class represents a Mobile Position Tag device mounted on the personnel
Tag
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tag: """This class represents a Mobile Position Tag device mounted on the personnel""" def __init__(self, tag_id, algorithm, filename): """Initializes Tag Args: tag_id (integer): Unique Tag ID algorithm (string): The Algorithm used by Tag for processing the positioning data""" ...
stack_v2_sparse_classes_36k_train_018920
6,057
no_license
[ { "docstring": "Initializes Tag Args: tag_id (integer): Unique Tag ID algorithm (string): The Algorithm used by Tag for processing the positioning data", "name": "__init__", "signature": "def __init__(self, tag_id, algorithm, filename)" }, { "docstring": "Runs the instance of Algorithm correspon...
2
stack_v2_sparse_classes_30k_train_003327
Implement the Python class `Tag` described below. Class description: This class represents a Mobile Position Tag device mounted on the personnel Method signatures and docstrings: - def __init__(self, tag_id, algorithm, filename): Initializes Tag Args: tag_id (integer): Unique Tag ID algorithm (string): The Algorithm ...
Implement the Python class `Tag` described below. Class description: This class represents a Mobile Position Tag device mounted on the personnel Method signatures and docstrings: - def __init__(self, tag_id, algorithm, filename): Initializes Tag Args: tag_id (integer): Unique Tag ID algorithm (string): The Algorithm ...
9fdb25e37002ce27b39539bead6beb527342f3dc
<|skeleton|> class Tag: """This class represents a Mobile Position Tag device mounted on the personnel""" def __init__(self, tag_id, algorithm, filename): """Initializes Tag Args: tag_id (integer): Unique Tag ID algorithm (string): The Algorithm used by Tag for processing the positioning data""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tag: """This class represents a Mobile Position Tag device mounted on the personnel""" def __init__(self, tag_id, algorithm, filename): """Initializes Tag Args: tag_id (integer): Unique Tag ID algorithm (string): The Algorithm used by Tag for processing the positioning data""" try: ...
the_stack_v2_python_sparse
hrc/personnel/tracking/position_node.py
eternalamit5/Indoor-Localisation
train
0
518d200dd4b365b580f2bcede4de1b2e8d0f185b
[ "if not head or n < 1:\n return head\ncurr = head\nwhile curr:\n curr = curr.next\n n -= 1\nif n == 0:\n head = head.next\nif n < 0:\n curr = head\n n += 1\n while n < 0:\n curr = curr.next\n n += 1\n curr.next = curr.next.next\nreturn head", "if not head or n < 1:\n retur...
<|body_start_0|> if not head or n < 1: return head curr = head while curr: curr = curr.next n -= 1 if n == 0: head = head.next if n < 0: curr = head n += 1 while n < 0: curr = curr...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEnd2(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_018921
1,526
no_license
[ { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "removeNthFromEnd", "signature": "def removeNthFromEnd(self, head, n)" }, { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "removeNthFromEnd2", "signature": "def removeNthFromEnd2(sel...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEnd2(self, head, n): :type head: ListNode :type n: int :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEnd2(self, head, n): :type head: ListNode :type n: int :rtype: ListNode...
604efd2c53c369fb262f42f7f7f31997ea4d029b
<|skeleton|> class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEnd2(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" if not head or n < 1: return head curr = head while curr: curr = curr.next n -= 1 if n == 0: head = head.next ...
the_stack_v2_python_sparse
DeleteNode.py
fxy1018/Leetcode
train
1
1e7e14a8a86e56975286eb59d19ff9ea6f6b1e7f
[ "self.x_max = x_max\nself.x_min = x_min or 0\nresolution = resolution or 1000\nif self.x_max <= self.x_min:\n raise ValueError('x_max : {} must be larger than x_min : {}'.format(self.x_max, self.x_min))\nself.x_vector = np.linspace(self.x_min, self.x_max, num=resolution)\nself.y_vector_top = self.construct_y_vec...
<|body_start_0|> self.x_max = x_max self.x_min = x_min or 0 resolution = resolution or 1000 if self.x_max <= self.x_min: raise ValueError('x_max : {} must be larger than x_min : {}'.format(self.x_max, self.x_min)) self.x_vector = np.linspace(self.x_min, self.x_max, nu...
Define a geometric domain using upper and lower y arrays. Geometry must be symmetric about the y-axis.
Geometry
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Geometry: """Define a geometric domain using upper and lower y arrays. Geometry must be symmetric about the y-axis.""" def __init__(self, x_max, x_min=None, resolution=1000, bounds_top=None, funcs_top=None, bounds_bottom=None, funcs_bottom=None): """Instantiate Geometry class. :param...
stack_v2_sparse_classes_36k_train_018922
7,819
permissive
[ { "docstring": "Instantiate Geometry class. :param <int> x_max: Maximum x-value [meters] :param <int> x_min: Minimum x-value [meters] :param <int> resolution: Size of the x-array :param <list> bounds_top: y upper domain bounds :param <list> funcs_top: y upper domain functions :param <list> bounds_bottom: y lowe...
3
stack_v2_sparse_classes_30k_train_014570
Implement the Python class `Geometry` described below. Class description: Define a geometric domain using upper and lower y arrays. Geometry must be symmetric about the y-axis. Method signatures and docstrings: - def __init__(self, x_max, x_min=None, resolution=1000, bounds_top=None, funcs_top=None, bounds_bottom=Non...
Implement the Python class `Geometry` described below. Class description: Define a geometric domain using upper and lower y arrays. Geometry must be symmetric about the y-axis. Method signatures and docstrings: - def __init__(self, x_max, x_min=None, resolution=1000, bounds_top=None, funcs_top=None, bounds_bottom=Non...
51ac84926d691ec80a46e877302ccbe47281f8f4
<|skeleton|> class Geometry: """Define a geometric domain using upper and lower y arrays. Geometry must be symmetric about the y-axis.""" def __init__(self, x_max, x_min=None, resolution=1000, bounds_top=None, funcs_top=None, bounds_bottom=None, funcs_bottom=None): """Instantiate Geometry class. :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Geometry: """Define a geometric domain using upper and lower y arrays. Geometry must be symmetric about the y-axis.""" def __init__(self, x_max, x_min=None, resolution=1000, bounds_top=None, funcs_top=None, bounds_bottom=None, funcs_bottom=None): """Instantiate Geometry class. :param <int> x_max:...
the_stack_v2_python_sparse
geometry.py
pinebai/apsCFD
train
0
c76bdeb34099414b91b0d717b82c3ec2f2ccfbbc
[ "Component.__init__(self)\nself.name = 'Compressor_default_name'\nself.bus_h2_in = None\nself.bus_h2_out = None\nself.bus_el = None\nself.m_flow_max = 33.6\nself.life_time = 20\nself.temp_in = 293.15\nself.efficiency = 0.88829\nself.set_parameters(params)\nself.spec_compression_energy = None\nself.R = 8.314\nself.M...
<|body_start_0|> Component.__init__(self) self.name = 'Compressor_default_name' self.bus_h2_in = None self.bus_h2_out = None self.bus_el = None self.m_flow_max = 33.6 self.life_time = 20 self.temp_in = 293.15 self.efficiency = 0.88829 self....
:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: higher pressure hydrogen bus that is the...
CompressorH2
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompressorH2: """:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: ...
stack_v2_sparse_classes_36k_train_018923
10,964
permissive
[ { "docstring": "Constructor method", "name": "__init__", "signature": "def __init__(self, params)" }, { "docstring": "Creates an oemof Transformer component using the information given in the CompressorH2 class, to be used in the oemof model :param busses: virtual buses used in the energy system...
4
stack_v2_sparse_classes_30k_train_007495
Implement the Python class `CompressorH2` described below. Class description: :param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compresso...
Implement the Python class `CompressorH2` described below. Class description: :param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compresso...
0d4d55d587c18d9e05258f85c1bb41c0b5fdaee7
<|skeleton|> class CompressorH2: """:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompressorH2: """:param name: unique name given to the compressor component :type name: str :param bus_h2_in: lower pressure hydrogen bus that is an input of the compressor :type bus_h2_in: str :param bus_el: electricity bus that is an input of the compressor :type bus_el: str :param bus_h2_out: higher pressu...
the_stack_v2_python_sparse
smooth/components/component_compressor_h2.py
rl-institut/smooth
train
7
cc15e2111cd96a422debe0d6bf491ae7cdd6723a
[ "self.actor_id = kwargs.get('actor_id')\nself.level_id = kwargs.get('level_id')\nself.passed = kwargs.get('passed')\nself.star1 = kwargs.get('star1')\nself.star2 = kwargs.get('star2')\nself.star3 = kwargs.get('star3')", "self.actor_id = kwargs['actor_id']\nself.level_id = kwargs['level_id']\nself.passed = kwargs[...
<|body_start_0|> self.actor_id = kwargs.get('actor_id') self.level_id = kwargs.get('level_id') self.passed = kwargs.get('passed') self.star1 = kwargs.get('star1') self.star2 = kwargs.get('star2') self.star3 = kwargs.get('star3') <|end_body_0|> <|body_start_1|> se...
ActorLevelInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ActorLevelInfo: def __init__(self, **kwargs): """Params: actor_id: int level_id: int passed: bool star1: bool star2: bool star3: bool""" <|body_0|> def load(self, **kwargs): """load from dict Exception: KeyError""" <|body_1|> def dump(self): """d...
stack_v2_sparse_classes_36k_train_018924
26,590
no_license
[ { "docstring": "Params: actor_id: int level_id: int passed: bool star1: bool star2: bool star3: bool", "name": "__init__", "signature": "def __init__(self, **kwargs)" }, { "docstring": "load from dict Exception: KeyError", "name": "load", "signature": "def load(self, **kwargs)" }, { ...
3
stack_v2_sparse_classes_30k_train_016166
Implement the Python class `ActorLevelInfo` described below. Class description: Implement the ActorLevelInfo class. Method signatures and docstrings: - def __init__(self, **kwargs): Params: actor_id: int level_id: int passed: bool star1: bool star2: bool star3: bool - def load(self, **kwargs): load from dict Exceptio...
Implement the Python class `ActorLevelInfo` described below. Class description: Implement the ActorLevelInfo class. Method signatures and docstrings: - def __init__(self, **kwargs): Params: actor_id: int level_id: int passed: bool star1: bool star2: bool star3: bool - def load(self, **kwargs): load from dict Exceptio...
aa0b2697e295889e8c23a7104889ea95f2a4b6b1
<|skeleton|> class ActorLevelInfo: def __init__(self, **kwargs): """Params: actor_id: int level_id: int passed: bool star1: bool star2: bool star3: bool""" <|body_0|> def load(self, **kwargs): """load from dict Exception: KeyError""" <|body_1|> def dump(self): """d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ActorLevelInfo: def __init__(self, **kwargs): """Params: actor_id: int level_id: int passed: bool star1: bool star2: bool star3: bool""" self.actor_id = kwargs.get('actor_id') self.level_id = kwargs.get('level_id') self.passed = kwargs.get('passed') self.star1 = kwargs....
the_stack_v2_python_sparse
message.py
songhui17/Server
train
0
012a9e48178ac782a4ae9a22d33e445d3f5af820
[ "if n_packets:\n self.n_packets = n_packets\n self.footer = bytearray((n_packets + 1) * self.n_bytes)\n self.footer[-self.n_bytes:] = struct.pack('I', self.n_packets)\nelif view:\n self.n_packets = struct.unpack('I', view[-self.n_bytes:])[0]\n self.footer = view[-(self.n_packets + 1) * self.n_bytes:]...
<|body_start_0|> if n_packets: self.n_packets = n_packets self.footer = bytearray((n_packets + 1) * self.n_bytes) self.footer[-self.n_bytes:] = struct.pack('I', self.n_packets) elif view: self.n_packets = struct.unpack('I', view[-self.n_bytes:])[0] ...
PacketFooter
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PacketFooter: def __init__(self, n_packets=0, view=None): """Creates footer for packets footer format = | size of packet 0 | size of packet 1 | ... size of packet N | n_packets Each footer element has n_bytes. If n_packets is given, creates an empty footer with n_packets . If footer is g...
stack_v2_sparse_classes_36k_train_018925
2,153
permissive
[ { "docstring": "Creates footer for packets footer format = | size of packet 0 | size of packet 1 | ... size of packet N | n_packets Each footer element has n_bytes. If n_packets is given, creates an empty footer with n_packets . If footer is given, sets footer that's available for packet size access.", "nam...
5
null
Implement the Python class `PacketFooter` described below. Class description: Implement the PacketFooter class. Method signatures and docstrings: - def __init__(self, n_packets=0, view=None): Creates footer for packets footer format = | size of packet 0 | size of packet 1 | ... size of packet N | n_packets Each foote...
Implement the Python class `PacketFooter` described below. Class description: Implement the PacketFooter class. Method signatures and docstrings: - def __init__(self, n_packets=0, view=None): Creates footer for packets footer format = | size of packet 0 | size of packet 1 | ... size of packet N | n_packets Each foote...
7f0401960ceb46551fd926d932c59e96297df6b0
<|skeleton|> class PacketFooter: def __init__(self, n_packets=0, view=None): """Creates footer for packets footer format = | size of packet 0 | size of packet 1 | ... size of packet N | n_packets Each footer element has n_bytes. If n_packets is given, creates an empty footer with n_packets . If footer is g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PacketFooter: def __init__(self, n_packets=0, view=None): """Creates footer for packets footer format = | size of packet 0 | size of packet 1 | ... size of packet N | n_packets Each footer element has n_bytes. If n_packets is given, creates an empty footer with n_packets . If footer is given, sets foo...
the_stack_v2_python_sparse
psana/psana/psexp/packet_footer.py
slac-lcls/lcls2
train
19
a317a7fbc38595d9aa056a169e01826692cafc3e
[ "self.mMapComponent2Object = {}\nself.mMapObject2Component = {}\nfor line in infile:\n if line[0] == '#':\n continue\n data = line[:-1].split('\\t')\n obj_id, obj_start, obj_end, ncoms, com_type, com_id = data[:6]\n if com_type == 'N':\n continue\n com_start, com_end, orientation = data...
<|body_start_0|> self.mMapComponent2Object = {} self.mMapObject2Component = {} for line in infile: if line[0] == '#': continue data = line[:-1].split('\t') obj_id, obj_start, obj_end, ncoms, com_type, com_id = data[:6] if com_type =...
Parser for AGP formatted files.
AGP
[ "BSD-2-Clause", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AGP: """Parser for AGP formatted files.""" def readFromFile(self, infile): """read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/closed notation. In AGP nomenclature (http://www.ncbi.nlm.nih....
stack_v2_sparse_classes_36k_train_018926
2,378
permissive
[ { "docstring": "read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/closed notation. In AGP nomenclature (http://www.ncbi.nlm.nih.gov/genome/guide/Assembly/AGP_Specification.html) objects (obj) like scaffolds are assembl...
2
stack_v2_sparse_classes_30k_train_007321
Implement the Python class `AGP` described below. Class description: Parser for AGP formatted files. Method signatures and docstrings: - def readFromFile(self, infile): read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/close...
Implement the Python class `AGP` described below. Class description: Parser for AGP formatted files. Method signatures and docstrings: - def readFromFile(self, infile): read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/close...
1ec3733ca0b9bb6ee2931201fc0c329b9e079564
<|skeleton|> class AGP: """Parser for AGP formatted files.""" def readFromFile(self, infile): """read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/closed notation. In AGP nomenclature (http://www.ncbi.nlm.nih....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AGP: """Parser for AGP formatted files.""" def readFromFile(self, infile): """read an agp file. Example line:: scaffold_1 1 1199 1 W contig_13 1 1199 + This method converts coordinates to zero-based coordinates using open/closed notation. In AGP nomenclature (http://www.ncbi.nlm.nih.gov/genome/gu...
the_stack_v2_python_sparse
cgat/AGP.py
cgat-developers/cgat-apps
train
31
e50d4668751b33b8d5505a300d5236347070edc0
[ "if arg in cls.types_dict:\n raise RuntimeError('%s already registered' % arg)\n\nclass _Wrapper(arg):\n 'Wrapper for builtin %s\\n%s' % (arg, cls.__doc__)\n_Wrapper.__name__ = '_%sWrapper' % arg.__name__\ncls.types_dict[arg] = _Wrapper", "for k, v in cls.types_dict.iteritems():\n what = Any.serialmap.ge...
<|body_start_0|> if arg in cls.types_dict: raise RuntimeError('%s already registered' % arg) class _Wrapper(arg): 'Wrapper for builtin %s\n%s' % (arg, cls.__doc__) _Wrapper.__name__ = '_%sWrapper' % arg.__name__ cls.types_dict[arg] = _Wrapper <|end_body_0|> <|bo...
Get a python object that wraps data and typecode. Used by <any> parse routine, so that typecode information discovered during parsing is retained in the pyobj representation and thus can be serialized.
_GetPyobjWrapper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _GetPyobjWrapper: """Get a python object that wraps data and typecode. Used by <any> parse routine, so that typecode information discovered during parsing is retained in the pyobj representation and thus can be serialized.""" def RegisterBuiltin(cls, arg): """register a builtin, crea...
stack_v2_sparse_classes_36k_train_018927
14,557
permissive
[ { "docstring": "register a builtin, create a new wrapper.", "name": "RegisterBuiltin", "signature": "def RegisterBuiltin(cls, arg)" }, { "docstring": "If find registered TypeCode instance, add Wrapper class to TypeCode class serialmap and Re-RegisterType. Provides Any serialzation of any instanc...
3
stack_v2_sparse_classes_30k_train_021126
Implement the Python class `_GetPyobjWrapper` described below. Class description: Get a python object that wraps data and typecode. Used by <any> parse routine, so that typecode information discovered during parsing is retained in the pyobj representation and thus can be serialized. Method signatures and docstrings: ...
Implement the Python class `_GetPyobjWrapper` described below. Class description: Get a python object that wraps data and typecode. Used by <any> parse routine, so that typecode information discovered during parsing is retained in the pyobj representation and thus can be serialized. Method signatures and docstrings: ...
9b890e6a25471037b7485e4999b480de7c86b656
<|skeleton|> class _GetPyobjWrapper: """Get a python object that wraps data and typecode. Used by <any> parse routine, so that typecode information discovered during parsing is retained in the pyobj representation and thus can be serialized.""" def RegisterBuiltin(cls, arg): """register a builtin, crea...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _GetPyobjWrapper: """Get a python object that wraps data and typecode. Used by <any> parse routine, so that typecode information discovered during parsing is retained in the pyobj representation and thus can be serialized.""" def RegisterBuiltin(cls, arg): """register a builtin, create a new wrap...
the_stack_v2_python_sparse
Libraries/DUTs/Community/di_vsphere/pysphere/pysphere/ZSI/schema.py
Spirent/iTest-assets
train
10
80b2c664bf95039f3f1c8abb460ba7dc04c81b88
[ "self.flip_coin_vflip = ops.CoinFlip(probability=p)\nself.image_vflip = ops.Flip(device='gpu', horizontal=0)\nself.bbox_vflip = ops.BbFlip(device='cpu', horizontal=0)\nself.ldmrks_vflip = ops.CoordFlip(layout='xy', device='cpu', flip_x=0)", "data = EasyDict(data)\nvflip_coin = self.flip_coin_vflip()\ndata.images ...
<|body_start_0|> self.flip_coin_vflip = ops.CoinFlip(probability=p) self.image_vflip = ops.Flip(device='gpu', horizontal=0) self.bbox_vflip = ops.BbFlip(device='cpu', horizontal=0) self.ldmrks_vflip = ops.CoordFlip(layout='xy', device='cpu', flip_x=0) <|end_body_0|> <|body_start_1|> ...
Flip image in vertical axis. Supports coordinates sensitive labels
VerticalFlip
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VerticalFlip: """Flip image in vertical axis. Supports coordinates sensitive labels""" def __init__(self, p: float=0.5): """Initialization Args: p (float, optional): Probability to apply this transformation. Defaults to 0.5.""" <|body_0|> def __call__(self, **data): ...
stack_v2_sparse_classes_36k_train_018928
22,608
no_license
[ { "docstring": "Initialization Args: p (float, optional): Probability to apply this transformation. Defaults to 0.5.", "name": "__init__", "signature": "def __init__(self, p: float=0.5)" }, { "docstring": "This function will receive keyword args which will be processed as a dict. Inside the dict...
2
stack_v2_sparse_classes_30k_train_009905
Implement the Python class `VerticalFlip` described below. Class description: Flip image in vertical axis. Supports coordinates sensitive labels Method signatures and docstrings: - def __init__(self, p: float=0.5): Initialization Args: p (float, optional): Probability to apply this transformation. Defaults to 0.5. - ...
Implement the Python class `VerticalFlip` described below. Class description: Flip image in vertical axis. Supports coordinates sensitive labels Method signatures and docstrings: - def __init__(self, p: float=0.5): Initialization Args: p (float, optional): Probability to apply this transformation. Defaults to 0.5. - ...
1532db8447d03e75d5ec26f93111270a4ccb7a7e
<|skeleton|> class VerticalFlip: """Flip image in vertical axis. Supports coordinates sensitive labels""" def __init__(self, p: float=0.5): """Initialization Args: p (float, optional): Probability to apply this transformation. Defaults to 0.5.""" <|body_0|> def __call__(self, **data): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VerticalFlip: """Flip image in vertical axis. Supports coordinates sensitive labels""" def __init__(self, p: float=0.5): """Initialization Args: p (float, optional): Probability to apply this transformation. Defaults to 0.5.""" self.flip_coin_vflip = ops.CoinFlip(probability=p) se...
the_stack_v2_python_sparse
src/development/vortex/development/utils/data/augment/modules/nvidia_dali/modules.py
jesslynsepthiaa/vortex
train
0
26f2162ea2709a5275a8780d7415161efc420589
[ "super(GRRHuntArtifactCollector, self).__init__(state, name=name, critical=critical)\nself.artifacts = []\nself.use_raw_filesystem_access = False\nself.hunt = None\nself.max_file_size = 5 * 1024 * 1024 * 1024", "self.GrrSetUp(reason, grr_server_url, grr_username, grr_password, approvers=approvers, verify=verify, ...
<|body_start_0|> super(GRRHuntArtifactCollector, self).__init__(state, name=name, critical=critical) self.artifacts = [] self.use_raw_filesystem_access = False self.hunt = None self.max_file_size = 5 * 1024 * 1024 * 1024 <|end_body_0|> <|body_start_1|> self.GrrSetUp(reas...
Artifact collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. artifacts (str): comma-separated list of GRR-defined artifacts. use_raw_filesystem_access (bool): True if GRR should use raw disk access to collect file system artifacts.
GRRHuntArtifactCollector
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GRRHuntArtifactCollector: """Artifact collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. artifacts (str): comma-separated list of GRR-defined artifacts. use_raw_filesystem_access (bool): True if GRR should use...
stack_v2_sparse_classes_36k_train_018929
27,645
permissive
[ { "docstring": "Initializes a GRR artifact collector hunt. Args: state (DFTimewolfState): recipe state. name (Optional[str]): The module's runtime name. critical (bool): True if the module is critical, which causes the entire recipe to fail if the module encounters an error.", "name": "__init__", "signa...
3
null
Implement the Python class `GRRHuntArtifactCollector` described below. Class description: Artifact collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. artifacts (str): comma-separated list of GRR-defined artifacts. use_raw_filesyste...
Implement the Python class `GRRHuntArtifactCollector` described below. Class description: Artifact collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. artifacts (str): comma-separated list of GRR-defined artifacts. use_raw_filesyste...
bcea85b1ce7a0feb2aa28b5be4fc6ae124e8ca3c
<|skeleton|> class GRRHuntArtifactCollector: """Artifact collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. artifacts (str): comma-separated list of GRR-defined artifacts. use_raw_filesystem_access (bool): True if GRR should use...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GRRHuntArtifactCollector: """Artifact collector for GRR hunts. Attributes: reason (str): justification for GRR access. approvers (str): comma-separated GRR approval recipients. artifacts (str): comma-separated list of GRR-defined artifacts. use_raw_filesystem_access (bool): True if GRR should use raw disk acc...
the_stack_v2_python_sparse
dftimewolf/lib/collectors/grr_hunt.py
log2timeline/dftimewolf
train
248
d0ad14d881174fa4bf442afa83270a963313d8b0
[ "body1 = {'reqId': get_uuid(), 'areaCode': 'atAF-A', 'startTime': '20181010' + '00000000', 'endTime': '20181023' + '00000000'}\na = api_v1_analysis_channel_review_peak(body1)\ndict_data = json.loads(a)\nself.assertNotEqual(dict_data['results'][0]['num'], 0)", "body1 = {'reqId': get_uuid(), 'areaCode': 'atAF-A', '...
<|body_start_0|> body1 = {'reqId': get_uuid(), 'areaCode': 'atAF-A', 'startTime': '20181010' + '00000000', 'endTime': '20181023' + '00000000'} a = api_v1_analysis_channel_review_peak(body1) dict_data = json.loads(a) self.assertNotEqual(dict_data['results'][0]['num'], 0) <|end_body_0|> <...
2.4.9.3复核口人数峰值分析
TestApiAnalysisChannelReviewPeak
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestApiAnalysisChannelReviewPeak: """2.4.9.3复核口人数峰值分析""" def test_01(self): """验证正确传入参数时能返回复核口人数峰值数据""" <|body_0|> def test_02(self): """验证查询非有效时间内不能查询到复核口人数峰值数据""" <|body_1|> def test_03(self): """验证区域通道不存在时,不能查到复核口人数峰值数据""" <|body_2...
stack_v2_sparse_classes_36k_train_018930
2,777
no_license
[ { "docstring": "验证正确传入参数时能返回复核口人数峰值数据", "name": "test_01", "signature": "def test_01(self)" }, { "docstring": "验证查询非有效时间内不能查询到复核口人数峰值数据", "name": "test_02", "signature": "def test_02(self)" }, { "docstring": "验证区域通道不存在时,不能查到复核口人数峰值数据", "name": "test_03", "signature": "def...
5
null
Implement the Python class `TestApiAnalysisChannelReviewPeak` described below. Class description: 2.4.9.3复核口人数峰值分析 Method signatures and docstrings: - def test_01(self): 验证正确传入参数时能返回复核口人数峰值数据 - def test_02(self): 验证查询非有效时间内不能查询到复核口人数峰值数据 - def test_03(self): 验证区域通道不存在时,不能查到复核口人数峰值数据 - def test_04(self): reqId为空时候服务能正...
Implement the Python class `TestApiAnalysisChannelReviewPeak` described below. Class description: 2.4.9.3复核口人数峰值分析 Method signatures and docstrings: - def test_01(self): 验证正确传入参数时能返回复核口人数峰值数据 - def test_02(self): 验证查询非有效时间内不能查询到复核口人数峰值数据 - def test_03(self): 验证区域通道不存在时,不能查到复核口人数峰值数据 - def test_04(self): reqId为空时候服务能正...
aa0749f4a237ee76a61579dc5984635a7127a631
<|skeleton|> class TestApiAnalysisChannelReviewPeak: """2.4.9.3复核口人数峰值分析""" def test_01(self): """验证正确传入参数时能返回复核口人数峰值数据""" <|body_0|> def test_02(self): """验证查询非有效时间内不能查询到复核口人数峰值数据""" <|body_1|> def test_03(self): """验证区域通道不存在时,不能查到复核口人数峰值数据""" <|body_2...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestApiAnalysisChannelReviewPeak: """2.4.9.3复核口人数峰值分析""" def test_01(self): """验证正确传入参数时能返回复核口人数峰值数据""" body1 = {'reqId': get_uuid(), 'areaCode': 'atAF-A', 'startTime': '20181010' + '00000000', 'endTime': '20181023' + '00000000'} a = api_v1_analysis_channel_review_peak(body1) ...
the_stack_v2_python_sparse
Airport/Auto_return/TestCase/test_data_platform_093.py
jingshiyue/zhongkeyuan_workspace
train
0
22e509e1c63112b98d9c8bad61f67c79bf37eeb2
[ "if not board:\n return 0\nrow = len(board)\ncol = len(board[0])\ncount = 0\nfor i in range(row):\n for j in range(col):\n if board[i][j] == '.':\n pass\n elif board[i][j] == 'X':\n count += 1\n board[i][j] = '.'\n tem_i = i + 1\n while tem_...
<|body_start_0|> if not board: return 0 row = len(board) col = len(board[0]) count = 0 for i in range(row): for j in range(col): if board[i][j] == '.': pass elif board[i][j] == 'X': co...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countBattleships(self, board): """:type board: List[List[str]] :rtype: int""" <|body_0|> def countBattleships2(self, board): """:type board: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not board: ...
stack_v2_sparse_classes_36k_train_018931
1,618
no_license
[ { "docstring": ":type board: List[List[str]] :rtype: int", "name": "countBattleships", "signature": "def countBattleships(self, board)" }, { "docstring": ":type board: List[List[str]] :rtype: int", "name": "countBattleships2", "signature": "def countBattleships2(self, board)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countBattleships(self, board): :type board: List[List[str]] :rtype: int - def countBattleships2(self, board): :type board: List[List[str]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countBattleships(self, board): :type board: List[List[str]] :rtype: int - def countBattleships2(self, board): :type board: List[List[str]] :rtype: int <|skeleton|> class Sol...
4105e18050b15fc0409c75353ad31be17187dd34
<|skeleton|> class Solution: def countBattleships(self, board): """:type board: List[List[str]] :rtype: int""" <|body_0|> def countBattleships2(self, board): """:type board: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countBattleships(self, board): """:type board: List[List[str]] :rtype: int""" if not board: return 0 row = len(board) col = len(board[0]) count = 0 for i in range(row): for j in range(col): if board[i][j] == ...
the_stack_v2_python_sparse
countBattleships.py
NeilWangziyu/Leetcode_py
train
2
623e35e500898ec242295e4d2a2fe0d99d29a2d6
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Proto file describing the Ad Group Label service. Service to manage labels on ad groups.
AdGroupLabelServiceServicer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdGroupLabelServiceServicer: """Proto file describing the Ad Group Label service. Service to manage labels on ad groups.""" def GetAdGroupLabel(self, request, context): """Returns the requested ad group label in full detail.""" <|body_0|> def MutateAdGroupLabels(self, re...
stack_v2_sparse_classes_36k_train_018932
3,439
permissive
[ { "docstring": "Returns the requested ad group label in full detail.", "name": "GetAdGroupLabel", "signature": "def GetAdGroupLabel(self, request, context)" }, { "docstring": "Creates and removes ad group labels. Operation statuses are returned.", "name": "MutateAdGroupLabels", "signatur...
2
stack_v2_sparse_classes_30k_train_012691
Implement the Python class `AdGroupLabelServiceServicer` described below. Class description: Proto file describing the Ad Group Label service. Service to manage labels on ad groups. Method signatures and docstrings: - def GetAdGroupLabel(self, request, context): Returns the requested ad group label in full detail. - ...
Implement the Python class `AdGroupLabelServiceServicer` described below. Class description: Proto file describing the Ad Group Label service. Service to manage labels on ad groups. Method signatures and docstrings: - def GetAdGroupLabel(self, request, context): Returns the requested ad group label in full detail. - ...
0fc8a7dbf31d9e8e2a4364df93bec5f6b7edd50a
<|skeleton|> class AdGroupLabelServiceServicer: """Proto file describing the Ad Group Label service. Service to manage labels on ad groups.""" def GetAdGroupLabel(self, request, context): """Returns the requested ad group label in full detail.""" <|body_0|> def MutateAdGroupLabels(self, re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdGroupLabelServiceServicer: """Proto file describing the Ad Group Label service. Service to manage labels on ad groups.""" def GetAdGroupLabel(self, request, context): """Returns the requested ad group label in full detail.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) conte...
the_stack_v2_python_sparse
google/ads/google_ads/v2/proto/services/ad_group_label_service_pb2_grpc.py
juanmacugat/google-ads-python
train
1
b3416904608175d3f92c903e4aef165cdbd898ff
[ "length = len(nums)\ndp = [0 for i in range(length + 1)]\nfor i in range(1, length + 1):\n if nums[i - 1] + dp[i - 1] < 0:\n continue\n dp[i] = nums[i - 1] + dp[i - 1]\nmax_val = max(dp)\nif max_val == 0:\n return max(nums)\nreturn max(dp)", "result = nums[0]\ntemp = nums[0]\nfor i in range(1, len...
<|body_start_0|> length = len(nums) dp = [0 for i in range(length + 1)] for i in range(1, length + 1): if nums[i - 1] + dp[i - 1] < 0: continue dp[i] = nums[i - 1] + dp[i - 1] max_val = max(dp) if max_val == 0: return max(nums) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """动态规划:if nums[i] + dp[i-1] < 0 dp[i] = 0 else dp[i] = dp[i-1] + nums[i] :param nums: :return:""" <|body_0|> def maxSubArray1(self, nums): """空间优化为O(1) :param nums: :return:""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_36k_train_018933
1,427
no_license
[ { "docstring": "动态规划:if nums[i] + dp[i-1] < 0 dp[i] = 0 else dp[i] = dp[i-1] + nums[i] :param nums: :return:", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": "空间优化为O(1) :param nums: :return:", "name": "maxSubArray1", "signature": "def maxSubArray1(sel...
2
stack_v2_sparse_classes_30k_train_000186
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): 动态规划:if nums[i] + dp[i-1] < 0 dp[i] = 0 else dp[i] = dp[i-1] + nums[i] :param nums: :return: - def maxSubArray1(self, nums): 空间优化为O(1) :param nums: :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): 动态规划:if nums[i] + dp[i-1] < 0 dp[i] = 0 else dp[i] = dp[i-1] + nums[i] :param nums: :return: - def maxSubArray1(self, nums): 空间优化为O(1) :param nums: :...
eeaf80e179eec6e9b834c724fe7ba69643137c0a
<|skeleton|> class Solution: def maxSubArray(self, nums): """动态规划:if nums[i] + dp[i-1] < 0 dp[i] = 0 else dp[i] = dp[i-1] + nums[i] :param nums: :return:""" <|body_0|> def maxSubArray1(self, nums): """空间优化为O(1) :param nums: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxSubArray(self, nums): """动态规划:if nums[i] + dp[i-1] < 0 dp[i] = 0 else dp[i] = dp[i-1] + nums[i] :param nums: :return:""" length = len(nums) dp = [0 for i in range(length + 1)] for i in range(1, length + 1): if nums[i - 1] + dp[i - 1] < 0: ...
the_stack_v2_python_sparse
动态规划/53,最大子序和.py
jiangxinyang227/leetcode
train
2
7221e4aee4ad15d7c14502266429ba4009b13d74
[ "like = CommentLike(comment_id=comment_id, user_id=user_id, status=1)\nlike.save()\nreturn like", "try:\n like = CommentLike.objects.filter(status=1).get(comment_id=comment_id, user_id=user_id)\n return like\nexcept CommentLike.DoesNotExist:\n return None" ]
<|body_start_0|> like = CommentLike(comment_id=comment_id, user_id=user_id, status=1) like.save() return like <|end_body_0|> <|body_start_1|> try: like = CommentLike.objects.filter(status=1).get(comment_id=comment_id, user_id=user_id) return like except C...
CommentLike
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CommentLike: def add_comment_like(comment_id=0, user_id=0): """增加一条点赞记录""" <|body_0|> def user_liked(comment_id=0, user_id=0): """查询某人是否点赞了评论""" <|body_1|> <|end_skeleton|> <|body_start_0|> like = CommentLike(comment_id=comment_id, user_id=user_id, ...
stack_v2_sparse_classes_36k_train_018934
979
no_license
[ { "docstring": "增加一条点赞记录", "name": "add_comment_like", "signature": "def add_comment_like(comment_id=0, user_id=0)" }, { "docstring": "查询某人是否点赞了评论", "name": "user_liked", "signature": "def user_liked(comment_id=0, user_id=0)" } ]
2
stack_v2_sparse_classes_30k_train_008160
Implement the Python class `CommentLike` described below. Class description: Implement the CommentLike class. Method signatures and docstrings: - def add_comment_like(comment_id=0, user_id=0): 增加一条点赞记录 - def user_liked(comment_id=0, user_id=0): 查询某人是否点赞了评论
Implement the Python class `CommentLike` described below. Class description: Implement the CommentLike class. Method signatures and docstrings: - def add_comment_like(comment_id=0, user_id=0): 增加一条点赞记录 - def user_liked(comment_id=0, user_id=0): 查询某人是否点赞了评论 <|skeleton|> class CommentLike: def add_comment_like(co...
1fa6ab22a04f3cd2c1a130803833c5c22460a382
<|skeleton|> class CommentLike: def add_comment_like(comment_id=0, user_id=0): """增加一条点赞记录""" <|body_0|> def user_liked(comment_id=0, user_id=0): """查询某人是否点赞了评论""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CommentLike: def add_comment_like(comment_id=0, user_id=0): """增加一条点赞记录""" like = CommentLike(comment_id=comment_id, user_id=user_id, status=1) like.save() return like def user_liked(comment_id=0, user_id=0): """查询某人是否点赞了评论""" try: like = Commen...
the_stack_v2_python_sparse
app/models/blog/comment_like.py
tomszhou/pony
train
1
60e4260265c859ebb0b50014b0e658ad5df12190
[ "for structure_sfvalues in runnerase_sfvalues.data:\n sfvalues_arrays = {}\n for element, sfvalues in structure_sfvalues.data.items():\n name = f'sfvalues_{element}'\n shape = (sfvalues.shape[1],)\n if name not in self.list_arrays():\n self.add_array(name, shape=shape, dtype=np...
<|body_start_0|> for structure_sfvalues in runnerase_sfvalues.data: sfvalues_arrays = {} for element, sfvalues in structure_sfvalues.data.items(): name = f'sfvalues_{element}' shape = (sfvalues.shape[1],) if name not in self.list_arrays(): ...
Extend runnerase RunnerSymmetryFunctionValues with HDF5 compatibility.
HDFSymmetryFunctionValues
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HDFSymmetryFunctionValues: """Extend runnerase RunnerSymmetryFunctionValues with HDF5 compatibility.""" def from_runnerase(self, runnerase_sfvalues: RunnerSymmetryFunctionValues) -> None: """Fill `self` with information of the corresponding `runnerase` object. `runnerase` stores the ...
stack_v2_sparse_classes_36k_train_018935
13,543
permissive
[ { "docstring": "Fill `self` with information of the corresponding `runnerase` object. `runnerase` stores the symmetry function values of each structure in a separate `RunnerStructureSymmetryFunctionValues` object. However, it is very inefficient to read and write all of this information separately into HDF5 sto...
2
stack_v2_sparse_classes_30k_train_015933
Implement the Python class `HDFSymmetryFunctionValues` described below. Class description: Extend runnerase RunnerSymmetryFunctionValues with HDF5 compatibility. Method signatures and docstrings: - def from_runnerase(self, runnerase_sfvalues: RunnerSymmetryFunctionValues) -> None: Fill `self` with information of the ...
Implement the Python class `HDFSymmetryFunctionValues` described below. Class description: Extend runnerase RunnerSymmetryFunctionValues with HDF5 compatibility. Method signatures and docstrings: - def from_runnerase(self, runnerase_sfvalues: RunnerSymmetryFunctionValues) -> None: Fill `self` with information of the ...
7e4085d60017be32624c2e47c10fa1a144c882a1
<|skeleton|> class HDFSymmetryFunctionValues: """Extend runnerase RunnerSymmetryFunctionValues with HDF5 compatibility.""" def from_runnerase(self, runnerase_sfvalues: RunnerSymmetryFunctionValues) -> None: """Fill `self` with information of the corresponding `runnerase` object. `runnerase` stores the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HDFSymmetryFunctionValues: """Extend runnerase RunnerSymmetryFunctionValues with HDF5 compatibility.""" def from_runnerase(self, runnerase_sfvalues: RunnerSymmetryFunctionValues) -> None: """Fill `self` with information of the corresponding `runnerase` object. `runnerase` stores the symmetry func...
the_stack_v2_python_sparse
pyiron_contrib/atomistics/runner/storageclasses.py
pyiron/pyiron_contrib
train
8
4f3676a9a99246f9780071dbc3dbc96e994b1fe9
[ "l = []\n\ndef _tostr(node):\n if node is None:\n l.append('null')\n else:\n l.append(str(node.val))\n _tostr(node.left)\n _tostr(node.right)\n_tostr(root)\nreturn ','.join(l)", "l = data.split(',')\npos = [0]\n\ndef _totree():\n i = pos[0]\n pos[0] += 1\n if i >= len(l)...
<|body_start_0|> l = [] def _tostr(node): if node is None: l.append('null') else: l.append(str(node.val)) _tostr(node.left) _tostr(node.right) _tostr(root) return ','.join(l) <|end_body_0|> <|body_s...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_018936
1,246
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
06dbf4f5b505a6a41e0d93367eedd231b611a84b
<|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""" l = [] def _tostr(node): if node is None: l.append('null') else: l.append(str(node.val)) _tostr(node.left...
the_stack_v2_python_sparse
499.Serialize and Deserialize BST.py
tlxxzj/leetcode
train
2
3cfea37efec128470cf1b5f48622a729620a970e
[ "ans = ''\nfor s in strs:\n ans += str(len(s)) + '|' + s\nreturn ans", "count = False\nnum = ''\nres = []\nfor i in range(len(s)):\n if not count:\n if num == '':\n count = True\n num += s[i]\n else:\n res[-1] += s[i]\n num -= 1\n if num =...
<|body_start_0|> ans = '' for s in strs: ans += str(len(s)) + '|' + s return ans <|end_body_0|> <|body_start_1|> count = False num = '' res = [] for i in range(len(s)): if not count: if num == '': count ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def encode(self, strs): """:type strs: list[str] :rtype: str""" <|body_0|> def decode(self, s): """:type s: str :rtype: list[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ans = '' for s in strs: ans += str(len(s)...
stack_v2_sparse_classes_36k_train_018937
2,596
no_license
[ { "docstring": ":type strs: list[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": ":type s: str :rtype: list[str]", "name": "decode", "signature": "def decode(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def encode(self, strs): :type strs: list[str] :rtype: str - def decode(self, s): :type s: str :rtype: list[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def encode(self, strs): :type strs: list[str] :rtype: str - def decode(self, s): :type s: str :rtype: list[str] <|skeleton|> class Solution: def encode(self, strs): ...
0584b86642dff667f5bf6b7acfbbce86a41a55b6
<|skeleton|> class Solution: def encode(self, strs): """:type strs: list[str] :rtype: str""" <|body_0|> def decode(self, s): """:type s: str :rtype: list[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def encode(self, strs): """:type strs: list[str] :rtype: str""" ans = '' for s in strs: ans += str(len(s)) + '|' + s return ans def decode(self, s): """:type s: str :rtype: list[str]""" count = False num = '' res = [] ...
the_stack_v2_python_sparse
python_solution/271_280/EncodeDecodeStrings.py
CescWang1991/LeetCode-Python
train
1
8ecbf02039a0d00678f57d4a2e25a8e1e1985a12
[ "if S == '':\n return 0\nif S == '()':\n return 1\nscore = 0\nif S[0] == '(' and S[1] == '(':\n i = self.findSplit(S)\n temp1 = S[1:i]\n temp2 = S[i + 1:]\n score = 2 * self.scoreOfParentheses(temp1) + self.scoreOfParentheses(temp2)\nif S[0] == '(' and S[1] == ')':\n temp = S[2:]\n score = 1...
<|body_start_0|> if S == '': return 0 if S == '()': return 1 score = 0 if S[0] == '(' and S[1] == '(': i = self.findSplit(S) temp1 = S[1:i] temp2 = S[i + 1:] score = 2 * self.scoreOfParentheses(temp1) + self.scoreOfP...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def scoreOfParentheses(self, S): """:type S: str :rtype: int""" <|body_0|> def findSplit(self, S): """:type: str :rtype: int for example: S = '(())()' return 3""" <|body_1|> <|end_skeleton|> <|body_start_0|> if S == '': return ...
stack_v2_sparse_classes_36k_train_018938
1,031
no_license
[ { "docstring": ":type S: str :rtype: int", "name": "scoreOfParentheses", "signature": "def scoreOfParentheses(self, S)" }, { "docstring": ":type: str :rtype: int for example: S = '(())()' return 3", "name": "findSplit", "signature": "def findSplit(self, S)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def scoreOfParentheses(self, S): :type S: str :rtype: int - def findSplit(self, S): :type: str :rtype: int for example: S = '(())()' return 3
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def scoreOfParentheses(self, S): :type S: str :rtype: int - def findSplit(self, S): :type: str :rtype: int for example: S = '(())()' return 3 <|skeleton|> class Solution: d...
a6d0e392134afe19d1aed2dfe7914b674e05ecc6
<|skeleton|> class Solution: def scoreOfParentheses(self, S): """:type S: str :rtype: int""" <|body_0|> def findSplit(self, S): """:type: str :rtype: int for example: S = '(())()' return 3""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def scoreOfParentheses(self, S): """:type S: str :rtype: int""" if S == '': return 0 if S == '()': return 1 score = 0 if S[0] == '(' and S[1] == '(': i = self.findSplit(S) temp1 = S[1:i] temp2 = S[i +...
the_stack_v2_python_sparse
856ScoreParentheses.py
Ting007/leetcodePractice
train
0
64c1d950757a8be0c1b2d3c352e7cd01e8e84420
[ "super(EncoderImageFull, self).__init__()\nself.embed_size = embed_size\nself.no_imgnorm = no_imgnorm\nself.use_abs = use_abs\nself.cnn = self.get_cnn(cnn_type, True)\nfor param in self.cnn.parameters():\n param.requires_grad = finetune\nif cnn_type.startswith('vgg'):\n self.fc = nn.Linear(self.cnn.classifier...
<|body_start_0|> super(EncoderImageFull, self).__init__() self.embed_size = embed_size self.no_imgnorm = no_imgnorm self.use_abs = use_abs self.cnn = self.get_cnn(cnn_type, True) for param in self.cnn.parameters(): param.requires_grad = finetune if cnn...
EncoderImageFull
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderImageFull: def __init__(self, embed_size, finetune=False, cnn_type='vgg19', use_abs=False, no_imgnorm=False): """Load pretrained VGG19 and replace top fc layer.""" <|body_0|> def get_cnn(self, arch, pretrained): """Load a pretrained CNN and parallelize over GP...
stack_v2_sparse_classes_36k_train_018939
17,641
no_license
[ { "docstring": "Load pretrained VGG19 and replace top fc layer.", "name": "__init__", "signature": "def __init__(self, embed_size, finetune=False, cnn_type='vgg19', use_abs=False, no_imgnorm=False)" }, { "docstring": "Load a pretrained CNN and parallelize over GPUs", "name": "get_cnn", "...
5
stack_v2_sparse_classes_30k_train_005072
Implement the Python class `EncoderImageFull` described below. Class description: Implement the EncoderImageFull class. Method signatures and docstrings: - def __init__(self, embed_size, finetune=False, cnn_type='vgg19', use_abs=False, no_imgnorm=False): Load pretrained VGG19 and replace top fc layer. - def get_cnn(s...
Implement the Python class `EncoderImageFull` described below. Class description: Implement the EncoderImageFull class. Method signatures and docstrings: - def __init__(self, embed_size, finetune=False, cnn_type='vgg19', use_abs=False, no_imgnorm=False): Load pretrained VGG19 and replace top fc layer. - def get_cnn(s...
6899024a0f22f2f0b632ab0aa02c8343fb9c2845
<|skeleton|> class EncoderImageFull: def __init__(self, embed_size, finetune=False, cnn_type='vgg19', use_abs=False, no_imgnorm=False): """Load pretrained VGG19 and replace top fc layer.""" <|body_0|> def get_cnn(self, arch, pretrained): """Load a pretrained CNN and parallelize over GP...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EncoderImageFull: def __init__(self, embed_size, finetune=False, cnn_type='vgg19', use_abs=False, no_imgnorm=False): """Load pretrained VGG19 and replace top fc layer.""" super(EncoderImageFull, self).__init__() self.embed_size = embed_size self.no_imgnorm = no_imgnorm ...
the_stack_v2_python_sparse
model.py
rriva002/Tweet-Embeddings
train
0
2d697450b617fd6843744cacf27a082f64bdceed
[ "def buildChildTree(preIndex, inIndex, length):\n if length == 0:\n return None\n root = TreeNode(preorder[preIndex])\n count = 0\n while inorder[inIndex + count] != preorder[preIndex]:\n count += 1\n root.left = buildChildTree(preIndex + 1, inIndex, count)\n root.right = buildChildT...
<|body_start_0|> def buildChildTree(preIndex, inIndex, length): if length == 0: return None root = TreeNode(preorder[preIndex]) count = 0 while inorder[inIndex + count] != preorder[preIndex]: count += 1 root.left = build...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def buildTree(self, preorder, inorder): """:type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" <|body_0|> def buildTree2(self, preorder, inorder): """:type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" <|body_1|...
stack_v2_sparse_classes_36k_train_018940
1,314
permissive
[ { "docstring": ":type preorder: List[int] :type inorder: List[int] :rtype: TreeNode", "name": "buildTree", "signature": "def buildTree(self, preorder, inorder)" }, { "docstring": ":type preorder: List[int] :type inorder: List[int] :rtype: TreeNode", "name": "buildTree2", "signature": "de...
2
stack_v2_sparse_classes_30k_train_003593
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, preorder, inorder): :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode - def buildTree2(self, preorder, inorder): :type preorder: List[int] :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def buildTree(self, preorder, inorder): :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode - def buildTree2(self, preorder, inorder): :type preorder: List[int] :...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|skeleton|> class Solution: def buildTree(self, preorder, inorder): """:type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" <|body_0|> def buildTree2(self, preorder, inorder): """:type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def buildTree(self, preorder, inorder): """:type preorder: List[int] :type inorder: List[int] :rtype: TreeNode""" def buildChildTree(preIndex, inIndex, length): if length == 0: return None root = TreeNode(preorder[preIndex]) count =...
the_stack_v2_python_sparse
101-200/101-110/105-binaryTreeFromPreInOrder/binaryTreeFromPreInOrder.py
xuychen/Leetcode
train
0
27804157bd4866469b89c0294fee607aa4b4d174
[ "feat = BoundingBox(n_class=10, max_bbox_per_data=10)\nwith pytest.raises((ValueError, TypeError)):\n features = feat._create_from(bboxes=bboxes)", "nCapacity = 10\nfeat = BoundingBox(n_class=5, max_bbox_per_data=nCapacity)\nfor nBox in range(1, 21):\n yx = np.random.randint(1000, size=(nBox, 2)) / 10\n ...
<|body_start_0|> feat = BoundingBox(n_class=10, max_bbox_per_data=10) with pytest.raises((ValueError, TypeError)): features = feat._create_from(bboxes=bboxes) <|end_body_0|> <|body_start_1|> nCapacity = 10 feat = BoundingBox(n_class=5, max_bbox_per_data=nCapacity) fo...
TestBBoxFeatures
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestBBoxFeatures: def test_invalid_bbox_should_be_blocked(self, bboxes): """Invliad bbox should be blocked by _create_from""" <|body_0|> def test_encode_decode_bboxes(self): """Check encodied ymin, xmin, height, width, class correct""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k_train_018941
8,391
no_license
[ { "docstring": "Invliad bbox should be blocked by _create_from", "name": "test_invalid_bbox_should_be_blocked", "signature": "def test_invalid_bbox_should_be_blocked(self, bboxes)" }, { "docstring": "Check encodied ymin, xmin, height, width, class correct", "name": "test_encode_decode_bboxes...
2
stack_v2_sparse_classes_30k_train_013983
Implement the Python class `TestBBoxFeatures` described below. Class description: Implement the TestBBoxFeatures class. Method signatures and docstrings: - def test_invalid_bbox_should_be_blocked(self, bboxes): Invliad bbox should be blocked by _create_from - def test_encode_decode_bboxes(self): Check encodied ymin, ...
Implement the Python class `TestBBoxFeatures` described below. Class description: Implement the TestBBoxFeatures class. Method signatures and docstrings: - def test_invalid_bbox_should_be_blocked(self, bboxes): Invliad bbox should be blocked by _create_from - def test_encode_decode_bboxes(self): Check encodied ymin, ...
5da5317cedd380c244f20a96213e883d6ef29de2
<|skeleton|> class TestBBoxFeatures: def test_invalid_bbox_should_be_blocked(self, bboxes): """Invliad bbox should be blocked by _create_from""" <|body_0|> def test_encode_decode_bboxes(self): """Check encodied ymin, xmin, height, width, class correct""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestBBoxFeatures: def test_invalid_bbox_should_be_blocked(self, bboxes): """Invliad bbox should be blocked by _create_from""" feat = BoundingBox(n_class=10, max_bbox_per_data=10) with pytest.raises((ValueError, TypeError)): features = feat._create_from(bboxes=bboxes) d...
the_stack_v2_python_sparse
Database/_unittests/test_features.py
MingRuey/mlbox
train
2
0974e74c06389988f8723f724fc5c6cc32423335
[ "caffemodel = config.HEAD_POSE['caffemodel']\ndeploy = config.HEAD_POSE['deploy']\nself.detector = cv2.dnn.readNetFromCaffe(deploy, caffemodel)\nself.detector_confidence = 0.7", "height, width = (img.shape[0], img.shape[1])\naspect_ratio = width / height\nif img.shape[1] * img.shape[0] >= 192 * 192:\n img = cv...
<|body_start_0|> caffemodel = config.HEAD_POSE['caffemodel'] deploy = config.HEAD_POSE['deploy'] self.detector = cv2.dnn.readNetFromCaffe(deploy, caffemodel) self.detector_confidence = 0.7 <|end_body_0|> <|body_start_1|> height, width = (img.shape[0], img.shape[1]) aspec...
Detection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Detection: def __init__(self): """init the class with caffe model and decide the amount of confidence.""" <|body_0|> def get_bbox(self, img): """get a bbox representing the corners of the image after normalization :param img: image to get its corners. :return: an arr...
stack_v2_sparse_classes_36k_train_018942
1,913
no_license
[ { "docstring": "init the class with caffe model and decide the amount of confidence.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "get a bbox representing the corners of the image after normalization :param img: image to get its corners. :return: an array of corners ...
2
stack_v2_sparse_classes_30k_train_010859
Implement the Python class `Detection` described below. Class description: Implement the Detection class. Method signatures and docstrings: - def __init__(self): init the class with caffe model and decide the amount of confidence. - def get_bbox(self, img): get a bbox representing the corners of the image after norma...
Implement the Python class `Detection` described below. Class description: Implement the Detection class. Method signatures and docstrings: - def __init__(self): init the class with caffe model and decide the amount of confidence. - def get_bbox(self, img): get a bbox representing the corners of the image after norma...
607e459d737ac689d6974bf05f452abf89cbdfe2
<|skeleton|> class Detection: def __init__(self): """init the class with caffe model and decide the amount of confidence.""" <|body_0|> def get_bbox(self, img): """get a bbox representing the corners of the image after normalization :param img: image to get its corners. :return: an arr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Detection: def __init__(self): """init the class with caffe model and decide the amount of confidence.""" caffemodel = config.HEAD_POSE['caffemodel'] deploy = config.HEAD_POSE['deploy'] self.detector = cv2.dnn.readNetFromCaffe(deploy, caffemodel) self.detector_confidenc...
the_stack_v2_python_sparse
Measurements/HeadPose/detect.py
alexshachor/TheBackEye
train
0
3a78e1890bf78f99afbf3bf71165c55257b51ded
[ "if not nums:\n return 0\nfirst = self.find_first(nums, target, 0, len(nums) - 1)\nif first == -1:\n return 0\nlast = self.find_last(nums, target, 0, len(nums) - 1)\nreturn last - first + 1", "if begin > end:\n return -1\nmid = begin + (end - begin) // 2\nif nums[mid] == target:\n if mid > 0 and nums[...
<|body_start_0|> if not nums: return 0 first = self.find_first(nums, target, 0, len(nums) - 1) if first == -1: return 0 last = self.find_last(nums, target, 0, len(nums) - 1) return last - first + 1 <|end_body_0|> <|body_start_1|> if begin > end: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums: List[int], target: int) -> int: """binary search, find first and last target in list. O(logn) time complexity.""" <|body_0|> def find_first(self, nums, target, begin, end): """binary search, find first target""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_018943
1,589
no_license
[ { "docstring": "binary search, find first and last target in list. O(logn) time complexity.", "name": "search", "signature": "def search(self, nums: List[int], target: int) -> int" }, { "docstring": "binary search, find first target", "name": "find_first", "signature": "def find_first(se...
3
stack_v2_sparse_classes_30k_train_009512
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: binary search, find first and last target in list. O(logn) time complexity. - def find_first(self, nums, target, begin, end...
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: binary search, find first and last target in list. O(logn) time complexity. - def find_first(self, nums, target, begin, end...
0f16635de49dc63a207d34f7e612546977a5753e
<|skeleton|> class Solution: def search(self, nums: List[int], target: int) -> int: """binary search, find first and last target in list. O(logn) time complexity.""" <|body_0|> def find_first(self, nums, target, begin, end): """binary search, find first target""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def search(self, nums: List[int], target: int) -> int: """binary search, find first and last target in list. O(logn) time complexity.""" if not nums: return 0 first = self.find_first(nums, target, 0, len(nums) - 1) if first == -1: return 0 ...
the_stack_v2_python_sparse
jianzhioffer/53-1findElementInOrderedList.py
bycxw/coder
train
0
a4a2b61f7256a340878c334d9f742878b57ac30c
[ "self.Tmin = 300.0\nself.Tmax = 3000.0\nself.Pmin = 0.1\nself.Pmax = 100.0\nself.comment = 'foo bar'\nself.uncertainty = RateUncertainty(mu=0.3, var=0.6, Tref=1000.0, N=1, correlation='ab')\nself.km = KineticsModel(Tmin=(self.Tmin, 'K'), Tmax=(self.Tmax, 'K'), Pmin=(self.Pmin, 'bar'), Pmax=(self.Pmax, 'bar'), uncer...
<|body_start_0|> self.Tmin = 300.0 self.Tmax = 3000.0 self.Pmin = 0.1 self.Pmax = 100.0 self.comment = 'foo bar' self.uncertainty = RateUncertainty(mu=0.3, var=0.6, Tref=1000.0, N=1, correlation='ab') self.km = KineticsModel(Tmin=(self.Tmin, 'K'), Tmax=(self.Tmax,...
Contains unit tests of the KineticsModel class
TestKineticsModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestKineticsModel: """Contains unit tests of the KineticsModel class""" def setUp(self): """A function run before each unit test in this class.""" <|body_0|> def test_is_identical_to(self): """Test that the KineticsModel.is_identical_to method works on itself. Th...
stack_v2_sparse_classes_36k_train_018944
7,835
permissive
[ { "docstring": "A function run before each unit test in this class.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test that the KineticsModel.is_identical_to method works on itself. This just checks the Temperature range", "name": "test_is_identical_to", "signature...
4
stack_v2_sparse_classes_30k_train_001304
Implement the Python class `TestKineticsModel` described below. Class description: Contains unit tests of the KineticsModel class Method signatures and docstrings: - def setUp(self): A function run before each unit test in this class. - def test_is_identical_to(self): Test that the KineticsModel.is_identical_to metho...
Implement the Python class `TestKineticsModel` described below. Class description: Contains unit tests of the KineticsModel class Method signatures and docstrings: - def setUp(self): A function run before each unit test in this class. - def test_is_identical_to(self): Test that the KineticsModel.is_identical_to metho...
349a4af759cf8877197772cd7eaca1e51d46eff5
<|skeleton|> class TestKineticsModel: """Contains unit tests of the KineticsModel class""" def setUp(self): """A function run before each unit test in this class.""" <|body_0|> def test_is_identical_to(self): """Test that the KineticsModel.is_identical_to method works on itself. Th...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestKineticsModel: """Contains unit tests of the KineticsModel class""" def setUp(self): """A function run before each unit test in this class.""" self.Tmin = 300.0 self.Tmax = 3000.0 self.Pmin = 0.1 self.Pmax = 100.0 self.comment = 'foo bar' self.u...
the_stack_v2_python_sparse
rmgpy/kinetics/modelTest.py
CanePan-cc/CanePanWorkshop
train
2
a3e6239e79ebc51dafdec0c46d45694f54554dbf
[ "super(TextFileStream, self).__init__(*path)\nfrom flume.proto import entity_pb2\npb = entity_pb2.PbInputFormatEntityConfig()\npb.repeatedly = True\npb.max_record_num_per_round = options.get('max_record_num_per_round', 1000)\npb.timeout_per_round = options.get('timeout_per_round', 30)\npb.file_stream.filename_patte...
<|body_start_0|> super(TextFileStream, self).__init__(*path) from flume.proto import entity_pb2 pb = entity_pb2.PbInputFormatEntityConfig() pb.repeatedly = True pb.max_record_num_per_round = options.get('max_record_num_per_round', 1000) pb.timeout_per_round = options.get(...
表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipeline.read(input.TextFileStream('hdfs:///multi_path1', 'hdfs:///multi_path2')) >>>...
TextFileStream
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TextFileStream: """表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipeline.read(input.TextFileStream('hdfs://...
stack_v2_sparse_classes_36k_train_018945
30,720
permissive
[ { "docstring": "内部方法", "name": "__init__", "signature": "def __init__(self, *path, **options)" }, { "docstring": "内部接口", "name": "transform_from_node", "signature": "def transform_from_node(self, load_node, pipeline)" } ]
2
stack_v2_sparse_classes_30k_val_000182
Implement the Python class `TextFileStream` described below. Class description: 表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipe...
Implement the Python class `TextFileStream` described below. Class description: 表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipe...
cfcef62e8a64565b1dceb84efd4278fa83f87b7c
<|skeleton|> class TextFileStream: """表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipeline.read(input.TextFileStream('hdfs://...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TextFileStream: """表示读取的文本文件的无穷数据源。 Args: *path: 读取文件目录的path,必须均为str类型 读取文件数据示例::: >>> lines1 = _pipeline.read(input.TextFileStream('hdfs:///my_hdfs_dir/')) >>> lines2 = _pipeline.read(input.TextFileStream('hdfs://host:port/my_hdfs_dir/')) >>> lines3 = _pipeline.read(input.TextFileStream('hdfs:///multi_path1'...
the_stack_v2_python_sparse
bigflow_python/python/bigflow/input.py
baidu/bigflow
train
1,279
406dc7113431990851df61ca2f7846902a7b8cd7
[ "await self.register_unknown_repositories(repositories, category)\nfor entry, repo_data in repositories.items():\n if repo_data['full_name'] in removed:\n self.hacs.log.warning(\"Skipping %s as it's removed from HACS\", repo_data['full_name'])\n continue\n self.async_restore_repository(entry, re...
<|body_start_0|> await self.register_unknown_repositories(repositories, category) for entry, repo_data in repositories.items(): if repo_data['full_name'] in removed: self.hacs.log.warning("Skipping %s as it's removed from HACS", repo_data['full_name']) continu...
Extended HACS data.
AdjustedHacsData
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdjustedHacsData: """Extended HACS data.""" async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str]): """Restore saved data.""" <|body_0|> def async_store_repository_data(self, repository: HacsRepository) -> dict: ...
stack_v2_sparse_classes_36k_train_018946
14,890
permissive
[ { "docstring": "Restore saved data.", "name": "register_base_data", "signature": "async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str])" }, { "docstring": "Store the repository data.", "name": "async_store_repository_data", "signat...
2
stack_v2_sparse_classes_30k_val_001008
Implement the Python class `AdjustedHacsData` described below. Class description: Extended HACS data. Method signatures and docstrings: - async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str]): Restore saved data. - def async_store_repository_data(self, reposito...
Implement the Python class `AdjustedHacsData` described below. Class description: Extended HACS data. Method signatures and docstrings: - async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str]): Restore saved data. - def async_store_repository_data(self, reposito...
6a27b0a4b74ed4161185af438bcff5aec926f4d9
<|skeleton|> class AdjustedHacsData: """Extended HACS data.""" async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str]): """Restore saved data.""" <|body_0|> def async_store_repository_data(self, repository: HacsRepository) -> dict: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdjustedHacsData: """Extended HACS data.""" async def register_base_data(self, category: str, repositories: dict[str, dict[str, Any]], removed: list[str]): """Restore saved data.""" await self.register_unknown_repositories(repositories, category) for entry, repo_data in repositori...
the_stack_v2_python_sparse
scripts/data/generate_category_data.py
hacs/integration
train
3,601
2fe01cc376c9c2cf1ed2ee3df4d41d5337619422
[ "passwd = data['password']\npasswd_conf = data['password_confirmation']\nif passwd != passwd_conf:\n raise serializers.ValidationError(\"Password don't match.\")\npassword_validation.validate_password(passwd)\nreturn data", "data.pop('password_confirmation')\nuser = User.objects.create_user(**data)\nreturn use...
<|body_start_0|> passwd = data['password'] passwd_conf = data['password_confirmation'] if passwd != passwd_conf: raise serializers.ValidationError("Password don't match.") password_validation.validate_password(passwd) return data <|end_body_0|> <|body_start_1|> ...
UserCreateSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserCreateSerializer: def validate(self, data): """Verify password match.""" <|body_0|> def create(self, data): """Handle user and profile creation.""" <|body_1|> <|end_skeleton|> <|body_start_0|> passwd = data['password'] passwd_conf = data...
stack_v2_sparse_classes_36k_train_018947
3,224
no_license
[ { "docstring": "Verify password match.", "name": "validate", "signature": "def validate(self, data)" }, { "docstring": "Handle user and profile creation.", "name": "create", "signature": "def create(self, data)" } ]
2
stack_v2_sparse_classes_30k_train_020221
Implement the Python class `UserCreateSerializer` described below. Class description: Implement the UserCreateSerializer class. Method signatures and docstrings: - def validate(self, data): Verify password match. - def create(self, data): Handle user and profile creation.
Implement the Python class `UserCreateSerializer` described below. Class description: Implement the UserCreateSerializer class. Method signatures and docstrings: - def validate(self, data): Verify password match. - def create(self, data): Handle user and profile creation. <|skeleton|> class UserCreateSerializer: ...
9b7680a062d2dde312cd07e069cdbe30aab1cbcb
<|skeleton|> class UserCreateSerializer: def validate(self, data): """Verify password match.""" <|body_0|> def create(self, data): """Handle user and profile creation.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserCreateSerializer: def validate(self, data): """Verify password match.""" passwd = data['password'] passwd_conf = data['password_confirmation'] if passwd != passwd_conf: raise serializers.ValidationError("Password don't match.") password_validation.valida...
the_stack_v2_python_sparse
api/users/serializers/users.py
felipebarraza6/cultural_center
train
0
ae2de0cebcca72fc50ed0898603b49c1bc827754
[ "self.setFragmentParent(page)\nself.hyperbola = hyperbola\nself._resolver = ixmantissa.ITemplateNameResolver(self.hyperbola.store)\nsuper(BlogListFragment, self).__init__()", "site = ixmantissa.ISiteURLGenerator(self.hyperbola.store.parent)\nblogURL = websharing.linkTo(blog)\nsiteURL = site.encryptedRoot()\nblogU...
<|body_start_0|> self.setFragmentParent(page) self.hyperbola = hyperbola self._resolver = ixmantissa.ITemplateNameResolver(self.hyperbola.store) super(BlogListFragment, self).__init__() <|end_body_0|> <|body_start_1|> site = ixmantissa.ISiteURLGenerator(self.hyperbola.store.pare...
Fragment which renders a list of all blogs
BlogListFragment
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BlogListFragment: """Fragment which renders a list of all blogs""" def __init__(self, page, hyperbola): """@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence""" <|body_0|> def _getPostURL(self, blog): """Figure out a URL which could be used for ...
stack_v2_sparse_classes_36k_train_018948
28,777
permissive
[ { "docstring": "@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence", "name": "__init__", "signature": "def __init__(self, page, hyperbola)" }, { "docstring": "Figure out a URL which could be used for posting to C{blog} @type blog: L{xmantissa.sharing.SharedProxy} @rtype: L{nevo...
3
stack_v2_sparse_classes_30k_train_005698
Implement the Python class `BlogListFragment` described below. Class description: Fragment which renders a list of all blogs Method signatures and docstrings: - def __init__(self, page, hyperbola): @type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence - def _getPostURL(self, blog): Figure out a URL whi...
Implement the Python class `BlogListFragment` described below. Class description: Fragment which renders a list of all blogs Method signatures and docstrings: - def __init__(self, page, hyperbola): @type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence - def _getPostURL(self, blog): Figure out a URL whi...
bf9c26051e8dfd1325bdc63aab1c560dbad7f6b7
<|skeleton|> class BlogListFragment: """Fragment which renders a list of all blogs""" def __init__(self, page, hyperbola): """@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence""" <|body_0|> def _getPostURL(self, blog): """Figure out a URL which could be used for ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BlogListFragment: """Fragment which renders a list of all blogs""" def __init__(self, page, hyperbola): """@type hyperbola: L{hyperbola.hyperbola_model.HyperbolaPublicPresence""" self.setFragmentParent(page) self.hyperbola = hyperbola self._resolver = ixmantissa.ITemplateN...
the_stack_v2_python_sparse
Hyperbola/hyperbola/hyperbola_view.py
feitianyiren/divmod.org
train
0
67217bba10145e7e96089f3444cdf7d4ecf1451c
[ "from django.conf.urls import url\n\ndef wrap(view):\n\n def wrapper(*args, **kwargs):\n return self.admin_site.admin_view(view, cacheable=True)(*args, **kwargs)\n return update_wrapper(wrapper, view)\ninfo = self.get_model_info()\nurls = super(HTMLModelReportMixin, self).get_urls()\nreport_url = [url(...
<|body_start_0|> from django.conf.urls import url def wrap(view): def wrapper(*args, **kwargs): return self.admin_site.admin_view(view, cacheable=True)(*args, **kwargs) return update_wrapper(wrapper, view) info = self.get_model_info() urls = supe...
HTML Admin Mixin for django admin Generate model object detail in pdf format report with WeasyPrint using html file template
HTMLModelReportMixin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTMLModelReportMixin: """HTML Admin Mixin for django admin Generate model object detail in pdf format report with WeasyPrint using html file template""" def get_urls(self): """Get default django admin urls then add custom url for report link""" <|body_0|> def get_context...
stack_v2_sparse_classes_36k_train_018949
6,508
no_license
[ { "docstring": "Get default django admin urls then add custom url for report link", "name": "get_urls", "signature": "def get_urls(self)" }, { "docstring": "Get the context name to used in template", "name": "get_context_object_name", "signature": "def get_context_object_name(self)" },...
6
stack_v2_sparse_classes_30k_test_000348
Implement the Python class `HTMLModelReportMixin` described below. Class description: HTML Admin Mixin for django admin Generate model object detail in pdf format report with WeasyPrint using html file template Method signatures and docstrings: - def get_urls(self): Get default django admin urls then add custom url f...
Implement the Python class `HTMLModelReportMixin` described below. Class description: HTML Admin Mixin for django admin Generate model object detail in pdf format report with WeasyPrint using html file template Method signatures and docstrings: - def get_urls(self): Get default django admin urls then add custom url f...
0cf8fb1be8ac3c27304807ed7aac7eb0032c2cb6
<|skeleton|> class HTMLModelReportMixin: """HTML Admin Mixin for django admin Generate model object detail in pdf format report with WeasyPrint using html file template""" def get_urls(self): """Get default django admin urls then add custom url for report link""" <|body_0|> def get_context...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HTMLModelReportMixin: """HTML Admin Mixin for django admin Generate model object detail in pdf format report with WeasyPrint using html file template""" def get_urls(self): """Get default django admin urls then add custom url for report link""" from django.conf.urls import url de...
the_stack_v2_python_sparse
reporting/admin.py
andrewidya/littleerp
train
1
7faaf211074a3346a71330ef0aaca4226624bf71
[ "if model._meta.app_label == self.APP:\n return self.DB\nreturn None", "if model._meta.app_label == self.APP:\n return self.DB\nreturn None", "if obj1._meta.app_label == self.APP or obj2._meta.app_label == self.APP:\n return True\nreturn None", "if db == self.DB:\n return model._meta.app_label == ...
<|body_start_0|> if model._meta.app_label == self.APP: return self.DB return None <|end_body_0|> <|body_start_1|> if model._meta.app_label == self.APP: return self.DB return None <|end_body_1|> <|body_start_2|> if obj1._meta.app_label == self.APP or obj2...
A router to control all database operations on models in the geonames application.
GeoNamesRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeoNamesRouter: """A router to control all database operations on models in the geonames application.""" def db_for_read(self, model, **hints): """Attempts to read geonames models go to geonames db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempt...
stack_v2_sparse_classes_36k_train_018950
1,196
no_license
[ { "docstring": "Attempts to read geonames models go to geonames db.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Attempts to write geonames models go to geonames db.", "name": "db_for_write", "signature": "def db_for_write(self, model, ...
4
stack_v2_sparse_classes_30k_train_016932
Implement the Python class `GeoNamesRouter` described below. Class description: A router to control all database operations on models in the geonames application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read geonames models go to geonames db. - def db_for_write(self, mod...
Implement the Python class `GeoNamesRouter` described below. Class description: A router to control all database operations on models in the geonames application. Method signatures and docstrings: - def db_for_read(self, model, **hints): Attempts to read geonames models go to geonames db. - def db_for_write(self, mod...
681ef09e4044879840f7f0c8bccc836c3cffec3c
<|skeleton|> class GeoNamesRouter: """A router to control all database operations on models in the geonames application.""" def db_for_read(self, model, **hints): """Attempts to read geonames models go to geonames db.""" <|body_0|> def db_for_write(self, model, **hints): """Attempt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeoNamesRouter: """A router to control all database operations on models in the geonames application.""" def db_for_read(self, model, **hints): """Attempts to read geonames models go to geonames db.""" if model._meta.app_label == self.APP: return self.DB return None ...
the_stack_v2_python_sparse
apps/geonames/db_routers.py
RumorIO/healersource
train
0
dc65257598c4d3225bf9a102626fec4a011a5389
[ "plugin = MergeCubesForWeightedBlending('realization')\nself.assertEqual(plugin.blend_coord, 'realization')\nself.assertIsNone(plugin.weighting_coord)\nself.assertIsNone(plugin.model_id_attr)", "plugin = MergeCubesForWeightedBlending('model_id', weighting_coord='forecast_period', model_id_attr='mosg__model_config...
<|body_start_0|> plugin = MergeCubesForWeightedBlending('realization') self.assertEqual(plugin.blend_coord, 'realization') self.assertIsNone(plugin.weighting_coord) self.assertIsNone(plugin.model_id_attr) <|end_body_0|> <|body_start_1|> plugin = MergeCubesForWeightedBlending('mo...
Test the __init__ method
Test__init__
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__init__: """Test the __init__ method""" def test_basic(self): """Test default initialisation""" <|body_0|> def test_optional_args(self): """Test model ID and weighting coordinate setting""" <|body_1|> def test_error_missing_model_id_attr(self): ...
stack_v2_sparse_classes_36k_train_018951
20,203
permissive
[ { "docstring": "Test default initialisation", "name": "test_basic", "signature": "def test_basic(self)" }, { "docstring": "Test model ID and weighting coordinate setting", "name": "test_optional_args", "signature": "def test_optional_args(self)" }, { "docstring": "Test exception ...
4
null
Implement the Python class `Test__init__` described below. Class description: Test the __init__ method Method signatures and docstrings: - def test_basic(self): Test default initialisation - def test_optional_args(self): Test model ID and weighting coordinate setting - def test_error_missing_model_id_attr(self): Test...
Implement the Python class `Test__init__` described below. Class description: Test the __init__ method Method signatures and docstrings: - def test_basic(self): Test default initialisation - def test_optional_args(self): Test model ID and weighting coordinate setting - def test_error_missing_model_id_attr(self): Test...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test__init__: """Test the __init__ method""" def test_basic(self): """Test default initialisation""" <|body_0|> def test_optional_args(self): """Test model ID and weighting coordinate setting""" <|body_1|> def test_error_missing_model_id_attr(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test__init__: """Test the __init__ method""" def test_basic(self): """Test default initialisation""" plugin = MergeCubesForWeightedBlending('realization') self.assertEqual(plugin.blend_coord, 'realization') self.assertIsNone(plugin.weighting_coord) self.assertIsNon...
the_stack_v2_python_sparse
improver_tests/blending/weighted_blend/test_MergeCubesForWeightedBlending.py
metoppv/improver
train
101
77b4fa5853a57fc81e6d0349b8dbfa99548d4bc0
[ "self.warmup = warmup\nself.n_steps = n_steps\nsuper().__init__(optimizer, lr_lambda=self.lr_lambda, last_epoch=-1)", "if step < self.warmup:\n return float(step) / float(max(1, self.warmup))\nreturn max(0.0, float(self.n_steps - step) / float(max(1.0, self.n_steps - self.warmup)))" ]
<|body_start_0|> self.warmup = warmup self.n_steps = n_steps super().__init__(optimizer, lr_lambda=self.lr_lambda, last_epoch=-1) <|end_body_0|> <|body_start_1|> if step < self.warmup: return float(step) / float(max(1, self.warmup)) return max(0.0, float(self.n_steps...
Linear warmup and then linear decay. Linearly increases learning rate from 0 to 1 over `warmup` training steps. Linearly decreases learning rate from 1. to 0. over remaining `n_steps - warmup` steps. This scheduler is generally used after every training batch.
WarmupLinearScheduler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WarmupLinearScheduler: """Linear warmup and then linear decay. Linearly increases learning rate from 0 to 1 over `warmup` training steps. Linearly decreases learning rate from 1. to 0. over remaining `n_steps - warmup` steps. This scheduler is generally used after every training batch.""" de...
stack_v2_sparse_classes_36k_train_018952
1,483
permissive
[ { "docstring": "Initialize the WarmupLinearScheduler. Parameters ---------- optimizer : torch.optim.Optimizer Wrapped optimizer. warmup : int The number of linear warmup phases n_steps : int, optional The index of last step. Default: -1", "name": "__init__", "signature": "def __init__(self, optimizer, w...
2
stack_v2_sparse_classes_30k_train_019281
Implement the Python class `WarmupLinearScheduler` described below. Class description: Linear warmup and then linear decay. Linearly increases learning rate from 0 to 1 over `warmup` training steps. Linearly decreases learning rate from 1. to 0. over remaining `n_steps - warmup` steps. This scheduler is generally used...
Implement the Python class `WarmupLinearScheduler` described below. Class description: Linear warmup and then linear decay. Linearly increases learning rate from 0 to 1 over `warmup` training steps. Linearly decreases learning rate from 1. to 0. over remaining `n_steps - warmup` steps. This scheduler is generally used...
0dc2f5b2b286694defe8abf450fe5be9ae12c097
<|skeleton|> class WarmupLinearScheduler: """Linear warmup and then linear decay. Linearly increases learning rate from 0 to 1 over `warmup` training steps. Linearly decreases learning rate from 1. to 0. over remaining `n_steps - warmup` steps. This scheduler is generally used after every training batch.""" de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WarmupLinearScheduler: """Linear warmup and then linear decay. Linearly increases learning rate from 0 to 1 over `warmup` training steps. Linearly decreases learning rate from 1. to 0. over remaining `n_steps - warmup` steps. This scheduler is generally used after every training batch.""" def __init__(se...
the_stack_v2_python_sparse
flambe/optim/linear.py
cle-ros/flambe
train
1
b4b801eb1a39b29b547817ca1179ca5e43eff53c
[ "count = db.import_data('D:\\\\UW\\\\PY220\\\\Examples and Assignments\\\\lesson05\\\\csv_files\\\\', 'products.csv', 'customers.csv', 'rentals.csv')\nexpected_count = ((4, 3, 4), (0, 0, 0))\nself.assertEqual(count, expected_count)", "data = db\ndata.import_data('D:\\\\UW\\\\PY220\\\\Examples and Assignments\\\\l...
<|body_start_0|> count = db.import_data('D:\\UW\\PY220\\Examples and Assignments\\lesson05\\csv_files\\', 'products.csv', 'customers.csv', 'rentals.csv') expected_count = ((4, 3, 4), (0, 0, 0)) self.assertEqual(count, expected_count) <|end_body_0|> <|body_start_1|> data = db dat...
Testing the Parts of Database.py
TestDatabase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDatabase: """Testing the Parts of Database.py""" def test_import_data(self): """Test Importing Data""" <|body_0|> def test_show_available_products(self): """Test Showing Available Products""" <|body_1|> def test_show_rentals(self): """Tes...
stack_v2_sparse_classes_36k_train_018953
2,486
no_license
[ { "docstring": "Test Importing Data", "name": "test_import_data", "signature": "def test_import_data(self)" }, { "docstring": "Test Showing Available Products", "name": "test_show_available_products", "signature": "def test_show_available_products(self)" }, { "docstring": "Test S...
3
null
Implement the Python class `TestDatabase` described below. Class description: Testing the Parts of Database.py Method signatures and docstrings: - def test_import_data(self): Test Importing Data - def test_show_available_products(self): Test Showing Available Products - def test_show_rentals(self): Test Showing Renta...
Implement the Python class `TestDatabase` described below. Class description: Testing the Parts of Database.py Method signatures and docstrings: - def test_import_data(self): Test Importing Data - def test_show_available_products(self): Test Showing Available Products - def test_show_rentals(self): Test Showing Renta...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class TestDatabase: """Testing the Parts of Database.py""" def test_import_data(self): """Test Importing Data""" <|body_0|> def test_show_available_products(self): """Test Showing Available Products""" <|body_1|> def test_show_rentals(self): """Tes...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestDatabase: """Testing the Parts of Database.py""" def test_import_data(self): """Test Importing Data""" count = db.import_data('D:\\UW\\PY220\\Examples and Assignments\\lesson05\\csv_files\\', 'products.csv', 'customers.csv', 'rentals.csv') expected_count = ((4, 3, 4), (0, 0, 0...
the_stack_v2_python_sparse
students/andrew_garcia/lesson05-assignment/test_database.py
JavaRod/SP_Python220B_2019
train
1
1b347eeca875b9f23267b7e75ac82238e49b9c2c
[ "super(Inception5a, self).__init__()\nbranch1_list = [{'type': ConvBNLayer, 'num_channels': num_channels, 'num_filters': ch1x1, 'filter_size': 1, 'stride': 1, 'padding': 0, 'act': 'relu'}]\nself.branch1 = LinConPoo(branch1_list)\nbranch2_list = [{'type': ConvBNLayer, 'num_channels': num_channels, 'num_filters': ch3...
<|body_start_0|> super(Inception5a, self).__init__() branch1_list = [{'type': ConvBNLayer, 'num_channels': num_channels, 'num_filters': ch1x1, 'filter_size': 1, 'stride': 1, 'padding': 0, 'act': 'relu'}] self.branch1 = LinConPoo(branch1_list) branch2_list = [{'type': ConvBNLayer, 'num_ch...
Inception5a
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Inception5a: def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): """@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel num...
stack_v2_sparse_classes_36k_train_018954
22,436
permissive
[ { "docstring": "@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 conv before 3x3 conv ch3x3 : output channel numbers of 3x3 conv doublech3x3reduced : channel numbers of 1x1 conv before the double 3x3 ...
2
stack_v2_sparse_classes_30k_train_017552
Implement the Python class `Inception5a` described below. Class description: Implement the Inception5a class. Method signatures and docstrings: - def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception5a` @Parameters num_channels : c...
Implement the Python class `Inception5a` described below. Class description: Implement the Inception5a class. Method signatures and docstrings: - def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): @Brief `Inception5a` @Parameters num_channels : c...
78ff3c3ab3906012a0f4a612251347632aa493a7
<|skeleton|> class Inception5a: def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): """@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel num...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Inception5a: def __init__(self, num_channels, ch1x1, ch3x3reduced, ch3x3, doublech3x3reduced, doublech3x3_1, doublech3x3_2, pool_proj): """@Brief `Inception5a` @Parameters num_channels : channel numbers of input tensor ch1x1 : output channel numbers of 1x1 conv ch3x3reduced : channel numbers of 1x1 co...
the_stack_v2_python_sparse
ECO/paddle1.8/model/ECO.py
thinkall/Contrib
train
1
36d121cf4ab8c4a21fac3cad275776852e5ea7a7
[ "super().__init__()\nself.fps = fps\nself.m_dims = m_dims\nself.bins = bins\nself.delay = delay\nself.cutter = aseg.Segmentation(n_perseg, n_overlap)\nif pp_params:\n self._ppkr = FilterPeakPicker(**pp_params)\nelse:\n self._ppkr = FilterPeakPicker()", "segs = self.cutter.transform(inp)\nodf = np.empty((seg...
<|body_start_0|> super().__init__() self.fps = fps self.m_dims = m_dims self.bins = bins self.delay = delay self.cutter = aseg.Segmentation(n_perseg, n_overlap) if pp_params: self._ppkr = FilterPeakPicker(**pp_params) else: self._pp...
Detect onsets based on entropy maxima.
EntropyOnsetDetector
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EntropyOnsetDetector: """Detect onsets based on entropy maxima.""" def __init__(self, fps: int, m_dims: int=3, delay: int=10, bins: int=10, n_perseg: int=1024, n_overlap: int=512, pp_params: Optional[dict]=None) -> None: """Detect onsets as local maxima of information entropy of cons...
stack_v2_sparse_classes_36k_train_018955
8,907
permissive
[ { "docstring": "Detect onsets as local maxima of information entropy of consecutive windows. Be sure to set ``n_perseg`` and ``hop_size`` according to the sampling rate of the input signal. Params: fps: Audio signal. m_dim: Embedding dimension. bins: Boxes per axis. delay: Embedding delay. n_perseg: Length of s...
2
stack_v2_sparse_classes_30k_train_012719
Implement the Python class `EntropyOnsetDetector` described below. Class description: Detect onsets based on entropy maxima. Method signatures and docstrings: - def __init__(self, fps: int, m_dims: int=3, delay: int=10, bins: int=10, n_perseg: int=1024, n_overlap: int=512, pp_params: Optional[dict]=None) -> None: Det...
Implement the Python class `EntropyOnsetDetector` described below. Class description: Detect onsets based on entropy maxima. Method signatures and docstrings: - def __init__(self, fps: int, m_dims: int=3, delay: int=10, bins: int=10, n_perseg: int=1024, n_overlap: int=512, pp_params: Optional[dict]=None) -> None: Det...
c733591240f3a4d3825d61385bd19262bd76b43b
<|skeleton|> class EntropyOnsetDetector: """Detect onsets based on entropy maxima.""" def __init__(self, fps: int, m_dims: int=3, delay: int=10, bins: int=10, n_perseg: int=1024, n_overlap: int=512, pp_params: Optional[dict]=None) -> None: """Detect onsets as local maxima of information entropy of cons...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EntropyOnsetDetector: """Detect onsets based on entropy maxima.""" def __init__(self, fps: int, m_dims: int=3, delay: int=10, bins: int=10, n_perseg: int=1024, n_overlap: int=512, pp_params: Optional[dict]=None) -> None: """Detect onsets as local maxima of information entropy of consecutive windo...
the_stack_v2_python_sparse
src/apollon/onsets.py
TimZiemer/apollon
train
0
11dbce014496e88fb59cc3756800973831b19a50
[ "if isinstance(factors[0], np.ndarray):\n self.U = [tf.constant(mat, dtype=tf.float32) for mat in factors]\nelse:\n self.U = factors\nif lambdas is None:\n self.lambdas = tf.ones((self.U[0].get_shape()[1].value, 1), dtype=tf.float32)\nelse:\n if isinstance(lambdas, np.ndarray):\n self.lambdas = t...
<|body_start_0|> if isinstance(factors[0], np.ndarray): self.U = [tf.constant(mat, dtype=tf.float32) for mat in factors] else: self.U = factors if lambdas is None: self.lambdas = tf.ones((self.U[0].get_shape()[1].value, 1), dtype=tf.float32) else: ...
Kruskal Tensor .. math:: \\mathcal{X} = \\sum_r \\sigma_r a_r \\circ b_r \\circ c_r
KTensor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KTensor: """Kruskal Tensor .. math:: \\mathcal{X} = \\sum_r \\sigma_r a_r \\circ b_r \\circ c_r""" def __init__(self, factors, lambdas=None): """Parameters ---------- factors : list of [tf.Tensor, ndarray] the factor matrix of Kruskal Tensor lambdas : ndarray, tf.Tensor vector-like, ...
stack_v2_sparse_classes_36k_train_018956
5,724
permissive
[ { "docstring": "Parameters ---------- factors : list of [tf.Tensor, ndarray] the factor matrix of Kruskal Tensor lambdas : ndarray, tf.Tensor vector-like, the weight of every axis of factors", "name": "__init__", "signature": "def __init__(self, factors, lambdas=None)" }, { "docstring": ".. math...
2
stack_v2_sparse_classes_30k_val_000260
Implement the Python class `KTensor` described below. Class description: Kruskal Tensor .. math:: \\mathcal{X} = \\sum_r \\sigma_r a_r \\circ b_r \\circ c_r Method signatures and docstrings: - def __init__(self, factors, lambdas=None): Parameters ---------- factors : list of [tf.Tensor, ndarray] the factor matrix of ...
Implement the Python class `KTensor` described below. Class description: Kruskal Tensor .. math:: \\mathcal{X} = \\sum_r \\sigma_r a_r \\circ b_r \\circ c_r Method signatures and docstrings: - def __init__(self, factors, lambdas=None): Parameters ---------- factors : list of [tf.Tensor, ndarray] the factor matrix of ...
342e360d348713a18b4e80fcc0f840a136748b66
<|skeleton|> class KTensor: """Kruskal Tensor .. math:: \\mathcal{X} = \\sum_r \\sigma_r a_r \\circ b_r \\circ c_r""" def __init__(self, factors, lambdas=None): """Parameters ---------- factors : list of [tf.Tensor, ndarray] the factor matrix of Kruskal Tensor lambdas : ndarray, tf.Tensor vector-like, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KTensor: """Kruskal Tensor .. math:: \\mathcal{X} = \\sum_r \\sigma_r a_r \\circ b_r \\circ c_r""" def __init__(self, factors, lambdas=None): """Parameters ---------- factors : list of [tf.Tensor, ndarray] the factor matrix of Kruskal Tensor lambdas : ndarray, tf.Tensor vector-like, the weight of...
the_stack_v2_python_sparse
tensorD/base/type.py
Yousef11111/tensorD
train
1
11e39f8ab203717c5d0253ca0afefab2a58b6301
[ "bound_clusters = []\nself.bound_cluster_vertices = []\nerasure_bound = []\nfor layer in self.graph.B.values():\n for bound in layer.values():\n for vertex, edge in bound.neighbors.values():\n if edge.qubit.erasure:\n cluster = self.graph.get_cluster(self.graph.cID, bound)\n ...
<|body_start_0|> bound_clusters = [] self.bound_cluster_vertices = [] erasure_bound = [] for layer in self.graph.B.values(): for bound in layer.values(): for vertex, edge in bound.neighbors.values(): if edge.qubit.erasure: ...
Union-Find evengrow-plugin decoder for the toric lattice (2D and 3D) Inherits all the class variables and methods of unionfind.planar and toric objects. Method resolution order: planar -> unionfind.planar -> toric -> unionfind.toric Initilized using the toric.__init__() function. And therefore has the addditions and re...
planar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class planar: """Union-Find evengrow-plugin decoder for the toric lattice (2D and 3D) Inherits all the class variables and methods of unionfind.planar and toric objects. Method resolution order: planar -> unionfind.planar -> toric -> unionfind.toric Initilized using the toric.__init__() function. And t...
stack_v2_sparse_classes_36k_train_018957
19,737
no_license
[ { "docstring": "For the planar lattice, in the case of erasures connected to the boundary, clusters need to be formed from the boundary, such that the shortest path from an anyon to the boundary is formed within the cluster tree. We loop over all edges connected to the boundary to find erasures and initate clus...
3
null
Implement the Python class `planar` described below. Class description: Union-Find evengrow-plugin decoder for the toric lattice (2D and 3D) Inherits all the class variables and methods of unionfind.planar and toric objects. Method resolution order: planar -> unionfind.planar -> toric -> unionfind.toric Initilized usi...
Implement the Python class `planar` described below. Class description: Union-Find evengrow-plugin decoder for the toric lattice (2D and 3D) Inherits all the class variables and methods of unionfind.planar and toric objects. Method resolution order: planar -> unionfind.planar -> toric -> unionfind.toric Initilized usi...
8d952fc8d8d728086360e1718f43c0bc445f26b1
<|skeleton|> class planar: """Union-Find evengrow-plugin decoder for the toric lattice (2D and 3D) Inherits all the class variables and methods of unionfind.planar and toric objects. Method resolution order: planar -> unionfind.planar -> toric -> unionfind.toric Initilized using the toric.__init__() function. And t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class planar: """Union-Find evengrow-plugin decoder for the toric lattice (2D and 3D) Inherits all the class variables and methods of unionfind.planar and toric objects. Method resolution order: planar -> unionfind.planar -> toric -> unionfind.toric Initilized using the toric.__init__() function. And therefore has ...
the_stack_v2_python_sparse
old/unionfind_evengrow_plugin.py
Poeloe/oop_surface_code
train
3
b42b1bdb5630119ac802d673c5bdbd5c91a18274
[ "path_spec = database_file_entry.path_spec\nlocation = getattr(path_spec, 'location', None)\nif not path_spec or not location:\n return (None, None)\nlocation_wal = '{0:s}-wal'.format(location)\nfile_system = database_file_entry.GetFileSystem()\nwal_path_spec = path_spec_factory.Factory.NewPathSpec(file_system.t...
<|body_start_0|> path_spec = database_file_entry.path_spec location = getattr(path_spec, 'location', None) if not path_spec or not location: return (None, None) location_wal = '{0:s}-wal'.format(location) file_system = database_file_entry.GetFileSystem() wal_p...
Parses SQLite database files.
SQLiteParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SQLiteParser: """Parses SQLite database files.""" def _OpenDatabaseWithWAL(self, parser_mediator, database_file_entry, database_file_object, filename): """Opens a database with its Write-Ahead Log (WAL) committed. Args: parser_mediator (ParserMediator): parser mediator. database_file...
stack_v2_sparse_classes_36k_train_018958
15,878
permissive
[ { "docstring": "Opens a database with its Write-Ahead Log (WAL) committed. Args: parser_mediator (ParserMediator): parser mediator. database_file_entry (dfvfs.FileEntry): file entry of the database. database_file_object (dfvfs.FileIO): file-like object of the database. filename (str): name of the database file ...
4
stack_v2_sparse_classes_30k_train_015177
Implement the Python class `SQLiteParser` described below. Class description: Parses SQLite database files. Method signatures and docstrings: - def _OpenDatabaseWithWAL(self, parser_mediator, database_file_entry, database_file_object, filename): Opens a database with its Write-Ahead Log (WAL) committed. Args: parser_...
Implement the Python class `SQLiteParser` described below. Class description: Parses SQLite database files. Method signatures and docstrings: - def _OpenDatabaseWithWAL(self, parser_mediator, database_file_entry, database_file_object, filename): Opens a database with its Write-Ahead Log (WAL) committed. Args: parser_...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class SQLiteParser: """Parses SQLite database files.""" def _OpenDatabaseWithWAL(self, parser_mediator, database_file_entry, database_file_object, filename): """Opens a database with its Write-Ahead Log (WAL) committed. Args: parser_mediator (ParserMediator): parser mediator. database_file...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SQLiteParser: """Parses SQLite database files.""" def _OpenDatabaseWithWAL(self, parser_mediator, database_file_entry, database_file_object, filename): """Opens a database with its Write-Ahead Log (WAL) committed. Args: parser_mediator (ParserMediator): parser mediator. database_file_entry (dfvfs...
the_stack_v2_python_sparse
plaso/parsers/sqlite.py
log2timeline/plaso
train
1,506
24375fc22958a9863e24f29d9b3683237fadc6cc
[ "self._attr_name = name\nself._device_id = device_id\nself._lwlink = lwlink", "self._attr_is_on = True\nself._lwlink.turn_on_switch(self._device_id, self._attr_name)\nself.async_write_ha_state()", "self._attr_is_on = False\nself._lwlink.turn_off(self._device_id, self._attr_name)\nself.async_write_ha_state()" ]
<|body_start_0|> self._attr_name = name self._device_id = device_id self._lwlink = lwlink <|end_body_0|> <|body_start_1|> self._attr_is_on = True self._lwlink.turn_on_switch(self._device_id, self._attr_name) self.async_write_ha_state() <|end_body_1|> <|body_start_2|> ...
Representation of a LightWaveRF switch.
LWRFSwitch
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LWRFSwitch: """Representation of a LightWaveRF switch.""" def __init__(self, name, device_id, lwlink): """Initialize LWRFSwitch entity.""" <|body_0|> async def async_turn_on(self, **kwargs: Any) -> None: """Turn the LightWave switch on.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_018959
1,734
permissive
[ { "docstring": "Initialize LWRFSwitch entity.", "name": "__init__", "signature": "def __init__(self, name, device_id, lwlink)" }, { "docstring": "Turn the LightWave switch on.", "name": "async_turn_on", "signature": "async def async_turn_on(self, **kwargs: Any) -> None" }, { "doc...
3
null
Implement the Python class `LWRFSwitch` described below. Class description: Representation of a LightWaveRF switch. Method signatures and docstrings: - def __init__(self, name, device_id, lwlink): Initialize LWRFSwitch entity. - async def async_turn_on(self, **kwargs: Any) -> None: Turn the LightWave switch on. - asy...
Implement the Python class `LWRFSwitch` described below. Class description: Representation of a LightWaveRF switch. Method signatures and docstrings: - def __init__(self, name, device_id, lwlink): Initialize LWRFSwitch entity. - async def async_turn_on(self, **kwargs: Any) -> None: Turn the LightWave switch on. - asy...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class LWRFSwitch: """Representation of a LightWaveRF switch.""" def __init__(self, name, device_id, lwlink): """Initialize LWRFSwitch entity.""" <|body_0|> async def async_turn_on(self, **kwargs: Any) -> None: """Turn the LightWave switch on.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LWRFSwitch: """Representation of a LightWaveRF switch.""" def __init__(self, name, device_id, lwlink): """Initialize LWRFSwitch entity.""" self._attr_name = name self._device_id = device_id self._lwlink = lwlink async def async_turn_on(self, **kwargs: Any) -> None: ...
the_stack_v2_python_sparse
homeassistant/components/lightwave/switch.py
home-assistant/core
train
35,501
a9adae40b29d15730d139079d42db61db5c7ebab
[ "s = set()\nq = deque()\nresult = 0\nfor c in st:\n if c in s:\n result = max(result, len(q))\n while True:\n d = q.popleft()\n s.difference_update({d})\n if c == d:\n break\n q.append(c)\n s.add(c)\nreturn max(result, len(q))", "result = 0\ns...
<|body_start_0|> s = set() q = deque() result = 0 for c in st: if c in s: result = max(result, len(q)) while True: d = q.popleft() s.difference_update({d}) if c == d: ...
Given a string, find the length of the longest substring without repeating characters. https://leetcode.com/problems/longest-substring-without-repeating-characters/
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """Given a string, find the length of the longest substring without repeating characters. https://leetcode.com/problems/longest-substring-without-repeating-characters/""" def lengthOfLongestSubstring(self, st: str) -> int: """tiempo invertido en la solución: 10'40''""" ...
stack_v2_sparse_classes_36k_train_018960
2,140
no_license
[ { "docstring": "tiempo invertido en la solución: 10'40''", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, st: str) -> int" }, { "docstring": "he hecho este ejercicio sin mirar la resolución anterior ha salido casi igual, bastante impresionante cómo he progra...
2
null
Implement the Python class `Solution` described below. Class description: Given a string, find the length of the longest substring without repeating characters. https://leetcode.com/problems/longest-substring-without-repeating-characters/ Method signatures and docstrings: - def lengthOfLongestSubstring(self, st: str)...
Implement the Python class `Solution` described below. Class description: Given a string, find the length of the longest substring without repeating characters. https://leetcode.com/problems/longest-substring-without-repeating-characters/ Method signatures and docstrings: - def lengthOfLongestSubstring(self, st: str)...
d4d44e6dfd3df4cb47b855ad30e6849038cea0a5
<|skeleton|> class Solution: """Given a string, find the length of the longest substring without repeating characters. https://leetcode.com/problems/longest-substring-without-repeating-characters/""" def lengthOfLongestSubstring(self, st: str) -> int: """tiempo invertido en la solución: 10'40''""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """Given a string, find the length of the longest substring without repeating characters. https://leetcode.com/problems/longest-substring-without-repeating-characters/""" def lengthOfLongestSubstring(self, st: str) -> int: """tiempo invertido en la solución: 10'40''""" s = set()...
the_stack_v2_python_sparse
leetcode/amazon/arrays_and_strings/longest-substring-without-repeating-characters.py
alvaronaschez/amazon
train
0
27a9995676b055c0fdbef5c2fb8df0007d6e5e67
[ "super().__init__()\nself.blocks = len(rnns)\nfor index, (rnn, deconvrelu) in enumerate(zip(rnns, deconvrelus), 1):\n setattr(self, 'rnn' + str(index), rnn)\n setattr(self, 'deconvrelu' + str(index), deconvrelu)\nself.output_layer = cnn", "if len(inputs) > 0:\n inputs = inputs.transpose(0, 1)\ncur_deconv...
<|body_start_0|> super().__init__() self.blocks = len(rnns) for index, (rnn, deconvrelu) in enumerate(zip(rnns, deconvrelus), 1): setattr(self, 'rnn' + str(index), rnn) setattr(self, 'deconvrelu' + str(index), deconvrelu) self.output_layer = cnn <|end_body_0|> <|...
decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and then to another convlstm cell, so on so forth. Finally, the inputs will go throug...
Decoder_pro
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder_pro: """decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and then to another convlstm cell, so on so fo...
stack_v2_sparse_classes_36k_train_018961
41,120
no_license
[ { "docstring": "rnns are a list of convlstm cells, deconvrelus are a list of deconvrelu cells and cnn is a convcell", "name": "__init__", "signature": "def __init__(self, rnns, deconvrelus, cnn)" }, { "docstring": "forward pass of the decoder_pro :param seq_len: how long the sequence is decoded ...
2
stack_v2_sparse_classes_30k_train_002264
Implement the Python class `Decoder_pro` described below. Class description: decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and the...
Implement the Python class `Decoder_pro` described below. Class description: decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and the...
b6a3161635bfa3b5da8ec871e1025e01f878e732
<|skeleton|> class Decoder_pro: """decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and then to another convlstm cell, so on so fo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Decoder_pro: """decode a sequence given an initial tuple of hidden states and cell states It consists of multiple (convlstm, deconvrelu) pairs and one convcell. The inputs will first pass through an convlstm cell, then pass through a deconvrelu cell, and then to another convlstm cell, so on so forth. Finally,...
the_stack_v2_python_sparse
src/bayesian_neural_net.py
KEHUIYAO/BCLS
train
0
98cdd48549f2caf0b11882e826abf723c2e1130c
[ "def getMinutes(time):\n return int(time[:2]) * 60 + int(time[3:])\nslots = [False] * (24 * 60 + 1)\nfirst, last = (2 ** 31 - 1, -2 ** 31)\nfor time in timePoints:\n minutes = getMinutes(time)\n if slots[minutes]:\n return 0\n else:\n slots[minutes] = True\n first = min(first, minut...
<|body_start_0|> def getMinutes(time): return int(time[:2]) * 60 + int(time[3:]) slots = [False] * (24 * 60 + 1) first, last = (2 ** 31 - 1, -2 ** 31) for time in timePoints: minutes = getMinutes(time) if slots[minutes]: return 0 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_0|> def findMinDifference2(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> def getM...
stack_v2_sparse_classes_36k_train_018962
2,141
no_license
[ { "docstring": ":type timePoints: List[str] :rtype: int", "name": "findMinDifference", "signature": "def findMinDifference(self, timePoints)" }, { "docstring": ":type timePoints: List[str] :rtype: int", "name": "findMinDifference2", "signature": "def findMinDifference2(self, timePoints)"...
2
stack_v2_sparse_classes_30k_train_014563
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinDifference(self, timePoints): :type timePoints: List[str] :rtype: int - def findMinDifference2(self, timePoints): :type timePoints: List[str] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findMinDifference(self, timePoints): :type timePoints: List[str] :rtype: int - def findMinDifference2(self, timePoints): :type timePoints: List[str] :rtype: int <|skeleton|>...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_0|> def findMinDifference2(self, timePoints): """:type timePoints: List[str] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def findMinDifference(self, timePoints): """:type timePoints: List[str] :rtype: int""" def getMinutes(time): return int(time[:2]) * 60 + int(time[3:]) slots = [False] * (24 * 60 + 1) first, last = (2 ** 31 - 1, -2 ** 31) for time in timePoints: ...
the_stack_v2_python_sparse
code539MinimumTimeDifference.py
cybelewang/leetcode-python
train
0
74b76d5f3a141a0d90afeecd51eefe633230f1dd
[ "self.degree = degree\nself.gamma = gamma\nself.coef0 = coef0\nif degree <= 0:\n raise ValueError('KPoly needs positive degree')\nif not np.allclose(degree, int(degree)):\n raise ValueError('KPoly needs integral degree')", "dot = np.dot(X, Y.T)\ngamma = 1 / X.shape[1] if self.gamma is None else self.gamma\n...
<|body_start_0|> self.degree = degree self.gamma = gamma self.coef0 = coef0 if degree <= 0: raise ValueError('KPoly needs positive degree') if not np.allclose(degree, int(degree)): raise ValueError('KPoly needs integral degree') <|end_body_0|> <|body_star...
KPoly
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KPoly: def __init__(self, degree=3, gamma=None, coef0=1): """Polynomial kernel (gamma X^T Y + coef0)^degree degree: default 3 gamma: default 1/dim coef0: float, default 1""" <|body_0|> def eval(self, X, Y): """Evaluate the kernel on data X and Y X: nx x d where each ...
stack_v2_sparse_classes_36k_train_018963
22,155
permissive
[ { "docstring": "Polynomial kernel (gamma X^T Y + coef0)^degree degree: default 3 gamma: default 1/dim coef0: float, default 1", "name": "__init__", "signature": "def __init__(self, degree=3, gamma=None, coef0=1)" }, { "docstring": "Evaluate the kernel on data X and Y X: nx x d where each row rep...
6
stack_v2_sparse_classes_30k_train_016590
Implement the Python class `KPoly` described below. Class description: Implement the KPoly class. Method signatures and docstrings: - def __init__(self, degree=3, gamma=None, coef0=1): Polynomial kernel (gamma X^T Y + coef0)^degree degree: default 3 gamma: default 1/dim coef0: float, default 1 - def eval(self, X, Y):...
Implement the Python class `KPoly` described below. Class description: Implement the KPoly class. Method signatures and docstrings: - def __init__(self, degree=3, gamma=None, coef0=1): Polynomial kernel (gamma X^T Y + coef0)^degree degree: default 3 gamma: default 1/dim coef0: float, default 1 - def eval(self, X, Y):...
039a95ed9d8062e283da6bd051b7161a190b4876
<|skeleton|> class KPoly: def __init__(self, degree=3, gamma=None, coef0=1): """Polynomial kernel (gamma X^T Y + coef0)^degree degree: default 3 gamma: default 1/dim coef0: float, default 1""" <|body_0|> def eval(self, X, Y): """Evaluate the kernel on data X and Y X: nx x d where each ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KPoly: def __init__(self, degree=3, gamma=None, coef0=1): """Polynomial kernel (gamma X^T Y + coef0)^degree degree: default 3 gamma: default 1/dim coef0: float, default 1""" self.degree = degree self.gamma = gamma self.coef0 = coef0 if degree <= 0: raise Val...
the_stack_v2_python_sparse
kgof/kernel.py
wittawatj/kernel-gof
train
69
53eed50e3576927dfded512dddabc2d80b5f06ea
[ "self.request = request\nself.namespace = namespace\nself.name = name\nself.args = args\nself.kwargs = kwargs\nself.nameinfo = '%s:%s' % (self.namespace, self.name)", "base_url = reverse(self.nameinfo, args=self.args, kwargs=self.kwargs)\nif not self.request.GET:\n url = base_url\nelse:\n param = self.reque...
<|body_start_0|> self.request = request self.namespace = namespace self.name = name self.args = args self.kwargs = kwargs self.nameinfo = '%s:%s' % (self.namespace, self.name) <|end_body_0|> <|body_start_1|> base_url = reverse(self.nameinfo, args=self.args, kwarg...
保留原搜索条件
ParseUrl
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParseUrl: """保留原搜索条件""" def __init__(self, request, namespace, name, *args, **kwargs): """:param request: URL 的request :param namespace: URL 的namespace :param name: URL的别名 :param args: 默认传参 :param kwargs: 默认传参""" <|body_0|> def memory_reverse_url(self): """保留搜索的u...
stack_v2_sparse_classes_36k_train_018964
1,630
no_license
[ { "docstring": ":param request: URL 的request :param namespace: URL 的namespace :param name: URL的别名 :param args: 默认传参 :param kwargs: 默认传参", "name": "__init__", "signature": "def __init__(self, request, namespace, name, *args, **kwargs)" }, { "docstring": "保留搜索的url参数到新的页面 :return:", "name": "me...
3
null
Implement the Python class `ParseUrl` described below. Class description: 保留原搜索条件 Method signatures and docstrings: - def __init__(self, request, namespace, name, *args, **kwargs): :param request: URL 的request :param namespace: URL 的namespace :param name: URL的别名 :param args: 默认传参 :param kwargs: 默认传参 - def memory_reve...
Implement the Python class `ParseUrl` described below. Class description: 保留原搜索条件 Method signatures and docstrings: - def __init__(self, request, namespace, name, *args, **kwargs): :param request: URL 的request :param namespace: URL 的namespace :param name: URL的别名 :param args: 默认传参 :param kwargs: 默认传参 - def memory_reve...
6e1ab7f217d9bf9aa7801266dee7ab4d7a602b9f
<|skeleton|> class ParseUrl: """保留原搜索条件""" def __init__(self, request, namespace, name, *args, **kwargs): """:param request: URL 的request :param namespace: URL 的namespace :param name: URL的别名 :param args: 默认传参 :param kwargs: 默认传参""" <|body_0|> def memory_reverse_url(self): """保留搜索的u...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParseUrl: """保留原搜索条件""" def __init__(self, request, namespace, name, *args, **kwargs): """:param request: URL 的request :param namespace: URL 的namespace :param name: URL的别名 :param args: 默认传参 :param kwargs: 默认传参""" self.request = request self.namespace = namespace self.name ...
the_stack_v2_python_sparse
seventh_module/CRM/30.rbac以及stark个人总结/6.parse_url.py
ryan-yang-2049/oldboy_python_study
train
0
5b27f794883ed18b0c95360e6ea778cb50d750a2
[ "preorder = []\ninorder = []\n\ndef traverse(root):\n if root is None:\n return\n preorder.append(root.val)\n traverse(root.left)\n inorder.append(root.val)\n traverse(root.right)\ntraverse(root)\nres = ','.join([str(val) for val in preorder]) + '||' + ','.join([str(val) for val in inorder])\n...
<|body_start_0|> preorder = [] inorder = [] def traverse(root): if root is None: return preorder.append(root.val) traverse(root.left) inorder.append(root.val) traverse(root.right) traverse(root) res = ',...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_018965
6,926
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_004206
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:...
0821af55eca60084b503b5f751301048c55e4381
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" preorder = [] inorder = [] def traverse(root): if root is None: return preorder.append(root.val) traverse(root.left) ...
the_stack_v2_python_sparse
Hard/LC297.py
shuowenwei/LeetCodePython
train
2
c3e4902463e127b3c9d5734b2998f09d5c1f1507
[ "super(ResConfigSettings, self).set_values()\nselect_type = self.env['ir.config_parameter'].sudo()\nif self.responsible_report_person_id:\n select_type.set_param('res.config.settings.responsible_report_person_id', self.responsible_report_person_id.id)\nelse:\n select_type.set_param('res.config.settings.respon...
<|body_start_0|> super(ResConfigSettings, self).set_values() select_type = self.env['ir.config_parameter'].sudo() if self.responsible_report_person_id: select_type.set_param('res.config.settings.responsible_report_person_id', self.responsible_report_person_id.id) else: ...
ResConfigSettings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResConfigSettings: def set_values(self): """:Author:Bhavesh Jadav TechUltra Solutions :Date:23/09/2020 :Func:This method use for the set values of the responsible_report_person_id in res.config.settings :Return:N/A""" <|body_0|> def get_values(self): """:Author:Bhave...
stack_v2_sparse_classes_36k_train_018966
1,722
no_license
[ { "docstring": ":Author:Bhavesh Jadav TechUltra Solutions :Date:23/09/2020 :Func:This method use for the set values of the responsible_report_person_id in res.config.settings :Return:N/A", "name": "set_values", "signature": "def set_values(self)" }, { "docstring": ":Author:Bhavesh Jadav TechUltr...
2
stack_v2_sparse_classes_30k_train_000337
Implement the Python class `ResConfigSettings` described below. Class description: Implement the ResConfigSettings class. Method signatures and docstrings: - def set_values(self): :Author:Bhavesh Jadav TechUltra Solutions :Date:23/09/2020 :Func:This method use for the set values of the responsible_report_person_id in...
Implement the Python class `ResConfigSettings` described below. Class description: Implement the ResConfigSettings class. Method signatures and docstrings: - def set_values(self): :Author:Bhavesh Jadav TechUltra Solutions :Date:23/09/2020 :Func:This method use for the set values of the responsible_report_person_id in...
2ea290a8a9d80f89a9cbd97ac46670541e32aab4
<|skeleton|> class ResConfigSettings: def set_values(self): """:Author:Bhavesh Jadav TechUltra Solutions :Date:23/09/2020 :Func:This method use for the set values of the responsible_report_person_id in res.config.settings :Return:N/A""" <|body_0|> def get_values(self): """:Author:Bhave...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResConfigSettings: def set_values(self): """:Author:Bhavesh Jadav TechUltra Solutions :Date:23/09/2020 :Func:This method use for the set values of the responsible_report_person_id in res.config.settings :Return:N/A""" super(ResConfigSettings, self).set_values() select_type = self.env['...
the_stack_v2_python_sparse
employee_report_request/models/res_config.py
hassanfadl/eastern_national
train
0
57a4643207823d0250e9524126b25f1d27aa1fa2
[ "self.config = config_\nself.logger = logging.getLogger('cuda_logger')\nself.data_exporter = DataExporter(self.config)", "self.logger.info('Starting job: RunRLTrainingJob\\n')\nself.logger.info('RL training parameters:')\npp = pprint.PrettyPrinter(indent=4)\nself.logger.info(pp.pprint(self.config['RL_parameters']...
<|body_start_0|> self.config = config_ self.logger = logging.getLogger('cuda_logger') self.data_exporter = DataExporter(self.config) <|end_body_0|> <|body_start_1|> self.logger.info('Starting job: RunRLTrainingJob\n') self.logger.info('RL training parameters:') pp = ppri...
This class implements a job to run the RL training
RunRLTrainingJob
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunRLTrainingJob: """This class implements a job to run the RL training""" def __init__(self, config_): """Constructor :param config_: :return:""" <|body_0|> def run(self): """This method executes the job :param: :return:""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_36k_train_018967
1,908
no_license
[ { "docstring": "Constructor :param config_: :return:", "name": "__init__", "signature": "def __init__(self, config_)" }, { "docstring": "This method executes the job :param: :return:", "name": "run", "signature": "def run(self)" } ]
2
stack_v2_sparse_classes_30k_train_003111
Implement the Python class `RunRLTrainingJob` described below. Class description: This class implements a job to run the RL training Method signatures and docstrings: - def __init__(self, config_): Constructor :param config_: :return: - def run(self): This method executes the job :param: :return:
Implement the Python class `RunRLTrainingJob` described below. Class description: This class implements a job to run the RL training Method signatures and docstrings: - def __init__(self, config_): Constructor :param config_: :return: - def run(self): This method executes the job :param: :return: <|skeleton|> class ...
f7fcd2cc1d6ba18b199d176d4d39193f025ee281
<|skeleton|> class RunRLTrainingJob: """This class implements a job to run the RL training""" def __init__(self, config_): """Constructor :param config_: :return:""" <|body_0|> def run(self): """This method executes the job :param: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunRLTrainingJob: """This class implements a job to run the RL training""" def __init__(self, config_): """Constructor :param config_: :return:""" self.config = config_ self.logger = logging.getLogger('cuda_logger') self.data_exporter = DataExporter(self.config) def r...
the_stack_v2_python_sparse
learn_to_earn_framework/jobs/rl_training.py
transparent-framework/optimize-ride-sharing-earnings
train
7
6749614ab2182e2aa4b8bee6b0f5303da0323e14
[ "self.host = host\nself.host_port = host_port\nself.storage_path = storage_path\nself.storage_count = storage_count\nself.default_chunk_size = default_size\nself.default_file_size = default_file_size\nself.chunk_sizes = chunk_sizes\nself.file_sizes = file_sizes\nself.monitor_poll_period = monitor_poll_period\nself....
<|body_start_0|> self.host = host self.host_port = host_port self.storage_path = storage_path self.storage_count = storage_count self.default_chunk_size = default_size self.default_file_size = default_file_size self.chunk_sizes = chunk_sizes self.file_size...
This class pairs with a yaml file for the client configuration. The file will be loaded and converted into an instance of this.
ClientConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClientConfig: """This class pairs with a yaml file for the client configuration. The file will be loaded and converted into an instance of this.""" def __init__(self, host, host_port, storage_path, storage_count, default_chunk_size, default_file_size, chunk_sizes, file_sizes, monitor_poll_pe...
stack_v2_sparse_classes_36k_train_018968
3,059
no_license
[ { "docstring": "Initializes a ClientConfig with: Args: host: The server ip. host_port: The server port. storage_path: Path to save consumer files. storage_count: Number of consumer instances. default_chunk_size: Size of chunks to write to file. default_file_size: Total size of file before rolling over. chunk_si...
2
stack_v2_sparse_classes_30k_train_013454
Implement the Python class `ClientConfig` described below. Class description: This class pairs with a yaml file for the client configuration. The file will be loaded and converted into an instance of this. Method signatures and docstrings: - def __init__(self, host, host_port, storage_path, storage_count, default_chu...
Implement the Python class `ClientConfig` described below. Class description: This class pairs with a yaml file for the client configuration. The file will be loaded and converted into an instance of this. Method signatures and docstrings: - def __init__(self, host, host_port, storage_path, storage_count, default_chu...
e2b7136c7feda4deb667bd1e6cba3c1ef7eeff9d
<|skeleton|> class ClientConfig: """This class pairs with a yaml file for the client configuration. The file will be loaded and converted into an instance of this.""" def __init__(self, host, host_port, storage_path, storage_count, default_chunk_size, default_file_size, chunk_sizes, file_sizes, monitor_poll_pe...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClientConfig: """This class pairs with a yaml file for the client configuration. The file will be loaded and converted into an instance of this.""" def __init__(self, host, host_port, storage_path, storage_count, default_chunk_size, default_file_size, chunk_sizes, file_sizes, monitor_poll_period, runtime...
the_stack_v2_python_sparse
client/config.py
NickBayard/sf
train
0
091053e1113f2dab7c3875490c049cf3ace73df9
[ "name = utils.get_args_raw(message)\nreply = await message.get_reply_message()\nif reply:\n await message.edit('Скачиваем...')\n if reply.text:\n text = reply.text\n fname = f'{name or message.id + reply.id}.txt'\n file = open(fname, 'w')\n file.write(text)\n file.close()\n ...
<|body_start_0|> name = utils.get_args_raw(message) reply = await message.get_reply_message() if reply: await message.edit('Скачиваем...') if reply.text: text = reply.text fname = f'{name or message.id + reply.id}.txt' file ...
Скачать файлом реплай.
ReplyDownloaderMod
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReplyDownloaderMod: """Скачать файлом реплай.""" async def dlrcmd(self, message): """Команда .dlr <реплай на файл> <название (по желанию)> скачивает файл, либо сохраняет текст в файл на который был сделан реплай.""" <|body_0|> async def ulfcmd(self, message): """...
stack_v2_sparse_classes_36k_train_018969
2,550
no_license
[ { "docstring": "Команда .dlr <реплай на файл> <название (по желанию)> скачивает файл, либо сохраняет текст в файл на который был сделан реплай.", "name": "dlrcmd", "signature": "async def dlrcmd(self, message)" }, { "docstring": "Команда .ulf <d>* <название файла> отправляет файл в чат. * - удал...
2
stack_v2_sparse_classes_30k_train_007096
Implement the Python class `ReplyDownloaderMod` described below. Class description: Скачать файлом реплай. Method signatures and docstrings: - async def dlrcmd(self, message): Команда .dlr <реплай на файл> <название (по желанию)> скачивает файл, либо сохраняет текст в файл на который был сделан реплай. - async def ul...
Implement the Python class `ReplyDownloaderMod` described below. Class description: Скачать файлом реплай. Method signatures and docstrings: - async def dlrcmd(self, message): Команда .dlr <реплай на файл> <название (по желанию)> скачивает файл, либо сохраняет текст в файл на который был сделан реплай. - async def ul...
a29db28872a452fcc48445279aff58e676dd0e3c
<|skeleton|> class ReplyDownloaderMod: """Скачать файлом реплай.""" async def dlrcmd(self, message): """Команда .dlr <реплай на файл> <название (по желанию)> скачивает файл, либо сохраняет текст в файл на который был сделан реплай.""" <|body_0|> async def ulfcmd(self, message): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReplyDownloaderMod: """Скачать файлом реплай.""" async def dlrcmd(self, message): """Команда .dlr <реплай на файл> <название (по желанию)> скачивает файл, либо сохраняет текст в файл на который был сделан реплай.""" name = utils.get_args_raw(message) reply = await message.get_repl...
the_stack_v2_python_sparse
replydownloader.py
Fl1yd/FTG-Modules
train
6
b4fc4fa1a936e3121e5be633dcf1cb9b395c406a
[ "params = super().get_default_params(with_embedding=True)\nparams.add(engine.Param(name='dropout_rate', value=0.1, desc='The dropout rate.'))\nparams.add(engine.Param(name='num_layers', value=2, desc='Number of hidden layers in the MLP layer.'))\nparams.add(engine.Param(name='hidden_sizes', value=[30, 30], desc='Nu...
<|body_start_0|> params = super().get_default_params(with_embedding=True) params.add(engine.Param(name='dropout_rate', value=0.1, desc='The dropout rate.')) params.add(engine.Param(name='num_layers', value=2, desc='Number of hidden layers in the MLP layer.')) params.add(engine.Param(name...
ANMM Model. Examples: >>> model = ANMM() >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build()
ANMM
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ANMM: """ANMM Model. Examples: >>> model = ANMM() >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build()""" def get_default_params(cls) -> engine.ParamTable: """:return: model default parameters.""" <|body_0|> def build(self): """Build model structu...
stack_v2_sparse_classes_36k_train_018970
2,579
permissive
[ { "docstring": ":return: model default parameters.", "name": "get_default_params", "signature": "def get_default_params(cls) -> engine.ParamTable" }, { "docstring": "Build model structure. aNMM model based on bin weighting and query term attentions", "name": "build", "signature": "def bu...
2
stack_v2_sparse_classes_30k_train_014784
Implement the Python class `ANMM` described below. Class description: ANMM Model. Examples: >>> model = ANMM() >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() Method signatures and docstrings: - def get_default_params(cls) -> engine.ParamTable: :return: model default parameters. - def build(self)...
Implement the Python class `ANMM` described below. Class description: ANMM Model. Examples: >>> model = ANMM() >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build() Method signatures and docstrings: - def get_default_params(cls) -> engine.ParamTable: :return: model default parameters. - def build(self)...
1fe2afca7bc2aa0fd8af8f80df84a2665367d13c
<|skeleton|> class ANMM: """ANMM Model. Examples: >>> model = ANMM() >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build()""" def get_default_params(cls) -> engine.ParamTable: """:return: model default parameters.""" <|body_0|> def build(self): """Build model structu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ANMM: """ANMM Model. Examples: >>> model = ANMM() >>> model.guess_and_fill_missing_params(verbose=0) >>> model.build()""" def get_default_params(cls) -> engine.ParamTable: """:return: model default parameters.""" params = super().get_default_params(with_embedding=True) params.add(...
the_stack_v2_python_sparse
matchzoo/models/anmm.py
zhanzecheng/MatchZoo
train
2
fe6cbb95a08bb8c16bbf45ccbe70576343ec51a9
[ "r = s[::-1]\nfor i in range(len(s) + 1):\n if s.startswith(r[i:]):\n return r[:i] + s", "if not s or len(s) == 1:\n return s\nj = 0\nfor i in reversed(range(len(s))):\n if s[i] == s[j]:\n j += 1\nreturn s[::-1][:len(s) - j] + self.shortestPalindrome_1(s[:j - len(s)]) + s[j - len(s):]" ]
<|body_start_0|> r = s[::-1] for i in range(len(s) + 1): if s.startswith(r[i:]): return r[:i] + s <|end_body_0|> <|body_start_1|> if not s or len(s) == 1: return s j = 0 for i in reversed(range(len(s))): if s[i] == s[j]: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def shortestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def shortestPalindrome_1(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|> <|body_start_0|> r = s[::-1] for i in range(len(s) + 1): ...
stack_v2_sparse_classes_36k_train_018971
1,452
no_license
[ { "docstring": ":type s: str :rtype: str", "name": "shortestPalindrome", "signature": "def shortestPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: str", "name": "shortestPalindrome_1", "signature": "def shortestPalindrome_1(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPalindrome(self, s): :type s: str :rtype: str - def shortestPalindrome_1(self, s): :type s: str :rtype: str
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def shortestPalindrome(self, s): :type s: str :rtype: str - def shortestPalindrome_1(self, s): :type s: str :rtype: str <|skeleton|> class Solution: def shortestPalindrome(...
3d9e0ad2f6ed92ec969556f75d97c51ea4854719
<|skeleton|> class Solution: def shortestPalindrome(self, s): """:type s: str :rtype: str""" <|body_0|> def shortestPalindrome_1(self, s): """:type s: str :rtype: str""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def shortestPalindrome(self, s): """:type s: str :rtype: str""" r = s[::-1] for i in range(len(s) + 1): if s.startswith(r[i:]): return r[:i] + s def shortestPalindrome_1(self, s): """:type s: str :rtype: str""" if not s or len(...
the_stack_v2_python_sparse
Solutions/0214_shortestPalindrome.py
YoupengLi/leetcode-sorting
train
3
615790fe38c460aae7f01acb5e9e111d9a8b05aa
[ "self.titulo = titulo\nself.autores = autores\nself.editor = editor\nself.isbn = isbn\nself.precio = precio", "num = 0\nfor i in range(len(self.autores)):\n num += 1\nreturn num" ]
<|body_start_0|> self.titulo = titulo self.autores = autores self.editor = editor self.isbn = isbn self.precio = precio <|end_body_0|> <|body_start_1|> num = 0 for i in range(len(self.autores)): num += 1 return num <|end_body_1|>
Información acerca de un libro, incluye título, lista de autores, editorial, ISBN y precio.
Libro
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Libro: """Información acerca de un libro, incluye título, lista de autores, editorial, ISBN y precio.""" def __init__(self, titulo, autores, editor, isbn, precio): """Construtor principal con parámetros por defecto.""" <|body_0|> def num_autores(self): """Método ...
stack_v2_sparse_classes_36k_train_018972
976
no_license
[ { "docstring": "Construtor principal con parámetros por defecto.", "name": "__init__", "signature": "def __init__(self, titulo, autores, editor, isbn, precio)" }, { "docstring": "Método que cuenta el número de autores del libro y devuelve dicho número.", "name": "num_autores", "signature...
2
stack_v2_sparse_classes_30k_train_010151
Implement the Python class `Libro` described below. Class description: Información acerca de un libro, incluye título, lista de autores, editorial, ISBN y precio. Method signatures and docstrings: - def __init__(self, titulo, autores, editor, isbn, precio): Construtor principal con parámetros por defecto. - def num_a...
Implement the Python class `Libro` described below. Class description: Información acerca de un libro, incluye título, lista de autores, editorial, ISBN y precio. Method signatures and docstrings: - def __init__(self, titulo, autores, editor, isbn, precio): Construtor principal con parámetros por defecto. - def num_a...
5b86a497a7f2337aeb9711f0500a7fc7cebc986a
<|skeleton|> class Libro: """Información acerca de un libro, incluye título, lista de autores, editorial, ISBN y precio.""" def __init__(self, titulo, autores, editor, isbn, precio): """Construtor principal con parámetros por defecto.""" <|body_0|> def num_autores(self): """Método ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Libro: """Información acerca de un libro, incluye título, lista de autores, editorial, ISBN y precio.""" def __init__(self, titulo, autores, editor, isbn, precio): """Construtor principal con parámetros por defecto.""" self.titulo = titulo self.autores = autores self.edito...
the_stack_v2_python_sparse
Sergey_Examen/ej3.py
2dam-spopov/di
train
0
9a5aa93cb21b2833ea0e5c8bc17e6ac8ca97b389
[ "assert rake is None or -180 <= rake <= 180\nif rake is None:\n return 10.0 ** (-3.49 + 0.91 * mag)\nelif -45 <= rake <= 45 or rake >= 135 or rake <= -135:\n return 10.0 ** (-3.42 + 0.9 * mag)\nelif rake > 0:\n return 10.0 ** (-3.99 + 0.98 * mag)\nelse:\n return 10.0 ** (-2.87 + 0.82 * mag)", "assert ...
<|body_start_0|> assert rake is None or -180 <= rake <= 180 if rake is None: return 10.0 ** (-3.49 + 0.91 * mag) elif -45 <= rake <= 45 or rake >= 135 or rake <= -135: return 10.0 ** (-3.42 + 0.9 * mag) elif rake > 0: return 10.0 ** (-3.99 + 0.98 * mag...
Wells and Coppersmith magnitude -- rupture area relationships, see 1994, Bull. Seism. Soc. Am., pages 974-2002. Implements both magnitude-area and area-magnitude scaling relationships.
WC1994
[ "AGPL-3.0-only", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WC1994: """Wells and Coppersmith magnitude -- rupture area relationships, see 1994, Bull. Seism. Soc. Am., pages 974-2002. Implements both magnitude-area and area-magnitude scaling relationships.""" def get_median_area(self, mag, rake): """The values are a function of both magnitude ...
stack_v2_sparse_classes_36k_train_018973
3,795
permissive
[ { "docstring": "The values are a function of both magnitude and rake. Setting the rake to ``None`` causes their \"All\" rupture-types to be applied.", "name": "get_median_area", "signature": "def get_median_area(self, mag, rake)" }, { "docstring": "Standard deviation for WC1994. Magnitude is ign...
4
null
Implement the Python class `WC1994` described below. Class description: Wells and Coppersmith magnitude -- rupture area relationships, see 1994, Bull. Seism. Soc. Am., pages 974-2002. Implements both magnitude-area and area-magnitude scaling relationships. Method signatures and docstrings: - def get_median_area(self,...
Implement the Python class `WC1994` described below. Class description: Wells and Coppersmith magnitude -- rupture area relationships, see 1994, Bull. Seism. Soc. Am., pages 974-2002. Implements both magnitude-area and area-magnitude scaling relationships. Method signatures and docstrings: - def get_median_area(self,...
0da9ba5a575360081715e8b90c71d4b16c6687c8
<|skeleton|> class WC1994: """Wells and Coppersmith magnitude -- rupture area relationships, see 1994, Bull. Seism. Soc. Am., pages 974-2002. Implements both magnitude-area and area-magnitude scaling relationships.""" def get_median_area(self, mag, rake): """The values are a function of both magnitude ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WC1994: """Wells and Coppersmith magnitude -- rupture area relationships, see 1994, Bull. Seism. Soc. Am., pages 974-2002. Implements both magnitude-area and area-magnitude scaling relationships.""" def get_median_area(self, mag, rake): """The values are a function of both magnitude and rake. Set...
the_stack_v2_python_sparse
openquake/hazardlib/scalerel/wc1994.py
GFZ-Centre-for-Early-Warning/shakyground
train
1
9457c695489ab781b08362bbade72b341cb6dc90
[ "def _enqueue(txn):\n return TestWork.reschedule(txn, delay, priority=priority, weight=weight, delay=runtime)\nreturn store.inTransaction('TestWork.schedule', _enqueue)", "log.debug('TestWork started: {jobid}', jobid=self.jobID)\nif self.delay != 0:\n wait = Deferred()\n\n def _timedDeferred():\n ...
<|body_start_0|> def _enqueue(txn): return TestWork.reschedule(txn, delay, priority=priority, weight=weight, delay=runtime) return store.inTransaction('TestWork.schedule', _enqueue) <|end_body_0|> <|body_start_1|> log.debug('TestWork started: {jobid}', jobid=self.jobID) if s...
This work item is used solely for testing purposes to allow us to simulate different types of work with varying priority, weight and notBefore, and taking a variable amount of time to complete. This will allow us to load test the job queue.
TestWork
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestWork: """This work item is used solely for testing purposes to allow us to simulate different types of work with varying priority, weight and notBefore, and taking a variable amount of time to complete. This will allow us to load test the job queue.""" def schedule(cls, store, delay, pri...
stack_v2_sparse_classes_36k_train_018974
2,684
permissive
[ { "docstring": "Create a new L{TestWork} item. @param store: the L{CommonStore} to use @type store: L{CommonStore} @param delay: seconds before work executes @type delay: L{int} @param priority: priority to use for this work @type priority: L{int} @param weight: weight to use for thus work @type weight: L{int} ...
2
null
Implement the Python class `TestWork` described below. Class description: This work item is used solely for testing purposes to allow us to simulate different types of work with varying priority, weight and notBefore, and taking a variable amount of time to complete. This will allow us to load test the job queue. Met...
Implement the Python class `TestWork` described below. Class description: This work item is used solely for testing purposes to allow us to simulate different types of work with varying priority, weight and notBefore, and taking a variable amount of time to complete. This will allow us to load test the job queue. Met...
cb2962f1f1927f1e52ea405094fa3e7e180f23cb
<|skeleton|> class TestWork: """This work item is used solely for testing purposes to allow us to simulate different types of work with varying priority, weight and notBefore, and taking a variable amount of time to complete. This will allow us to load test the job queue.""" def schedule(cls, store, delay, pri...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestWork: """This work item is used solely for testing purposes to allow us to simulate different types of work with varying priority, weight and notBefore, and taking a variable amount of time to complete. This will allow us to load test the job queue.""" def schedule(cls, store, delay, priority, weight...
the_stack_v2_python_sparse
txdav/common/datastore/work/load_work.py
ass-a2s/ccs-calendarserver
train
2
ce53712d4bb18831cbad74c8ec18ed70d25130df
[ "if root is None:\n return []\nif root.left is None and root.right is None:\n if sum == root.val:\n return [[root.val]]\n else:\n return []\nreturn [[root.val, *x] for x in self.pathSum(root.left, sum - root.val) + self.pathSum(root.right, sum - root.val)]", "def dfs(node, backtrack, summat...
<|body_start_0|> if root is None: return [] if root.left is None and root.right is None: if sum == root.val: return [[root.val]] else: return [] return [[root.val, *x] for x in self.pathSum(root.left, sum - root.val) + self.path...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pathSum(self, root, sum): """05/06/2018 21:21""" <|body_0|> def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]: """08/22/2021 22:30""" <|body_1|> def pathSum(self, root: Optional[TreeNode], targetSum: int) -> Lis...
stack_v2_sparse_classes_36k_train_018975
3,394
no_license
[ { "docstring": "05/06/2018 21:21", "name": "pathSum", "signature": "def pathSum(self, root, sum)" }, { "docstring": "08/22/2021 22:30", "name": "pathSum", "signature": "def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]" }, { "docstring": "10/22/2022 0...
3
stack_v2_sparse_classes_30k_train_015377
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, sum): 05/06/2018 21:21 - def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]: 08/22/2021 22:30 - def pathSum(self, root: Option...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pathSum(self, root, sum): 05/06/2018 21:21 - def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]: 08/22/2021 22:30 - def pathSum(self, root: Option...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def pathSum(self, root, sum): """05/06/2018 21:21""" <|body_0|> def pathSum(self, root: Optional[TreeNode], targetSum: int) -> List[List[int]]: """08/22/2021 22:30""" <|body_1|> def pathSum(self, root: Optional[TreeNode], targetSum: int) -> Lis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def pathSum(self, root, sum): """05/06/2018 21:21""" if root is None: return [] if root.left is None and root.right is None: if sum == root.val: return [[root.val]] else: return [] return [[root.val, ...
the_stack_v2_python_sparse
leetcode/solved/113_Path_Sum_II/solution.py
sungminoh/algorithms
train
0
f218a16813a9351c677fdbc7a6ebe9d0242e2284
[ "ItemTextsFormRecord._init_map(self)\nItemFilesFormRecord._init_map(self)\nsuper(ItemTextsAndFilesMixin, self)._init_map()", "ItemTextsFormRecord._init_metadata(self)\nItemFilesFormRecord._init_metadata(self)\nsuper(ItemTextsAndFilesMixin, self)._init_metadata()" ]
<|body_start_0|> ItemTextsFormRecord._init_map(self) ItemFilesFormRecord._init_map(self) super(ItemTextsAndFilesMixin, self)._init_map() <|end_body_0|> <|body_start_1|> ItemTextsFormRecord._init_metadata(self) ItemFilesFormRecord._init_metadata(self) super(ItemTextsAndFi...
Mixin class to make the two classes compatible with super() for _init_map and _init_metadata
ItemTextsAndFilesMixin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemTextsAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" <|body_0|> def _init_metadata(self): """stub""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_018976
22,562
permissive
[ { "docstring": "stub", "name": "_init_map", "signature": "def _init_map(self)" }, { "docstring": "stub", "name": "_init_metadata", "signature": "def _init_metadata(self)" } ]
2
stack_v2_sparse_classes_30k_train_007909
Implement the Python class `ItemTextsAndFilesMixin` described below. Class description: Mixin class to make the two classes compatible with super() for _init_map and _init_metadata Method signatures and docstrings: - def _init_map(self): stub - def _init_metadata(self): stub
Implement the Python class `ItemTextsAndFilesMixin` described below. Class description: Mixin class to make the two classes compatible with super() for _init_map and _init_metadata Method signatures and docstrings: - def _init_map(self): stub - def _init_metadata(self): stub <|skeleton|> class ItemTextsAndFilesMixin...
445f968a175d61c8d92c0f617a3c17dc1dc7c584
<|skeleton|> class ItemTextsAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" <|body_0|> def _init_metadata(self): """stub""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ItemTextsAndFilesMixin: """Mixin class to make the two classes compatible with super() for _init_map and _init_metadata""" def _init_map(self): """stub""" ItemTextsFormRecord._init_map(self) ItemFilesFormRecord._init_map(self) super(ItemTextsAndFilesMixin, self)._init_map(...
the_stack_v2_python_sparse
dlkit/records/assessment/basic/simple_records.py
mitsei/dlkit
train
2
b9bced417bb94b0f5be3dc9ca50660377154af44
[ "private_key = ecdsa.SigningKey.generate(curve=ecdsa.SECP256k1)\npublic_key = private_key.get_verifying_key()\nnode_base = create_nodebase(public_key.to_string())\ncipher = encrypt(seed, private_key.to_pem())\nnode_base_path = os.path.join(node_dir, mac(seed).hex())\nwith open(node_base_path, 'wb') as key_file:\n ...
<|body_start_0|> private_key = ecdsa.SigningKey.generate(curve=ecdsa.SECP256k1) public_key = private_key.get_verifying_key() node_base = create_nodebase(public_key.to_string()) cipher = encrypt(seed, private_key.to_pem()) node_base_path = os.path.join(node_dir, mac(seed).hex()) ...
address management class
Address
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Address: """address management class""" def create(cls, node_dir, seed): """create address :param node_dir: (str) directory path :param seed: (bytes) keystore password :return: tuple(nodebase, Signingkey) >>> create('./test/', b'seed') >>> return b'gBx34fb...', SigningKey()""" ...
stack_v2_sparse_classes_36k_train_018977
4,964
no_license
[ { "docstring": "create address :param node_dir: (str) directory path :param seed: (bytes) keystore password :return: tuple(nodebase, Signingkey) >>> create('./test/', b'seed') >>> return b'gBx34fb...', SigningKey()", "name": "create", "signature": "def create(cls, node_dir, seed)" }, { "docstrin...
4
stack_v2_sparse_classes_30k_train_020161
Implement the Python class `Address` described below. Class description: address management class Method signatures and docstrings: - def create(cls, node_dir, seed): create address :param node_dir: (str) directory path :param seed: (bytes) keystore password :return: tuple(nodebase, Signingkey) >>> create('./test/', ...
Implement the Python class `Address` described below. Class description: address management class Method signatures and docstrings: - def create(cls, node_dir, seed): create address :param node_dir: (str) directory path :param seed: (bytes) keystore password :return: tuple(nodebase, Signingkey) >>> create('./test/', ...
058ec0a366624d1b49f8ff9745d99455e8dfae65
<|skeleton|> class Address: """address management class""" def create(cls, node_dir, seed): """create address :param node_dir: (str) directory path :param seed: (bytes) keystore password :return: tuple(nodebase, Signingkey) >>> create('./test/', b'seed') >>> return b'gBx34fb...', SigningKey()""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Address: """address management class""" def create(cls, node_dir, seed): """create address :param node_dir: (str) directory path :param seed: (bytes) keystore password :return: tuple(nodebase, Signingkey) >>> create('./test/', b'seed') >>> return b'gBx34fb...', SigningKey()""" private_key...
the_stack_v2_python_sparse
utils/address.py
GbrickPlatform/gbrick
train
0
27446b7a109f296100c0a523f8a2cd544faa817e
[ "data = super(DateTimeBaseControl, self).parse(args)\nvalue = data[self.name]\nif value is not None:\n for fmt in self.formats:\n try:\n tm = time.strptime(value, fmt)\n break\n except ValueError:\n pass\n else:\n m = tr('Illegal format for field: %s') % t...
<|body_start_0|> data = super(DateTimeBaseControl, self).parse(args) value = data[self.name] if value is not None: for fmt in self.formats: try: tm = time.strptime(value, fmt) break except ValueError: ...
Date base control. This is a base class for all date, time and datetime controls.
DateTimeBaseControl
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DateTimeBaseControl: """Date base control. This is a base class for all date, time and datetime controls.""" def parse(self, args): """Parse `args' to Python format.""" <|body_0|> def unparse(self, object): """Parse `object' to string format.""" <|body_1|...
stack_v2_sparse_classes_36k_train_018978
12,353
permissive
[ { "docstring": "Parse `args' to Python format.", "name": "parse", "signature": "def parse(self, args)" }, { "docstring": "Parse `object' to string format.", "name": "unparse", "signature": "def unparse(self, object)" } ]
2
null
Implement the Python class `DateTimeBaseControl` described below. Class description: Date base control. This is a base class for all date, time and datetime controls. Method signatures and docstrings: - def parse(self, args): Parse `args' to Python format. - def unparse(self, object): Parse `object' to string format.
Implement the Python class `DateTimeBaseControl` described below. Class description: Date base control. This is a base class for all date, time and datetime controls. Method signatures and docstrings: - def parse(self, args): Parse `args' to Python format. - def unparse(self, object): Parse `object' to string format....
3a533d3158860102866eaf603840691618f39f81
<|skeleton|> class DateTimeBaseControl: """Date base control. This is a base class for all date, time and datetime controls.""" def parse(self, args): """Parse `args' to Python format.""" <|body_0|> def unparse(self, object): """Parse `object' to string format.""" <|body_1|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DateTimeBaseControl: """Date base control. This is a base class for all date, time and datetime controls.""" def parse(self, args): """Parse `args' to Python format.""" data = super(DateTimeBaseControl, self).parse(args) value = data[self.name] if value is not None: ...
the_stack_v2_python_sparse
draco2/form/control.py
geertj/draco2
train
0
f05d13978cca7829f393a6088c65c16c1fbe5d0a
[ "logging.debug('%s', request)\n_, result = get_request_and_result(request.task_id)\nreturn message_conversion.task_result_to_rpc(result, request.include_performance_stats)", "logging.debug('%s', request)\nrequest_obj, _ = get_request_and_result(request.task_id)\nreturn message_conversion.task_request_to_rpc(reque...
<|body_start_0|> logging.debug('%s', request) _, result = get_request_and_result(request.task_id) return message_conversion.task_result_to_rpc(result, request.include_performance_stats) <|end_body_0|> <|body_start_1|> logging.debug('%s', request) request_obj, _ = get_request_and...
Swarming's task-related API.
SwarmingTaskService
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SwarmingTaskService: """Swarming's task-related API.""" def result(self, request): """Reports the result of the task corresponding to a task ID. It can be a 'run' ID specifying a specific retry or a 'summary' ID hidding the fact that a task may have been retried transparently, when a...
stack_v2_sparse_classes_36k_train_018979
31,178
permissive
[ { "docstring": "Reports the result of the task corresponding to a task ID. It can be a 'run' ID specifying a specific retry or a 'summary' ID hidding the fact that a task may have been retried transparently, when a bot reports BOT_DIED. A summary ID ends with '0', a run ID ends with '1' or '2'.", "name": "r...
4
stack_v2_sparse_classes_30k_val_000028
Implement the Python class `SwarmingTaskService` described below. Class description: Swarming's task-related API. Method signatures and docstrings: - def result(self, request): Reports the result of the task corresponding to a task ID. It can be a 'run' ID specifying a specific retry or a 'summary' ID hidding the fac...
Implement the Python class `SwarmingTaskService` described below. Class description: Swarming's task-related API. Method signatures and docstrings: - def result(self, request): Reports the result of the task corresponding to a task ID. It can be a 'run' ID specifying a specific retry or a 'summary' ID hidding the fac...
3fa4c520dddd82ed190152709e0a54b35faa3bae
<|skeleton|> class SwarmingTaskService: """Swarming's task-related API.""" def result(self, request): """Reports the result of the task corresponding to a task ID. It can be a 'run' ID specifying a specific retry or a 'summary' ID hidding the fact that a task may have been retried transparently, when a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SwarmingTaskService: """Swarming's task-related API.""" def result(self, request): """Reports the result of the task corresponding to a task ID. It can be a 'run' ID specifying a specific retry or a 'summary' ID hidding the fact that a task may have been retried transparently, when a bot reports ...
the_stack_v2_python_sparse
appengine/swarming/handlers_endpoints.py
Slayo2008/New2
train
1
7821f9731758664f91ed28101a4ac3279495276e
[ "temp_feature_keys = column_values\nkeys_features_length = len(temp_feature_keys)\nvariables_length = len(variables)\nfeature_keys = []\nfor i in range(keys_features_length * variables_length):\n quotient = int(i / keys_features_length)\n feature_keys.append(self.variables[quotient] + '_' + temp_feature_keys[...
<|body_start_0|> temp_feature_keys = column_values keys_features_length = len(temp_feature_keys) variables_length = len(variables) feature_keys = [] for i in range(keys_features_length * variables_length): quotient = int(i / keys_features_length) feature_k...
A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier.
FeatureEngineering
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureEngineering: """A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier.""" def _construct_feature_keys(self, column_values, variables): """Get the column values o...
stack_v2_sparse_classes_36k_train_018980
3,951
no_license
[ { "docstring": "Get the column values of one of the variables and since they are the same for all the variables because of tsfresh it expands the features by prepending the name of the variable. Parameters ---------- column_values: list A list with the values of the keys returned by tsfresh Returns ------- feat...
2
stack_v2_sparse_classes_30k_train_003080
Implement the Python class `FeatureEngineering` described below. Class description: A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier. Method signatures and docstrings: - def _construct_feature_keys...
Implement the Python class `FeatureEngineering` described below. Class description: A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier. Method signatures and docstrings: - def _construct_feature_keys...
d7e42676b64d177ded11d4731e11130c129d477b
<|skeleton|> class FeatureEngineering: """A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier.""" def _construct_feature_keys(self, column_values, variables): """Get the column values o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureEngineering: """A class that does feature engineering by using the tsfresh package. It also extract the feature keys in order to be able to see the importances of the XGBoost classifier.""" def _construct_feature_keys(self, column_values, variables): """Get the column values of one of the ...
the_stack_v2_python_sparse
code/classification/feature_engineering.py
mcbuehler/ssw-prediction
train
1
9ff5c1cc53d609e2729b3e61fd0dd7faddc563c9
[ "char_count = {}\nfor c in s:\n char_count[c] = char_count.get(c, 0) + 1\nmax_odd = 1\nmax_pal_len = 0\nhas_max_odd = False\nfor word in char_count:\n if char_count[word] % 2 == 0:\n max_pal_len += char_count[word]\n elif char_count[word] >= max_odd:\n has_max_odd = True\n max_pal_len ...
<|body_start_0|> char_count = {} for c in s: char_count[c] = char_count.get(c, 0) + 1 max_odd = 1 max_pal_len = 0 has_max_odd = False for word in char_count: if char_count[word] % 2 == 0: max_pal_len += char_count[word] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def longestPalindrome1(self, s): """:type s: str :rtype: int""" <|body_0|> def longestPalindrome(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> char_count = {} for c in s: char_cou...
stack_v2_sparse_classes_36k_train_018981
1,678
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "longestPalindrome1", "signature": "def longestPalindrome1(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "longestPalindrome", "signature": "def longestPalindrome(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_008040
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome1(self, s): :type s: str :rtype: int - def longestPalindrome(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def longestPalindrome1(self, s): :type s: str :rtype: int - def longestPalindrome(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def longestPalindrome1(sel...
852fad258f5070c7b93c35252f7404e85e709ea6
<|skeleton|> class Solution: def longestPalindrome1(self, s): """:type s: str :rtype: int""" <|body_0|> def longestPalindrome(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def longestPalindrome1(self, s): """:type s: str :rtype: int""" char_count = {} for c in s: char_count[c] = char_count.get(c, 0) + 1 max_odd = 1 max_pal_len = 0 has_max_odd = False for word in char_count: if char_count[w...
the_stack_v2_python_sparse
401-500/409. Longest Palindrome.py
SunnyMarkLiu/LeetCode
train
1
3e9ec4b03d342eeccacfef72c5a9b35ab1b56fe5
[ "self.client.force_login(self.team2_admin)\nresponse = self.client.get(self.detail_url)\nself.assertContains(response, self.team2_category3, status_code=200)\nself.assertContains(response, self.team2_category3.description)", "self.client.force_login(self.team2_member)\nresponse = self.client.get(self.detail_url)\...
<|body_start_0|> self.client.force_login(self.team2_admin) response = self.client.get(self.detail_url) self.assertContains(response, self.team2_category3, status_code=200) self.assertContains(response, self.team2_category3.description) <|end_body_0|> <|body_start_1|> self.client...
Test CategoryDetailView
CategoryDetailViewTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoryDetailViewTest: """Test CategoryDetailView""" def test_category_detail_admin(self): """Assert that category details are shown to an admin""" <|body_0|> def test_category_detail_member(self): """Assert that category details are shown to a regular member"""...
stack_v2_sparse_classes_36k_train_018982
9,408
permissive
[ { "docstring": "Assert that category details are shown to an admin", "name": "test_category_detail_admin", "signature": "def test_category_detail_admin(self)" }, { "docstring": "Assert that category details are shown to a regular member", "name": "test_category_detail_member", "signature...
3
stack_v2_sparse_classes_30k_train_020645
Implement the Python class `CategoryDetailViewTest` described below. Class description: Test CategoryDetailView Method signatures and docstrings: - def test_category_detail_admin(self): Assert that category details are shown to an admin - def test_category_detail_member(self): Assert that category details are shown t...
Implement the Python class `CategoryDetailViewTest` described below. Class description: Test CategoryDetailView Method signatures and docstrings: - def test_category_detail_admin(self): Assert that category details are shown to an admin - def test_category_detail_member(self): Assert that category details are shown t...
b3a61462d46d33de25fb96c029b2bd822001b669
<|skeleton|> class CategoryDetailViewTest: """Test CategoryDetailView""" def test_category_detail_admin(self): """Assert that category details are shown to an admin""" <|body_0|> def test_category_detail_member(self): """Assert that category details are shown to a regular member"""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CategoryDetailViewTest: """Test CategoryDetailView""" def test_category_detail_admin(self): """Assert that category details are shown to an admin""" self.client.force_login(self.team2_admin) response = self.client.get(self.detail_url) self.assertContains(response, self.tea...
the_stack_v2_python_sparse
src/category/tests.py
tykling/socialrating
train
3
2aa874954d79b47a58d8721ca782d61072a1e82a
[ "instance_dict = db.to_dict(self)\nfor key, val in instance_dict.items():\n instance_dict[key] = property_to_json(val)\ninstance_dict['key'] = str(self.key())\nif encode:\n return json.dumps(instance_dict)\nelse:\n return instance_dict", "if isinstance(value, basestring):\n json_dict = json.loads(valu...
<|body_start_0|> instance_dict = db.to_dict(self) for key, val in instance_dict.items(): instance_dict[key] = property_to_json(val) instance_dict['key'] = str(self.key()) if encode: return json.dumps(instance_dict) else: return instance_dict <|...
Adding these Mixins to your model class will allow serialisation/deserialisation of your model instances.
JSONMixins
[ "ISC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JSONMixins: """Adding these Mixins to your model class will allow serialisation/deserialisation of your model instances.""" def get_json(self, encode=True): """Build and return a JSON representation of our model""" <|body_0|> def set_json(self, value): """Convert...
stack_v2_sparse_classes_36k_train_018983
1,738
permissive
[ { "docstring": "Build and return a JSON representation of our model", "name": "get_json", "signature": "def get_json(self, encode=True)" }, { "docstring": "Convert a dictionary or JSON encoded string to appengine model properties", "name": "set_json", "signature": "def set_json(self, val...
2
stack_v2_sparse_classes_30k_train_003016
Implement the Python class `JSONMixins` described below. Class description: Adding these Mixins to your model class will allow serialisation/deserialisation of your model instances. Method signatures and docstrings: - def get_json(self, encode=True): Build and return a JSON representation of our model - def set_json(...
Implement the Python class `JSONMixins` described below. Class description: Adding these Mixins to your model class will allow serialisation/deserialisation of your model instances. Method signatures and docstrings: - def get_json(self, encode=True): Build and return a JSON representation of our model - def set_json(...
5cb341c844bd5b60394a71287dae6a6c48f47006
<|skeleton|> class JSONMixins: """Adding these Mixins to your model class will allow serialisation/deserialisation of your model instances.""" def get_json(self, encode=True): """Build and return a JSON representation of our model""" <|body_0|> def set_json(self, value): """Convert...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JSONMixins: """Adding these Mixins to your model class will allow serialisation/deserialisation of your model instances.""" def get_json(self, encode=True): """Build and return a JSON representation of our model""" instance_dict = db.to_dict(self) for key, val in instance_dict.ite...
the_stack_v2_python_sparse
nacelle/models/mixins.py
moefang/nacelle
train
0
36d2653943b5703d04b9bd44d62feace2bd260ac
[ "product_data_queue_obj = self.env['shopify.product.data.queue.ept']\nir_model_obj = self.env['ir.model']\ncommon_log_book_obj = self.env['common.log.book.ept']\nquery = \"select queue.id\\n from shopify_product_data_queue_line_ept as queue_line\\n inner join shopify_product_data_queue...
<|body_start_0|> product_data_queue_obj = self.env['shopify.product.data.queue.ept'] ir_model_obj = self.env['ir.model'] common_log_book_obj = self.env['common.log.book.ept'] query = "select queue.id\n from shopify_product_data_queue_line_ept as queue_line\n ...
ShopifyProductDataQueueLineEpt
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShopifyProductDataQueueLineEpt: def auto_import_product_queue_line_data(self): """This method used to process synced shopify product data in batch of 100 queue lines. @author: Maulik Barad on Date 31-Aug-2020.""" <|body_0|> def process_product_queue_line_data(self): ...
stack_v2_sparse_classes_36k_train_018984
6,365
no_license
[ { "docstring": "This method used to process synced shopify product data in batch of 100 queue lines. @author: Maulik Barad on Date 31-Aug-2020.", "name": "auto_import_product_queue_line_data", "signature": "def auto_import_product_queue_line_data(self)" }, { "docstring": "This method processes p...
3
stack_v2_sparse_classes_30k_train_017817
Implement the Python class `ShopifyProductDataQueueLineEpt` described below. Class description: Implement the ShopifyProductDataQueueLineEpt class. Method signatures and docstrings: - def auto_import_product_queue_line_data(self): This method used to process synced shopify product data in batch of 100 queue lines. @a...
Implement the Python class `ShopifyProductDataQueueLineEpt` described below. Class description: Implement the ShopifyProductDataQueueLineEpt class. Method signatures and docstrings: - def auto_import_product_queue_line_data(self): This method used to process synced shopify product data in batch of 100 queue lines. @a...
581b23342122c0568407c1c42efd4b2085719335
<|skeleton|> class ShopifyProductDataQueueLineEpt: def auto_import_product_queue_line_data(self): """This method used to process synced shopify product data in batch of 100 queue lines. @author: Maulik Barad on Date 31-Aug-2020.""" <|body_0|> def process_product_queue_line_data(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShopifyProductDataQueueLineEpt: def auto_import_product_queue_line_data(self): """This method used to process synced shopify product data in batch of 100 queue lines. @author: Maulik Barad on Date 31-Aug-2020.""" product_data_queue_obj = self.env['shopify.product.data.queue.ept'] ir_mo...
the_stack_v2_python_sparse
modules/shopify_ept/models/product_data_queue_line.py
yspcn/odoo14-import
train
0
89f507bc0e205ae3fc33ab4b8d80c3be9424c360
[ "super(DJFMidasNet, self).__init__()\nuse_pretrained = False if path else True\nself.pretrained, self.scratch = _make_encoder(backbone, features, use_pretrained)\nself.scratch.refinenet4 = DJFFeatureFusionBlock(features)\nself.scratch.refinenet3 = DJFFeatureFusionBlock(features)\nself.scratch.refinenet2 = DJFFeatur...
<|body_start_0|> super(DJFMidasNet, self).__init__() use_pretrained = False if path else True self.pretrained, self.scratch = _make_encoder(backbone, features, use_pretrained) self.scratch.refinenet4 = DJFFeatureFusionBlock(features) self.scratch.refinenet3 = DJFFeatureFusionBloc...
Network for monocular depth estimation.
DJFMidasNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DJFMidasNet: """Network for monocular depth estimation.""" def __init__(self, path=None, features=256, backbone='resnet50', non_negative=True): """Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256. b...
stack_v2_sparse_classes_36k_train_018985
13,019
permissive
[ { "docstring": "Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256. backbone (str, optional): Backbone network for encoder. Defaults to resnet50", "name": "__init__", "signature": "def __init__(self, path=None, features=...
2
stack_v2_sparse_classes_30k_train_008262
Implement the Python class `DJFMidasNet` described below. Class description: Network for monocular depth estimation. Method signatures and docstrings: - def __init__(self, path=None, features=256, backbone='resnet50', non_negative=True): Init. Args: path (str, optional): Path to saved model. Defaults to None. feature...
Implement the Python class `DJFMidasNet` described below. Class description: Network for monocular depth estimation. Method signatures and docstrings: - def __init__(self, path=None, features=256, backbone='resnet50', non_negative=True): Init. Args: path (str, optional): Path to saved model. Defaults to None. feature...
a00c3619bf4042e446e1919087f0b09fe9fa3a65
<|skeleton|> class DJFMidasNet: """Network for monocular depth estimation.""" def __init__(self, path=None, features=256, backbone='resnet50', non_negative=True): """Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256. b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DJFMidasNet: """Network for monocular depth estimation.""" def __init__(self, path=None, features=256, backbone='resnet50', non_negative=True): """Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256. backbone (str,...
the_stack_v2_python_sparse
nasws/cnn/search_space/monodepth/models/midas_net.py
kcyu2014/nas-landmarkreg
train
10
89797a12399b63f28d171ec3f3da1a651fe01d28
[ "super().__init__(model_config)\nself.pipelines = pipelines\nself.aggregation_type = ensemble_aggregation_type", "inference_pipelines = []\nfor pipeline_id, path in enumerate(paths_to_checkpoint):\n pipeline = ScalarInferencePipeline.create_from_checkpoint(path, config, pipeline_id)\n if pipeline:\n ...
<|body_start_0|> super().__init__(model_config) self.pipelines = pipelines self.aggregation_type = ensemble_aggregation_type <|end_body_0|> <|body_start_1|> inference_pipelines = [] for pipeline_id, path in enumerate(paths_to_checkpoint): pipeline = ScalarInferencePi...
Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models.
ScalarEnsemblePipeline
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScalarEnsemblePipeline: """Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models.""" def __init__(self, pipelines: List[ScalarInferencePipeline], model_config: ScalarModelBase...
stack_v2_sparse_classes_36k_train_018986
9,301
permissive
[ { "docstring": ":param pipelines: A set of inference pipelines, one for each recovered checkpoint. :param model_config: Model configuration information. :param ensemble_aggregation_type: Type of aggregation to perform on the model outputs. :return:", "name": "__init__", "signature": "def __init__(self, ...
4
null
Implement the Python class `ScalarEnsemblePipeline` described below. Class description: Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models. Method signatures and docstrings: - def __init__(self, pip...
Implement the Python class `ScalarEnsemblePipeline` described below. Class description: Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models. Method signatures and docstrings: - def __init__(self, pip...
2877002d50d3a34d80f647c18cb561025d9066cc
<|skeleton|> class ScalarEnsemblePipeline: """Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models.""" def __init__(self, pipelines: List[ScalarInferencePipeline], model_config: ScalarModelBase...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScalarEnsemblePipeline: """Pipeline for inference from an ensemble model on classification tasks. This pipeline creates models from multiple checkpoints and aggregates the predictions across models.""" def __init__(self, pipelines: List[ScalarInferencePipeline], model_config: ScalarModelBase, ensemble_ag...
the_stack_v2_python_sparse
InnerEye/ML/pipelines/scalar_inference.py
microsoft/InnerEye-DeepLearning
train
511
08c20671c2a17fca57a62e61251f33f66fd8d397
[ "super().__init__()\nself.v2_proj = nn.Linear(hidden_size, hidden_size)\nself.proj = nn.Linear(hidden_size * 4, hidden_size * 2)\nself.dropout = nn.Dropout(p=dropout_rate)", "proj_v2 = self.v2_proj(v2)\nsimilarity_matrix = v1.bmm(proj_v2.transpose(2, 1).contiguous())\nv1_v2_attn = F.softmax(similarity_matrix.mask...
<|body_start_0|> super().__init__() self.v2_proj = nn.Linear(hidden_size, hidden_size) self.proj = nn.Linear(hidden_size * 4, hidden_size * 2) self.dropout = nn.Dropout(p=dropout_rate) <|end_body_0|> <|body_start_1|> proj_v2 = self.v2_proj(v2) similarity_matrix = v1.bmm(...
Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>> v1 = torch.randn(4, 5, 10) >>> v1.shape torch.Size([4, 5, 10]) >>> v2 = torc...
MatchModule
[ "MIT", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchModule: """Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>> v1 = torch.randn(4, 5, 10) >>> v1.sha...
stack_v2_sparse_classes_36k_train_018987
3,191
permissive
[ { "docstring": "Init.", "name": "__init__", "signature": "def __init__(self, hidden_size, dropout_rate=0)" }, { "docstring": "Computing attention vectors and projection vectors.", "name": "forward", "signature": "def forward(self, v1, v2, v2_mask)" } ]
2
stack_v2_sparse_classes_30k_train_002845
Implement the Python class `MatchModule` described below. Class description: Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>...
Implement the Python class `MatchModule` described below. Class description: Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>...
4198ebce942f4afe7ddca6a96ab6f4464ade4518
<|skeleton|> class MatchModule: """Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>> v1 = torch.randn(4, 5, 10) >>> v1.sha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatchModule: """Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import torch >>> attention = MatchModule(hidden_size=10) >>> v1 = torch.randn(4, 5, 10) >>> v1.shape torch.Size...
the_stack_v2_python_sparse
poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/modules/attention.py
microsoft/ContextualSP
train
332
10eb4bbba045acfbf135ee7576c4e95757dbbbe2
[ "super().__init__()\nself.num_convolution_channels_list = num_convolution_channels_list\nself.num_convolutions = len(num_convolution_channels_list)\nself.conv_filter_size = conv_filter_size\nself.use_batch_norm = use_batch_norm\nself.dropout_prob = dropout_prob\nself.apply_relu_to_last_conv = apply_relu_to_last_con...
<|body_start_0|> super().__init__() self.num_convolution_channels_list = num_convolution_channels_list self.num_convolutions = len(num_convolution_channels_list) self.conv_filter_size = conv_filter_size self.use_batch_norm = use_batch_norm self.dropout_prob = dropout_prob...
Applies a series of 3d sparse convolutions to the voxel features.
SparseConvBlock3D
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseConvBlock3D: """Applies a series of 3d sparse convolutions to the voxel features.""" def __init__(self, num_convolution_channels_list, conv_filter_size=3, use_batch_norm=True, dropout_prob=0.0, apply_relu_to_last_conv=True, normalize_sparse_conv=True, use_rule_based_op=True): "...
stack_v2_sparse_classes_36k_train_018988
18,351
permissive
[ { "docstring": "3D sparse conv block constructor. The block contains a sequence of 3d sparse convolutions. Args: num_convolution_channels_list: A list that contains the number of output channels of the convolutions in the block. The length of the list identifies the number of convolutions in the block. conv_fil...
3
null
Implement the Python class `SparseConvBlock3D` described below. Class description: Applies a series of 3d sparse convolutions to the voxel features. Method signatures and docstrings: - def __init__(self, num_convolution_channels_list, conv_filter_size=3, use_batch_norm=True, dropout_prob=0.0, apply_relu_to_last_conv=...
Implement the Python class `SparseConvBlock3D` described below. Class description: Applies a series of 3d sparse convolutions to the voxel features. Method signatures and docstrings: - def __init__(self, num_convolution_channels_list, conv_filter_size=3, use_batch_norm=True, dropout_prob=0.0, apply_relu_to_last_conv=...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class SparseConvBlock3D: """Applies a series of 3d sparse convolutions to the voxel features.""" def __init__(self, num_convolution_channels_list, conv_filter_size=3, use_batch_norm=True, dropout_prob=0.0, apply_relu_to_last_conv=True, normalize_sparse_conv=True, use_rule_based_op=True): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparseConvBlock3D: """Applies a series of 3d sparse convolutions to the voxel features.""" def __init__(self, num_convolution_channels_list, conv_filter_size=3, use_batch_norm=True, dropout_prob=0.0, apply_relu_to_last_conv=True, normalize_sparse_conv=True, use_rule_based_op=True): """3D sparse c...
the_stack_v2_python_sparse
tf3d/layers/sparse_voxel_net_utils.py
Jimmy-INL/google-research
train
1
df5d2e0541397e5c8c6863ced056aa9a5711873f
[ "query = self.session.query(VDealhistory.time, VDealhistory.deal, VDealhistory.positionid, VDealhistory.login, VDealhistory.symbol, VDealhistory.action, VDealhistory.entry, VDealhistory.volume, VDealhistory.price, VDealhistory.priceposition, VDealhistory.profit, VDealhistory.storage, VDealhistory.commission, VDealh...
<|body_start_0|> query = self.session.query(VDealhistory.time, VDealhistory.deal, VDealhistory.positionid, VDealhistory.login, VDealhistory.symbol, VDealhistory.action, VDealhistory.entry, VDealhistory.volume, VDealhistory.price, VDealhistory.priceposition, VDealhistory.profit, VDealhistory.storage, VDealhistor...
v_dealhistory视图操作
VDealhistoryDao
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VDealhistoryDao: """v_dealhistory视图操作""" 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, mtlog...
stack_v2_sparse_classes_36k_train_018989
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: 开始时间 :p...
2
stack_v2_sparse_classes_30k_train_001267
Implement the Python class `VDealhistoryDao` described below. Class description: v_dealhistory视图操作 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_by_...
Implement the Python class `VDealhistoryDao` described below. Class description: v_dealhistory视图操作 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_by_...
1fadeecf31f1d25e258dc5d70c47a785f7b33961
<|skeleton|> class VDealhistoryDao: """v_dealhistory视图操作""" 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, mtlog...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VDealhistoryDao: """v_dealhistory视图操作""" 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(VDealhistory.time, VDealhistory.deal, VDealhistory....
the_stack_v2_python_sparse
xwcrm/model/views.py
MSUNorg/XWCRM
train
0
565ad5f0df884d07f07f36c869605eea8c492c93
[ "while T != None and key != T.data:\n if key < T.data:\n T = T.leftChild\n else:\n T = T.rightChild\nreturn T", "if T is None:\n return\nif T.data == key:\n return T\nelif key < T.data:\n BSTSearch().searchRecursion(T.leftChild, key)\nelse:\n BSTSearch().searchRecursion(T.rightChil...
<|body_start_0|> while T != None and key != T.data: if key < T.data: T = T.leftChild else: T = T.rightChild return T <|end_body_0|> <|body_start_1|> if T is None: return if T.data == key: return T el...
二叉排序树的查找
BSTSearch
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSTSearch: """二叉排序树的查找""" def searchNoRecursion(self, T: Node, key) -> Node: """非递归 :param T: :param key: :return:""" <|body_0|> def searchRecursion(self, T: Node, key): """递归 :param T: :param key: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_018990
997
no_license
[ { "docstring": "非递归 :param T: :param key: :return:", "name": "searchNoRecursion", "signature": "def searchNoRecursion(self, T: Node, key) -> Node" }, { "docstring": "递归 :param T: :param key: :return:", "name": "searchRecursion", "signature": "def searchRecursion(self, T: Node, key)" } ...
2
null
Implement the Python class `BSTSearch` described below. Class description: 二叉排序树的查找 Method signatures and docstrings: - def searchNoRecursion(self, T: Node, key) -> Node: 非递归 :param T: :param key: :return: - def searchRecursion(self, T: Node, key): 递归 :param T: :param key: :return:
Implement the Python class `BSTSearch` described below. Class description: 二叉排序树的查找 Method signatures and docstrings: - def searchNoRecursion(self, T: Node, key) -> Node: 非递归 :param T: :param key: :return: - def searchRecursion(self, T: Node, key): 递归 :param T: :param key: :return: <|skeleton|> class BSTSearch: ...
cded97a52c422f98b55f2b3527a054d23541d5a4
<|skeleton|> class BSTSearch: """二叉排序树的查找""" def searchNoRecursion(self, T: Node, key) -> Node: """非递归 :param T: :param key: :return:""" <|body_0|> def searchRecursion(self, T: Node, key): """递归 :param T: :param key: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BSTSearch: """二叉排序树的查找""" def searchNoRecursion(self, T: Node, key) -> Node: """非递归 :param T: :param key: :return:""" while T != None and key != T.data: if key < T.data: T = T.leftChild else: T = T.rightChild return T de...
the_stack_v2_python_sparse
chapter5/二叉排序树的查找.py
AnJian2020/Leetcode
train
1
98b3072785e7c390b76dede231249f873b78b377
[ "start = index * 28 * 28 + 16\npicture = []\nfor i in range(28):\n picture.append([])\n for j in range(28):\n picture[i].append(content[start + i * 28 + j])\npicture = np.array(picture, dtype='uint8')\nreturn picture", "content = self.get_file_content()\ndata_set = []\nfor index in range(self.count):...
<|body_start_0|> start = index * 28 * 28 + 16 picture = [] for i in range(28): picture.append([]) for j in range(28): picture[i].append(content[start + i * 28 + j]) picture = np.array(picture, dtype='uint8') return picture <|end_body_0|> <...
The image loader of MNIST.
ImageLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageLoader: """The image loader of MNIST.""" def get_picture(content, index): """Get image from MNIST data file. :param content: The MNIST's data. :param index: Current index of the image in content. :return:""" <|body_0|> def load(self): """Load images tensor."...
stack_v2_sparse_classes_36k_train_018991
1,031
no_license
[ { "docstring": "Get image from MNIST data file. :param content: The MNIST's data. :param index: Current index of the image in content. :return:", "name": "get_picture", "signature": "def get_picture(content, index)" }, { "docstring": "Load images tensor.", "name": "load", "signature": "d...
2
stack_v2_sparse_classes_30k_train_000895
Implement the Python class `ImageLoader` described below. Class description: The image loader of MNIST. Method signatures and docstrings: - def get_picture(content, index): Get image from MNIST data file. :param content: The MNIST's data. :param index: Current index of the image in content. :return: - def load(self):...
Implement the Python class `ImageLoader` described below. Class description: The image loader of MNIST. Method signatures and docstrings: - def get_picture(content, index): Get image from MNIST data file. :param content: The MNIST's data. :param index: Current index of the image in content. :return: - def load(self):...
4159aa7e272fa1f20a54b8c3a6d13891599962fe
<|skeleton|> class ImageLoader: """The image loader of MNIST.""" def get_picture(content, index): """Get image from MNIST data file. :param content: The MNIST's data. :param index: Current index of the image in content. :return:""" <|body_0|> def load(self): """Load images tensor."...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageLoader: """The image loader of MNIST.""" def get_picture(content, index): """Get image from MNIST data file. :param content: The MNIST's data. :param index: Current index of the image in content. :return:""" start = index * 28 * 28 + 16 picture = [] for i in range(28)...
the_stack_v2_python_sparse
image_loader.py
administrator-zero/agent_yang
train
0
c495b1851412524f5cf9622004c5d6d72df1614d
[ "super(EgocentricCostmap, self).__init__(env)\nself._egomap_x_bounds = np.array([-0.5, 3.0])\nself._egomap_y_bounds = np.array([-2.0, 2.0])\nresulting_size = np.array([self._egomap_x_bounds[1] - self._egomap_x_bounds[0], self._egomap_y_bounds[1] - self._egomap_y_bounds[0]])\npixel_size = world_to_pixel(resulting_si...
<|body_start_0|> super(EgocentricCostmap, self).__init__(env) self._egomap_x_bounds = np.array([-0.5, 3.0]) self._egomap_y_bounds = np.array([-2.0, 2.0]) resulting_size = np.array([self._egomap_x_bounds[1] - self._egomap_x_bounds[0], self._egomap_y_bounds[1] - self._egomap_y_bounds[0]]) ...
Random Aisle Turn environment, but the observation is a colored egocentric costmap and a vector with (robot state, normalized goal coordinates).
EgocentricCostmap
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EgocentricCostmap: """Random Aisle Turn environment, but the observation is a colored egocentric costmap and a vector with (robot state, normalized goal coordinates).""" def __init__(self, env): """Wrap the environment in this wrapper, that will make the observation egocentric :param...
stack_v2_sparse_classes_36k_train_018992
6,962
permissive
[ { "docstring": "Wrap the environment in this wrapper, that will make the observation egocentric :param env object: the environment to wrap.", "name": "__init__", "signature": "def __init__(self, env)" }, { "docstring": "Extract egocentric map and path from rich observation :param observation Obs...
2
stack_v2_sparse_classes_30k_val_000358
Implement the Python class `EgocentricCostmap` described below. Class description: Random Aisle Turn environment, but the observation is a colored egocentric costmap and a vector with (robot state, normalized goal coordinates). Method signatures and docstrings: - def __init__(self, env): Wrap the environment in this ...
Implement the Python class `EgocentricCostmap` described below. Class description: Random Aisle Turn environment, but the observation is a colored egocentric costmap and a vector with (robot state, normalized goal coordinates). Method signatures and docstrings: - def __init__(self, env): Wrap the environment in this ...
e2864d88eb971e327d7e886e75d00140673006ef
<|skeleton|> class EgocentricCostmap: """Random Aisle Turn environment, but the observation is a colored egocentric costmap and a vector with (robot state, normalized goal coordinates).""" def __init__(self, env): """Wrap the environment in this wrapper, that will make the observation egocentric :param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EgocentricCostmap: """Random Aisle Turn environment, but the observation is a colored egocentric costmap and a vector with (robot state, normalized goal coordinates).""" def __init__(self, env): """Wrap the environment in this wrapper, that will make the observation egocentric :param env object: ...
the_stack_v2_python_sparse
bc_gym_planning_env/envs/egocentric.py
braincorp/bc-gym-planning-env
train
2
88bc221af97e3153672423b3bd81e03bb01a5970
[ "super().__init__()\nself.fc = nn.Sequential(nn.Linear(62, 1024), nn.BatchNorm1d(1024), nn.ReLU(), nn.Linear(1024, 128 * 8 * 8), nn.ReLU())\nself.deconv = nn.Sequential(nn.ConvTranspose2d(128, 64, kernel_size=4, stride=2, padding=1), nn.BatchNorm2d(64), nn.ReLU(), nn.ConvTranspose2d(64, 3, kernel_size=4, stride=2, ...
<|body_start_0|> super().__init__() self.fc = nn.Sequential(nn.Linear(62, 1024), nn.BatchNorm1d(1024), nn.ReLU(), nn.Linear(1024, 128 * 8 * 8), nn.ReLU()) self.deconv = nn.Sequential(nn.ConvTranspose2d(128, 64, kernel_size=4, stride=2, padding=1), nn.BatchNorm2d(64), nn.ReLU(), nn.ConvTranspose2...
Generator
Generator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: """Generator""" def __init__(self): """Initialize Note: --- 62 次元の入力ベクトルを 1024 次元に拡張し、 7x7 サイズの 128 チャネル画像へ変換する。""" <|body_0|> def forward(self, input): """forward Note: --- input から fc によって 128x7x7 次元のベクトルを生成する。 deconv には画像を入力としたいため、 view によって (128, 7...
stack_v2_sparse_classes_36k_train_018993
1,205
permissive
[ { "docstring": "Initialize Note: --- 62 次元の入力ベクトルを 1024 次元に拡張し、 7x7 サイズの 128 チャネル画像へ変換する。", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "forward Note: --- input から fc によって 128x7x7 次元のベクトルを生成する。 deconv には画像を入力としたいため、 view によって (128, 7, 7) 画像へ変換する。", "name": "forwar...
2
stack_v2_sparse_classes_30k_train_011503
Implement the Python class `Generator` described below. Class description: Generator Method signatures and docstrings: - def __init__(self): Initialize Note: --- 62 次元の入力ベクトルを 1024 次元に拡張し、 7x7 サイズの 128 チャネル画像へ変換する。 - def forward(self, input): forward Note: --- input から fc によって 128x7x7 次元のベクトルを生成する。 deconv には画像を入力としたい...
Implement the Python class `Generator` described below. Class description: Generator Method signatures and docstrings: - def __init__(self): Initialize Note: --- 62 次元の入力ベクトルを 1024 次元に拡張し、 7x7 サイズの 128 チャネル画像へ変換する。 - def forward(self, input): forward Note: --- input から fc によって 128x7x7 次元のベクトルを生成する。 deconv には画像を入力としたい...
a3994d272d812261ba694954554cfa213dfe795e
<|skeleton|> class Generator: """Generator""" def __init__(self): """Initialize Note: --- 62 次元の入力ベクトルを 1024 次元に拡張し、 7x7 サイズの 128 チャネル画像へ変換する。""" <|body_0|> def forward(self, input): """forward Note: --- input から fc によって 128x7x7 次元のベクトルを生成する。 deconv には画像を入力としたいため、 view によって (128, 7...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Generator: """Generator""" def __init__(self): """Initialize Note: --- 62 次元の入力ベクトルを 1024 次元に拡張し、 7x7 サイズの 128 チャネル画像へ変換する。""" super().__init__() self.fc = nn.Sequential(nn.Linear(62, 1024), nn.BatchNorm1d(1024), nn.ReLU(), nn.Linear(1024, 128 * 8 * 8), nn.ReLU()) self.dec...
the_stack_v2_python_sparse
machine_learning/torch_dcgan/generator.py
samsgood0310/til
train
0
84059e77611c3279dd00145891df7a9045b3a054
[ "f = self.dtype_f(self.init)\nv = u.flatten()\nf.comp1[:] = self.A.dot(v).reshape(self.nvars)\nf.comp2[:] = (1.0 / self.eps ** 2 * v * (1.0 - v ** self.nu)).reshape(self.nvars)\nreturn f", "class context:\n num_iter = 0\n\ndef callback(xk):\n context.num_iter += 1\n return context.num_iter\nme = self.dty...
<|body_start_0|> f = self.dtype_f(self.init) v = u.flatten() f.comp1[:] = self.A.dot(v).reshape(self.nvars) f.comp2[:] = (1.0 / self.eps ** 2 * v * (1.0 - v ** self.nu)).reshape(self.nvars) return f <|end_body_0|> <|body_start_1|> class context: num_iter = 0 ...
Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting
allencahn_multiimplicit
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class allencahn_multiimplicit: """Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting""" def eval_f(self, u, t): """Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical solut...
stack_v2_sparse_classes_36k_train_018994
19,427
permissive
[ { "docstring": "Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical solution. t : float Current time of the numerical solution is computed. Returns ------- f : dtype_f The right-hand side of the problem.", "name": "eval_f", "signature...
3
null
Implement the Python class `allencahn_multiimplicit` described below. Class description: Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting Method signatures and docstrings: - def eval_f(self, u, t): Routine to evaluate the right-hand side of the problem. Parameters ---...
Implement the Python class `allencahn_multiimplicit` described below. Class description: Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting Method signatures and docstrings: - def eval_f(self, u, t): Routine to evaluate the right-hand side of the problem. Parameters ---...
1a51834bedffd4472e344bed28f4d766614b1537
<|skeleton|> class allencahn_multiimplicit: """Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting""" def eval_f(self, u, t): """Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical solut...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class allencahn_multiimplicit: """Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting""" def eval_f(self, u, t): """Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical solution. t : floa...
the_stack_v2_python_sparse
pySDC/implementations/problem_classes/AllenCahn_2D_FD.py
Parallel-in-Time/pySDC
train
30
2bf2c458d40ca076aec7d5db84e79bc4ee90a099
[ "self.nums1 = nums1\nself.nums2 = nums2\nself.dict2 = {}\nfor n in self.nums2:\n self.dict2[n] = self.dict2.get(n, 0) + 1", "self.dict2[self.nums2[index]] = self.dict2.get(self.nums2[index]) - 1\nself.dict2[self.nums2[index] + val] = self.dict2.get(self.nums2[index] + val, 0) + 1\nself.nums2[index] += val", ...
<|body_start_0|> self.nums1 = nums1 self.nums2 = nums2 self.dict2 = {} for n in self.nums2: self.dict2[n] = self.dict2.get(n, 0) + 1 <|end_body_0|> <|body_start_1|> self.dict2[self.nums2[index]] = self.dict2.get(self.nums2[index]) - 1 self.dict2[self.nums2[in...
FindSumPairs
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FindSumPairs: def __init__(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int]""" <|body_0|> def add(self, index, val): """:type index: int :type val: int :rtype: None""" <|body_1|> def count(self, tot): """:type tot: int :rtype...
stack_v2_sparse_classes_36k_train_018995
1,746
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int]", "name": "__init__", "signature": "def __init__(self, nums1, nums2)" }, { "docstring": ":type index: int :type val: int :rtype: None", "name": "add", "signature": "def add(self, index, val)" }, { "docstring": ":type t...
3
null
Implement the Python class `FindSumPairs` described below. Class description: Implement the FindSumPairs class. Method signatures and docstrings: - def __init__(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] - def add(self, index, val): :type index: int :type val: int :rtype: None - def count(self...
Implement the Python class `FindSumPairs` described below. Class description: Implement the FindSumPairs class. Method signatures and docstrings: - def __init__(self, nums1, nums2): :type nums1: List[int] :type nums2: List[int] - def add(self, index, val): :type index: int :type val: int :rtype: None - def count(self...
0630af62adfa1de0e59315573e250dc83fe660e8
<|skeleton|> class FindSumPairs: def __init__(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int]""" <|body_0|> def add(self, index, val): """:type index: int :type val: int :rtype: None""" <|body_1|> def count(self, tot): """:type tot: int :rtype...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FindSumPairs: def __init__(self, nums1, nums2): """:type nums1: List[int] :type nums2: List[int]""" self.nums1 = nums1 self.nums2 = nums2 self.dict2 = {} for n in self.nums2: self.dict2[n] = self.dict2.get(n, 0) + 1 def add(self, index, val): ""...
the_stack_v2_python_sparse
src/main/python/FindSumPairs.py
vikumsw/Algorithms_For_Problem_Solving
train
1
cedb3ff1f64b5793290a2d4c011719898c624628
[ "repl = Chem.MolFromSmiles('CC')\npatt = Chem.MolFromSmarts('[#1;$([#1])]')\ntry:\n fragH = Chem.AddHs(Chem.MolFromSmiles(frag))\n molH = Chem.ReplaceSubstructs(fragH, patt, repl, replaceAll=False)\n mol = Chem.RemoveHs(molH[0])\n return Chem.MolToSmiles(mol)\nexcept:\n logger.debug(f\"Skipped: could...
<|body_start_0|> repl = Chem.MolFromSmiles('CC') patt = Chem.MolFromSmarts('[#1;$([#1])]') try: fragH = Chem.AddHs(Chem.MolFromSmiles(frag)) molH = Chem.ReplaceSubstructs(fragH, patt, repl, replaceAll=False) mol = Chem.RemoveHs(molH[0]) return Chem...
A converter to create dummy molecules from fragments.
dummyMolsFromFragments
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dummyMolsFromFragments: """A converter to create dummy molecules from fragments.""" def addCCToFragments(frag): """Add CC to a single fragment to build a dummy molecule. Args: frag: fragment to be converted to a dummy molecule Returns:""" <|body_0|> def bridgeFragments(f...
stack_v2_sparse_classes_36k_train_018996
3,301
permissive
[ { "docstring": "Add CC to a single fragment to build a dummy molecule. Args: frag: fragment to be converted to a dummy molecule Returns:", "name": "addCCToFragments", "signature": "def addCCToFragments(frag)" }, { "docstring": "Bridge multiple fragments together into one dummy molecule. Args: fr...
3
null
Implement the Python class `dummyMolsFromFragments` described below. Class description: A converter to create dummy molecules from fragments. Method signatures and docstrings: - def addCCToFragments(frag): Add CC to a single fragment to build a dummy molecule. Args: frag: fragment to be converted to a dummy molecule ...
Implement the Python class `dummyMolsFromFragments` described below. Class description: A converter to create dummy molecules from fragments. Method signatures and docstrings: - def addCCToFragments(frag): Add CC to a single fragment to build a dummy molecule. Args: frag: fragment to be converted to a dummy molecule ...
b61d31a4b98b6d600184e52ca24640d3e64fd425
<|skeleton|> class dummyMolsFromFragments: """A converter to create dummy molecules from fragments.""" def addCCToFragments(frag): """Add CC to a single fragment to build a dummy molecule. Args: frag: fragment to be converted to a dummy molecule Returns:""" <|body_0|> def bridgeFragments(f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class dummyMolsFromFragments: """A converter to create dummy molecules from fragments.""" def addCCToFragments(frag): """Add CC to a single fragment to build a dummy molecule. Args: frag: fragment to be converted to a dummy molecule Returns:""" repl = Chem.MolFromSmiles('CC') patt = Che...
the_stack_v2_python_sparse
drugex/molecules/converters/dummy_molecules.py
CDDLeiden/DrugEx
train
70
34b54ca5614d3efaafe4dcd8703581cfa3a061bb
[ "super(Chef, self).__init__(image=Chef.chef_image, x=games.screen.width / 2, y=y, dx=speed)\nself.odds_change = odds_change\nself.time_til_drop = 0", "if self.right > games.screen.width or self.left < 0:\n self.dx = -self.dx\nif self.bottom > games.screen.height or self.top < 0:\n self.dy = -self.dy\nself.c...
<|body_start_0|> super(Chef, self).__init__(image=Chef.chef_image, x=games.screen.width / 2, y=y, dx=speed) self.odds_change = odds_change self.time_til_drop = 0 <|end_body_0|> <|body_start_1|> if self.right > games.screen.width or self.left < 0: self.dx = -self.dx i...
The chef that throws pizza
Chef
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chef: """The chef that throws pizza""" def __init__(self, y=115, speed=2, odds_change=200): """Initialize Chef""" <|body_0|> def update(self): """Changes speed vectors when Chef comes to the screen edge""" <|body_1|> def check_drop(self): """...
stack_v2_sparse_classes_36k_train_018997
4,179
no_license
[ { "docstring": "Initialize Chef", "name": "__init__", "signature": "def __init__(self, y=115, speed=2, odds_change=200)" }, { "docstring": "Changes speed vectors when Chef comes to the screen edge", "name": "update", "signature": "def update(self)" }, { "docstring": "Decrease int...
3
stack_v2_sparse_classes_30k_train_012574
Implement the Python class `Chef` described below. Class description: The chef that throws pizza Method signatures and docstrings: - def __init__(self, y=115, speed=2, odds_change=200): Initialize Chef - def update(self): Changes speed vectors when Chef comes to the screen edge - def check_drop(self): Decrease interv...
Implement the Python class `Chef` described below. Class description: The chef that throws pizza Method signatures and docstrings: - def __init__(self, y=115, speed=2, odds_change=200): Initialize Chef - def update(self): Changes speed vectors when Chef comes to the screen edge - def check_drop(self): Decrease interv...
19343c985f368770dc01ce415506506d62a23285
<|skeleton|> class Chef: """The chef that throws pizza""" def __init__(self, y=115, speed=2, odds_change=200): """Initialize Chef""" <|body_0|> def update(self): """Changes speed vectors when Chef comes to the screen edge""" <|body_1|> def check_drop(self): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Chef: """The chef that throws pizza""" def __init__(self, y=115, speed=2, odds_change=200): """Initialize Chef""" super(Chef, self).__init__(image=Chef.chef_image, x=games.screen.width / 2, y=y, dx=speed) self.odds_change = odds_change self.time_til_drop = 0 def updat...
the_stack_v2_python_sparse
graphics/pizza_panic.py
gofr1/python-learning
train
0
003fb03da0e935df8c908132c28051ecd760753b
[ "course_id = request.data['course']\ncheck = self._is_instructor_or_ta(course_id, request.user)\nif check is not True:\n return check\nserializer = self.get_serializer(data=request.data)\nif serializer.is_valid():\n serializer.save()\n send_mail(serializer.data['subject'], serializer.data['body'], serializ...
<|body_start_0|> course_id = request.data['course'] check = self._is_instructor_or_ta(course_id, request.user) if check is not True: return check serializer = self.get_serializer(data=request.data) if serializer.is_valid(): serializer.save() se...
Viewset for `Email`.
EmailViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailViewSet: """Viewset for `Email`.""" def create_email(self, request): """Adds an email to the course. Args: request (Request): DRF `Request` object Returns: `Response` with the created email data and status `HTTP_201_CREATED` Raises: `HTTP_400_BAD_REQUEST`: Raised due to `create(...
stack_v2_sparse_classes_36k_train_018998
4,219
no_license
[ { "docstring": "Adds an email to the course. Args: request (Request): DRF `Request` object Returns: `Response` with the created email data and status `HTTP_201_CREATED` Raises: `HTTP_400_BAD_REQUEST`: Raised due to `create()` method `HTTP_401_UNAUTHORIZED`: Raised by `IsInstructorOrTA` permission class `HTTP_40...
3
null
Implement the Python class `EmailViewSet` described below. Class description: Viewset for `Email`. Method signatures and docstrings: - def create_email(self, request): Adds an email to the course. Args: request (Request): DRF `Request` object Returns: `Response` with the created email data and status `HTTP_201_CREATE...
Implement the Python class `EmailViewSet` described below. Class description: Viewset for `Email`. Method signatures and docstrings: - def create_email(self, request): Adds an email to the course. Args: request (Request): DRF `Request` object Returns: `Response` with the created email data and status `HTTP_201_CREATE...
ab04535bc307167b2d79fa7e2b37e74e16f63963
<|skeleton|> class EmailViewSet: """Viewset for `Email`.""" def create_email(self, request): """Adds an email to the course. Args: request (Request): DRF `Request` object Returns: `Response` with the created email data and status `HTTP_201_CREATED` Raises: `HTTP_400_BAD_REQUEST`: Raised due to `create(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailViewSet: """Viewset for `Email`.""" def create_email(self, request): """Adds an email to the course. Args: request (Request): DRF `Request` object Returns: `Response` with the created email data and status `HTTP_201_CREATED` Raises: `HTTP_400_BAD_REQUEST`: Raised due to `create()` method `HT...
the_stack_v2_python_sparse
email_notices/api.py
suraj-iitb/bodhitree
train
1
df27fbee8d53d016fd5242741cfccfd383432990
[ "self._server = server_type(('0.0.0.0', 4413), WSGIRequestHandler)\nself._server.set_app(api.app)\nself._thread = Thread(target=self._server.serve_forever, name='RegistryServer')\nself._thread.start()", "self._server.shutdown()\nself._server.server_close()\nself._thread.join()" ]
<|body_start_0|> self._server = server_type(('0.0.0.0', 4413), WSGIRequestHandler) self._server.set_app(api.app) self._thread = Thread(target=self._server.serve_forever, name='RegistryServer') self._thread.start() <|end_body_0|> <|body_start_1|> self._server.shutdown() s...
An HTTP server serving the registry API.
RegistryServer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegistryServer: """An HTTP server serving the registry API.""" def __init__(self, api: RegistryRestApi, server_type: Type[WSGIServer]=WSGIServer) -> None: """Create a RegistryServer. This starts a background thread with an HTTP server. It will listen on all local interfaces on port 4...
stack_v2_sparse_classes_36k_train_018999
6,537
permissive
[ { "docstring": "Create a RegistryServer. This starts a background thread with an HTTP server. It will listen on all local interfaces on port 4413. Args: api: The API to serve. server_type: The server class to use.", "name": "__init__", "signature": "def __init__(self, api: RegistryRestApi, server_type: ...
2
null
Implement the Python class `RegistryServer` described below. Class description: An HTTP server serving the registry API. Method signatures and docstrings: - def __init__(self, api: RegistryRestApi, server_type: Type[WSGIServer]=WSGIServer) -> None: Create a RegistryServer. This starts a background thread with an HTTP...
Implement the Python class `RegistryServer` described below. Class description: An HTTP server serving the registry API. Method signatures and docstrings: - def __init__(self, api: RegistryRestApi, server_type: Type[WSGIServer]=WSGIServer) -> None: Create a RegistryServer. This starts a background thread with an HTTP...
22f9533a506e039237227ca66faea5375cce5fcb
<|skeleton|> class RegistryServer: """An HTTP server serving the registry API.""" def __init__(self, api: RegistryRestApi, server_type: Type[WSGIServer]=WSGIServer) -> None: """Create a RegistryServer. This starts a background thread with an HTTP server. It will listen on all local interfaces on port 4...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegistryServer: """An HTTP server serving the registry API.""" def __init__(self, api: RegistryRestApi, server_type: Type[WSGIServer]=WSGIServer) -> None: """Create a RegistryServer. This starts a background thread with an HTTP server. It will listen on all local interfaces on port 4413. Args: ap...
the_stack_v2_python_sparse
mahiru/rest/registry.py
SecConNet/mahiru
train
4