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
a3266fc2bf287823d12ea54a03d670f091500a67
[ "if not root:\n return 0\nreturn max(self.maxDepth(root.left), self.maxDepth(root.right)) + 1", "if not root:\n return 0\nif not root.left and (not root.right):\n return 1\nif not root.left:\n return self.minDepth(root.right) + 1\nif not root.right:\n return self.minDepth(root.left) + 1\nreturn min...
<|body_start_0|> if not root: return 0 return max(self.maxDepth(root.left), self.maxDepth(root.right)) + 1 <|end_body_0|> <|body_start_1|> if not root: return 0 if not root.left and (not root.right): return 1 if not root.left: retu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def minDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not root: return 0 return max(...
stack_v2_sparse_classes_36k_train_004600
622
no_license
[ { "docstring": ":type root: TreeNode :rtype: int", "name": "maxDepth", "signature": "def maxDepth(self, root)" }, { "docstring": ":type root: TreeNode :rtype: int", "name": "minDepth", "signature": "def minDepth(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_015063
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root): :type root: TreeNode :rtype: int - def minDepth(self, root): :type root: TreeNode :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxDepth(self, root): :type root: TreeNode :rtype: int - def minDepth(self, root): :type root: TreeNode :rtype: int <|skeleton|> class Solution: def maxDepth(self, root...
e153306b85c3687b23a332812a0885d25ecce904
<|skeleton|> class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_0|> def minDepth(self, root): """:type root: TreeNode :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxDepth(self, root): """:type root: TreeNode :rtype: int""" if not root: return 0 return max(self.maxDepth(root.left), self.maxDepth(root.right)) + 1 def minDepth(self, root): """:type root: TreeNode :rtype: int""" if not root: ...
the_stack_v2_python_sparse
linkedin/max min depth of a tree.py
Jason003/interview
train
2
c0b05c2a0f8bcf0a678f65b56cf671df51ac7ed0
[ "value_lines = []\ntry:\n file = open(file_name + '\\\\' + file_path, 'r')\n try:\n print('读取的文件为:%s' % file_name + '\\\\' + file_path)\n value_lines = file.readlines()\n for line in value_lines:\n text_line = line.split('\\n')\n value_lines.append(text_line[0])\n ...
<|body_start_0|> value_lines = [] try: file = open(file_name + '\\' + file_path, 'r') try: print('读取的文件为:%s' % file_name + '\\' + file_path) value_lines = file.readlines() for line in value_lines: text_line = lin...
UseText
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UseText: def read_text(file_name, file_path): """读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容""" <|body_0|> def write_text(file_name, text_value): """写入Text文本文档 :param file_name: text文本文档名(路径) :param text_value: 写入内容...
stack_v2_sparse_classes_36k_train_004601
1,728
no_license
[ { "docstring": "读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容", "name": "read_text", "signature": "def read_text(file_name, file_path)" }, { "docstring": "写入Text文本文档 :param file_name: text文本文档名(路径) :param text_value: 写入内容(值) :return:", "name"...
2
stack_v2_sparse_classes_30k_train_001421
Implement the Python class `UseText` described below. Class description: Implement the UseText class. Method signatures and docstrings: - def read_text(file_name, file_path): 读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容 - def write_text(file_name, text_value): 写入Text...
Implement the Python class `UseText` described below. Class description: Implement the UseText class. Method signatures and docstrings: - def read_text(file_name, file_path): 读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容 - def write_text(file_name, text_value): 写入Text...
e09df64a0b19ad128152a9fb6c9e73e6271207bb
<|skeleton|> class UseText: def read_text(file_name, file_path): """读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容""" <|body_0|> def write_text(file_name, text_value): """写入Text文本文档 :param file_name: text文本文档名(路径) :param text_value: 写入内容...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UseText: def read_text(file_name, file_path): """读取text文档文本 :param file_name: text文档文本名 :param file_path: text文档文本路径 :return: 以list的类型返回text中的内容""" value_lines = [] try: file = open(file_name + '\\' + file_path, 'r') try: print('读取的文件为:%s' % file...
the_stack_v2_python_sparse
common/use_text.py
wallaceok/GoldGarden
train
0
1cf3a307aa971e6236aebd0d761ba139590fc651
[ "if city is None and state is None:\n return 'USA'\nelif city is None or state is None:\n return f\"{city or ''}{state or ''}, USA\"\nreturn f'{city}, {state} USA'", "loc_id = LocationCoordinates.to_location(city, state)\nrow = LocationCoordinates.query.get(loc_id)\nif row is None:\n loc_obj = geolocator...
<|body_start_0|> if city is None and state is None: return 'USA' elif city is None or state is None: return f"{city or ''}{state or ''}, USA" return f'{city}, {state} USA' <|end_body_0|> <|body_start_1|> loc_id = LocationCoordinates.to_location(city, state) ...
This table contains a mapping between a location string to the coordinates of that location. It contains static functions to convert a given city/state to the expected format and to 'get' coordinates (which will attempt to first retrieve from the table, then query the geolocator if not present). Locations are in the fo...
LocationCoordinates
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationCoordinates: """This table contains a mapping between a location string to the coordinates of that location. It contains static functions to convert a given city/state to the expected format and to 'get' coordinates (which will attempt to first retrieve from the table, then query the geol...
stack_v2_sparse_classes_36k_train_004602
39,169
no_license
[ { "docstring": "Converts a city and state (both optional) to the key expected by this table.", "name": "to_location", "signature": "def to_location(city: str=None, state: str=None) -> str" }, { "docstring": "Gets the coordinates for the given city and/or state. If fallback is true, it will attem...
2
stack_v2_sparse_classes_30k_train_015630
Implement the Python class `LocationCoordinates` described below. Class description: This table contains a mapping between a location string to the coordinates of that location. It contains static functions to convert a given city/state to the expected format and to 'get' coordinates (which will attempt to first retri...
Implement the Python class `LocationCoordinates` described below. Class description: This table contains a mapping between a location string to the coordinates of that location. It contains static functions to convert a given city/state to the expected format and to 'get' coordinates (which will attempt to first retri...
344eec835b1468a828f83f6bc3f737c421777de5
<|skeleton|> class LocationCoordinates: """This table contains a mapping between a location string to the coordinates of that location. It contains static functions to convert a given city/state to the expected format and to 'get' coordinates (which will attempt to first retrieve from the table, then query the geol...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocationCoordinates: """This table contains a mapping between a location string to the coordinates of that location. It contains static functions to convert a given city/state to the expected format and to 'get' coordinates (which will attempt to first retrieve from the table, then query the geolocator if not...
the_stack_v2_python_sparse
app/models.py
shirtandtieler/Job-Website-Project
train
2
c1ceafabbcaff4ef3a603106b9fb1d47d4c2d58b
[ "self.a = [0]\nfor i in range(len(rects) - 1):\n self.a.append(self.a[-1] + (rects[i][2] - rects[i][0] + 1) * (rects[i][3] - rects[i][1] + 1))\n rects[i] = [rects[i][0], rects[i][1], rects[i][2] - rects[i][0] + 1]\nself.b, self.k = (rects, self.a[-1] + (rects[-1][2] - rects[-1][0] + 1) * (rects[-1][3] - rects...
<|body_start_0|> self.a = [0] for i in range(len(rects) - 1): self.a.append(self.a[-1] + (rects[i][2] - rects[i][0] + 1) * (rects[i][3] - rects[i][1] + 1)) rects[i] = [rects[i][0], rects[i][1], rects[i][2] - rects[i][0] + 1] self.b, self.k = (rects, self.a[-1] + (rects[-1...
Solution_1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution_1: def __init__(self, rects): """:type rects: List[List[int]] 256ms""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.a = [0] for i in range(len(rects) - 1): self.a.a...
stack_v2_sparse_classes_36k_train_004603
2,805
no_license
[ { "docstring": ":type rects: List[List[int]] 256ms", "name": "__init__", "signature": "def __init__(self, rects)" }, { "docstring": ":rtype: List[int]", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_010008
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] 256ms - def pick(self): :rtype: List[int]
Implement the Python class `Solution_1` described below. Class description: Implement the Solution_1 class. Method signatures and docstrings: - def __init__(self, rects): :type rects: List[List[int]] 256ms - def pick(self): :rtype: List[int] <|skeleton|> class Solution_1: def __init__(self, rects): """:...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class Solution_1: def __init__(self, rects): """:type rects: List[List[int]] 256ms""" <|body_0|> def pick(self): """:rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution_1: def __init__(self, rects): """:type rects: List[List[int]] 256ms""" self.a = [0] for i in range(len(rects) - 1): self.a.append(self.a[-1] + (rects[i][2] - rects[i][0] + 1) * (rects[i][3] - rects[i][1] + 1)) rects[i] = [rects[i][0], rects[i][1], rects...
the_stack_v2_python_sparse
RandomPointInNonoverlappingRectangles_MID_882.py
953250587/leetcode-python
train
2
c5fd1b577997ab14158787ed75b35152ac9ff12a
[ "if lstm_size is None and rnn_construction_fn is None:\n raise ValueError('Need to provide either custom rnn_construction_fn or lstm_size.')\nif lstm_size and rnn_construction_fn:\n raise ValueError('Cannot provide both custom rnn_construction_fn and lstm_size.')\nkernel_initializer = tf.compat.v1.variance_sc...
<|body_start_0|> if lstm_size is None and rnn_construction_fn is None: raise ValueError('Need to provide either custom rnn_construction_fn or lstm_size.') if lstm_size and rnn_construction_fn: raise ValueError('Cannot provide both custom rnn_construction_fn and lstm_size.') ...
Recurrent network.
LSTMEncodingNetwork
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMEncodingNetwork: """Recurrent network.""" def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, input_fc_layer_params=(75, 40), lstm_size=None, output_fc_layer_params=(75, 40), activation_fn=tf.keras.activations.relu, rnn_co...
stack_v2_sparse_classes_36k_train_004604
9,710
permissive
[ { "docstring": "Creates an instance of `LSTMEncodingNetwork`. Input preprocessing is possible via `preprocessing_layers` and `preprocessing_combiner` Layers. If the `preprocessing_layers` nest is shallower than `input_tensor_spec`, then the layers will get the subnests. For example, if: ```python input_tensor_s...
2
stack_v2_sparse_classes_30k_val_001157
Implement the Python class `LSTMEncodingNetwork` described below. Class description: Recurrent network. Method signatures and docstrings: - def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, input_fc_layer_params=(75, 40), lstm_size=None, output_fc_la...
Implement the Python class `LSTMEncodingNetwork` described below. Class description: Recurrent network. Method signatures and docstrings: - def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, input_fc_layer_params=(75, 40), lstm_size=None, output_fc_la...
eca1093d3a047e538f17f6ab92ab4d8144284f23
<|skeleton|> class LSTMEncodingNetwork: """Recurrent network.""" def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, input_fc_layer_params=(75, 40), lstm_size=None, output_fc_layer_params=(75, 40), activation_fn=tf.keras.activations.relu, rnn_co...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LSTMEncodingNetwork: """Recurrent network.""" def __init__(self, input_tensor_spec, preprocessing_layers=None, preprocessing_combiner=None, conv_layer_params=None, input_fc_layer_params=(75, 40), lstm_size=None, output_fc_layer_params=(75, 40), activation_fn=tf.keras.activations.relu, rnn_construction_fn...
the_stack_v2_python_sparse
tf_agents/networks/lstm_encoding_network.py
tensorflow/agents
train
2,755
97ba2c8dbb90199871ebead20570ddb79ccca4d5
[ "args = movies_parser.parse_args()\npage = args['page']\nper_page = args['per_page']\nsort_by = args['sort_by']\nsort_order = args['order']\nstart = per_page * (page - 1)\nstop = start + per_page\ndescending = sort_order == 'desc'\nkwargs = {'start': start, 'stop': stop, 'list_id': list_id, 'order_by': sort_by, 'de...
<|body_start_0|> args = movies_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_by = args['sort_by'] sort_order = args['order'] start = per_page * (page - 1) stop = start + per_page descending = sort_order == 'desc' kwargs =...
MovieListMoviesAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovieListMoviesAPI: def get(self, list_id, session=None): """Get movies by list ID""" <|body_0|> def post(self, list_id, session=None): """Add movies to list by ID""" <|body_1|> <|end_skeleton|> <|body_start_0|> args = movies_parser.parse_args() ...
stack_v2_sparse_classes_36k_train_004605
12,846
permissive
[ { "docstring": "Get movies by list ID", "name": "get", "signature": "def get(self, list_id, session=None)" }, { "docstring": "Add movies to list by ID", "name": "post", "signature": "def post(self, list_id, session=None)" } ]
2
stack_v2_sparse_classes_30k_train_000029
Implement the Python class `MovieListMoviesAPI` described below. Class description: Implement the MovieListMoviesAPI class. Method signatures and docstrings: - def get(self, list_id, session=None): Get movies by list ID - def post(self, list_id, session=None): Add movies to list by ID
Implement the Python class `MovieListMoviesAPI` described below. Class description: Implement the MovieListMoviesAPI class. Method signatures and docstrings: - def get(self, list_id, session=None): Get movies by list ID - def post(self, list_id, session=None): Add movies to list by ID <|skeleton|> class MovieListMov...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class MovieListMoviesAPI: def get(self, list_id, session=None): """Get movies by list ID""" <|body_0|> def post(self, list_id, session=None): """Add movies to list by ID""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovieListMoviesAPI: def get(self, list_id, session=None): """Get movies by list ID""" args = movies_parser.parse_args() page = args['page'] per_page = args['per_page'] sort_by = args['sort_by'] sort_order = args['order'] start = per_page * (page - 1) ...
the_stack_v2_python_sparse
flexget/components/managed_lists/lists/movie_list/api.py
BrutuZ/Flexget
train
1
116a13dbedb359684640e24e5013196c0d370e05
[ "super().__init__(env)\nself.beta = 0.9\nself.loss = 'mse'", "gamma = 0.95\nr = last_value\nfor item in self.memory[::-1]:\n [step, state, next_state, reward, done] = item\n r = reward + gamma * r\n item = [step, state, next_state, r, done]\n self.train(item)", "[step, state, next_state, reward, don...
<|body_start_0|> super().__init__(env) self.beta = 0.9 self.loss = 'mse' <|end_body_0|> <|body_start_1|> gamma = 0.95 r = last_value for item in self.memory[::-1]: [step, state, next_state, reward, done] = item r = reward + gamma * r i...
A2CAgent
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class A2CAgent: def __init__(self, env): """Implements the models and training of A2C policy gradient method Arguments: env (Object): OpenAI gym environment""" <|body_0|> def train_by_episode(self, last_value=0): """Train by episode Prepare the dataset before the step by s...
stack_v2_sparse_classes_36k_train_004606
29,328
permissive
[ { "docstring": "Implements the models and training of A2C policy gradient method Arguments: env (Object): OpenAI gym environment", "name": "__init__", "signature": "def __init__(self, env)" }, { "docstring": "Train by episode Prepare the dataset before the step by step training Arguments: last_v...
3
stack_v2_sparse_classes_30k_train_020780
Implement the Python class `A2CAgent` described below. Class description: Implement the A2CAgent class. Method signatures and docstrings: - def __init__(self, env): Implements the models and training of A2C policy gradient method Arguments: env (Object): OpenAI gym environment - def train_by_episode(self, last_value=...
Implement the Python class `A2CAgent` described below. Class description: Implement the A2CAgent class. Method signatures and docstrings: - def __init__(self, env): Implements the models and training of A2C policy gradient method Arguments: env (Object): OpenAI gym environment - def train_by_episode(self, last_value=...
7f447a07eb2f3dc41c83d468ae102ab8fa9dff05
<|skeleton|> class A2CAgent: def __init__(self, env): """Implements the models and training of A2C policy gradient method Arguments: env (Object): OpenAI gym environment""" <|body_0|> def train_by_episode(self, last_value=0): """Train by episode Prepare the dataset before the step by s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class A2CAgent: def __init__(self, env): """Implements the models and training of A2C policy gradient method Arguments: env (Object): OpenAI gym environment""" super().__init__(env) self.beta = 0.9 self.loss = 'mse' def train_by_episode(self, last_value=0): """Train by e...
the_stack_v2_python_sparse
chapter10-policy/policygradient-car-10.1.1.py
PacktPublishing/Advanced-Deep-Learning-with-Keras
train
1,672
1e1b37bdf82506f151aaa1701c1dea96b8c3b315
[ "kwargs = self.dict()\nkwargs['data'] = fsr.load_result_df(self.path)\nreturn IntExperimentResult(**kwargs)", "sess = check_sess(sess)\nsql_result = crud.create_experiment_result(self)\nself.uid = sql_result.id\nself.path = Path(sql_result.path)", "kwargs = self.dict()\nkwargs['experimentGroups'] = self.experim...
<|body_start_0|> kwargs = self.dict() kwargs['data'] = fsr.load_result_df(self.path) return IntExperimentResult(**kwargs) <|end_body_0|> <|body_start_1|> sess = check_sess(sess) sql_result = crud.create_experiment_result(self) self.uid = sql_result.id self.path =...
A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed description of the experiment result experiment_group_id : int unique identifier of the assoc...
DbExperimentResult
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DbExperimentResult: """A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed description of the experiment result experiment...
stack_v2_sparse_classes_36k_train_004607
4,588
permissive
[ { "docstring": "Returns c_int.IntExperimentResult", "name": "to_int_class", "signature": "def to_int_class(self)" }, { "docstring": "Creates object in db. Path and id are generated and updated in object. Parameters: - sess(sqlalchemy.orm.Session): The database session to be used, if no session i...
3
stack_v2_sparse_classes_30k_train_021480
Implement the Python class `DbExperimentResult` described below. Class description: A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed descript...
Implement the Python class `DbExperimentResult` described below. Class description: A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed descript...
4bd9f45ad9e49f4178c0b8bb1a177d7db5349c34
<|skeleton|> class DbExperimentResult: """A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed description of the experiment result experiment...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DbExperimentResult: """A class to handle database and file storage of ExperimentResults Attributes ---------- uid : int the objects unique identifier name : str the objects name hint : str brief description of the object description : str a detailed description of the experiment result experiment_group_id : i...
the_stack_v2_python_sparse
mistos-backend/src/app/api/classes/experiment_result.py
Maddonix/mistos_2
train
1
808d252ab54980d4d84b93b442782fc2eff4377d
[ "base, regression = build_function(idx, exdir)\nbase.write_simulation()\nif regression is not None:\n if isinstance(regression, flopy.mf6.MFSimulation):\n regression.write_simulation()\n else:\n regression.write_input()", "sim.set_model(sim.name if workspace is None else workspace, testModel=F...
<|body_start_0|> base, regression = build_function(idx, exdir) base.write_simulation() if regression is not None: if isinstance(regression, flopy.mf6.MFSimulation): regression.write_simulation() else: regression.write_input() <|end_body_0|>...
TestFramework
[ "LicenseRef-scancode-warranty-disclaimer", "CC0-1.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestFramework: def build(self, build_function, idx, exdir): """Build base and regression MODFLOW 6 models Parameters ---------- build_function : function user defined function that builds a base model and optionally builds a regression model. If a regression model is not built then None ...
stack_v2_sparse_classes_36k_train_004608
1,742
permissive
[ { "docstring": "Build base and regression MODFLOW 6 models Parameters ---------- build_function : function user defined function that builds a base model and optionally builds a regression model. If a regression model is not built then None must be returned from the function for the regression model. idx : int ...
2
stack_v2_sparse_classes_30k_train_007256
Implement the Python class `TestFramework` described below. Class description: Implement the TestFramework class. Method signatures and docstrings: - def build(self, build_function, idx, exdir): Build base and regression MODFLOW 6 models Parameters ---------- build_function : function user defined function that build...
Implement the Python class `TestFramework` described below. Class description: Implement the TestFramework class. Method signatures and docstrings: - def build(self, build_function, idx, exdir): Build base and regression MODFLOW 6 models Parameters ---------- build_function : function user defined function that build...
43f6198125867c487eedc64b17e9adaceb73f5ab
<|skeleton|> class TestFramework: def build(self, build_function, idx, exdir): """Build base and regression MODFLOW 6 models Parameters ---------- build_function : function user defined function that builds a base model and optionally builds a regression model. If a regression model is not built then None ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestFramework: def build(self, build_function, idx, exdir): """Build base and regression MODFLOW 6 models Parameters ---------- build_function : function user defined function that builds a base model and optionally builds a regression model. If a regression model is not built then None must be return...
the_stack_v2_python_sparse
autotest/framework.py
MODFLOW-USGS/modflow6
train
158
1a8df46ff42cc89c4eab30b93aec89d51d605c12
[ "i = bisect.bisect_left(array, value)\nif i != len(array) and array[i] == value:\n return i\nreturn -1", "assert i >= 0\nassert i < len(word)\nif cache[i] is not None:\n return cache[i]\nfull = word[i:]\nif self._find(dictionary, full) != -1:\n cache[i] = True\n return True\ncache[i] = False\nfor j in...
<|body_start_0|> i = bisect.bisect_left(array, value) if i != len(array) and array[i] == value: return i return -1 <|end_body_0|> <|body_start_1|> assert i >= 0 assert i < len(word) if cache[i] is not None: return cache[i] full = word[i:] ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _find(self, array, value): """Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist.""" <|body_0|> def _wordBreak(self, word, i, dictionary, cache): """Checks if word[i:] c...
stack_v2_sparse_classes_36k_train_004609
2,379
permissive
[ { "docstring": "Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist.", "name": "_find", "signature": "def _find(self, array, value)" }, { "docstring": "Checks if word[i:] can be broken up into words from the speci...
3
stack_v2_sparse_classes_30k_train_004530
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _find(self, array, value): Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist. - def _word...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _find(self, array, value): Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist. - def _word...
363848b7870c8d90f5be0d345204c0bf8eb45daa
<|skeleton|> class Solution: def _find(self, array, value): """Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist.""" <|body_0|> def _wordBreak(self, word, i, dictionary, cache): """Checks if word[i:] c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _find(self, array, value): """Returns the index of the first occurence of value in array. The array is expected to be sorted. Returns -1 if the value does not exist.""" i = bisect.bisect_left(array, value) if i != len(array) and array[i] == value: return i ...
the_stack_v2_python_sparse
leetcode/algorithms/word-break/solution.py
kgashok/algorithms
train
1
48bb32d6a2610239a9482847456bb0f2eb8db28c
[ "if not non_terminal(start_variable):\n raise ValueError('The start variable must not be terminal')\nself._start_variable = start_variable\nself.deriv_rules = {}", "if not non_terminal(left):\n raise ValueError('The left side must be non terminal')\nif left not in self.deriv_rules and type(right) == list:\n...
<|body_start_0|> if not non_terminal(start_variable): raise ValueError('The start variable must not be terminal') self._start_variable = start_variable self.deriv_rules = {} <|end_body_0|> <|body_start_1|> if not non_terminal(left): raise ValueError('The left sid...
Class representing a CF grammar.
Grammar
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Grammar: """Class representing a CF grammar.""" def __init__(self, start_variable): """Initialize a Grammar object. :param start_variable: The start variable, one of the non-terminals.""" <|body_0|> def add_rule(self, left, right): """Add a new derivation rule to...
stack_v2_sparse_classes_36k_train_004610
5,080
no_license
[ { "docstring": "Initialize a Grammar object. :param start_variable: The start variable, one of the non-terminals.", "name": "__init__", "signature": "def __init__(self, start_variable)" }, { "docstring": "Add a new derivation rule to the grammar. :param left: the left side of the rule, a non ter...
5
stack_v2_sparse_classes_30k_train_000540
Implement the Python class `Grammar` described below. Class description: Class representing a CF grammar. Method signatures and docstrings: - def __init__(self, start_variable): Initialize a Grammar object. :param start_variable: The start variable, one of the non-terminals. - def add_rule(self, left, right): Add a n...
Implement the Python class `Grammar` described below. Class description: Class representing a CF grammar. Method signatures and docstrings: - def __init__(self, start_variable): Initialize a Grammar object. :param start_variable: The start variable, one of the non-terminals. - def add_rule(self, left, right): Add a n...
310ab38aa6b2fc573e3530816bfbfd02ac1a0936
<|skeleton|> class Grammar: """Class representing a CF grammar.""" def __init__(self, start_variable): """Initialize a Grammar object. :param start_variable: The start variable, one of the non-terminals.""" <|body_0|> def add_rule(self, left, right): """Add a new derivation rule to...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Grammar: """Class representing a CF grammar.""" def __init__(self, start_variable): """Initialize a Grammar object. :param start_variable: The start variable, one of the non-terminals.""" if not non_terminal(start_variable): raise ValueError('The start variable must not be ter...
the_stack_v2_python_sparse
4Sucipto_Lunkyadi.py
galezon/TheoryAlgorithms
train
1
aa0faf38a1bc8e55c17c2ae23c7baf291de9f098
[ "client = self.authenticate_token_endpoint_client()\nlog.debug('Validate authorization request of %r', client)\nredirect_uri = self.validate_authorization_redirect_uri(self.request, client)\nresponse_type = self.request.response_type\nif not client.check_response_type(response_type):\n raise UnauthorizedClientEr...
<|body_start_0|> client = self.authenticate_token_endpoint_client() log.debug('Validate authorization request of %r', client) redirect_uri = self.validate_authorization_redirect_uri(self.request, client) response_type = self.request.response_type if not client.check_response_type...
The implicit grant type is used to obtain access tokens (it does not support the issuance of refresh tokens) and is optimized for public clients known to operate a particular redirection URI. These clients are typically implemented in a browser using a scripting language such as JavaScript. Since this is a redirection-...
ImplicitGrant
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImplicitGrant: """The implicit grant type is used to obtain access tokens (it does not support the issuance of refresh tokens) and is optimized for public clients known to operate a particular redirection URI. These clients are typically implemented in a browser using a scripting language such as...
stack_v2_sparse_classes_36k_train_004611
9,297
permissive
[ { "docstring": "The client constructs the request URI by adding the following parameters to the query component of the authorization endpoint URI using the \"application/x-www-form-urlencoded\" format. Per `Section 4.2.1`_. response_type REQUIRED. Value MUST be set to \"token\". client_id REQUIRED. The client i...
2
null
Implement the Python class `ImplicitGrant` described below. Class description: The implicit grant type is used to obtain access tokens (it does not support the issuance of refresh tokens) and is optimized for public clients known to operate a particular redirection URI. These clients are typically implemented in a bro...
Implement the Python class `ImplicitGrant` described below. Class description: The implicit grant type is used to obtain access tokens (it does not support the issuance of refresh tokens) and is optimized for public clients known to operate a particular redirection URI. These clients are typically implemented in a bro...
1846d6ac66e89bdb3268fffe15b7e49289966366
<|skeleton|> class ImplicitGrant: """The implicit grant type is used to obtain access tokens (it does not support the issuance of refresh tokens) and is optimized for public clients known to operate a particular redirection URI. These clients are typically implemented in a browser using a scripting language such as...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImplicitGrant: """The implicit grant type is used to obtain access tokens (it does not support the issuance of refresh tokens) and is optimized for public clients known to operate a particular redirection URI. These clients are typically implemented in a browser using a scripting language such as JavaScript. ...
the_stack_v2_python_sparse
authlib/oauth2/rfc6749/grants/implicit.py
lepture/authlib
train
4,091
6f9cfaca5979ec78138348407f71106617c4e796
[ "kwargs = super().get_form_kwargs()\nkwargs.update({'camp': self.camp})\nreturn kwargs", "speaker = form.save()\nsave_speaker_availability(form, obj=speaker)\nmessages.success(self.request, 'Speaker has been updated')\nreturn redirect(reverse('backoffice:speaker_detail', kwargs={'camp_slug': self.camp.slug, 'slug...
<|body_start_0|> kwargs = super().get_form_kwargs() kwargs.update({'camp': self.camp}) return kwargs <|end_body_0|> <|body_start_1|> speaker = form.save() save_speaker_availability(form, obj=speaker) messages.success(self.request, 'Speaker has been updated') retu...
This view is used by the Content Team to update Speaker objects
SpeakerUpdateView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpeakerUpdateView: """This view is used by the Content Team to update Speaker objects""" def get_form_kwargs(self): """Set camp for the form""" <|body_0|> def form_valid(self, form): """Save object and availability""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_004612
33,145
permissive
[ { "docstring": "Set camp for the form", "name": "get_form_kwargs", "signature": "def get_form_kwargs(self)" }, { "docstring": "Save object and availability", "name": "form_valid", "signature": "def form_valid(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_008968
Implement the Python class `SpeakerUpdateView` described below. Class description: This view is used by the Content Team to update Speaker objects Method signatures and docstrings: - def get_form_kwargs(self): Set camp for the form - def form_valid(self, form): Save object and availability
Implement the Python class `SpeakerUpdateView` described below. Class description: This view is used by the Content Team to update Speaker objects Method signatures and docstrings: - def get_form_kwargs(self): Set camp for the form - def form_valid(self, form): Save object and availability <|skeleton|> class Speaker...
767deb7f58429e9162e0c2ef79be9f0f38f37ce1
<|skeleton|> class SpeakerUpdateView: """This view is used by the Content Team to update Speaker objects""" def get_form_kwargs(self): """Set camp for the form""" <|body_0|> def form_valid(self, form): """Save object and availability""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpeakerUpdateView: """This view is used by the Content Team to update Speaker objects""" def get_form_kwargs(self): """Set camp for the form""" kwargs = super().get_form_kwargs() kwargs.update({'camp': self.camp}) return kwargs def form_valid(self, form): """S...
the_stack_v2_python_sparse
src/backoffice/views/program.py
bornhack/bornhack-website
train
9
b42a48fd447ed40a4a6160f04cbe52a0ce001e35
[ "self.max_tries = max_tries\nself.delay = delay\nself.backoff = backoff\nself.max_jitter = int(max_jitter * 100)\nself.max_delay = float(max_delay)\nself._attempts = 0\nself._cur_delay = delay\nself.deadline = deadline\nself._cur_stoptime = None\nself.retry_exceptions = self.RETRY_EXCEPTIONS\nself.interrupt = inter...
<|body_start_0|> self.max_tries = max_tries self.delay = delay self.backoff = backoff self.max_jitter = int(max_jitter * 100) self.max_delay = float(max_delay) self._attempts = 0 self._cur_delay = delay self.deadline = deadline self._cur_stoptime =...
A retry helper based on kazoo.retry.KazooRetry and modified to work with coroutines.
AsyncKazooRetry
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncKazooRetry: """A retry helper based on kazoo.retry.KazooRetry and modified to work with coroutines.""" def __init__(self, max_tries=1, delay=0.1, backoff=2, max_jitter=0.8, max_delay=60, ignore_expire=True, deadline=None, interrupt=None): """Creates an AsyncKazooRetry for retryi...
stack_v2_sparse_classes_36k_train_004613
17,648
permissive
[ { "docstring": "Creates an AsyncKazooRetry for retrying coroutines. Args: max_tries: How many times to retry the command. -1 means infinite tries. delay: Initial delay between retry attempts. backoff: Backoff multiplier between retry attempts. Defaults to 2 for exponential backoff. max_jitter: Additional max ji...
4
null
Implement the Python class `AsyncKazooRetry` described below. Class description: A retry helper based on kazoo.retry.KazooRetry and modified to work with coroutines. Method signatures and docstrings: - def __init__(self, max_tries=1, delay=0.1, backoff=2, max_jitter=0.8, max_delay=60, ignore_expire=True, deadline=Non...
Implement the Python class `AsyncKazooRetry` described below. Class description: A retry helper based on kazoo.retry.KazooRetry and modified to work with coroutines. Method signatures and docstrings: - def __init__(self, max_tries=1, delay=0.1, backoff=2, max_jitter=0.8, max_delay=60, ignore_expire=True, deadline=Non...
be17e5f658d7b42b5aa7eeb7a5ddd4962f3ea82f
<|skeleton|> class AsyncKazooRetry: """A retry helper based on kazoo.retry.KazooRetry and modified to work with coroutines.""" def __init__(self, max_tries=1, delay=0.1, backoff=2, max_jitter=0.8, max_delay=60, ignore_expire=True, deadline=None, interrupt=None): """Creates an AsyncKazooRetry for retryi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsyncKazooRetry: """A retry helper based on kazoo.retry.KazooRetry and modified to work with coroutines.""" def __init__(self, max_tries=1, delay=0.1, backoff=2, max_jitter=0.8, max_delay=60, ignore_expire=True, deadline=None, interrupt=None): """Creates an AsyncKazooRetry for retrying coroutines...
the_stack_v2_python_sparse
AppDB/appscale/datastore/zkappscale/tornado_kazoo.py
obino/appscale
train
1
b20b84173b38953f184e8abc8656cb1f9ecafe56
[ "g = entry.graph\nfvg = {g2 for g2 in g.free_variables_total if isinstance(g2, Graph) and g2 not in all_entries}\nall_fvs = reduce(operator.or_, [gg.free_variables_extended for gg in entry.eqv], OrderedSet())\nif all_fvs and all((all((user in g.scope for user in g2.graph_users)) for g2 in fvg)):\n entry.fvs = al...
<|body_start_0|> g = entry.graph fvg = {g2 for g2 in g.free_variables_total if isinstance(g2, Graph) and g2 not in all_entries} all_fvs = reduce(operator.or_, [gg.free_variables_extended for gg in entry.eqv], OrderedSet()) if all_fvs and all((all((user in g.scope for user in g2.graph_use...
Lambda lifting optimization. Graphs with free variables for which we can identify all calls will be modified to take these free variables as extra arguments. This is a destructive operation.
LambdaLiftRewriter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LambdaLiftRewriter: """Lambda lifting optimization. Graphs with free variables for which we can identify all calls will be modified to take these free variables as extra arguments. This is a destructive operation.""" def filter(self, entry, all_entries): """Only graphs that have free...
stack_v2_sparse_classes_36k_train_004614
15,078
permissive
[ { "docstring": "Only graphs that have free variables will be transformed. In order for the lambda lifting to work properly when a function F refers to a function G that cannot be lambda lifted but has free variables (in other words, the G is a free variable of F), G will have to be moved inside F's scope. We on...
4
null
Implement the Python class `LambdaLiftRewriter` described below. Class description: Lambda lifting optimization. Graphs with free variables for which we can identify all calls will be modified to take these free variables as extra arguments. This is a destructive operation. Method signatures and docstrings: - def fil...
Implement the Python class `LambdaLiftRewriter` described below. Class description: Lambda lifting optimization. Graphs with free variables for which we can identify all calls will be modified to take these free variables as extra arguments. This is a destructive operation. Method signatures and docstrings: - def fil...
d7b12c15453079e1a2c4fdae611c5f741574363d
<|skeleton|> class LambdaLiftRewriter: """Lambda lifting optimization. Graphs with free variables for which we can identify all calls will be modified to take these free variables as extra arguments. This is a destructive operation.""" def filter(self, entry, all_entries): """Only graphs that have free...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LambdaLiftRewriter: """Lambda lifting optimization. Graphs with free variables for which we can identify all calls will be modified to take these free variables as extra arguments. This is a destructive operation.""" def filter(self, entry, all_entries): """Only graphs that have free variables wi...
the_stack_v2_python_sparse
myia/opt/rewrite.py
breuleux/myia
train
1
1f47d79c34b7204bef6f06bcdccec706ff4c6a8d
[ "blacklist = ['', None, '-']\nif value in blacklist:\n return\nelif type(value) == tuple and len(value) == 2 and (value[1] == True):\n self.__dict__[name] = value[0]\nelse:\n if type(value) == str:\n value = value.replace(\"'\", '')\n self.__dict__[name] = value", "variableNames = [key for key ...
<|body_start_0|> blacklist = ['', None, '-'] if value in blacklist: return elif type(value) == tuple and len(value) == 2 and (value[1] == True): self.__dict__[name] = value[0] else: if type(value) == str: value = value.replace("'", '') ...
Main
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Main: def __setattr__(self, name, value): """Function doesnt set value if it is in blacklist""" <|body_0|> def insertQuery(self): """Function returns INSERT query with its class variables""" <|body_1|> <|end_skeleton|> <|body_start_0|> blacklist = [...
stack_v2_sparse_classes_36k_train_004615
5,468
permissive
[ { "docstring": "Function doesnt set value if it is in blacklist", "name": "__setattr__", "signature": "def __setattr__(self, name, value)" }, { "docstring": "Function returns INSERT query with its class variables", "name": "insertQuery", "signature": "def insertQuery(self)" } ]
2
stack_v2_sparse_classes_30k_train_018028
Implement the Python class `Main` described below. Class description: Implement the Main class. Method signatures and docstrings: - def __setattr__(self, name, value): Function doesnt set value if it is in blacklist - def insertQuery(self): Function returns INSERT query with its class variables
Implement the Python class `Main` described below. Class description: Implement the Main class. Method signatures and docstrings: - def __setattr__(self, name, value): Function doesnt set value if it is in blacklist - def insertQuery(self): Function returns INSERT query with its class variables <|skeleton|> class Ma...
c296af4934c9e70ce56ccdb23c5998e2d8418cab
<|skeleton|> class Main: def __setattr__(self, name, value): """Function doesnt set value if it is in blacklist""" <|body_0|> def insertQuery(self): """Function returns INSERT query with its class variables""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Main: def __setattr__(self, name, value): """Function doesnt set value if it is in blacklist""" blacklist = ['', None, '-'] if value in blacklist: return elif type(value) == tuple and len(value) == 2 and (value[1] == True): self.__dict__[name] = value[0]...
the_stack_v2_python_sparse
web-app/generate_random_patients.py
sandbernar/corona-prod
train
0
5347204cf8b328aa55010d90053b65244ef5e29c
[ "if not self.log_softmax:\n return {'logits': NeuralType(('B', 'T', 'C'), LogitsType())}\nelse:\n return {'log_probs': NeuralType(('B', 'T', 'C'), LogprobsType())}", "super().__init__(hidden_size=hidden_size, dropout=dropout)\nself.log_softmax = log_softmax\nself.mlp = MultiLayerPerceptron(hidden_size, num_...
<|body_start_0|> if not self.log_softmax: return {'logits': NeuralType(('B', 'T', 'C'), LogitsType())} else: return {'log_probs': NeuralType(('B', 'T', 'C'), LogprobsType())} <|end_body_0|> <|body_start_1|> super().__init__(hidden_size=hidden_size, dropout=dropout) ...
A module to perform token level classification tasks such as Named entity recognition.
TokenClassifier
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TokenClassifier: """A module to perform token level classification tasks such as Named entity recognition.""" def output_types(self) -> Optional[Dict[str, NeuralType]]: """Returns definitions of module output ports.""" <|body_0|> def __init__(self, hidden_size: int, num_...
stack_v2_sparse_classes_36k_train_004616
6,136
permissive
[ { "docstring": "Returns definitions of module output ports.", "name": "output_types", "signature": "def output_types(self) -> Optional[Dict[str, NeuralType]]" }, { "docstring": "Initializes the Token Classifier module. Args: hidden_size: the size of the hidden dimension num_classes: number of cl...
3
null
Implement the Python class `TokenClassifier` described below. Class description: A module to perform token level classification tasks such as Named entity recognition. Method signatures and docstrings: - def output_types(self) -> Optional[Dict[str, NeuralType]]: Returns definitions of module output ports. - def __ini...
Implement the Python class `TokenClassifier` described below. Class description: A module to perform token level classification tasks such as Named entity recognition. Method signatures and docstrings: - def output_types(self) -> Optional[Dict[str, NeuralType]]: Returns definitions of module output ports. - def __ini...
c20a16ea8aa2a9d8e31a98eb22178ddb9d5935e7
<|skeleton|> class TokenClassifier: """A module to perform token level classification tasks such as Named entity recognition.""" def output_types(self) -> Optional[Dict[str, NeuralType]]: """Returns definitions of module output ports.""" <|body_0|> def __init__(self, hidden_size: int, num_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TokenClassifier: """A module to perform token level classification tasks such as Named entity recognition.""" def output_types(self) -> Optional[Dict[str, NeuralType]]: """Returns definitions of module output ports.""" if not self.log_softmax: return {'logits': NeuralType(('B'...
the_stack_v2_python_sparse
nemo/collections/nlp/modules/common/token_classifier.py
NVIDIA/NeMo
train
7,957
592d0bfeb755e797480a1d13cbb17972eeb9b97d
[ "logger.info('Overriding class: JS -> NBJS.')\nsuper(NBJS, self).__init__(params)\nlogger.info('Class overrided.')", "r1 = r.generate_uniform_random_number()\nmotion = self.gamma * r1\nreturn motion" ]
<|body_start_0|> logger.info('Overriding class: JS -> NBJS.') super(NBJS, self).__init__(params) logger.info('Class overrided.') <|end_body_0|> <|body_start_1|> r1 = r.generate_uniform_random_number() motion = self.gamma * r1 return motion <|end_body_1|>
An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending.
NBJS
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NBJS: """An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending.""" def __init__(self, params: Optional[Dict[str, Any]]=None) -> None: """Initialization method. Args: params: Contains key-value parame...
stack_v2_sparse_classes_36k_train_004617
7,453
permissive
[ { "docstring": "Initialization method. Args: params: Contains key-value parameters to the meta-heuristics.", "name": "__init__", "signature": "def __init__(self, params: Optional[Dict[str, Any]]=None) -> None" }, { "docstring": "Calculates type A motion. Args: lb: Array of lower bounds. ub: Arra...
2
stack_v2_sparse_classes_30k_train_014230
Implement the Python class `NBJS` described below. Class description: An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending. Method signatures and docstrings: - def __init__(self, params: Optional[Dict[str, Any]]=None) -> None: Initi...
Implement the Python class `NBJS` described below. Class description: An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending. Method signatures and docstrings: - def __init__(self, params: Optional[Dict[str, Any]]=None) -> None: Initi...
7326a887ed8e3858bc99c8815048d56d02edf88c
<|skeleton|> class NBJS: """An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending.""" def __init__(self, params: Optional[Dict[str, Any]]=None) -> None: """Initialization method. Args: params: Contains key-value parame...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NBJS: """An NBJS class, inherited from JS. This is the designed class to define NBJS-related variables and methods. References: Publication pending.""" def __init__(self, params: Optional[Dict[str, Any]]=None) -> None: """Initialization method. Args: params: Contains key-value parameters to the m...
the_stack_v2_python_sparse
opytimizer/optimizers/swarm/js.py
gugarosa/opytimizer
train
602
07233c99a408e4919c41eb7527456d5f02995f65
[ "losses_dict = dict()\nlosses_dict['loss_disc_fake'] = F.relu(1 + disc_pred_fake).mean()\nlosses_dict['loss_disc_real'] = F.relu(1 - disc_pred_real).mean()\nloss, log_var = self.parse_losses(losses_dict)\nreturn (loss, log_var)", "losses_dict = dict()\nlosses_dict['loss_gen'] = -disc_pred_fake.mean()\nloss, log_v...
<|body_start_0|> losses_dict = dict() losses_dict['loss_disc_fake'] = F.relu(1 + disc_pred_fake).mean() losses_dict['loss_disc_real'] = F.relu(1 - disc_pred_real).mean() loss, log_var = self.parse_losses(losses_dict) return (loss, log_var) <|end_body_0|> <|body_start_1|> ...
Implementation of `Geometric GAN`. <https://arxiv.org/abs/1705.02894>`_(GGAN).
GGAN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GGAN: """Implementation of `Geometric GAN`. <https://arxiv.org/abs/1705.02894>`_(GGAN).""" def disc_loss(self, disc_pred_fake: Tensor, disc_pred_real: Tensor) -> Tuple: """Get disc loss. GGAN use hinge loss to train the discriminator. .. math: L_{D} = -\\mathbb{E}_{\\left(x, y\\right...
stack_v2_sparse_classes_36k_train_004618
4,255
permissive
[ { "docstring": "Get disc loss. GGAN use hinge loss to train the discriminator. .. math: L_{D} = -\\\\mathbb{E}_{\\\\left(x, y\\\\right)\\\\sim{p}_{data}} \\\\left[\\\\min\\\\left(0, -1 + D\\\\left(x, y\\\\right)\\\\right)\\\\right] -\\\\mathbb{E}_{z\\\\sim{p_{z}}, y\\\\sim{p_{data}}}\\\\left[\\\\min \\\\left(0,...
4
null
Implement the Python class `GGAN` described below. Class description: Implementation of `Geometric GAN`. <https://arxiv.org/abs/1705.02894>`_(GGAN). Method signatures and docstrings: - def disc_loss(self, disc_pred_fake: Tensor, disc_pred_real: Tensor) -> Tuple: Get disc loss. GGAN use hinge loss to train the discrim...
Implement the Python class `GGAN` described below. Class description: Implementation of `Geometric GAN`. <https://arxiv.org/abs/1705.02894>`_(GGAN). Method signatures and docstrings: - def disc_loss(self, disc_pred_fake: Tensor, disc_pred_real: Tensor) -> Tuple: Get disc loss. GGAN use hinge loss to train the discrim...
a382f143c0fd20d227e1e5524831ba26a568190d
<|skeleton|> class GGAN: """Implementation of `Geometric GAN`. <https://arxiv.org/abs/1705.02894>`_(GGAN).""" def disc_loss(self, disc_pred_fake: Tensor, disc_pred_real: Tensor) -> Tuple: """Get disc loss. GGAN use hinge loss to train the discriminator. .. math: L_{D} = -\\mathbb{E}_{\\left(x, y\\right...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GGAN: """Implementation of `Geometric GAN`. <https://arxiv.org/abs/1705.02894>`_(GGAN).""" def disc_loss(self, disc_pred_fake: Tensor, disc_pred_real: Tensor) -> Tuple: """Get disc loss. GGAN use hinge loss to train the discriminator. .. math: L_{D} = -\\mathbb{E}_{\\left(x, y\\right)\\sim{p}_{da...
the_stack_v2_python_sparse
mmagic/models/editors/ggan/ggan.py
open-mmlab/mmagic
train
1,370
28214f4f210989418f9c7ac1507b0edb367ecdb1
[ "if HAS_ISBD and ISelectableBrowserDefault.providedBy(target):\n return target.getLayout()\nelse:\n view = target.getTypeInfo().getActionById('view') or 'base_view'\n if view == 'view':\n view = target.portal_type.lower() + '_view'\n return view", "data = [HelpCenterTutorialPage.SearchableText(...
<|body_start_0|> if HAS_ISBD and ISelectableBrowserDefault.providedBy(target): return target.getLayout() else: view = target.getTypeInfo().getActionById('view') or 'base_view' if view == 'view': view = target.portal_type.lower() + '_view' r...
A tutorial containing TutorialPages, Files and Images.
BungeniHelpCenterTutorialPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BungeniHelpCenterTutorialPage: """A tutorial containing TutorialPages, Files and Images.""" def getTargetObjectLayout(self, target): """Returns target object 'view' action page template""" <|body_0|> def SearchableText(self): """Append references' searchable fiel...
stack_v2_sparse_classes_36k_train_004619
34,826
no_license
[ { "docstring": "Returns target object 'view' action page template", "name": "getTargetObjectLayout", "signature": "def getTargetObjectLayout(self, target)" }, { "docstring": "Append references' searchable fields.", "name": "SearchableText", "signature": "def SearchableText(self)" } ]
2
null
Implement the Python class `BungeniHelpCenterTutorialPage` described below. Class description: A tutorial containing TutorialPages, Files and Images. Method signatures and docstrings: - def getTargetObjectLayout(self, target): Returns target object 'view' action page template - def SearchableText(self): Append refere...
Implement the Python class `BungeniHelpCenterTutorialPage` described below. Class description: A tutorial containing TutorialPages, Files and Images. Method signatures and docstrings: - def getTargetObjectLayout(self, target): Returns target object 'view' action page template - def SearchableText(self): Append refere...
5cf0ba31dfbff8d2c1b4aa8ab6f69c7a0ae9870d
<|skeleton|> class BungeniHelpCenterTutorialPage: """A tutorial containing TutorialPages, Files and Images.""" def getTargetObjectLayout(self, target): """Returns target object 'view' action page template""" <|body_0|> def SearchableText(self): """Append references' searchable fiel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BungeniHelpCenterTutorialPage: """A tutorial containing TutorialPages, Files and Images.""" def getTargetObjectLayout(self, target): """Returns target object 'view' action page template""" if HAS_ISBD and ISelectableBrowserDefault.providedBy(target): return target.getLayout() ...
the_stack_v2_python_sparse
plone.products/BungeniHelpCenter/branches/plone4/content/HelpCenter.py
malangalanga/bungeni-portal
train
0
cd121b2152bac944b45e1a2d03b811b3cfe26445
[ "self.blockNumber = blockNumber\nself.unknownVarIndex = unknownVarIndex\nself.indepVar = indepVar\nx = self.indepVar\nlogger.debug('indepVarOrders:')\nlogger.debug(indepVarOrders)\nself.derivOrder = int(indepVarOrders[x])\nself.userIndepVariables = ['x', 'y', 'z']\nvar = self.indepVar\nself.indepVarIndexList = [sel...
<|body_start_0|> self.blockNumber = blockNumber self.unknownVarIndex = unknownVarIndex self.indepVar = indepVar x = self.indepVar logger.debug('indepVarOrders:') logger.debug(indepVarOrders) self.derivOrder = int(indepVarOrders[x]) self.userIndepVariables ...
DESCRIPTION: Find d^{n}(u)/d(x)^{n} where n is n > 1 for central functions (used method common_diff) INPUT: See ``self.__init__``
GenPureCommon
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenPureCommon: """DESCRIPTION: Find d^{n}(u)/d(x)^{n} where n is n > 1 for central functions (used method common_diff) INPUT: See ``self.__init__``""" def __init__(self, blockNumber, unknownVarIndex, indepVar, indepVarOrders): """Inputs: - ``blockNumber`` -- used for strides and cell...
stack_v2_sparse_classes_36k_train_004620
7,512
no_license
[ { "docstring": "Inputs: - ``blockNumber`` -- used for strides and cellsize variables names - ``unknownVarIndex`` -- shift index for variable (like (U, V)-> (source[+0], source[+1])) (Ex: dict([('U', 0), ('V', 1)])['U']) - ``indepVar`` -- like 'x' i.e. for which diff maked - ``indepVarOrders`` -- dict([(var, flo...
5
null
Implement the Python class `GenPureCommon` described below. Class description: DESCRIPTION: Find d^{n}(u)/d(x)^{n} where n is n > 1 for central functions (used method common_diff) INPUT: See ``self.__init__`` Method signatures and docstrings: - def __init__(self, blockNumber, unknownVarIndex, indepVar, indepVarOrders...
Implement the Python class `GenPureCommon` described below. Class description: DESCRIPTION: Find d^{n}(u)/d(x)^{n} where n is n > 1 for central functions (used method common_diff) INPUT: See ``self.__init__`` Method signatures and docstrings: - def __init__(self, blockNumber, unknownVarIndex, indepVar, indepVarOrders...
1e1e5d46713bb15519653f4e9151f559f6637e4a
<|skeleton|> class GenPureCommon: """DESCRIPTION: Find d^{n}(u)/d(x)^{n} where n is n > 1 for central functions (used method common_diff) INPUT: See ``self.__init__``""" def __init__(self, blockNumber, unknownVarIndex, indepVar, indepVarOrders): """Inputs: - ``blockNumber`` -- used for strides and cell...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GenPureCommon: """DESCRIPTION: Find d^{n}(u)/d(x)^{n} where n is n > 1 for central functions (used method common_diff) INPUT: See ``self.__init__``""" def __init__(self, blockNumber, unknownVarIndex, indepVar, indepVarOrders): """Inputs: - ``blockNumber`` -- used for strides and cellsize variable...
the_stack_v2_python_sparse
spaces/math_space/common/env/equation/data/terms/output/cpp/additions/deriv/gen_pure_common.py
dglyzin/tracer
train
0
4c2283b9f271fdbbf74de7511a457e34fbecc993
[ "self.sensor_data = SensorData.SensorData()\nself.sensor_data.setName('Temperature Sensor Data')\nself.sense = SenseHat()\nself.sense.clear()\nself.sensorDataManager = SensorDataManager.SensorDataManager()\npass", "temp = self.sense.get_temperature()\nself.sensor_data.addValue(temp)\ntempString = self.generateStr...
<|body_start_0|> self.sensor_data = SensorData.SensorData() self.sensor_data.setName('Temperature Sensor Data') self.sense = SenseHat() self.sense.clear() self.sensorDataManager = SensorDataManager.SensorDataManager() pass <|end_body_0|> <|body_start_1|> temp = s...
Class which reads the temperature data from the SenseHAT. Stores the data in the SensorData class and then further calls SensorDataManager to parse the stored data.
TempSensorAdapterTask
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TempSensorAdapterTask: """Class which reads the temperature data from the SenseHAT. Stores the data in the SensorData class and then further calls SensorDataManager to parse the stored data.""" def __init__(self): """Constructor""" <|body_0|> def readTemperature(self) ->...
stack_v2_sparse_classes_36k_train_004621
2,375
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to read new data from the senseHat. Data is then pushed to the SensorData instance, then a sensorDataManager instance is called which overtakes execution.", "name": "readTemperature"...
3
stack_v2_sparse_classes_30k_test_000272
Implement the Python class `TempSensorAdapterTask` described below. Class description: Class which reads the temperature data from the SenseHAT. Stores the data in the SensorData class and then further calls SensorDataManager to parse the stored data. Method signatures and docstrings: - def __init__(self): Constructo...
Implement the Python class `TempSensorAdapterTask` described below. Class description: Class which reads the temperature data from the SenseHAT. Stores the data in the SensorData class and then further calls SensorDataManager to parse the stored data. Method signatures and docstrings: - def __init__(self): Constructo...
dfd5fd8c757cae8b1306ae3e4eb2cfc9bf124fee
<|skeleton|> class TempSensorAdapterTask: """Class which reads the temperature data from the SenseHAT. Stores the data in the SensorData class and then further calls SensorDataManager to parse the stored data.""" def __init__(self): """Constructor""" <|body_0|> def readTemperature(self) ->...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TempSensorAdapterTask: """Class which reads the temperature data from the SenseHAT. Stores the data in the SensorData class and then further calls SensorDataManager to parse the stored data.""" def __init__(self): """Constructor""" self.sensor_data = SensorData.SensorData() self.s...
the_stack_v2_python_sparse
apps/labs/module03/TempSensorAdapterTask.py
mnk400/iot-device
train
0
3e3f5fa0142072dee681009fb5cda7ccb633a43f
[ "if isinstance(value, str) and value.replace(' ', '') == '':\n raise InvalidEmptyValue(field_name=field.name)\nreturn value", "ti_utils = ThreatIntelUtil(session_tc=registry.session_tc)\nindicator_types = cls.indicator_types or ti_utils.indicator_types\nif value.lower() not in [i.lower() for i in indicator_typ...
<|body_start_0|> if isinstance(value, str) and value.replace(' ', '') == '': raise InvalidEmptyValue(field_name=field.name) return value <|end_body_0|> <|body_start_1|> ti_utils = ThreatIntelUtil(session_tc=registry.session_tc) indicator_types = cls.indicator_types or ti_uti...
Indicator Entity Field (Model) Type
IndicatorEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndicatorEntity: """Indicator Entity Field (Model) Type""" def is_empty(cls, value: str, field: ModelField) -> str: """Validate that the value is a non-empty string.""" <|body_0|> def is_type(cls, value: str, field: ModelField) -> str: """Validate that the entity...
stack_v2_sparse_classes_36k_train_004622
2,094
permissive
[ { "docstring": "Validate that the value is a non-empty string.", "name": "is_empty", "signature": "def is_empty(cls, value: str, field: ModelField) -> str" }, { "docstring": "Validate that the entity is of a specific Indicator type.", "name": "is_type", "signature": "def is_type(cls, val...
2
stack_v2_sparse_classes_30k_train_016830
Implement the Python class `IndicatorEntity` described below. Class description: Indicator Entity Field (Model) Type Method signatures and docstrings: - def is_empty(cls, value: str, field: ModelField) -> str: Validate that the value is a non-empty string. - def is_type(cls, value: str, field: ModelField) -> str: Val...
Implement the Python class `IndicatorEntity` described below. Class description: Indicator Entity Field (Model) Type Method signatures and docstrings: - def is_empty(cls, value: str, field: ModelField) -> str: Validate that the value is a non-empty string. - def is_type(cls, value: str, field: ModelField) -> str: Val...
30dc147e40d63d1082ec2a5e6c62005b60c29c37
<|skeleton|> class IndicatorEntity: """Indicator Entity Field (Model) Type""" def is_empty(cls, value: str, field: ModelField) -> str: """Validate that the value is a non-empty string.""" <|body_0|> def is_type(cls, value: str, field: ModelField) -> str: """Validate that the entity...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IndicatorEntity: """Indicator Entity Field (Model) Type""" def is_empty(cls, value: str, field: ModelField) -> str: """Validate that the value is a non-empty string.""" if isinstance(value, str) and value.replace(' ', '') == '': raise InvalidEmptyValue(field_name=field.name) ...
the_stack_v2_python_sparse
tcex/input/field_type/indicator_entity.py
ThreatConnect-Inc/tcex
train
24
686a19c3a7fbc8a0edb1951309d3e78524ab04a7
[ "user = self.env.user\ncan_access = False\nfor rec in self:\n if user.id == SUPERUSER_ID or rec.author_id.user_id.id == user.id:\n can_access = True\n if user.has_group('tms_modules.group_profile_tms_admin'):\n can_access = True\nreturn can_access", "user_env = self.env['res.users']\nemployee_...
<|body_start_0|> user = self.env.user can_access = False for rec in self: if user.id == SUPERUSER_ID or rec.author_id.user_id.id == user.id: can_access = True if user.has_group('tms_modules.group_profile_tms_admin'): can_access = True ...
HrAppraisalInput
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HrAppraisalInput: def _security_https_password(self): """Only author of input and Admin profile can see expect_salary_raise""" <|body_0|> def _password_security(self): """Author can see and edit all secured fields of his appraisal input HR manager and Manager of the ...
stack_v2_sparse_classes_36k_train_004623
3,054
no_license
[ { "docstring": "Only author of input and Admin profile can see expect_salary_raise", "name": "_security_https_password", "signature": "def _security_https_password(self)" }, { "docstring": "Author can see and edit all secured fields of his appraisal input HR manager and Manager of the employee_o...
2
null
Implement the Python class `HrAppraisalInput` described below. Class description: Implement the HrAppraisalInput class. Method signatures and docstrings: - def _security_https_password(self): Only author of input and Admin profile can see expect_salary_raise - def _password_security(self): Author can see and edit all...
Implement the Python class `HrAppraisalInput` described below. Class description: Implement the HrAppraisalInput class. Method signatures and docstrings: - def _security_https_password(self): Only author of input and Admin profile can see expect_salary_raise - def _password_security(self): Author can see and edit all...
673dd0f2a7c0b69a984342b20f55164a97a00529
<|skeleton|> class HrAppraisalInput: def _security_https_password(self): """Only author of input and Admin profile can see expect_salary_raise""" <|body_0|> def _password_security(self): """Author can see and edit all secured fields of his appraisal input HR manager and Manager of the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HrAppraisalInput: def _security_https_password(self): """Only author of input and Admin profile can see expect_salary_raise""" user = self.env.user can_access = False for rec in self: if user.id == SUPERUSER_ID or rec.author_id.user_id.id == user.id: ...
the_stack_v2_python_sparse
project/tms_modules/model/hr/hr_appraisal_input.py
TinPlusIT05/tms
train
0
4f8948521bc9ecc91b2ace6e440b943ab943bc8e
[ "uid = getSecurityManager().getUser().getId()\nif uid == 'Anonymous':\n return ()\nbook = component.getUtility(IAddressBookUtility).get(uid)\nentry_names = list(book.keys())\nentry_names.sort()\nentry_dict = {}\nfor entry_name in entry_names:\n second_line = ''\n if book[entry_name].ship_second_line:\n ...
<|body_start_0|> uid = getSecurityManager().getUser().getId() if uid == 'Anonymous': return () book = component.getUtility(IAddressBookUtility).get(uid) entry_names = list(book.keys()) entry_names.sort() entry_dict = {} for entry_name in entry_names: ...
AddressBookView
[ "ZPL-2.1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddressBookView: def getEntryNames(self): """get a list of entry names""" <|body_0|> def getEntryScripts(self): """Returns javascript function that fill the fields with the data""" <|body_1|> <|end_skeleton|> <|body_start_0|> uid = getSecurityManage...
stack_v2_sparse_classes_36k_train_004624
37,142
permissive
[ { "docstring": "get a list of entry names", "name": "getEntryNames", "signature": "def getEntryNames(self)" }, { "docstring": "Returns javascript function that fill the fields with the data", "name": "getEntryScripts", "signature": "def getEntryScripts(self)" } ]
2
stack_v2_sparse_classes_30k_train_008436
Implement the Python class `AddressBookView` described below. Class description: Implement the AddressBookView class. Method signatures and docstrings: - def getEntryNames(self): get a list of entry names - def getEntryScripts(self): Returns javascript function that fill the fields with the data
Implement the Python class `AddressBookView` described below. Class description: Implement the AddressBookView class. Method signatures and docstrings: - def getEntryNames(self): get a list of entry names - def getEntryScripts(self): Returns javascript function that fill the fields with the data <|skeleton|> class A...
95ebc05678cb8db7510e0de0857ad41253800fb1
<|skeleton|> class AddressBookView: def getEntryNames(self): """get a list of entry names""" <|body_0|> def getEntryScripts(self): """Returns javascript function that fill the fields with the data""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddressBookView: def getEntryNames(self): """get a list of entry names""" uid = getSecurityManager().getUser().getId() if uid == 'Anonymous': return () book = component.getUtility(IAddressBookUtility).get(uid) entry_names = list(book.keys()) entry_na...
the_stack_v2_python_sparse
Products/PloneGetPaid/browser/checkout.py
Martronic-SA/Products.PloneGetPaid
train
0
4f222c52fc99692e590270e54ccf5a592d9ba5da
[ "self.logistic_cost = logistic_cost\nself.loan_rate = loan_rate\nself.annual_interest = annual_interest\nself.subsidized_interest = subsidized_interest\nself.loan_period = loan_period\nself.grace_period = grace_period\nself.own_funds_rate = 1 - self.loan_rate\nself.own_fund = self.logistic_cost * self.own_funds_rat...
<|body_start_0|> self.logistic_cost = logistic_cost self.loan_rate = loan_rate self.annual_interest = annual_interest self.subsidized_interest = subsidized_interest self.loan_period = loan_period self.grace_period = grace_period self.own_funds_rate = 1 - self.loan...
Class of Loan Mechanism.
Loan
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Loan: """Class of Loan Mechanism.""" def __init__(self, logistic_cost, loan_rate, annual_interest, subsidized_interest, loan_period, grace_period): """Args: logistic_cost (float): initial cost that will be divided in loan amount and own funds amount. loan (float): how much of the log...
stack_v2_sparse_classes_36k_train_004625
13,376
no_license
[ { "docstring": "Args: logistic_cost (float): initial cost that will be divided in loan amount and own funds amount. loan (float): how much of the logistic cost will be in loan amount. annual_interest (float): annual interest rate of loan. subsidizes_interest (float): annual subsidized interest rate of loan. loa...
3
stack_v2_sparse_classes_30k_train_001623
Implement the Python class `Loan` described below. Class description: Class of Loan Mechanism. Method signatures and docstrings: - def __init__(self, logistic_cost, loan_rate, annual_interest, subsidized_interest, loan_period, grace_period): Args: logistic_cost (float): initial cost that will be divided in loan amoun...
Implement the Python class `Loan` described below. Class description: Class of Loan Mechanism. Method signatures and docstrings: - def __init__(self, logistic_cost, loan_rate, annual_interest, subsidized_interest, loan_period, grace_period): Args: logistic_cost (float): initial cost that will be divided in loan amoun...
7701766260a54836e9b767acfcc1c288535cbc78
<|skeleton|> class Loan: """Class of Loan Mechanism.""" def __init__(self, logistic_cost, loan_rate, annual_interest, subsidized_interest, loan_period, grace_period): """Args: logistic_cost (float): initial cost that will be divided in loan amount and own funds amount. loan (float): how much of the log...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Loan: """Class of Loan Mechanism.""" def __init__(self, logistic_cost, loan_rate, annual_interest, subsidized_interest, loan_period, grace_period): """Args: logistic_cost (float): initial cost that will be divided in loan amount and own funds amount. loan (float): how much of the logistic cost wi...
the_stack_v2_python_sparse
MuPIA/pro2/modules/financial_mechanism.py
atsta/MuPIA
train
0
6cfb4c27f0a897695d4b0bf229f64f5d0d5bb378
[ "if headA is None or headB is None:\n return\ncur1 = headA\nwhile cur1:\n cur2 = headB\n while cur2:\n if cur1 == cur2:\n return cur1\n else:\n cur2 = cur2.next\n cur1 = cur1.next\nreturn", "listA = []\nif headA is None or headB is None:\n return\ncur1 = headA\nw...
<|body_start_0|> if headA is None or headB is None: return cur1 = headA while cur1: cur2 = headB while cur2: if cur1 == cur2: return cur1 else: cur2 = cur2.next cur1 = cur1.nex...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode2(self, headA, headB): """采用先遍历后判断的逻辑,此种方法把链表的存储优势浪费了,使用庞大的列表,对空间的需求和遍历也是绝大的开支,仍超时 :param headA: :par...
stack_v2_sparse_classes_36k_train_004626
3,348
no_license
[ { "docstring": "采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode", "name": "getIntersectionNode", "signature": "def getIntersectionNode(self, headA, headB)" }, { "docstring": "采用先遍历后判断的逻辑,此种方法把链表的存储优势浪费了,使用庞大的列表,对空间的需求和遍历也是绝大的开支,仍超时 :param headA: :param headB: :return:", ...
4
stack_v2_sparse_classes_30k_train_000467
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): 采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode2(self, headA, headB): 采用先遍历后判断的逻辑,此种...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getIntersectionNode(self, headA, headB): 采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode - def getIntersectionNode2(self, headA, headB): 采用先遍历后判断的逻辑,此种...
16b6fc4247c91a919d38bf18835f10fc29fccca7
<|skeleton|> class Solution: def getIntersectionNode(self, headA, headB): """采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode""" <|body_0|> def getIntersectionNode2(self, headA, headB): """采用先遍历后判断的逻辑,此种方法把链表的存储优势浪费了,使用庞大的列表,对空间的需求和遍历也是绝大的开支,仍超时 :param headA: :par...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def getIntersectionNode(self, headA, headB): """采用边遍历边判断的方法,实现了功能,但是提交超时 :type head1, head1: ListNode :rtype: ListNode""" if headA is None or headB is None: return cur1 = headA while cur1: cur2 = headB while cur2: if...
the_stack_v2_python_sparse
problem_160.py
SeanLau/leetcode
train
0
5dfe6cc7aa0c84402992d3b7ec632fa5945a609d
[ "self._hass = hass\nself._step = step\nself._attr = attr\nself._state = 0\nself._hass.states.set(ENTITYID, self._state, attributes=self._attr)\ntrack_time_interval(self._hass, self.update, TIME_BETWEEN_UPDATES)", "f = open('C:\\\\\\\\Apache24\\\\\\\\htdocs\\\\\\\\index1.html', 'r')\nlinecache.clearcache()\na = li...
<|body_start_0|> self._hass = hass self._step = step self._attr = attr self._state = 0 self._hass.states.set(ENTITYID, self._state, attributes=self._attr) track_time_interval(self._hass, self.update, TIME_BETWEEN_UPDATES) <|end_body_0|> <|body_start_1|> f = open(...
定义一个类,此类中存储了状态与属性值,并定时更新状态.
GrowingState
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GrowingState: """定义一个类,此类中存储了状态与属性值,并定时更新状态.""" def __init__(self, hass, step, attr): """GrwoingState类的初始化函数,参数为hass、step和attr.""" <|body_0|> def update(self, now): """在GrowingState类中定义函数update,更新状态.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004627
3,093
no_license
[ { "docstring": "GrwoingState类的初始化函数,参数为hass、step和attr.", "name": "__init__", "signature": "def __init__(self, hass, step, attr)" }, { "docstring": "在GrowingState类中定义函数update,更新状态.", "name": "update", "signature": "def update(self, now)" } ]
2
null
Implement the Python class `GrowingState` described below. Class description: 定义一个类,此类中存储了状态与属性值,并定时更新状态. Method signatures and docstrings: - def __init__(self, hass, step, attr): GrwoingState类的初始化函数,参数为hass、step和attr. - def update(self, now): 在GrowingState类中定义函数update,更新状态.
Implement the Python class `GrowingState` described below. Class description: 定义一个类,此类中存储了状态与属性值,并定时更新状态. Method signatures and docstrings: - def __init__(self, hass, step, attr): GrwoingState类的初始化函数,参数为hass、step和attr. - def update(self, now): 在GrowingState类中定义函数update,更新状态. <|skeleton|> class GrowingState: """定...
92aa2711b763a2c93be238825c445bf2db8da391
<|skeleton|> class GrowingState: """定义一个类,此类中存储了状态与属性值,并定时更新状态.""" def __init__(self, hass, step, attr): """GrwoingState类的初始化函数,参数为hass、step和attr.""" <|body_0|> def update(self, now): """在GrowingState类中定义函数update,更新状态.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GrowingState: """定义一个类,此类中存储了状态与属性值,并定时更新状态.""" def __init__(self, hass, step, attr): """GrwoingState类的初始化函数,参数为hass、step和attr.""" self._hass = hass self._step = step self._attr = attr self._state = 0 self._hass.states.set(ENTITYID, self._state, attributes=...
the_stack_v2_python_sparse
l-team/team1/basketball/ha/Device2.py
mutiangua/EIS2020
train
0
c05276bb5d9a7603d89b900dabcadc7865a25b67
[ "intermediate = {}\nfor str in strs:\n key = ''.join(sorted(list(str)))\n if key in intermediate.keys():\n values = intermediate.get(key)\n values.append(str)\n else:\n intermediate[key] = [str]\nreturn [item for item in intermediate.values()]", "intermediate = {}\nfor str in strs:\n...
<|body_start_0|> intermediate = {} for str in strs: key = ''.join(sorted(list(str))) if key in intermediate.keys(): values = intermediate.get(key) values.append(str) else: intermediate[key] = [str] return [item f...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_0|> def groupAnagrams_2(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> intermediate = ...
stack_v2_sparse_classes_36k_train_004628
1,443
permissive
[ { "docstring": ":type strs: List[str] :rtype: List[List[str]]", "name": "groupAnagrams", "signature": "def groupAnagrams(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: List[List[str]]", "name": "groupAnagrams_2", "signature": "def groupAnagrams_2(self, strs)" } ]
2
stack_v2_sparse_classes_30k_train_020111
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]] - def groupAnagrams_2(self, strs): :type strs: List[str] :rtype: List[List[str]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]] - def groupAnagrams_2(self, strs): :type strs: List[str] :rtype: List[List[str]] <|skeleton|> class ...
91c1ee4875a740d8be48fc9d74098a37e2f5cae6
<|skeleton|> class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_0|> def groupAnagrams_2(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" intermediate = {} for str in strs: key = ''.join(sorted(list(str))) if key in intermediate.keys(): values = intermediate.get(key) values....
the_stack_v2_python_sparse
Python_Test/PyCodePractice/com/djs/learn/GroupAnagrams.py
djsilenceboy/LearnTest
train
3
6cee6e2dbd7c9ee92196600fdd346f6b3afa8580
[ "if file_resources is None:\n file_resources = {}\n file_resources['NONCODEv5_source'] = os.path.join(path, 'NONCODEv5_source')\n file_resources['NONCODEv5_Transcript2Gene'] = os.path.join(path, 'NONCODEv5_Transcript2Gene')\n file_resources['NONCODEv5_human.func'] = os.path.join(path, 'NONCODEv5_human.f...
<|body_start_0|> if file_resources is None: file_resources = {} file_resources['NONCODEv5_source'] = os.path.join(path, 'NONCODEv5_source') file_resources['NONCODEv5_Transcript2Gene'] = os.path.join(path, 'NONCODEv5_Transcript2Gene') file_resources['NONCODEv5_huma...
Loads the NONCODE database from http://noncode.org . Default path: "http://www.noncode.org/datadownload" . Default file_resources: { "NONCODEv6_human.fa": "NONCODEv6_human.fa.gz", "": "", "": "", }
NONCODE
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NONCODE: """Loads the NONCODE database from http://noncode.org . Default path: "http://www.noncode.org/datadownload" . Default file_resources: { "NONCODEv6_human.fa": "NONCODEv6_human.fa.gz", "": "", "": "", }""" def __init__(self, path='http://www.noncode.org/datadownload', file_resources=N...
stack_v2_sparse_classes_36k_train_004629
19,914
permissive
[ { "docstring": "Args: path: file_resources: col_rename: verbose: blocksize:", "name": "__init__", "signature": "def __init__(self, path='http://www.noncode.org/datadownload', file_resources=None, col_rename=None, verbose=False, blocksize=None, **kwargs)" }, { "docstring": "Args: file_resources: ...
2
stack_v2_sparse_classes_30k_val_001011
Implement the Python class `NONCODE` described below. Class description: Loads the NONCODE database from http://noncode.org . Default path: "http://www.noncode.org/datadownload" . Default file_resources: { "NONCODEv6_human.fa": "NONCODEv6_human.fa.gz", "": "", "": "", } Method signatures and docstrings: - def __init_...
Implement the Python class `NONCODE` described below. Class description: Loads the NONCODE database from http://noncode.org . Default path: "http://www.noncode.org/datadownload" . Default file_resources: { "NONCODEv6_human.fa": "NONCODEv6_human.fa.gz", "": "", "": "", } Method signatures and docstrings: - def __init_...
35a0e00964c9b308f831263936f9507a69f52613
<|skeleton|> class NONCODE: """Loads the NONCODE database from http://noncode.org . Default path: "http://www.noncode.org/datadownload" . Default file_resources: { "NONCODEv6_human.fa": "NONCODEv6_human.fa.gz", "": "", "": "", }""" def __init__(self, path='http://www.noncode.org/datadownload', file_resources=N...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NONCODE: """Loads the NONCODE database from http://noncode.org . Default path: "http://www.noncode.org/datadownload" . Default file_resources: { "NONCODEv6_human.fa": "NONCODEv6_human.fa.gz", "": "", "": "", }""" def __init__(self, path='http://www.noncode.org/datadownload', file_resources=None, col_rena...
the_stack_v2_python_sparse
openomics/database/annotation.py
JonnyTran/OpenOmics
train
8
e69c481a2971bb0a8397ebb305c12a2ab23c6df3
[ "self.details = Details(selenium)\nself.legacy_rides = LegacyRideBooking(selenium)\nself.rides = Rides(selenium)", "ride: dict = ride_factory.build()\nrider = ride['rider']\nrider_name = f\"{rider['first_name']} {rider['last_name']}\"\nself.rides.visit()\nself.rides.navigate_to_legacy_ride_booking()\nself.legacy_...
<|body_start_0|> self.details = Details(selenium) self.legacy_rides = LegacyRideBooking(selenium) self.rides = Rides(selenium) <|end_body_0|> <|body_start_1|> ride: dict = ride_factory.build() rider = ride['rider'] rider_name = f"{rider['first_name']} {rider['last_name']...
Battery of tests for legacy ASAP ride booking functionality.
TestLegacyAsapRides
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestLegacyAsapRides: """Battery of tests for legacy ASAP ride booking functionality.""" def set_pages(self, selenium: fixture) -> None: """Instantiate all pages used in ASAP ride testing.""" <|body_0|> def test_booking(self, ride_factory: factory, service: fixture) -> No...
stack_v2_sparse_classes_36k_train_004630
3,539
no_license
[ { "docstring": "Instantiate all pages used in ASAP ride testing.", "name": "set_pages", "signature": "def set_pages(self, selenium: fixture) -> None" }, { "docstring": "Input valid ride information for an asap ride, then check for a success state. This test is part of the smoke testing battery. ...
5
null
Implement the Python class `TestLegacyAsapRides` described below. Class description: Battery of tests for legacy ASAP ride booking functionality. Method signatures and docstrings: - def set_pages(self, selenium: fixture) -> None: Instantiate all pages used in ASAP ride testing. - def test_booking(self, ride_factory: ...
Implement the Python class `TestLegacyAsapRides` described below. Class description: Battery of tests for legacy ASAP ride booking functionality. Method signatures and docstrings: - def set_pages(self, selenium: fixture) -> None: Instantiate all pages used in ASAP ride testing. - def test_booking(self, ride_factory: ...
cf1fc925a8730bd416cd874dad3a836c86334589
<|skeleton|> class TestLegacyAsapRides: """Battery of tests for legacy ASAP ride booking functionality.""" def set_pages(self, selenium: fixture) -> None: """Instantiate all pages used in ASAP ride testing.""" <|body_0|> def test_booking(self, ride_factory: factory, service: fixture) -> No...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestLegacyAsapRides: """Battery of tests for legacy ASAP ride booking functionality.""" def set_pages(self, selenium: fixture) -> None: """Instantiate all pages used in ASAP ride testing.""" self.details = Details(selenium) self.legacy_rides = LegacyRideBooking(selenium) s...
the_stack_v2_python_sparse
integration/ondemand/admin/rides/test_legacy_ride_booking.py
jmt-transloc/ondemand-python
train
1
b404e61165b655a9d14ad76f1f3bc2d411e76d29
[ "self.font = pygame.font.SysFont('Century Gothic', 15)\nself.file_name = file_name\nif not os.path.isfile(self.file_name):\n self.on_empty_file()\nwith open(file_name) as f:\n self.scores = json.load(f)", "tmp = {'Alex': (222, '22.04.1997'), 'Oleg': (111, '09.04.1998')}\nwith open(self.file_name, 'w') as f:...
<|body_start_0|> self.font = pygame.font.SysFont('Century Gothic', 15) self.file_name = file_name if not os.path.isfile(self.file_name): self.on_empty_file() with open(file_name) as f: self.scores = json.load(f) <|end_body_0|> <|body_start_1|> tmp = {'Ale...
Leaderboard class :param file: name of file
Leaderboard
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Leaderboard: """Leaderboard class :param file: name of file""" def __init__(self, file_name=FILE_NAME): """Init leaderboard.""" <|body_0|> def on_empty_file(self): """Fill empty file.""" <|body_1|> def save_score(self, name, score): """Save s...
stack_v2_sparse_classes_36k_train_004631
1,761
no_license
[ { "docstring": "Init leaderboard.", "name": "__init__", "signature": "def __init__(self, file_name=FILE_NAME)" }, { "docstring": "Fill empty file.", "name": "on_empty_file", "signature": "def on_empty_file(self)" }, { "docstring": "Save score from last game. :param name: name of ...
4
stack_v2_sparse_classes_30k_train_005230
Implement the Python class `Leaderboard` described below. Class description: Leaderboard class :param file: name of file Method signatures and docstrings: - def __init__(self, file_name=FILE_NAME): Init leaderboard. - def on_empty_file(self): Fill empty file. - def save_score(self, name, score): Save score from last ...
Implement the Python class `Leaderboard` described below. Class description: Leaderboard class :param file: name of file Method signatures and docstrings: - def __init__(self, file_name=FILE_NAME): Init leaderboard. - def on_empty_file(self): Fill empty file. - def save_score(self, name, score): Save score from last ...
4b392ab5fd13734ec671e69f501ee842f95ae5b0
<|skeleton|> class Leaderboard: """Leaderboard class :param file: name of file""" def __init__(self, file_name=FILE_NAME): """Init leaderboard.""" <|body_0|> def on_empty_file(self): """Fill empty file.""" <|body_1|> def save_score(self, name, score): """Save s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Leaderboard: """Leaderboard class :param file: name of file""" def __init__(self, file_name=FILE_NAME): """Init leaderboard.""" self.font = pygame.font.SysFont('Century Gothic', 15) self.file_name = file_name if not os.path.isfile(self.file_name): self.on_empty...
the_stack_v2_python_sparse
leaderboard.py
BelyankovOO/JointProject
train
0
5f477eaf8233cc0cd2d72366b75ff88c2b2b54f7
[ "db = self.request.app['db']\ndocument = await virtool.otus.db.join_and_format(db, otu_id)\nif not document:\n raise NotFound()\nreturn json_response(document['isolates'])", "db = self.request.app['db']\nreference = await get_one_field(db.otus, 'reference', otu_id)\nif not reference:\n raise NotFound()\nif ...
<|body_start_0|> db = self.request.app['db'] document = await virtool.otus.db.join_and_format(db, otu_id) if not document: raise NotFound() return json_response(document['isolates']) <|end_body_0|> <|body_start_1|> db = self.request.app['db'] reference = awai...
IsolatesView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IsolatesView: async def get(self, otu_id: str, /): """List isolates. Lists all the isolates and sequences for an OTU.""" <|body_0|> async def post(self, otu_id: str, /, data: CreateIsolateRequest) -> Union[r201[OTUIsolate], r401, r404]: """Create an isolate. Creates ...
stack_v2_sparse_classes_36k_train_004632
16,946
permissive
[ { "docstring": "List isolates. Lists all the isolates and sequences for an OTU.", "name": "get", "signature": "async def get(self, otu_id: str, /)" }, { "docstring": "Create an isolate. Creates an isolate on the OTU specified by `otu_id`.", "name": "post", "signature": "async def post(se...
2
null
Implement the Python class `IsolatesView` described below. Class description: Implement the IsolatesView class. Method signatures and docstrings: - async def get(self, otu_id: str, /): List isolates. Lists all the isolates and sequences for an OTU. - async def post(self, otu_id: str, /, data: CreateIsolateRequest) ->...
Implement the Python class `IsolatesView` described below. Class description: Implement the IsolatesView class. Method signatures and docstrings: - async def get(self, otu_id: str, /): List isolates. Lists all the isolates and sequences for an OTU. - async def post(self, otu_id: str, /, data: CreateIsolateRequest) ->...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class IsolatesView: async def get(self, otu_id: str, /): """List isolates. Lists all the isolates and sequences for an OTU.""" <|body_0|> async def post(self, otu_id: str, /, data: CreateIsolateRequest) -> Union[r201[OTUIsolate], r401, r404]: """Create an isolate. Creates ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IsolatesView: async def get(self, otu_id: str, /): """List isolates. Lists all the isolates and sequences for an OTU.""" db = self.request.app['db'] document = await virtool.otus.db.join_and_format(db, otu_id) if not document: raise NotFound() return json_re...
the_stack_v2_python_sparse
virtool/otus/api.py
virtool/virtool
train
45
30fc70590cbe446265c98b20da4c707a9b32f658
[ "self.source_addr = source_addr\nself.disconnected = False\nreturn super(SourceAddrStreamer, self).__init__(auth, listener, **kwargs)", "super(SourceAddrStreamer, self).new_session()\nif self.source_addr is not None:\n self.session.mount('http://', SourceAddressAdapter((self.source_addr, 0)))\n self.session...
<|body_start_0|> self.source_addr = source_addr self.disconnected = False return super(SourceAddrStreamer, self).__init__(auth, listener, **kwargs) <|end_body_0|> <|body_start_1|> super(SourceAddrStreamer, self).new_session() if self.source_addr is not None: self.ses...
Tweepy Stream wrapper for handling using source address adapter.
SourceAddrStreamer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceAddrStreamer: """Tweepy Stream wrapper for handling using source address adapter.""" def __init__(self, auth, listener, source_addr=None, **kwargs): """store source address.""" <|body_0|> def new_session(self): """create new session with the source address....
stack_v2_sparse_classes_36k_train_004633
3,950
no_license
[ { "docstring": "store source address.", "name": "__init__", "signature": "def __init__(self, auth, listener, source_addr=None, **kwargs)" }, { "docstring": "create new session with the source address.", "name": "new_session", "signature": "def new_session(self)" }, { "docstring":...
3
stack_v2_sparse_classes_30k_train_016360
Implement the Python class `SourceAddrStreamer` described below. Class description: Tweepy Stream wrapper for handling using source address adapter. Method signatures and docstrings: - def __init__(self, auth, listener, source_addr=None, **kwargs): store source address. - def new_session(self): create new session wit...
Implement the Python class `SourceAddrStreamer` described below. Class description: Tweepy Stream wrapper for handling using source address adapter. Method signatures and docstrings: - def __init__(self, auth, listener, source_addr=None, **kwargs): store source address. - def new_session(self): create new session wit...
96b24dae671e4dd1948decdb0d84ff3c5ce6981c
<|skeleton|> class SourceAddrStreamer: """Tweepy Stream wrapper for handling using source address adapter.""" def __init__(self, auth, listener, source_addr=None, **kwargs): """store source address.""" <|body_0|> def new_session(self): """create new session with the source address....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SourceAddrStreamer: """Tweepy Stream wrapper for handling using source address adapter.""" def __init__(self, auth, listener, source_addr=None, **kwargs): """store source address.""" self.source_addr = source_addr self.disconnected = False return super(SourceAddrStreamer, ...
the_stack_v2_python_sparse
streamer.py
geosoco/twitter_capture_client
train
1
9e61c7fea8febb2273a0dab1bc3af0618bdd2246
[ "items = pickle_utils.LoadPickle(filename, compress=True, open_function=options.open_function)\nmodules = {name: Module(name, filename=None, ast=None, pickle=pickle, has_unresolved_pointers=False) for name, pickle in items}\nreturn cls(options, modules=modules, missing_modules=missing_modules)", "if not (mod_info...
<|body_start_0|> items = pickle_utils.LoadPickle(filename, compress=True, open_function=options.open_function) modules = {name: Module(name, filename=None, ast=None, pickle=pickle, has_unresolved_pointers=False) for name, pickle in items} return cls(options, modules=modules, missing_modules=miss...
A Loader which always loads pickle instead of PYI, for speed.
PickledPyiLoader
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PickledPyiLoader: """A Loader which always loads pickle instead of PYI, for speed.""" def load_from_pickle(cls, filename, options, missing_modules=()): """Load a pytd module from a pickle file.""" <|body_0|> def load_module(self, mod_info, mod_ast=None): """Load ...
stack_v2_sparse_classes_36k_train_004634
29,651
permissive
[ { "docstring": "Load a pytd module from a pickle file.", "name": "load_from_pickle", "signature": "def load_from_pickle(cls, filename, options, missing_modules=())" }, { "docstring": "Load (or retrieve from cache) a module and resolve its dependencies.", "name": "load_module", "signature...
2
null
Implement the Python class `PickledPyiLoader` described below. Class description: A Loader which always loads pickle instead of PYI, for speed. Method signatures and docstrings: - def load_from_pickle(cls, filename, options, missing_modules=()): Load a pytd module from a pickle file. - def load_module(self, mod_info,...
Implement the Python class `PickledPyiLoader` described below. Class description: A Loader which always loads pickle instead of PYI, for speed. Method signatures and docstrings: - def load_from_pickle(cls, filename, options, missing_modules=()): Load a pytd module from a pickle file. - def load_module(self, mod_info,...
bda0b9547af9a084bb2bd1427f58dcde968e48b5
<|skeleton|> class PickledPyiLoader: """A Loader which always loads pickle instead of PYI, for speed.""" def load_from_pickle(cls, filename, options, missing_modules=()): """Load a pytd module from a pickle file.""" <|body_0|> def load_module(self, mod_info, mod_ast=None): """Load ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PickledPyiLoader: """A Loader which always loads pickle instead of PYI, for speed.""" def load_from_pickle(cls, filename, options, missing_modules=()): """Load a pytd module from a pickle file.""" items = pickle_utils.LoadPickle(filename, compress=True, open_function=options.open_function...
the_stack_v2_python_sparse
pytype/load_pytd.py
google/pytype
train
4,595
3b94f443693a2e332147080ed39b32323363f3cd
[ "user = self.request.user\nif user.username == 'chris':\n return UploadedFile.objects.all()\nreturn UploadedFile.objects.filter(owner=user)", "response = super(UploadedFileList, self).list(request, *args, **kwargs)\nquery_list = [reverse('uploadedfile-list-query-search', request=request)]\nresponse = services....
<|body_start_0|> user = self.request.user if user.username == 'chris': return UploadedFile.objects.all() return UploadedFile.objects.filter(owner=user) <|end_body_0|> <|body_start_1|> response = super(UploadedFileList, self).list(request, *args, **kwargs) query_list ...
A view for the collection of uploaded user files.
UploadedFileList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UploadedFileList: """A view for the collection of uploaded user files.""" def get_queryset(self): """Overriden to return a custom queryset that is only comprised by the files owned by the currently authenticated user.""" <|body_0|> def list(self, request, *args, **kwargs...
stack_v2_sparse_classes_36k_train_004635
4,631
permissive
[ { "docstring": "Overriden to return a custom queryset that is only comprised by the files owned by the currently authenticated user.", "name": "get_queryset", "signature": "def get_queryset(self)" }, { "docstring": "Overriden to append document-level link relations and a collection+json template...
2
null
Implement the Python class `UploadedFileList` described below. Class description: A view for the collection of uploaded user files. Method signatures and docstrings: - def get_queryset(self): Overriden to return a custom queryset that is only comprised by the files owned by the currently authenticated user. - def lis...
Implement the Python class `UploadedFileList` described below. Class description: A view for the collection of uploaded user files. Method signatures and docstrings: - def get_queryset(self): Overriden to return a custom queryset that is only comprised by the files owned by the currently authenticated user. - def lis...
20d3eedf20610af9182f6cca8db8f0b3546b5336
<|skeleton|> class UploadedFileList: """A view for the collection of uploaded user files.""" def get_queryset(self): """Overriden to return a custom queryset that is only comprised by the files owned by the currently authenticated user.""" <|body_0|> def list(self, request, *args, **kwargs...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UploadedFileList: """A view for the collection of uploaded user files.""" def get_queryset(self): """Overriden to return a custom queryset that is only comprised by the files owned by the currently authenticated user.""" user = self.request.user if user.username == 'chris': ...
the_stack_v2_python_sparse
chris_backend/uploadedfiles/views.py
FNNDSC/ChRIS_ultron_backEnd
train
36
ec83cb02476cf7cbc8047119f63cc717e95f51f2
[ "super().__init__(*args, command=HydraBase(), **kwargs)\nself.service = service\nself.login = login", "args = []\nif self.login:\n args.extend(['-L', cfg['tools.hydra.loginfile']])\nif self._port.is_ipv6:\n args.append('-6')\nargs.extend(['-P', cfg['tools.hydra.passwordfile'], '-s', str(self._port.number), ...
<|body_start_0|> super().__init__(*args, command=HydraBase(), **kwargs) self.service = service self.login = login <|end_body_0|> <|body_start_1|> args = [] if self.login: args.extend(['-L', cfg['tools.hydra.loginfile']]) if self._port.is_ipv6: arg...
This is task for Hydra tool. Call Hydra and parse output
HydraScriptTask
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HydraScriptTask: """This is task for Hydra tool. Call Hydra and parse output""" def __init__(self, service, login=True, *args, **kwargs): """Initialize variables Args: port (Port): Port for scanning service (str): Service name for scanning login (bool): Define if hydra should use log...
stack_v2_sparse_classes_36k_train_004636
1,216
permissive
[ { "docstring": "Initialize variables Args: port (Port): Port for scanning service (str): Service name for scanning login (bool): Define if hydra should use login or not *args: **kwargs:", "name": "__init__", "signature": "def __init__(self, service, login=True, *args, **kwargs)" }, { "docstring"...
2
stack_v2_sparse_classes_30k_train_008215
Implement the Python class `HydraScriptTask` described below. Class description: This is task for Hydra tool. Call Hydra and parse output Method signatures and docstrings: - def __init__(self, service, login=True, *args, **kwargs): Initialize variables Args: port (Port): Port for scanning service (str): Service name ...
Implement the Python class `HydraScriptTask` described below. Class description: This is task for Hydra tool. Call Hydra and parse output Method signatures and docstrings: - def __init__(self, service, login=True, *args, **kwargs): Initialize variables Args: port (Port): Port for scanning service (str): Service name ...
bb21ff02965ed0cca5a55ee559eae77856d9866c
<|skeleton|> class HydraScriptTask: """This is task for Hydra tool. Call Hydra and parse output""" def __init__(self, service, login=True, *args, **kwargs): """Initialize variables Args: port (Port): Port for scanning service (str): Service name for scanning login (bool): Define if hydra should use log...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HydraScriptTask: """This is task for Hydra tool. Call Hydra and parse output""" def __init__(self, service, login=True, *args, **kwargs): """Initialize variables Args: port (Port): Port for scanning service (str): Service name for scanning login (bool): Define if hydra should use login or not *ar...
the_stack_v2_python_sparse
tools/hydra/tasks.py
collectivesense/aucote
train
0
bcf1b9c13fa954c345b9ae9778b1cea8e402d049
[ "super(MobiusAdd, self).__init__()\nself.pow = Pow()\nself.sum = ReduceSum(keep_dims=True)\nself.clamp_min = ClampMin()\nself.min_norm = min_norm", "x2 = self.sum(self.pow(x, 2), dim)\ny2 = self.sum(self.pow(y, 2), dim)\nxy = self.sum(x * y, dim)\nnum = (1 + 2 * c * xy + c * y2) * x + (1 - c * x2) * y\ndenom = 1 ...
<|body_start_0|> super(MobiusAdd, self).__init__() self.pow = Pow() self.sum = ReduceSum(keep_dims=True) self.clamp_min = ClampMin() self.min_norm = min_norm <|end_body_0|> <|body_start_1|> x2 = self.sum(self.pow(x, 2), dim) y2 = self.sum(self.pow(y, 2), dim) ...
mobius add
MobiusAdd
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MobiusAdd: """mobius add""" def __init__(self, min_norm): """init fun""" <|body_0|> def construct(self, x, y, c, dim=-1): """constructfun""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(MobiusAdd, self).__init__() self.pow = Pow() ...
stack_v2_sparse_classes_36k_train_004637
8,596
permissive
[ { "docstring": "init fun", "name": "__init__", "signature": "def __init__(self, min_norm)" }, { "docstring": "constructfun", "name": "construct", "signature": "def construct(self, x, y, c, dim=-1)" } ]
2
null
Implement the Python class `MobiusAdd` described below. Class description: mobius add Method signatures and docstrings: - def __init__(self, min_norm): init fun - def construct(self, x, y, c, dim=-1): constructfun
Implement the Python class `MobiusAdd` described below. Class description: mobius add Method signatures and docstrings: - def __init__(self, min_norm): init fun - def construct(self, x, y, c, dim=-1): constructfun <|skeleton|> class MobiusAdd: """mobius add""" def __init__(self, min_norm): """init f...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class MobiusAdd: """mobius add""" def __init__(self, min_norm): """init fun""" <|body_0|> def construct(self, x, y, c, dim=-1): """constructfun""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MobiusAdd: """mobius add""" def __init__(self, min_norm): """init fun""" super(MobiusAdd, self).__init__() self.pow = Pow() self.sum = ReduceSum(keep_dims=True) self.clamp_min = ClampMin() self.min_norm = min_norm def construct(self, x, y, c, dim=-1): ...
the_stack_v2_python_sparse
research/nlp/hypertext/src/poincare.py
mindspore-ai/models
train
301
85916d336328f7f703a77cd71ba4db60f09c7734
[ "if isinstance(key, int):\n return RouterAlert(key)\nif key not in RouterAlert._member_map_:\n return extend_enum(RouterAlert, key, default)\nreturn RouterAlert[key]", "if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 70 <= va...
<|body_start_0|> if isinstance(key, int): return RouterAlert(key) if key not in RouterAlert._member_map_: return extend_enum(RouterAlert, key, default) return RouterAlert[key] <|end_body_0|> <|body_start_1|> if not (isinstance(value, int) and 0 <= value <= 65535)...
[RouterAlert] IPv6 Router Alert Option Values
RouterAlert
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RouterAlert: """[RouterAlert] IPv6 Router Alert Option Values""" def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> def ...
stack_v2_sparse_classes_36k_train_004638
8,804
permissive
[ { "docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:", "name": "get", "signature": "def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert'" }, { "docstring": "Lookup function used when value is not found....
2
null
Implement the Python class `RouterAlert` described below. Class description: [RouterAlert] IPv6 Router Alert Option Values Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert': Backport support for original codes. Args: key: Key to get enum item. default: Default value if ...
Implement the Python class `RouterAlert` described below. Class description: [RouterAlert] IPv6 Router Alert Option Values Method signatures and docstrings: - def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert': Backport support for original codes. Args: key: Key to get enum item. default: Default value if ...
a6fe49ec58f09e105bec5a00fb66d9b3f22730d9
<|skeleton|> class RouterAlert: """[RouterAlert] IPv6 Router Alert Option Values""" def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" <|body_0|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RouterAlert: """[RouterAlert] IPv6 Router Alert Option Values""" def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert': """Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:""" if isinstance(key, int): ...
the_stack_v2_python_sparse
pcapkit/const/ipv6/router_alert.py
JarryShaw/PyPCAPKit
train
204
05d5ba533381fee995087a656975281a62bc8b17
[ "cost_matrix = np.array([[[4, 1, 3], [2, 0, 5], [3, 2, 2]]], dtype=np.float32)\n_, adjacency_matrix = matchers.hungarian_matching(tf.constant(cost_matrix))\nadjacency_output = adjacency_matrix.numpy()\ncorrect_output = np.array([[0, 1, 0], [1, 0, 0], [0, 0, 1]], dtype=bool)\nself.assertAllEqual(adjacency_output[0],...
<|body_start_0|> cost_matrix = np.array([[[4, 1, 3], [2, 0, 5], [3, 2, 2]]], dtype=np.float32) _, adjacency_matrix = matchers.hungarian_matching(tf.constant(cost_matrix)) adjacency_output = adjacency_matrix.numpy() correct_output = np.array([[0, 1, 0], [1, 0, 0], [0, 0, 1]], dtype=bool) ...
MatchersOpsTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MatchersOpsTest: def testLinearSumAssignment(self): """Check a simple 2D test case of the Linear Sum Assignment problem. Ensures that the implementation of the matching algorithm is correct and functional on TPUs.""" <|body_0|> def testBatchedLinearSumAssignment(self): ...
stack_v2_sparse_classes_36k_train_004639
3,439
permissive
[ { "docstring": "Check a simple 2D test case of the Linear Sum Assignment problem. Ensures that the implementation of the matching algorithm is correct and functional on TPUs.", "name": "testLinearSumAssignment", "signature": "def testLinearSumAssignment(self)" }, { "docstring": "Check a batched ...
4
null
Implement the Python class `MatchersOpsTest` described below. Class description: Implement the MatchersOpsTest class. Method signatures and docstrings: - def testLinearSumAssignment(self): Check a simple 2D test case of the Linear Sum Assignment problem. Ensures that the implementation of the matching algorithm is co...
Implement the Python class `MatchersOpsTest` described below. Class description: Implement the MatchersOpsTest class. Method signatures and docstrings: - def testLinearSumAssignment(self): Check a simple 2D test case of the Linear Sum Assignment problem. Ensures that the implementation of the matching algorithm is co...
d3507b550a3ade40cade60a79eb5b8978b56c7ae
<|skeleton|> class MatchersOpsTest: def testLinearSumAssignment(self): """Check a simple 2D test case of the Linear Sum Assignment problem. Ensures that the implementation of the matching algorithm is correct and functional on TPUs.""" <|body_0|> def testBatchedLinearSumAssignment(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MatchersOpsTest: def testLinearSumAssignment(self): """Check a simple 2D test case of the Linear Sum Assignment problem. Ensures that the implementation of the matching algorithm is correct and functional on TPUs.""" cost_matrix = np.array([[[4, 1, 3], [2, 0, 5], [3, 2, 2]]], dtype=np.float32)...
the_stack_v2_python_sparse
official/projects/detr/ops/matchers_test.py
jianzhnie/models
train
2
da0c4e1077bf059179a43f5ee32eeaa020ff1e03
[ "steps = dict()\n\ndef dfs(root, step):\n if root is None:\n return\n if step not in steps:\n steps[step] = root.val\n else:\n steps[step] = max(steps[step], root.val)\n if root.left:\n dfs(root.left, step + 1)\n if root.right:\n dfs(root.right, step + 1)\ndfs(root,...
<|body_start_0|> steps = dict() def dfs(root, step): if root is None: return if step not in steps: steps[step] = root.val else: steps[step] = max(steps[step], root.val) if root.left: dfs(root...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestValues(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def largestValuesBFS(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> steps = dict() def ...
stack_v2_sparse_classes_36k_train_004640
1,886
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "largestValues", "signature": "def largestValues(self, root)" }, { "docstring": ":type root: TreeNode :rtype: List[int]", "name": "largestValuesBFS", "signature": "def largestValuesBFS(self, root)" } ]
2
stack_v2_sparse_classes_30k_test_000823
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestValues(self, root): :type root: TreeNode :rtype: List[int] - def largestValuesBFS(self, root): :type root: TreeNode :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestValues(self, root): :type root: TreeNode :rtype: List[int] - def largestValuesBFS(self, root): :type root: TreeNode :rtype: List[int] <|skeleton|> class Solution: ...
1520e1e9bb0c428797a3e5234e5b328110472c20
<|skeleton|> class Solution: def largestValues(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_0|> def largestValuesBFS(self, root): """:type root: TreeNode :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def largestValues(self, root): """:type root: TreeNode :rtype: List[int]""" steps = dict() def dfs(root, step): if root is None: return if step not in steps: steps[step] = root.val else: step...
the_stack_v2_python_sparse
Depth-first Search/515. Find Largest Value in Each Tree Row.py
tinkle1129/Leetcode_Solution
train
0
a27d12c4a81e6ba65fd390657ca38f2b7ee02065
[ "loc_inactive = mixer.blend(Location, manager=None, active=False)\nurl = '/api/locations/'\nresponse = self.client.get(url)\nself.assertEqual(response.status_code, 200)\nself.assertNotContains(response, loc_inactive.name)", "url = '/api/locations/?location_id={}'.format(self.loc1.pk)\nresponse = self.client.get(u...
<|body_start_0|> loc_inactive = mixer.blend(Location, manager=None, active=False) url = '/api/locations/' response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertNotContains(response, loc_inactive.name) <|end_body_0|> <|body_start_1|> url =...
LocationResourceTestCase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LocationResourceTestCase: def test_list(self): """Test the LocationResource list response""" <|body_0|> def test_filter(self): """Test the LocationResource filtered response""" <|body_1|> <|end_skeleton|> <|body_start_0|> loc_inactive = mixer.blend(...
stack_v2_sparse_classes_36k_train_004641
18,653
permissive
[ { "docstring": "Test the LocationResource list response", "name": "test_list", "signature": "def test_list(self)" }, { "docstring": "Test the LocationResource filtered response", "name": "test_filter", "signature": "def test_filter(self)" } ]
2
stack_v2_sparse_classes_30k_val_000160
Implement the Python class `LocationResourceTestCase` described below. Class description: Implement the LocationResourceTestCase class. Method signatures and docstrings: - def test_list(self): Test the LocationResource list response - def test_filter(self): Test the LocationResource filtered response
Implement the Python class `LocationResourceTestCase` described below. Class description: Implement the LocationResourceTestCase class. Method signatures and docstrings: - def test_list(self): Test the LocationResource list response - def test_filter(self): Test the LocationResource filtered response <|skeleton|> cl...
4d5caceba69cac7f59b63745a0f52322004df2eb
<|skeleton|> class LocationResourceTestCase: def test_list(self): """Test the LocationResource list response""" <|body_0|> def test_filter(self): """Test the LocationResource filtered response""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LocationResourceTestCase: def test_list(self): """Test the LocationResource list response""" loc_inactive = mixer.blend(Location, manager=None, active=False) url = '/api/locations/' response = self.client.get(url) self.assertEqual(response.status_code, 200) self...
the_stack_v2_python_sparse
organisation/test_api.py
bryceprince0/it-assets
train
0
1b576beb7ed0ae60cc00d1ad100e17c81a2eb8ae
[ "self.run_time = run_time\nsuper().__init__(start_end_points, *args, **kwargs)\nself._next_dots_coords = {'x': self.x_funnel_center, 'y': self.y_point_bottom + self.y_bottom_shift * 2}", "current_coord = self._next_dots_coords.get('y')\nx_left_to_bottom_right = self.left_to_bottom_right.get_all_points()[-1][0]\nx...
<|body_start_0|> self.run_time = run_time super().__init__(start_end_points, *args, **kwargs) self._next_dots_coords = {'x': self.x_funnel_center, 'y': self.y_point_bottom + self.y_bottom_shift * 2} <|end_body_0|> <|body_start_1|> current_coord = self._next_dots_coords.get('y') ...
Overridden Funnel class to add 'movable' functionality
MovableFunnel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovableFunnel: """Overridden Funnel class to add 'movable' functionality""" def __init__(self, start_end_points: Tuple[tuple, tuple], run_time: Union[int, float], *args, **kwargs): """Class initialization. It receives all parameters that the Funnel class needs. Args: start_end_points...
stack_v2_sparse_classes_36k_train_004642
5,092
no_license
[ { "docstring": "Class initialization. It receives all parameters that the Funnel class needs. Args: start_end_points (Tuple[tuple, tuple]): Left top and right top points. ((x1,y1), (x2,y2)). run_time (Union[int, float]): How quickly we need to animate dots.", "name": "__init__", "signature": "def __init...
3
stack_v2_sparse_classes_30k_test_000108
Implement the Python class `MovableFunnel` described below. Class description: Overridden Funnel class to add 'movable' functionality Method signatures and docstrings: - def __init__(self, start_end_points: Tuple[tuple, tuple], run_time: Union[int, float], *args, **kwargs): Class initialization. It receives all param...
Implement the Python class `MovableFunnel` described below. Class description: Overridden Funnel class to add 'movable' functionality Method signatures and docstrings: - def __init__(self, start_end_points: Tuple[tuple, tuple], run_time: Union[int, float], *args, **kwargs): Class initialization. It receives all param...
290bf56ef888283a0225939ed8b1f87445e506d0
<|skeleton|> class MovableFunnel: """Overridden Funnel class to add 'movable' functionality""" def __init__(self, start_end_points: Tuple[tuple, tuple], run_time: Union[int, float], *args, **kwargs): """Class initialization. It receives all parameters that the Funnel class needs. Args: start_end_points...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovableFunnel: """Overridden Funnel class to add 'movable' functionality""" def __init__(self, start_end_points: Tuple[tuple, tuple], run_time: Union[int, float], *args, **kwargs): """Class initialization. It receives all parameters that the Funnel class needs. Args: start_end_points (Tuple[tuple...
the_stack_v2_python_sparse
classes/movable_funnel.py
mohovkm/habr_manim
train
0
10a919e8a5978aeb8eaf66409f071a2e553cf04e
[ "self._unix_start = datetime(1970, 1, 1)\nt = Time(mjd_init, format='mjd')\nself.initial_dt = t.datetime", "if datetime2 is None:\n datetime2 = self._unix_start\nif reverse:\n return (datetime1 - datetime2).total_seconds()\nelse:\n return (datetime2 - datetime1).total_seconds()" ]
<|body_start_0|> self._unix_start = datetime(1970, 1, 1) t = Time(mjd_init, format='mjd') self.initial_dt = t.datetime <|end_body_0|> <|body_start_1|> if datetime2 is None: datetime2 = self._unix_start if reverse: return (datetime1 - datetime2).total_seco...
Don't need the full time handler, so save a dependency and use this.
dummy_time_handler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class dummy_time_handler: """Don't need the full time handler, so save a dependency and use this.""" def __init__(self, mjd_init): """Parameters ---------- mjd_init : float The initial mjd""" <|body_0|> def time_since_given_datetime(self, datetime1, datetime2=None, reverse=Fal...
stack_v2_sparse_classes_36k_train_004643
17,828
no_license
[ { "docstring": "Parameters ---------- mjd_init : float The initial mjd", "name": "__init__", "signature": "def __init__(self, mjd_init)" }, { "docstring": "Really? We need a method to do one line of arithmatic?", "name": "time_since_given_datetime", "signature": "def time_since_given_dat...
2
stack_v2_sparse_classes_30k_train_015892
Implement the Python class `dummy_time_handler` described below. Class description: Don't need the full time handler, so save a dependency and use this. Method signatures and docstrings: - def __init__(self, mjd_init): Parameters ---------- mjd_init : float The initial mjd - def time_since_given_datetime(self, dateti...
Implement the Python class `dummy_time_handler` described below. Class description: Don't need the full time handler, so save a dependency and use this. Method signatures and docstrings: - def __init__(self, mjd_init): Parameters ---------- mjd_init : float The initial mjd - def time_since_given_datetime(self, dateti...
20fd8cfe38dbecfd6f219086e273eefe3ff6ff07
<|skeleton|> class dummy_time_handler: """Don't need the full time handler, so save a dependency and use this.""" def __init__(self, mjd_init): """Parameters ---------- mjd_init : float The initial mjd""" <|body_0|> def time_since_given_datetime(self, datetime1, datetime2=None, reverse=Fal...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class dummy_time_handler: """Don't need the full time handler, so save a dependency and use this.""" def __init__(self, mjd_init): """Parameters ---------- mjd_init : float The initial mjd""" self._unix_start = datetime(1970, 1, 1) t = Time(mjd_init, format='mjd') self.initial_d...
the_stack_v2_python_sparse
python/lsst/sims/speedObservatory/speed_observatory.py
lsst-sims/sims_speedObservatory
train
0
8ce3b2fbb084bc6f71691afb43803d49e56379cf
[ "image_groups = mall_models.ImageGroup.objects.filter(owner=request.manager)\ngroup_ids = []\nid2group = {}\nfor image_group in image_groups:\n image_group.images = []\n group_ids.append(image_group.id)\n id2group[image_group.id] = image_group\ntarget_image_groups = mall_models.Image.objects.filter(group_i...
<|body_start_0|> image_groups = mall_models.ImageGroup.objects.filter(owner=request.manager) group_ids = [] id2group = {} for image_group in image_groups: image_group.images = [] group_ids.append(image_group.id) id2group[image_group.id] = image_group ...
ImageGroupList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageGroupList: def get(request): """图片分组列表页面 Note 每个图片分组最多显示8张图片""" <|body_0|> def api_get(request): """获取图片分组信息 Return json: data [{ "id": 1, "name": "图片分组1" }, { "id": 2, "name": "图片分组2" }, { ...... }]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004644
5,963
no_license
[ { "docstring": "图片分组列表页面 Note 每个图片分组最多显示8张图片", "name": "get", "signature": "def get(request)" }, { "docstring": "获取图片分组信息 Return json: data [{ \"id\": 1, \"name\": \"图片分组1\" }, { \"id\": 2, \"name\": \"图片分组2\" }, { ...... }]", "name": "api_get", "signature": "def api_get(request)" } ]
2
null
Implement the Python class `ImageGroupList` described below. Class description: Implement the ImageGroupList class. Method signatures and docstrings: - def get(request): 图片分组列表页面 Note 每个图片分组最多显示8张图片 - def api_get(request): 获取图片分组信息 Return json: data [{ "id": 1, "name": "图片分组1" }, { "id": 2, "name": "图片分组2" }, { ........
Implement the Python class `ImageGroupList` described below. Class description: Implement the ImageGroupList class. Method signatures and docstrings: - def get(request): 图片分组列表页面 Note 每个图片分组最多显示8张图片 - def api_get(request): 获取图片分组信息 Return json: data [{ "id": 1, "name": "图片分组1" }, { "id": 2, "name": "图片分组2" }, { ........
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class ImageGroupList: def get(request): """图片分组列表页面 Note 每个图片分组最多显示8张图片""" <|body_0|> def api_get(request): """获取图片分组信息 Return json: data [{ "id": 1, "name": "图片分组1" }, { "id": 2, "name": "图片分组2" }, { ...... }]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageGroupList: def get(request): """图片分组列表页面 Note 每个图片分组最多显示8张图片""" image_groups = mall_models.ImageGroup.objects.filter(owner=request.manager) group_ids = [] id2group = {} for image_group in image_groups: image_group.images = [] group_ids.appen...
the_stack_v2_python_sparse
weapp/mall/product/image_group.py
chengdg/weizoom
train
1
0c537649fc89f3a6db7c05b8ef1c75265fe7524d
[ "if reflection_table.get_flags(reflection_table.flags.integrated_prf).count(True) == 0:\n raise NoProfilesException('WARNING: No profile-integrated reflections found')\nselection = reflection_table.get_flags(reflection_table.flags.integrated, all=False)\nreflection_table = reflection_table.select(selection)\nlog...
<|body_start_0|> if reflection_table.get_flags(reflection_table.flags.integrated_prf).count(True) == 0: raise NoProfilesException('WARNING: No profile-integrated reflections found') selection = reflection_table.get_flags(reflection_table.flags.integrated, all=False) reflection_table ...
Reduction methods for data with sum or profile intensities. Reflections with valid values for either intensity type are retained.
SumORPrfIntensityReducer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SumORPrfIntensityReducer: """Reduction methods for data with sum or profile intensities. Reflections with valid values for either intensity type are retained.""" def reduce_on_intensities(reflection_table): """Select reflections successfully integrated by sum and prf methods.""" ...
stack_v2_sparse_classes_36k_train_004645
38,270
permissive
[ { "docstring": "Select reflections successfully integrated by sum and prf methods.", "name": "reduce_on_intensities", "signature": "def reduce_on_intensities(reflection_table)" }, { "docstring": "Apply corrections to the intensities and variances (partiality, lp, qe).", "name": "apply_scalin...
2
null
Implement the Python class `SumORPrfIntensityReducer` described below. Class description: Reduction methods for data with sum or profile intensities. Reflections with valid values for either intensity type are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): Select reflection...
Implement the Python class `SumORPrfIntensityReducer` described below. Class description: Reduction methods for data with sum or profile intensities. Reflections with valid values for either intensity type are retained. Method signatures and docstrings: - def reduce_on_intensities(reflection_table): Select reflection...
88bf7f7c5ac44defc046ebf0719cde748092cfff
<|skeleton|> class SumORPrfIntensityReducer: """Reduction methods for data with sum or profile intensities. Reflections with valid values for either intensity type are retained.""" def reduce_on_intensities(reflection_table): """Select reflections successfully integrated by sum and prf methods.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SumORPrfIntensityReducer: """Reduction methods for data with sum or profile intensities. Reflections with valid values for either intensity type are retained.""" def reduce_on_intensities(reflection_table): """Select reflections successfully integrated by sum and prf methods.""" if reflec...
the_stack_v2_python_sparse
src/dials/util/filter_reflections.py
dials/dials
train
71
0678892165feb626db38e06a804eecf309c843e3
[ "super(String, self).__init__(has_msg_time=has_msg_time, interpolate=False)\nself._fields = {'data': [], 'bag_time': [], 'msg_time': []}\nself._has_msg_time = has_msg_time", "self._fields['bag_time'] = numpy.array(self._fields['bag_time'])\nif self._has_msg_time:\n self._fields['msg_time'] = numpy.array(self._...
<|body_start_0|> super(String, self).__init__(has_msg_time=has_msg_time, interpolate=False) self._fields = {'data': [], 'bag_time': [], 'msg_time': []} self._has_msg_time = has_msg_time <|end_body_0|> <|body_start_1|> self._fields['bag_time'] = numpy.array(self._fields['bag_time']) ...
Record for std_msgs/Int64 types
String
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class String: """Record for std_msgs/Int64 types""" def __init__(self, has_msg_time=False): """Constructor Arguments: has_msg_time: optional bool indicating if this record should have a message time. Typically false, but if this is part of a message, then it could have a message stamp Retu...
stack_v2_sparse_classes_36k_train_004646
15,317
permissive
[ { "docstring": "Constructor Arguments: has_msg_time: optional bool indicating if this record should have a message time. Typically false, but if this is part of a message, then it could have a message stamp Returns: class instance", "name": "__init__", "signature": "def __init__(self, has_msg_time=False...
2
stack_v2_sparse_classes_30k_train_019935
Implement the Python class `String` described below. Class description: Record for std_msgs/Int64 types Method signatures and docstrings: - def __init__(self, has_msg_time=False): Constructor Arguments: has_msg_time: optional bool indicating if this record should have a message time. Typically false, but if this is p...
Implement the Python class `String` described below. Class description: Record for std_msgs/Int64 types Method signatures and docstrings: - def __init__(self, has_msg_time=False): Constructor Arguments: has_msg_time: optional bool indicating if this record should have a message time. Typically false, but if this is p...
6827886916e36432ce1d806f0a78edef6c9270d9
<|skeleton|> class String: """Record for std_msgs/Int64 types""" def __init__(self, has_msg_time=False): """Constructor Arguments: has_msg_time: optional bool indicating if this record should have a message time. Typically false, but if this is part of a message, then it could have a message stamp Retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class String: """Record for std_msgs/Int64 types""" def __init__(self, has_msg_time=False): """Constructor Arguments: has_msg_time: optional bool indicating if this record should have a message time. Typically false, but if this is part of a message, then it could have a message stamp Returns: class in...
the_stack_v2_python_sparse
rosbots/src/bag_records/std_records.py
aivian/robots
train
0
29a0207d464e839ae7c118a61c950bae683ba7d3
[ "if field == 'current_password':\n if current_user.password != value and obj.password != value:\n abort(code=HTTPStatus.FORBIDDEN, message='Wrong password')\n else:\n state['current_password'] = value\n return True\nreturn PatchJSONParameters.test(obj, field, value, state)", "if 'curren...
<|body_start_0|> if field == 'current_password': if current_user.password != value and obj.password != value: abort(code=HTTPStatus.FORBIDDEN, message='Wrong password') else: state['current_password'] = value return True return Patc...
User details updating parameters following PATCH JSON RFC.
PatchUserDetailsParameters
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PatchUserDetailsParameters: """User details updating parameters following PATCH JSON RFC.""" def test(cls, obj, field, value, state): """Additional check for 'current_password' as User hasn't field 'current_password'""" <|body_0|> def replace(cls, obj, field, value, stat...
stack_v2_sparse_classes_36k_train_004647
4,647
permissive
[ { "docstring": "Additional check for 'current_password' as User hasn't field 'current_password'", "name": "test", "signature": "def test(cls, obj, field, value, state)" }, { "docstring": "Some fields require extra permissions to be changed. Changing `is_active` and `is_regular_user` properties, ...
2
stack_v2_sparse_classes_30k_train_015694
Implement the Python class `PatchUserDetailsParameters` described below. Class description: User details updating parameters following PATCH JSON RFC. Method signatures and docstrings: - def test(cls, obj, field, value, state): Additional check for 'current_password' as User hasn't field 'current_password' - def repl...
Implement the Python class `PatchUserDetailsParameters` described below. Class description: User details updating parameters following PATCH JSON RFC. Method signatures and docstrings: - def test(cls, obj, field, value, state): Additional check for 'current_password' as User hasn't field 'current_password' - def repl...
53a3a156cc9df414537860ed677bd0cc98dd2271
<|skeleton|> class PatchUserDetailsParameters: """User details updating parameters following PATCH JSON RFC.""" def test(cls, obj, field, value, state): """Additional check for 'current_password' as User hasn't field 'current_password'""" <|body_0|> def replace(cls, obj, field, value, stat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PatchUserDetailsParameters: """User details updating parameters following PATCH JSON RFC.""" def test(cls, obj, field, value, state): """Additional check for 'current_password' as User hasn't field 'current_password'""" if field == 'current_password': if current_user.password ...
the_stack_v2_python_sparse
app/modules/users/parameters.py
frol/flask-restplus-server-example
train
1,487
1b1410532e60719cdc65b0b7b86070f289323594
[ "self.min_cutoff = min_cutoff\nself.beta = beta\nself.d_cutoff = d_cutoff", "t_e = 1\na_d = smoothing_factor(t_e, self.d_cutoff)\ndx = np.sqrt(np.sum((x - x_prev) ** 2, axis=1))\ndx_prev = np.sqrt(np.sum(dx_prev ** 2, axis=1))\ndx_hat = exponential_smoothing(a_d, dx, dx_prev)\ncutoff = self.min_cutoff + self.beta...
<|body_start_0|> self.min_cutoff = min_cutoff self.beta = beta self.d_cutoff = d_cutoff <|end_body_0|> <|body_start_1|> t_e = 1 a_d = smoothing_factor(t_e, self.d_cutoff) dx = np.sqrt(np.sum((x - x_prev) ** 2, axis=1)) dx_prev = np.sqrt(np.sum(dx_prev ** 2, axis=...
OneEuroFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OneEuroFilter: def __init__(self, dx0=0.0, min_cutoff=0.15, beta=0.8, d_cutoff=1): """Initialize the one euro filter.""" <|body_0|> def __call__(self, x, x_prev, dx_prev): """Compute the filtered signal.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004648
4,561
permissive
[ { "docstring": "Initialize the one euro filter.", "name": "__init__", "signature": "def __init__(self, dx0=0.0, min_cutoff=0.15, beta=0.8, d_cutoff=1)" }, { "docstring": "Compute the filtered signal.", "name": "__call__", "signature": "def __call__(self, x, x_prev, dx_prev)" } ]
2
stack_v2_sparse_classes_30k_val_000916
Implement the Python class `OneEuroFilter` described below. Class description: Implement the OneEuroFilter class. Method signatures and docstrings: - def __init__(self, dx0=0.0, min_cutoff=0.15, beta=0.8, d_cutoff=1): Initialize the one euro filter. - def __call__(self, x, x_prev, dx_prev): Compute the filtered signa...
Implement the Python class `OneEuroFilter` described below. Class description: Implement the OneEuroFilter class. Method signatures and docstrings: - def __init__(self, dx0=0.0, min_cutoff=0.15, beta=0.8, d_cutoff=1): Initialize the one euro filter. - def __call__(self, x, x_prev, dx_prev): Compute the filtered signa...
3f1aaa3a8724078b080d64cf5d18dcdfae41bafe
<|skeleton|> class OneEuroFilter: def __init__(self, dx0=0.0, min_cutoff=0.15, beta=0.8, d_cutoff=1): """Initialize the one euro filter.""" <|body_0|> def __call__(self, x, x_prev, dx_prev): """Compute the filtered signal.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OneEuroFilter: def __init__(self, dx0=0.0, min_cutoff=0.15, beta=0.8, d_cutoff=1): """Initialize the one euro filter.""" self.min_cutoff = min_cutoff self.beta = beta self.d_cutoff = d_cutoff def __call__(self, x, x_prev, dx_prev): """Compute the filtered signal.""...
the_stack_v2_python_sparse
Skps/core/smoother/lk.py
1996scarlet/Peppa_Pig_Face_Engine
train
1
a120a9709b5514f32d0ad4ef32665fec3e1dca8a
[ "self.bus_number = bus_number\nself.controller_type = controller_type\nself.disk_id = disk_id\nself.disk_location = disk_location\nself.disk_size_in_bytes = disk_size_in_bytes\nself.file_path = file_path\nself.mount_points = mount_points\nself.unit_number = unit_number", "if dictionary is None:\n return None\n...
<|body_start_0|> self.bus_number = bus_number self.controller_type = controller_type self.disk_id = disk_id self.disk_location = disk_location self.disk_size_in_bytes = disk_size_in_bytes self.file_path = file_path self.mount_points = mount_points self.uni...
Implementation of the 'VirtualDiskInformation' model. TODO: type description here. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller type like SCSI, or IDE etc. disk_id (string): Specifies original disk id. This is suffic...
VirtualDiskInformation
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VirtualDiskInformation: """Implementation of the 'VirtualDiskInformation' model. TODO: type description here. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller type like SCSI, or IDE etc. disk_id (s...
stack_v2_sparse_classes_36k_train_004649
3,759
permissive
[ { "docstring": "Constructor for the VirtualDiskInformation class", "name": "__init__", "signature": "def __init__(self, bus_number=None, controller_type=None, disk_id=None, disk_location=None, disk_size_in_bytes=None, file_path=None, mount_points=None, unit_number=None)" }, { "docstring": "Creat...
2
null
Implement the Python class `VirtualDiskInformation` described below. Class description: Implementation of the 'VirtualDiskInformation' model. TODO: type description here. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller...
Implement the Python class `VirtualDiskInformation` described below. Class description: Implementation of the 'VirtualDiskInformation' model. TODO: type description here. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VirtualDiskInformation: """Implementation of the 'VirtualDiskInformation' model. TODO: type description here. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller type like SCSI, or IDE etc. disk_id (s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VirtualDiskInformation: """Implementation of the 'VirtualDiskInformation' model. TODO: type description here. Attributes: bus_number (long|int): Specifies the Id of the controller bus that controls the disk. controller_type (string): Specifies the controller type like SCSI, or IDE etc. disk_id (string): Speci...
the_stack_v2_python_sparse
cohesity_management_sdk/models/virtual_disk_information.py
cohesity/management-sdk-python
train
24
ad895b4965b7fa949fac62d9fda0a42763128093
[ "self.snapshot = snapshot\nself.output_dir = output_dir\nprint(f'Initializing with snapshot={self.snapshot} output_dir={self.output_dir}')", "if not os.path.exists(self.output_dir):\n os.makedirs(self.output_dir)\npm.execute_notebook('Dataset_metrics.ipynb', self.output_dir + '/dataset_metrics_' + self.snapsho...
<|body_start_0|> self.snapshot = snapshot self.output_dir = output_dir print(f'Initializing with snapshot={self.snapshot} output_dir={self.output_dir}') <|end_body_0|> <|body_start_1|> if not os.path.exists(self.output_dir): os.makedirs(self.output_dir) pm.execute_no...
DatasetMetricsRunner
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetMetricsRunner: def __init__(self, snapshot, output_dir): """:param str snapshot: Snapshot date :param str output_dir: Directory to place output .ipynb and .csv files""" <|body_0|> def run(self): """Executes jupyter notebook""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_004650
1,422
no_license
[ { "docstring": ":param str snapshot: Snapshot date :param str output_dir: Directory to place output .ipynb and .csv files", "name": "__init__", "signature": "def __init__(self, snapshot, output_dir)" }, { "docstring": "Executes jupyter notebook", "name": "run", "signature": "def run(self...
2
stack_v2_sparse_classes_30k_test_000544
Implement the Python class `DatasetMetricsRunner` described below. Class description: Implement the DatasetMetricsRunner class. Method signatures and docstrings: - def __init__(self, snapshot, output_dir): :param str snapshot: Snapshot date :param str output_dir: Directory to place output .ipynb and .csv files - def ...
Implement the Python class `DatasetMetricsRunner` described below. Class description: Implement the DatasetMetricsRunner class. Method signatures and docstrings: - def __init__(self, snapshot, output_dir): :param str snapshot: Snapshot date :param str output_dir: Directory to place output .ipynb and .csv files - def ...
6149d86e9d6f45cf035d89e6874b5ad7d1fdb5a7
<|skeleton|> class DatasetMetricsRunner: def __init__(self, snapshot, output_dir): """:param str snapshot: Snapshot date :param str output_dir: Directory to place output .ipynb and .csv files""" <|body_0|> def run(self): """Executes jupyter notebook""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatasetMetricsRunner: def __init__(self, snapshot, output_dir): """:param str snapshot: Snapshot date :param str output_dir: Directory to place output .ipynb and .csv files""" self.snapshot = snapshot self.output_dir = output_dir print(f'Initializing with snapshot={self.snapsho...
the_stack_v2_python_sparse
dataset_metrics/dataset_metrics_runner.py
mirrys/ImageMatching
train
2
7d696327500cc75771d42822ae7a22e282acbbe8
[ "try:\n assert init_ad_manage.get_title() == '广告管理'\n assert '广告管理' in init_ad_manage.get_info_title()\nexcept Exception as e:\n raise e", "init_search_ad[0].search_ad(ad.api_ad_name)\ntry:\n assert ad.api_ad_name in init_search_ad[0].get_ad_name()\n assert init_search_ad[0].get_status() == 'el-swi...
<|body_start_0|> try: assert init_ad_manage.get_title() == '广告管理' assert '广告管理' in init_ad_manage.get_info_title() except Exception as e: raise e <|end_body_0|> <|body_start_1|> init_search_ad[0].search_ad(ad.api_ad_name) try: assert ad.ap...
广告管理
TestAd
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestAd: """广告管理""" def test01_title_name(self, init_ad_manage): """网页标题校验 :return:""" <|body_0|> def test02_search_ad(self, init_search_ad): """广告名称搜索 :return:""" <|body_1|> def test03_add_ad(self, init_ad_manage): """新增广告 :return:""" ...
stack_v2_sparse_classes_36k_train_004651
1,641
no_license
[ { "docstring": "网页标题校验 :return:", "name": "test01_title_name", "signature": "def test01_title_name(self, init_ad_manage)" }, { "docstring": "广告名称搜索 :return:", "name": "test02_search_ad", "signature": "def test02_search_ad(self, init_search_ad)" }, { "docstring": "新增广告 :return:", ...
4
stack_v2_sparse_classes_30k_train_007639
Implement the Python class `TestAd` described below. Class description: 广告管理 Method signatures and docstrings: - def test01_title_name(self, init_ad_manage): 网页标题校验 :return: - def test02_search_ad(self, init_search_ad): 广告名称搜索 :return: - def test03_add_ad(self, init_ad_manage): 新增广告 :return: - def test04_del_ad(self,...
Implement the Python class `TestAd` described below. Class description: 广告管理 Method signatures and docstrings: - def test01_title_name(self, init_ad_manage): 网页标题校验 :return: - def test02_search_ad(self, init_search_ad): 广告名称搜索 :return: - def test03_add_ad(self, init_ad_manage): 新增广告 :return: - def test04_del_ad(self,...
b6905b765d84263439e459d6281cd2440e634cef
<|skeleton|> class TestAd: """广告管理""" def test01_title_name(self, init_ad_manage): """网页标题校验 :return:""" <|body_0|> def test02_search_ad(self, init_search_ad): """广告名称搜索 :return:""" <|body_1|> def test03_add_ad(self, init_ad_manage): """新增广告 :return:""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestAd: """广告管理""" def test01_title_name(self, init_ad_manage): """网页标题校验 :return:""" try: assert init_ad_manage.get_title() == '广告管理' assert '广告管理' in init_ad_manage.get_info_title() except Exception as e: raise e def test02_search_ad(self...
the_stack_v2_python_sparse
TestCases/test_05_ad_page.py
Dake-M/boss_web_framework
train
0
6a9e6755df7dc1d2e15a9aa9f95f6b6bafcd687f
[ "count = 0\nfor i in range(len(nums)):\n total = 1\n for j in range(i, len(nums)):\n total *= nums[j]\n if total < k:\n count += 1\n else:\n break\nreturn count", "if k <= 1:\n return 0\ncount, product, l = (0, 1, 0)\nfor r in range(len(nums)):\n product *= n...
<|body_start_0|> count = 0 for i in range(len(nums)): total = 1 for j in range(i, len(nums)): total *= nums[j] if total < k: count += 1 else: break return count <|end_body_0|> <|body_...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numSubarrayProductLessThanK_(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def numSubarrayProductLessThanK(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_004652
1,122
no_license
[ { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "numSubarrayProductLessThanK_", "signature": "def numSubarrayProductLessThanK_(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: int", "name": "numSubarrayProductLessThanK", "signature": ...
2
stack_v2_sparse_classes_30k_test_001012
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayProductLessThanK_(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def numSubarrayProductLessThanK(self, nums, k): :type nums: List[int] :type k: i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numSubarrayProductLessThanK_(self, nums, k): :type nums: List[int] :type k: int :rtype: int - def numSubarrayProductLessThanK(self, nums, k): :type nums: List[int] :type k: i...
b5c25f976866eefec33b96c638a4c5e127319e74
<|skeleton|> class Solution: def numSubarrayProductLessThanK_(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_0|> def numSubarrayProductLessThanK(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def numSubarrayProductLessThanK_(self, nums, k): """:type nums: List[int] :type k: int :rtype: int""" count = 0 for i in range(len(nums)): total = 1 for j in range(i, len(nums)): total *= nums[j] if total < k: ...
the_stack_v2_python_sparse
Python/713_Subarray Product Less Than K.py
Eddie02582/Leetcode
train
1
60eecbc9886dc6e7e022d5c87830e49e1975c31f
[ "self.quark = quark\nself.nucleon = nucleon\nself.ip = input_dict", "if self.nucleon == 'p':\n if self.quark == 'u':\n return self.ip['Deltaup']\n if self.quark == 'd':\n return self.ip['Deltadp']\n if self.quark == 's':\n return self.ip['Deltas']\nif self.nucleon == 'n':\n if sel...
<|body_start_0|> self.quark = quark self.nucleon = nucleon self.ip = input_dict <|end_body_0|> <|body_start_1|> if self.nucleon == 'p': if self.quark == 'u': return self.ip['Deltaup'] if self.quark == 'd': return self.ip['Deltadp']...
FA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FA: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor FA at zero momentum transfer Return the nuclear form factor FA, evaluated at zero momentum transfer. Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the ...
stack_v2_sparse_classes_36k_train_004653
18,337
permissive
[ { "docstring": "The nuclear form factor FA at zero momentum transfer Return the nuclear form factor FA, evaluated at zero momentum transfer. Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proton or neutron) input_dict (optional) -- a dictiona...
2
stack_v2_sparse_classes_30k_train_012513
Implement the Python class `FA` described below. Class description: Implement the FA class. Method signatures and docstrings: - def __init__(self, quark, nucleon, input_dict): The nuclear form factor FA at zero momentum transfer Return the nuclear form factor FA, evaluated at zero momentum transfer. Arguments -------...
Implement the Python class `FA` described below. Class description: Implement the FA class. Method signatures and docstrings: - def __init__(self, quark, nucleon, input_dict): The nuclear form factor FA at zero momentum transfer Return the nuclear form factor FA, evaluated at zero momentum transfer. Arguments -------...
4a714e4701f817fdc96e10e461eef7c4756ef71d
<|skeleton|> class FA: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor FA at zero momentum transfer Return the nuclear form factor FA, evaluated at zero momentum transfer. Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FA: def __init__(self, quark, nucleon, input_dict): """The nuclear form factor FA at zero momentum transfer Return the nuclear form factor FA, evaluated at zero momentum transfer. Arguments --------- quark = 'u', 'd', 's' -- the quark flavor (up, down, strange) nucleon = 'p', 'n' -- the nucleon (proto...
the_stack_v2_python_sparse
directdm/num/single_nucleon_form_factors.py
DirectDM/directdm-py
train
6
890f860c2394aafc4cd78bae4b8ae3ba933e3ccb
[ "heapq.heapify(nodes)\nwhile len(nodes) > 1:\n left = heapq.heappop(nodes)\n right = heapq.heappop(nodes)\n node = self._merge(left, right)\n heapq.heappush(nodes, node)\nself.root = node", "symbol = left._symbol + right._symbol\nweight = left._weight + right._weight\nnode = Node(symbol, weight, left,...
<|body_start_0|> heapq.heapify(nodes) while len(nodes) > 1: left = heapq.heappop(nodes) right = heapq.heappop(nodes) node = self._merge(left, right) heapq.heappush(nodes, node) self.root = node <|end_body_0|> <|body_start_1|> symbol = left...
HuffmanTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HuffmanTree: def build(self, nodes): """Build a Huffman Tree with given nodes.""" <|body_0|> def _merge(self, left, right): """Merge the given two nodes and return a new one.""" <|body_1|> def _depth(self, node): """Return the depth of a given no...
stack_v2_sparse_classes_36k_train_004654
2,759
no_license
[ { "docstring": "Build a Huffman Tree with given nodes.", "name": "build", "signature": "def build(self, nodes)" }, { "docstring": "Merge the given two nodes and return a new one.", "name": "_merge", "signature": "def _merge(self, left, right)" }, { "docstring": "Return the depth ...
4
stack_v2_sparse_classes_30k_train_011333
Implement the Python class `HuffmanTree` described below. Class description: Implement the HuffmanTree class. Method signatures and docstrings: - def build(self, nodes): Build a Huffman Tree with given nodes. - def _merge(self, left, right): Merge the given two nodes and return a new one. - def _depth(self, node): Re...
Implement the Python class `HuffmanTree` described below. Class description: Implement the HuffmanTree class. Method signatures and docstrings: - def build(self, nodes): Build a Huffman Tree with given nodes. - def _merge(self, left, right): Merge the given two nodes and return a new one. - def _depth(self, node): Re...
222ee034fe2943c2e5ee1a9e642d108b046b2f2a
<|skeleton|> class HuffmanTree: def build(self, nodes): """Build a Huffman Tree with given nodes.""" <|body_0|> def _merge(self, left, right): """Merge the given two nodes and return a new one.""" <|body_1|> def _depth(self, node): """Return the depth of a given no...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HuffmanTree: def build(self, nodes): """Build a Huffman Tree with given nodes.""" heapq.heapify(nodes) while len(nodes) > 1: left = heapq.heappop(nodes) right = heapq.heappop(nodes) node = self._merge(left, right) heapq.heappush(nodes, no...
the_stack_v2_python_sparse
03 Greedy Algorithms, Minimum Spanning Trees, and Dynamic Programming/algo3assignments/Programming Assignment #3/Huffman.py
peng00bo00/Coursera-Algorithms
train
0
b717320569bba8faa2c3e5d0bb005153310ba05c
[ "d = {}\nfor i in range(len(nums)):\n k = target - nums[i]\n if d.get(k) != None:\n return [d.get(k), i]\n else:\n d[nums[i]] = i", "n = len(nums)\nfor i in range(n):\n for j in range(i + 1, n):\n if nums[i] + nums[j] == target:\n return [i, j]" ]
<|body_start_0|> d = {} for i in range(len(nums)): k = target - nums[i] if d.get(k) != None: return [d.get(k), i] else: d[nums[i]] = i <|end_body_0|> <|body_start_1|> n = len(nums) for i in range(n): for j i...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """使用辅助字典 键: nums[i] 值:索引 :param nums: :param target: :return:""" <|body_0|> def twoSum2(self, nums, target): """暴力 :param nums: :param target: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = {}...
stack_v2_sparse_classes_36k_train_004655
1,227
no_license
[ { "docstring": "使用辅助字典 键: nums[i] 值:索引 :param nums: :param target: :return:", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": "暴力 :param nums: :param target: :return:", "name": "twoSum2", "signature": "def twoSum2(self, nums, target)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): 使用辅助字典 键: nums[i] 值:索引 :param nums: :param target: :return: - def twoSum2(self, nums, target): 暴力 :param nums: :param target: :return:
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): 使用辅助字典 键: nums[i] 值:索引 :param nums: :param target: :return: - def twoSum2(self, nums, target): 暴力 :param nums: :param target: :return: <|skeleton...
5d3574ccd282d0146c83c286ae28d8baaabd4910
<|skeleton|> class Solution: def twoSum(self, nums, target): """使用辅助字典 键: nums[i] 值:索引 :param nums: :param target: :return:""" <|body_0|> def twoSum2(self, nums, target): """暴力 :param nums: :param target: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, nums, target): """使用辅助字典 键: nums[i] 值:索引 :param nums: :param target: :return:""" d = {} for i in range(len(nums)): k = target - nums[i] if d.get(k) != None: return [d.get(k), i] else: d[nums[...
the_stack_v2_python_sparse
1_两数之和.py
lovehhf/LeetCode
train
0
b40d4481f6e5e3d62c31cad08b88c40ee2d0a252
[ "super(ResNetRoIHead, self).__init__()\nassert len({len(pool_size), len(dim_in)}) == 1, 'pathway dimensions are not consistent.'\nself.num_pathways = len(pool_size)\nself.pool_size = pool_size\nself.resolution = resolution\nself.scale_factor = scale_factor\nfor pathway in range(self.num_pathways):\n spatial_pool...
<|body_start_0|> super(ResNetRoIHead, self).__init__() assert len({len(pool_size), len(dim_in)}) == 1, 'pathway dimensions are not consistent.' self.num_pathways = len(pool_size) self.pool_size = pool_size self.resolution = resolution self.scale_factor = scale_factor ...
ResNe(X)t RoI head.
ResNetRoIHead
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResNetRoIHead: """ResNe(X)t RoI head.""" def __init__(self, dim_in, num_classes, pool_size, resolution, scale_factor, dropout_rate=0.0, act_func='softmax', aligned=True): """The `__init__` method of any subclass should also contain these arguments. ResNetRoIHead takes p pathways as i...
stack_v2_sparse_classes_36k_train_004656
6,336
permissive
[ { "docstring": "The `__init__` method of any subclass should also contain these arguments. ResNetRoIHead takes p pathways as input where p in [1, infty]. Args: dim_in (list): the list of channel dimensions of the p inputs to the ResNetHead. num_classes (int): the channel dimensions of the p outputs to the ResNe...
2
null
Implement the Python class `ResNetRoIHead` described below. Class description: ResNe(X)t RoI head. Method signatures and docstrings: - def __init__(self, dim_in, num_classes, pool_size, resolution, scale_factor, dropout_rate=0.0, act_func='softmax', aligned=True): The `__init__` method of any subclass should also con...
Implement the Python class `ResNetRoIHead` described below. Class description: ResNe(X)t RoI head. Method signatures and docstrings: - def __init__(self, dim_in, num_classes, pool_size, resolution, scale_factor, dropout_rate=0.0, act_func='softmax', aligned=True): The `__init__` method of any subclass should also con...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class ResNetRoIHead: """ResNe(X)t RoI head.""" def __init__(self, dim_in, num_classes, pool_size, resolution, scale_factor, dropout_rate=0.0, act_func='softmax', aligned=True): """The `__init__` method of any subclass should also contain these arguments. ResNetRoIHead takes p pathways as i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResNetRoIHead: """ResNe(X)t RoI head.""" def __init__(self, dim_in, num_classes, pool_size, resolution, scale_factor, dropout_rate=0.0, act_func='softmax', aligned=True): """The `__init__` method of any subclass should also contain these arguments. ResNetRoIHead takes p pathways as input where p ...
the_stack_v2_python_sparse
research/cv/slowfast/src/models/head_helper.py
mindspore-ai/models
train
301
0d60b7b8526aa669ba65b13104a262556c82576a
[ "if keys is None:\n keys = ['ymin', 'xmin', 'ymax', 'xmax']\nelif len(keys) != 4:\n raise ValueError('BoundingBox expects 4 keys but got {}'.format(len(keys)))\nself._prefix = prefix\nself._keys = keys\nself._full_keys = [prefix + k for k in keys]\nsuper(BoundingBox, self).__init__(self._full_keys)", "sides...
<|body_start_0|> if keys is None: keys = ['ymin', 'xmin', 'ymax', 'xmax'] elif len(keys) != 4: raise ValueError('BoundingBox expects 4 keys but got {}'.format(len(keys))) self._prefix = prefix self._keys = keys self._full_keys = [prefix + k for k in keys] ...
An ItemHandler that concatenates a set of parsed Tensors to Bounding Boxes.
BoundingBox
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BoundingBox: """An ItemHandler that concatenates a set of parsed Tensors to Bounding Boxes.""" def __init__(self, keys=None, prefix=None): """Initialize the bounding box handler. Args: keys: A list of four key names representing the ymin, xmin, ymax, mmax prefix: An optional prefix f...
stack_v2_sparse_classes_36k_train_004657
15,383
permissive
[ { "docstring": "Initialize the bounding box handler. Args: keys: A list of four key names representing the ymin, xmin, ymax, mmax prefix: An optional prefix for each of the bounding box keys. If provided, `prefix` is appended to each key in `keys`. Raises: ValueError: if keys is not `None` and also not a list o...
2
stack_v2_sparse_classes_30k_train_004413
Implement the Python class `BoundingBox` described below. Class description: An ItemHandler that concatenates a set of parsed Tensors to Bounding Boxes. Method signatures and docstrings: - def __init__(self, keys=None, prefix=None): Initialize the bounding box handler. Args: keys: A list of four key names representin...
Implement the Python class `BoundingBox` described below. Class description: An ItemHandler that concatenates a set of parsed Tensors to Bounding Boxes. Method signatures and docstrings: - def __init__(self, keys=None, prefix=None): Initialize the bounding box handler. Args: keys: A list of four key names representin...
cabf6e4f1970dc14302f87414f170de19944bac2
<|skeleton|> class BoundingBox: """An ItemHandler that concatenates a set of parsed Tensors to Bounding Boxes.""" def __init__(self, keys=None, prefix=None): """Initialize the bounding box handler. Args: keys: A list of four key names representing the ymin, xmin, ymax, mmax prefix: An optional prefix f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BoundingBox: """An ItemHandler that concatenates a set of parsed Tensors to Bounding Boxes.""" def __init__(self, keys=None, prefix=None): """Initialize the bounding box handler. Args: keys: A list of four key names representing the ymin, xmin, ymax, mmax prefix: An optional prefix for each of th...
the_stack_v2_python_sparse
Tensorflow_OpenCV_Nightly/source/tensorflow/contrib/slim/python/slim/data/tfexample_decoder.py
ryfeus/lambda-packs
train
1,283
d29f95f199c956504a18cb5772affd88114721b1
[ "self.map = {}\nfor i in blacklist:\n self.map[i] = 1\nself.M = N - len(blacklist)\nfor i in blacklist:\n if i < self.M:\n N = N - 1\n while N in self.map:\n N -= 1\n self.map[i] = N", "import random\nres = random.randint(0, self.M - 1)\nreturn self.map[res] if res in self.ma...
<|body_start_0|> self.map = {} for i in blacklist: self.map[i] = 1 self.M = N - len(blacklist) for i in blacklist: if i < self.M: N = N - 1 while N in self.map: N -= 1 self.map[i] = N <|end_body_0...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, N, blacklist): """:type N: int :type blacklist: List[int] :ref:https://blog.csdn.net/dpengwang/article/details/83044688""" <|body_0|> def pick(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.ma...
stack_v2_sparse_classes_36k_train_004658
851
no_license
[ { "docstring": ":type N: int :type blacklist: List[int] :ref:https://blog.csdn.net/dpengwang/article/details/83044688", "name": "__init__", "signature": "def __init__(self, N, blacklist)" }, { "docstring": ":rtype: int", "name": "pick", "signature": "def pick(self)" } ]
2
stack_v2_sparse_classes_30k_train_017733
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, N, blacklist): :type N: int :type blacklist: List[int] :ref:https://blog.csdn.net/dpengwang/article/details/83044688 - def pick(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, N, blacklist): :type N: int :type blacklist: List[int] :ref:https://blog.csdn.net/dpengwang/article/details/83044688 - def pick(self): :rtype: int <|skeleton|...
5755c3edd6d949af18d0247d2103379510dfab85
<|skeleton|> class Solution: def __init__(self, N, blacklist): """:type N: int :type blacklist: List[int] :ref:https://blog.csdn.net/dpengwang/article/details/83044688""" <|body_0|> def pick(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, N, blacklist): """:type N: int :type blacklist: List[int] :ref:https://blog.csdn.net/dpengwang/article/details/83044688""" self.map = {} for i in blacklist: self.map[i] = 1 self.M = N - len(blacklist) for i in blacklist: ...
the_stack_v2_python_sparse
710.py
JiayuZhai/leetcode_python3
train
0
0102801138766fe5e55dc3cef09a56deff98f4b9
[ "width = int(len(features) / classifier_input_size)\nself.features = np.reshape(features, (width, classifier_input_size))\nself.pos = 0", "if self.pos < len(self.features):\n self.pos += 1\n return self.features[self.pos - 1]\nreturn None" ]
<|body_start_0|> width = int(len(features) / classifier_input_size) self.features = np.reshape(features, (width, classifier_input_size)) self.pos = 0 <|end_body_0|> <|body_start_1|> if self.pos < len(self.features): self.pos += 1 return self.features[self.pos - 1...
FeatureReader takes in the full set of features and returns classifier_input_size chunks of data
FeatureReader
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureReader: """FeatureReader takes in the full set of features and returns classifier_input_size chunks of data""" def __init__(self, features, classifier_input_size): """Initialize the FeatureReader with the full set of features, and the classifier input size""" <|body_0|...
stack_v2_sparse_classes_36k_train_004659
11,862
permissive
[ { "docstring": "Initialize the FeatureReader with the full set of features, and the classifier input size", "name": "__init__", "signature": "def __init__(self, features, classifier_input_size)" }, { "docstring": "Return the next classifier input of size (feature_width, classifier_input_size)", ...
2
stack_v2_sparse_classes_30k_train_012370
Implement the Python class `FeatureReader` described below. Class description: FeatureReader takes in the full set of features and returns classifier_input_size chunks of data Method signatures and docstrings: - def __init__(self, features, classifier_input_size): Initialize the FeatureReader with the full set of fea...
Implement the Python class `FeatureReader` described below. Class description: FeatureReader takes in the full set of features and returns classifier_input_size chunks of data Method signatures and docstrings: - def __init__(self, features, classifier_input_size): Initialize the FeatureReader with the full set of fea...
cb897e3aec148a1e9bd648012b5f53ab9d0dd20c
<|skeleton|> class FeatureReader: """FeatureReader takes in the full set of features and returns classifier_input_size chunks of data""" def __init__(self, features, classifier_input_size): """Initialize the FeatureReader with the full set of features, and the classifier input size""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureReader: """FeatureReader takes in the full set of features and returns classifier_input_size chunks of data""" def __init__(self, features, classifier_input_size): """Initialize the FeatureReader with the full set of features, and the classifier input size""" width = int(len(featur...
the_stack_v2_python_sparse
tools/utilities/pythonlibs/audio/training/test_ell_model.py
awesomemachinelearning/ELL
train
1
2469c8cbc51ebb1017c48dd76b3f0ba54174b013
[ "data = []\n\ndef dfs(root):\n if root is None:\n return\n data.append(root.val)\n dfs(root.left)\n dfs(root.right)\ndfs(root)\nreturn str(data)", "arr = literal_eval(data)\n\ndef construct_tree(arr):\n node = TreeNode(arr[0])\n root = node\n q = [node]\n j = 1\n while q:\n ...
<|body_start_0|> data = [] def dfs(root): if root is None: return data.append(root.val) dfs(root.left) dfs(root.right) dfs(root) return str(data) <|end_body_0|> <|body_start_1|> arr = literal_eval(data) de...
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_004660
1,531
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:...
77a13580fd6231830558b1cf8c84f8b3b62b99d0
<|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""" data = [] def dfs(root): if root is None: return data.append(root.val) dfs(root.left) dfs(root.right) dfs...
the_stack_v2_python_sparse
lc-297.py
UtsavRaychaudhuri/leetcode
train
0
48505463af0fc4fa9e477daae3a01830a30ac4e2
[ "super().__init__(path)\nself._bug_list = dict()\nself._parse()", "if self._bug_list != other._bug_list:\n print('Bug lists do not match.')\n return False\nreturn True", "with open(self._path, 'r') as file:\n try:\n line = file.readline()\n while line:\n if line.startswith(BUG_...
<|body_start_0|> super().__init__(path) self._bug_list = dict() self._parse() <|end_body_0|> <|body_start_1|> if self._bug_list != other._bug_list: print('Bug lists do not match.') return False return True <|end_body_1|> <|body_start_2|> with ope...
Responsible for parsing bug bucket logs
BugLogParser
[ "LicenseRef-scancode-generic-cla", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BugLogParser: """Responsible for parsing bug bucket logs""" def __init__(self, path): """BugLogParser constructor @param path: The path to the bug log file @type path: Str""" <|body_0|> def diff_log(self, other): """Diffs a BugLogParser's bug list with this objec...
stack_v2_sparse_classes_36k_train_004661
9,641
permissive
[ { "docstring": "BugLogParser constructor @param path: The path to the bug log file @type path: Str", "name": "__init__", "signature": "def __init__(self, path)" }, { "docstring": "Diffs a BugLogParser's bug list with this object's bug list @param other: The parser to compare to this one @type ot...
3
stack_v2_sparse_classes_30k_train_004247
Implement the Python class `BugLogParser` described below. Class description: Responsible for parsing bug bucket logs Method signatures and docstrings: - def __init__(self, path): BugLogParser constructor @param path: The path to the bug log file @type path: Str - def diff_log(self, other): Diffs a BugLogParser's bug...
Implement the Python class `BugLogParser` described below. Class description: Responsible for parsing bug bucket logs Method signatures and docstrings: - def __init__(self, path): BugLogParser constructor @param path: The path to the bug log file @type path: Str - def diff_log(self, other): Diffs a BugLogParser's bug...
5a9ba1af74953334fcf54570f1e31e74ea057688
<|skeleton|> class BugLogParser: """Responsible for parsing bug bucket logs""" def __init__(self, path): """BugLogParser constructor @param path: The path to the bug log file @type path: Str""" <|body_0|> def diff_log(self, other): """Diffs a BugLogParser's bug list with this objec...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BugLogParser: """Responsible for parsing bug bucket logs""" def __init__(self, path): """BugLogParser constructor @param path: The path to the bug log file @type path: Str""" super().__init__(path) self._bug_list = dict() self._parse() def diff_log(self, other): ...
the_stack_v2_python_sparse
restler/test_servers/log_parser.py
wisec/restler-fuzzer
train
0
9ee3951d484d64a80b375ea232066c783ef16238
[ "tmp_sum = (x + self.eta).as_array()\nind = tmp_sum >= 0\ntmp = scipy.special.kl_div(self.b.as_array()[ind], tmp_sum[ind])\nreturn numpy.sum(tmp)", "should_return = False\nif out is None:\n out = x.add(self.eta)\n should_return = True\nelse:\n x.add(self.eta, out=out)\narr = out.as_array()\narr[arr > 0] ...
<|body_start_0|> tmp_sum = (x + self.eta).as_array() ind = tmp_sum >= 0 tmp = scipy.special.kl_div(self.b.as_array()[ind], tmp_sum[ind]) return numpy.sum(tmp) <|end_body_0|> <|body_start_1|> should_return = False if out is None: out = x.add(self.eta) ...
KullbackLeibler_numpy
[ "Apache-2.0", "BSD-3-Clause", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KullbackLeibler_numpy: def __call__(self, x): """Returns the value of the KullbackLeibler function at :math:`(b, x + \\eta)`. Note ---- To avoid infinity values, we consider only pixels/voxels for :math:`x+\\eta\\geq0`.""" <|body_0|> def gradient(self, x, out=None): ...
stack_v2_sparse_classes_36k_train_004662
18,813
permissive
[ { "docstring": "Returns the value of the KullbackLeibler function at :math:`(b, x + \\\\eta)`. Note ---- To avoid infinity values, we consider only pixels/voxels for :math:`x+\\\\eta\\\\geq0`.", "name": "__call__", "signature": "def __call__(self, x)" }, { "docstring": "Returns the value of the ...
5
stack_v2_sparse_classes_30k_train_001198
Implement the Python class `KullbackLeibler_numpy` described below. Class description: Implement the KullbackLeibler_numpy class. Method signatures and docstrings: - def __call__(self, x): Returns the value of the KullbackLeibler function at :math:`(b, x + \\eta)`. Note ---- To avoid infinity values, we consider only...
Implement the Python class `KullbackLeibler_numpy` described below. Class description: Implement the KullbackLeibler_numpy class. Method signatures and docstrings: - def __call__(self, x): Returns the value of the KullbackLeibler function at :math:`(b, x + \\eta)`. Note ---- To avoid infinity values, we consider only...
b0503d1b24cc71d937bbb780602d8778b36b0e77
<|skeleton|> class KullbackLeibler_numpy: def __call__(self, x): """Returns the value of the KullbackLeibler function at :math:`(b, x + \\eta)`. Note ---- To avoid infinity values, we consider only pixels/voxels for :math:`x+\\eta\\geq0`.""" <|body_0|> def gradient(self, x, out=None): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KullbackLeibler_numpy: def __call__(self, x): """Returns the value of the KullbackLeibler function at :math:`(b, x + \\eta)`. Note ---- To avoid infinity values, we consider only pixels/voxels for :math:`x+\\eta\\geq0`.""" tmp_sum = (x + self.eta).as_array() ind = tmp_sum >= 0 ...
the_stack_v2_python_sparse
Wrappers/Python/cil/optimisation/functions/KullbackLeibler.py
TomographicImaging/CIL
train
72
8e79cad0739d8de9e3c86cdd31761b0cd0052d40
[ "cache = {}\nfor x in nums:\n cache[x] = cache.get(x, 0) + 1\nfor item in cache.items():\n if item[1] == 1:\n return item[0]", "result = 0\nfor x in nums:\n result ^= x\nreturn result" ]
<|body_start_0|> cache = {} for x in nums: cache[x] = cache.get(x, 0) + 1 for item in cache.items(): if item[1] == 1: return item[0] <|end_body_0|> <|body_start_1|> result = 0 for x in nums: result ^= x return result <|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumberUsingExtra(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> cache = {} for x in nums:...
stack_v2_sparse_classes_36k_train_004663
946
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumberUsingExtra", "signature": "def singleNumberUsingExtra(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber", "signature": "def singleNumber(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_004767
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumberUsingExtra(self, nums): :type nums: List[int] :rtype: int - def singleNumber(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumberUsingExtra(self, nums): :type nums: List[int] :rtype: int - def singleNumber(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def...
0743cbeb0e9aa4a8a25f4520a1e3f92793fae1ee
<|skeleton|> class Solution: def singleNumberUsingExtra(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def singleNumberUsingExtra(self, nums): """:type nums: List[int] :rtype: int""" cache = {} for x in nums: cache[x] = cache.get(x, 0) + 1 for item in cache.items(): if item[1] == 1: return item[0] def singleNumber(self, nums...
the_stack_v2_python_sparse
practice/leetcode/algorithm/136_SingleNumber.py
aliceayres/leetcode-practice
train
0
c928dcd4069edea1639fd852dc8945f9ed291a77
[ "user = User()\nuser.username = 'test'\nuser.save()\nprofile = Profile.objects.get(user=user)\nself.assertFalse(profile.activated)\nuser_id = user.id\nuser_token = profile.activation_token\nurl = reverse('userprofile-activate', args=(user_id, user_token))\nself.client.get(url)\nprofile = Profile.objects.get(user=us...
<|body_start_0|> user = User() user.username = 'test' user.save() profile = Profile.objects.get(user=user) self.assertFalse(profile.activated) user_id = user.id user_token = profile.activation_token url = reverse('userprofile-activate', args=(user_id, user...
AccountActionvationTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AccountActionvationTests: def test_user_activation(self): """Tests if the user activation works""" <|body_0|> def test_user_whrong_activation(self): """Tests if the user activation works worng""" <|body_1|> <|end_skeleton|> <|body_start_0|> user = U...
stack_v2_sparse_classes_36k_train_004664
8,641
no_license
[ { "docstring": "Tests if the user activation works", "name": "test_user_activation", "signature": "def test_user_activation(self)" }, { "docstring": "Tests if the user activation works worng", "name": "test_user_whrong_activation", "signature": "def test_user_whrong_activation(self)" }...
2
stack_v2_sparse_classes_30k_train_019628
Implement the Python class `AccountActionvationTests` described below. Class description: Implement the AccountActionvationTests class. Method signatures and docstrings: - def test_user_activation(self): Tests if the user activation works - def test_user_whrong_activation(self): Tests if the user activation works wor...
Implement the Python class `AccountActionvationTests` described below. Class description: Implement the AccountActionvationTests class. Method signatures and docstrings: - def test_user_activation(self): Tests if the user activation works - def test_user_whrong_activation(self): Tests if the user activation works wor...
bee916136a67f2203a7ca6078220553ae1ce9c3c
<|skeleton|> class AccountActionvationTests: def test_user_activation(self): """Tests if the user activation works""" <|body_0|> def test_user_whrong_activation(self): """Tests if the user activation works worng""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AccountActionvationTests: def test_user_activation(self): """Tests if the user activation works""" user = User() user.username = 'test' user.save() profile = Profile.objects.get(user=user) self.assertFalse(profile.activated) user_id = user.id use...
the_stack_v2_python_sparse
dwarf/userprofile/tests.py
slok/dwarf
train
1
da15541a5be3e9a130de1526ee7cd7695a33253b
[ "ans = []\n\ndef _generate(s='', l=0, r=0):\n if len(s) == 2 * n:\n ans.append(s)\n return\n if l < n:\n _generate(s + '(', l + 1, r)\n if r < l:\n _generate(s + ')', l, r + 1)\n_generate()\nreturn ans", "from collections import deque\nans = []\nqueue = deque([('', 0, 0)])\nwh...
<|body_start_0|> ans = [] def _generate(s='', l=0, r=0): if len(s) == 2 * n: ans.append(s) return if l < n: _generate(s + '(', l + 1, r) if r < l: _generate(s + ')', l, r + 1) _generate() ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generateParenthesis(self, n: int) -> List[str]: """1. 递归 KEY:关键点是生成括号的合法性的判断!!!""" <|body_0|> def generateParenthesis2(self, n: int) -> List[str]: """2. 队列:记录当前子串状态及左右括号的数量""" <|body_1|> <|end_skeleton|> <|body_start_0|> ans = [] ...
stack_v2_sparse_classes_36k_train_004665
2,017
no_license
[ { "docstring": "1. 递归 KEY:关键点是生成括号的合法性的判断!!!", "name": "generateParenthesis", "signature": "def generateParenthesis(self, n: int) -> List[str]" }, { "docstring": "2. 队列:记录当前子串状态及左右括号的数量", "name": "generateParenthesis2", "signature": "def generateParenthesis2(self, n: int) -> List[str]" ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateParenthesis(self, n: int) -> List[str]: 1. 递归 KEY:关键点是生成括号的合法性的判断!!! - def generateParenthesis2(self, n: int) -> List[str]: 2. 队列:记录当前子串状态及左右括号的数量
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generateParenthesis(self, n: int) -> List[str]: 1. 递归 KEY:关键点是生成括号的合法性的判断!!! - def generateParenthesis2(self, n: int) -> List[str]: 2. 队列:记录当前子串状态及左右括号的数量 <|skeleton|> class...
4732fb80710a08a715c3e7080c394f5298b8326d
<|skeleton|> class Solution: def generateParenthesis(self, n: int) -> List[str]: """1. 递归 KEY:关键点是生成括号的合法性的判断!!!""" <|body_0|> def generateParenthesis2(self, n: int) -> List[str]: """2. 队列:记录当前子串状态及左右括号的数量""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def generateParenthesis(self, n: int) -> List[str]: """1. 递归 KEY:关键点是生成括号的合法性的判断!!!""" ans = [] def _generate(s='', l=0, r=0): if len(s) == 2 * n: ans.append(s) return if l < n: _generate(s + '(', l + 1,...
the_stack_v2_python_sparse
.leetcode/22.括号生成.py
xiaoruijiang/algorithm
train
0
c75d575e0808cb45511979d5be0661a999f5625d
[ "super(HyperOptOAT, self).__init__(params, data)\nself.objective = None\nself.trial_losses = []\nself.best_trial = None\nself.n_factors = None\nself.n_levels = None\nself.strength = None\nself.N_runs = None", "number_of_trial = 0\nself.objective = ObjectiveBase(self.params, self.data_handler)\nfor row in self.ort...
<|body_start_0|> super(HyperOptOAT, self).__init__(params, data) self.objective = None self.trial_losses = [] self.best_trial = None self.n_factors = None self.n_levels = None self.strength = None self.N_runs = None <|end_body_0|> <|body_start_1|> ...
Hyperparameter optimizer using Orthogonal Array Tuning.
HyperOptOAT
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HyperOptOAT: """Hyperparameter optimizer using Orthogonal Array Tuning.""" def __init__(self, params, data): """Create a HyperOptOAT object. Parameters ---------- params : mala.common.parametes.Parameters Parameters used to create this hyperparameter optimizer. data : mala.datahandli...
stack_v2_sparse_classes_36k_train_004666
4,528
permissive
[ { "docstring": "Create a HyperOptOAT object. Parameters ---------- params : mala.common.parametes.Parameters Parameters used to create this hyperparameter optimizer. data : mala.datahandling.data_handler.DataHandler DataHandler holding the data for the hyperparameter optimization.", "name": "__init__", ...
5
stack_v2_sparse_classes_30k_train_009292
Implement the Python class `HyperOptOAT` described below. Class description: Hyperparameter optimizer using Orthogonal Array Tuning. Method signatures and docstrings: - def __init__(self, params, data): Create a HyperOptOAT object. Parameters ---------- params : mala.common.parametes.Parameters Parameters used to cre...
Implement the Python class `HyperOptOAT` described below. Class description: Hyperparameter optimizer using Orthogonal Array Tuning. Method signatures and docstrings: - def __init__(self, params, data): Create a HyperOptOAT object. Parameters ---------- params : mala.common.parametes.Parameters Parameters used to cre...
9cc771b0cdc4178c7f66fd717684658abbb0d95c
<|skeleton|> class HyperOptOAT: """Hyperparameter optimizer using Orthogonal Array Tuning.""" def __init__(self, params, data): """Create a HyperOptOAT object. Parameters ---------- params : mala.common.parametes.Parameters Parameters used to create this hyperparameter optimizer. data : mala.datahandli...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HyperOptOAT: """Hyperparameter optimizer using Orthogonal Array Tuning.""" def __init__(self, params, data): """Create a HyperOptOAT object. Parameters ---------- params : mala.common.parametes.Parameters Parameters used to create this hyperparameter optimizer. data : mala.datahandling.data_handl...
the_stack_v2_python_sparse
mala/network/hyper_opt_oat.py
icamps/mala
train
0
e98e77f40afdcaa65a888184e04ba50e474dfc52
[ "if s == '':\n return True\nX = [False] * len(s)\nfor i in range(0, len(s)):\n if i == 0 or X[i - 1] == True:\n for word in wordDict:\n if s[i:i + len(word)] == word:\n X[i + len(word) - 1] = True\nreturn X[-1]", "if len(s) == 0:\n return True\nfor word in wordDict:\n ...
<|body_start_0|> if s == '': return True X = [False] * len(s) for i in range(0, len(s)): if i == 0 or X[i - 1] == True: for word in wordDict: if s[i:i + len(word)] == word: X[i + len(word) - 1] = True ret...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_0|> def wordBreakRecursive(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|...
stack_v2_sparse_classes_36k_train_004667
18,132
no_license
[ { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreak", "signature": "def wordBreak(self, s, wordDict)" }, { "docstring": ":type s: str :type wordDict: List[str] :rtype: bool", "name": "wordBreakRecursive", "signature": "def wordBreakRecursive(self, s, ...
2
stack_v2_sparse_classes_30k_train_016560
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - def wordBreakRecursive(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def wordBreak(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: bool - def wordBreakRecursive(self, s, wordDict): :type s: str :type wordDict: List[str] :rtype: ...
f5d35123ab14ac630f1bcf1105829c47bb43b9a9
<|skeleton|> class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_0|> def wordBreakRecursive(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def wordBreak(self, s, wordDict): """:type s: str :type wordDict: List[str] :rtype: bool""" if s == '': return True X = [False] * len(s) for i in range(0, len(s)): if i == 0 or X[i - 1] == True: for word in wordDict: ...
the_stack_v2_python_sparse
139. Word Break.py
mbuon/Leetcode
train
1
e6416a97ff424b6540b22f6afdbc4e50aa643a8e
[ "super().__init__(fn.track, 'J')\nself.fn = fn\nassert isinstance(fn, Inferrer)\nself.mktuple = mktuple", "args = [TransformedReference(self.engine, P.Jinv, jarg) for jarg in jargs]\nres = await self.fn(*args)\nres_t = self.track.jtag(await reify_shallow(res))\nbparams_t = [self.track.stag(self)]\nbparams_t += [s...
<|body_start_0|> super().__init__(fn.track, 'J') self.fn = fn assert isinstance(fn, Inferrer) self.mktuple = mktuple <|end_body_0|> <|body_start_1|> args = [TransformedReference(self.engine, P.Jinv, jarg) for jarg in jargs] res = await self.fn(*args) res_t = self...
Inferrer for J(fn). Arguments: fn: The function to transform. mktuple: A function to create a tuple appropriate for the track.
JInferrer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JInferrer: """Inferrer for J(fn). Arguments: fn: The function to transform. mktuple: A function to create a tuple appropriate for the track.""" def __init__(self, fn, mktuple): """Initialize a JInferrer.""" <|body_0|> async def infer(self, *jargs): """Infer given...
stack_v2_sparse_classes_36k_train_004668
1,315
permissive
[ { "docstring": "Initialize a JInferrer.", "name": "__init__", "signature": "def __init__(self, fn, mktuple)" }, { "docstring": "Infer given the arguments.", "name": "infer", "signature": "async def infer(self, *jargs)" } ]
2
stack_v2_sparse_classes_30k_train_017771
Implement the Python class `JInferrer` described below. Class description: Inferrer for J(fn). Arguments: fn: The function to transform. mktuple: A function to create a tuple appropriate for the track. Method signatures and docstrings: - def __init__(self, fn, mktuple): Initialize a JInferrer. - async def infer(self,...
Implement the Python class `JInferrer` described below. Class description: Inferrer for J(fn). Arguments: fn: The function to transform. mktuple: A function to create a tuple appropriate for the track. Method signatures and docstrings: - def __init__(self, fn, mktuple): Initialize a JInferrer. - async def infer(self,...
1256317fd74f73a6f431becc711a01254c74f1b2
<|skeleton|> class JInferrer: """Inferrer for J(fn). Arguments: fn: The function to transform. mktuple: A function to create a tuple appropriate for the track.""" def __init__(self, fn, mktuple): """Initialize a JInferrer.""" <|body_0|> async def infer(self, *jargs): """Infer given...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JInferrer: """Inferrer for J(fn). Arguments: fn: The function to transform. mktuple: A function to create a tuple appropriate for the track.""" def __init__(self, fn, mktuple): """Initialize a JInferrer.""" super().__init__(fn.track, 'J') self.fn = fn assert isinstance(fn,...
the_stack_v2_python_sparse
myia/infer/jinf.py
mbrukman/myia
train
0
0903ff999ba0d3eb3887cd0fb297e21f7b1353ca
[ "print(target)\nfor i in range(0, len(nums)):\n for j in range(i + 1, len(nums)):\n for k in range(i + 2, len(nums)):\n a = nums[i]\n b = nums[j]\n c = nums[k]\n if a + b + c == target:\n print([a, b, c])\n return 1", "nums.sort()...
<|body_start_0|> print(target) for i in range(0, len(nums)): for j in range(i + 1, len(nums)): for k in range(i + 2, len(nums)): a = nums[i] b = nums[j] c = nums[k] if a + b + c == target: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_004669
1,769
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "threeSumClosest", "signature": "def threeSumClosest(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: int", "name": "threeSumClosest", "signature": "def threeSumClosest(se...
2
stack_v2_sparse_classes_30k_train_020117
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :r...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :rtype: int - def threeSumClosest(self, nums, target): :type nums: List[int] :type target: int :r...
ca6ffffcb775c4caacc4dc907b9912b40a48a343
<|skeleton|> class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_0|> def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def threeSumClosest(self, nums, target): """:type nums: List[int] :type target: int :rtype: int""" print(target) for i in range(0, len(nums)): for j in range(i + 1, len(nums)): for k in range(i + 2, len(nums)): a = nums[i] ...
the_stack_v2_python_sparse
Array/02_3Sumclosest.py
saranyab9064/leetcode-geeks
train
0
14521041b58db8e01ae6f4b3510fd510f19c2408
[ "self.name = 'masterbias'\nself.procname = 'mbias'\nself.log = logging.getLogger('pipe.step.%s' % self.name)\nself.paramlist = []\nself.paramlist.append(['combinemethod', 'median', 'Specifies how the files should be combined - options are median, average, sum'])\nself.paramlist.append(['outputfolder', '', 'Output d...
<|body_start_0|> self.name = 'masterbias' self.procname = 'mbias' self.log = logging.getLogger('pipe.step.%s' % self.name) self.paramlist = [] self.paramlist.append(['combinemethod', 'median', 'Specifies how the files should be combined - options are median, average, sum']) ...
Stone Edge Pipeline Step Master Bias Object The object is callable. It requires a valid configuration input (file or object) when it runs.
StepMasterBias
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StepMasterBias: """Stone Edge Pipeline Step Master Bias Object The object is callable. It requires a valid configuration input (file or object) when it runs.""" def setup(self): """### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved...
stack_v2_sparse_classes_36k_train_004670
4,726
no_license
[ { "docstring": "### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved files. Defines the input parameters for the current pipe step. Setup() is called at the end of __init__ The parameters are stored in a list containing the following information: - name: The na...
2
stack_v2_sparse_classes_30k_train_020417
Implement the Python class `StepMasterBias` described below. Class description: Stone Edge Pipeline Step Master Bias Object The object is callable. It requires a valid configuration input (file or object) when it runs. Method signatures and docstrings: - def setup(self): ### Names and Parameters need to be Set Here #...
Implement the Python class `StepMasterBias` described below. Class description: Stone Edge Pipeline Step Master Bias Object The object is callable. It requires a valid configuration input (file or object) when it runs. Method signatures and docstrings: - def setup(self): ### Names and Parameters need to be Set Here #...
dd41da709e2bd55f072b37f5a9b16f1a61dcfc8c
<|skeleton|> class StepMasterBias: """Stone Edge Pipeline Step Master Bias Object The object is callable. It requires a valid configuration input (file or object) when it runs.""" def setup(self): """### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StepMasterBias: """Stone Edge Pipeline Step Master Bias Object The object is callable. It requires a valid configuration input (file or object) when it runs.""" def setup(self): """### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved files. Defin...
the_stack_v2_python_sparse
source/stonesteps/stepmasterbias.py
yerkesobservatory/pipeline
train
6
0bf30ac6cc76253dce5a64e710ff14ccdea1e0f9
[ "coins = [0] * N\nfor relation in trust:\n coins[relation[0] - 1] -= 1\n coins[relation[1] - 1] += 1\nfor index, coin in enumerate(coins):\n if coin == N - 1:\n return index + 1\nreturn -1", "coins = dict(zip(range(1, N + 1), [0] * N))\nfor relation in trust:\n coins[relation[0]] = coins.get(re...
<|body_start_0|> coins = [0] * N for relation in trust: coins[relation[0] - 1] -= 1 coins[relation[1] - 1] += 1 for index, coin in enumerate(coins): if coin == N - 1: return index + 1 return -1 <|end_body_0|> <|body_start_1|> c...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _findJudge(self, N, trust): """:type N: int :type trust: List[List[int]] :rtype: int""" <|body_0|> def findJudge(self, N, trust): """:type N: int :type trust: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004671
2,589
permissive
[ { "docstring": ":type N: int :type trust: List[List[int]] :rtype: int", "name": "_findJudge", "signature": "def _findJudge(self, N, trust)" }, { "docstring": ":type N: int :type trust: List[List[int]] :rtype: int", "name": "findJudge", "signature": "def findJudge(self, N, trust)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _findJudge(self, N, trust): :type N: int :type trust: List[List[int]] :rtype: int - def findJudge(self, N, trust): :type N: int :type trust: List[List[int]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _findJudge(self, N, trust): :type N: int :type trust: List[List[int]] :rtype: int - def findJudge(self, N, trust): :type N: int :type trust: List[List[int]] :rtype: int <|sk...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _findJudge(self, N, trust): """:type N: int :type trust: List[List[int]] :rtype: int""" <|body_0|> def findJudge(self, N, trust): """:type N: int :type trust: List[List[int]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def _findJudge(self, N, trust): """:type N: int :type trust: List[List[int]] :rtype: int""" coins = [0] * N for relation in trust: coins[relation[0] - 1] -= 1 coins[relation[1] - 1] += 1 for index, coin in enumerate(coins): if coin ...
the_stack_v2_python_sparse
997.find-the-town-judge.py
windard/leeeeee
train
0
5dab47e94725ac7e5f7f08a3b318c35389c87b44
[ "self.tator_api = tator_api\nself.media_num_frames = media.num_frames - 2\nself.moving_forward = moving_forward\nself.buffer_size = buffer_size\nself.work_folder = work_folder\nself.media = media\nself.frame_buffer = {}\nself.use_get_frame = use_get_frame\nhighest_quality = 0\nfor media_file in media.media_files.st...
<|body_start_0|> self.tator_api = tator_api self.media_num_frames = media.num_frames - 2 self.moving_forward = moving_forward self.buffer_size = buffer_size self.work_folder = work_folder self.media = media self.frame_buffer = {} self.use_get_frame = use_g...
FrameBuffer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FrameBuffer: def __init__(self, tator_api: tator.openapi.tator_openapi.api.tator_api.TatorApi, media: tator.openapi.tator_openapi.models.media.Media, moving_forward: bool, work_folder: str, buffer_size: int, use_get_frame: bool=False) -> None: """Constructor""" <|body_0|> de...
stack_v2_sparse_classes_36k_train_004672
27,504
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, tator_api: tator.openapi.tator_openapi.api.tator_api.TatorApi, media: tator.openapi.tator_openapi.models.media.Media, moving_forward: bool, work_folder: str, buffer_size: int, use_get_frame: bool=False) -> None" }, { ...
3
null
Implement the Python class `FrameBuffer` described below. Class description: Implement the FrameBuffer class. Method signatures and docstrings: - def __init__(self, tator_api: tator.openapi.tator_openapi.api.tator_api.TatorApi, media: tator.openapi.tator_openapi.models.media.Media, moving_forward: bool, work_folder: ...
Implement the Python class `FrameBuffer` described below. Class description: Implement the FrameBuffer class. Method signatures and docstrings: - def __init__(self, tator_api: tator.openapi.tator_openapi.api.tator_api.TatorApi, media: tator.openapi.tator_openapi.models.media.Media, moving_forward: bool, work_folder: ...
fae655f396380dbe74413812a41b734e267faffe
<|skeleton|> class FrameBuffer: def __init__(self, tator_api: tator.openapi.tator_openapi.api.tator_api.TatorApi, media: tator.openapi.tator_openapi.models.media.Media, moving_forward: bool, work_folder: str, buffer_size: int, use_get_frame: bool=False) -> None: """Constructor""" <|body_0|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FrameBuffer: def __init__(self, tator_api: tator.openapi.tator_openapi.api.tator_api.TatorApi, media: tator.openapi.tator_openapi.models.media.Media, moving_forward: bool, work_folder: str, buffer_size: int, use_get_frame: bool=False) -> None: """Constructor""" self.tator_api = tator_api ...
the_stack_v2_python_sparse
scripts/tator/fill_track_gaps.py
openem-team/openem
train
11
a821df0ab9b090990bc2dfddf37360c41334100a
[ "mapping = {}\nfor i in nums:\n mapping[i] = mapping[i] + 1 if i in mapping.keys() else 1\nlist_ = []\nimport heapq\nfor key, val in mapping.items():\n heapq.heappush(list_, (-val, key))\nprint(list_)\nreturn [heapq.heappop(list_)[1] for i in range(k)]", "mapping = {}\nfor i in nums:\n if i in mapping.ke...
<|body_start_0|> mapping = {} for i in nums: mapping[i] = mapping[i] + 1 if i in mapping.keys() else 1 list_ = [] import heapq for key, val in mapping.items(): heapq.heappush(list_, (-val, key)) print(list_) return [heapq.heappop(list_)[1] ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def topKFrequent(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def topKFrequent1(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004673
1,269
permissive
[ { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "topKFrequent", "signature": "def topKFrequent(self, nums, k)" }, { "docstring": ":type nums: List[int] :type k: int :rtype: List[int]", "name": "topKFrequent1", "signature": "def topKFrequent1(self, nums, k)"...
2
stack_v2_sparse_classes_30k_train_004685
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def topKFrequent(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def topKFrequent1(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def topKFrequent(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] - def topKFrequent1(self, nums, k): :type nums: List[int] :type k: int :rtype: List[int] <|...
64847cbb1adcaca4561b949e8acc52e8e031a6cb
<|skeleton|> class Solution: def topKFrequent(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_0|> def topKFrequent1(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def topKFrequent(self, nums, k): """:type nums: List[int] :type k: int :rtype: List[int]""" mapping = {} for i in nums: mapping[i] = mapping[i] + 1 if i in mapping.keys() else 1 list_ = [] import heapq for key, val in mapping.items(): ...
the_stack_v2_python_sparse
TopKFrequentElements347.py
Bit64L/LeetCode-Python-
train
0
ac5dfff75236146ede375c4ba8757575f4c6a95b
[ "async with database.connection() as connection:\n query = 'SELECT EXISTS(SELECT 1 FROM authors WHERE id = :id);'\n exists = await connection.fetch_val(query, payload)\n if not exists:\n raise NotFoundException()", "async with database.connection() as connection:\n raw_connection = connection.r...
<|body_start_0|> async with database.connection() as connection: query = 'SELECT EXISTS(SELECT 1 FROM authors WHERE id = :id);' exists = await connection.fetch_val(query, payload) if not exists: raise NotFoundException() <|end_body_0|> <|body_start_1|> ...
AuthorEndpoint
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AuthorEndpoint: async def validate_get_action(self, payload: typing.Dict[str, typing.Any]) -> None: """Check if it exists""" <|body_0|> async def get(self, request_data: typing.Dict) -> aiosqlite.Row: """Retrieves the author for the given id.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_004674
3,278
permissive
[ { "docstring": "Check if it exists", "name": "validate_get_action", "signature": "async def validate_get_action(self, payload: typing.Dict[str, typing.Any]) -> None" }, { "docstring": "Retrieves the author for the given id.", "name": "get", "signature": "async def get(self, request_data:...
4
stack_v2_sparse_classes_30k_train_020402
Implement the Python class `AuthorEndpoint` described below. Class description: Implement the AuthorEndpoint class. Method signatures and docstrings: - async def validate_get_action(self, payload: typing.Dict[str, typing.Any]) -> None: Check if it exists - async def get(self, request_data: typing.Dict) -> aiosqlite.R...
Implement the Python class `AuthorEndpoint` described below. Class description: Implement the AuthorEndpoint class. Method signatures and docstrings: - async def validate_get_action(self, payload: typing.Dict[str, typing.Any]) -> None: Check if it exists - async def get(self, request_data: typing.Dict) -> aiosqlite.R...
4c18a1cf1cfa088d67a61b89e64217e2e4dac809
<|skeleton|> class AuthorEndpoint: async def validate_get_action(self, payload: typing.Dict[str, typing.Any]) -> None: """Check if it exists""" <|body_0|> async def get(self, request_data: typing.Dict) -> aiosqlite.Row: """Retrieves the author for the given id.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AuthorEndpoint: async def validate_get_action(self, payload: typing.Dict[str, typing.Any]) -> None: """Check if it exists""" async with database.connection() as connection: query = 'SELECT EXISTS(SELECT 1 FROM authors WHERE id = :id);' exists = await connection.fetch_va...
the_stack_v2_python_sparse
example_app/base_api/base_common.py
gvbgduh/starlette-cbge
train
7
63a6b9315f73be64a3776e50602709b7309de62e
[ "self.name = 'overcut'\nself.procname = 'OVC'\nself.log = logging.getLogger('pipe.step.%s' % self.name)\nself.paramlist = []\nself.paramlist.append(['ovrscncolsfrac', 257, 'Fraction of the detector colums which are overscaned'])", "self.log.debug('Running step %s' % self.name)\nself.dataout = self.datain\noscfrac...
<|body_start_0|> self.name = 'overcut' self.procname = 'OVC' self.log = logging.getLogger('pipe.step.%s' % self.name) self.paramlist = [] self.paramlist.append(['ovrscncolsfrac', 257, 'Fraction of the detector colums which are overscaned']) <|end_body_0|> <|body_start_1|> ...
DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs.
StepOverCut
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StepOverCut: """DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs.""" def setup(self): """### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved files. Defines t...
stack_v2_sparse_classes_36k_train_004675
3,801
no_license
[ { "docstring": "### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved files. Defines the input parameters for the current pipe step. Setup() is called at the end of __init__ The parameters are stored in a list containing the following information: - name: The na...
2
stack_v2_sparse_classes_30k_test_000072
Implement the Python class `StepOverCut` described below. Class description: DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs. Method signatures and docstrings: - def setup(self): ### Names and Parameters need to be Set Here ### Sets the inter...
Implement the Python class `StepOverCut` described below. Class description: DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs. Method signatures and docstrings: - def setup(self): ### Names and Parameters need to be Set Here ### Sets the inter...
dd41da709e2bd55f072b37f5a9b16f1a61dcfc8c
<|skeleton|> class StepOverCut: """DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs.""" def setup(self): """### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved files. Defines t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StepOverCut: """DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs.""" def setup(self): """### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved files. Defines the input para...
the_stack_v2_python_sparse
source/stonesteps/stepovercut.py
yerkesobservatory/pipeline
train
6
b8216b4e3702f98ed2876fdd91dd58b8a050d575
[ "if not root:\n return []\nreturn [root.val] + [self.serialize(each) for each in root.children]", "if not data:\n return None\nnode = Node(data[0])\nnode.children = [self.deserialize(each) for each in data[1:]]\nreturn node" ]
<|body_start_0|> if not root: return [] return [root.val] + [self.serialize(each) for each in root.children] <|end_body_0|> <|body_start_1|> if not data: return None node = Node(data[0]) node.children = [self.deserialize(each) for each in data[1:]] ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|e...
stack_v2_sparse_classes_36k_train_004676
907
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: Node :rtype: str", "name": "serialize", "signature": "def serialize(self, root: 'Node') -> str" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node", "name": "deserialize", "signature": "def des...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: 'Node') -> str: Encodes a tree to a single string. :type root: Node :rtype: str - def deserialize(self, data: str) -> 'Node': Decodes your encoded data to tre...
ca445222ac0c513070123693977d8e1570c077f5
<|skeleton|> class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" <|body_0|> def deserialize(self, data: str) -> 'Node': """Decodes your encoded data to tree. :type data: str :rtype: Node""" <|body_1|> <|e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: 'Node') -> str: """Encodes a tree to a single string. :type root: Node :rtype: str""" if not root: return [] return [root.val] + [self.serialize(each) for each in root.children] def deserialize(self, data: str) -> 'Node': """Dec...
the_stack_v2_python_sparse
Problems/0428. Serialize and Deserialize N-ary Tree.py
KirkGuo/LeetCode-Accepted-Code
train
0
5014683dcd8aee94249af4c2d58f9aac46aa7b4c
[ "p = data.get('with', {})\na = p.pop('args') if 'args' in p else ()\nk = p.pop('kwargs') if 'kwargs' in p else {}\ntmp_a = (expand_env_var(v) for v in a)\ntmp_p = {kk: expand_env_var(vv) for kk, vv in {**k, **p}.items()}\nobj = cls(*tmp_a, **tmp_p)\npp = data.get('pods', {})\nfor pod_name, pod_attr in pp.items():\n...
<|body_start_0|> p = data.get('with', {}) a = p.pop('args') if 'args' in p else () k = p.pop('kwargs') if 'kwargs' in p else {} tmp_a = (expand_env_var(v) for v in a) tmp_p = {kk: expand_env_var(vv) for kk, vv in {**k, **p}.items()} obj = cls(*tmp_a, **tmp_p) pp =...
LegacyParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LegacyParser: def parse(self, cls: Type['BaseFlow'], data: Dict) -> 'BaseFlow': """:param cls: target class type to parse into, must be a :class:`JAMLCompatible` type :param data: flow yaml file loaded as python dict :return: the Flow YAML parser given the syntax version number""" ...
stack_v2_sparse_classes_36k_train_004677
2,491
permissive
[ { "docstring": ":param cls: target class type to parse into, must be a :class:`JAMLCompatible` type :param data: flow yaml file loaded as python dict :return: the Flow YAML parser given the syntax version number", "name": "parse", "signature": "def parse(self, cls: Type['BaseFlow'], data: Dict) -> 'Base...
2
stack_v2_sparse_classes_30k_train_006300
Implement the Python class `LegacyParser` described below. Class description: Implement the LegacyParser class. Method signatures and docstrings: - def parse(self, cls: Type['BaseFlow'], data: Dict) -> 'BaseFlow': :param cls: target class type to parse into, must be a :class:`JAMLCompatible` type :param data: flow ya...
Implement the Python class `LegacyParser` described below. Class description: Implement the LegacyParser class. Method signatures and docstrings: - def parse(self, cls: Type['BaseFlow'], data: Dict) -> 'BaseFlow': :param cls: target class type to parse into, must be a :class:`JAMLCompatible` type :param data: flow ya...
97f9e97a4a678a28bdeacbc7346eaf7bbd2aeb89
<|skeleton|> class LegacyParser: def parse(self, cls: Type['BaseFlow'], data: Dict) -> 'BaseFlow': """:param cls: target class type to parse into, must be a :class:`JAMLCompatible` type :param data: flow yaml file loaded as python dict :return: the Flow YAML parser given the syntax version number""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LegacyParser: def parse(self, cls: Type['BaseFlow'], data: Dict) -> 'BaseFlow': """:param cls: target class type to parse into, must be a :class:`JAMLCompatible` type :param data: flow yaml file loaded as python dict :return: the Flow YAML parser given the syntax version number""" p = data.get...
the_stack_v2_python_sparse
jina/jaml/parsers/flow/legacy.py
deepampatel/jina
train
2
bb0b248bc5bd1af9506f636b0f6bbb6d076236b0
[ "self.TimeOne = '15:15:00'\nself.TimeTwo = '15:15:12'\nself.output = 1\nreturn (self.TimeOne, self.TimeTwo, self.output)", "TimeOne, TimeTwo, output = self.setUp()\noutput_method = solution(TimeOne, TimeTwo)\nself.assertEqual(output, output_method)" ]
<|body_start_0|> self.TimeOne = '15:15:00' self.TimeTwo = '15:15:12' self.output = 1 return (self.TimeOne, self.TimeTwo, self.output) <|end_body_0|> <|body_start_1|> TimeOne, TimeTwo, output = self.setUp() output_method = solution(TimeOne, TimeTwo) self.assertEqu...
Class with unittests for Codility_1_task.py
test_Codility_1_task
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class test_Codility_1_task: """Class with unittests for Codility_1_task.py""" def setUp(self): """Sets up input.""" <|body_0|> def test_user_input(self): """Checks if method works properly.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.TimeOne ...
stack_v2_sparse_classes_36k_train_004678
882
no_license
[ { "docstring": "Sets up input.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Checks if method works properly.", "name": "test_user_input", "signature": "def test_user_input(self)" } ]
2
stack_v2_sparse_classes_30k_train_009229
Implement the Python class `test_Codility_1_task` described below. Class description: Class with unittests for Codility_1_task.py Method signatures and docstrings: - def setUp(self): Sets up input. - def test_user_input(self): Checks if method works properly.
Implement the Python class `test_Codility_1_task` described below. Class description: Class with unittests for Codility_1_task.py Method signatures and docstrings: - def setUp(self): Sets up input. - def test_user_input(self): Checks if method works properly. <|skeleton|> class test_Codility_1_task: """Class wit...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class test_Codility_1_task: """Class with unittests for Codility_1_task.py""" def setUp(self): """Sets up input.""" <|body_0|> def test_user_input(self): """Checks if method works properly.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class test_Codility_1_task: """Class with unittests for Codility_1_task.py""" def setUp(self): """Sets up input.""" self.TimeOne = '15:15:00' self.TimeTwo = '15:15:12' self.output = 1 return (self.TimeOne, self.TimeTwo, self.output) def test_user_input(self): ...
the_stack_v2_python_sparse
Codility_algorithms/test_Codility_1_task.py
JakubKazimierski/PythonPortfolio
train
9
91127ca06cefa45b00c914deeed12d7f010d3800
[ "if not q:\n return self\nif isinstance(q, QueryBuilder):\n self._query_builder = q\nelse:\n self._query_builder.where(q, **kwargs)\nreturn self", "if not q and (not kwargs):\n raise ApiError('.and_() expects a string, a solrq.Q, or kwargs')\nself._query_builder.and_(q, **kwargs)\nreturn self", "if ...
<|body_start_0|> if not q: return self if isinstance(q, QueryBuilder): self._query_builder = q else: self._query_builder.where(q, **kwargs) return self <|end_body_0|> <|body_start_1|> if not q and (not kwargs): raise ApiError('.and...
A mixin that supplies wrapper methods to access the _query_builder.
QueryBuilderSupportMixin
[ "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueryBuilderSupportMixin: """A mixin that supplies wrapper methods to access the _query_builder.""" def where(self, q=None, **kwargs): """Add a filter to this query. :param q: Query string, :py:class:`QueryBuilder`, or `solrq.Q` object :param kwargs: Arguments to construct a `solrq.Q...
stack_v2_sparse_classes_36k_train_004679
8,223
permissive
[ { "docstring": "Add a filter to this query. :param q: Query string, :py:class:`QueryBuilder`, or `solrq.Q` object :param kwargs: Arguments to construct a `solrq.Q` with :return: Query object :rtype: :py:class:`Query`", "name": "where", "signature": "def where(self, q=None, **kwargs)" }, { "docst...
4
stack_v2_sparse_classes_30k_val_000831
Implement the Python class `QueryBuilderSupportMixin` described below. Class description: A mixin that supplies wrapper methods to access the _query_builder. Method signatures and docstrings: - def where(self, q=None, **kwargs): Add a filter to this query. :param q: Query string, :py:class:`QueryBuilder`, or `solrq.Q...
Implement the Python class `QueryBuilderSupportMixin` described below. Class description: A mixin that supplies wrapper methods to access the _query_builder. Method signatures and docstrings: - def where(self, q=None, **kwargs): Add a filter to this query. :param q: Query string, :py:class:`QueryBuilder`, or `solrq.Q...
32dd08d2185f7113f87834002e720db31c8c910e
<|skeleton|> class QueryBuilderSupportMixin: """A mixin that supplies wrapper methods to access the _query_builder.""" def where(self, q=None, **kwargs): """Add a filter to this query. :param q: Query string, :py:class:`QueryBuilder`, or `solrq.Q` object :param kwargs: Arguments to construct a `solrq.Q...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueryBuilderSupportMixin: """A mixin that supplies wrapper methods to access the _query_builder.""" def where(self, q=None, **kwargs): """Add a filter to this query. :param q: Query string, :py:class:`QueryBuilder`, or `solrq.Q` object :param kwargs: Arguments to construct a `solrq.Q` with :retur...
the_stack_v2_python_sparse
src/cbapi/psc/base_query.py
carbonblack/cbapi-python
train
158
a1ebfe9caf337253fad01f2a4567814257ec4047
[ "self._api = api\nself._sensors = sensors\nself._connected = True", "for index, sensor in enumerate(self._sensors):\n if sensor.type == sensor_type:\n self._sensors[index].enabled = True\n return", "for index, sensor in enumerate(self._sensors):\n if sensor.type == sensor_type:\n self...
<|body_start_0|> self._api = api self._sensors = sensors self._connected = True <|end_body_0|> <|body_start_1|> for index, sensor in enumerate(self._sensors): if sensor.type == sensor_type: self._sensors[index].enabled = True return <|end_body...
Class handling the API updates.
AsuswrtDataHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsuswrtDataHandler: """Class handling the API updates.""" def __init__(self, sensors: List[_SensorInfo], api: AsusWrt): """Initialize the handler class.""" <|body_0|> def enable_sensor(self, sensor_type: _SensorTypes): """Enable a specific sensor type.""" ...
stack_v2_sparse_classes_36k_train_004680
8,041
permissive
[ { "docstring": "Initialize the handler class.", "name": "__init__", "signature": "def __init__(self, sensors: List[_SensorInfo], api: AsusWrt)" }, { "docstring": "Enable a specific sensor type.", "name": "enable_sensor", "signature": "def enable_sensor(self, sensor_type: _SensorTypes)" ...
4
null
Implement the Python class `AsuswrtDataHandler` described below. Class description: Class handling the API updates. Method signatures and docstrings: - def __init__(self, sensors: List[_SensorInfo], api: AsusWrt): Initialize the handler class. - def enable_sensor(self, sensor_type: _SensorTypes): Enable a specific se...
Implement the Python class `AsuswrtDataHandler` described below. Class description: Class handling the API updates. Method signatures and docstrings: - def __init__(self, sensors: List[_SensorInfo], api: AsusWrt): Initialize the handler class. - def enable_sensor(self, sensor_type: _SensorTypes): Enable a specific se...
4ab0151fb1cbefb31def23ba850e197da0a5027f
<|skeleton|> class AsuswrtDataHandler: """Class handling the API updates.""" def __init__(self, sensors: List[_SensorInfo], api: AsusWrt): """Initialize the handler class.""" <|body_0|> def enable_sensor(self, sensor_type: _SensorTypes): """Enable a specific sensor type.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AsuswrtDataHandler: """Class handling the API updates.""" def __init__(self, sensors: List[_SensorInfo], api: AsusWrt): """Initialize the handler class.""" self._api = api self._sensors = sensors self._connected = True def enable_sensor(self, sensor_type: _SensorTypes...
the_stack_v2_python_sparse
homeassistant/components/asuswrt/sensor.py
turbokongen/home-assistant
train
4
fed27a5f608ad752d800e91be77eb73f6c8b354a
[ "try:\n geometry = GEOSGeometry(geom_wkt)\n if geometry is None or geometry.geom_type != 'Point':\n return None\n return geometry\nexcept (ValueError, GEOSException):\n return None", "if base_name:\n if not point_name:\n point_name = base_name + '_point'\n if not point_alternate_na...
<|body_start_0|> try: geometry = GEOSGeometry(geom_wkt) if geometry is None or geometry.geom_type != 'Point': return None return geometry except (ValueError, GEOSException): return None <|end_body_0|> <|body_start_1|> if base_name:...
Base form for the carpool app
BaseForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseForm: """Base form for the carpool app""" def get_point(self, geom_wkt): """Return a geometry of type "point" from a WKT point""" <|body_0|> def clean_route_point(self, point_name=None, point_alternate_name=None, displayable_name=None, base_name=None): """Rou...
stack_v2_sparse_classes_36k_train_004681
9,404
no_license
[ { "docstring": "Return a geometry of type \"point\" from a WKT point", "name": "get_point", "signature": "def get_point(self, geom_wkt)" }, { "docstring": "Route point (departure/arrival) cleaner for forms Check that the WKT traject point is well filled, and match to a geometry of type point.", ...
2
stack_v2_sparse_classes_30k_train_014240
Implement the Python class `BaseForm` described below. Class description: Base form for the carpool app Method signatures and docstrings: - def get_point(self, geom_wkt): Return a geometry of type "point" from a WKT point - def clean_route_point(self, point_name=None, point_alternate_name=None, displayable_name=None,...
Implement the Python class `BaseForm` described below. Class description: Base form for the carpool app Method signatures and docstrings: - def get_point(self, geom_wkt): Return a geometry of type "point" from a WKT point - def clean_route_point(self, point_name=None, point_alternate_name=None, displayable_name=None,...
5cc5ccf2759d0856ebfc8f9678bb814ef1c5a1ac
<|skeleton|> class BaseForm: """Base form for the carpool app""" def get_point(self, geom_wkt): """Return a geometry of type "point" from a WKT point""" <|body_0|> def clean_route_point(self, point_name=None, point_alternate_name=None, displayable_name=None, base_name=None): """Rou...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseForm: """Base form for the carpool app""" def get_point(self, geom_wkt): """Return a geometry of type "point" from a WKT point""" try: geometry = GEOSGeometry(geom_wkt) if geometry is None or geometry.geom_type != 'Point': return None ...
the_stack_v2_python_sparse
src/bv/client/trips/forms.py
bisonvert/bv.client
train
0
4c801d8d88e9ca231df0d601a38ab26178bb531b
[ "user = authenticate(request)\nif not MartAccessPermissions.top().user_can_access_definition(user, definition_id):\n raise HTTPUnauthorized()\nif not get_settings().mart_allow_runtime_creation:\n raise HTTPForbidden('Runtime Mart creation is not allowed')\ncreator = MartCreator(user, definition_id)\ntry:\n ...
<|body_start_0|> user = authenticate(request) if not MartAccessPermissions.top().user_can_access_definition(user, definition_id): raise HTTPUnauthorized() if not get_settings().mart_allow_runtime_creation: raise HTTPForbidden('Runtime Mart creation is not allowed') ...
DefinitionDetailResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefinitionDetailResource: def create(self, request, definition_id, **params): """Initiates the creation of a Mart using the specified Mart Definition. The body of this request allows two parameters: * ``purge_on_failure``: Whether or not to purge the remnants of the Mart if creation fail...
stack_v2_sparse_classes_36k_train_004682
13,752
permissive
[ { "docstring": "Initiates the creation of a Mart using the specified Mart Definition. The body of this request allows two parameters: * ``purge_on_failure``: Whether or not to purge the remnants of the Mart if creation fails at any point. Optional. Defaults to ``true``. * ``leave_incomplete``: Whether or not to...
2
stack_v2_sparse_classes_30k_test_000193
Implement the Python class `DefinitionDetailResource` described below. Class description: Implement the DefinitionDetailResource class. Method signatures and docstrings: - def create(self, request, definition_id, **params): Initiates the creation of a Mart using the specified Mart Definition. The body of this request...
Implement the Python class `DefinitionDetailResource` described below. Class description: Implement the DefinitionDetailResource class. Method signatures and docstrings: - def create(self, request, definition_id, **params): Initiates the creation of a Mart using the specified Mart Definition. The body of this request...
5588355677873ef1531ddbd1816eb2b0f6ea6996
<|skeleton|> class DefinitionDetailResource: def create(self, request, definition_id, **params): """Initiates the creation of a Mart using the specified Mart Definition. The body of this request allows two parameters: * ``purge_on_failure``: Whether or not to purge the remnants of the Mart if creation fail...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DefinitionDetailResource: def create(self, request, definition_id, **params): """Initiates the creation of a Mart using the specified Mart Definition. The body of this request allows two parameters: * ``purge_on_failure``: Whether or not to purge the remnants of the Mart if creation fails at any point...
the_stack_v2_python_sparse
src/rex.mart/src/rex/mart/commands.py
prometheusresearch/baseline-codebase
train
9
8e582a0eff37d724dee56663dfdd9534106de193
[ "for index, element in enumerate(array):\n if element % 2 != 0:\n inserted_index = index\n for j in range(inserted_index - 1, -1, -1):\n if array[j] % 2 != 0:\n inserted_index = j + 1\n break\n elif j == 0:\n inserted_index = 0\n ...
<|body_start_0|> for index, element in enumerate(array): if element % 2 != 0: inserted_index = index for j in range(inserted_index - 1, -1, -1): if array[j] % 2 != 0: inserted_index = j + 1 break ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reOrderArray(self, array): """loop [2, 1, 3, 4, 5] if current element is odd: * 2 * 1 exchange with 1st element when 1st element is even [1, 2, 3, 4, 5] * 3 exchange with latest element whose prior element is odd [1, 3, 2, 4, 5] * 5 if we do as above, we will get [1, 3, 5, ...
stack_v2_sparse_classes_36k_train_004683
1,679
permissive
[ { "docstring": "loop [2, 1, 3, 4, 5] if current element is odd: * 2 * 1 exchange with 1st element when 1st element is even [1, 2, 3, 4, 5] * 3 exchange with latest element whose prior element is odd [1, 3, 2, 4, 5] * 5 if we do as above, we will get [1, 3, 5, 4, 2] that will break the relative order. we should ...
2
stack_v2_sparse_classes_30k_train_015016
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reOrderArray(self, array): loop [2, 1, 3, 4, 5] if current element is odd: * 2 * 1 exchange with 1st element when 1st element is even [1, 2, 3, 4, 5] * 3 exchange with latest...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reOrderArray(self, array): loop [2, 1, 3, 4, 5] if current element is odd: * 2 * 1 exchange with 1st element when 1st element is even [1, 2, 3, 4, 5] * 3 exchange with latest...
5fdd3a607ee3828e9b229cac8104fcccf1a2770d
<|skeleton|> class Solution: def reOrderArray(self, array): """loop [2, 1, 3, 4, 5] if current element is odd: * 2 * 1 exchange with 1st element when 1st element is even [1, 2, 3, 4, 5] * 3 exchange with latest element whose prior element is odd [1, 3, 2, 4, 5] * 5 if we do as above, we will get [1, 3, 5, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reOrderArray(self, array): """loop [2, 1, 3, 4, 5] if current element is odd: * 2 * 1 exchange with 1st element when 1st element is even [1, 2, 3, 4, 5] * 3 exchange with latest element whose prior element is odd [1, 3, 2, 4, 5] * 5 if we do as above, we will get [1, 3, 5, 4, 2] that wil...
the_stack_v2_python_sparse
014-调整数组顺序使奇数位于偶数前面/v2.py
Jay54520/Learn-Algorithms-With-Python
train
0
599e3fb8b170d9994fe368d9ce34c791fc24c854
[ "image_numbers = list(image_numbers)\nfilenames = list(filenames)\ndebug('image_numbers = %.200r' % image_numbers)\nself.image_numbers = image_numbers\ndebug('filenames = %.200r' % filenames)\nself.filenames = filenames\nself.xdet_trig_counts = {}\nself.acquiring = True\nself.trigger_monitoring = True\nself.saving_...
<|body_start_0|> image_numbers = list(image_numbers) filenames = list(filenames) debug('image_numbers = %.200r' % image_numbers) self.image_numbers = image_numbers debug('filenames = %.200r' % filenames) self.filenames = filenames self.xdet_trig_counts = {} ...
Rayonix MX series X-ray Detector
Rayonix_Detector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Rayonix_Detector: """Rayonix MX series X-ray Detector""" def acquire_images(self, image_numbers, filenames): """Save a series of images image_numbers: 0-based, matching timing system's 'image_number''""" <|body_0|> def cancel_acquisition(self): """Undo 'acquire_i...
stack_v2_sparse_classes_36k_train_004684
4,154
permissive
[ { "docstring": "Save a series of images image_numbers: 0-based, matching timing system's 'image_number''", "name": "acquire_images", "signature": "def acquire_images(self, image_numbers, filenames)" }, { "docstring": "Undo 'acquire_images', stop saving images", "name": "cancel_acquisition", ...
2
null
Implement the Python class `Rayonix_Detector` described below. Class description: Rayonix MX series X-ray Detector Method signatures and docstrings: - def acquire_images(self, image_numbers, filenames): Save a series of images image_numbers: 0-based, matching timing system's 'image_number'' - def cancel_acquisition(s...
Implement the Python class `Rayonix_Detector` described below. Class description: Rayonix MX series X-ray Detector Method signatures and docstrings: - def acquire_images(self, image_numbers, filenames): Save a series of images image_numbers: 0-based, matching timing system's 'image_number'' - def cancel_acquisition(s...
60ae2b05ea8596ba0decf426e37aeaca0bc8b6be
<|skeleton|> class Rayonix_Detector: """Rayonix MX series X-ray Detector""" def acquire_images(self, image_numbers, filenames): """Save a series of images image_numbers: 0-based, matching timing system's 'image_number''""" <|body_0|> def cancel_acquisition(self): """Undo 'acquire_i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Rayonix_Detector: """Rayonix MX series X-ray Detector""" def acquire_images(self, image_numbers, filenames): """Save a series of images image_numbers: 0-based, matching timing system's 'image_number''""" image_numbers = list(image_numbers) filenames = list(filenames) debug...
the_stack_v2_python_sparse
rayonix_detector_client.py
bopopescu/Lauecollect
train
0
4bdf84211d39ef691061a0bc57d411a9efb966cf
[ "self.measure_list = measure_list\nself.op_list = [item.operations for item in measure_list]\nself.operations = dict()\nself.operation_statistics()", "for item in self.op_list:\n for key in item:\n if key not in self.operations:\n self.operations[key] = item[key]\n else:\n s...
<|body_start_0|> self.measure_list = measure_list self.op_list = [item.operations for item in measure_list] self.operations = dict() self.operation_statistics() <|end_body_0|> <|body_start_1|> for item in self.op_list: for key in item: if key not in s...
MeasureList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MeasureList: def __init__(self, measure_list): """measure_list: a list of Measure Objects""" <|body_0|> def operation_statistics(self): """add up operations consumption of all layers""" <|body_1|> def get_operation_time(self): """return a string ...
stack_v2_sparse_classes_36k_train_004685
5,111
permissive
[ { "docstring": "measure_list: a list of Measure Objects", "name": "__init__", "signature": "def __init__(self, measure_list)" }, { "docstring": "add up operations consumption of all layers", "name": "operation_statistics", "signature": "def operation_statistics(self)" }, { "docst...
3
null
Implement the Python class `MeasureList` described below. Class description: Implement the MeasureList class. Method signatures and docstrings: - def __init__(self, measure_list): measure_list: a list of Measure Objects - def operation_statistics(self): add up operations consumption of all layers - def get_operation_...
Implement the Python class `MeasureList` described below. Class description: Implement the MeasureList class. Method signatures and docstrings: - def __init__(self, measure_list): measure_list: a list of Measure Objects - def operation_statistics(self): add up operations consumption of all layers - def get_operation_...
6c3031487cd1447b7f5362483c14b108177387bb
<|skeleton|> class MeasureList: def __init__(self, measure_list): """measure_list: a list of Measure Objects""" <|body_0|> def operation_statistics(self): """add up operations consumption of all layers""" <|body_1|> def get_operation_time(self): """return a string ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MeasureList: def __init__(self, measure_list): """measure_list: a list of Measure Objects""" self.measure_list = measure_list self.op_list = [item.operations for item in measure_list] self.operations = dict() self.operation_statistics() def operation_statistics(sel...
the_stack_v2_python_sparse
keras_wide_deep_98_table_15GB/output/analyze.py
WenqiJiang/FPGA-Accelerator-for-Recommender-Systems
train
6
3a08ce16bcdb2817884c9f6826303eb664586002
[ "assert hasattr(function, '__call__'), 'function should be a callable obj'\nself._function = function\nself._args = args\nself._kargs = kargs", "_args = list(self._args)\n_args.extend(args)\n_kargs = self._kargs.copy()\n_kargs.update(kargs)\nreturn self._function(*_args, **_kargs)" ]
<|body_start_0|> assert hasattr(function, '__call__'), 'function should be a callable obj' self._function = function self._args = args self._kargs = kargs <|end_body_0|> <|body_start_1|> _args = list(self._args) _args.extend(args) _kargs = self._kargs.copy() ...
A class that wraps a function to act like the function.
_Functor
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _Functor: """A class that wraps a function to act like the function.""" def __init__(self, function, *args, **kargs): """Constructor""" <|body_0|> def __call__(self, *args, **kargs): """Call function""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_004686
2,943
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, function, *args, **kargs)" }, { "docstring": "Call function", "name": "__call__", "signature": "def __call__(self, *args, **kargs)" } ]
2
stack_v2_sparse_classes_30k_train_000883
Implement the Python class `_Functor` described below. Class description: A class that wraps a function to act like the function. Method signatures and docstrings: - def __init__(self, function, *args, **kargs): Constructor - def __call__(self, *args, **kargs): Call function
Implement the Python class `_Functor` described below. Class description: A class that wraps a function to act like the function. Method signatures and docstrings: - def __init__(self, function, *args, **kargs): Constructor - def __call__(self, *args, **kargs): Call function <|skeleton|> class _Functor: """A cla...
d99406f2af1fb62268c34453a2fbe6bd4a7348f0
<|skeleton|> class _Functor: """A class that wraps a function to act like the function.""" def __init__(self, function, *args, **kargs): """Constructor""" <|body_0|> def __call__(self, *args, **kargs): """Call function""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _Functor: """A class that wraps a function to act like the function.""" def __init__(self, function, *args, **kargs): """Constructor""" assert hasattr(function, '__call__'), 'function should be a callable obj' self._function = function self._args = args self._kargs...
the_stack_v2_python_sparse
pyutilib/misc/factory.py
whart222/pyutilib
train
0
a10d4897ce68038a4836808819984bf6612c102a
[ "self.options = options\nself.django_class = locate(self.DJANGO_MODEL)\nself.django_instance_count = self.django_class.objects.count()\nself.logger = logging.getLogger(__name__)\nif self.options:\n self.options = Q(**self.options)\nelse:\n self.options = Q()\nif self.django_instance_count == 0:\n self.logg...
<|body_start_0|> self.options = options self.django_class = locate(self.DJANGO_MODEL) self.django_instance_count = self.django_class.objects.count() self.logger = logging.getLogger(__name__) if self.options: self.options = Q(**self.options) else: s...
The factory datatype denotes the type of data generated by this factory, which is used to ensure an associated mutator can effectively mutate data generated by this factory
DjangoModelFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DjangoModelFactory: """The factory datatype denotes the type of data generated by this factory, which is used to ensure an associated mutator can effectively mutate data generated by this factory""" def __init__(self, options: dict=None): """Creates a given name factory""" <|...
stack_v2_sparse_classes_36k_train_004687
3,085
no_license
[ { "docstring": "Creates a given name factory", "name": "__init__", "signature": "def __init__(self, options: dict=None)" }, { "docstring": "Create a dataframe with the specified number of rows, and the requested columns, if no columns are specified, default columns will be returned", "name":...
2
stack_v2_sparse_classes_30k_test_001047
Implement the Python class `DjangoModelFactory` described below. Class description: The factory datatype denotes the type of data generated by this factory, which is used to ensure an associated mutator can effectively mutate data generated by this factory Method signatures and docstrings: - def __init__(self, option...
Implement the Python class `DjangoModelFactory` described below. Class description: The factory datatype denotes the type of data generated by this factory, which is used to ensure an associated mutator can effectively mutate data generated by this factory Method signatures and docstrings: - def __init__(self, option...
5ea3e552d29a37556490f0a72c47b4280e8e5f5e
<|skeleton|> class DjangoModelFactory: """The factory datatype denotes the type of data generated by this factory, which is used to ensure an associated mutator can effectively mutate data generated by this factory""" def __init__(self, options: dict=None): """Creates a given name factory""" <|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DjangoModelFactory: """The factory datatype denotes the type of data generated by this factory, which is used to ensure an associated mutator can effectively mutate data generated by this factory""" def __init__(self, options: dict=None): """Creates a given name factory""" self.options = ...
the_stack_v2_python_sparse
synth_data/records/factory/django.py
afrasier/synth-data
train
0
85085b822c9b11af9aabeef824a0293cf484a0a6
[ "self.time_frame = time_frame\nself.max_requests = max_requests\nself.verbose = verbose\nself._requests = deque([])\nself._client, self._db = (None, None)\nself._mongo_coll, self._output_file = (None, None)\nself._connection_type = None", "try:\n self._client = MongoClient('mongodb://localhost:%i/' % port)\n ...
<|body_start_0|> self.time_frame = time_frame self.max_requests = max_requests self.verbose = verbose self._requests = deque([]) self._client, self._db = (None, None) self._mongo_coll, self._output_file = (None, None) self._connection_type = None <|end_body_0|> <...
RequestScheduler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequestScheduler: def __init__(self, time_frame, max_requests, verbose=False): """Abstract scheduler object. It enables only 'max_requests' requests in every 'time_frame' seconds.""" <|body_0|> def connect_to_mongodb(self, collection_name, port=27017, db_name='twitter-crawle...
stack_v2_sparse_classes_36k_train_004688
3,151
no_license
[ { "docstring": "Abstract scheduler object. It enables only 'max_requests' requests in every 'time_frame' seconds.", "name": "__init__", "signature": "def __init__(self, time_frame, max_requests, verbose=False)" }, { "docstring": "Connect to MongoDB collection", "name": "connect_to_mongodb", ...
6
stack_v2_sparse_classes_30k_train_000731
Implement the Python class `RequestScheduler` described below. Class description: Implement the RequestScheduler class. Method signatures and docstrings: - def __init__(self, time_frame, max_requests, verbose=False): Abstract scheduler object. It enables only 'max_requests' requests in every 'time_frame' seconds. - d...
Implement the Python class `RequestScheduler` described below. Class description: Implement the RequestScheduler class. Method signatures and docstrings: - def __init__(self, time_frame, max_requests, verbose=False): Abstract scheduler object. It enables only 'max_requests' requests in every 'time_frame' seconds. - d...
feb8cd0099c25b7fb36cb75498d1e205616f345d
<|skeleton|> class RequestScheduler: def __init__(self, time_frame, max_requests, verbose=False): """Abstract scheduler object. It enables only 'max_requests' requests in every 'time_frame' seconds.""" <|body_0|> def connect_to_mongodb(self, collection_name, port=27017, db_name='twitter-crawle...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RequestScheduler: def __init__(self, time_frame, max_requests, verbose=False): """Abstract scheduler object. It enables only 'max_requests' requests in every 'time_frame' seconds.""" self.time_frame = time_frame self.max_requests = max_requests self.verbose = verbose se...
the_stack_v2_python_sparse
python/request_scheduler.py
MolnarAnna22/twitter-crawler
train
0
0f34c3993f67268315b5f8e56f99b3df4d73f6af
[ "self._p1Box = Rectangle(320, 600, (175, 425))\nself._p1Box.setFillColor('#f5deb3')\nself._p1Box.setBorderWidth(4)\nself._p1LabelRec = Rectangle(290, 90, (175, 180))\nself._p1LabelRec.setFillColor('#ce3120')\nself._p1LabelRec.setBorderWidth(2)\nself._p1LabelText = Text('Player 1', (175, 192), 32)\nself._p1ScoreText...
<|body_start_0|> self._p1Box = Rectangle(320, 600, (175, 425)) self._p1Box.setFillColor('#f5deb3') self._p1Box.setBorderWidth(4) self._p1LabelRec = Rectangle(290, 90, (175, 180)) self._p1LabelRec.setFillColor('#ce3120') self._p1LabelRec.setBorderWidth(2) self._p1L...
creates side panels for two players on either side of the board
Panel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Panel: """creates side panels for two players on either side of the board""" def __init__(self, board): """contructs the panels on either side of the board for each player""" <|body_0|> def addTo(self, win): """adds both player's buttons and scores to the window"...
stack_v2_sparse_classes_36k_train_004689
34,907
no_license
[ { "docstring": "contructs the panels on either side of the board for each player", "name": "__init__", "signature": "def __init__(self, board)" }, { "docstring": "adds both player's buttons and scores to the window", "name": "addTo", "signature": "def addTo(self, win)" }, { "docs...
5
null
Implement the Python class `Panel` described below. Class description: creates side panels for two players on either side of the board Method signatures and docstrings: - def __init__(self, board): contructs the panels on either side of the board for each player - def addTo(self, win): adds both player's buttons and ...
Implement the Python class `Panel` described below. Class description: creates side panels for two players on either side of the board Method signatures and docstrings: - def __init__(self, board): contructs the panels on either side of the board for each player - def addTo(self, win): adds both player's buttons and ...
e5d96a65fc84481b85072cfb55dea9a0666634b5
<|skeleton|> class Panel: """creates side panels for two players on either side of the board""" def __init__(self, board): """contructs the panels on either side of the board for each player""" <|body_0|> def addTo(self, win): """adds both player's buttons and scores to the window"...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Panel: """creates side panels for two players on either side of the board""" def __init__(self, board): """contructs the panels on either side of the board for each player""" self._p1Box = Rectangle(320, 600, (175, 425)) self._p1Box.setFillColor('#f5deb3') self._p1Box.setB...
the_stack_v2_python_sparse
Games-2017/32/Game.py
paulmagnus/CSPy
train
0
a543ae22cfc04b8b841915f98a627fcc4d2636f5
[ "super().__init__()\nself.reasoning_module = reasoning_module\nself.question_module = question_module\nself.scene_graph_module = scene_graph_module\nself.question_embeddings = question_embeddings\nself.scene_graph_embeddings = scene_graph_embeddings", "if self.scene_graph_embeddings is not None:\n assert len(s...
<|body_start_0|> super().__init__() self.reasoning_module = reasoning_module self.question_module = question_module self.scene_graph_module = scene_graph_module self.question_embeddings = question_embeddings self.scene_graph_embeddings = scene_graph_embeddings <|end_body_...
Network that uses multiple GCN/BiLSTM inputs for its question and knowledge-base representations, and a reasoning module for predictions.
VQA
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VQA: """Network that uses multiple GCN/BiLSTM inputs for its question and knowledge-base representations, and a reasoning module for predictions.""" def __init__(self, reasoning_module: AbstractReasoningModule, question_module: AbstractQuestionModule, scene_graph_module: AbstractSceneGraphMo...
stack_v2_sparse_classes_36k_train_004690
2,730
no_license
[ { "docstring": "Create a `VQA` model.", "name": "__init__", "signature": "def __init__(self, reasoning_module: AbstractReasoningModule, question_module: AbstractQuestionModule, scene_graph_module: AbstractSceneGraphModule, question_embeddings: Optional[torch.nn.Embedding]=None, scene_graph_embeddings: O...
2
null
Implement the Python class `VQA` described below. Class description: Network that uses multiple GCN/BiLSTM inputs for its question and knowledge-base representations, and a reasoning module for predictions. Method signatures and docstrings: - def __init__(self, reasoning_module: AbstractReasoningModule, question_modu...
Implement the Python class `VQA` described below. Class description: Network that uses multiple GCN/BiLSTM inputs for its question and knowledge-base representations, and a reasoning module for predictions. Method signatures and docstrings: - def __init__(self, reasoning_module: AbstractReasoningModule, question_modu...
78c479f8d0b3209ece9f9ccbbf63810802293f61
<|skeleton|> class VQA: """Network that uses multiple GCN/BiLSTM inputs for its question and knowledge-base representations, and a reasoning module for predictions.""" def __init__(self, reasoning_module: AbstractReasoningModule, question_module: AbstractQuestionModule, scene_graph_module: AbstractSceneGraphMo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VQA: """Network that uses multiple GCN/BiLSTM inputs for its question and knowledge-base representations, and a reasoning module for predictions.""" def __init__(self, reasoning_module: AbstractReasoningModule, question_module: AbstractQuestionModule, scene_graph_module: AbstractSceneGraphModule, questio...
the_stack_v2_python_sparse
gat_vqa/modules/vqa.py
alexmirrington/gat-vqa
train
4
c762a5a20d89ef6ab11fe292d2a37ae12ede3ca4
[ "self._hass = hass\nself._store = Store[dict[str, dict[str, bool | Orientation]]](hass, STORAGE_VERSION, STORAGE_KEY)\nself._dynamic_stream_settings_by_entity_id: dict[str, DynamicStreamSettings] = {}", "dynamic_stream_settings = self._dynamic_stream_settings_by_entity_id.get(entity_id)\nif preload_stream is not ...
<|body_start_0|> self._hass = hass self._store = Store[dict[str, dict[str, bool | Orientation]]](hass, STORAGE_VERSION, STORAGE_KEY) self._dynamic_stream_settings_by_entity_id: dict[str, DynamicStreamSettings] = {} <|end_body_0|> <|body_start_1|> dynamic_stream_settings = self._dynamic_...
Handle camera preferences.
CameraPreferences
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CameraPreferences: """Handle camera preferences.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize camera prefs.""" <|body_0|> async def async_update(self, entity_id: str, *, preload_stream: bool | UndefinedType=UNDEFINED, orientation: Orientation | Undef...
stack_v2_sparse_classes_36k_train_004691
4,020
permissive
[ { "docstring": "Initialize camera prefs.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant) -> None" }, { "docstring": "Update camera preferences. Also update the DynamicStreamSettings if they exist. preload_stream is stored in a Store orientation is stored in the Entity...
3
null
Implement the Python class `CameraPreferences` described below. Class description: Handle camera preferences. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant) -> None: Initialize camera prefs. - async def async_update(self, entity_id: str, *, preload_stream: bool | UndefinedType=UNDEFINED, ...
Implement the Python class `CameraPreferences` described below. Class description: Handle camera preferences. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant) -> None: Initialize camera prefs. - async def async_update(self, entity_id: str, *, preload_stream: bool | UndefinedType=UNDEFINED, ...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class CameraPreferences: """Handle camera preferences.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize camera prefs.""" <|body_0|> async def async_update(self, entity_id: str, *, preload_stream: bool | UndefinedType=UNDEFINED, orientation: Orientation | Undef...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CameraPreferences: """Handle camera preferences.""" def __init__(self, hass: HomeAssistant) -> None: """Initialize camera prefs.""" self._hass = hass self._store = Store[dict[str, dict[str, bool | Orientation]]](hass, STORAGE_VERSION, STORAGE_KEY) self._dynamic_stream_sett...
the_stack_v2_python_sparse
homeassistant/components/camera/prefs.py
home-assistant/core
train
35,501
1d88b43fff2ba6fbcc7aea4487bec281b30f0328
[ "self.use_cuda = use_cuda\nif self.use_cuda is True and cuda_installed is False:\n self.use_cuda = False\n print('** Cuda not available for Fourier transform.')\n print('** Performing the Fourier transform on the CPU.')\nself.use_mkl = mkl_installed\nif self.use_cuda:\n copy_tpb = (8, 32) if cuda_gpu_mo...
<|body_start_0|> self.use_cuda = use_cuda if self.use_cuda is True and cuda_installed is False: self.use_cuda = False print('** Cuda not available for Fourier transform.') print('** Performing the Fourier transform on the CPU.') self.use_mkl = mkl_installed ...
Object that performs Fourier transform of 2D arrays along the z axis, (axis 0) either on the CPU (using pyfftw) or on the GPU (using cufft) See the methods `transform` and `inverse transform` for more information
FFT
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FFT: """Object that performs Fourier transform of 2D arrays along the z axis, (axis 0) either on the CPU (using pyfftw) or on the GPU (using cufft) See the methods `transform` and `inverse transform` for more information""" def __init__(self, Nr, Nz, use_cuda=False, nthreads=None): "...
stack_v2_sparse_classes_36k_train_004692
6,780
permissive
[ { "docstring": "Initialize an FFT object Parameters ---------- Nr: int Number of grid points along the r axis (axis -1) Nz: int Number of grid points along the z axis (axis 0) use_cuda: bool, optional Whether to perform the Fourier transform on the z axis nthreads : int, optional Number of threads for the FFTW ...
3
null
Implement the Python class `FFT` described below. Class description: Object that performs Fourier transform of 2D arrays along the z axis, (axis 0) either on the CPU (using pyfftw) or on the GPU (using cufft) See the methods `transform` and `inverse transform` for more information Method signatures and docstrings: - ...
Implement the Python class `FFT` described below. Class description: Object that performs Fourier transform of 2D arrays along the z axis, (axis 0) either on the CPU (using pyfftw) or on the GPU (using cufft) See the methods `transform` and `inverse transform` for more information Method signatures and docstrings: - ...
5744598571eab40c4fb45cc3db21f346b69b1f37
<|skeleton|> class FFT: """Object that performs Fourier transform of 2D arrays along the z axis, (axis 0) either on the CPU (using pyfftw) or on the GPU (using cufft) See the methods `transform` and `inverse transform` for more information""" def __init__(self, Nr, Nz, use_cuda=False, nthreads=None): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FFT: """Object that performs Fourier transform of 2D arrays along the z axis, (axis 0) either on the CPU (using pyfftw) or on the GPU (using cufft) See the methods `transform` and `inverse transform` for more information""" def __init__(self, Nr, Nz, use_cuda=False, nthreads=None): """Initialize ...
the_stack_v2_python_sparse
fbpic/fields/spectral_transform/fourier.py
fbpic/fbpic
train
163
a5a642817da1c334a050a930b50d8b8d067952e5
[ "size = len(prices)\nif size == 0:\n return 0\nminValue = prices[0]\nascMax = [0] * size\ndesMax = [0] * (size + 1)\nfor i in range(len(prices)):\n minValue = min(minValue, prices[i])\n ascMax[i] = max(ascMax[i - 1], prices[i] - minValue)\nj = size - 1\nmaxValue = prices[size - 1]\nwhile j >= 0:\n maxVa...
<|body_start_0|> size = len(prices) if size == 0: return 0 minValue = prices[0] ascMax = [0] * size desMax = [0] * (size + 1) for i in range(len(prices)): minValue = min(minValue, prices[i]) ascMax[i] = max(ascMax[i - 1], prices[i] - mi...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit2(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> size = len(prices) if size == 0:...
stack_v2_sparse_classes_36k_train_004693
1,745
no_license
[ { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit", "signature": "def maxProfit(self, prices)" }, { "docstring": ":type prices: List[int] :rtype: int", "name": "maxProfit2", "signature": "def maxProfit2(self, prices)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit2(self, prices): :type prices: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices): :type prices: List[int] :rtype: int - def maxProfit2(self, prices): :type prices: List[int] :rtype: int <|skeleton|> class Solution: def maxPro...
85ceaf8f3da0efd66b4394ef16669ea673218265
<|skeleton|> class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" <|body_0|> def maxProfit2(self, prices): """:type prices: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices): """:type prices: List[int] :rtype: int""" size = len(prices) if size == 0: return 0 minValue = prices[0] ascMax = [0] * size desMax = [0] * (size + 1) for i in range(len(prices)): minValue = ...
the_stack_v2_python_sparse
LeetCode/动态规划/123. 买卖股票的最佳时机3.py
alexkie007/offer
train
2
3db5f3a2e2e3b286072b45c00847e839e99886c9
[ "try:\n if 'key' in request.query_params:\n key = request.query_params['key']\n else:\n key = None\n request_args = {'service': 'meta', 'collection_name': collection, 'experiment_name': experiment, 'channel_name': channel, 'key': key}\n req = BossRequest(request, request_args)\n lookup_...
<|body_start_0|> try: if 'key' in request.query_params: key = request.query_params['key'] else: key = None request_args = {'service': 'meta', 'collection_name': collection, 'experiment_name': experiment, 'channel_name': channel, 'key': key} ...
View to handle read,write,update and delete metadata queries
BossMeta
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BossMeta: """View to handle read,write,update and delete metadata queries""" def get(self, request, collection, experiment=None, channel=None): """View to handle GET requests for metadata Args: request: DRF Request object collection: Collection Name experiment: Experiment name. defau...
stack_v2_sparse_classes_36k_train_004694
8,196
permissive
[ { "docstring": "View to handle GET requests for metadata Args: request: DRF Request object collection: Collection Name experiment: Experiment name. default = None channel: Channel name Returns:", "name": "get", "signature": "def get(self, request, collection, experiment=None, channel=None)" }, { ...
4
stack_v2_sparse_classes_30k_train_002367
Implement the Python class `BossMeta` described below. Class description: View to handle read,write,update and delete metadata queries Method signatures and docstrings: - def get(self, request, collection, experiment=None, channel=None): View to handle GET requests for metadata Args: request: DRF Request object colle...
Implement the Python class `BossMeta` described below. Class description: View to handle read,write,update and delete metadata queries Method signatures and docstrings: - def get(self, request, collection, experiment=None, channel=None): View to handle GET requests for metadata Args: request: DRF Request object colle...
c2e26d272bd7b8d54abdc2948193163537e31291
<|skeleton|> class BossMeta: """View to handle read,write,update and delete metadata queries""" def get(self, request, collection, experiment=None, channel=None): """View to handle GET requests for metadata Args: request: DRF Request object collection: Collection Name experiment: Experiment name. defau...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BossMeta: """View to handle read,write,update and delete metadata queries""" def get(self, request, collection, experiment=None, channel=None): """View to handle GET requests for metadata Args: request: DRF Request object collection: Collection Name experiment: Experiment name. default = None cha...
the_stack_v2_python_sparse
django/bossmeta/views.py
jhuapl-boss/boss
train
20
eff2b63b5159fd291bdb55b07e69b3c1de36e96f
[ "self.CapsuleGuid = self.EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID\nself.HeaderSize = self._StructSize\nself.OemFlags = 0\nself.PersistAcrossReset = False\nself.PopulateSystemTable = False\nself.InitiateReset = False\nself.CapsuleImageSize = self.HeaderSize\nself.Payload = b''\nself.FmpCapsuleHeader = None", "Flags...
<|body_start_0|> self.CapsuleGuid = self.EFI_FIRMWARE_MANAGEMENT_CAPSULE_ID_GUID self.HeaderSize = self._StructSize self.OemFlags = 0 self.PersistAcrossReset = False self.PopulateSystemTable = False self.InitiateReset = False self.CapsuleImageSize = self.HeaderSiz...
An object representing a UEFI_CAPSULE_HEADER. Attributes: CapsuleGuid (uuid.UUID): 6DCBD5ED-E82D-4C44-BDA1-7194199AD92A HeaderSize (int): The size of the capsule header. This may be larger than the size of the EFI_CAPSULE_HEADER since CapsuleGuid may imply extended header entries OemFlags (int): Bit-mapped list describ...
UefiCapsuleHeaderClass
[ "BSD-2-Clause-Patent" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UefiCapsuleHeaderClass: """An object representing a UEFI_CAPSULE_HEADER. Attributes: CapsuleGuid (uuid.UUID): 6DCBD5ED-E82D-4C44-BDA1-7194199AD92A HeaderSize (int): The size of the capsule header. This may be larger than the size of the EFI_CAPSULE_HEADER since CapsuleGuid may imply extended head...
stack_v2_sparse_classes_36k_train_004695
6,514
permissive
[ { "docstring": "Inits an empty object.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Serializes the Header + payload. Returns: (str): string representing packed data as bytes (i.e. b'\\\\x01\\\\x00\\\\x03')", "name": "Encode", "signature": "def Encode(self)" ...
4
stack_v2_sparse_classes_30k_train_008138
Implement the Python class `UefiCapsuleHeaderClass` described below. Class description: An object representing a UEFI_CAPSULE_HEADER. Attributes: CapsuleGuid (uuid.UUID): 6DCBD5ED-E82D-4C44-BDA1-7194199AD92A HeaderSize (int): The size of the capsule header. This may be larger than the size of the EFI_CAPSULE_HEADER si...
Implement the Python class `UefiCapsuleHeaderClass` described below. Class description: An object representing a UEFI_CAPSULE_HEADER. Attributes: CapsuleGuid (uuid.UUID): 6DCBD5ED-E82D-4C44-BDA1-7194199AD92A HeaderSize (int): The size of the capsule header. This may be larger than the size of the EFI_CAPSULE_HEADER si...
78295929b37af62a8cfc4c28eab72ed0c468f350
<|skeleton|> class UefiCapsuleHeaderClass: """An object representing a UEFI_CAPSULE_HEADER. Attributes: CapsuleGuid (uuid.UUID): 6DCBD5ED-E82D-4C44-BDA1-7194199AD92A HeaderSize (int): The size of the capsule header. This may be larger than the size of the EFI_CAPSULE_HEADER since CapsuleGuid may imply extended head...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UefiCapsuleHeaderClass: """An object representing a UEFI_CAPSULE_HEADER. Attributes: CapsuleGuid (uuid.UUID): 6DCBD5ED-E82D-4C44-BDA1-7194199AD92A HeaderSize (int): The size of the capsule header. This may be larger than the size of the EFI_CAPSULE_HEADER since CapsuleGuid may imply extended header entries Oe...
the_stack_v2_python_sparse
edk2toollib/uefi/uefi_capsule_header.py
tianocore/edk2-pytool-library
train
47
8a249e999e24661c6cb7cf3e4afee3e3287e2896
[ "string = self.x.get_string()\nlines = string.split('\\n')\nself.assert_('' not in lines)", "string = self.x.get_string()\nlines = string.split('\\n')\nlengths = [len(line) for line in lines]\nlengths = set(lengths)\nself.assertEqual(len(lengths), 1)" ]
<|body_start_0|> string = self.x.get_string() lines = string.split('\n') self.assert_('' not in lines) <|end_body_0|> <|body_start_1|> string = self.x.get_string() lines = string.split('\n') lengths = [len(line) for line in lines] lengths = set(lengths) s...
Some very basic tests.
BasicTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicTests: """Some very basic tests.""" def testNoBlankLines(self): """No table should ever have blank lines in it.""" <|body_0|> def testAllLengthsEqual(self): """All lines in a table should be of the same length.""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_004696
9,697
no_license
[ { "docstring": "No table should ever have blank lines in it.", "name": "testNoBlankLines", "signature": "def testNoBlankLines(self)" }, { "docstring": "All lines in a table should be of the same length.", "name": "testAllLengthsEqual", "signature": "def testAllLengthsEqual(self)" } ]
2
null
Implement the Python class `BasicTests` described below. Class description: Some very basic tests. Method signatures and docstrings: - def testNoBlankLines(self): No table should ever have blank lines in it. - def testAllLengthsEqual(self): All lines in a table should be of the same length.
Implement the Python class `BasicTests` described below. Class description: Some very basic tests. Method signatures and docstrings: - def testNoBlankLines(self): No table should ever have blank lines in it. - def testAllLengthsEqual(self): All lines in a table should be of the same length. <|skeleton|> class BasicT...
235fd68d62923dfe514db182e1c4ccf7a72af5f5
<|skeleton|> class BasicTests: """Some very basic tests.""" def testNoBlankLines(self): """No table should ever have blank lines in it.""" <|body_0|> def testAllLengthsEqual(self): """All lines in a table should be of the same length.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicTests: """Some very basic tests.""" def testNoBlankLines(self): """No table should ever have blank lines in it.""" string = self.x.get_string() lines = string.split('\n') self.assert_('' not in lines) def testAllLengthsEqual(self): """All lines in a table...
the_stack_v2_python_sparse
src/sandbox/prettytable_test.py
JoaoGRRodrigues/rodd
train
0
56d67561858ea517483ad47f76c4b85a1913e0ba
[ "ctx = super().get_panel_context(view, request, context)\nif isinstance(view, StockLocationDetail):\n ctx['location'] = view.get_object()\nreturn ctx", "panels = [{'title': 'No Content'}]\nif self.get_setting('ENABLE_HELLO_WORLD'):\n content = \"\\n <strong>Hello world!</strong>\\n <hr...
<|body_start_0|> ctx = super().get_panel_context(view, request, context) if isinstance(view, StockLocationDetail): ctx['location'] = view.get_object() return ctx <|end_body_0|> <|body_start_1|> panels = [{'title': 'No Content'}] if self.get_setting('ENABLE_HELLO_WORL...
A sample plugin which renders some custom panels.
CustomPanelSample
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomPanelSample: """A sample plugin which renders some custom panels.""" def get_panel_context(self, view, request, context): """Returns enriched context.""" <|body_0|> def get_custom_panels(self, view, request): """You can decide at run-time which custom panel...
stack_v2_sparse_classes_36k_train_004697
4,420
permissive
[ { "docstring": "Returns enriched context.", "name": "get_panel_context", "signature": "def get_panel_context(self, view, request, context)" }, { "docstring": "You can decide at run-time which custom panels you want to display! - Display on every page - Only on a single page or set of pages - Onl...
2
stack_v2_sparse_classes_30k_train_015379
Implement the Python class `CustomPanelSample` described below. Class description: A sample plugin which renders some custom panels. Method signatures and docstrings: - def get_panel_context(self, view, request, context): Returns enriched context. - def get_custom_panels(self, view, request): You can decide at run-ti...
Implement the Python class `CustomPanelSample` described below. Class description: A sample plugin which renders some custom panels. Method signatures and docstrings: - def get_panel_context(self, view, request, context): Returns enriched context. - def get_custom_panels(self, view, request): You can decide at run-ti...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class CustomPanelSample: """A sample plugin which renders some custom panels.""" def get_panel_context(self, view, request, context): """Returns enriched context.""" <|body_0|> def get_custom_panels(self, view, request): """You can decide at run-time which custom panel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomPanelSample: """A sample plugin which renders some custom panels.""" def get_panel_context(self, view, request, context): """Returns enriched context.""" ctx = super().get_panel_context(view, request, context) if isinstance(view, StockLocationDetail): ctx['locati...
the_stack_v2_python_sparse
InvenTree/plugin/samples/integration/custom_panel_sample.py
inventree/InvenTree
train
3,077
05dedf60dd6d1d428eedfa1742cd3e3231549605
[ "config_value = ConfigValue.query.filter_by(key=key).first()\nif config_value is None:\n environ[key] = value\n config_value = ConfigValue(key=key, value=value)\n db.session.add(config_value)\n db.session.commit()\nelse:\n self.update(key=key, value=value)", "environ[key] = value\nconfig_value = Co...
<|body_start_0|> config_value = ConfigValue.query.filter_by(key=key).first() if config_value is None: environ[key] = value config_value = ConfigValue(key=key, value=value) db.session.add(config_value) db.session.commit() else: self.upda...
CRUD persistent storage service. A class with the single responsibility of creating/mutating ConfigValue data.
ConfigValueService
[ "Apache-2.0", "LGPL-3.0-only", "MIT", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConfigValueService: """CRUD persistent storage service. A class with the single responsibility of creating/mutating ConfigValue data.""" def create(self, key, value): """Creates and persists a new config_value record to the database. Args: key (str): The key to lookup. value (str): T...
stack_v2_sparse_classes_36k_train_004698
1,698
permissive
[ { "docstring": "Creates and persists a new config_value record to the database. Args: key (str): The key to lookup. value (str): The value. Returns: None", "name": "create", "signature": "def create(self, key, value)" }, { "docstring": "Updates a persisted config_value. Args: Returns: None", ...
3
null
Implement the Python class `ConfigValueService` described below. Class description: CRUD persistent storage service. A class with the single responsibility of creating/mutating ConfigValue data. Method signatures and docstrings: - def create(self, key, value): Creates and persists a new config_value record to the dat...
Implement the Python class `ConfigValueService` described below. Class description: CRUD persistent storage service. A class with the single responsibility of creating/mutating ConfigValue data. Method signatures and docstrings: - def create(self, key, value): Creates and persists a new config_value record to the dat...
f39d8a5f00fccccdbbcbad7f7ff039c74dfe66ae
<|skeleton|> class ConfigValueService: """CRUD persistent storage service. A class with the single responsibility of creating/mutating ConfigValue data.""" def create(self, key, value): """Creates and persists a new config_value record to the database. Args: key (str): The key to lookup. value (str): T...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConfigValueService: """CRUD persistent storage service. A class with the single responsibility of creating/mutating ConfigValue data.""" def create(self, key, value): """Creates and persists a new config_value record to the database. Args: key (str): The key to lookup. value (str): The value. Ret...
the_stack_v2_python_sparse
app/services/config_value_service.py
DataDog/gello
train
50
770bdc7713c18ba7facb64c1a33f4ede383fbb01
[ "super(AdditionalFeatureMapGenerator, self).__init__()\ndepth_fn = get_depth_fn(depth_multiplier, min_depth)\nself.channels = depth_fn(layer_depth)\nself.insert_1x1_conv = insert_1x1_conv\nself.use_explicit_padding = use_explicit_padding\nself.use_depthwise = use_depthwise\nself.pre_channels = pre_channels\ninterme...
<|body_start_0|> super(AdditionalFeatureMapGenerator, self).__init__() depth_fn = get_depth_fn(depth_multiplier, min_depth) self.channels = depth_fn(layer_depth) self.insert_1x1_conv = insert_1x1_conv self.use_explicit_padding = use_explicit_padding self.use_depthwise = u...
Generate feature layers outside the backbone network
AdditionalFeatureMapGenerator
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdditionalFeatureMapGenerator: """Generate feature layers outside the backbone network""" def __init__(self, insert_1x1_conv, use_explicit_padding, use_depthwise, pool_residual, pre_channels, layer_depth, depth_multiplier, min_depth, conv_kernel_size): """Create operation cell sequen...
stack_v2_sparse_classes_36k_train_004699
10,243
permissive
[ { "docstring": "Create operation cell sequence when `from_layer` is an empty str. Args: insert_1x1_conv (bool): use_explicit_padding (bool): use_depthwise (bool): pool_residual (bool): pre_channels (int): Depth of the previous feature map in feature map list. layer_depth (int): Layer depth in `feature_map_layou...
2
null
Implement the Python class `AdditionalFeatureMapGenerator` described below. Class description: Generate feature layers outside the backbone network Method signatures and docstrings: - def __init__(self, insert_1x1_conv, use_explicit_padding, use_depthwise, pool_residual, pre_channels, layer_depth, depth_multiplier, m...
Implement the Python class `AdditionalFeatureMapGenerator` described below. Class description: Generate feature layers outside the backbone network Method signatures and docstrings: - def __init__(self, insert_1x1_conv, use_explicit_padding, use_depthwise, pool_residual, pre_channels, layer_depth, depth_multiplier, m...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class AdditionalFeatureMapGenerator: """Generate feature layers outside the backbone network""" def __init__(self, insert_1x1_conv, use_explicit_padding, use_depthwise, pool_residual, pre_channels, layer_depth, depth_multiplier, min_depth, conv_kernel_size): """Create operation cell sequen...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdditionalFeatureMapGenerator: """Generate feature layers outside the backbone network""" def __init__(self, insert_1x1_conv, use_explicit_padding, use_depthwise, pool_residual, pre_channels, layer_depth, depth_multiplier, min_depth, conv_kernel_size): """Create operation cell sequence when `from...
the_stack_v2_python_sparse
research/cv/ssd_inception_v2/src/feature_map_generators.py
mindspore-ai/models
train
301