blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
378
8.64k
id
stringlengths
44
44
length_bytes
int64
505
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.88k
prompted_full_text
stringlengths
565
12.5k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
5.05k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
snapshot_total_rows
int64
75.8k
75.8k
solution
stringlengths
242
8.3k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
8a4f5bb25a9edc24126441051bf20284cad1c989
[ "column_def = {'model': ['year', 'doy', 'seconds', 'system', 'satellite', 'obs_type', 'flight_time', 'measurement', 'calculate', 'sat_pos_x', 'sat_pos_y', 'sat_pos_z', 'sat_vel_x', 'sat_vel_y', 'sat_vel_z', 'gnss_range', 'gnss_satellite_clock', 'gnss_satellite_phase_center_offset', 'gnss_receiver_phase_center', 'gn...
<|body_start_0|> column_def = {'model': ['year', 'doy', 'seconds', 'system', 'satellite', 'obs_type', 'flight_time', 'measurement', 'calculate', 'sat_pos_x', 'sat_pos_y', 'sat_pos_z', 'sat_vel_x', 'sat_vel_y', 'sat_vel_z', 'gnss_range', 'gnss_satellite_clock', 'gnss_satellite_phase_center_offset', 'gnss_receive...
A parser for reading gLAB output files The keys of the **data** dictionary are defined depending, which kind of gLAB output file is read. The values of the **data** dictionary are represented by the gLAB colum values. Following **meta**-data are available after reading of gLAB files: | Key | Description | |------------...
GlabOutputParser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GlabOutputParser: """A parser for reading gLAB output files The keys of the **data** dictionary are defined depending, which kind of gLAB output file is read. The values of the **data** dictionary are represented by the gLAB colum values. Following **meta**-data are available after reading of gLA...
stack_v2_sparse_classes_75kplus_train_071200
7,684
permissive
[ { "docstring": "Read data from the data file Uses the pd.read_csv-function to parse the file.", "name": "read_data", "signature": "def read_data(self) -> None" }, { "docstring": "Return the parsed data as a Dataset Returns: A dataset containing the data.", "name": "as_dataset", "signatur...
2
stack_v2_sparse_classes_30k_train_032728
Implement the Python class `GlabOutputParser` described below. Class description: A parser for reading gLAB output files The keys of the **data** dictionary are defined depending, which kind of gLAB output file is read. The values of the **data** dictionary are represented by the gLAB colum values. Following **meta**-...
Implement the Python class `GlabOutputParser` described below. Class description: A parser for reading gLAB output files The keys of the **data** dictionary are defined depending, which kind of gLAB output file is read. The values of the **data** dictionary are represented by the gLAB colum values. Following **meta**-...
31939afee943273b23fa0a5ef193cfecfa68d6c0
<|skeleton|> class GlabOutputParser: """A parser for reading gLAB output files The keys of the **data** dictionary are defined depending, which kind of gLAB output file is read. The values of the **data** dictionary are represented by the gLAB colum values. Following **meta**-data are available after reading of gLA...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GlabOutputParser: """A parser for reading gLAB output files The keys of the **data** dictionary are defined depending, which kind of gLAB output file is read. The values of the **data** dictionary are represented by the gLAB colum values. Following **meta**-data are available after reading of gLAB files: | Ke...
the_stack_v2_python_sparse
midgard/parsers/glab_output.py
kartverket/midgard
train
18
da91c20229048368b6bcfa5738795fe347fb931d
[ "self.rympro = rympro\ninterval = timedelta(seconds=SCAN_INTERVAL)\nsuper().__init__(hass, _LOGGER, name=DOMAIN, update_interval=interval)", "try:\n return await self.rympro.last_read()\nexcept UnauthorizedError as error:\n assert self.config_entry\n await self.hass.config_entries.async_reload(self.confi...
<|body_start_0|> self.rympro = rympro interval = timedelta(seconds=SCAN_INTERVAL) super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=interval) <|end_body_0|> <|body_start_1|> try: return await self.rympro.last_read() except UnauthorizedError as error: ...
Class to manage fetching RYM Pro data.
RymProDataUpdateCoordinator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RymProDataUpdateCoordinator: """Class to manage fetching RYM Pro data.""" def __init__(self, hass: HomeAssistant, rympro: RymPro) -> None: """Initialize global RymPro data updater.""" <|body_0|> async def _async_update_data(self) -> dict[int, dict]: """Fetch data...
stack_v2_sparse_classes_75kplus_train_071201
1,388
permissive
[ { "docstring": "Initialize global RymPro data updater.", "name": "__init__", "signature": "def __init__(self, hass: HomeAssistant, rympro: RymPro) -> None" }, { "docstring": "Fetch data from Rym Pro.", "name": "_async_update_data", "signature": "async def _async_update_data(self) -> dict...
2
stack_v2_sparse_classes_30k_train_026577
Implement the Python class `RymProDataUpdateCoordinator` described below. Class description: Class to manage fetching RYM Pro data. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, rympro: RymPro) -> None: Initialize global RymPro data updater. - async def _async_update_data(self) -> dict[i...
Implement the Python class `RymProDataUpdateCoordinator` described below. Class description: Class to manage fetching RYM Pro data. Method signatures and docstrings: - def __init__(self, hass: HomeAssistant, rympro: RymPro) -> None: Initialize global RymPro data updater. - async def _async_update_data(self) -> dict[i...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class RymProDataUpdateCoordinator: """Class to manage fetching RYM Pro data.""" def __init__(self, hass: HomeAssistant, rympro: RymPro) -> None: """Initialize global RymPro data updater.""" <|body_0|> async def _async_update_data(self) -> dict[int, dict]: """Fetch data...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RymProDataUpdateCoordinator: """Class to manage fetching RYM Pro data.""" def __init__(self, hass: HomeAssistant, rympro: RymPro) -> None: """Initialize global RymPro data updater.""" self.rympro = rympro interval = timedelta(seconds=SCAN_INTERVAL) super().__init__(hass, _...
the_stack_v2_python_sparse
homeassistant/components/rympro/coordinator.py
home-assistant/core
train
35,501
e5052b3e8de9ce4477920d5e426c0fa347c0468f
[ "self.config = config\nself.model = VBCAR(config['model'])\nuser_fea = torch.tensor(config['user_fea'], requires_grad=False, device=config['model']['device_str'], dtype=torch.float32)\nitem_fea = torch.tensor(config['item_fea'], requires_grad=False, device=config['model']['device_str'], dtype=torch.float32)\nself.m...
<|body_start_0|> self.config = config self.model = VBCAR(config['model']) user_fea = torch.tensor(config['user_fea'], requires_grad=False, device=config['model']['device_str'], dtype=torch.float32) item_fea = torch.tensor(config['item_fea'], requires_grad=False, device=config['model']['d...
Engine for training & evaluating GMF model.
VBCAREngine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VBCAREngine: """Engine for training & evaluating GMF model.""" def __init__(self, config): """Initialize VBCAREngine Class.""" <|body_0|> def train_single_batch(self, batch_data, ratings=None): """Train the model in a single batch.""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus_train_071202
11,137
permissive
[ { "docstring": "Initialize VBCAREngine Class.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "Train the model in a single batch.", "name": "train_single_batch", "signature": "def train_single_batch(self, batch_data, ratings=None)" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_030042
Implement the Python class `VBCAREngine` described below. Class description: Engine for training & evaluating GMF model. Method signatures and docstrings: - def __init__(self, config): Initialize VBCAREngine Class. - def train_single_batch(self, batch_data, ratings=None): Train the model in a single batch. - def trai...
Implement the Python class `VBCAREngine` described below. Class description: Engine for training & evaluating GMF model. Method signatures and docstrings: - def __init__(self, config): Initialize VBCAREngine Class. - def train_single_batch(self, batch_data, ratings=None): Train the model in a single batch. - def trai...
625189d5e1002a3edc27c3e3ce075fddf7ae1c92
<|skeleton|> class VBCAREngine: """Engine for training & evaluating GMF model.""" def __init__(self, config): """Initialize VBCAREngine Class.""" <|body_0|> def train_single_batch(self, batch_data, ratings=None): """Train the model in a single batch.""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VBCAREngine: """Engine for training & evaluating GMF model.""" def __init__(self, config): """Initialize VBCAREngine Class.""" self.config = config self.model = VBCAR(config['model']) user_fea = torch.tensor(config['user_fea'], requires_grad=False, device=config['model']['...
the_stack_v2_python_sparse
beta_rec/models/vbcar.py
beta-team/beta-recsys
train
156
c968379d754739e0981ee6c185172a74a4b77b7c
[ "super(SimpleLSTM, self).__init__()\nself.params = locals()\nself.embed = nn.Embedding(*vocab.shape)\nself.embed.weight.data.copy_(vocab)\nself.embedding_dim = vocab.shape[1]\nself.hidden_dim = hidden_dim\nself.output_dim = output_dim\nself.lstm = nn.LSTM(self.embedding_dim, hidden_dim, batch_first=True)\nself.fc_o...
<|body_start_0|> super(SimpleLSTM, self).__init__() self.params = locals() self.embed = nn.Embedding(*vocab.shape) self.embed.weight.data.copy_(vocab) self.embedding_dim = vocab.shape[1] self.hidden_dim = hidden_dim self.output_dim = output_dim self.lstm =...
SimpleLSTM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleLSTM: def __init__(self, vocab, hidden_dim: int, output_dim: int, dropout: float=0.3, device=torch.device('cpu'), use_lengths=True, use_bert_embeds: bool=False): """:param vocab: a vector containing the word embeddings of the word in the train set :param hidden_dim: int specifying ...
stack_v2_sparse_classes_75kplus_train_071203
2,695
no_license
[ { "docstring": ":param vocab: a vector containing the word embeddings of the word in the train set :param hidden_dim: int specifying number of hidden units in LSTM :param output_dim: int specifying the number of output units :param dropout: float specifying the dropout ratio :param device: torch.device specifyi...
2
null
Implement the Python class `SimpleLSTM` described below. Class description: Implement the SimpleLSTM class. Method signatures and docstrings: - def __init__(self, vocab, hidden_dim: int, output_dim: int, dropout: float=0.3, device=torch.device('cpu'), use_lengths=True, use_bert_embeds: bool=False): :param vocab: a ve...
Implement the Python class `SimpleLSTM` described below. Class description: Implement the SimpleLSTM class. Method signatures and docstrings: - def __init__(self, vocab, hidden_dim: int, output_dim: int, dropout: float=0.3, device=torch.device('cpu'), use_lengths=True, use_bert_embeds: bool=False): :param vocab: a ve...
52b379ef4019a2aaad3f637d5c1af54b498b45f1
<|skeleton|> class SimpleLSTM: def __init__(self, vocab, hidden_dim: int, output_dim: int, dropout: float=0.3, device=torch.device('cpu'), use_lengths=True, use_bert_embeds: bool=False): """:param vocab: a vector containing the word embeddings of the word in the train set :param hidden_dim: int specifying ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SimpleLSTM: def __init__(self, vocab, hidden_dim: int, output_dim: int, dropout: float=0.3, device=torch.device('cpu'), use_lengths=True, use_bert_embeds: bool=False): """:param vocab: a vector containing the word embeddings of the word in the train set :param hidden_dim: int specifying number of hidd...
the_stack_v2_python_sparse
codebase/models/simplelstm.py
RubenvanHeusden/MasterThesis
train
2
824f53c46056c3e0d02e50193d0175d5fea79887
[ "self.capacity = capacity\nself.dict = {}\nself.head = DoubleLinkedListNode('head', -1)\nself.tail = DoubleLinkedListNode('tail', -1)\nself.head.next = self.tail\nself.tail.prev = self.head", "if key not in self.dict:\n return -1\ncurr = self.dict[key]\ncurr.next.prev = curr.prev\ncurr.prev.next = curr.next\nc...
<|body_start_0|> self.capacity = capacity self.dict = {} self.head = DoubleLinkedListNode('head', -1) self.tail = DoubleLinkedListNode('tail', -1) self.head.next = self.tail self.tail.prev = self.head <|end_body_0|> <|body_start_1|> if key not in self.dict: ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|> <...
stack_v2_sparse_classes_75kplus_train_071204
4,337
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: nothing", "name": "set", "sig...
3
stack_v2_sparse_classes_30k_train_034787
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :rtype: int - def set(self, key, value): :type key: int :type value: int :rtype: nothing <|skeleton|> cla...
752ac00bea40be1e3794d80aa7b2be58c0a548f6
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:rtype: int""" <|body_1|> def set(self, key, value): """:type key: int :type value: int :rtype: nothing""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.dict = {} self.head = DoubleLinkedListNode('head', -1) self.tail = DoubleLinkedListNode('tail', -1) self.head.next = self.tail self.tail.prev = self.head ...
the_stack_v2_python_sparse
Code/LRU Cache.py
mws19901118/Leetcode
train
0
f81aee85cd6430142b1c19ec5304a82a0caf59f3
[ "if not exclude:\n exclude = {}\nreturn dict([('%s__isnull' % f.name, True) for f in self.model.option_fields() if f.name not in exclude])", "if options:\n options = SortedDict(options)\n variations = [[]]\n for values_list in options.values():\n variations = [x + [y] for x in variations for y ...
<|body_start_0|> if not exclude: exclude = {} return dict([('%s__isnull' % f.name, True) for f in self.model.option_fields() if f.name not in exclude]) <|end_body_0|> <|body_start_1|> if options: options = SortedDict(options) variations = [[]] for...
ProductVariationManager
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductVariationManager: def _empty_options_lookup(self, exclude=None): """Create a lookup dict of field__isnull for options fields.""" <|body_0|> def create_from_options(self, options): """Create all unique variations from the selected options.""" <|body_1|>...
stack_v2_sparse_classes_75kplus_train_071205
5,059
permissive
[ { "docstring": "Create a lookup dict of field__isnull for options fields.", "name": "_empty_options_lookup", "signature": "def _empty_options_lookup(self, exclude=None)" }, { "docstring": "Create all unique variations from the selected options.", "name": "create_from_options", "signature...
3
stack_v2_sparse_classes_30k_train_031726
Implement the Python class `ProductVariationManager` described below. Class description: Implement the ProductVariationManager class. Method signatures and docstrings: - def _empty_options_lookup(self, exclude=None): Create a lookup dict of field__isnull for options fields. - def create_from_options(self, options): C...
Implement the Python class `ProductVariationManager` described below. Class description: Implement the ProductVariationManager class. Method signatures and docstrings: - def _empty_options_lookup(self, exclude=None): Create a lookup dict of field__isnull for options fields. - def create_from_options(self, options): C...
e7f5b35bc19417a445d3f39fb9cd0910cc7f5caa
<|skeleton|> class ProductVariationManager: def _empty_options_lookup(self, exclude=None): """Create a lookup dict of field__isnull for options fields.""" <|body_0|> def create_from_options(self, options): """Create all unique variations from the selected options.""" <|body_1|>...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProductVariationManager: def _empty_options_lookup(self, exclude=None): """Create a lookup dict of field__isnull for options fields.""" if not exclude: exclude = {} return dict([('%s__isnull' % f.name, True) for f in self.model.option_fields() if f.name not in exclude]) ...
the_stack_v2_python_sparse
cartridge/shop/managers.py
alyoung/cartridge
train
0
1e354c99cfaae71fe77fed7d25d407945e3d5a19
[ "request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': str}, 'group_name': {'type': str}, 'role': {'type': str}})\nrest_utils.validate_inputs(request_dict)\nrole_name = request_dict.get('role')\nif role_name:\n rest_utils.verify_role(role_name)\nelse:\n role_name = constants.DEFAULT_TE...
<|body_start_0|> request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': str}, 'group_name': {'type': str}, 'role': {'type': str}}) rest_utils.validate_inputs(request_dict) role_name = request_dict.get('role') if role_name: rest_utils.verify_role(role_na...
TenantGroups
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TenantGroups: def put(self, multi_tenancy): """Add a group to a tenant""" <|body_0|> def patch(self, multi_tenancy): """Update role in group tenant association.""" <|body_1|> def delete(self, multi_tenancy): """Remove a group from a tenant""" ...
stack_v2_sparse_classes_75kplus_train_071206
10,735
permissive
[ { "docstring": "Add a group to a tenant", "name": "put", "signature": "def put(self, multi_tenancy)" }, { "docstring": "Update role in group tenant association.", "name": "patch", "signature": "def patch(self, multi_tenancy)" }, { "docstring": "Remove a group from a tenant", ...
3
stack_v2_sparse_classes_30k_train_030783
Implement the Python class `TenantGroups` described below. Class description: Implement the TenantGroups class. Method signatures and docstrings: - def put(self, multi_tenancy): Add a group to a tenant - def patch(self, multi_tenancy): Update role in group tenant association. - def delete(self, multi_tenancy): Remove...
Implement the Python class `TenantGroups` described below. Class description: Implement the TenantGroups class. Method signatures and docstrings: - def put(self, multi_tenancy): Add a group to a tenant - def patch(self, multi_tenancy): Update role in group tenant association. - def delete(self, multi_tenancy): Remove...
c0de6442e1d7653fad824d75e571802a74eee605
<|skeleton|> class TenantGroups: def put(self, multi_tenancy): """Add a group to a tenant""" <|body_0|> def patch(self, multi_tenancy): """Update role in group tenant association.""" <|body_1|> def delete(self, multi_tenancy): """Remove a group from a tenant""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TenantGroups: def put(self, multi_tenancy): """Add a group to a tenant""" request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': str}, 'group_name': {'type': str}, 'role': {'type': str}}) rest_utils.validate_inputs(request_dict) role_name = request_dict.g...
the_stack_v2_python_sparse
rest-service/manager_rest/rest/resources_v3/tenants.py
cloudify-cosmo/cloudify-manager
train
146
e12db9da6121429c9bb05f20931c276c60b9eb43
[ "set_ = set()\nstart = end = 0\nl = list(s)\nres = 0\nwhile end < len(s):\n c = s[end]\n if not c in set_:\n set_.add(c)\n res = max(res, len(set_))\n end = end + 1\n else:\n while s[start] != c:\n set_.remove(s[start])\n start = start + 1\n set_.rem...
<|body_start_0|> set_ = set() start = end = 0 l = list(s) res = 0 while end < len(s): c = s[end] if not c in set_: set_.add(c) res = max(res, len(set_)) end = end + 1 else: while s...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int 方法一:双指针 + set,不重复放入,计算最大,移动end指针; 如果重复则移动start指针,删除集合中对应的元素,直到删掉重复元素""" <|body_0|> def lengthOfLongestSubstring2(self, s): """:type s: str :rtype: int 方法二:双指针 + map,k:值,v:下标 不重复放入,计算最大值,移动en...
stack_v2_sparse_classes_75kplus_train_071207
1,705
no_license
[ { "docstring": ":type s: str :rtype: int 方法一:双指针 + set,不重复放入,计算最大,移动end指针; 如果重复则移动start指针,删除集合中对应的元素,直到删掉重复元素", "name": "lengthOfLongestSubstring", "signature": "def lengthOfLongestSubstring(self, s)" }, { "docstring": ":type s: str :rtype: int 方法二:双指针 + map,k:值,v:下标 不重复放入,计算最大值,移动end指针,由于没有依次删掉...
2
stack_v2_sparse_classes_30k_train_026170
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int 方法一:双指针 + set,不重复放入,计算最大,移动end指针; 如果重复则移动start指针,删除集合中对应的元素,直到删掉重复元素 - def lengthOfLongestSubstring2(self, s): :ty...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLongestSubstring(self, s): :type s: str :rtype: int 方法一:双指针 + set,不重复放入,计算最大,移动end指针; 如果重复则移动start指针,删除集合中对应的元素,直到删掉重复元素 - def lengthOfLongestSubstring2(self, s): :ty...
b4fc2ba621f3484973c0520b02c60e5ed1930722
<|skeleton|> class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int 方法一:双指针 + set,不重复放入,计算最大,移动end指针; 如果重复则移动start指针,删除集合中对应的元素,直到删掉重复元素""" <|body_0|> def lengthOfLongestSubstring2(self, s): """:type s: str :rtype: int 方法二:双指针 + map,k:值,v:下标 不重复放入,计算最大值,移动en...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def lengthOfLongestSubstring(self, s): """:type s: str :rtype: int 方法一:双指针 + set,不重复放入,计算最大,移动end指针; 如果重复则移动start指针,删除集合中对应的元素,直到删掉重复元素""" set_ = set() start = end = 0 l = list(s) res = 0 while end < len(s): c = s[end] if not c ...
the_stack_v2_python_sparse
003_LongestSubstring.py
Black-Mamba24/leetcode-python
train
0
5d51cb2bbedd78570f659432d01cf9f26a807547
[ "getcontext().prec = 3\ni = Decimal(str(obj.alertObj.orbit.i))\ne = Decimal(str(obj.alertObj.orbit.e))\nq = Decimal(str(obj.alertObj.orbit.q))\nh = Decimal(str(obj.alertObj.orbit.h_v))\na = q / (Decimal(1) - e)\nresult = e > Decimal('0.8') and a <= Decimal('2.5') and (a >= Decimal('2.0')) and (i > Decimal('4.0'))\n...
<|body_start_0|> getcontext().prec = 3 i = Decimal(str(obj.alertObj.orbit.i)) e = Decimal(str(obj.alertObj.orbit.e)) q = Decimal(str(obj.alertObj.orbit.q)) h = Decimal(str(obj.alertObj.orbit.h_v)) a = q / (Decimal(1) - e) result = e > Decimal('0.8') and a <= Decim...
Encke_Family
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encke_Family: def IsEnckeFam(self, obj): """Return True if obj has 2.0 AU <= a <= 2.5 AU && e > 0.8 && i > 4.0 q = a * ( 1 - e ) @param obj: DerivedObject instance""" <|body_0|> def evaluate(self): """Return Derived Objects that have a been submitted to the MPC that ...
stack_v2_sparse_classes_75kplus_train_071208
2,493
no_license
[ { "docstring": "Return True if obj has 2.0 AU <= a <= 2.5 AU && e > 0.8 && i > 4.0 q = a * ( 1 - e ) @param obj: DerivedObject instance", "name": "IsEnckeFam", "signature": "def IsEnckeFam(self, obj)" }, { "docstring": "Return Derived Objects that have a been submitted to the MPC that contain a ...
2
null
Implement the Python class `Encke_Family` described below. Class description: Implement the Encke_Family class. Method signatures and docstrings: - def IsEnckeFam(self, obj): Return True if obj has 2.0 AU <= a <= 2.5 AU && e > 0.8 && i > 4.0 q = a * ( 1 - e ) @param obj: DerivedObject instance - def evaluate(self): R...
Implement the Python class `Encke_Family` described below. Class description: Implement the Encke_Family class. Method signatures and docstrings: - def IsEnckeFam(self, obj): Return True if obj has 2.0 AU <= a <= 2.5 AU && e > 0.8 && i > 4.0 q = a * ( 1 - e ) @param obj: DerivedObject instance - def evaluate(self): R...
06858b7e935243da7a3f55b3e5097d6440e0c1c2
<|skeleton|> class Encke_Family: def IsEnckeFam(self, obj): """Return True if obj has 2.0 AU <= a <= 2.5 AU && e > 0.8 && i > 4.0 q = a * ( 1 - e ) @param obj: DerivedObject instance""" <|body_0|> def evaluate(self): """Return Derived Objects that have a been submitted to the MPC that ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Encke_Family: def IsEnckeFam(self, obj): """Return True if obj has 2.0 AU <= a <= 2.5 AU && e > 0.8 && i > 4.0 q = a * ( 1 - e ) @param obj: DerivedObject instance""" getcontext().prec = 3 i = Decimal(str(obj.alertObj.orbit.i)) e = Decimal(str(obj.alertObj.orbit.e)) q =...
the_stack_v2_python_sparse
python/MOPS/Alerts/plugins/encke_family.py
ldenneau/mopsng
train
0
67448b3f2fbd09bb0e9fa61935aead5048c3879d
[ "response = self.client.get(reverse('index_rango'))\nself.assertEqual(response.status_code, 200)\nself.assertContains(response, 'There are no categories present.')\nself.assertQuerysetEqual(response.context['categories'], [])", "add_cat('test', 1, 1)\nadd_cat('temp', 1, 1)\nadd_cat('tmp', 1, 1)\nadd_cat('tmp test...
<|body_start_0|> response = self.client.get(reverse('index_rango')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'There are no categories present.') self.assertQuerysetEqual(response.context['categories'], []) <|end_body_0|> <|body_start_1|> add_cat(...
IndexViewTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexViewTests: def test_index_view_with_no_categories(self): """Если не существует категорий, то должно выводиться соответствующее сообщение.""" <|body_0|> def test_index_view_with_categories(self): """Если не существует категорий, то должно выводиться соответствующ...
stack_v2_sparse_classes_75kplus_train_071209
2,626
no_license
[ { "docstring": "Если не существует категорий, то должно выводиться соответствующее сообщение.", "name": "test_index_view_with_no_categories", "signature": "def test_index_view_with_no_categories(self)" }, { "docstring": "Если не существует категорий, то должно выводиться соответствующее сообщени...
2
stack_v2_sparse_classes_30k_train_024925
Implement the Python class `IndexViewTests` described below. Class description: Implement the IndexViewTests class. Method signatures and docstrings: - def test_index_view_with_no_categories(self): Если не существует категорий, то должно выводиться соответствующее сообщение. - def test_index_view_with_categories(self...
Implement the Python class `IndexViewTests` described below. Class description: Implement the IndexViewTests class. Method signatures and docstrings: - def test_index_view_with_no_categories(self): Если не существует категорий, то должно выводиться соответствующее сообщение. - def test_index_view_with_categories(self...
80f1a6bcbe2e0448b844e1352ebd1ae3c5f5e858
<|skeleton|> class IndexViewTests: def test_index_view_with_no_categories(self): """Если не существует категорий, то должно выводиться соответствующее сообщение.""" <|body_0|> def test_index_view_with_categories(self): """Если не существует категорий, то должно выводиться соответствующ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IndexViewTests: def test_index_view_with_no_categories(self): """Если не существует категорий, то должно выводиться соответствующее сообщение.""" response = self.client.get(reverse('index_rango')) self.assertEqual(response.status_code, 200) self.assertContains(response, 'There ...
the_stack_v2_python_sparse
rango/tests.py
blazer-05/tangotest
train
1
95bae501300921e9a9ae6df7d07035f8d3031d69
[ "super(DecoderBlock, self).__init__()\nself.mha1 = MultiHeadAttention(dm, h)\nself.mha2 = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernor...
<|body_start_0|> super(DecoderBlock, self).__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(hidden, activation='relu') self.dense_output = tf.keras.layers.Dense(dm) self.layernorm1 = tf.keras....
create an encoder block for a transformer
DecoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderBlock: """create an encoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """Public instance method""" <|b...
stack_v2_sparse_classes_75kplus_train_071210
2,127
no_license
[ { "docstring": "Class constructor", "name": "__init__", "signature": "def __init__(self, dm, h, hidden, drop_rate=0.1)" }, { "docstring": "Public instance method", "name": "call", "signature": "def call(self, x, encoder_output, training, look_ahead_mask, padding_mask)" } ]
2
stack_v2_sparse_classes_30k_train_023957
Implement the Python class `DecoderBlock` described below. Class description: create an encoder block for a transformer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): Class constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): Public instance ...
Implement the Python class `DecoderBlock` described below. Class description: create an encoder block for a transformer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): Class constructor - def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): Public instance ...
c23deee331a71a089197547fcae4c1eefb8d24ef
<|skeleton|> class DecoderBlock: """create an encoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor""" <|body_0|> def call(self, x, encoder_output, training, look_ahead_mask, padding_mask): """Public instance method""" <|b...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DecoderBlock: """create an encoder block for a transformer""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Class constructor""" super(DecoderBlock, self).__init__() self.mha1 = MultiHeadAttention(dm, h) self.mha2 = MultiHeadAttention(dm, h) self.dense_hidde...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/8-transformer_decoder_block.py
YosriGFX/holbertonschool-machine_learning
train
0
65300aef5964778af611c2b8c9cd7565489067cb
[ "self.config = {}\nfor key, value in configs:\n self.setConfig(key, value)", "gist_md_pattern = GistPattern(GIST_MD_RE, self.getConfigs())\ngist_md_pattern.md = md\nmd.inlinePatterns.register(gist_md_pattern, 'gist', 175)\ngist_rst_pattern = GistPattern(GIST_RST_RE, self.getConfigs())\ngist_rst_pattern.md = md...
<|body_start_0|> self.config = {} for key, value in configs: self.setConfig(key, value) <|end_body_0|> <|body_start_1|> gist_md_pattern = GistPattern(GIST_MD_RE, self.getConfigs()) gist_md_pattern.md = md md.inlinePatterns.register(gist_md_pattern, 'gist', 175) ...
Gist extension for Markdown.
GistExtension
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GistExtension: """Gist extension for Markdown.""" def __init__(self, configs={}): """Initialize the extension.""" <|body_0|> def extendMarkdown(self, md, md_globals=None): """Extend Markdown.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_75kplus_train_071211
6,764
permissive
[ { "docstring": "Initialize the extension.", "name": "__init__", "signature": "def __init__(self, configs={})" }, { "docstring": "Extend Markdown.", "name": "extendMarkdown", "signature": "def extendMarkdown(self, md, md_globals=None)" } ]
2
stack_v2_sparse_classes_30k_train_035268
Implement the Python class `GistExtension` described below. Class description: Gist extension for Markdown. Method signatures and docstrings: - def __init__(self, configs={}): Initialize the extension. - def extendMarkdown(self, md, md_globals=None): Extend Markdown.
Implement the Python class `GistExtension` described below. Class description: Gist extension for Markdown. Method signatures and docstrings: - def __init__(self, configs={}): Initialize the extension. - def extendMarkdown(self, md, md_globals=None): Extend Markdown. <|skeleton|> class GistExtension: """Gist ext...
2b10e9952bac5a1119e6845c7a2c28273aca9775
<|skeleton|> class GistExtension: """Gist extension for Markdown.""" def __init__(self, configs={}): """Initialize the extension.""" <|body_0|> def extendMarkdown(self, md, md_globals=None): """Extend Markdown.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GistExtension: """Gist extension for Markdown.""" def __init__(self, configs={}): """Initialize the extension.""" self.config = {} for key, value in configs: self.setConfig(key, value) def extendMarkdown(self, md, md_globals=None): """Extend Markdown.""" ...
the_stack_v2_python_sparse
nikola/plugins/compile/markdown/mdx_gist.py
getnikola/nikola
train
2,142
5cbab5ca770c8631b498657df7fe93be80e8b008
[ "if len(nums) < 1:\n return []\nret = []\ndh = DualHeap()\nfor i in xrange(k):\n dh.add(nums[i])\nret.append(dh.median())\nfor i in xrange(k, len(nums)):\n dh.remove(nums[i - k])\n dh.add(nums[i])\n ret.append(dh.median())\nreturn ret", "if len(nums) < 1:\n return []\npq = PriorityQueue()\nfor i...
<|body_start_0|> if len(nums) < 1: return [] ret = [] dh = DualHeap() for i in xrange(k): dh.add(nums[i]) ret.append(dh.median()) for i in xrange(k, len(nums)): dh.remove(nums[i - k]) dh.add(nums[i]) ret.append(d...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def medianSlidingWindow(self, nums, k): """Use heap""" <|body_0|> def medianSlidingWindow_TLE(self, nums, k): """Use priority queue :param nums: A list of integers. :param k: size of window :return: The median of element inside the window at each moving."""...
stack_v2_sparse_classes_75kplus_train_071212
4,918
permissive
[ { "docstring": "Use heap", "name": "medianSlidingWindow", "signature": "def medianSlidingWindow(self, nums, k)" }, { "docstring": "Use priority queue :param nums: A list of integers. :param k: size of window :return: The median of element inside the window at each moving.", "name": "medianSl...
2
stack_v2_sparse_classes_30k_train_028647
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def medianSlidingWindow(self, nums, k): Use heap - def medianSlidingWindow_TLE(self, nums, k): Use priority queue :param nums: A list of integers. :param k: size of window :retur...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def medianSlidingWindow(self, nums, k): Use heap - def medianSlidingWindow_TLE(self, nums, k): Use priority queue :param nums: A list of integers. :param k: size of window :retur...
4629a3857b2c57418b86a3b3a7180ecb15e763e3
<|skeleton|> class Solution: def medianSlidingWindow(self, nums, k): """Use heap""" <|body_0|> def medianSlidingWindow_TLE(self, nums, k): """Use priority queue :param nums: A list of integers. :param k: size of window :return: The median of element inside the window at each moving."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def medianSlidingWindow(self, nums, k): """Use heap""" if len(nums) < 1: return [] ret = [] dh = DualHeap() for i in xrange(k): dh.add(nums[i]) ret.append(dh.median()) for i in xrange(k, len(nums)): dh.remove...
the_stack_v2_python_sparse
archive/Sliding Window Median TLE.py
RijuDasgupta9116/LintCode
train
0
e0c186ed48ada562ac255001251ffb3cfae05d06
[ "self.utterance = message.data['utterance']\nself.location = message.data.get('location')\nself.language = language\nself.unit = message.data.get('unit')\nself.timeframe = CURRENT", "if self._geolocation is None:\n if self.location is None:\n self._geolocation = dict()\n else:\n self._geolocat...
<|body_start_0|> self.utterance = message.data['utterance'] self.location = message.data.get('location') self.language = language self.unit = message.data.get('unit') self.timeframe = CURRENT <|end_body_0|> <|body_start_1|> if self._geolocation is None: if se...
WeatherIntent
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeatherIntent: def __init__(self, message, language): """Constructor :param message: Intent data from the message bus :param language: The configured language of the device""" <|body_0|> def geolocation(self): """Lookup the intent location using the Selene API. The S...
stack_v2_sparse_classes_75kplus_train_071213
3,835
permissive
[ { "docstring": "Constructor :param message: Intent data from the message bus :param language: The configured language of the device", "name": "__init__", "signature": "def __init__(self, message, language)" }, { "docstring": "Lookup the intent location using the Selene API. The Selene geolocatio...
4
stack_v2_sparse_classes_30k_train_046338
Implement the Python class `WeatherIntent` described below. Class description: Implement the WeatherIntent class. Method signatures and docstrings: - def __init__(self, message, language): Constructor :param message: Intent data from the message bus :param language: The configured language of the device - def geoloca...
Implement the Python class `WeatherIntent` described below. Class description: Implement the WeatherIntent class. Method signatures and docstrings: - def __init__(self, message, language): Constructor :param message: Intent data from the message bus :param language: The configured language of the device - def geoloca...
db4ba8b1ec1231420c97759861a1ab1c22bdd114
<|skeleton|> class WeatherIntent: def __init__(self, message, language): """Constructor :param message: Intent data from the message bus :param language: The configured language of the device""" <|body_0|> def geolocation(self): """Lookup the intent location using the Selene API. The S...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WeatherIntent: def __init__(self, message, language): """Constructor :param message: Intent data from the message bus :param language: The configured language of the device""" self.utterance = message.data['utterance'] self.location = message.data.get('location') self.language ...
the_stack_v2_python_sparse
skill/intent.py
MycroftAI/skill-weather
train
25
5b04c9575c93733eae442c8a81cead6129515b36
[ "if Database.__instance is None:\n Database()\nreturn Database.__instance", "if Database.__instance is not None:\n raise Exception('This class is a singleton!')\nelse:\n Database.__instance = self\n self.connection = init_connection_engine()" ]
<|body_start_0|> if Database.__instance is None: Database() return Database.__instance <|end_body_0|> <|body_start_1|> if Database.__instance is not None: raise Exception('This class is a singleton!') else: Database.__instance = self self....
Singleton Database class to connect SQLServer. Database provides a connection to a remote SQLServer. Attributes: connection: db instance.
Database
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Database: """Singleton Database class to connect SQLServer. Database provides a connection to a remote SQLServer. Attributes: connection: db instance.""" def get_instance(): """Static access method.""" <|body_0|> def __init__(self): """Virtually private construct...
stack_v2_sparse_classes_75kplus_train_071214
5,624
permissive
[ { "docstring": "Static access method.", "name": "get_instance", "signature": "def get_instance()" }, { "docstring": "Virtually private constructor.", "name": "__init__", "signature": "def __init__(self)" } ]
2
stack_v2_sparse_classes_30k_train_041139
Implement the Python class `Database` described below. Class description: Singleton Database class to connect SQLServer. Database provides a connection to a remote SQLServer. Attributes: connection: db instance. Method signatures and docstrings: - def get_instance(): Static access method. - def __init__(self): Virtua...
Implement the Python class `Database` described below. Class description: Singleton Database class to connect SQLServer. Database provides a connection to a remote SQLServer. Attributes: connection: db instance. Method signatures and docstrings: - def get_instance(): Static access method. - def __init__(self): Virtua...
f47c6cce471d97104074d403ab9ec39a08276213
<|skeleton|> class Database: """Singleton Database class to connect SQLServer. Database provides a connection to a remote SQLServer. Attributes: connection: db instance.""" def get_instance(): """Static access method.""" <|body_0|> def __init__(self): """Virtually private construct...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Database: """Singleton Database class to connect SQLServer. Database provides a connection to a remote SQLServer. Attributes: connection: db instance.""" def get_instance(): """Static access method.""" if Database.__instance is None: Database() return Database.__instan...
the_stack_v2_python_sparse
util/database.py
ReadMoa/web-service
train
0
3ea1c693b092bd35a5dc20cfb1fbb3e2745d96c9
[ "self.trie_prefix = {'weight': set()}\nself.trie_suffix = {'weight': set()}\nself.weights = {}\nfor i, word in enumerate(words):\n dicts = self.trie_prefix\n dicts['weight'].add(word)\n for char in word:\n if char not in dicts:\n dicts[char] = {'weight': set()}\n dicts[char]['weigh...
<|body_start_0|> self.trie_prefix = {'weight': set()} self.trie_suffix = {'weight': set()} self.weights = {} for i, word in enumerate(words): dicts = self.trie_prefix dicts['weight'].add(word) for char in word: if char not in dicts: ...
648ms
WordFilter_2
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordFilter_2: """648ms""" def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.trie_prefix = {'wei...
stack_v2_sparse_classes_75kplus_train_071215
5,608
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type prefix: str :type suffix: str :rtype: int", "name": "f", "signature": "def f(self, prefix, suffix)" } ]
2
null
Implement the Python class `WordFilter_2` described below. Class description: 648ms Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
Implement the Python class `WordFilter_2` described below. Class description: 648ms Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int <|skeleton|> class WordFilter_2: """648ms""" def __init__(s...
679a2b246b8b6bb7fc55ed1c8096d3047d6d4461
<|skeleton|> class WordFilter_2: """648ms""" def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordFilter_2: """648ms""" def __init__(self, words): """:type words: List[str]""" self.trie_prefix = {'weight': set()} self.trie_suffix = {'weight': set()} self.weights = {} for i, word in enumerate(words): dicts = self.trie_prefix dicts['we...
the_stack_v2_python_sparse
PrefixAndSuffixSearch_HARD_745.py
953250587/leetcode-python
train
2
ac783f9de79f0bcaea03cdbf06300fe7af7f2e77
[ "self.mark = mark\nself.value = value\nself.training = training\nself.previous_reward = None\nself.previous_after_state = None", "selected_action = self.value.get_max_action(state, self.mark)\nif self.training:\n if random.random() < self.epsilon:\n selected_action = random.choice(state.get_valid_action...
<|body_start_0|> self.mark = mark self.value = value self.training = training self.previous_reward = None self.previous_after_state = None <|end_body_0|> <|body_start_1|> selected_action = self.value.get_max_action(state, self.mark) if self.training: ...
SarsaCom
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SarsaCom: def __init__(self, mark, value, training=True): """初期化: arguments: どちらのマークのPlayerとして行動するか 行動価値テーブル""" <|body_0|> def select_index(self, state): """AIによる行動選択(ε-greedy) arguments: 状態 return: 選択したアクション""" <|body_1|> def learn(self, reward, finishe...
stack_v2_sparse_classes_75kplus_train_071216
2,076
permissive
[ { "docstring": "初期化: arguments: どちらのマークのPlayerとして行動するか 行動価値テーブル", "name": "__init__", "signature": "def __init__(self, mark, value, training=True)" }, { "docstring": "AIによる行動選択(ε-greedy) arguments: 状態 return: 選択したアクション", "name": "select_index", "signature": "def select_index(self, state)...
3
stack_v2_sparse_classes_30k_train_023394
Implement the Python class `SarsaCom` described below. Class description: Implement the SarsaCom class. Method signatures and docstrings: - def __init__(self, mark, value, training=True): 初期化: arguments: どちらのマークのPlayerとして行動するか 行動価値テーブル - def select_index(self, state): AIによる行動選択(ε-greedy) arguments: 状態 return: 選択したアクシ...
Implement the Python class `SarsaCom` described below. Class description: Implement the SarsaCom class. Method signatures and docstrings: - def __init__(self, mark, value, training=True): 初期化: arguments: どちらのマークのPlayerとして行動するか 行動価値テーブル - def select_index(self, state): AIによる行動選択(ε-greedy) arguments: 状態 return: 選択したアクシ...
eb64b9ce6aa978be95a9c8c656995559517b1169
<|skeleton|> class SarsaCom: def __init__(self, mark, value, training=True): """初期化: arguments: どちらのマークのPlayerとして行動するか 行動価値テーブル""" <|body_0|> def select_index(self, state): """AIによる行動選択(ε-greedy) arguments: 状態 return: 選択したアクション""" <|body_1|> def learn(self, reward, finishe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SarsaCom: def __init__(self, mark, value, training=True): """初期化: arguments: どちらのマークのPlayerとして行動するか 行動価値テーブル""" self.mark = mark self.value = value self.training = training self.previous_reward = None self.previous_after_state = None def select_index(self, ...
the_stack_v2_python_sparse
tic_tac_toe_sarsa_com.py
MasazI/ReinforcementLearning
train
0
77f8713c7443fb029ded2cb01acaebe8d1d8a8fd
[ "super(SmoothL1Loss, self).__init__()\nself.beta = desc['beta'] if 'beta' in desc else 1.0\nself.reduction = desc['reduction'] if 'reduction' in desc else 'mean'\nself.loss_weight = desc['loss_weight'] if 'loss_weight' in desc else 1.0", "reduction = reduction_override if reduction_override else self.reduction\ni...
<|body_start_0|> super(SmoothL1Loss, self).__init__() self.beta = desc['beta'] if 'beta' in desc else 1.0 self.reduction = desc['reduction'] if 'reduction' in desc else 'mean' self.loss_weight = desc['loss_weight'] if 'loss_weight' in desc else 1.0 <|end_body_0|> <|body_start_1|> ...
Smooth L1 Loss.
SmoothL1Loss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmoothL1Loss: """Smooth L1 Loss.""" def __init__(self, desc): """Init smooth l1 loss. :param desc: config dict""" <|body_0|> def forward(self, pred, target, weight=None, avg_factor=None, reduction_override=None, **kwargs): """Forward compute. :param pred: predict...
stack_v2_sparse_classes_75kplus_train_071217
2,297
permissive
[ { "docstring": "Init smooth l1 loss. :param desc: config dict", "name": "__init__", "signature": "def __init__(self, desc)" }, { "docstring": "Forward compute. :param pred: predict :param target: target :param weight: weight :param avg_factor: avg factor :param reduction_override: reduce overrid...
2
stack_v2_sparse_classes_30k_train_009965
Implement the Python class `SmoothL1Loss` described below. Class description: Smooth L1 Loss. Method signatures and docstrings: - def __init__(self, desc): Init smooth l1 loss. :param desc: config dict - def forward(self, pred, target, weight=None, avg_factor=None, reduction_override=None, **kwargs): Forward compute....
Implement the Python class `SmoothL1Loss` described below. Class description: Smooth L1 Loss. Method signatures and docstrings: - def __init__(self, desc): Init smooth l1 loss. :param desc: config dict - def forward(self, pred, target, weight=None, avg_factor=None, reduction_override=None, **kwargs): Forward compute....
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class SmoothL1Loss: """Smooth L1 Loss.""" def __init__(self, desc): """Init smooth l1 loss. :param desc: config dict""" <|body_0|> def forward(self, pred, target, weight=None, avg_factor=None, reduction_override=None, **kwargs): """Forward compute. :param pred: predict...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SmoothL1Loss: """Smooth L1 Loss.""" def __init__(self, desc): """Init smooth l1 loss. :param desc: config dict""" super(SmoothL1Loss, self).__init__() self.beta = desc['beta'] if 'beta' in desc else 1.0 self.reduction = desc['reduction'] if 'reduction' in desc else 'mean' ...
the_stack_v2_python_sparse
zeus/networks/pytorch/losses/smooth_l1_loss.py
huawei-noah/xingtian
train
308
3b61ecf69e828c16665c06cecfa3d6188181f030
[ "if filename.endswith('.TIF') or filename.endswith('.tif') or filename.endswith('.tiff') or filename.endswith('.TIFF'):\n file_path = os.path.join(out_path, filename)\nelse:\n file_path = os.path.join(out_path, '{}_{}.TIF'.format(filename, type_bands_name))\nreturn file_path", "type_bands_name = 'r{0}g{1}b{...
<|body_start_0|> if filename.endswith('.TIF') or filename.endswith('.tif') or filename.endswith('.tiff') or filename.endswith('.TIFF'): file_path = os.path.join(out_path, filename) else: file_path = os.path.join(out_path, '{}_{}.TIF'.format(filename, type_bands_name)) ret...
Class with method that process and create composition from a Landsat list of files.
Composer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Composer: """Class with method that process and create composition from a Landsat list of files.""" def __set_full_output_filepath(self, filename, out_path, type_bands_name): """Returns complete filepath tif for rgb composition""" <|body_0|> def create_composition(filena...
stack_v2_sparse_classes_75kplus_train_071218
2,574
permissive
[ { "docstring": "Returns complete filepath tif for rgb composition", "name": "__set_full_output_filepath", "signature": "def __set_full_output_filepath(self, filename, out_path, type_bands_name)" }, { "docstring": "Creates a composition using gdal_merge.py with ordered filelist Args: filename: ou...
2
stack_v2_sparse_classes_30k_train_044825
Implement the Python class `Composer` described below. Class description: Class with method that process and create composition from a Landsat list of files. Method signatures and docstrings: - def __set_full_output_filepath(self, filename, out_path, type_bands_name): Returns complete filepath tif for rgb composition...
Implement the Python class `Composer` described below. Class description: Class with method that process and create composition from a Landsat list of files. Method signatures and docstrings: - def __set_full_output_filepath(self, filename, out_path, type_bands_name): Returns complete filepath tif for rgb composition...
310566df81483d9d7e5535832375091af2117c2d
<|skeleton|> class Composer: """Class with method that process and create composition from a Landsat list of files.""" def __set_full_output_filepath(self, filename, out_path, type_bands_name): """Returns complete filepath tif for rgb composition""" <|body_0|> def create_composition(filena...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Composer: """Class with method that process and create composition from a Landsat list of files.""" def __set_full_output_filepath(self, filename, out_path, type_bands_name): """Returns complete filepath tif for rgb composition""" if filename.endswith('.TIF') or filename.endswith('.tif') ...
the_stack_v2_python_sparse
landsat_processor/composer.py
igor-rodrigues01/landast_processor
train
0
b061f404141edcf8b0eafcaca409726ee6cd97a9
[ "ret = 0\nn = -relative_position\nif bidirectional:\n num_buckets //= 2\n ret += (n < 0).astype(np.int32) * num_buckets\n n = np.abs(n)\nelse:\n n = np.maximum(n, 0)\nmax_exact = num_buckets // 2\nis_small = n < max_exact\nval_if_large = max_exact + (np.log(n.astype(np.float32) / max_exact + np.finfo(np...
<|body_start_0|> ret = 0 n = -relative_position if bidirectional: num_buckets //= 2 ret += (n < 0).astype(np.int32) * num_buckets n = np.abs(n) else: n = np.maximum(n, 0) max_exact = num_buckets // 2 is_small = n < max_exact...
Adds T5-style relative positional embeddings to the attention logits. Attributes: config: TransformerConfig dataclass containing hyperparameters. embedding_init: initializer for relative embedding table.
RelativePositionEmbs
[ "CC-BY-4.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelativePositionEmbs: """Adds T5-style relative positional embeddings to the attention logits. Attributes: config: TransformerConfig dataclass containing hyperparameters. embedding_init: initializer for relative embedding table.""" def _relative_position_bucket(relative_position, bidirection...
stack_v2_sparse_classes_75kplus_train_071219
48,226
permissive
[ { "docstring": "Translate relative position to a bucket number for relative attention. The relative position is defined as memory_position - query_position, i.e. the distance in tokens from the attending position to the attended-to position. If bidirectional=False, then positive relative positions are invalid. ...
2
stack_v2_sparse_classes_30k_train_052288
Implement the Python class `RelativePositionEmbs` described below. Class description: Adds T5-style relative positional embeddings to the attention logits. Attributes: config: TransformerConfig dataclass containing hyperparameters. embedding_init: initializer for relative embedding table. Method signatures and docstr...
Implement the Python class `RelativePositionEmbs` described below. Class description: Adds T5-style relative positional embeddings to the attention logits. Attributes: config: TransformerConfig dataclass containing hyperparameters. embedding_init: initializer for relative embedding table. Method signatures and docstr...
320a49f768cea27200044c0d12f394aa6c795feb
<|skeleton|> class RelativePositionEmbs: """Adds T5-style relative positional embeddings to the attention logits. Attributes: config: TransformerConfig dataclass containing hyperparameters. embedding_init: initializer for relative embedding table.""" def _relative_position_bucket(relative_position, bidirection...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RelativePositionEmbs: """Adds T5-style relative positional embeddings to the attention logits. Attributes: config: TransformerConfig dataclass containing hyperparameters. embedding_init: initializer for relative embedding table.""" def _relative_position_bucket(relative_position, bidirectional=True, num_...
the_stack_v2_python_sparse
flax_models/t5x/models.py
afcarl/google-research
train
1
ff0616e19930126b3976fd45d581bf41deaace65
[ "super().__init__(results)\nself.path = path\nself.load_from_filesystem()", "for result_path in self.path.iterdir():\n result = deserialize(dir_path=result_path)\n self.data[result.name] = result", "for name in self.data:\n dir_path = self.path.joinpath(name)\n self.data[name].serialize(dir_path=dir...
<|body_start_0|> super().__init__(results) self.path = path self.load_from_filesystem() <|end_body_0|> <|body_start_1|> for result_path in self.path.iterdir(): result = deserialize(dir_path=result_path) self.data[result.name] = result <|end_body_1|> <|body_start...
ResultDB
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResultDB: def __init__(self, path: Path, results: Dict[str, Result]): """List-like interface to a collection of Experiments.""" <|body_0|> def load_from_filesystem(self) -> None: """Load results from the filesystem.""" <|body_1|> def save_to_filesystem(s...
stack_v2_sparse_classes_75kplus_train_071220
1,003
permissive
[ { "docstring": "List-like interface to a collection of Experiments.", "name": "__init__", "signature": "def __init__(self, path: Path, results: Dict[str, Result])" }, { "docstring": "Load results from the filesystem.", "name": "load_from_filesystem", "signature": "def load_from_filesyste...
3
stack_v2_sparse_classes_30k_train_012190
Implement the Python class `ResultDB` described below. Class description: Implement the ResultDB class. Method signatures and docstrings: - def __init__(self, path: Path, results: Dict[str, Result]): List-like interface to a collection of Experiments. - def load_from_filesystem(self) -> None: Load results from the fi...
Implement the Python class `ResultDB` described below. Class description: Implement the ResultDB class. Method signatures and docstrings: - def __init__(self, path: Path, results: Dict[str, Result]): List-like interface to a collection of Experiments. - def load_from_filesystem(self) -> None: Load results from the fi...
17124a0b6f89480821eca515b900a8c06187480a
<|skeleton|> class ResultDB: def __init__(self, path: Path, results: Dict[str, Result]): """List-like interface to a collection of Experiments.""" <|body_0|> def load_from_filesystem(self) -> None: """Load results from the filesystem.""" <|body_1|> def save_to_filesystem(s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ResultDB: def __init__(self, path: Path, results: Dict[str, Result]): """List-like interface to a collection of Experiments.""" super().__init__(results) self.path = path self.load_from_filesystem() def load_from_filesystem(self) -> None: """Load results from the f...
the_stack_v2_python_sparse
xplogger/experiment_manager/result/db.py
shagunsodhani/xplogger
train
7
233e464239c669c25b63d5d61222b39130ae3960
[ "code = '\\na = 3\\nb = a/1\\nc = b\\n '\nattr = self.prepare(code, self.attr_name)\nself.assertEqual(attr, 0)\ncode = '\\nfor i in range(0, 10):\\n a = i\\n '\nattr = self.prepare(code, self.attr_name)\nself.assertEqual(attr, 0)", "code = '\\ndef func(a, b):\\n if a < 0:\\n return a\\n...
<|body_start_0|> code = '\na = 3\nb = a/1\nc = b\n ' attr = self.prepare(code, self.attr_name) self.assertEqual(attr, 0) code = '\nfor i in range(0, 10):\n a = i\n ' attr = self.prepare(code, self.attr_name) self.assertEqual(attr, 0) <|end_body_0|> <|bod...
Test class for RecCount
TestRecCount
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRecCount: """Test class for RecCount""" def test_noRec(self): """Tests the correct results for codes without recursion. Keyword arguments: self -- the TestRecCount instance""" <|body_0|> def test_oneRec(self): """Tests the correct results for codes with one r...
stack_v2_sparse_classes_75kplus_train_071221
20,005
no_license
[ { "docstring": "Tests the correct results for codes without recursion. Keyword arguments: self -- the TestRecCount instance", "name": "test_noRec", "signature": "def test_noRec(self)" }, { "docstring": "Tests the correct results for codes with one recursion. Keyword arguments: self -- the TestRe...
4
stack_v2_sparse_classes_30k_train_037655
Implement the Python class `TestRecCount` described below. Class description: Test class for RecCount Method signatures and docstrings: - def test_noRec(self): Tests the correct results for codes without recursion. Keyword arguments: self -- the TestRecCount instance - def test_oneRec(self): Tests the correct results...
Implement the Python class `TestRecCount` described below. Class description: Test class for RecCount Method signatures and docstrings: - def test_noRec(self): Tests the correct results for codes without recursion. Keyword arguments: self -- the TestRecCount instance - def test_oneRec(self): Tests the correct results...
2c0b907f5d9e74265e87ab3e36753f764a965f21
<|skeleton|> class TestRecCount: """Test class for RecCount""" def test_noRec(self): """Tests the correct results for codes without recursion. Keyword arguments: self -- the TestRecCount instance""" <|body_0|> def test_oneRec(self): """Tests the correct results for codes with one r...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestRecCount: """Test class for RecCount""" def test_noRec(self): """Tests the correct results for codes without recursion. Keyword arguments: self -- the TestRecCount instance""" code = '\na = 3\nb = a/1\nc = b\n ' attr = self.prepare(code, self.attr_name) self.ass...
the_stack_v2_python_sparse
AlgoBooster/ab_ui/ab_main/ab_unittests/test_extraction.py
danielaboeing/algobooster
train
0
9f24123e50f1b85f0d9b8f0f1375167fa509f77b
[ "owner = self.context['request'].user\nvalidated_data['owner'] = owner\nreturn Item.objects.create(**validated_data)", "owner = self.context['request'].user\ntry:\n Item.objects.get(name=value, owner=owner)\nexcept Item.DoesNotExist:\n return value\nraise serializers.ValidationError('Shopping Item {} alread...
<|body_start_0|> owner = self.context['request'].user validated_data['owner'] = owner return Item.objects.create(**validated_data) <|end_body_0|> <|body_start_1|> owner = self.context['request'].user try: Item.objects.get(name=value, owner=owner) except Item....
ItemSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ItemSerializer: def create(self, validated_data, **kwargs): """create a new shopping item""" <|body_0|> def validate_name(self, value): """ensure shopping list name doesn't exist""" <|body_1|> <|end_skeleton|> <|body_start_0|> owner = self.context['...
stack_v2_sparse_classes_75kplus_train_071222
2,826
permissive
[ { "docstring": "create a new shopping item", "name": "create", "signature": "def create(self, validated_data, **kwargs)" }, { "docstring": "ensure shopping list name doesn't exist", "name": "validate_name", "signature": "def validate_name(self, value)" } ]
2
stack_v2_sparse_classes_30k_train_032539
Implement the Python class `ItemSerializer` described below. Class description: Implement the ItemSerializer class. Method signatures and docstrings: - def create(self, validated_data, **kwargs): create a new shopping item - def validate_name(self, value): ensure shopping list name doesn't exist
Implement the Python class `ItemSerializer` described below. Class description: Implement the ItemSerializer class. Method signatures and docstrings: - def create(self, validated_data, **kwargs): create a new shopping item - def validate_name(self, value): ensure shopping list name doesn't exist <|skeleton|> class I...
b71cd9b55b82c8d2d2060ce350b5135022bd8f4e
<|skeleton|> class ItemSerializer: def create(self, validated_data, **kwargs): """create a new shopping item""" <|body_0|> def validate_name(self, value): """ensure shopping list name doesn't exist""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ItemSerializer: def create(self, validated_data, **kwargs): """create a new shopping item""" owner = self.context['request'].user validated_data['owner'] = owner return Item.objects.create(**validated_data) def validate_name(self, value): """ensure shopping list na...
the_stack_v2_python_sparse
shoppingList/apps/shoppingItems/serializers.py
verenceLola/Shopping
train
0
787e9e2157b3589b63728a18761e7123f8cd11fa
[ "self.initializer = initializer\nself.selector = selector\nself.recombiner = recombiner\nself.mutator = mutator\nself.replacer = replacer\nself.generation_count = generation_count\nself.generation_results = []", "self.generation_results = []\nfor i in range(iterations):\n self.generation_results.append([])\n ...
<|body_start_0|> self.initializer = initializer self.selector = selector self.recombiner = recombiner self.mutator = mutator self.replacer = replacer self.generation_count = generation_count self.generation_results = [] <|end_body_0|> <|body_start_1|> sel...
GeneticAlgorithm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneticAlgorithm: def __init__(self, initializer, selector, recombiner, mutator, replacer, generation_count=100): """A Genetic Algorithm with the given modules""" <|body_0|> def run(self, iterations=100): """Runs the algorithm multiple times and save the results Args...
stack_v2_sparse_classes_75kplus_train_071223
10,050
no_license
[ { "docstring": "A Genetic Algorithm with the given modules", "name": "__init__", "signature": "def __init__(self, initializer, selector, recombiner, mutator, replacer, generation_count=100)" }, { "docstring": "Runs the algorithm multiple times and save the results Args: iterations: the number of...
3
stack_v2_sparse_classes_30k_train_034517
Implement the Python class `GeneticAlgorithm` described below. Class description: Implement the GeneticAlgorithm class. Method signatures and docstrings: - def __init__(self, initializer, selector, recombiner, mutator, replacer, generation_count=100): A Genetic Algorithm with the given modules - def run(self, iterati...
Implement the Python class `GeneticAlgorithm` described below. Class description: Implement the GeneticAlgorithm class. Method signatures and docstrings: - def __init__(self, initializer, selector, recombiner, mutator, replacer, generation_count=100): A Genetic Algorithm with the given modules - def run(self, iterati...
ebcb90bef2c308d470bb2106ead59615e8b151b8
<|skeleton|> class GeneticAlgorithm: def __init__(self, initializer, selector, recombiner, mutator, replacer, generation_count=100): """A Genetic Algorithm with the given modules""" <|body_0|> def run(self, iterations=100): """Runs the algorithm multiple times and save the results Args...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GeneticAlgorithm: def __init__(self, initializer, selector, recombiner, mutator, replacer, generation_count=100): """A Genetic Algorithm with the given modules""" self.initializer = initializer self.selector = selector self.recombiner = recombiner self.mutator = mutator...
the_stack_v2_python_sparse
Week_2/GeneticAlgorithm.py
Illiou/nature-inspired-algorithms-2018
train
1
13652621d809995db884f538959adedc382daaae
[ "self.value = int(value)\nself.input_units = input_units\nself.output_units = output_units", "converter = self.input_check()\nmeters_liters = self.value * converter[0][0]\nout_base = converter[1][0]\nmeters_liters_prefix = [value for key, value in self.metprefix_dict.items() if key in self.input_units]\nif meters...
<|body_start_0|> self.value = int(value) self.input_units = input_units self.output_units = output_units <|end_body_0|> <|body_start_1|> converter = self.input_check() meters_liters = self.value * converter[0][0] out_base = converter[1][0] meters_liters_prefix = ...
This class is used to convert between various units
UnitsConverter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UnitsConverter: """This class is used to convert between various units""" def __init__(self, value, input_units, output_units): """Instantiate an object for converting given value from current to target units""" <|body_0|> def convert_to_base(self): """Returns a ...
stack_v2_sparse_classes_75kplus_train_071224
4,609
no_license
[ { "docstring": "Instantiate an object for converting given value from current to target units", "name": "__init__", "signature": "def __init__(self, value, input_units, output_units)" }, { "docstring": "Returns a conversion of distance or volume into base meters/liters units", "name": "conve...
4
stack_v2_sparse_classes_30k_train_001274
Implement the Python class `UnitsConverter` described below. Class description: This class is used to convert between various units Method signatures and docstrings: - def __init__(self, value, input_units, output_units): Instantiate an object for converting given value from current to target units - def convert_to_b...
Implement the Python class `UnitsConverter` described below. Class description: This class is used to convert between various units Method signatures and docstrings: - def __init__(self, value, input_units, output_units): Instantiate an object for converting given value from current to target units - def convert_to_b...
308889e57e71c369aa8516fba8a2064f6a26abee
<|skeleton|> class UnitsConverter: """This class is used to convert between various units""" def __init__(self, value, input_units, output_units): """Instantiate an object for converting given value from current to target units""" <|body_0|> def convert_to_base(self): """Returns a ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UnitsConverter: """This class is used to convert between various units""" def __init__(self, value, input_units, output_units): """Instantiate an object for converting given value from current to target units""" self.value = int(value) self.input_units = input_units self.o...
the_stack_v2_python_sparse
PDX_Code_Guild/UnitsConverter.py
mike-jolliffe/Learning
train
0
12fc61dd838b728dcb7ddde8160af2cb5f66f4b2
[ "self.extra_trees = extra_trees\nself.n_trees = n_trees\nsuper().__init__(scaled=False)", "super().update(x, y)\nif self.extra_trees:\n self.model = ExtraTreesRegressor(n_estimators=self.n_trees)\nelse:\n self.model = RandomForestRegressor(n_estimators=self.n_trees)\nif y.ndim == 2 and y.shape[1] == 1:\n ...
<|body_start_0|> self.extra_trees = extra_trees self.n_trees = n_trees super().__init__(scaled=False) <|end_body_0|> <|body_start_1|> super().update(x, y) if self.extra_trees: self.model = ExtraTreesRegressor(n_estimators=self.n_trees) else: self....
RF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RF: def __init__(self, extra_trees=True, n_trees=100): """class for random forest surrogates. :param bool extra_trees: :param int n_trees:""" <|body_0|> def update(self, x, y): """updates the RF, taking real-valued data and generating a GP and optimising the kernel p...
stack_v2_sparse_classes_75kplus_train_071225
10,652
no_license
[ { "docstring": "class for random forest surrogates. :param bool extra_trees: :param int n_trees:", "name": "__init__", "signature": "def __init__(self, extra_trees=True, n_trees=100)" }, { "docstring": "updates the RF, taking real-valued data and generating a GP and optimising the kernel paramet...
2
null
Implement the Python class `RF` described below. Class description: Implement the RF class. Method signatures and docstrings: - def __init__(self, extra_trees=True, n_trees=100): class for random forest surrogates. :param bool extra_trees: :param int n_trees: - def update(self, x, y): updates the RF, taking real-valu...
Implement the Python class `RF` described below. Class description: Implement the RF class. Method signatures and docstrings: - def __init__(self, extra_trees=True, n_trees=100): class for random forest surrogates. :param bool extra_trees: :param int n_trees: - def update(self, x, y): updates the RF, taking real-valu...
a70409882ca03dc3fd85a30ab062bf35b4cec60f
<|skeleton|> class RF: def __init__(self, extra_trees=True, n_trees=100): """class for random forest surrogates. :param bool extra_trees: :param int n_trees:""" <|body_0|> def update(self, x, y): """updates the RF, taking real-valued data and generating a GP and optimising the kernel p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RF: def __init__(self, extra_trees=True, n_trees=100): """class for random forest surrogates. :param bool extra_trees: :param int n_trees:""" self.extra_trees = extra_trees self.n_trees = n_trees super().__init__(scaled=False) def update(self, x, y): """updates the...
the_stack_v2_python_sparse
testsuite/surrogates.py
FinleyGibson/SAF_EMO
train
2
d96adc767c43e7c2f8c1ce8eaf72012f1e3caff1
[ "if filesystem is None:\n filesystem, path = get_base_filesystem_and_path(path, config=config)\nself.path = path\nself.full_path = get_full_path(filesystem, path)\nself._pickled_filesystem = pickle_fs(filesystem)\nself.fiona_kwargs = kwargs\nself._aws_session = None\nself._dataset_crs: CRS | None = None\nsuper()...
<|body_start_0|> if filesystem is None: filesystem, path = get_base_filesystem_and_path(path, config=config) self.path = path self.full_path = get_full_path(filesystem, path) self._pickled_filesystem = pickle_fs(filesystem) self.fiona_kwargs = kwargs self._aws...
A task for importing (Fiona readable) vector data files into an EOPatch
VectorImportTask
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VectorImportTask: """A task for importing (Fiona readable) vector data files into an EOPatch""" def __init__(self, feature: FeatureSpec, path: str, reproject: bool=True, clip: bool=False, filesystem: FS | None=None, config: SHConfig | None=None, **kwargs: Any): """:param feature: A v...
stack_v2_sparse_classes_75kplus_train_071226
9,682
permissive
[ { "docstring": ":param feature: A vector feature into which to import data :param path: A path to a dataset containing vector data. It can be either a local path or a path to s3 bucket. If `filesystem` parameter is given the path should be relative to the filesystem, otherwise it should be an absolute path. :pa...
4
null
Implement the Python class `VectorImportTask` described below. Class description: A task for importing (Fiona readable) vector data files into an EOPatch Method signatures and docstrings: - def __init__(self, feature: FeatureSpec, path: str, reproject: bool=True, clip: bool=False, filesystem: FS | None=None, config: ...
Implement the Python class `VectorImportTask` described below. Class description: A task for importing (Fiona readable) vector data files into an EOPatch Method signatures and docstrings: - def __init__(self, feature: FeatureSpec, path: str, reproject: bool=True, clip: bool=False, filesystem: FS | None=None, config: ...
a65899e4632b50c9c41a67e1f7698c09b929d840
<|skeleton|> class VectorImportTask: """A task for importing (Fiona readable) vector data files into an EOPatch""" def __init__(self, feature: FeatureSpec, path: str, reproject: bool=True, clip: bool=False, filesystem: FS | None=None, config: SHConfig | None=None, **kwargs: Any): """:param feature: A v...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VectorImportTask: """A task for importing (Fiona readable) vector data files into an EOPatch""" def __init__(self, feature: FeatureSpec, path: str, reproject: bool=True, clip: bool=False, filesystem: FS | None=None, config: SHConfig | None=None, **kwargs: Any): """:param feature: A vector feature...
the_stack_v2_python_sparse
io/eolearn/io/geometry_io.py
sentinel-hub/eo-learn
train
1,072
211ee0ce1ab31abfd625e1e603f21f2bf180e5a5
[ "JobRunner.__init__(self)\nself.setParam('batchqueue', 'workday', 'Batch queue')\nfor k in params.keys():\n self.setParam(k, params[k])\nself.checkParams()", "condorScript = condorScriptTemplate % jobConfig\nprint(condorScript)\nscript = open('condorSubmit.sub', 'w')\nscript.write(condorScript)\nscript.close()...
<|body_start_0|> JobRunner.__init__(self) self.setParam('batchqueue', 'workday', 'Batch queue') for k in params.keys(): self.setParam(k, params[k]) self.checkParams() <|end_body_0|> <|body_start_1|> condorScript = condorScriptTemplate % jobConfig print(condor...
HTCondorJobRunner - run jobs using the HTCondor batch system
HTCondorJobRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HTCondorJobRunner: """HTCondorJobRunner - run jobs using the HTCondor batch system""" def __init__(self, **params): """Constructor (takes any number of parameters as an argument).""" <|body_0|> def submitJob(self, jobConfig): """Submit a JobRunner job as a LSF ba...
stack_v2_sparse_classes_75kplus_train_071227
1,782
permissive
[ { "docstring": "Constructor (takes any number of parameters as an argument).", "name": "__init__", "signature": "def __init__(self, **params)" }, { "docstring": "Submit a JobRunner job as a LSF batch job.", "name": "submitJob", "signature": "def submitJob(self, jobConfig)" } ]
2
stack_v2_sparse_classes_30k_train_046281
Implement the Python class `HTCondorJobRunner` described below. Class description: HTCondorJobRunner - run jobs using the HTCondor batch system Method signatures and docstrings: - def __init__(self, **params): Constructor (takes any number of parameters as an argument). - def submitJob(self, jobConfig): Submit a JobR...
Implement the Python class `HTCondorJobRunner` described below. Class description: HTCondorJobRunner - run jobs using the HTCondor batch system Method signatures and docstrings: - def __init__(self, **params): Constructor (takes any number of parameters as an argument). - def submitJob(self, jobConfig): Submit a JobR...
354f92551294f7be678aebcd7b9d67d2c4448176
<|skeleton|> class HTCondorJobRunner: """HTCondorJobRunner - run jobs using the HTCondor batch system""" def __init__(self, **params): """Constructor (takes any number of parameters as an argument).""" <|body_0|> def submitJob(self, jobConfig): """Submit a JobRunner job as a LSF ba...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HTCondorJobRunner: """HTCondorJobRunner - run jobs using the HTCondor batch system""" def __init__(self, **params): """Constructor (takes any number of parameters as an argument).""" JobRunner.__init__(self) self.setParam('batchqueue', 'workday', 'Batch queue') for k in pa...
the_stack_v2_python_sparse
InnerDetector/InDetExample/InDetBeamSpotExample/python/HTCondorJobRunner.py
strigazi/athena
train
0
1dc25f3e8bd1e2a153e5e3147c1941088acffc95
[ "info = OrderedDict({})\ntry:\n info_editors = OrderedDict({})\n for instance in obj.editors.all():\n info_editors[instance.pk] = instance.pen_name\n info['editors'] = info_editors\nexcept Editor.DoesNotExist as e:\n info['editors'] = str(e)\ntry:\n info['domain'] = domain.DOMAIN_DICT[obj.doma...
<|body_start_0|> info = OrderedDict({}) try: info_editors = OrderedDict({}) for instance in obj.editors.all(): info_editors[instance.pk] = instance.pen_name info['editors'] = info_editors except Editor.DoesNotExist as e: info['edito...
Problem Base Serializer
ProblemBaseSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProblemBaseSerializer: """Problem Base Serializer""" def get_info_data(self, obj, *args, **kwargs): """Get Information Data :param obj: :param args: :param kwargs: :return:""" <|body_0|> def get_links_url(self, obj, *args, **kwargs): """Get links url :param obj: ...
stack_v2_sparse_classes_75kplus_train_071228
6,316
no_license
[ { "docstring": "Get Information Data :param obj: :param args: :param kwargs: :return:", "name": "get_info_data", "signature": "def get_info_data(self, obj, *args, **kwargs)" }, { "docstring": "Get links url :param obj: :param args: :param kwargs: :return:", "name": "get_links_url", "sign...
2
stack_v2_sparse_classes_30k_train_054057
Implement the Python class `ProblemBaseSerializer` described below. Class description: Problem Base Serializer Method signatures and docstrings: - def get_info_data(self, obj, *args, **kwargs): Get Information Data :param obj: :param args: :param kwargs: :return: - def get_links_url(self, obj, *args, **kwargs): Get l...
Implement the Python class `ProblemBaseSerializer` described below. Class description: Problem Base Serializer Method signatures and docstrings: - def get_info_data(self, obj, *args, **kwargs): Get Information Data :param obj: :param args: :param kwargs: :return: - def get_links_url(self, obj, *args, **kwargs): Get l...
acd31a2f43d7ea83fc9bb34627f5dca94763eade
<|skeleton|> class ProblemBaseSerializer: """Problem Base Serializer""" def get_info_data(self, obj, *args, **kwargs): """Get Information Data :param obj: :param args: :param kwargs: :return:""" <|body_0|> def get_links_url(self, obj, *args, **kwargs): """Get links url :param obj: ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProblemBaseSerializer: """Problem Base Serializer""" def get_info_data(self, obj, *args, **kwargs): """Get Information Data :param obj: :param args: :param kwargs: :return:""" info = OrderedDict({}) try: info_editors = OrderedDict({}) for instance in obj.ed...
the_stack_v2_python_sparse
problem/serializers.py
JoenyBui/mywaterbuffalo
train
0
cfc017d673e4b405a02f567b6ce78eaed151e3eb
[ "self.graph = graph\nif not self._is_eulerian():\n raise ValueError('the graph is not eulerian')\nself.eulerian_cycle = list()\nself._graph_copy = self.graph.copy()\nself._stack = LifoQueue()", "if source is None:\n source = next(self.graph.iternodes())\nself.eulerian_cycle.append(source)\nwhile True:\n ...
<|body_start_0|> self.graph = graph if not self._is_eulerian(): raise ValueError('the graph is not eulerian') self.eulerian_cycle = list() self._graph_copy = self.graph.copy() self._stack = LifoQueue() <|end_body_0|> <|body_start_1|> if source is None: ...
Finding an Eulerian cycle in a multigraph, complexity O(E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private _stack : LIFO queue, private Notes ----- Based on the description from: https://en.wikipedia.org/wiki/Eulerian_path
Hierholzer
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Hierholzer: """Finding an Eulerian cycle in a multigraph, complexity O(E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private _stack : LIFO queue, private Notes ----- Based on the description from: https://en.wikipedia.org/wiki/Eul...
stack_v2_sparse_classes_75kplus_train_071229
4,109
permissive
[ { "docstring": "The algorithm initialization.", "name": "__init__", "signature": "def __init__(self, graph)" }, { "docstring": "Executable pseudocode.", "name": "run", "signature": "def run(self, source=None)" }, { "docstring": "Test if the graph is eulerian.", "name": "_is_e...
3
stack_v2_sparse_classes_30k_train_041383
Implement the Python class `Hierholzer` described below. Class description: Finding an Eulerian cycle in a multigraph, complexity O(E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private _stack : LIFO queue, private Notes ----- Based on the description ...
Implement the Python class `Hierholzer` described below. Class description: Finding an Eulerian cycle in a multigraph, complexity O(E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private _stack : LIFO queue, private Notes ----- Based on the description ...
0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60
<|skeleton|> class Hierholzer: """Finding an Eulerian cycle in a multigraph, complexity O(E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private _stack : LIFO queue, private Notes ----- Based on the description from: https://en.wikipedia.org/wiki/Eul...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Hierholzer: """Finding an Eulerian cycle in a multigraph, complexity O(E). Attributes ---------- graph : input graph eulerian_cycle : list of nodes (length |E|+1) _graph_copy : graph, private _stack : LIFO queue, private Notes ----- Based on the description from: https://en.wikipedia.org/wiki/Eulerian_path"""...
the_stack_v2_python_sparse
graphtheory/eulerian/hierholzer.py
kgashok/graphs-dict
train
0
dae290dc596ba50c544cf9ac06bab4e81b7d2e8e
[ "account_id = self.get_args('id', '')\nif is_empty(account_id):\n self.send_fail_json('用户id不能为空')\n return\nuser = WeiboUser().get_one8id(account_id)\nif not user:\n self.send_fail_json('查无用户')\n return\nuser = self.tran_rowproxy2variable(user)\nuser.pwd = aes_decrypt(user.pwd)\nself.render('weibo/accou...
<|body_start_0|> account_id = self.get_args('id', '') if is_empty(account_id): self.send_fail_json('用户id不能为空') return user = WeiboUser().get_one8id(account_id) if not user: self.send_fail_json('查无用户') return user = self.tran_rowprox...
WeiboUserEditHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeiboUserEditHandler: def get(self, *args, **kwargs): """加载修改微博账号表单页 :param args: :param kwargs: :return:""" <|body_0|> def post(self, *args, **kwargs): """执行修改微博账号 :param args: :param kwargs: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_071230
16,934
no_license
[ { "docstring": "加载修改微博账号表单页 :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, *args, **kwargs)" }, { "docstring": "执行修改微博账号 :param args: :param kwargs: :return:", "name": "post", "signature": "def post(self, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_030137
Implement the Python class `WeiboUserEditHandler` described below. Class description: Implement the WeiboUserEditHandler class. Method signatures and docstrings: - def get(self, *args, **kwargs): 加载修改微博账号表单页 :param args: :param kwargs: :return: - def post(self, *args, **kwargs): 执行修改微博账号 :param args: :param kwargs: :...
Implement the Python class `WeiboUserEditHandler` described below. Class description: Implement the WeiboUserEditHandler class. Method signatures and docstrings: - def get(self, *args, **kwargs): 加载修改微博账号表单页 :param args: :param kwargs: :return: - def post(self, *args, **kwargs): 执行修改微博账号 :param args: :param kwargs: :...
d1714c7f44bae2b7ebce489d3d73df6bd55a5e04
<|skeleton|> class WeiboUserEditHandler: def get(self, *args, **kwargs): """加载修改微博账号表单页 :param args: :param kwargs: :return:""" <|body_0|> def post(self, *args, **kwargs): """执行修改微博账号 :param args: :param kwargs: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WeiboUserEditHandler: def get(self, *args, **kwargs): """加载修改微博账号表单页 :param args: :param kwargs: :return:""" account_id = self.get_args('id', '') if is_empty(account_id): self.send_fail_json('用户id不能为空') return user = WeiboUser().get_one8id(account_id) ...
the_stack_v2_python_sparse
handlers/weibo.py
frankiegu/MarketingManager
train
0
7fab72c1569fbe8c9dafd090a41aade106f49ad7
[ "self.capacity = init_size\nself.size = 0\nself.bucket = [None] * self.capacity", "hashsum = 0\nfor idx, c in enumerate(key):\n hashsum += (idx + len(key)) ** ord(c)\n hashsum = hashsum % self.capacity\nreturn hashsum", "self.size += 1\nindex = self.hash(key)\nnode = self.bucket[index]\nif node is None:\n...
<|body_start_0|> self.capacity = init_size self.size = 0 self.bucket = [None] * self.capacity <|end_body_0|> <|body_start_1|> hashsum = 0 for idx, c in enumerate(key): hashsum += (idx + len(key)) ** ord(c) hashsum = hashsum % self.capacity return ...
hashtable class
HashTable
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HashTable: """hashtable class""" def __init__(self): """initializes the hashtable with a capacity, size and bucket""" <|body_0|> def hash(self, key): """hash method to return an index in the collection for a given key""" <|body_1|> def add(self, key,...
stack_v2_sparse_classes_75kplus_train_071231
1,897
permissive
[ { "docstring": "initializes the hashtable with a capacity, size and bucket", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "hash method to return an index in the collection for a given key", "name": "hash", "signature": "def hash(self, key)" }, { "docstr...
5
stack_v2_sparse_classes_30k_train_028885
Implement the Python class `HashTable` described below. Class description: hashtable class Method signatures and docstrings: - def __init__(self): initializes the hashtable with a capacity, size and bucket - def hash(self, key): hash method to return an index in the collection for a given key - def add(self, key, val...
Implement the Python class `HashTable` described below. Class description: hashtable class Method signatures and docstrings: - def __init__(self): initializes the hashtable with a capacity, size and bucket - def hash(self, key): hash method to return an index in the collection for a given key - def add(self, key, val...
4546a0606334c6e3156b567d8cc82d39fb183c58
<|skeleton|> class HashTable: """hashtable class""" def __init__(self): """initializes the hashtable with a capacity, size and bucket""" <|body_0|> def hash(self, key): """hash method to return an index in the collection for a given key""" <|body_1|> def add(self, key,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HashTable: """hashtable class""" def __init__(self): """initializes the hashtable with a capacity, size and bucket""" self.capacity = init_size self.size = 0 self.bucket = [None] * self.capacity def hash(self, key): """hash method to return an index in the col...
the_stack_v2_python_sparse
data_structures/hashtables/hashtable.py
glasscharlie/data-structures-and-algorithms
train
0
d1ad9e0ce25258cb45dde102948072d218302472
[ "defer.Deferred.__init__(self)\nself.timer = reactor.callLater(timeout, self._timeout)\nother.chainDeferred(self)", "if not self.called:\n self.timer = None\n self.errback(defer.TimeoutError())", "if self.timer:\n self.timer.cancel()\n self.timer = None\nif not self.called:\n defer.Deferred._star...
<|body_start_0|> defer.Deferred.__init__(self) self.timer = reactor.callLater(timeout, self._timeout) other.chainDeferred(self) <|end_body_0|> <|body_start_1|> if not self.called: self.timer = None self.errback(defer.TimeoutError()) <|end_body_1|> <|body_start_2...
A deferred that fires errback if the result doesn't come back in the given time period
TimeoutDeferred
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeoutDeferred: """A deferred that fires errback if the result doesn't come back in the given time period""" def __init__(self, other, timeout): """Wrap the passed deferred and return a new deferred that will timeout @type other: a Deferred @param other: the deferred to wrap @type t...
stack_v2_sparse_classes_75kplus_train_071232
1,707
no_license
[ { "docstring": "Wrap the passed deferred and return a new deferred that will timeout @type other: a Deferred @param other: the deferred to wrap @type timeout: floating point number @param timeout: time, in seconds, to wait before failing the deferred", "name": "__init__", "signature": "def __init__(self...
3
stack_v2_sparse_classes_30k_train_050157
Implement the Python class `TimeoutDeferred` described below. Class description: A deferred that fires errback if the result doesn't come back in the given time period Method signatures and docstrings: - def __init__(self, other, timeout): Wrap the passed deferred and return a new deferred that will timeout @type oth...
Implement the Python class `TimeoutDeferred` described below. Class description: A deferred that fires errback if the result doesn't come back in the given time period Method signatures and docstrings: - def __init__(self, other, timeout): Wrap the passed deferred and return a new deferred that will timeout @type oth...
1ea508c3d2b51742bc3b448c445cd0a3dba9e798
<|skeleton|> class TimeoutDeferred: """A deferred that fires errback if the result doesn't come back in the given time period""" def __init__(self, other, timeout): """Wrap the passed deferred and return a new deferred that will timeout @type other: a Deferred @param other: the deferred to wrap @type t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimeoutDeferred: """A deferred that fires errback if the result doesn't come back in the given time period""" def __init__(self, other, timeout): """Wrap the passed deferred and return a new deferred that will timeout @type other: a Deferred @param other: the deferred to wrap @type timeout: float...
the_stack_v2_python_sparse
Products/ZenUtils/Timeout.py
zenoss/zenoss-prodbin
train
27
b4643d057c94727aab206871daa05d033c2da29a
[ "self.vectors = vec2d\nself.list_index = 0\nself.element_index = 0", "if self.hasNext():\n value = self.vectors[self.list_index][self.element_index]\n self.element_index += 1\n return value", "while self.list_index < len(self.vectors):\n if self.element_index < len(self.vectors[self.list_index]):\n ...
<|body_start_0|> self.vectors = vec2d self.list_index = 0 self.element_index = 0 <|end_body_0|> <|body_start_1|> if self.hasNext(): value = self.vectors[self.list_index][self.element_index] self.element_index += 1 return value <|end_body_1|> <|body_s...
Vector2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_75kplus_train_071233
1,316
no_license
[ { "docstring": "Initialize your data structure here. :type vec2d: List[List[int]]", "name": "__init__", "signature": "def __init__(self, vec2d)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext",...
3
stack_v2_sparse_classes_30k_train_008854
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool <|skeleton|> class V...
086b7c9b3651a0e70c5794f6c264eb975cc90363
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" self.vectors = vec2d self.list_index = 0 self.element_index = 0 def next(self): """:rtype: int""" if self.hasNext(): value = self.vector...
the_stack_v2_python_sparse
flatten_2d_vector.py
chunweiliu/leetcode2
train
4
92ecf0eb0cb72d8b8f5fb884acc346f682ef1844
[ "self.data = None\nself.porter = nltk.PorterStemmer()\nself.stops = set(self.stopwords)", "logging.info('Start reading File')\nif not os.path.isfile(filepath):\n logging.error('File Not Exist!')\n sys.exit()\nif filetype == 'csv':\n df = pd.read_csv(filepath, encoding=encod, header=header)\nelif filetype...
<|body_start_0|> self.data = None self.porter = nltk.PorterStemmer() self.stops = set(self.stopwords) <|end_body_0|> <|body_start_1|> logging.info('Start reading File') if not os.path.isfile(filepath): logging.error('File Not Exist!') sys.exit() i...
SentenceParser
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentenceParser: def __init__(self): """SentenceParser serves to clean text content""" <|body_0|> def read_file(self, filepath, filetype, encod='ISO-8859-1', header=None): """This method is to read csv/json/xlsx files""" <|body_1|> def merge_column(self, ...
stack_v2_sparse_classes_75kplus_train_071234
5,465
permissive
[ { "docstring": "SentenceParser serves to clean text content", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "This method is to read csv/json/xlsx files", "name": "read_file", "signature": "def read_file(self, filepath, filetype, encod='ISO-8859-1', header=None)"...
5
stack_v2_sparse_classes_30k_train_033792
Implement the Python class `SentenceParser` described below. Class description: Implement the SentenceParser class. Method signatures and docstrings: - def __init__(self): SentenceParser serves to clean text content - def read_file(self, filepath, filetype, encod='ISO-8859-1', header=None): This method is to read csv...
Implement the Python class `SentenceParser` described below. Class description: Implement the SentenceParser class. Method signatures and docstrings: - def __init__(self): SentenceParser serves to clean text content - def read_file(self, filepath, filetype, encod='ISO-8859-1', header=None): This method is to read csv...
0fb0e75b83a371130caf43098ec1e5b12326cb25
<|skeleton|> class SentenceParser: def __init__(self): """SentenceParser serves to clean text content""" <|body_0|> def read_file(self, filepath, filetype, encod='ISO-8859-1', header=None): """This method is to read csv/json/xlsx files""" <|body_1|> def merge_column(self, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SentenceParser: def __init__(self): """SentenceParser serves to clean text content""" self.data = None self.porter = nltk.PorterStemmer() self.stops = set(self.stopwords) def read_file(self, filepath, filetype, encod='ISO-8859-1', header=None): """This method is to...
the_stack_v2_python_sparse
services/github-bots/PredictLabels/SentenceParser.py
ChaiBapchya/incubator-mxnet-ci
train
0
fd549edd39667872c6ae35e0d327c52174dcb827
[ "self.positions_list = positions_list\nself.positions_value_list = positions_value_list\nself.num_trial = num_trial", "cumu_ret = 0\nfor i in range(num_invest_per_day):\n random_value = np.random.uniform(0, 1, 1)\n if random_value <= 0.51:\n cumu_ret = cumu_ret + value * 2\nreturn cumu_ret", "posit...
<|body_start_0|> self.positions_list = positions_list self.positions_value_list = positions_value_list self.num_trial = num_trial <|end_body_0|> <|body_start_1|> cumu_ret = 0 for i in range(num_invest_per_day): random_value = np.random.uniform(0, 1, 1) if...
This class will finish the invest procedure and save the results, the total money invest in a single day is 1000
make_single_day_inverstment
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class make_single_day_inverstment: """This class will finish the invest procedure and save the results, the total money invest in a single day is 1000""" def __init__(self, positions_list, positions_value_list, num_trial): """the constructor will accept the paramters of investment""" ...
stack_v2_sparse_classes_75kplus_train_071235
2,505
no_license
[ { "docstring": "the constructor will accept the paramters of investment", "name": "__init__", "signature": "def __init__(self, positions_list, positions_value_list, num_trial)" }, { "docstring": "the method will accept the paramters of investment", "name": "generate_one_day_investment_result...
3
stack_v2_sparse_classes_30k_train_015239
Implement the Python class `make_single_day_inverstment` described below. Class description: This class will finish the invest procedure and save the results, the total money invest in a single day is 1000 Method signatures and docstrings: - def __init__(self, positions_list, positions_value_list, num_trial): the con...
Implement the Python class `make_single_day_inverstment` described below. Class description: This class will finish the invest procedure and save the results, the total money invest in a single day is 1000 Method signatures and docstrings: - def __init__(self, positions_list, positions_value_list, num_trial): the con...
068db95cef0c693ad833fcfe968aa0b5db2162cd
<|skeleton|> class make_single_day_inverstment: """This class will finish the invest procedure and save the results, the total money invest in a single day is 1000""" def __init__(self, positions_list, positions_value_list, num_trial): """the constructor will accept the paramters of investment""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class make_single_day_inverstment: """This class will finish the invest procedure and save the results, the total money invest in a single day is 1000""" def __init__(self, positions_list, positions_value_list, num_trial): """the constructor will accept the paramters of investment""" self.posit...
the_stack_v2_python_sparse
mx419/make_investment_class.py
whirlkick/assignment8
train
0
c6daf1cbe0859bdb3c2964fc84cf2eec9db9f1c5
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Provides recommendations for cloud customers for various categories like performance optimization, cost savings, reliability, feature discovery, etc. These recommendations are generated automatically based on analysis of user resources, configuration and monitoring metrics.
RecommenderServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecommenderServicer: """Provides recommendations for cloud customers for various categories like performance optimization, cost savings, reliability, feature discovery, etc. These recommendations are generated automatically based on analysis of user resources, configuration and monitoring metrics...
stack_v2_sparse_classes_75kplus_train_071236
8,760
permissive
[ { "docstring": "Lists recommendations for a Cloud project. Requires the recommender.*.list IAM permission for the specified recommender.", "name": "ListRecommendations", "signature": "def ListRecommendations(self, request, context)" }, { "docstring": "Gets the requested recommendation. Requires ...
5
null
Implement the Python class `RecommenderServicer` described below. Class description: Provides recommendations for cloud customers for various categories like performance optimization, cost savings, reliability, feature discovery, etc. These recommendations are generated automatically based on analysis of user resource...
Implement the Python class `RecommenderServicer` described below. Class description: Provides recommendations for cloud customers for various categories like performance optimization, cost savings, reliability, feature discovery, etc. These recommendations are generated automatically based on analysis of user resource...
d897d56bce03d1fda98b79afb08264e51d46c421
<|skeleton|> class RecommenderServicer: """Provides recommendations for cloud customers for various categories like performance optimization, cost savings, reliability, feature discovery, etc. These recommendations are generated automatically based on analysis of user resources, configuration and monitoring metrics...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RecommenderServicer: """Provides recommendations for cloud customers for various categories like performance optimization, cost savings, reliability, feature discovery, etc. These recommendations are generated automatically based on analysis of user resources, configuration and monitoring metrics.""" def...
the_stack_v2_python_sparse
recommender/google/cloud/recommender_v1beta1/proto/recommender_service_pb2_grpc.py
tswast/google-cloud-python
train
1
a9ade60aa89a42aa203a50a669b59171ddffa0e7
[ "content = self.get_file_content()\nlabels = []\nfor index in range(self.count):\n labels.append(self.norm(content[index + 8]))\nreturn labels", "label_vec = []\nlabel_value = label\nfor i in range(10):\n if i == label_value:\n label_vec.append(0.9)\n else:\n label_vec.append(0.1)\nreturn l...
<|body_start_0|> content = self.get_file_content() labels = [] for index in range(self.count): labels.append(self.norm(content[index + 8])) return labels <|end_body_0|> <|body_start_1|> label_vec = [] label_value = label for i in range(10): ...
LabelLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelLoader: def load(self): """加载数据文件,获得全部样本的标签向量""" <|body_0|> def norm(self, label): """内部函数,将一个值转换为10维标签向量""" <|body_1|> <|end_skeleton|> <|body_start_0|> content = self.get_file_content() labels = [] for index in range(self.coun...
stack_v2_sparse_classes_75kplus_train_071237
8,172
no_license
[ { "docstring": "加载数据文件,获得全部样本的标签向量", "name": "load", "signature": "def load(self)" }, { "docstring": "内部函数,将一个值转换为10维标签向量", "name": "norm", "signature": "def norm(self, label)" } ]
2
stack_v2_sparse_classes_30k_train_003584
Implement the Python class `LabelLoader` described below. Class description: Implement the LabelLoader class. Method signatures and docstrings: - def load(self): 加载数据文件,获得全部样本的标签向量 - def norm(self, label): 内部函数,将一个值转换为10维标签向量
Implement the Python class `LabelLoader` described below. Class description: Implement the LabelLoader class. Method signatures and docstrings: - def load(self): 加载数据文件,获得全部样本的标签向量 - def norm(self, label): 内部函数,将一个值转换为10维标签向量 <|skeleton|> class LabelLoader: def load(self): """加载数据文件,获得全部样本的标签向量""" ...
50ab9a55dc402f097ce7427b4cc634bc8949ab29
<|skeleton|> class LabelLoader: def load(self): """加载数据文件,获得全部样本的标签向量""" <|body_0|> def norm(self, label): """内部函数,将一个值转换为10维标签向量""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LabelLoader: def load(self): """加载数据文件,获得全部样本的标签向量""" content = self.get_file_content() labels = [] for index in range(self.count): labels.append(self.norm(content[index + 8])) return labels def norm(self, label): """内部函数,将一个值转换为10维标签向量""" ...
the_stack_v2_python_sparse
full_connection(init).py
AIMarkov/tensorflow
train
0
0ed209a66ea7af53b5fa25771035865e4eb0a90b
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
EdgeStorageServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EdgeStorageServicer: """Missing associated documentation comment in .proto file.""" def StoreFeatureMap(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def FetchFeatureMap(self, request, context): """Missing asso...
stack_v2_sparse_classes_75kplus_train_071238
11,728
permissive
[ { "docstring": "Missing associated documentation comment in .proto file.", "name": "StoreFeatureMap", "signature": "def StoreFeatureMap(self, request, context)" }, { "docstring": "Missing associated documentation comment in .proto file.", "name": "FetchFeatureMap", "signature": "def Fetc...
3
stack_v2_sparse_classes_30k_test_002581
Implement the Python class `EdgeStorageServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def StoreFeatureMap(self, request, context): Missing associated documentation comment in .proto file. - def FetchFeatureMap(self, request, c...
Implement the Python class `EdgeStorageServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def StoreFeatureMap(self, request, context): Missing associated documentation comment in .proto file. - def FetchFeatureMap(self, request, c...
dd85efa2d165960e404163dba9aa120b9b7b0e7a
<|skeleton|> class EdgeStorageServicer: """Missing associated documentation comment in .proto file.""" def StoreFeatureMap(self, request, context): """Missing associated documentation comment in .proto file.""" <|body_0|> def FetchFeatureMap(self, request, context): """Missing asso...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EdgeStorageServicer: """Missing associated documentation comment in .proto file.""" def StoreFeatureMap(self, request, context): """Missing associated documentation comment in .proto file.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implement...
the_stack_v2_python_sparse
edge/protos/edge_cloud_pb2_grpc.py
tabVersion/ddnn_with_pruning
train
1
ef5b29cbdda3d986bc0a49599ae11e49545aee8c
[ "a = node\nfor c in reversed(generators):\n target = c.target\n if not isinstance(target, ast.Name):\n raise ValueError(f'Comprehension variable must be a name, but found {target} - {unparse_ast(node)}.')\n if c.is_async:\n raise ValueError(f\"Comprehension can't be async - {unparse_ast(node)...
<|body_start_0|> a = node for c in reversed(generators): target = c.target if not isinstance(target, ast.Name): raise ValueError(f'Comprehension variable must be a name, but found {target} - {unparse_ast(node)}.') if c.is_async: raise V...
syntax_transformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class syntax_transformer: def resolve_generator(self, lambda_body: ast.AST, generators: List[ast.comprehension], node: ast.AST) -> ast.AST: """Translate a list comprehension or a generator to Select statements. `[j.pt() for j in jets] -> jets.Select(lambda j: j.pt())` Args: lambda_body (ast.AS...
stack_v2_sparse_classes_75kplus_train_071239
3,369
no_license
[ { "docstring": "Translate a list comprehension or a generator to Select statements. `[j.pt() for j in jets] -> jets.Select(lambda j: j.pt())` Args: lambda_body (ast.AST): The target of the lambda expression generators (List[ast.comprehension]): The list of generators node (ast.AST): The original AST node Return...
3
null
Implement the Python class `syntax_transformer` described below. Class description: Implement the syntax_transformer class. Method signatures and docstrings: - def resolve_generator(self, lambda_body: ast.AST, generators: List[ast.comprehension], node: ast.AST) -> ast.AST: Translate a list comprehension or a generato...
Implement the Python class `syntax_transformer` described below. Class description: Implement the syntax_transformer class. Method signatures and docstrings: - def resolve_generator(self, lambda_body: ast.AST, generators: List[ast.comprehension], node: ast.AST) -> ast.AST: Translate a list comprehension or a generato...
89713708d8d1dc7234a38d78a6961170f4d26dca
<|skeleton|> class syntax_transformer: def resolve_generator(self, lambda_body: ast.AST, generators: List[ast.comprehension], node: ast.AST) -> ast.AST: """Translate a list comprehension or a generator to Select statements. `[j.pt() for j in jets] -> jets.Select(lambda j: j.pt())` Args: lambda_body (ast.AS...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class syntax_transformer: def resolve_generator(self, lambda_body: ast.AST, generators: List[ast.comprehension], node: ast.AST) -> ast.AST: """Translate a list comprehension or a generator to Select statements. `[j.pt() for j in jets] -> jets.Select(lambda j: j.pt())` Args: lambda_body (ast.AST): The target...
the_stack_v2_python_sparse
func_adl/ast/syntatic_sugar.py
iris-hep/func_adl
train
7
b073e00d222c4dc9a4b2f0f6eee0d73d2e9f24f8
[ "data = request.get_json()\nres, info = containerInfo(projectId, data.get('container_list'))\nif res == '0':\n return ({'containerInfo': info}, 200)\nelse:\n return ({'code': res}, 400)", "data = request.get_json()\nres = deleteContainer(projectId, data.get('container_list'))\nif res == '0':\n return ({}...
<|body_start_0|> data = request.get_json() res, info = containerInfo(projectId, data.get('container_list')) if res == '0': return ({'containerInfo': info}, 200) else: return ({'code': res}, 400) <|end_body_0|> <|body_start_1|> data = request.get_json() ...
ManageContainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageContainer: def get(self, projectId): """get container Spec""" <|body_0|> def delete(self, projectId): """delete containers""" <|body_1|> def post(self, projectId): """start, stop containers""" <|body_2|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_75kplus_train_071240
4,008
no_license
[ { "docstring": "get container Spec", "name": "get", "signature": "def get(self, projectId)" }, { "docstring": "delete containers", "name": "delete", "signature": "def delete(self, projectId)" }, { "docstring": "start, stop containers", "name": "post", "signature": "def po...
3
stack_v2_sparse_classes_30k_train_044520
Implement the Python class `ManageContainer` described below. Class description: Implement the ManageContainer class. Method signatures and docstrings: - def get(self, projectId): get container Spec - def delete(self, projectId): delete containers - def post(self, projectId): start, stop containers
Implement the Python class `ManageContainer` described below. Class description: Implement the ManageContainer class. Method signatures and docstrings: - def get(self, projectId): get container Spec - def delete(self, projectId): delete containers - def post(self, projectId): start, stop containers <|skeleton|> clas...
2cd55cbfb023e79b92dc31a96b9de6d2db138767
<|skeleton|> class ManageContainer: def get(self, projectId): """get container Spec""" <|body_0|> def delete(self, projectId): """delete containers""" <|body_1|> def post(self, projectId): """start, stop containers""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ManageContainer: def get(self, projectId): """get container Spec""" data = request.get_json() res, info = containerInfo(projectId, data.get('container_list')) if res == '0': return ({'containerInfo': info}, 200) else: return ({'code': res}, 400) ...
the_stack_v2_python_sparse
src/projectManager/namespaces/views.py
LCTheo/DeployT_PoC
train
0
d2d9353b05b5e29534ce7b9dde6e62ce57428e07
[ "cur = head\nif cur.val == val:\n return cur.next\nwhile cur.next:\n if cur.next.val == val:\n cur.next = cur.next.next\n return head\n cur = cur.next\nreturn head", "if head.val == val:\n return head.next\nhead.next = self.deleteNode(head.next, val)\nreturn head" ]
<|body_start_0|> cur = head if cur.val == val: return cur.next while cur.next: if cur.next.val == val: cur.next = cur.next.next return head cur = cur.next return head <|end_body_0|> <|body_start_1|> if head.val ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def deleteNode(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_0|> def deleteNode_alter(self, head, val): """更优雅的办法就是用递归,将所有情况都归结为一种:处理删除头结点问题""" <|body_1|> <|end_skeleton|> <|body_start_0|> cur = head ...
stack_v2_sparse_classes_75kplus_train_071241
2,275
no_license
[ { "docstring": ":type head: ListNode :type val: int :rtype: ListNode", "name": "deleteNode", "signature": "def deleteNode(self, head, val)" }, { "docstring": "更优雅的办法就是用递归,将所有情况都归结为一种:处理删除头结点问题", "name": "deleteNode_alter", "signature": "def deleteNode_alter(self, head, val)" } ]
2
stack_v2_sparse_classes_30k_train_031886
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteNode(self, head, val): :type head: ListNode :type val: int :rtype: ListNode - def deleteNode_alter(self, head, val): 更优雅的办法就是用递归,将所有情况都归结为一种:处理删除头结点问题
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def deleteNode(self, head, val): :type head: ListNode :type val: int :rtype: ListNode - def deleteNode_alter(self, head, val): 更优雅的办法就是用递归,将所有情况都归结为一种:处理删除头结点问题 <|skeleton|> cla...
47911c354145d9867774aeb3358de20e55cf89ad
<|skeleton|> class Solution: def deleteNode(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" <|body_0|> def deleteNode_alter(self, head, val): """更优雅的办法就是用递归,将所有情况都归结为一种:处理删除头结点问题""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def deleteNode(self, head, val): """:type head: ListNode :type val: int :rtype: ListNode""" cur = head if cur.val == val: return cur.next while cur.next: if cur.next.val == val: cur.next = cur.next.next return he...
the_stack_v2_python_sparse
rsc/1_easy/offer_18.py
VincentGaoHJ/Sword-For-Offer
train
1
5c98f11ca78bdc472a955c068ef427ac6d13209a
[ "li = []\nfor i in arr:\n if i % 2 == 0 and i / 2 in li or i * 2 in li:\n return True\n li.append(i)\nreturn False", "for i in range(len(arr)):\n if arr[i] * 2 in arr and i != arr.index(arr[i] * 2):\n return True\nreturn False" ]
<|body_start_0|> li = [] for i in arr: if i % 2 == 0 and i / 2 in li or i * 2 in li: return True li.append(i) return False <|end_body_0|> <|body_start_1|> for i in range(len(arr)): if arr[i] * 2 in arr and i != arr.index(arr[i] * 2): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkIfExist(self, arr): """:type arr: List[int] :rtype: bool""" <|body_0|> def checkIfExist(self, arr): """:type arr: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> li = [] for i in arr: if ...
stack_v2_sparse_classes_75kplus_train_071242
558
no_license
[ { "docstring": ":type arr: List[int] :rtype: bool", "name": "checkIfExist", "signature": "def checkIfExist(self, arr)" }, { "docstring": ":type arr: List[int] :rtype: bool", "name": "checkIfExist", "signature": "def checkIfExist(self, arr)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkIfExist(self, arr): :type arr: List[int] :rtype: bool - def checkIfExist(self, arr): :type arr: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkIfExist(self, arr): :type arr: List[int] :rtype: bool - def checkIfExist(self, arr): :type arr: List[int] :rtype: bool <|skeleton|> class Solution: def checkIfExis...
a509b383a42f54313970168d9faa11f088f18708
<|skeleton|> class Solution: def checkIfExist(self, arr): """:type arr: List[int] :rtype: bool""" <|body_0|> def checkIfExist(self, arr): """:type arr: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def checkIfExist(self, arr): """:type arr: List[int] :rtype: bool""" li = [] for i in arr: if i % 2 == 0 and i / 2 in li or i * 2 in li: return True li.append(i) return False def checkIfExist(self, arr): """:type ar...
the_stack_v2_python_sparse
1346_Check_If_N_and_Its_Double_Exist.py
bingli8802/leetcode
train
0
2b43483fe46a177feefa0f9dcf5c2d02b657407c
[ "tmp = sorted((x for i, j, k in trips for x in [[j, i], [k, -i]]))\nfor i, j in tmp:\n capacity -= j\n if capacity < 0:\n return False\nreturn True", "res = [0] * 1001\nfor trip in trips:\n num, start, end = trip\n for i in range(start, end):\n res[i] += num\nfor val in res:\n if val ...
<|body_start_0|> tmp = sorted((x for i, j, k in trips for x in [[j, i], [k, -i]])) for i, j in tmp: capacity -= j if capacity < 0: return False return True <|end_body_0|> <|body_start_1|> res = [0] * 1001 for trip in trips: num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def carPooling(self, trips, capacity): """:type trips: List[List[int]] :type capacity: int :rtype: bool""" <|body_0|> def carPooling2(self, trips, capacity): """:type trips: List[List[int]] :type capacity: int :rtype: bool""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus_train_071243
2,249
no_license
[ { "docstring": ":type trips: List[List[int]] :type capacity: int :rtype: bool", "name": "carPooling", "signature": "def carPooling(self, trips, capacity)" }, { "docstring": ":type trips: List[List[int]] :type capacity: int :rtype: bool", "name": "carPooling2", "signature": "def carPoolin...
2
stack_v2_sparse_classes_30k_train_049424
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def carPooling(self, trips, capacity): :type trips: List[List[int]] :type capacity: int :rtype: bool - def carPooling2(self, trips, capacity): :type trips: List[List[int]] :type ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def carPooling(self, trips, capacity): :type trips: List[List[int]] :type capacity: int :rtype: bool - def carPooling2(self, trips, capacity): :type trips: List[List[int]] :type ...
8595b04cf5a024c2cd8a97f750d890a818568401
<|skeleton|> class Solution: def carPooling(self, trips, capacity): """:type trips: List[List[int]] :type capacity: int :rtype: bool""" <|body_0|> def carPooling2(self, trips, capacity): """:type trips: List[List[int]] :type capacity: int :rtype: bool""" <|body_1|> <|end_skele...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def carPooling(self, trips, capacity): """:type trips: List[List[int]] :type capacity: int :rtype: bool""" tmp = sorted((x for i, j, k in trips for x in [[j, i], [k, -i]])) for i, j in tmp: capacity -= j if capacity < 0: return False ...
the_stack_v2_python_sparse
python/1094.car-pooling.py
tainenko/Leetcode2019
train
5
1852adbb56a7c08dc4a4e555c62da35036eddb7c
[ "self.wind = wind\nself.water = water\nsuper(Langmuir, self).__init__(**kwargs)\nself.array_types.update({'fay_area': gat('fay_area'), 'area': gat('area'), 'bulk_init_volume': gat('bulk_init_volume'), 'age': gat('age'), 'positions': gat('positions'), 'spill_num': gat('spill_num'), 'frac_coverage': gat('frac_coverag...
<|body_start_0|> self.wind = wind self.water = water super(Langmuir, self).__init__(**kwargs) self.array_types.update({'fay_area': gat('fay_area'), 'area': gat('area'), 'bulk_init_volume': gat('bulk_init_volume'), 'age': gat('age'), 'positions': gat('positions'), 'spill_num': gat('spill_...
Easiest to define this as a weathering process that updates 'area' array
Langmuir
[ "LicenseRef-scancode-public-domain", "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Langmuir: """Easiest to define this as a weathering process that updates 'area' array""" def __init__(self, water=None, wind=None, **kwargs): """initialize wind to (0, 0) if it is None""" <|body_0|> def _get_frac_coverage(self, points, model_time, rel_buoy, thickness): ...
stack_v2_sparse_classes_75kplus_train_071244
38,088
permissive
[ { "docstring": "initialize wind to (0, 0) if it is None", "name": "__init__", "signature": "def __init__(self, water=None, wind=None, **kwargs)" }, { "docstring": "return fractional coverage for a blob of oil with inputs; relative_buoyancy, and thickness Assumes the thickness is the minimum oil ...
4
stack_v2_sparse_classes_30k_test_000228
Implement the Python class `Langmuir` described below. Class description: Easiest to define this as a weathering process that updates 'area' array Method signatures and docstrings: - def __init__(self, water=None, wind=None, **kwargs): initialize wind to (0, 0) if it is None - def _get_frac_coverage(self, points, mod...
Implement the Python class `Langmuir` described below. Class description: Easiest to define this as a weathering process that updates 'area' array Method signatures and docstrings: - def __init__(self, water=None, wind=None, **kwargs): initialize wind to (0, 0) if it is None - def _get_frac_coverage(self, points, mod...
97bb561fb8c953c4ee766a3f9d84a41aef93fb28
<|skeleton|> class Langmuir: """Easiest to define this as a weathering process that updates 'area' array""" def __init__(self, water=None, wind=None, **kwargs): """initialize wind to (0, 0) if it is None""" <|body_0|> def _get_frac_coverage(self, points, model_time, rel_buoy, thickness): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Langmuir: """Easiest to define this as a weathering process that updates 'area' array""" def __init__(self, water=None, wind=None, **kwargs): """initialize wind to (0, 0) if it is None""" self.wind = wind self.water = water super(Langmuir, self).__init__(**kwargs) ...
the_stack_v2_python_sparse
py_gnome/gnome/weatherers/spreading.py
NOAA-ORR-ERD/PyGnome
train
45
26c19746cde7be455a4386c1932ab17bc0a88507
[ "nr = choice(range(150))\ninput_file = open(filename).readlines()\nfilename = self._input_filename = 'mfold_in%d.txt' % nr\ndata_file = open(filename, 'w')\ndata_to_file = '\\n'.join([str(d).strip('\\n') for d in input_file])\ndata_file.write(data_to_file)\ndata_file.close()\ndata = '='.join(['SEQ', filename])\nret...
<|body_start_0|> nr = choice(range(150)) input_file = open(filename).readlines() filename = self._input_filename = 'mfold_in%d.txt' % nr data_file = open(filename, 'w') data_to_file = '\n'.join([str(d).strip('\n') for d in input_file]) data_file.write(data_to_file) ...
Application controller for mfold 3.2 application
Mfold
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mfold: """Application controller for mfold 3.2 application""" def _input_as_string(self, filename): """mfold dosen't take full paths so a tmp-file is created in the working dir for mfold to read.""" <|body_0|> def _input_as_lines(self, data): """Uses a fixed tmp ...
stack_v2_sparse_classes_75kplus_train_071245
4,259
permissive
[ { "docstring": "mfold dosen't take full paths so a tmp-file is created in the working dir for mfold to read.", "name": "_input_as_string", "signature": "def _input_as_string(self, filename)" }, { "docstring": "Uses a fixed tmp filename since weird truncation of the generated filename sometimes o...
3
stack_v2_sparse_classes_30k_train_032786
Implement the Python class `Mfold` described below. Class description: Application controller for mfold 3.2 application Method signatures and docstrings: - def _input_as_string(self, filename): mfold dosen't take full paths so a tmp-file is created in the working dir for mfold to read. - def _input_as_lines(self, dat...
Implement the Python class `Mfold` described below. Class description: Application controller for mfold 3.2 application Method signatures and docstrings: - def _input_as_string(self, filename): mfold dosen't take full paths so a tmp-file is created in the working dir for mfold to read. - def _input_as_lines(self, dat...
fe6f8c8dfed86d39c80f2804a753c05bb2e485b4
<|skeleton|> class Mfold: """Application controller for mfold 3.2 application""" def _input_as_string(self, filename): """mfold dosen't take full paths so a tmp-file is created in the working dir for mfold to read.""" <|body_0|> def _input_as_lines(self, data): """Uses a fixed tmp ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Mfold: """Application controller for mfold 3.2 application""" def _input_as_string(self, filename): """mfold dosen't take full paths so a tmp-file is created in the working dir for mfold to read.""" nr = choice(range(150)) input_file = open(filename).readlines() filename =...
the_stack_v2_python_sparse
scripts/venv/lib/python2.7/site-packages/cogent/app/mfold.py
sauloal/cnidaria
train
3
9d98bef6556da0c0ef934ad3d7a2cc47a0cbbbf4
[ "request_data = request.GET\nusername = request.META.get('HTTP_USERNAME')\nif not username:\n username = request.user.username\nsearch_value = request_data.get('search_value', '')\nper_page = int(request_data.get('per_page', 10)) if request_data.get('per_page', 10) else 10\npage = int(request_data.get('page', 1)...
<|body_start_0|> request_data = request.GET username = request.META.get('HTTP_USERNAME') if not username: username = request.user.username search_value = request_data.get('search_value', '') per_page = int(request_data.get('per_page', 10)) if request_data.get('per_pag...
WorkflowCustomNoticeView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkflowCustomNoticeView: def get(self, request, *args, **kwargs): """get worklfow custom notice list 获取工作流通知列表 :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """add notice record 新增通知记录 :param request: :p...
stack_v2_sparse_classes_75kplus_train_071246
48,278
permissive
[ { "docstring": "get worklfow custom notice list 获取工作流通知列表 :param request: :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "add notice record 新增通知记录 :param request: :param args: :param kwargs: :return:", "name": "p...
2
null
Implement the Python class `WorkflowCustomNoticeView` described below. Class description: Implement the WorkflowCustomNoticeView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): get worklfow custom notice list 获取工作流通知列表 :param request: :param args: :param kwargs: :return: - def post...
Implement the Python class `WorkflowCustomNoticeView` described below. Class description: Implement the WorkflowCustomNoticeView class. Method signatures and docstrings: - def get(self, request, *args, **kwargs): get worklfow custom notice list 获取工作流通知列表 :param request: :param args: :param kwargs: :return: - def post...
b0e236b314286c5f6cc6959622c9c8505e776443
<|skeleton|> class WorkflowCustomNoticeView: def get(self, request, *args, **kwargs): """get worklfow custom notice list 获取工作流通知列表 :param request: :param args: :param kwargs: :return:""" <|body_0|> def post(self, request, *args, **kwargs): """add notice record 新增通知记录 :param request: :p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WorkflowCustomNoticeView: def get(self, request, *args, **kwargs): """get worklfow custom notice list 获取工作流通知列表 :param request: :param args: :param kwargs: :return:""" request_data = request.GET username = request.META.get('HTTP_USERNAME') if not username: username ...
the_stack_v2_python_sparse
apps/workflow/views.py
blackholll/loonflow
train
1,864
958bb6fe32ef0457c8bcf6528fd191797b06b29b
[ "super(Playing.SearchForBall, self).__init__()\nself.pan = pan * core.DEG_T_RAD\nself.tilt = tilt\nself.duration = duration", "ball = memory.world_objects.getObjPtr(core.WO_BALL)\nif ball.seen:\n print('Found ball')\n sys.stdout.flush()\n self.finish()\nif self.getTime() > self.duration:\n print('Fini...
<|body_start_0|> super(Playing.SearchForBall, self).__init__() self.pan = pan * core.DEG_T_RAD self.tilt = tilt self.duration = duration <|end_body_0|> <|body_start_1|> ball = memory.world_objects.getObjPtr(core.WO_BALL) if ball.seen: print('Found ball') ...
SearchForBall
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SearchForBall: def __init__(self, pan=0, tilt=0, duration=2.0): """pan: (left/right) in degrees tilt: (up/down) in degrees duration: time in seconds""" <|body_0|> def run(self): """If the ball was seen, then move head towards the ball""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_75kplus_train_071247
7,474
permissive
[ { "docstring": "pan: (left/right) in degrees tilt: (up/down) in degrees duration: time in seconds", "name": "__init__", "signature": "def __init__(self, pan=0, tilt=0, duration=2.0)" }, { "docstring": "If the ball was seen, then move head towards the ball", "name": "run", "signature": "d...
2
stack_v2_sparse_classes_30k_train_033776
Implement the Python class `SearchForBall` described below. Class description: Implement the SearchForBall class. Method signatures and docstrings: - def __init__(self, pan=0, tilt=0, duration=2.0): pan: (left/right) in degrees tilt: (up/down) in degrees duration: time in seconds - def run(self): If the ball was seen...
Implement the Python class `SearchForBall` described below. Class description: Implement the SearchForBall class. Method signatures and docstrings: - def __init__(self, pan=0, tilt=0, duration=2.0): pan: (left/right) in degrees tilt: (up/down) in degrees duration: time in seconds - def run(self): If the ball was seen...
de127ba5d7671fb46b558dbe52fc70a5caeba493
<|skeleton|> class SearchForBall: def __init__(self, pan=0, tilt=0, duration=2.0): """pan: (left/right) in degrees tilt: (up/down) in degrees duration: time in seconds""" <|body_0|> def run(self): """If the ball was seen, then move head towards the ball""" <|body_1|> <|end_ske...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SearchForBall: def __init__(self, pan=0, tilt=0, duration=2.0): """pan: (left/right) in degrees tilt: (up/down) in degrees duration: time in seconds""" super(Playing.SearchForBall, self).__init__() self.pan = pan * core.DEG_T_RAD self.tilt = tilt self.duration = duratio...
the_stack_v2_python_sparse
core/python/behaviors/gaze.py
srama2512/cs393r-latest
train
0
9161659a56b9afedfc88df4c374e23ace8679efc
[ "self.nums = []\nself.size = 0\nself.dataset = {}", "if val in self.dataset:\n return False\nif self.size < len(self.nums):\n self.dataset[val] = self.size\n self.nums[self.size] = val\n self.size += 1\nelse:\n self.nums.append(val)\n self.dataset[val] = self.size\n self.size += 1\nreturn Tru...
<|body_start_0|> self.nums = [] self.size = 0 self.dataset = {} <|end_body_0|> <|body_start_1|> if val in self.dataset: return False if self.size < len(self.nums): self.dataset[val] = self.size self.nums[self.size] = val self.size ...
RandomizedSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val): """Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool""" <|body_1|> ...
stack_v2_sparse_classes_75kplus_train_071248
1,710
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool", "name": "insert", "signature": ...
4
null
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif...
Implement the Python class `RandomizedSet` described below. Class description: Implement the RandomizedSet class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, val): Inserts a value to the set. Returns true if the set did not already contain the specif...
58c295d505293abf76569efeb3ccf92156029af1
<|skeleton|> class RandomizedSet: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, val): """Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int :rtype: bool""" <|body_1|> ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RandomizedSet: def __init__(self): """Initialize your data structure here.""" self.nums = [] self.size = 0 self.dataset = {} def insert(self, val): """Inserts a value to the set. Returns true if the set did not already contain the specified element. :type val: int ...
the_stack_v2_python_sparse
medium/380. Insert Delete GetRandom O(1).py
pkufergus/leetcode
train
0
c4c4bc7fd27b42ba72bb533efa55fa675d1612bb
[ "logger.info('文件查询参数:{}'.format(request.query_params))\ntry:\n obj = ParamsFile.objects.get(pk=pk)\n serializer = ParamsFileSerializer(obj)\n content = request.query_params.get('content', '1')\n if content != '0':\n with open(obj.file.name, encoding=file_encoding) as f:\n code = f.read...
<|body_start_0|> logger.info('文件查询参数:{}'.format(request.query_params)) try: obj = ParamsFile.objects.get(pk=pk) serializer = ParamsFileSerializer(obj) content = request.query_params.get('content', '1') if content != '0': with open(obj.file....
参数文件信息单查询、修改
ParamsFileDetailView
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParamsFileDetailView: """参数文件信息单查询、修改""" def get(self, request, pk): """获取单个文件的信息 如果要获取文件内容,使用content参数,为1,返回内容;为0不返回内容; 默认为1 :param request: :param pk: :return:""" <|body_0|> def delete(self, request, pk): """删除文件记录和文件 :param request: :param pk: :return: 后面要增加用例...
stack_v2_sparse_classes_75kplus_train_071249
5,785
permissive
[ { "docstring": "获取单个文件的信息 如果要获取文件内容,使用content参数,为1,返回内容;为0不返回内容; 默认为1 :param request: :param pk: :return:", "name": "get", "signature": "def get(self, request, pk)" }, { "docstring": "删除文件记录和文件 :param request: :param pk: :return: 后面要增加用例引用文件时不能删除文件的保存", "name": "delete", "signature": "de...
3
stack_v2_sparse_classes_30k_train_015336
Implement the Python class `ParamsFileDetailView` described below. Class description: 参数文件信息单查询、修改 Method signatures and docstrings: - def get(self, request, pk): 获取单个文件的信息 如果要获取文件内容,使用content参数,为1,返回内容;为0不返回内容; 默认为1 :param request: :param pk: :return: - def delete(self, request, pk): 删除文件记录和文件 :param request: :param...
Implement the Python class `ParamsFileDetailView` described below. Class description: 参数文件信息单查询、修改 Method signatures and docstrings: - def get(self, request, pk): 获取单个文件的信息 如果要获取文件内容,使用content参数,为1,返回内容;为0不返回内容; 默认为1 :param request: :param pk: :return: - def delete(self, request, pk): 删除文件记录和文件 :param request: :param...
e0ad3eb2e44c2eae47d2fa9f2c2ca6ab44341149
<|skeleton|> class ParamsFileDetailView: """参数文件信息单查询、修改""" def get(self, request, pk): """获取单个文件的信息 如果要获取文件内容,使用content参数,为1,返回内容;为0不返回内容; 默认为1 :param request: :param pk: :return:""" <|body_0|> def delete(self, request, pk): """删除文件记录和文件 :param request: :param pk: :return: 后面要增加用例...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ParamsFileDetailView: """参数文件信息单查询、修改""" def get(self, request, pk): """获取单个文件的信息 如果要获取文件内容,使用content参数,为1,返回内容;为0不返回内容; 默认为1 :param request: :param pk: :return:""" logger.info('文件查询参数:{}'.format(request.query_params)) try: obj = ParamsFile.objects.get(pk=pk) ...
the_stack_v2_python_sparse
interface_test/api/params_file.py
hejun123456/interface_test_platform
train
0
3ee304f5dbf83615fdad12d56655feca0956d457
[ "self.upper = max(upper, 1)\nself.str_units = str_units\nself.bar_len = bar_len\nself.min_update_ell_time = 1 / 30\nself.start_time = time.perf_counter()\nself.last_update = self.start_time - 1", "if time.perf_counter() - self.last_update > self.min_update_ell_time or value_in == self.upper:\n self.last_update...
<|body_start_0|> self.upper = max(upper, 1) self.str_units = str_units self.bar_len = bar_len self.min_update_ell_time = 1 / 30 self.start_time = time.perf_counter() self.last_update = self.start_time - 1 <|end_body_0|> <|body_start_1|> if time.perf_counter() - s...
Displays a simple progress bar in the console. No other prints with should be used as this relies in ' '
CmdProgressBar
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CmdProgressBar: """Displays a simple progress bar in the console. No other prints with should be used as this relies in ' '""" def __init__(self, upper=1, str_units='', bar_len=30): """Class constructor :param upper: Int value associated with 100% progress :param str_units: String ap...
stack_v2_sparse_classes_75kplus_train_071250
2,154
permissive
[ { "docstring": "Class constructor :param upper: Int value associated with 100% progress :param str_units: String appended before progress numbers :param bar_len: Bar width in characters", "name": "__init__", "signature": "def __init__(self, upper=1, str_units='', bar_len=30)" }, { "docstring": "...
2
stack_v2_sparse_classes_30k_train_044560
Implement the Python class `CmdProgressBar` described below. Class description: Displays a simple progress bar in the console. No other prints with should be used as this relies in ' ' Method signatures and docstrings: - def __init__(self, upper=1, str_units='', bar_len=30): Class constructor :param upper: Int value ...
Implement the Python class `CmdProgressBar` described below. Class description: Displays a simple progress bar in the console. No other prints with should be used as this relies in ' ' Method signatures and docstrings: - def __init__(self, upper=1, str_units='', bar_len=30): Class constructor :param upper: Int value ...
e3296b7bb71c46f62696cd221968d2e0b3e76a7f
<|skeleton|> class CmdProgressBar: """Displays a simple progress bar in the console. No other prints with should be used as this relies in ' '""" def __init__(self, upper=1, str_units='', bar_len=30): """Class constructor :param upper: Int value associated with 100% progress :param str_units: String ap...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CmdProgressBar: """Displays a simple progress bar in the console. No other prints with should be used as this relies in ' '""" def __init__(self, upper=1, str_units='', bar_len=30): """Class constructor :param upper: Int value associated with 100% progress :param str_units: String appended before...
the_stack_v2_python_sparse
src/cmdInterface/cmdProgressBar.py
Santi-hr/Acronymate
train
4
f8867f2d69751f84fa1d61451ca1d884430197ea
[ "self.fn = ''\nself.pt_id = 'X X X X' + ' ' * 73\nself.rec_info = 'Startdate X X X X' + ' ' * 63\nself.start_date = '01.01.01'\nself.start_time = '01.01.01'\nself.py_h = 2\nself.pyedf_header = {'technician': '002', 'recording_additional': '', 'patientname': '', 'patient_additional': '', 'patientcode': '', 'equipmen...
<|body_start_0|> self.fn = '' self.pt_id = 'X X X X' + ' ' * 73 self.rec_info = 'Startdate X X X X' + ' ' * 63 self.start_date = '01.01.01' self.start_time = '01.01.01' self.py_h = 2 self.pyedf_header = {'technician': '002', 'recording_additional': '', 'patientnam...
Data structure for holding information for saving to edf namely the anonymized header
SaveEdfInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaveEdfInfo: """Data structure for holding information for saving to edf namely the anonymized header""" def __init__(self): """Header parameters set to default values""" <|body_0|> def convert_to_header(self): """Converts from native EDF format: self.data.pt_id ...
stack_v2_sparse_classes_75kplus_train_071251
3,114
no_license
[ { "docstring": "Header parameters set to default values", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Converts from native EDF format: self.data.pt_id = file[8:88].decode(\"utf-8\") self.data.rec_info = file[88:168].decode(\"utf-8\") self.data.start_date = file[168:1...
2
stack_v2_sparse_classes_30k_train_038568
Implement the Python class `SaveEdfInfo` described below. Class description: Data structure for holding information for saving to edf namely the anonymized header Method signatures and docstrings: - def __init__(self): Header parameters set to default values - def convert_to_header(self): Converts from native EDF for...
Implement the Python class `SaveEdfInfo` described below. Class description: Data structure for holding information for saving to edf namely the anonymized header Method signatures and docstrings: - def __init__(self): Header parameters set to default values - def convert_to_header(self): Converts from native EDF for...
099920716fdab891592ccc7f324445f088827298
<|skeleton|> class SaveEdfInfo: """Data structure for holding information for saving to edf namely the anonymized header""" def __init__(self): """Header parameters set to default values""" <|body_0|> def convert_to_header(self): """Converts from native EDF format: self.data.pt_id ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SaveEdfInfo: """Data structure for holding information for saving to edf namely the anonymized header""" def __init__(self): """Header parameters set to default values""" self.fn = '' self.pt_id = 'X X X X' + ' ' * 73 self.rec_info = 'Startdate X X X X' + ' ' * 63 ...
the_stack_v2_python_sparse
visualization/edf_saving/saveEdf_info.py
jcraley/jhu-eeg
train
2
f7a3744a6d85d56fcd32f763d9fe461b8cd2e471
[ "self.hab = hab\nself.msg = msg\nself.wits = wits if wits is not None else self.hab.kever.wits\nself.klas = klas if klas is not None else HttpWitnesser\nsuper(WitnessPublisher, self).__init__(doers=[doing.doify(self.sendDo)], **kwa)", "self.wind(tymth)\nself.tock = tock\n_ = (yield self.tock)\nif len(self.wits) =...
<|body_start_0|> self.hab = hab self.msg = msg self.wits = wits if wits is not None else self.hab.kever.wits self.klas = klas if klas is not None else HttpWitnesser super(WitnessPublisher, self).__init__(doers=[doing.doify(self.sendDo)], **kwa) <|end_body_0|> <|body_start_1|> ...
Sends messages to all current witnesses of given identifier (from hab) and exits. Removes all Doers and exits as Done once all witnesses have been sent the message. Could be enhanced to have a `once` method that runs once and cleans up and an `all` method that runs and waits for more messages to receipt.
WitnessPublisher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WitnessPublisher: """Sends messages to all current witnesses of given identifier (from hab) and exits. Removes all Doers and exits as Done once all witnesses have been sent the message. Could be enhanced to have a `once` method that runs once and cleans up and an `all` method that runs and waits ...
stack_v2_sparse_classes_75kplus_train_071252
41,568
permissive
[ { "docstring": "For the current event, gather the current set of witnesses, send the event, gather all receipts and send them to all other witnesses Parameters: hab: Habitat of the identifier to populate witnesses msg: is the message to send to all witnesses. Defaults to sending the latest KEL event if msg is N...
2
null
Implement the Python class `WitnessPublisher` described below. Class description: Sends messages to all current witnesses of given identifier (from hab) and exits. Removes all Doers and exits as Done once all witnesses have been sent the message. Could be enhanced to have a `once` method that runs once and cleans up a...
Implement the Python class `WitnessPublisher` described below. Class description: Sends messages to all current witnesses of given identifier (from hab) and exits. Removes all Doers and exits as Done once all witnesses have been sent the message. Could be enhanced to have a `once` method that runs once and cleans up a...
467f952912b17dede8a8f4ebce73241408b63e8c
<|skeleton|> class WitnessPublisher: """Sends messages to all current witnesses of given identifier (from hab) and exits. Removes all Doers and exits as Done once all witnesses have been sent the message. Could be enhanced to have a `once` method that runs once and cleans up and an `all` method that runs and waits ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WitnessPublisher: """Sends messages to all current witnesses of given identifier (from hab) and exits. Removes all Doers and exits as Done once all witnesses have been sent the message. Could be enhanced to have a `once` method that runs once and cleans up and an `all` method that runs and waits for more mess...
the_stack_v2_python_sparse
src/keri/app/agenting.py
dlandi/keripy-1
train
0
e23103db6580e70ff950ad32bc07eb61fffbc98c
[ "super().__init__(**kwargs)\nif kernel not in self.kernel_fn_dict:\n raise ValueError(f'Kernel {kernel} is not supported.Supported kernels are {list(self.kernel_fn_dict.keys())}')\nif scales is not None and (not isinstance(scales, list)):\n scales = [scales]\nself.scales = scales\nself.kernel = kernel", "if...
<|body_start_0|> super().__init__(**kwargs) if kernel not in self.kernel_fn_dict: raise ValueError(f'Kernel {kernel} is not supported.Supported kernels are {list(self.kernel_fn_dict.keys())}') if scales is not None and (not isinstance(scales, list)): scales = [scales] ...
Mixin class for multi-scale loss. It applies the loss at different scales (gaussian or cauchy smoothing). It is assumed that loss values are between 0 and 1.
MultiScaleMixin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiScaleMixin: """Mixin class for multi-scale loss. It applies the loss at different scales (gaussian or cauchy smoothing). It is assumed that loss values are between 0 and 1.""" def __init__(self, scales: Optional[Union[List, float, int]]=None, kernel: str='gaussian', **kwargs): "...
stack_v2_sparse_classes_75kplus_train_071253
4,702
permissive
[ { "docstring": "Init. :param scales: list of scalars or None, if None, do not apply any scaling. :param kernel: gaussian or cauchy. :param kwargs: additional arguments.", "name": "__init__", "signature": "def __init__(self, scales: Optional[Union[List, float, int]]=None, kernel: str='gaussian', **kwargs...
3
stack_v2_sparse_classes_30k_train_009487
Implement the Python class `MultiScaleMixin` described below. Class description: Mixin class for multi-scale loss. It applies the loss at different scales (gaussian or cauchy smoothing). It is assumed that loss values are between 0 and 1. Method signatures and docstrings: - def __init__(self, scales: Optional[Union[L...
Implement the Python class `MultiScaleMixin` described below. Class description: Mixin class for multi-scale loss. It applies the loss at different scales (gaussian or cauchy smoothing). It is assumed that loss values are between 0 and 1. Method signatures and docstrings: - def __init__(self, scales: Optional[Union[L...
650a2f1a88ad3c6932be305d6a98a36e26feedc6
<|skeleton|> class MultiScaleMixin: """Mixin class for multi-scale loss. It applies the loss at different scales (gaussian or cauchy smoothing). It is assumed that loss values are between 0 and 1.""" def __init__(self, scales: Optional[Union[List, float, int]]=None, kernel: str='gaussian', **kwargs): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiScaleMixin: """Mixin class for multi-scale loss. It applies the loss at different scales (gaussian or cauchy smoothing). It is assumed that loss values are between 0 and 1.""" def __init__(self, scales: Optional[Union[List, float, int]]=None, kernel: str='gaussian', **kwargs): """Init. :para...
the_stack_v2_python_sparse
deepreg/loss/util.py
DeepRegNet/DeepReg
train
509
39c6327c080b1244927bd0096f3c7ae6524ae792
[ "ksession = keystone.KeystoneSession('neutron')\nif not cls.neutron_client:\n sess = ksession.get_session()\n kwargs = {}\n if CONF.neutron.endpoint_override:\n kwargs['network_endpoint_override'] = CONF.neutron.endpoint_override\n conn = openstack.connection.Connection(session=sess, **kwargs)\n ...
<|body_start_0|> ksession = keystone.KeystoneSession('neutron') if not cls.neutron_client: sess = ksession.get_session() kwargs = {} if CONF.neutron.endpoint_override: kwargs['network_endpoint_override'] = CONF.neutron.endpoint_override con...
NeutronAuth
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeutronAuth: def get_neutron_client(cls): """Create neutron client object.""" <|body_0|> def get_user_neutron_client(cls, context): """Get neutron client for request user. It's possible that the token in the context is a trust scoped which can't be used to initialize...
stack_v2_sparse_classes_75kplus_train_071254
7,471
permissive
[ { "docstring": "Create neutron client object.", "name": "get_neutron_client", "signature": "def get_neutron_client(cls)" }, { "docstring": "Get neutron client for request user. It's possible that the token in the context is a trust scoped which can't be used to initialize a keystone session. We ...
2
stack_v2_sparse_classes_30k_train_013954
Implement the Python class `NeutronAuth` described below. Class description: Implement the NeutronAuth class. Method signatures and docstrings: - def get_neutron_client(cls): Create neutron client object. - def get_user_neutron_client(cls, context): Get neutron client for request user. It's possible that the token in...
Implement the Python class `NeutronAuth` described below. Class description: Implement the NeutronAuth class. Method signatures and docstrings: - def get_neutron_client(cls): Create neutron client object. - def get_user_neutron_client(cls, context): Get neutron client for request user. It's possible that the token in...
0426285a41464a5015494584f109eed35a0d44db
<|skeleton|> class NeutronAuth: def get_neutron_client(cls): """Create neutron client object.""" <|body_0|> def get_user_neutron_client(cls, context): """Get neutron client for request user. It's possible that the token in the context is a trust scoped which can't be used to initialize...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NeutronAuth: def get_neutron_client(cls): """Create neutron client object.""" ksession = keystone.KeystoneSession('neutron') if not cls.neutron_client: sess = ksession.get_session() kwargs = {} if CONF.neutron.endpoint_override: kwarg...
the_stack_v2_python_sparse
octavia/common/clients.py
openstack/octavia
train
147
2efafc367817221372d535d2efc35a850386f5db
[ "default_options = Options(**{constants().Name: Names().FEMComponent, constants().WeightFunction: None, constants().ReferenceElement: True, constants().Line: 0, constants().Column: 0})\nwhole_options = default_options << options\nsuper(IFEM, self).__init__(whole_options, **kw)", "self.line = arguments[constants()...
<|body_start_0|> default_options = Options(**{constants().Name: Names().FEMComponent, constants().WeightFunction: None, constants().ReferenceElement: True, constants().Line: 0, constants().Column: 0}) whole_options = default_options << options super(IFEM, self).__init__(whole_options, **kw) <|en...
IFEM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IFEM: def __init__(self, options=Options(), **kw): """Class initializer. Use it's Base Class initializer and adds the weight function to be used.""" <|body_0|> def __call__(self, **arguments): """Add supports for the call method. The difference is that it requires th...
stack_v2_sparse_classes_75kplus_train_071255
2,012
no_license
[ { "docstring": "Class initializer. Use it's Base Class initializer and adds the weight function to be used.", "name": "__init__", "signature": "def __init__(self, options=Options(), **kw)" }, { "docstring": "Add supports for the call method. The difference is that it requires the line and column...
2
null
Implement the Python class `IFEM` described below. Class description: Implement the IFEM class. Method signatures and docstrings: - def __init__(self, options=Options(), **kw): Class initializer. Use it's Base Class initializer and adds the weight function to be used. - def __call__(self, **arguments): Add supports f...
Implement the Python class `IFEM` described below. Class description: Implement the IFEM class. Method signatures and docstrings: - def __init__(self, options=Options(), **kw): Class initializer. Use it's Base Class initializer and adds the weight function to be used. - def __call__(self, **arguments): Add supports f...
66258b1669337f13cdb8d5bf48825e1f6dbfa294
<|skeleton|> class IFEM: def __init__(self, options=Options(), **kw): """Class initializer. Use it's Base Class initializer and adds the weight function to be used.""" <|body_0|> def __call__(self, **arguments): """Add supports for the call method. The difference is that it requires th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IFEM: def __init__(self, options=Options(), **kw): """Class initializer. Use it's Base Class initializer and adds the weight function to be used.""" default_options = Options(**{constants().Name: Names().FEMComponent, constants().WeightFunction: None, constants().ReferenceElement: True, consta...
the_stack_v2_python_sparse
NeuroCore/Equations/Component/FEM/Base.py
dabrunhosa/PhD_Program
train
0
f9f17ef6f78d6bc1b3c37917b34979bc1acdaaab
[ "from itertools import combinations\nmax_val = 0\nfor i in combinations(enumerate(height), 2):\n val = abs(i[0][0] - i[1][0]) * min([i[0][1], i[1][1]])\n if val > max_val:\n max_val = val\nreturn max_val", "i = 0\nj = len(height) - 1\nmax_val = 0\nwhile i < j:\n if height[i] < height[j]:\n ...
<|body_start_0|> from itertools import combinations max_val = 0 for i in combinations(enumerate(height), 2): val = abs(i[0][0] - i[1][0]) * min([i[0][1], i[1][1]]) if val > max_val: max_val = val return max_val <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxArea2(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> from itertools import combinations m...
stack_v2_sparse_classes_75kplus_train_071256
871
no_license
[ { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea2", "signature": "def maxArea2(self, height)" }, { "docstring": ":type height: List[int] :rtype: int", "name": "maxArea", "signature": "def maxArea(self, height)" } ]
2
stack_v2_sparse_classes_30k_train_053363
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea2(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxArea2(self, height): :type height: List[int] :rtype: int - def maxArea(self, height): :type height: List[int] :rtype: int <|skeleton|> class Solution: def maxArea2(s...
4bbcfbe0765226693461d02ec54995b5f79046a8
<|skeleton|> class Solution: def maxArea2(self, height): """:type height: List[int] :rtype: int""" <|body_0|> def maxArea(self, height): """:type height: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxArea2(self, height): """:type height: List[int] :rtype: int""" from itertools import combinations max_val = 0 for i in combinations(enumerate(height), 2): val = abs(i[0][0] - i[1][0]) * min([i[0][1], i[1][1]]) if val > max_val: ...
the_stack_v2_python_sparse
11_py3/main.py
reece15/leetcode
train
0
cf929f5a18ad3789f7a86ddd26c0fe42368527a5
[ "self.env.revert_snapshot('ready_with_3_slaves')\nself.prepare_plugin()\nself.helpers.create_cluster(name=self.__class__.__name__)\nself.activate_plugin()", "self.check_run('deploy_zabbix_monitoring_ha')\nself.env.revert_snapshot('ready_with_5_slaves')\nself.prepare_plugin()\nself.helpers.create_cluster(name=self...
<|body_start_0|> self.env.revert_snapshot('ready_with_3_slaves') self.prepare_plugin() self.helpers.create_cluster(name=self.__class__.__name__) self.activate_plugin() <|end_body_0|> <|body_start_1|> self.check_run('deploy_zabbix_monitoring_ha') self.env.revert_snapshot(...
Class for smoke testing the zabbix plugin.
TestZabbix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestZabbix: """Class for smoke testing the zabbix plugin.""" def install_zabbix(self): """Install Zabbix plugin and check it exists Scenario: 1. Upload Zabbix plugin to the master node 2. Install the plugin 3. Create a cluster 4. Check that the plugin can be enabled Duration 20m""" ...
stack_v2_sparse_classes_75kplus_train_071257
4,155
no_license
[ { "docstring": "Install Zabbix plugin and check it exists Scenario: 1. Upload Zabbix plugin to the master node 2. Install the plugin 3. Create a cluster 4. Check that the plugin can be enabled Duration 20m", "name": "install_zabbix", "signature": "def install_zabbix(self)" }, { "docstring": "Dep...
4
stack_v2_sparse_classes_30k_train_022942
Implement the Python class `TestZabbix` described below. Class description: Class for smoke testing the zabbix plugin. Method signatures and docstrings: - def install_zabbix(self): Install Zabbix plugin and check it exists Scenario: 1. Upload Zabbix plugin to the master node 2. Install the plugin 3. Create a cluster ...
Implement the Python class `TestZabbix` described below. Class description: Class for smoke testing the zabbix plugin. Method signatures and docstrings: - def install_zabbix(self): Install Zabbix plugin and check it exists Scenario: 1. Upload Zabbix plugin to the master node 2. Install the plugin 3. Create a cluster ...
179249df2d206eeabb3955c9dc8cb78cac3c36c6
<|skeleton|> class TestZabbix: """Class for smoke testing the zabbix plugin.""" def install_zabbix(self): """Install Zabbix plugin and check it exists Scenario: 1. Upload Zabbix plugin to the master node 2. Install the plugin 3. Create a cluster 4. Check that the plugin can be enabled Duration 20m""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestZabbix: """Class for smoke testing the zabbix plugin.""" def install_zabbix(self): """Install Zabbix plugin and check it exists Scenario: 1. Upload Zabbix plugin to the master node 2. Install the plugin 3. Create a cluster 4. Check that the plugin can be enabled Duration 20m""" self.e...
the_stack_v2_python_sparse
stacklight_tests/zabbix/test_smoke_bvt.py
rkhozinov/stacklight-integration-tests
train
1
127f83acd5ee432d16a68119a40c8040ad243f22
[ "super(Asteroid, self).__init__(image=Asteroid.images[size], x=x, y=y, dx=random.choice([1, -1]) * Asteroid.SPEED * random.random() / size, dy=random.choice([1, -1]) * Asteroid.SPEED * random.random() / size)\nself.size = size\nself.HEALTH = size\nself.game = game\nAsteroid.total += 1", "super(Asteroid, self).upd...
<|body_start_0|> super(Asteroid, self).__init__(image=Asteroid.images[size], x=x, y=y, dx=random.choice([1, -1]) * Asteroid.SPEED * random.random() / size, dy=random.choice([1, -1]) * Asteroid.SPEED * random.random() / size) self.size = size self.HEALTH = size self.game = game As...
An asteroid which floats across the screen
Asteroid
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Asteroid: """An asteroid which floats across the screen""" def __init__(self, game, x, y, size): """Initialise asteroid sprite""" <|body_0|> def update(self): """Reduced health""" <|body_1|> def die(self): """Destroy the asteroid and make mor...
stack_v2_sparse_classes_75kplus_train_071258
10,021
no_license
[ { "docstring": "Initialise asteroid sprite", "name": "__init__", "signature": "def __init__(self, game, x, y, size)" }, { "docstring": "Reduced health", "name": "update", "signature": "def update(self)" }, { "docstring": "Destroy the asteroid and make more", "name": "die", ...
3
stack_v2_sparse_classes_30k_train_034223
Implement the Python class `Asteroid` described below. Class description: An asteroid which floats across the screen Method signatures and docstrings: - def __init__(self, game, x, y, size): Initialise asteroid sprite - def update(self): Reduced health - def die(self): Destroy the asteroid and make more
Implement the Python class `Asteroid` described below. Class description: An asteroid which floats across the screen Method signatures and docstrings: - def __init__(self, game, x, y, size): Initialise asteroid sprite - def update(self): Reduced health - def die(self): Destroy the asteroid and make more <|skeleton|>...
1608cec3387e5a2f25b43165dcb5f109f0898969
<|skeleton|> class Asteroid: """An asteroid which floats across the screen""" def __init__(self, game, x, y, size): """Initialise asteroid sprite""" <|body_0|> def update(self): """Reduced health""" <|body_1|> def die(self): """Destroy the asteroid and make mor...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Asteroid: """An asteroid which floats across the screen""" def __init__(self, game, x, y, size): """Initialise asteroid sprite""" super(Asteroid, self).__init__(image=Asteroid.images[size], x=x, y=y, dx=random.choice([1, -1]) * Asteroid.SPEED * random.random() / size, dy=random.choice([1,...
the_stack_v2_python_sparse
Chapter 12/Asteroids08.py
doddydad/python-for-the-absolute-beginner-3rd-ed
train
0
d4b89a1e47ca2e68f30f2b27104a5fd56b5810f6
[ "self.expect_timeout = 20\nself.telnet_handle = None\nself.prompt = 'ready>\\\\s?'\nif system_data:\n self.host_args = dict()\n sys_pri = system_data['system']['primary']\n if 'name' in sys_pri:\n self.host_args['host'] = sys_pri['name']\n controller_key = list(sys_pri['controllers'].keys())[0]\n...
<|body_start_0|> self.expect_timeout = 20 self.telnet_handle = None self.prompt = 'ready>\\s?' if system_data: self.host_args = dict() sys_pri = system_data['system']['primary'] if 'name' in sys_pri: self.host_args['host'] = sys_pri['na...
IxVeriwave emulation class
IxVeriwave
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IxVeriwave: """IxVeriwave emulation class""" def __init__(self, system_data=None): """IxVeriwave abstraction layer :param system_data *MANDATORY* Dictionary of IxVeriwave information Example: system_data = system: primary: controllers: re0: domain: englab.juniper.net hostname: branch...
stack_v2_sparse_classes_75kplus_train_071259
5,859
no_license
[ { "docstring": "IxVeriwave abstraction layer :param system_data *MANDATORY* Dictionary of IxVeriwave information Example: system_data = system: primary: controllers: re0: domain: englab.juniper.net hostname: branch-ixveriwave isoaddr: 47.0005.80ff.f800.0000.0108.0001.0102.5523.0232.00 loop-ip: 10.255.230.232 lo...
3
stack_v2_sparse_classes_30k_train_000609
Implement the Python class `IxVeriwave` described below. Class description: IxVeriwave emulation class Method signatures and docstrings: - def __init__(self, system_data=None): IxVeriwave abstraction layer :param system_data *MANDATORY* Dictionary of IxVeriwave information Example: system_data = system: primary: cont...
Implement the Python class `IxVeriwave` described below. Class description: IxVeriwave emulation class Method signatures and docstrings: - def __init__(self, system_data=None): IxVeriwave abstraction layer :param system_data *MANDATORY* Dictionary of IxVeriwave information Example: system_data = system: primary: cont...
3966c63d48557b0b94303896eed7a767593a4832
<|skeleton|> class IxVeriwave: """IxVeriwave emulation class""" def __init__(self, system_data=None): """IxVeriwave abstraction layer :param system_data *MANDATORY* Dictionary of IxVeriwave information Example: system_data = system: primary: controllers: re0: domain: englab.juniper.net hostname: branch...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IxVeriwave: """IxVeriwave emulation class""" def __init__(self, system_data=None): """IxVeriwave abstraction layer :param system_data *MANDATORY* Dictionary of IxVeriwave information Example: system_data = system: primary: controllers: re0: domain: englab.juniper.net hostname: branch-ixveriwave i...
the_stack_v2_python_sparse
NITA/lib/jnpr/toby/hldcl/trafficgen/ixia/ixveriwave.py
fengyun4623/file
train
0
07a67dc383eb73700592342f6236403dd1cf8ef5
[ "if not isinstance(input_shape, Iterable):\n input_shape = (input_shape,)\nif not isinstance(output_shape, Iterable):\n output_shape = (output_shape,)\nself.input_shape = input_shape\nself.output_shape = output_shape\nself.kernel = np.zeros(input_shape + output_shape)\nself.bias = np.zeros(output_shape)", "...
<|body_start_0|> if not isinstance(input_shape, Iterable): input_shape = (input_shape,) if not isinstance(output_shape, Iterable): output_shape = (output_shape,) self.input_shape = input_shape self.output_shape = output_shape self.kernel = np.zeros(input_s...
Predict linear combination
Linear
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Linear: """Predict linear combination""" def __init__(self, input_shape, output_shape): """init""" <|body_0|> def __call__(self, x): """call""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not isinstance(input_shape, Iterable): in...
stack_v2_sparse_classes_75kplus_train_071260
1,500
permissive
[ { "docstring": "init", "name": "__init__", "signature": "def __init__(self, input_shape, output_shape)" }, { "docstring": "call", "name": "__call__", "signature": "def __call__(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_052947
Implement the Python class `Linear` described below. Class description: Predict linear combination Method signatures and docstrings: - def __init__(self, input_shape, output_shape): init - def __call__(self, x): call
Implement the Python class `Linear` described below. Class description: Predict linear combination Method signatures and docstrings: - def __init__(self, input_shape, output_shape): init - def __call__(self, x): call <|skeleton|> class Linear: """Predict linear combination""" def __init__(self, input_shape,...
5be08e2fa4ef8cad9a3c1d4134c13acf4c68637f
<|skeleton|> class Linear: """Predict linear combination""" def __init__(self, input_shape, output_shape): """init""" <|body_0|> def __call__(self, x): """call""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Linear: """Predict linear combination""" def __init__(self, input_shape, output_shape): """init""" if not isinstance(input_shape, Iterable): input_shape = (input_shape,) if not isinstance(output_shape, Iterable): output_shape = (output_shape,) self....
the_stack_v2_python_sparse
timecast/modules/_linear.py
NeoTim/timecast
train
0
45bbf26a7c8806afc1ba58bebe5c39579533d567
[ "if not self._errors:\n self._errors = ErrorDict()\nself._errors['upload_of_work'] = self.error_class([self.DEF_NO_UPLOAD])", "cleaned_data = self.cleaned_data\nupload = cleaned_data.get('upload_of_work')\nif not upload:\n raise gsoc_forms.ValidationError(self.DEF_NO_UPLOAD)\nreturn upload" ]
<|body_start_0|> if not self._errors: self._errors = ErrorDict() self._errors['upload_of_work'] = self.error_class([self.DEF_NO_UPLOAD]) <|end_body_0|> <|body_start_1|> cleaned_data = self.cleaned_data upload = cleaned_data.get('upload_of_work') if not upload: ...
Django form for submitting code samples for a project.
CodeSampleUploadFileForm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CodeSampleUploadFileForm: """Django form for submitting code samples for a project.""" def addFileRequiredError(self): """Appends a form error message indicating that this field is required.""" <|body_0|> def clean_upload_of_work(self): """Ensure that file field ...
stack_v2_sparse_classes_75kplus_train_071261
21,398
permissive
[ { "docstring": "Appends a form error message indicating that this field is required.", "name": "addFileRequiredError", "signature": "def addFileRequiredError(self)" }, { "docstring": "Ensure that file field has data.", "name": "clean_upload_of_work", "signature": "def clean_upload_of_wor...
2
stack_v2_sparse_classes_30k_test_001800
Implement the Python class `CodeSampleUploadFileForm` described below. Class description: Django form for submitting code samples for a project. Method signatures and docstrings: - def addFileRequiredError(self): Appends a form error message indicating that this field is required. - def clean_upload_of_work(self): En...
Implement the Python class `CodeSampleUploadFileForm` described below. Class description: Django form for submitting code samples for a project. Method signatures and docstrings: - def addFileRequiredError(self): Appends a form error message indicating that this field is required. - def clean_upload_of_work(self): En...
f581989f168189fa3a58c028eff327a16c03e438
<|skeleton|> class CodeSampleUploadFileForm: """Django form for submitting code samples for a project.""" def addFileRequiredError(self): """Appends a form error message indicating that this field is required.""" <|body_0|> def clean_upload_of_work(self): """Ensure that file field ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CodeSampleUploadFileForm: """Django form for submitting code samples for a project.""" def addFileRequiredError(self): """Appends a form error message indicating that this field is required.""" if not self._errors: self._errors = ErrorDict() self._errors['upload_of_wor...
the_stack_v2_python_sparse
app/soc/modules/gsoc/views/project_details.py
sambitgaan/nupic.son
train
0
368805339ecb374d96d348d36e86426af6571248
[ "format_file = DataSaver.FORMAT_CSV\nkwargs = locals()\n_apply_datasaver(format_file, kwargs, last_uuid)\nreturn None", "format_file = DataSaver.FORMAT_JSON\nkwargs = locals()\n_apply_datasaver(format_file, kwargs, last_uuid)\nreturn None", "format_file = DataSaver.FORMAT_PARQUET\nkwargs = locals()\n_apply_data...
<|body_start_0|> format_file = DataSaver.FORMAT_CSV kwargs = locals() _apply_datasaver(format_file, kwargs, last_uuid) return None <|end_body_0|> <|body_start_1|> format_file = DataSaver.FORMAT_JSON kwargs = locals() _apply_datasaver(format_file, kwargs, last_uui...
Save
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Save: def csv(filepath, header=True, mode=DataSaver.MODE_OVERWRITE, sep=',', na_rep='', float_format=None, columns=None, encoding=None, quoting=None, quotechar='"', date_format=None, doublequote=True, escapechar=None, decimal='.'): """Saves a csv file. :param filepath: :param header: :pa...
stack_v2_sparse_classes_75kplus_train_071262
3,936
permissive
[ { "docstring": "Saves a csv file. :param filepath: :param header: :param mode: :param sep: :param na_rep: :param float_format: :param columns: :param encoding: :param quoting: :param quotechar: :param date_format: :param doublequote: :param escapechar: :param decimal: :return:", "name": "csv", "signatur...
4
stack_v2_sparse_classes_30k_train_025496
Implement the Python class `Save` described below. Class description: Implement the Save class. Method signatures and docstrings: - def csv(filepath, header=True, mode=DataSaver.MODE_OVERWRITE, sep=',', na_rep='', float_format=None, columns=None, encoding=None, quoting=None, quotechar='"', date_format=None, doublequo...
Implement the Python class `Save` described below. Class description: Implement the Save class. Method signatures and docstrings: - def csv(filepath, header=True, mode=DataSaver.MODE_OVERWRITE, sep=',', na_rep='', float_format=None, columns=None, encoding=None, quoting=None, quotechar='"', date_format=None, doublequo...
09ab7c474c8badc9932de3e1148f62ffba16b0b2
<|skeleton|> class Save: def csv(filepath, header=True, mode=DataSaver.MODE_OVERWRITE, sep=',', na_rep='', float_format=None, columns=None, encoding=None, quoting=None, quotechar='"', date_format=None, doublequote=True, escapechar=None, decimal='.'): """Saves a csv file. :param filepath: :param header: :pa...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Save: def csv(filepath, header=True, mode=DataSaver.MODE_OVERWRITE, sep=',', na_rep='', float_format=None, columns=None, encoding=None, quoting=None, quotechar='"', date_format=None, doublequote=True, escapechar=None, decimal='.'): """Saves a csv file. :param filepath: :param header: :param mode: :par...
the_stack_v2_python_sparse
ddf_library/bases/data_saver.py
eubr-bigsea/Compss-Python
train
3
abeafe9badce162495d97711b4beda6fec871ab8
[ "(train_images, train_labels), (test_images, test_labels) = mnist.load_data()\ntrain_images = train_images.reshape(60000, 784)\ntrain_images = train_images.astype('float32')\ntrain_images = train_images / 255\ntrain_images = 1 - train_images\ntrain_dataset = tf.data.Dataset.from_tensor_slices(train_images)\ntrain_d...
<|body_start_0|> (train_images, train_labels), (test_images, test_labels) = mnist.load_data() train_images = train_images.reshape(60000, 784) train_images = train_images.astype('float32') train_images = train_images / 255 train_images = 1 - train_images train_dataset = tf...
Donnees
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Donnees: def train_donnees_mnist(cls): """"Methode qui charge et prepare des images de l'entrainement FashionMNIST dans le format nécessaire pour l'entraînement. :return: dataset a utiliser pour l'entraînement :rtype: class 'tensorflow.python.data.ops.dataset_ops.BatchDataset'""" ...
stack_v2_sparse_classes_75kplus_train_071263
5,675
no_license
[ { "docstring": "\"Methode qui charge et prepare des images de l'entrainement FashionMNIST dans le format nécessaire pour l'entraînement. :return: dataset a utiliser pour l'entraînement :rtype: class 'tensorflow.python.data.ops.dataset_ops.BatchDataset'", "name": "train_donnees_mnist", "signature": "def ...
4
stack_v2_sparse_classes_30k_train_029661
Implement the Python class `Donnees` described below. Class description: Implement the Donnees class. Method signatures and docstrings: - def train_donnees_mnist(cls): "Methode qui charge et prepare des images de l'entrainement FashionMNIST dans le format nécessaire pour l'entraînement. :return: dataset a utiliser po...
Implement the Python class `Donnees` described below. Class description: Implement the Donnees class. Method signatures and docstrings: - def train_donnees_mnist(cls): "Methode qui charge et prepare des images de l'entrainement FashionMNIST dans le format nécessaire pour l'entraînement. :return: dataset a utiliser po...
bad9fe47ef72b66fad289985484de4d5c58c48eb
<|skeleton|> class Donnees: def train_donnees_mnist(cls): """"Methode qui charge et prepare des images de l'entrainement FashionMNIST dans le format nécessaire pour l'entraînement. :return: dataset a utiliser pour l'entraînement :rtype: class 'tensorflow.python.data.ops.dataset_ops.BatchDataset'""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Donnees: def train_donnees_mnist(cls): """"Methode qui charge et prepare des images de l'entrainement FashionMNIST dans le format nécessaire pour l'entraînement. :return: dataset a utiliser pour l'entraînement :rtype: class 'tensorflow.python.data.ops.dataset_ops.BatchDataset'""" (train_images...
the_stack_v2_python_sparse
AutoencodeurProbabiliste/sourceae/Donnees.py
Anastasija-Kuramzina/ProjetAutoencodeur
train
0
73a5bb9645ca677accd0f9c1e35d6285e5fd534f
[ "super().__init__()\nif layer_sizes is None:\n layer_sizes = [1200, 600, 220]\nself._layer_sizes = layer_sizes\nself._num_shared_layers = shared_layers\nassert 0 < shared_layers <= len(self._layer_sizes)\nself._polynomial = polynomial\nself._input_size = None\nself._belief_size = None\nself._num_players = None\n...
<|body_start_0|> super().__init__() if layer_sizes is None: layer_sizes = [1200, 600, 220] self._layer_sizes = layer_sizes self._num_shared_layers = shared_layers assert 0 < shared_layers <= len(self._layer_sizes) self._polynomial = polynomial self._in...
Multilayered perceptron to approximate T: (b, a) -> b'
MultitaskTransitionModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultitaskTransitionModel: """Multilayered perceptron to approximate T: (b, a) -> b'""" def __init__(self, layer_sizes: List[int]=None, shared_layers: int=2, polynomial: bool=True): """:param layer_sizes: sizes of the hidden layers in the network (there will be len(layer_sizes) + 1 Li...
stack_v2_sparse_classes_75kplus_train_071264
13,214
permissive
[ { "docstring": ":param layer_sizes: sizes of the hidden layers in the network (there will be len(layer_sizes) + 1 Linear layers) :param shared_layers: number of layers to maintain as a shared backbone :param polynomial: whether or not to use the polynomial basis", "name": "__init__", "signature": "def _...
6
stack_v2_sparse_classes_30k_train_036242
Implement the Python class `MultitaskTransitionModel` described below. Class description: Multilayered perceptron to approximate T: (b, a) -> b' Method signatures and docstrings: - def __init__(self, layer_sizes: List[int]=None, shared_layers: int=2, polynomial: bool=True): :param layer_sizes: sizes of the hidden lay...
Implement the Python class `MultitaskTransitionModel` described below. Class description: Multilayered perceptron to approximate T: (b, a) -> b' Method signatures and docstrings: - def __init__(self, layer_sizes: List[int]=None, shared_layers: int=2, polynomial: bool=True): :param layer_sizes: sizes of the hidden lay...
ae32e85583c61cc27a44946a6b5fa7c1e2c152ff
<|skeleton|> class MultitaskTransitionModel: """Multilayered perceptron to approximate T: (b, a) -> b'""" def __init__(self, layer_sizes: List[int]=None, shared_layers: int=2, polynomial: bool=True): """:param layer_sizes: sizes of the hidden layers in the network (there will be len(layer_sizes) + 1 Li...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultitaskTransitionModel: """Multilayered perceptron to approximate T: (b, a) -> b'""" def __init__(self, layer_sizes: List[int]=None, shared_layers: int=2, polynomial: bool=True): """:param layer_sizes: sizes of the hidden layers in the network (there will be len(layer_sizes) + 1 Linear layers) ...
the_stack_v2_python_sparse
src/agents/models/multitask_models.py
lilianluong/multitask-card-games
train
1
01558337cea174c99006cbbfc3c48e91bb59ee80
[ "self.baseurl = baseurl\nself.apikey = apikey\nself.secretkey = secretkey", "sortedRequest = sorted(request, key=itemgetter(0))\nencodeRequest = '%s?%s' % (item, urlencode(request))\nsignature = hmac.new(self.secretkey, encodeRequest, hashlib.sha256).hexdigest()\nrequest.append(('signature', signature))\nfinalReq...
<|body_start_0|> self.baseurl = baseurl self.apikey = apikey self.secretkey = secretkey <|end_body_0|> <|body_start_1|> sortedRequest = sorted(request, key=itemgetter(0)) encodeRequest = '%s?%s' % (item, urlencode(request)) signature = hmac.new(self.secretkey, encodeRequ...
AmivID
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AmivID: def __init__(self, apikey, secretkey, baseurl): """Prepares a connection to AmivID :param apikey: Shared Secret string :param baseurl: Optional, the URL of the REST service""" <|body_0|> def __sign(self, item, request): """Computes the correct signature, sort...
stack_v2_sparse_classes_75kplus_train_071265
2,756
no_license
[ { "docstring": "Prepares a connection to AmivID :param apikey: Shared Secret string :param baseurl: Optional, the URL of the REST service", "name": "__init__", "signature": "def __init__(self, apikey, secretkey, baseurl)" }, { "docstring": "Computes the correct signature, sorting the request-arr...
4
stack_v2_sparse_classes_30k_train_045544
Implement the Python class `AmivID` described below. Class description: Implement the AmivID class. Method signatures and docstrings: - def __init__(self, apikey, secretkey, baseurl): Prepares a connection to AmivID :param apikey: Shared Secret string :param baseurl: Optional, the URL of the REST service - def __sign...
Implement the Python class `AmivID` described below. Class description: Implement the AmivID class. Method signatures and docstrings: - def __init__(self, apikey, secretkey, baseurl): Prepares a connection to AmivID :param apikey: Shared Secret string :param baseurl: Optional, the URL of the REST service - def __sign...
5346c8066870860cc7e8d6c6cf1818ad84f82e12
<|skeleton|> class AmivID: def __init__(self, apikey, secretkey, baseurl): """Prepares a connection to AmivID :param apikey: Shared Secret string :param baseurl: Optional, the URL of the REST service""" <|body_0|> def __sign(self, item, request): """Computes the correct signature, sort...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AmivID: def __init__(self, apikey, secretkey, baseurl): """Prepares a connection to AmivID :param apikey: Shared Secret string :param baseurl: Optional, the URL of the REST service""" self.baseurl = baseurl self.apikey = apikey self.secretkey = secretkey def __sign(self, i...
the_stack_v2_python_sparse
kaffi/amivid.py
worxli/kaffi
train
0
5b158450fde38f3a7b4542d4803c934a4fb7076f
[ "use_ssl = url.scheme == 'https'\nport = url.port or (443 if use_ssl else 80)\nreturn {'host': url.hostname, 'port': port, 'path_prefix': url.path, 'scheme': url.scheme}", "opts = super()._get_options_from_host_urls(urls)\nbasic_auth = (urls[0].username, urls[0].password)\nif any(((url.username, url.password) != ...
<|body_start_0|> use_ssl = url.scheme == 'https' port = url.port or (443 if use_ssl else 80) return {'host': url.hostname, 'port': port, 'path_prefix': url.path, 'scheme': url.scheme} <|end_body_0|> <|body_start_1|> opts = super()._get_options_from_host_urls(urls) basic_auth = (...
Elasticsearch8SearchBackend
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Elasticsearch8SearchBackend: def _get_host_config_from_url(self, url): """Given a parsed URL, return the host configuration to be added to self.hosts""" <|body_0|> def _get_options_from_host_urls(self, urls): """Given a list of parsed URLs, return a dict of additiona...
stack_v2_sparse_classes_75kplus_train_071266
2,690
permissive
[ { "docstring": "Given a parsed URL, return the host configuration to be added to self.hosts", "name": "_get_host_config_from_url", "signature": "def _get_host_config_from_url(self, url)" }, { "docstring": "Given a list of parsed URLs, return a dict of additional options to be passed into the Ela...
2
stack_v2_sparse_classes_30k_train_045625
Implement the Python class `Elasticsearch8SearchBackend` described below. Class description: Implement the Elasticsearch8SearchBackend class. Method signatures and docstrings: - def _get_host_config_from_url(self, url): Given a parsed URL, return the host configuration to be added to self.hosts - def _get_options_fro...
Implement the Python class `Elasticsearch8SearchBackend` described below. Class description: Implement the Elasticsearch8SearchBackend class. Method signatures and docstrings: - def _get_host_config_from_url(self, url): Given a parsed URL, return the host configuration to be added to self.hosts - def _get_options_fro...
06a7bc6124bf62675c09fbe0a4ed9bbac183e025
<|skeleton|> class Elasticsearch8SearchBackend: def _get_host_config_from_url(self, url): """Given a parsed URL, return the host configuration to be added to self.hosts""" <|body_0|> def _get_options_from_host_urls(self, urls): """Given a list of parsed URLs, return a dict of additiona...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Elasticsearch8SearchBackend: def _get_host_config_from_url(self, url): """Given a parsed URL, return the host configuration to be added to self.hosts""" use_ssl = url.scheme == 'https' port = url.port or (443 if use_ssl else 80) return {'host': url.hostname, 'port': port, 'path...
the_stack_v2_python_sparse
wagtail/search/backends/elasticsearch8.py
wagtail/wagtail
train
12,974
5031a9691217c918a6265ddc1e598f33d57790cd
[ "json_dict = json.loads(request.body.decode())\nreceiver = json_dict.get('receiver')\nprovince_id = json_dict.get('province_id')\ncity_id = json_dict.get('city_id')\ndistrict_id = json_dict.get('district_id')\nplace = json_dict.get('place')\nmobile = json_dict.get('mobile')\ntel = json_dict.get('tel')\nemail = json...
<|body_start_0|> json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id = json_dict.get('city_id') district_id = json_dict.get('district_id') place = json_dict.get('place') mobile = jso...
修改地址信息
UpdateDestroyAddressView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateDestroyAddressView: """修改地址信息""" def put(self, request, address_id): """修改地址""" <|body_0|> def delete(self, request, address_id): """删除地址""" <|body_1|> <|end_skeleton|> <|body_start_0|> json_dict = json.loads(request.body.decode()) ...
stack_v2_sparse_classes_75kplus_train_071267
20,821
no_license
[ { "docstring": "修改地址", "name": "put", "signature": "def put(self, request, address_id)" }, { "docstring": "删除地址", "name": "delete", "signature": "def delete(self, request, address_id)" } ]
2
stack_v2_sparse_classes_30k_train_037289
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改地址信息 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 - def delete(self, request, address_id): 删除地址
Implement the Python class `UpdateDestroyAddressView` described below. Class description: 修改地址信息 Method signatures and docstrings: - def put(self, request, address_id): 修改地址 - def delete(self, request, address_id): 删除地址 <|skeleton|> class UpdateDestroyAddressView: """修改地址信息""" def put(self, request, address...
014c94281efd99155957353c8300e31830946ab6
<|skeleton|> class UpdateDestroyAddressView: """修改地址信息""" def put(self, request, address_id): """修改地址""" <|body_0|> def delete(self, request, address_id): """删除地址""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UpdateDestroyAddressView: """修改地址信息""" def put(self, request, address_id): """修改地址""" json_dict = json.loads(request.body.decode()) receiver = json_dict.get('receiver') province_id = json_dict.get('province_id') city_id = json_dict.get('city_id') district_i...
the_stack_v2_python_sparse
apps/ausers/views.py
ruoyunruyan/simple_mall
train
0
415374d0cdf745a0774554af3f2a53b3363202a0
[ "super(Discriminator, self).__init__()\nassert image_size % 16 == 0, 'image size must be a multiple of 16!'\nself.num_gpu = num_gpu\nself.layer = nn.Sequential()\nself.layer.add_module('init.{}-{}.conv'.format(num_channels, conv_dim), nn.Conv2d(num_channels, conv_dim, 4, 2, 1, bias=False))\nself.layer.add_module('i...
<|body_start_0|> super(Discriminator, self).__init__() assert image_size % 16 == 0, 'image size must be a multiple of 16!' self.num_gpu = num_gpu self.layer = nn.Sequential() self.layer.add_module('init.{}-{}.conv'.format(num_channels, conv_dim), nn.Conv2d(num_channels, conv_dim,...
Model for Discriminator.
Discriminator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Discriminator: """Model for Discriminator.""" def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN): """Init for Discriminator model.""" <|body_0|> def forward(self, input): """Forward step for Discriminator model.""" <...
stack_v2_sparse_classes_75kplus_train_071268
7,633
permissive
[ { "docstring": "Init for Discriminator model.", "name": "__init__", "signature": "def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN)" }, { "docstring": "Forward step for Discriminator model.", "name": "forward", "signature": "def forward(self, input...
2
stack_v2_sparse_classes_30k_train_011818
Implement the Python class `Discriminator` described below. Class description: Model for Discriminator. Method signatures and docstrings: - def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN): Init for Discriminator model. - def forward(self, input): Forward step for Discriminato...
Implement the Python class `Discriminator` described below. Class description: Model for Discriminator. Method signatures and docstrings: - def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN): Init for Discriminator model. - def forward(self, input): Forward step for Discriminato...
fd4498da35ace5a3d1696ff4fbec3568eddbe6a1
<|skeleton|> class Discriminator: """Model for Discriminator.""" def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN): """Init for Discriminator model.""" <|body_0|> def forward(self, input): """Forward step for Discriminator model.""" <...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Discriminator: """Model for Discriminator.""" def __init__(self, num_channels, conv_dim, image_size, num_gpu, num_extra_layers, use_BN): """Init for Discriminator model.""" super(Discriminator, self).__init__() assert image_size % 16 == 0, 'image size must be a multiple of 16!' ...
the_stack_v2_python_sparse
WGAN-GP/models.py
corenel/GAN-Zoo
train
10
c77e7fb7f687cdafde6efbe9d442ed44115b3169
[ "self.version = '1.0.0'\nself.templatePath = []\nself.name = config.moduleName\nself.tags = config.tags\nself.inputKinds = ['fashion.core.generate.jinja2.spec', 'fashion.core.mirror']\nself.outputKinds = ['fashion.core.output.file']", "mdb = codeRegistry.getService('fashion.prime.modelAccess')\nmirCfg = munchify(...
<|body_start_0|> self.version = '1.0.0' self.templatePath = [] self.name = config.moduleName self.tags = config.tags self.inputKinds = ['fashion.core.generate.jinja2.spec', 'fashion.core.mirror'] self.outputKinds = ['fashion.core.output.file'] <|end_body_0|> <|body_start...
Generate output by merging a model into a template to produce a file.
Generate
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generate: """Generate output by merging a model into a template to produce a file.""" def __init__(self, config): """Constructor.""" <|body_0|> def execute(self, codeRegistry, verbose=False, tags=None): """cwd is project root directory.""" <|body_1|> <|e...
stack_v2_sparse_classes_75kplus_train_071269
2,297
permissive
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "cwd is project root directory.", "name": "execute", "signature": "def execute(self, codeRegistry, verbose=False, tags=None)" } ]
2
null
Implement the Python class `Generate` described below. Class description: Generate output by merging a model into a template to produce a file. Method signatures and docstrings: - def __init__(self, config): Constructor. - def execute(self, codeRegistry, verbose=False, tags=None): cwd is project root directory.
Implement the Python class `Generate` described below. Class description: Generate output by merging a model into a template to produce a file. Method signatures and docstrings: - def __init__(self, config): Constructor. - def execute(self, codeRegistry, verbose=False, tags=None): cwd is project root directory. <|sk...
2588f3712a72e81f3cb7733e40b6c3751aa5ece2
<|skeleton|> class Generate: """Generate output by merging a model into a template to produce a file.""" def __init__(self, config): """Constructor.""" <|body_0|> def execute(self, codeRegistry, verbose=False, tags=None): """cwd is project root directory.""" <|body_1|> <|e...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Generate: """Generate output by merging a model into a template to produce a file.""" def __init__(self, config): """Constructor.""" self.version = '1.0.0' self.templatePath = [] self.name = config.moduleName self.tags = config.tags self.inputKinds = ['fash...
the_stack_v2_python_sparse
fashion/warehouse/fashion.core/xform/generateJinja2.py
braddillman/fashion
train
1
855ce65cee85b4f3ebbacee370fa50276fe03de4
[ "self.logging_prefix = logging_prefix\nself.cross_validation_split_index = cross_validation_split_index\nself.log_to_parent_run = log_to_parent_run", "if not is_offline_run_context(RUN_CONTEXT):\n metric_name = self.logging_prefix + label\n RUN_CONTEXT.log(metric_name, metric)\n if self.log_to_parent_run...
<|body_start_0|> self.logging_prefix = logging_prefix self.cross_validation_split_index = cross_validation_split_index self.log_to_parent_run = log_to_parent_run <|end_body_0|> <|body_start_1|> if not is_offline_run_context(RUN_CONTEXT): metric_name = self.logging_prefix + l...
Stores the information that is required to log metrics to AzureML.
AzureMLLogger
[ "MIT", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AzureMLLogger: """Stores the information that is required to log metrics to AzureML.""" def __init__(self, cross_validation_split_index: int, logging_prefix: str, log_to_parent_run: bool): """:param cross_validation_split_index: The cross validation split index, or its default value ...
stack_v2_sparse_classes_75kplus_train_071270
32,709
permissive
[ { "docstring": ":param cross_validation_split_index: The cross validation split index, or its default value if not running inside cross validation. :param logging_prefix: A prefix string that will be added to all metrics names before logging. :param log_to_parent_run: If true, all metrics will also be written t...
2
stack_v2_sparse_classes_30k_train_002014
Implement the Python class `AzureMLLogger` described below. Class description: Stores the information that is required to log metrics to AzureML. Method signatures and docstrings: - def __init__(self, cross_validation_split_index: int, logging_prefix: str, log_to_parent_run: bool): :param cross_validation_split_index...
Implement the Python class `AzureMLLogger` described below. Class description: Stores the information that is required to log metrics to AzureML. Method signatures and docstrings: - def __init__(self, cross_validation_split_index: int, logging_prefix: str, log_to_parent_run: bool): :param cross_validation_split_index...
12b496093097ef48d5ac8880985c04918d7f76fe
<|skeleton|> class AzureMLLogger: """Stores the information that is required to log metrics to AzureML.""" def __init__(self, cross_validation_split_index: int, logging_prefix: str, log_to_parent_run: bool): """:param cross_validation_split_index: The cross validation split index, or its default value ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AzureMLLogger: """Stores the information that is required to log metrics to AzureML.""" def __init__(self, cross_validation_split_index: int, logging_prefix: str, log_to_parent_run: bool): """:param cross_validation_split_index: The cross validation split index, or its default value if not runnin...
the_stack_v2_python_sparse
InnerEye/ML/metrics.py
MaxCodeXTC/InnerEye-DeepLearning
train
1
7272396cc4436c8bdc7074037d36d557f93fbd23
[ "self.t0 = strt_t\nself.dt = datetime.timedelta(minutes=forward_flag * int(config['CORE']['time_step']))\nself.idx = idx\nself.lat = [lat0]\nself.lon = [lon0]\nself.h = [height0]\nself.t = [self.t0]\nself.ix = []\nself.iy = []\nself.iz = []", "self.lat.append(lat_new)\nself.lon.append(lon_new)\nself.h.append(heig...
<|body_start_0|> self.t0 = strt_t self.dt = datetime.timedelta(minutes=forward_flag * int(config['CORE']['time_step'])) self.idx = idx self.lat = [lat0] self.lon = [lon0] self.h = [height0] self.t = [self.t0] self.ix = [] self.iy = [] self....
Construct air parcel Attributes ----------- lat, list lon, list h, list t, datetime list, current time t0, datetime dt, datetime.timedelta idx, integer Methods -----------
air_parcel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class air_parcel: """Construct air parcel Attributes ----------- lat, list lon, list h, list t, datetime list, current time t0, datetime dt, datetime.timedelta idx, integer Methods -----------""" def __init__(self, idx, lat0, lon0, height0, config, strt_t, forward_flag): """construct air p...
stack_v2_sparse_classes_75kplus_train_071271
4,353
permissive
[ { "docstring": "construct air parcel obj", "name": "__init__", "signature": "def __init__(self, idx, lat0, lon0, height0, config, strt_t, forward_flag)" }, { "docstring": "update air parcel position", "name": "update", "signature": "def update(self, lat_new, lon_new, height_new, time_new...
3
null
Implement the Python class `air_parcel` described below. Class description: Construct air parcel Attributes ----------- lat, list lon, list h, list t, datetime list, current time t0, datetime dt, datetime.timedelta idx, integer Methods ----------- Method signatures and docstrings: - def __init__(self, idx, lat0, lon0...
Implement the Python class `air_parcel` described below. Class description: Construct air parcel Attributes ----------- lat, list lon, list h, list t, datetime list, current time t0, datetime dt, datetime.timedelta idx, integer Methods ----------- Method signatures and docstrings: - def __init__(self, idx, lat0, lon0...
8dcb3b07af4b45d9ade2515f98702f9a9ba1db8b
<|skeleton|> class air_parcel: """Construct air parcel Attributes ----------- lat, list lon, list h, list t, datetime list, current time t0, datetime dt, datetime.timedelta idx, integer Methods -----------""" def __init__(self, idx, lat0, lon0, height0, config, strt_t, forward_flag): """construct air p...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class air_parcel: """Construct air parcel Attributes ----------- lat, list lon, list h, list t, datetime list, current time t0, datetime dt, datetime.timedelta idx, integer Methods -----------""" def __init__(self, idx, lat0, lon0, height0, config, strt_t, forward_flag): """construct air parcel obj""" ...
the_stack_v2_python_sparse
lib/air_parcel.py
subaohuang/easy-era5-trck
train
0
a314e9d42e749bc9a4413b8e445c96c4ab1a3ace
[ "super(InTimeToArrivalToLocation, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._actor = actor\nself._time = time\nself._target_location = location", "new_status = py_trees.common.Status.RUNNING\ncurrent_location = CarlaDataProvider.get_location(self._actor)\nif current_...
<|body_start_0|> super(InTimeToArrivalToLocation, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._actor = actor self._time = time self._target_location = location <|end_body_0|> <|body_start_1|> new_status = py_trees.common.Status....
This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - location: Location to be checked in this behavior The condi...
InTimeToArrivalToLocation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTimeToArrivalToLocation: """This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - locati...
stack_v2_sparse_classes_75kplus_train_071272
18,494
permissive
[ { "docstring": "Setup parameters", "name": "__init__", "signature": "def __init__(self, actor, time, location, name='TimeToArrival')" }, { "docstring": "Check if the actor can arrive at target_location within time", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_026255
Implement the Python class `InTimeToArrivalToLocation` described below. Class description: This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA ...
Implement the Python class `InTimeToArrivalToLocation` described below. Class description: This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA ...
8ab0894b92e1f994802a218002021ee075c405bf
<|skeleton|> class InTimeToArrivalToLocation: """This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - locati...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class InTimeToArrivalToLocation: """This class contains a check if a actor arrives within a given time at a given location. Important parameters: - actor: CARLA actor to execute the behavior - name: Name of the condition - time: The behavior is successful, if TTA is less than _time_ in seconds - location: Location ...
the_stack_v2_python_sparse
carla_rllib/carla_rllib-prak_evaluator-carla_rllib-prak_evaluator/carla_rllib/prak_evaluator/srunner/scenarioconfigs/scenariomanager/scenarioatomics/atomic_trigger_conditions.py
TinaMenke/Deep-Reinforcement-Learning
train
9
18d06109c15b51173d876e3369f003a6570b10cc
[ "super(PositionEncoder, self).__init__()\nself.spa_enc_type = spa_enc_type\nself.id2geo = id2geo\nself.spa_embed_dim = spa_enc.spa_embed_dim\nself.spa_enc = spa_enc\nself.graph = graph\nself.spa_enc_embed_norm = spa_enc_embed_norm\nself.device = device\nself.nogeo_idmap = self.make_nogeo_idmap(self.id2geo, self.gra...
<|body_start_0|> super(PositionEncoder, self).__init__() self.spa_enc_type = spa_enc_type self.id2geo = id2geo self.spa_embed_dim = spa_enc.spa_embed_dim self.spa_enc = spa_enc self.graph = graph self.spa_enc_embed_norm = spa_enc_embed_norm self.device = d...
This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding
PositionEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionEncoder: """This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding""" def __init__(self, spa_enc_type, id2geo, spa_enc, graph, spa_enc_embed_norm, device='cpu'): """Args: out_dims: a dict() key: node type value: embed...
stack_v2_sparse_classes_75kplus_train_071273
34,194
permissive
[ { "docstring": "Args: out_dims: a dict() key: node type value: embedding dimention spa_enc_type: the type of space encoder id2geo: a dict(): node id -> [longitude, latitude] spa_enc: one space encoder graph: Graph() spa_enc_embed_norm: whether to do position embedding normalization", "name": "__init__", ...
4
null
Implement the Python class `PositionEncoder` described below. Class description: This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding Method signatures and docstrings: - def __init__(self, spa_enc_type, id2geo, spa_enc, graph, spa_enc_embed_norm, device='cp...
Implement the Python class `PositionEncoder` described below. Class description: This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding Method signatures and docstrings: - def __init__(self, spa_enc_type, id2geo, spa_enc, graph, spa_enc_embed_norm, device='cp...
0e5a630a8403d4c7965de0f71e2e22b95f7be7bd
<|skeleton|> class PositionEncoder: """This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding""" def __init__(self, spa_enc_type, id2geo, spa_enc, graph, spa_enc_embed_norm, device='cpu'): """Args: out_dims: a dict() key: node type value: embed...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PositionEncoder: """This is position encoder, a wrapper for different space encoder, Given a list of node ids, return their embedding""" def __init__(self, spa_enc_type, id2geo, spa_enc, graph, spa_enc_embed_norm, device='cpu'): """Args: out_dims: a dict() key: node type value: embedding dimentio...
the_stack_v2_python_sparse
graphqa/netquery/encoders.py
Moon-xm/se-kge
train
0
f26fb5fd9e1dfb042c6507e76c23a6d50398b547
[ "if not node:\n return\nif node.val == V:\n if is_left_path:\n self.t2 = node\n else:\n self.t2 = node.right\nif is_left_path and node.val < V:\n self.t2 = node\nif not is_left_path and node.val > V:\n self.t2 = node\nif V < node.val:\n self.t1 = node\n self.find_split_point(node....
<|body_start_0|> if not node: return if node.val == V: if is_left_path: self.t2 = node else: self.t2 = node.right if is_left_path and node.val < V: self.t2 = node if not is_left_path and node.val > V: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def find_split_point(self, node, is_left_path, V): """find the split point where both trees will be separated""" <|body_0|> def splitBST(self, root, V): """:type root: TreeNode :type V: int :rtype: List[TreeNode]""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_75kplus_train_071274
3,186
no_license
[ { "docstring": "find the split point where both trees will be separated", "name": "find_split_point", "signature": "def find_split_point(self, node, is_left_path, V)" }, { "docstring": ":type root: TreeNode :type V: int :rtype: List[TreeNode]", "name": "splitBST", "signature": "def split...
2
stack_v2_sparse_classes_30k_train_051792
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_split_point(self, node, is_left_path, V): find the split point where both trees will be separated - def splitBST(self, root, V): :type root: TreeNode :type V: int :rtype...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def find_split_point(self, node, is_left_path, V): find the split point where both trees will be separated - def splitBST(self, root, V): :type root: TreeNode :type V: int :rtype...
877933424e6d2c590d6ac53db18bee951a3d9de4
<|skeleton|> class Solution: def find_split_point(self, node, is_left_path, V): """find the split point where both trees will be separated""" <|body_0|> def splitBST(self, root, V): """:type root: TreeNode :type V: int :rtype: List[TreeNode]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def find_split_point(self, node, is_left_path, V): """find the split point where both trees will be separated""" if not node: return if node.val == V: if is_left_path: self.t2 = node else: self.t2 = node.righ...
the_stack_v2_python_sparse
leetcode/776.split-bst-messsss.py
siddhism/leetcode
train
0
30ba9c21f32cea9d098dc8596f28ec061def3b8a
[ "step3()\nshili = login_shili\nr = shili.login('halo', '123456')\nassert '首页' in r.text\nprint(r.text)", "step3_1()\nshili = login_shili\nr = shili.login('halo', '23541232')\nassert '登录' in r.text", "step3_2()\nshili = login_shili\nr = shili.login('halo', 'asdddddddddasdwqfaf')\nassert '登录' in r.text", "step3...
<|body_start_0|> step3() shili = login_shili r = shili.login('halo', '123456') assert '首页' in r.text print(r.text) <|end_body_0|> <|body_start_1|> step3_1() shili = login_shili r = shili.login('halo', '23541232') assert '登录' in r.text <|end_body_1...
Test_login
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_login: def test_1213(self, login_shili): """接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: application/x-www-form-urlencoded Cookie: JSESSIONID.a848f870=node01qe8pjjd6z7jiazrrmss3tntr23.node0 参数:a...
stack_v2_sparse_classes_75kplus_train_071275
8,089
no_license
[ { "docstring": "接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: application/x-www-form-urlencoded Cookie: JSESSIONID.a848f870=node01qe8pjjd6z7jiazrrmss3tntr23.node0 参数:account=halo&password=123456", "name": "test_1213", ...
5
stack_v2_sparse_classes_30k_train_046285
Implement the Python class `Test_login` described below. Class description: Implement the Test_login class. Method signatures and docstrings: - def test_1213(self, login_shili): 接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: applic...
Implement the Python class `Test_login` described below. Class description: Implement the Test_login class. Method signatures and docstrings: - def test_1213(self, login_shili): 接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: applic...
c3ca50f34dedb3d400fd303957198c4ca006a821
<|skeleton|> class Test_login: def test_1213(self, login_shili): """接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: application/x-www-form-urlencoded Cookie: JSESSIONID.a848f870=node01qe8pjjd6z7jiazrrmss3tntr23.node0 参数:a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_login: def test_1213(self, login_shili): """接口描述: 接口地址:http://123.56.113.64:9080/api/login/ 请求方式:post 请求类型:Content-Type: application/x-www-form-urlencoded headers头:Content-Type: application/x-www-form-urlencoded Cookie: JSESSIONID.a848f870=node01qe8pjjd6z7jiazrrmss3tntr23.node0 参数:account=halo&pa...
the_stack_v2_python_sparse
project_hrun/test_login_registers/test_regist_login.py
haloyazhou/halo_1
train
0
a18e17ad1da1f8714de932ed607241fed010fd32
[ "def inner_wrapper(wrapped_class: BaseDataset) -> Callable:\n if name in cls.registry:\n cls.logger.warning('Dataset {} already exists, will replace it'.format(name))\n cls.registry[name] = wrapped_class\n return wrapped_class\nreturn inner_wrapper", "if name not in cls.registry:\n raise ValueE...
<|body_start_0|> def inner_wrapper(wrapped_class: BaseDataset) -> Callable: if name in cls.registry: cls.logger.warning('Dataset {} already exists, will replace it'.format(name)) cls.registry[name] = wrapped_class return wrapped_class return inner_wrap...
The factory class for creating various dataset.
DatasetFactory
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatasetFactory: """The factory class for creating various dataset.""" def register(cls, name: str) -> Callable: """Class method to register dataset classes to the internal registry. :param name: the name of the dataset. :return: the dataset itself.""" <|body_0|> def crea...
stack_v2_sparse_classes_75kplus_train_071276
1,609
permissive
[ { "docstring": "Class method to register dataset classes to the internal registry. :param name: the name of the dataset. :return: the dataset itself.", "name": "register", "signature": "def register(cls, name: str) -> Callable" }, { "docstring": "Factory command to create the dataset. This metho...
2
stack_v2_sparse_classes_30k_train_052354
Implement the Python class `DatasetFactory` described below. Class description: The factory class for creating various dataset. Method signatures and docstrings: - def register(cls, name: str) -> Callable: Class method to register dataset classes to the internal registry. :param name: the name of the dataset. :return...
Implement the Python class `DatasetFactory` described below. Class description: The factory class for creating various dataset. Method signatures and docstrings: - def register(cls, name: str) -> Callable: Class method to register dataset classes to the internal registry. :param name: the name of the dataset. :return...
9ca6d5588bf025ae6feb848412261c10ac012e1f
<|skeleton|> class DatasetFactory: """The factory class for creating various dataset.""" def register(cls, name: str) -> Callable: """Class method to register dataset classes to the internal registry. :param name: the name of the dataset. :return: the dataset itself.""" <|body_0|> def crea...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DatasetFactory: """The factory class for creating various dataset.""" def register(cls, name: str) -> Callable: """Class method to register dataset classes to the internal registry. :param name: the name of the dataset. :return: the dataset itself.""" def inner_wrapper(wrapped_class: Base...
the_stack_v2_python_sparse
src/dataset/dataset_factory.py
dhockaday/deep-embedded-music
train
0
0dc767eede6d702c292036ba8f68b6b17fd85c1a
[ "uid = request._request.uid\ns = LabelCreateSerializer(data=request.data)\ns.is_valid()\nif s.errors:\n return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA)\ntry:\n instance = s.create(s.validated_data)\nexcept:\n return self.error(errorcode.MSG_DB_ERROR, errorcode.DB_ERROR)\ns = LabelCrea...
<|body_start_0|> uid = request._request.uid s = LabelCreateSerializer(data=request.data) s.is_valid() if s.errors: return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA) try: instance = s.create(s.validated_data) except: ...
LabelView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabelView: def post(self, request): """新建标签""" <|body_0|> def get(self, request): """获取所有顶级标签""" <|body_1|> def delete(self, request): """删除标签,同时删除它与其他标签、文章、问答等的关系""" <|body_2|> def put(self, request): """修改标签""" <|bo...
stack_v2_sparse_classes_75kplus_train_071277
9,306
no_license
[ { "docstring": "新建标签", "name": "post", "signature": "def post(self, request)" }, { "docstring": "获取所有顶级标签", "name": "get", "signature": "def get(self, request)" }, { "docstring": "删除标签,同时删除它与其他标签、文章、问答等的关系", "name": "delete", "signature": "def delete(self, request)" }, ...
4
stack_v2_sparse_classes_30k_train_036167
Implement the Python class `LabelView` described below. Class description: Implement the LabelView class. Method signatures and docstrings: - def post(self, request): 新建标签 - def get(self, request): 获取所有顶级标签 - def delete(self, request): 删除标签,同时删除它与其他标签、文章、问答等的关系 - def put(self, request): 修改标签
Implement the Python class `LabelView` described below. Class description: Implement the LabelView class. Method signatures and docstrings: - def post(self, request): 新建标签 - def get(self, request): 获取所有顶级标签 - def delete(self, request): 删除标签,同时删除它与其他标签、文章、问答等的关系 - def put(self, request): 修改标签 <|skeleton|> class Label...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class LabelView: def post(self, request): """新建标签""" <|body_0|> def get(self, request): """获取所有顶级标签""" <|body_1|> def delete(self, request): """删除标签,同时删除它与其他标签、文章、问答等的关系""" <|body_2|> def put(self, request): """修改标签""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LabelView: def post(self, request): """新建标签""" uid = request._request.uid s = LabelCreateSerializer(data=request.data) s.is_valid() if s.errors: return self.error(errorcode.MSG_INVALID_DATA, errorcode.INVALID_DATA) try: instance = s.creat...
the_stack_v2_python_sparse
apps/labels/views.py
Slowhalfframe/fanyijiang-API
train
0
18bfc8b192f6ec564224c5a719f370957497d070
[ "article = check_article.retrieve_article(slug)\nhighlight_data = request.data\narticle_field = highlight_data.get('field')\nindex_start = highlight_data.get('start_index')\nindex_end = highlight_data.get('end_index')\nvalidate_field(article_field)\nfield_data = check_field(article, article_field)\nvalidate_index(f...
<|body_start_0|> article = check_article.retrieve_article(slug) highlight_data = request.data article_field = highlight_data.get('field') index_start = highlight_data.get('start_index') index_end = highlight_data.get('end_index') validate_field(article_field) fiel...
Highlight and comment on text views
HighlightAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HighlightAPIView: """Highlight and comment on text views""" def post(self, request, slug): """Create a text Highlight""" <|body_0|> def get(self, request, slug): """Fetch all highlighted text for a single article for user""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_071278
4,382
permissive
[ { "docstring": "Create a text Highlight", "name": "post", "signature": "def post(self, request, slug)" }, { "docstring": "Fetch all highlighted text for a single article for user", "name": "get", "signature": "def get(self, request, slug)" } ]
2
stack_v2_sparse_classes_30k_train_011382
Implement the Python class `HighlightAPIView` described below. Class description: Highlight and comment on text views Method signatures and docstrings: - def post(self, request, slug): Create a text Highlight - def get(self, request, slug): Fetch all highlighted text for a single article for user
Implement the Python class `HighlightAPIView` described below. Class description: Highlight and comment on text views Method signatures and docstrings: - def post(self, request, slug): Create a text Highlight - def get(self, request, slug): Fetch all highlighted text for a single article for user <|skeleton|> class ...
d0f73bf166ad41f243cff6d82caced2f9facf2f9
<|skeleton|> class HighlightAPIView: """Highlight and comment on text views""" def post(self, request, slug): """Create a text Highlight""" <|body_0|> def get(self, request, slug): """Fetch all highlighted text for a single article for user""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HighlightAPIView: """Highlight and comment on text views""" def post(self, request, slug): """Create a text Highlight""" article = check_article.retrieve_article(slug) highlight_data = request.data article_field = highlight_data.get('field') index_start = highlight...
the_stack_v2_python_sparse
authors/apps/highlights/views.py
andela/ah-the-immortals-backend
train
3
64c900bf7d9bc534d2deeb8049667c13f3488140
[ "self.fitness = fitness\nself.breed = breed\nself.best_fitness = -np.inf\nself.best_fitness_history = []\nself.best_solution = None\nself.population = None\nself.nthreads = nthreads", "self.population = init_pop\nkeep = int(round(elitist_frac * len(self.population)))\nfor gen in range(max_gens):\n fitnesses = ...
<|body_start_0|> self.fitness = fitness self.breed = breed self.best_fitness = -np.inf self.best_fitness_history = [] self.best_solution = None self.population = None self.nthreads = nthreads <|end_body_0|> <|body_start_1|> self.population = init_pop ...
GeneticOptimizer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneticOptimizer: def __init__(self, fitness, breed, nthreads=1): """fitness(sol) is a function that defines the fitness of a solution. Space of solutions is implicitly defined by fitness function. breed(solist) takes a list of solutions and produces a new solution. mutate(sol,frac) take...
stack_v2_sparse_classes_75kplus_train_071279
12,215
permissive
[ { "docstring": "fitness(sol) is a function that defines the fitness of a solution. Space of solutions is implicitly defined by fitness function. breed(solist) takes a list of solutions and produces a new solution. mutate(sol,frac) takes a solution and perturbs a fraction of it.", "name": "__init__", "si...
2
stack_v2_sparse_classes_30k_train_020636
Implement the Python class `GeneticOptimizer` described below. Class description: Implement the GeneticOptimizer class. Method signatures and docstrings: - def __init__(self, fitness, breed, nthreads=1): fitness(sol) is a function that defines the fitness of a solution. Space of solutions is implicitly defined by fit...
Implement the Python class `GeneticOptimizer` described below. Class description: Implement the GeneticOptimizer class. Method signatures and docstrings: - def __init__(self, fitness, breed, nthreads=1): fitness(sol) is a function that defines the fitness of a solution. Space of solutions is implicitly defined by fit...
7d37356046617d3f7f0a22c72301b6ad0680aefe
<|skeleton|> class GeneticOptimizer: def __init__(self, fitness, breed, nthreads=1): """fitness(sol) is a function that defines the fitness of a solution. Space of solutions is implicitly defined by fitness function. breed(solist) takes a list of solutions and produces a new solution. mutate(sol,frac) take...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class GeneticOptimizer: def __init__(self, fitness, breed, nthreads=1): """fitness(sol) is a function that defines the fitness of a solution. Space of solutions is implicitly defined by fitness function. breed(solist) takes a list of solutions and produces a new solution. mutate(sol,frac) takes a solution a...
the_stack_v2_python_sparse
assets/notebooks/gen_alg.py
Paul-St-Young/algorithms
train
2
f1f2ab8a2dd361b8dd32ad5e25f9c3c0393a02d9
[ "if not field:\n raise ValueError('Empty field name.')\nif not is_string(field):\n raise TypeError('The field name must be a string, not {0}'.format(type(field).__name__))\nif ' ' in field:\n raise ValueError(\"Field name can't contain spaces.\")\nself.__field = field\nspecifications = _get_specifications(...
<|body_start_0|> if not field: raise ValueError('Empty field name.') if not is_string(field): raise TypeError('The field name must be a string, not {0}'.format(type(field).__name__)) if ' ' in field: raise ValueError("Field name can't contain spaces.") ...
@RequiresMap decorator Defines a required service, injected in a dictionary
RequiresMap
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequiresMap: """@RequiresMap decorator Defines a required service, injected in a dictionary""" def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): """Sets up the requirement :param field: The injected field :param specif...
stack_v2_sparse_classes_75kplus_train_071280
41,418
permissive
[ { "docstring": "Sets up the requirement :param field: The injected field :param specification: The injected service specification :param key: Name of the service property to use as a dictionary key :param allow_none: If True, inject services with a None property value :param aggregate: If true, injects a list :...
2
stack_v2_sparse_classes_30k_train_000037
Implement the Python class `RequiresMap` described below. Class description: @RequiresMap decorator Defines a required service, injected in a dictionary Method signatures and docstrings: - def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): Sets up the r...
Implement the Python class `RequiresMap` described below. Class description: @RequiresMap decorator Defines a required service, injected in a dictionary Method signatures and docstrings: - def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): Sets up the r...
686556cdde20beba77ae202de9969be46feed5e2
<|skeleton|> class RequiresMap: """@RequiresMap decorator Defines a required service, injected in a dictionary""" def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): """Sets up the requirement :param field: The injected field :param specif...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RequiresMap: """@RequiresMap decorator Defines a required service, injected in a dictionary""" def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): """Sets up the requirement :param field: The injected field :param specification: The ...
the_stack_v2_python_sparse
python/src/lib/python/pelix/ipopo/decorators.py
cohorte/cohorte-runtime
train
3
cc9ac5a133d824b091308b6705ad20610df8273f
[ "if n < 10:\n return n\nnl = list(str(n))\nfor i in range(len(nl) - 1, 0, -1):\n if nl[i - 1] > nl[i]:\n nl[i - 1] = str(int(nl[i - 1]) - 1)\n nl[i:] = ['9'] * len(nl[i:])\nreturn int(''.join(nl))", "if n < 10:\n return n\nnl = list(str(n))\nfor i in range(len(nl) - 1):\n if int(nl[i]) >...
<|body_start_0|> if n < 10: return n nl = list(str(n)) for i in range(len(nl) - 1, 0, -1): if nl[i - 1] > nl[i]: nl[i - 1] = str(int(nl[i - 1]) - 1) nl[i:] = ['9'] * len(nl[i:]) return int(''.join(nl)) <|end_body_0|> <|body_start_1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def monotoneIncreasingDigits(self, n): """:type n: int :rtype: int 从后往前遍历""" <|body_0|> def monotoneIncreasingDigits0(self, n): """:type n: int :rtype: int 从前往后遍历""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n < 10: retur...
stack_v2_sparse_classes_75kplus_train_071281
1,304
no_license
[ { "docstring": ":type n: int :rtype: int 从后往前遍历", "name": "monotoneIncreasingDigits", "signature": "def monotoneIncreasingDigits(self, n)" }, { "docstring": ":type n: int :rtype: int 从前往后遍历", "name": "monotoneIncreasingDigits0", "signature": "def monotoneIncreasingDigits0(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_031359
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def monotoneIncreasingDigits(self, n): :type n: int :rtype: int 从后往前遍历 - def monotoneIncreasingDigits0(self, n): :type n: int :rtype: int 从前往后遍历
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def monotoneIncreasingDigits(self, n): :type n: int :rtype: int 从后往前遍历 - def monotoneIncreasingDigits0(self, n): :type n: int :rtype: int 从前往后遍历 <|skeleton|> class Solution: ...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def monotoneIncreasingDigits(self, n): """:type n: int :rtype: int 从后往前遍历""" <|body_0|> def monotoneIncreasingDigits0(self, n): """:type n: int :rtype: int 从前往后遍历""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def monotoneIncreasingDigits(self, n): """:type n: int :rtype: int 从后往前遍历""" if n < 10: return n nl = list(str(n)) for i in range(len(nl) - 1, 0, -1): if nl[i - 1] > nl[i]: nl[i - 1] = str(int(nl[i - 1]) - 1) nl[...
the_stack_v2_python_sparse
738.单调递增的数字.py
yangyuxiang1996/leetcode
train
0
ce777ef6e115a829693a2fff4b39431390013497
[ "self.num_pkts_arrived = 0\nself.num_pkts_left = 0\nself.num_normal_arrived = 0\nself.num_normal_left = 0\nself.num_malicious_arrived = 0\nself.num_malicious_left = 0\nself.num_permits_arrived = 0\nself.num_permits_left = 0\nself.num_negative_arrived = 0\nself.num_negative_left = 0\nself.num_normal_removed = 0\nsel...
<|body_start_0|> self.num_pkts_arrived = 0 self.num_pkts_left = 0 self.num_normal_arrived = 0 self.num_normal_left = 0 self.num_malicious_arrived = 0 self.num_malicious_left = 0 self.num_permits_arrived = 0 self.num_permits_left = 0 self.num_negati...
Results
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Results: def __init__(self): """`self.packets` is a dictionary of dictionaries as follows.. {<pkt_id>: {'arrival': ___, 'departure': ___}, <pkt_id>: {...}, ...}""" <|body_0|> def _add_packet_arrival(self, pkt_id, time, pkt_type): """Update packet list and counters wh...
stack_v2_sparse_classes_75kplus_train_071282
6,421
no_license
[ { "docstring": "`self.packets` is a dictionary of dictionaries as follows.. {<pkt_id>: {'arrival': ___, 'departure': ___}, <pkt_id>: {...}, ...}", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Update packet list and counters when a packet arrived at module :param pkt_i...
6
stack_v2_sparse_classes_30k_train_047151
Implement the Python class `Results` described below. Class description: Implement the Results class. Method signatures and docstrings: - def __init__(self): `self.packets` is a dictionary of dictionaries as follows.. {<pkt_id>: {'arrival': ___, 'departure': ___}, <pkt_id>: {...}, ...} - def _add_packet_arrival(self,...
Implement the Python class `Results` described below. Class description: Implement the Results class. Method signatures and docstrings: - def __init__(self): `self.packets` is a dictionary of dictionaries as follows.. {<pkt_id>: {'arrival': ___, 'departure': ___}, <pkt_id>: {...}, ...} - def _add_packet_arrival(self,...
089dc4ac171e15c214f7fe81d59d7e1fa8370201
<|skeleton|> class Results: def __init__(self): """`self.packets` is a dictionary of dictionaries as follows.. {<pkt_id>: {'arrival': ___, 'departure': ___}, <pkt_id>: {...}, ...}""" <|body_0|> def _add_packet_arrival(self, pkt_id, time, pkt_type): """Update packet list and counters wh...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Results: def __init__(self): """`self.packets` is a dictionary of dictionaries as follows.. {<pkt_id>: {'arrival': ___, 'departure': ___}, <pkt_id>: {...}, ...}""" self.num_pkts_arrived = 0 self.num_pkts_left = 0 self.num_normal_arrived = 0 self.num_normal_left = 0 ...
the_stack_v2_python_sparse
results.py
mappls/gsim
train
0
bab932ecaa0f770e6a26e0d27c95f4fd89ba89ed
[ "UndoBase.__init__(self)\nif isinstance(items, TreeItem):\n items = [items]\nfor item in items:\n self.dataList.append((item, item.data.copy()))", "if redoRef:\n redoRef.addDataUndo([tuple[0] for tuple in self.dataList], False, False)\nfor item, data in self.dataList:\n item.data = data" ]
<|body_start_0|> UndoBase.__init__(self) if isinstance(items, TreeItem): items = [items] for item in items: self.dataList.append((item, item.data.copy())) <|end_body_0|> <|body_start_1|> if redoRef: redoRef.addDataUndo([tuple[0] for tuple in self.data...
Info for undo/redo of tree item data changes
DataUndo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataUndo: """Info for undo/redo of tree item data changes""" def __init__(self, items): """Pass an item or list of items with data to save""" <|body_0|> def undo(self, redoRef=None): """Restore saved state""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_75kplus_train_071283
10,696
no_license
[ { "docstring": "Pass an item or list of items with data to save", "name": "__init__", "signature": "def __init__(self, items)" }, { "docstring": "Restore saved state", "name": "undo", "signature": "def undo(self, redoRef=None)" } ]
2
stack_v2_sparse_classes_30k_train_004726
Implement the Python class `DataUndo` described below. Class description: Info for undo/redo of tree item data changes Method signatures and docstrings: - def __init__(self, items): Pass an item or list of items with data to save - def undo(self, redoRef=None): Restore saved state
Implement the Python class `DataUndo` described below. Class description: Info for undo/redo of tree item data changes Method signatures and docstrings: - def __init__(self, items): Pass an item or list of items with data to save - def undo(self, redoRef=None): Restore saved state <|skeleton|> class DataUndo: ""...
732f8c5045588ea4382b5e88a8710fbe74df11cd
<|skeleton|> class DataUndo: """Info for undo/redo of tree item data changes""" def __init__(self, items): """Pass an item or list of items with data to save""" <|body_0|> def undo(self, redoRef=None): """Restore saved state""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataUndo: """Info for undo/redo of tree item data changes""" def __init__(self, items): """Pass an item or list of items with data to save""" UndoBase.__init__(self) if isinstance(items, TreeItem): items = [items] for item in items: self.dataList.ap...
the_stack_v2_python_sparse
source/undo.py
ErikWegner/treeline-textile-plugin
train
0
f016eed3e5da4170291d6ccc550c63f187ce7f0c
[ "super().__init__(name='continue_predictor')\nself.model_size = model_size\nself.mlp = MLP(model_size=model_size, output_layer_size=1)\ndl_type = tf.keras.mixed_precision.global_policy().compute_dtype or tf.float32\nself.call = tf.function(input_signature=[tf.TensorSpec(shape=[None, get_gru_units(model_size)], dtyp...
<|body_start_0|> super().__init__(name='continue_predictor') self.model_size = model_size self.mlp = MLP(model_size=model_size, output_layer_size=1) dl_type = tf.keras.mixed_precision.global_policy().compute_dtype or tf.float32 self.call = tf.function(input_signature=[tf.TensorSp...
The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a Bernoulli distribution, from which simply the mode is used (no stochastic sampling!)....
ContinuePredictor
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContinuePredictor: """The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a Bernoulli distribution, from which simpl...
stack_v2_sparse_classes_75kplus_train_071284
3,620
permissive
[ { "docstring": "Initializes a ContinuePredictor instance. Args: model_size: The \"Model Size\" used according to [1] Appendinx B. Determines the exact size of the underlying MLP.", "name": "__init__", "signature": "def __init__(self, *, model_size: Optional[str]='XS')" }, { "docstring": "Perform...
2
stack_v2_sparse_classes_30k_train_022214
Implement the Python class `ContinuePredictor` described below. Class description: The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a B...
Implement the Python class `ContinuePredictor` described below. Class description: The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a B...
edba68c3e7cf255d1d6479329f305adb7fa4c3ed
<|skeleton|> class ContinuePredictor: """The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a Bernoulli distribution, from which simpl...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ContinuePredictor: """The world-model network sub-component used to predict the `continue` flags . Predicted continue flags are used to produce "dream data" to learn the policy in. The continue flags are predicted via a linear output used to parameterize a Bernoulli distribution, from which simply the mode is...
the_stack_v2_python_sparse
rllib/algorithms/dreamerv3/tf/models/components/continue_predictor.py
ray-project/ray
train
29,482
7d260fc3f3b9de7d635f8b1acfd65fbd72ca8f14
[ "super().__init__(d_model, q, v, h, attention_size, **kwargs)\nself._chunk_size = chunk_size\nself._future_mask = nn.Parameter(torch.triu(torch.ones((self._chunk_size, self._chunk_size)), diagonal=1).bool(), requires_grad=False)\nif self._attention_size is not None:\n self._attention_mask = nn.Parameter(generate...
<|body_start_0|> super().__init__(d_model, q, v, h, attention_size, **kwargs) self._chunk_size = chunk_size self._future_mask = nn.Parameter(torch.triu(torch.ones((self._chunk_size, self._chunk_size)), diagonal=1).bool(), requires_grad=False) if self._attention_size is not None: ...
Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and values are divided in chunks of constant size. Parameters ---------- d_model: Dimension of ...
MultiHeadAttentionChunk
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadAttentionChunk: """Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and values are divided in chunks of constant...
stack_v2_sparse_classes_75kplus_train_071285
13,552
permissive
[ { "docstring": "Initialize the Multi Head Block.", "name": "__init__", "signature": "def __init__(self, d_model: int, q: int, v: int, h: int, attention_size: int=None, chunk_size: Optional[int]=168, **kwargs)" }, { "docstring": "Propagate forward the input through the MHB. We compute for each he...
2
stack_v2_sparse_classes_30k_train_030365
Implement the Python class `MultiHeadAttentionChunk` described below. Class description: Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and v...
Implement the Python class `MultiHeadAttentionChunk` described below. Class description: Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and v...
0b801d2d2e828ac480d1097cb3bdd82b1e25c15b
<|skeleton|> class MultiHeadAttentionChunk: """Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and values are divided in chunks of constant...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MultiHeadAttentionChunk: """Multi Head Attention block with chunk. Given 3 inputs of shape (batch_size, K, d_model), that will be used to compute query, keys and values, we output a self attention tensor of shape (batch_size, K, d_model). Queries, keys and values are divided in chunks of constant size. Parame...
the_stack_v2_python_sparse
code/deep/adarnn/tst/multiHeadAttention.py
jindongwang/transferlearning
train
12,773
f3db5b730e910dfa78a8d12aa8dd0ec5808e709c
[ "self.rdf_settings = {'bins': nbins, 'range': limits}\nself.rmax = limits[1]\n_, edges = np.histogram([-1], **self.rdf_settings)\nself.bins = 0.5 * (edges[1:] + edges[:-1])\nself.shell_vol = 4.0 / 3.0 * np.pi * (np.power(edges[1:], 3) - np.power(edges[:-1], 3))\nself.shell_area = np.pi * (np.power(edges[1:], 2) - n...
<|body_start_0|> self.rdf_settings = {'bins': nbins, 'range': limits} self.rmax = limits[1] _, edges = np.histogram([-1], **self.rdf_settings) self.bins = 0.5 * (edges[1:] + edges[:-1]) self.shell_vol = 4.0 / 3.0 * np.pi * (np.power(edges[1:], 3) - np.power(edges[:-1], 3)) ...
Compute the RDF r.bins, r.shell_vol, r.shell_area available >>> r = smda.RDF(nbins=100, limits=(0.0, 15.0)[A]) 1) For static atomic groups >>> rdf = r.run(ag1, ag2, D=2/3, nblocks=1) >>> rdf[:,0] = bins [A] >>> rdf[:,1] = RDF (avg) [unitless] >>> rdf[:,2] = RDF (std) [unitless] 2) For dynamic atomic groups >>> data = [...
RDF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RDF: """Compute the RDF r.bins, r.shell_vol, r.shell_area available >>> r = smda.RDF(nbins=100, limits=(0.0, 15.0)[A]) 1) For static atomic groups >>> rdf = r.run(ag1, ag2, D=2/3, nblocks=1) >>> rdf[:,0] = bins [A] >>> rdf[:,1] = RDF (avg) [unitless] >>> rdf[:,2] = RDF (std) [unitless] 2) For dyn...
stack_v2_sparse_classes_75kplus_train_071286
4,520
no_license
[ { "docstring": "Set up a RDF calculation. Define the number of bins and limits. Parameter --------- nbins = 100 [int] limits = (0.0, 15.0) [A]", "name": "__init__", "signature": "def __init__(self, nbins=100, limits=(0.0, 15.0))" }, { "docstring": "Run a RDF calculation for static atomic groups ...
4
null
Implement the Python class `RDF` described below. Class description: Compute the RDF r.bins, r.shell_vol, r.shell_area available >>> r = smda.RDF(nbins=100, limits=(0.0, 15.0)[A]) 1) For static atomic groups >>> rdf = r.run(ag1, ag2, D=2/3, nblocks=1) >>> rdf[:,0] = bins [A] >>> rdf[:,1] = RDF (avg) [unitless] >>> rdf...
Implement the Python class `RDF` described below. Class description: Compute the RDF r.bins, r.shell_vol, r.shell_area available >>> r = smda.RDF(nbins=100, limits=(0.0, 15.0)[A]) 1) For static atomic groups >>> rdf = r.run(ag1, ag2, D=2/3, nblocks=1) >>> rdf[:,0] = bins [A] >>> rdf[:,1] = RDF (avg) [unitless] >>> rdf...
5d445b396a7810ad9cc337aac2040d7b39bca732
<|skeleton|> class RDF: """Compute the RDF r.bins, r.shell_vol, r.shell_area available >>> r = smda.RDF(nbins=100, limits=(0.0, 15.0)[A]) 1) For static atomic groups >>> rdf = r.run(ag1, ag2, D=2/3, nblocks=1) >>> rdf[:,0] = bins [A] >>> rdf[:,1] = RDF (avg) [unitless] >>> rdf[:,2] = RDF (std) [unitless] 2) For dyn...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RDF: """Compute the RDF r.bins, r.shell_vol, r.shell_area available >>> r = smda.RDF(nbins=100, limits=(0.0, 15.0)[A]) 1) For static atomic groups >>> rdf = r.run(ag1, ag2, D=2/3, nblocks=1) >>> rdf[:,0] = bins [A] >>> rdf[:,1] = RDF (avg) [unitless] >>> rdf[:,2] = RDF (std) [unitless] 2) For dynamic atomic g...
the_stack_v2_python_sparse
compute/rdf.py
ksy141/SMDAnalysis
train
0
fc1e7988668832e2bea324770dba57a069f8f47e
[ "super(FFmpegTask, self).__init__(*args, **kwargs)\nself.setOption('scale', self.__defaultScale)\nself.setOption('videoCodec', self.__defaultVideoCodec)\nself.setOption('pixelFormat', self.__defaultPixelFormat)\nself.setOption('bitRate', self.__defaultBitRate)", "movFiles = OrderedDict()\nfor crawler in self.craw...
<|body_start_0|> super(FFmpegTask, self).__init__(*args, **kwargs) self.setOption('scale', self.__defaultScale) self.setOption('videoCodec', self.__defaultVideoCodec) self.setOption('pixelFormat', self.__defaultPixelFormat) self.setOption('bitRate', self.__defaultBitRate) <|end_b...
Abstracted ffmpeg task. Options: - optional: scale (float), videoCoded, pixelFormat and bitRate - required: sourceColorSpace, targetColorSpace and frameRate (float)
FFmpegTask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FFmpegTask: """Abstracted ffmpeg task. Options: - optional: scale (float), videoCoded, pixelFormat and bitRate - required: sourceColorSpace, targetColorSpace and frameRate (float)""" def __init__(self, *args, **kwargs): """Create a ffmpeg object.""" <|body_0|> def _perfo...
stack_v2_sparse_classes_75kplus_train_071287
4,644
permissive
[ { "docstring": "Create a ffmpeg object.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Perform the task.", "name": "_perform", "signature": "def _perform(self)" }, { "docstring": "Execute ffmpeg.", "name": "__executeFFmpeg", "s...
3
null
Implement the Python class `FFmpegTask` described below. Class description: Abstracted ffmpeg task. Options: - optional: scale (float), videoCoded, pixelFormat and bitRate - required: sourceColorSpace, targetColorSpace and frameRate (float) Method signatures and docstrings: - def __init__(self, *args, **kwargs): Crea...
Implement the Python class `FFmpegTask` described below. Class description: Abstracted ffmpeg task. Options: - optional: scale (float), videoCoded, pixelFormat and bitRate - required: sourceColorSpace, targetColorSpace and frameRate (float) Method signatures and docstrings: - def __init__(self, *args, **kwargs): Crea...
046dbb0c1b4ff20ea5f2e1679f8d89f3089b6aa4
<|skeleton|> class FFmpegTask: """Abstracted ffmpeg task. Options: - optional: scale (float), videoCoded, pixelFormat and bitRate - required: sourceColorSpace, targetColorSpace and frameRate (float)""" def __init__(self, *args, **kwargs): """Create a ffmpeg object.""" <|body_0|> def _perfo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FFmpegTask: """Abstracted ffmpeg task. Options: - optional: scale (float), videoCoded, pixelFormat and bitRate - required: sourceColorSpace, targetColorSpace and frameRate (float)""" def __init__(self, *args, **kwargs): """Create a ffmpeg object.""" super(FFmpegTask, self).__init__(*args,...
the_stack_v2_python_sparse
src/lib/kombi/Task/ImageSequence/FFmpegTask.py
kombiHQ/kombi
train
2
4946060df9f7e5dc7b361b123be906f849bc574c
[ "if isinstance(value, str) and value.replace(' ', '') == '':\n raise InvalidEmptyValue(field_name=field.name)\nreturn value", "if value.lower() not in [i.lower() for i in cls.case_management_types]:\n raise InvalidEntityType(field_name=field.name, entity_type=str(cls.case_management_types), value=value)\nre...
<|body_start_0|> if isinstance(value, str) and value.replace(' ', '') == '': raise InvalidEmptyValue(field_name=field.name) return value <|end_body_0|> <|body_start_1|> if value.lower() not in [i.lower() for i in cls.case_management_types]: raise InvalidEntityType(field_...
Case Management Entity Field (Model) Type
CaseManagementEntity
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CaseManagementEntity: """Case Management 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...
stack_v2_sparse_classes_75kplus_train_071288
2,334
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 Indicator type.", "name": "is_type", "signature": "def is_type(cls, value: str, fi...
2
stack_v2_sparse_classes_30k_train_004405
Implement the Python class `CaseManagementEntity` described below. Class description: Case Management 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) ...
Implement the Python class `CaseManagementEntity` described below. Class description: Case Management 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) ...
30dc147e40d63d1082ec2a5e6c62005b60c29c37
<|skeleton|> class CaseManagementEntity: """Case Management 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...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CaseManagementEntity: """Case Management 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=fi...
the_stack_v2_python_sparse
tcex/input/field_type/case_management_entity.py
ThreatConnect-Inc/tcex
train
24
a9e7da0fac4b44297be7057fa5a1c9bf301de638
[ "method = method.lower()\nif method == 'ascii':\n return ModbusAsciiFramer(ClientDecoder())\nelif method == 'rtu':\n return ModbusRtuFramer(ClientDecoder())\nelif method == 'binary':\n return ModbusBinaryFramer(ClientDecoder())\nelif method == 'socket':\n return ModbusSocketFramer(ClientDecoder())\nrais...
<|body_start_0|> method = method.lower() if method == 'ascii': return ModbusAsciiFramer(ClientDecoder()) elif method == 'rtu': return ModbusRtuFramer(ClientDecoder()) elif method == 'binary': return ModbusBinaryFramer(ClientDecoder()) elif meth...
Actual Async Serial Client to be used. To use do:: from pymodbus.client.asynchronous.serial import AsyncModbusSerialClient
AsyncModbusSerialClient
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AsyncModbusSerialClient: """Actual Async Serial Client to be used. To use do:: from pymodbus.client.asynchronous.serial import AsyncModbusSerialClient""" def _framer(cls, method): """Returns the requested framer :method: The serial framer to instantiate :returns: The requested serial...
stack_v2_sparse_classes_75kplus_train_071289
2,625
permissive
[ { "docstring": "Returns the requested framer :method: The serial framer to instantiate :returns: The requested serial framer", "name": "_framer", "signature": "def _framer(cls, method)" }, { "docstring": "Scheduler to use: - reactor (Twisted) - io_loop (Tornado) - async_io (asyncio) The methods ...
2
stack_v2_sparse_classes_30k_train_025525
Implement the Python class `AsyncModbusSerialClient` described below. Class description: Actual Async Serial Client to be used. To use do:: from pymodbus.client.asynchronous.serial import AsyncModbusSerialClient Method signatures and docstrings: - def _framer(cls, method): Returns the requested framer :method: The se...
Implement the Python class `AsyncModbusSerialClient` described below. Class description: Actual Async Serial Client to be used. To use do:: from pymodbus.client.asynchronous.serial import AsyncModbusSerialClient Method signatures and docstrings: - def _framer(cls, method): Returns the requested framer :method: The se...
9cdcd83a6bf59cf42bb515d5a5b3544744c53c11
<|skeleton|> class AsyncModbusSerialClient: """Actual Async Serial Client to be used. To use do:: from pymodbus.client.asynchronous.serial import AsyncModbusSerialClient""" def _framer(cls, method): """Returns the requested framer :method: The serial framer to instantiate :returns: The requested serial...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AsyncModbusSerialClient: """Actual Async Serial Client to be used. To use do:: from pymodbus.client.asynchronous.serial import AsyncModbusSerialClient""" def _framer(cls, method): """Returns the requested framer :method: The serial framer to instantiate :returns: The requested serial framer""" ...
the_stack_v2_python_sparse
pymodbus/client/asynchronous/serial.py
mdismailmd44/pymodbus
train
0
e616503f865538bb52a197459ad39484e35741e8
[ "url = '{}{}/insights/page_fans_gender_age'.format(self.GRAPH_URL, page)\nresult = self.do_request(url)\ndata = result.get('data').pop().get('values')\nlastvalues = max(data, key=lambda item: item['end_time'])\nreturn lastvalues.get('value')", "agesexspread = self.get_likes_sex_age(page)\nfullspread = {}\nfor k, ...
<|body_start_0|> url = '{}{}/insights/page_fans_gender_age'.format(self.GRAPH_URL, page) result = self.do_request(url) data = result.get('data').pop().get('values') lastvalues = max(data, key=lambda item: item['end_time']) return lastvalues.get('value') <|end_body_0|> <|body_sta...
Interface for accessing the Facebook Insights api
FacebookManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacebookManager: """Interface for accessing the Facebook Insights api""" def get_likes_sex_age(self, page): """Return sex / age spread for likes of page""" <|body_0|> def get_likes_sex_age_spread_sorted(self, page): """Return age / sex spread formatted for use in...
stack_v2_sparse_classes_75kplus_train_071290
2,092
no_license
[ { "docstring": "Return sex / age spread for likes of page", "name": "get_likes_sex_age", "signature": "def get_likes_sex_age(self, page)" }, { "docstring": "Return age / sex spread formatted for use in Google Chart", "name": "get_likes_sex_age_spread_sorted", "signature": "def get_likes_...
3
stack_v2_sparse_classes_30k_train_037487
Implement the Python class `FacebookManager` described below. Class description: Interface for accessing the Facebook Insights api Method signatures and docstrings: - def get_likes_sex_age(self, page): Return sex / age spread for likes of page - def get_likes_sex_age_spread_sorted(self, page): Return age / sex spread...
Implement the Python class `FacebookManager` described below. Class description: Interface for accessing the Facebook Insights api Method signatures and docstrings: - def get_likes_sex_age(self, page): Return sex / age spread for likes of page - def get_likes_sex_age_spread_sorted(self, page): Return age / sex spread...
eda034f9f275c684185c7cf38361e35e8ea8f528
<|skeleton|> class FacebookManager: """Interface for accessing the Facebook Insights api""" def get_likes_sex_age(self, page): """Return sex / age spread for likes of page""" <|body_0|> def get_likes_sex_age_spread_sorted(self, page): """Return age / sex spread formatted for use in...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FacebookManager: """Interface for accessing the Facebook Insights api""" def get_likes_sex_age(self, page): """Return sex / age spread for likes of page""" url = '{}{}/insights/page_fans_gender_age'.format(self.GRAPH_URL, page) result = self.do_request(url) data = result.g...
the_stack_v2_python_sparse
facebook/fbmanager.py
haikezegwaard/SAM20
train
0
aa9182a938407333d4b90f2b33a8223d68e5bee3
[ "self.max_buckets = max_buckets\nself.count = 0\nself.head = None\nself.tail = None\nself.__add_to_head()", "self.head = AdwinBucketRow(self.max_buckets, next_bucket_row=self.head)\nif self.tail is None:\n self.tail = self.head\nself.count += 1", "self.tail = AdwinBucketRow(self.max_buckets, previous_bucket_...
<|body_start_0|> self.max_buckets = max_buckets self.count = 0 self.head = None self.tail = None self.__add_to_head() <|end_body_0|> <|body_start_1|> self.head = AdwinBucketRow(self.max_buckets, next_bucket_row=self.head) if self.tail is None: self.ta...
AdwinRowBucketList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdwinRowBucketList: def __init__(self, max_buckets=5): """Args: max_buckets: Max number of bucket in each bucket row""" <|body_0|> def __add_to_head(self): """Init bucket row list.""" <|body_1|> def add_to_tail(self): """Add the bucket row at the...
stack_v2_sparse_classes_75kplus_train_071291
13,858
no_license
[ { "docstring": "Args: max_buckets: Max number of bucket in each bucket row", "name": "__init__", "signature": "def __init__(self, max_buckets=5)" }, { "docstring": "Init bucket row list.", "name": "__add_to_head", "signature": "def __add_to_head(self)" }, { "docstring": "Add the ...
4
null
Implement the Python class `AdwinRowBucketList` described below. Class description: Implement the AdwinRowBucketList class. Method signatures and docstrings: - def __init__(self, max_buckets=5): Args: max_buckets: Max number of bucket in each bucket row - def __add_to_head(self): Init bucket row list. - def add_to_ta...
Implement the Python class `AdwinRowBucketList` described below. Class description: Implement the AdwinRowBucketList class. Method signatures and docstrings: - def __init__(self, max_buckets=5): Args: max_buckets: Max number of bucket in each bucket row - def __add_to_head(self): Init bucket row list. - def add_to_ta...
4938936dbf08b5331275d4413dbad51acbaf7da9
<|skeleton|> class AdwinRowBucketList: def __init__(self, max_buckets=5): """Args: max_buckets: Max number of bucket in each bucket row""" <|body_0|> def __add_to_head(self): """Init bucket row list.""" <|body_1|> def add_to_tail(self): """Add the bucket row at the...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AdwinRowBucketList: def __init__(self, max_buckets=5): """Args: max_buckets: Max number of bucket in each bucket row""" self.max_buckets = max_buckets self.count = 0 self.head = None self.tail = None self.__add_to_head() def __add_to_head(self): """...
the_stack_v2_python_sparse
mlep_odin_main/mlep/mlep/drift_detector/LabeledDriftDetector/ADWIN.py
asuprem/ODIN
train
7
0d94e8fdd0299ddfeb3d186c4e299c1424008e4f
[ "self.players = [player1, player2]\nself.payoffmat = payoffmat\nself.opponents = {player1: player2, player2: player1}\nself.player1Neighs = player1Neighs\nself.player2Neighs = player2Neighs\nself.history = list()", "player1, player2 = self.players\nfor iteration in range(game_iter):\n if fullEnt:\n newm...
<|body_start_0|> self.players = [player1, player2] self.payoffmat = payoffmat self.opponents = {player1: player2, player2: player1} self.player1Neighs = player1Neighs self.player2Neighs = player2Neighs self.history = list() <|end_body_0|> <|body_start_1|> player1...
Class to play a two player game
TwoPlayerGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwoPlayerGame: """Class to play a two player game""" def __init__(self, player1, player2, player1Neighs, player2Neighs, payoffmat): """Initializing the two players""" <|body_0|> def run(self, fullEnt=False, game_iter=1): """Recording both players' moves""" ...
stack_v2_sparse_classes_75kplus_train_071292
2,261
no_license
[ { "docstring": "Initializing the two players", "name": "__init__", "signature": "def __init__(self, player1, player2, player1Neighs, player2Neighs, payoffmat)" }, { "docstring": "Recording both players' moves", "name": "run", "signature": "def run(self, fullEnt=False, game_iter=1)" }, ...
5
stack_v2_sparse_classes_30k_train_026438
Implement the Python class `TwoPlayerGame` described below. Class description: Class to play a two player game Method signatures and docstrings: - def __init__(self, player1, player2, player1Neighs, player2Neighs, payoffmat): Initializing the two players - def run(self, fullEnt=False, game_iter=1): Recording both pla...
Implement the Python class `TwoPlayerGame` described below. Class description: Class to play a two player game Method signatures and docstrings: - def __init__(self, player1, player2, player1Neighs, player2Neighs, payoffmat): Initializing the two players - def run(self, fullEnt=False, game_iter=1): Recording both pla...
04139f702891285efb8c33b9db87822cbdb397bc
<|skeleton|> class TwoPlayerGame: """Class to play a two player game""" def __init__(self, player1, player2, player1Neighs, player2Neighs, payoffmat): """Initializing the two players""" <|body_0|> def run(self, fullEnt=False, game_iter=1): """Recording both players' moves""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TwoPlayerGame: """Class to play a two player game""" def __init__(self, player1, player2, player1Neighs, player2Neighs, payoffmat): """Initializing the two players""" self.players = [player1, player2] self.payoffmat = payoffmat self.opponents = {player1: player2, player2: ...
the_stack_v2_python_sparse
two_player_game.py
sohamde/entitativity
train
1
c592dde74f81df459ca629172241f383b399ac34
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Provides text analysis operations such as sentiment analysis and entity recognition.
LanguageServiceServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LanguageServiceServicer: """Provides text analysis operations such as sentiment analysis and entity recognition.""" def AnalyzeSentiment(self, request, context): """Analyzes the sentiment of the provided text.""" <|body_0|> def AnalyzeEntities(self, request, context): ...
stack_v2_sparse_classes_75kplus_train_071293
8,150
permissive
[ { "docstring": "Analyzes the sentiment of the provided text.", "name": "AnalyzeSentiment", "signature": "def AnalyzeSentiment(self, request, context)" }, { "docstring": "Finds named entities (currently proper names and common nouns) in the text along with entity types, salience, mentions for eac...
6
stack_v2_sparse_classes_30k_train_001403
Implement the Python class `LanguageServiceServicer` described below. Class description: Provides text analysis operations such as sentiment analysis and entity recognition. Method signatures and docstrings: - def AnalyzeSentiment(self, request, context): Analyzes the sentiment of the provided text. - def AnalyzeEnti...
Implement the Python class `LanguageServiceServicer` described below. Class description: Provides text analysis operations such as sentiment analysis and entity recognition. Method signatures and docstrings: - def AnalyzeSentiment(self, request, context): Analyzes the sentiment of the provided text. - def AnalyzeEnti...
253e419666f5dacf4566135faf5d451600020374
<|skeleton|> class LanguageServiceServicer: """Provides text analysis operations such as sentiment analysis and entity recognition.""" def AnalyzeSentiment(self, request, context): """Analyzes the sentiment of the provided text.""" <|body_0|> def AnalyzeEntities(self, request, context): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LanguageServiceServicer: """Provides text analysis operations such as sentiment analysis and entity recognition.""" def AnalyzeSentiment(self, request, context): """Analyzes the sentiment of the provided text.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details(...
the_stack_v2_python_sparse
venv/lib/python3.7/site-packages/google/cloud/language_v1beta2/proto/language_service_pb2_grpc.py
nicholasadamou/stockmine
train
2
c4aace17994c3f0435dc162af8a02ce0195d4940
[ "self.input = []\nself.length = []\nself.num_word = num_word\nself.test_num = 0\nself.transform(test_file_name, num_word)", "jieba.add_word('[MASK]')\nwith open(test_file_name, 'r', encoding='utf-8') as f:\n for line in f:\n sentence = jieba.lcut(line)\n mask_pos = sentence.index('MASK')\n ...
<|body_start_0|> self.input = [] self.length = [] self.num_word = num_word self.test_num = 0 self.transform(test_file_name, num_word) <|end_body_0|> <|body_start_1|> jieba.add_word('[MASK]') with open(test_file_name, 'r', encoding='utf-8') as f: for l...
Test_Text2Vec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_Text2Vec: def __init__(self, test_file_name, num_word): """:param test_file_name: 测试文本位置 :param num_word: 句子最大长度""" <|body_0|> def transform(self, test_file_name, num_word): """:param test_file_name: 测试文本位置 :param num_word: 句子最大长度""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus_train_071294
13,472
no_license
[ { "docstring": ":param test_file_name: 测试文本位置 :param num_word: 句子最大长度", "name": "__init__", "signature": "def __init__(self, test_file_name, num_word)" }, { "docstring": ":param test_file_name: 测试文本位置 :param num_word: 句子最大长度", "name": "transform", "signature": "def transform(self, test_f...
3
stack_v2_sparse_classes_30k_val_002772
Implement the Python class `Test_Text2Vec` described below. Class description: Implement the Test_Text2Vec class. Method signatures and docstrings: - def __init__(self, test_file_name, num_word): :param test_file_name: 测试文本位置 :param num_word: 句子最大长度 - def transform(self, test_file_name, num_word): :param test_file_na...
Implement the Python class `Test_Text2Vec` described below. Class description: Implement the Test_Text2Vec class. Method signatures and docstrings: - def __init__(self, test_file_name, num_word): :param test_file_name: 测试文本位置 :param num_word: 句子最大长度 - def transform(self, test_file_name, num_word): :param test_file_na...
bb47b7c30f9937b26b4803a21e6ad0c7c0f7ae85
<|skeleton|> class Test_Text2Vec: def __init__(self, test_file_name, num_word): """:param test_file_name: 测试文本位置 :param num_word: 句子最大长度""" <|body_0|> def transform(self, test_file_name, num_word): """:param test_file_name: 测试文本位置 :param num_word: 句子最大长度""" <|body_1|> def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_Text2Vec: def __init__(self, test_file_name, num_word): """:param test_file_name: 测试文本位置 :param num_word: 句子最大长度""" self.input = [] self.length = [] self.num_word = num_word self.test_num = 0 self.transform(test_file_name, num_word) def transform(self,...
the_stack_v2_python_sparse
自然语言处理(权小军)/实验/期中大作业/RNN.py
fxafight/SYSU_Undergraduate
train
0
7d89cf936341c2f8cc1fd14e29f3d894fb7134d7
[ "self.ppn = ppn.transpose()\nself.netnum = netnum\nif self.ionn is not None:\n self.ionn = ionn\n self.ions = _ions_from_beyond(ionn)\nself.xm = xm\nself.zm = zm\nif copy:\n self.netnum = self.netnum.copy()\n self.ppn = self.ppn.copy()\n if self.xm is not None:\n self.xm = self.xm.copy()\n ...
<|body_start_0|> self.ppn = ppn.transpose() self.netnum = netnum if self.ionn is not None: self.ionn = ionn self.ions = _ions_from_beyond(ionn) self.xm = xm self.zm = zm if copy: self.netnum = self.netnum.copy() self.ppn = s...
Kepler abudance set. For use with ppn from KEPLER dumps. Helpful to convert ppn data with different networks as a function of zone into usable data.
KepAbuDump
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KepAbuDump: """Kepler abudance set. For use with ppn from KEPLER dumps. Helpful to convert ppn data with different networks as a function of zone into usable data.""" def __init__(self, ppn, netnum, ionn=None, wind=None, molfrac=True, xm=None, zm=None, copy=False): """Initialize with...
stack_v2_sparse_classes_75kplus_train_071295
35,814
permissive
[ { "docstring": "Initialize with KEPLER network information.", "name": "__init__", "signature": "def __init__(self, ppn, netnum, ionn=None, wind=None, molfrac=True, xm=None, zm=None, copy=False)" }, { "docstring": "Return burning energy for zones. call as, e.g., >>> xE(func='o_burn')", "name"...
4
null
Implement the Python class `KepAbuDump` described below. Class description: Kepler abudance set. For use with ppn from KEPLER dumps. Helpful to convert ppn data with different networks as a function of zone into usable data. Method signatures and docstrings: - def __init__(self, ppn, netnum, ionn=None, wind=None, mol...
Implement the Python class `KepAbuDump` described below. Class description: Kepler abudance set. For use with ppn from KEPLER dumps. Helpful to convert ppn data with different networks as a function of zone into usable data. Method signatures and docstrings: - def __init__(self, ppn, netnum, ionn=None, wind=None, mol...
98fc181bab054619d12ffa4173ad5c469803c2ec
<|skeleton|> class KepAbuDump: """Kepler abudance set. For use with ppn from KEPLER dumps. Helpful to convert ppn data with different networks as a function of zone into usable data.""" def __init__(self, ppn, netnum, ionn=None, wind=None, molfrac=True, xm=None, zm=None, copy=False): """Initialize with...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KepAbuDump: """Kepler abudance set. For use with ppn from KEPLER dumps. Helpful to convert ppn data with different networks as a function of zone into usable data.""" def __init__(self, ppn, netnum, ionn=None, wind=None, molfrac=True, xm=None, zm=None, copy=False): """Initialize with KEPLER netwo...
the_stack_v2_python_sparse
kepler_python_packages/python_scripts/kepion.py
adam-m-jcbs/xrb-sens-datashare
train
1
4b28ab9c9b3e4e034c365941704909363092b9fe
[ "self.error = error\nself.filesystem_type = filesystem_type\nself.mount_point = mount_point\nself.original_volume_name = original_volume_name", "if dictionary is None:\n return None\nerror = cohesity_management_sdk.models.error_proto.ErrorProto.from_dictionary(dictionary.get('error')) if dictionary.get('error'...
<|body_start_0|> self.error = error self.filesystem_type = filesystem_type self.mount_point = mount_point self.original_volume_name = original_volume_name <|end_body_0|> <|body_start_1|> if dictionary is None: return None error = cohesity_management_sdk.model...
Implementation of the 'MountVolumeResult' model. TODO: type description here. Attributes: error (ErrorProto): This is set if there is any error during the mount. filesystem_type (string): Filesystem on this volume. mount_point (string): This is populated with the mount point where the volume corresponding to the newly ...
MountVolumeResult
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MountVolumeResult: """Implementation of the 'MountVolumeResult' model. TODO: type description here. Attributes: error (ErrorProto): This is set if there is any error during the mount. filesystem_type (string): Filesystem on this volume. mount_point (string): This is populated with the mount point...
stack_v2_sparse_classes_75kplus_train_071296
2,605
permissive
[ { "docstring": "Constructor for the MountVolumeResult class", "name": "__init__", "signature": "def __init__(self, error=None, filesystem_type=None, mount_point=None, original_volume_name=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary):...
2
stack_v2_sparse_classes_30k_train_022973
Implement the Python class `MountVolumeResult` described below. Class description: Implementation of the 'MountVolumeResult' model. TODO: type description here. Attributes: error (ErrorProto): This is set if there is any error during the mount. filesystem_type (string): Filesystem on this volume. mount_point (string):...
Implement the Python class `MountVolumeResult` described below. Class description: Implementation of the 'MountVolumeResult' model. TODO: type description here. Attributes: error (ErrorProto): This is set if there is any error during the mount. filesystem_type (string): Filesystem on this volume. mount_point (string):...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class MountVolumeResult: """Implementation of the 'MountVolumeResult' model. TODO: type description here. Attributes: error (ErrorProto): This is set if there is any error during the mount. filesystem_type (string): Filesystem on this volume. mount_point (string): This is populated with the mount point...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MountVolumeResult: """Implementation of the 'MountVolumeResult' model. TODO: type description here. Attributes: error (ErrorProto): This is set if there is any error during the mount. filesystem_type (string): Filesystem on this volume. mount_point (string): This is populated with the mount point where the vo...
the_stack_v2_python_sparse
cohesity_management_sdk/models/mount_volume_result.py
cohesity/management-sdk-python
train
24
52fcf8e790d3847b2dbc1edf27e71578f193b696
[ "res = []\nwords = sorted(words, key=len)\n\ndef recursive(words):\n longest = words.pop()\n for each in words:\n if each in longest:\n res.append(each)\n if words == []:\n return res\n else:\n return recursive(words)\nreturn list(set(recursive(words)))", "arr = ' '.joi...
<|body_start_0|> res = [] words = sorted(words, key=len) def recursive(words): longest = words.pop() for each in words: if each in longest: res.append(each) if words == []: return res else: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def stringMatching(self, words): """:type words: List[str] :rtype: List[str]""" <|body_0|> def stringMatching_cool_solution(self, words): """:type words: List[str] :rtype: List[str]""" <|body_1|> def stringMatching_brute(self, words): "...
stack_v2_sparse_classes_75kplus_train_071297
1,529
no_license
[ { "docstring": ":type words: List[str] :rtype: List[str]", "name": "stringMatching", "signature": "def stringMatching(self, words)" }, { "docstring": ":type words: List[str] :rtype: List[str]", "name": "stringMatching_cool_solution", "signature": "def stringMatching_cool_solution(self, w...
3
stack_v2_sparse_classes_30k_train_007531
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def stringMatching(self, words): :type words: List[str] :rtype: List[str] - def stringMatching_cool_solution(self, words): :type words: List[str] :rtype: List[str] - def stringMa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def stringMatching(self, words): :type words: List[str] :rtype: List[str] - def stringMatching_cool_solution(self, words): :type words: List[str] :rtype: List[str] - def stringMa...
85f71621c54f6b0029f3a2746f022f89dd7419d9
<|skeleton|> class Solution: def stringMatching(self, words): """:type words: List[str] :rtype: List[str]""" <|body_0|> def stringMatching_cool_solution(self, words): """:type words: List[str] :rtype: List[str]""" <|body_1|> def stringMatching_brute(self, words): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def stringMatching(self, words): """:type words: List[str] :rtype: List[str]""" res = [] words = sorted(words, key=len) def recursive(words): longest = words.pop() for each in words: if each in longest: res....
the_stack_v2_python_sparse
LeetCode/String/1408_string_matching_in_an_array.py
XyK0907/for_work
train
0
ab17cf43d470bae792572fdf151859586c7ac814
[ "self.__wordshash__ = {}\nfor index, part in enumerate(words):\n if part not in self.__wordshash__:\n self.__wordshash__[part] = [index]\n else:\n self.__wordshash__[part].append(index)", "if not word1 or not word2:\n return 0\nminidistance = float('inf')\nif word1 in self.__wordshash__:\n ...
<|body_start_0|> self.__wordshash__ = {} for index, part in enumerate(words): if part not in self.__wordshash__: self.__wordshash__[part] = [index] else: self.__wordshash__[part].append(index) <|end_body_0|> <|body_start_1|> if not word1 o...
WordDistance
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.__wordshash__ = {} for i...
stack_v2_sparse_classes_75kplus_train_071298
1,243
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type word1: str :type word2: str :rtype: int", "name": "shortest", "signature": "def shortest(self, word1, word2)" } ]
2
stack_v2_sparse_classes_30k_train_037548
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int
Implement the Python class `WordDistance` described below. Class description: Implement the WordDistance class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def shortest(self, word1, word2): :type word1: str :type word2: str :rtype: int <|skeleton|> class WordDistance: ...
96fdc45d15b4150cefe12361b236de6aae3bdc6a
<|skeleton|> class WordDistance: def __init__(self, words): """:type words: List[str]""" <|body_0|> def shortest(self, word1, word2): """:type word1: str :type word2: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class WordDistance: def __init__(self, words): """:type words: List[str]""" self.__wordshash__ = {} for index, part in enumerate(words): if part not in self.__wordshash__: self.__wordshash__[part] = [index] else: self.__wordshash__[part...
the_stack_v2_python_sparse
python/244 - Shortest Word Distance II/main.py
or0986113303/LeetCodeLearn
train
0
cfec8857cc81439912798a86047b13b2742d900d
[ "self.parent = parent\nself.file_internal_gains = 'InternalGains_' + self.parent.name + '.mat'\nself.version = {'AixLib': '0.9.1', 'Buildings': '6.0.0', 'BuildingSystems': '2.0.0-beta2', 'IDEAS': '2.1.0'}\nself.consider_heat_capacity = True", "if path is None:\n path = utilities.get_default_path()\nelse:\n ...
<|body_start_0|> self.parent = parent self.file_internal_gains = 'InternalGains_' + self.parent.name + '.mat' self.version = {'AixLib': '0.9.1', 'Buildings': '6.0.0', 'BuildingSystems': '2.0.0-beta2', 'IDEAS': '2.1.0'} self.consider_heat_capacity = True <|end_body_0|> <|body_start_1|> ...
Class to calculate parameters for AixLib output. This class holds functions to sort and partly rewrite zone and building attributes specific for IBPSA simulation. This includes the export of boundary conditions. Parameters ---------- parent: Building() The parent class of this object, the Building the attributes are ca...
IBPSA
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IBPSA: """Class to calculate parameters for AixLib output. This class holds functions to sort and partly rewrite zone and building attributes specific for IBPSA simulation. This includes the export of boundary conditions. Parameters ---------- parent: Building() The parent class of this object, t...
stack_v2_sparse_classes_75kplus_train_071299
4,790
permissive
[ { "docstring": "Construct IBPSA.", "name": "__init__", "signature": "def __init__(self, parent)" }, { "docstring": "creates .mat file for internal gains boundary conditions This function creates a matfile (-v4) for building internal gains boundary conditions. It collects internal gain profiles o...
3
null
Implement the Python class `IBPSA` described below. Class description: Class to calculate parameters for AixLib output. This class holds functions to sort and partly rewrite zone and building attributes specific for IBPSA simulation. This includes the export of boundary conditions. Parameters ---------- parent: Buildi...
Implement the Python class `IBPSA` described below. Class description: Class to calculate parameters for AixLib output. This class holds functions to sort and partly rewrite zone and building attributes specific for IBPSA simulation. This includes the export of boundary conditions. Parameters ---------- parent: Buildi...
25edb5be547a750e3ad35c02a97949d2b45bce32
<|skeleton|> class IBPSA: """Class to calculate parameters for AixLib output. This class holds functions to sort and partly rewrite zone and building attributes specific for IBPSA simulation. This includes the export of boundary conditions. Parameters ---------- parent: Building() The parent class of this object, t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class IBPSA: """Class to calculate parameters for AixLib output. This class holds functions to sort and partly rewrite zone and building attributes specific for IBPSA simulation. This includes the export of boundary conditions. Parameters ---------- parent: Building() The parent class of this object, the Building t...
the_stack_v2_python_sparse
teaser/logic/buildingobjects/calculation/ibpsa.py
PRemmen/TEASER
train
1