blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
6.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
438
7.52k
id
stringlengths
40
40
length_bytes
int64
506
50k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
153
4.25k
prompted_full_text
stringlengths
645
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.34k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
302
7.33k
source
stringclasses
1 value
source_path
stringlengths
4
177
source_repo
stringlengths
6
110
split
stringclasses
1 value
star_events_count
int64
0
209k
6fc43cc5de2f4eb3942f4a340d9281a9dffb19cf
[ "levels = []\nif not root:\n return levels\n\ndef helper(node, level):\n if len(levels) == level:\n levels.append([])\n levels[level].append(node.val)\n if node.left:\n helper(node.left, level + 1)\n if node.right:\n helper(node.right, level + 1)\nhelper(root, 0)\nreturn levels[:...
<|body_start_0|> levels = [] if not root: return levels def helper(node, level): if len(levels) == level: levels.append([]) levels[level].append(node.val) if node.left: helper(node.left, level + 1) if no...
Tree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tree: def traversal_(self, root: 'TreeNode') -> List[int]: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" <|body_0|> def traversal(self, root: 'TreeNode') -> List[int]: """Approach: Iterative/ BFS Time Complexity: O(N) Sp...
stack_v2_sparse_classes_36k_train_002200
1,516
no_license
[ { "docstring": "Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return:", "name": "traversal_", "signature": "def traversal_(self, root: 'TreeNode') -> List[int]" }, { "docstring": "Approach: Iterative/ BFS Time Complexity: O(N) Space Complexity: O(N) :param root: ...
2
stack_v2_sparse_classes_30k_train_002747
Implement the Python class `Tree` described below. Class description: Implement the Tree class. Method signatures and docstrings: - def traversal_(self, root: 'TreeNode') -> List[int]: Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return: - def traversal(self, root: 'TreeNode') -> Lis...
Implement the Python class `Tree` described below. Class description: Implement the Tree class. Method signatures and docstrings: - def traversal_(self, root: 'TreeNode') -> List[int]: Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return: - def traversal(self, root: 'TreeNode') -> Lis...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class Tree: def traversal_(self, root: 'TreeNode') -> List[int]: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" <|body_0|> def traversal(self, root: 'TreeNode') -> List[int]: """Approach: Iterative/ BFS Time Complexity: O(N) Sp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Tree: def traversal_(self, root: 'TreeNode') -> List[int]: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param root: :return:""" levels = [] if not root: return levels def helper(node, level): if len(levels) == level: ...
the_stack_v2_python_sparse
revisited_2021/tree/bst_level_order_traversal.py
Shiv2157k/leet_code
train
1
ef10982b6e273e7456dff909c70456075cd34d19
[ "logs.log_info('You are using the vgK channel: Kv1p6 ')\nself.time_unit = 1000.0\nself.vrev = -65\nself.m = 1 / (1 + np.exp((V - -20.8) / -8.1))\nself.h = 1 / (1 + np.exp((V - -22.0) / 11.39))\nself._mpower = 1\nself._hpower = 1", "self._mInf = 1 / (1 + np.exp((V - -20.8) / -8.1))\nself._mTau = 30.0 / (1 + np.exp...
<|body_start_0|> logs.log_info('You are using the vgK channel: Kv1p6 ') self.time_unit = 1000.0 self.vrev = -65 self.m = 1 / (1 + np.exp((V - -20.8) / -8.1)) self.h = 1 / (1 + np.exp((V - -22.0) / 11.39)) self._mpower = 1 self._hpower = 1 <|end_body_0|> <|body_st...
Kv1.6 model from Grupe et al. 1990. Reference: A Grupe et. al; EMBO J. 1990 Jun
Kv1p6
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Kv1p6: """Kv1.6 model from Grupe et al. 1990. Reference: A Grupe et. al; EMBO J. 1990 Jun""" def _init_state(self, V): """Run initialization calculation for m and h gates of the channel at starting Vmem value.""" <|body_0|> def _calculate_state(self, V): """Updat...
stack_v2_sparse_classes_36k_train_002201
24,227
no_license
[ { "docstring": "Run initialization calculation for m and h gates of the channel at starting Vmem value.", "name": "_init_state", "signature": "def _init_state(self, V)" }, { "docstring": "Update the state of m and h gates of the channel given their present value and present simulation Vmem.", ...
2
null
Implement the Python class `Kv1p6` described below. Class description: Kv1.6 model from Grupe et al. 1990. Reference: A Grupe et. al; EMBO J. 1990 Jun Method signatures and docstrings: - def _init_state(self, V): Run initialization calculation for m and h gates of the channel at starting Vmem value. - def _calculate_...
Implement the Python class `Kv1p6` described below. Class description: Kv1.6 model from Grupe et al. 1990. Reference: A Grupe et. al; EMBO J. 1990 Jun Method signatures and docstrings: - def _init_state(self, V): Run initialization calculation for m and h gates of the channel at starting Vmem value. - def _calculate_...
dd03ff5e3df3ef48d887a6566a6286fcd168880b
<|skeleton|> class Kv1p6: """Kv1.6 model from Grupe et al. 1990. Reference: A Grupe et. al; EMBO J. 1990 Jun""" def _init_state(self, V): """Run initialization calculation for m and h gates of the channel at starting Vmem value.""" <|body_0|> def _calculate_state(self, V): """Updat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Kv1p6: """Kv1.6 model from Grupe et al. 1990. Reference: A Grupe et. al; EMBO J. 1990 Jun""" def _init_state(self, V): """Run initialization calculation for m and h gates of the channel at starting Vmem value.""" logs.log_info('You are using the vgK channel: Kv1p6 ') self.time_uni...
the_stack_v2_python_sparse
betse/science/channels/vg_k.py
R-Stefano/betse-ml
train
0
bffb5b2ec43fe0dda7a7121250061023acb31905
[ "assert logits.size() == labels.size() and logits.dim() == 2\nloss = soft_dice_cpp.soft_dice_forward(logits, labels, p, smooth)\nctx.vars = (logits, labels, p, smooth)\nreturn loss", "logits, labels, p, smooth = ctx.vars\ngrads = soft_dice_cpp.soft_dice_backward(grad_output, logits, labels, p, smooth)\nreturn (gr...
<|body_start_0|> assert logits.size() == labels.size() and logits.dim() == 2 loss = soft_dice_cpp.soft_dice_forward(logits, labels, p, smooth) ctx.vars = (logits, labels, p, smooth) return loss <|end_body_0|> <|body_start_1|> logits, labels, p, smooth = ctx.vars grads = ...
compute backward directly for better numeric stability
SoftDiceLossV3Func
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftDiceLossV3Func: """compute backward directly for better numeric stability""" def forward(ctx, logits, labels, p, smooth): """inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)""" <|body_0|> def backward(ctx, grad_output): """compute gradient of soft-dic...
stack_v2_sparse_classes_36k_train_002202
7,172
permissive
[ { "docstring": "inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)", "name": "forward", "signature": "def forward(ctx, logits, labels, p, smooth)" }, { "docstring": "compute gradient of soft-dice loss", "name": "backward", "signature": "def backward(ctx, grad_output)" } ]
2
stack_v2_sparse_classes_30k_train_004968
Implement the Python class `SoftDiceLossV3Func` described below. Class description: compute backward directly for better numeric stability Method signatures and docstrings: - def forward(ctx, logits, labels, p, smooth): inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,) - def backward(ctx, grad_output): compute...
Implement the Python class `SoftDiceLossV3Func` described below. Class description: compute backward directly for better numeric stability Method signatures and docstrings: - def forward(ctx, logits, labels, p, smooth): inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,) - def backward(ctx, grad_output): compute...
99e04f64fb2ce46c2e6906750a716b93984fbe97
<|skeleton|> class SoftDiceLossV3Func: """compute backward directly for better numeric stability""" def forward(ctx, logits, labels, p, smooth): """inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)""" <|body_0|> def backward(ctx, grad_output): """compute gradient of soft-dic...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SoftDiceLossV3Func: """compute backward directly for better numeric stability""" def forward(ctx, logits, labels, p, smooth): """inputs: logits: (N, L) labels: (N, L) outpus: loss: (N,)""" assert logits.size() == labels.size() and logits.dim() == 2 loss = soft_dice_cpp.soft_dice_f...
the_stack_v2_python_sparse
soft_dice_loss.py
CoinCheung/pytorch-loss
train
2,079
4986d7562765fae465ddffef852a0071fca82fc4
[ "conv_dt = naive.astimezone(pytz.timezone(tz)).strftime('%Y-%m-%d %H:%M:%S')\nlogger.logic_log('LOSI13022', tz, naive, conv_dt, request=request)\nreturn conv_dt", "tz_ex = pytz.timezone(tz)\nnaive = naive.replace('/', '-')\nuser_dt = datetime.datetime.strptime(naive, '%Y-%m-%d %H:%M:%S')\ncou_dt = tz_ex.localize(...
<|body_start_0|> conv_dt = naive.astimezone(pytz.timezone(tz)).strftime('%Y-%m-%d %H:%M:%S') logger.logic_log('LOSI13022', tz, naive, conv_dt, request=request) return conv_dt <|end_body_0|> <|body_start_1|> tz_ex = pytz.timezone(tz) naive = naive.replace('/', '-') user_d...
TimeConversion
[ "Apache-2.0", "BSD-3-Clause", "LGPL-3.0-only", "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeConversion: def get_time_conversion(cls, naive, tz, request=None): """[概要] 時刻変換処理を行う [戻り値] 変換した時刻""" <|body_0|> def get_time_conversion_utc(cls, naive, tz, request=None): """[概要] 時刻変換処理を行う [戻り値] utc_dt : 変換した時刻(UTC)""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_002203
9,642
permissive
[ { "docstring": "[概要] 時刻変換処理を行う [戻り値] 変換した時刻", "name": "get_time_conversion", "signature": "def get_time_conversion(cls, naive, tz, request=None)" }, { "docstring": "[概要] 時刻変換処理を行う [戻り値] utc_dt : 変換した時刻(UTC)", "name": "get_time_conversion_utc", "signature": "def get_time_conversion_utc(cl...
2
stack_v2_sparse_classes_30k_train_012301
Implement the Python class `TimeConversion` described below. Class description: Implement the TimeConversion class. Method signatures and docstrings: - def get_time_conversion(cls, naive, tz, request=None): [概要] 時刻変換処理を行う [戻り値] 変換した時刻 - def get_time_conversion_utc(cls, naive, tz, request=None): [概要] 時刻変換処理を行う [戻り値] u...
Implement the Python class `TimeConversion` described below. Class description: Implement the TimeConversion class. Method signatures and docstrings: - def get_time_conversion(cls, naive, tz, request=None): [概要] 時刻変換処理を行う [戻り値] 変換した時刻 - def get_time_conversion_utc(cls, naive, tz, request=None): [概要] 時刻変換処理を行う [戻り値] u...
c00ea4fe1bf4b4a18d545aabeaaf1d95c7664b94
<|skeleton|> class TimeConversion: def get_time_conversion(cls, naive, tz, request=None): """[概要] 時刻変換処理を行う [戻り値] 変換した時刻""" <|body_0|> def get_time_conversion_utc(cls, naive, tz, request=None): """[概要] 時刻変換処理を行う [戻り値] utc_dt : 変換した時刻(UTC)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimeConversion: def get_time_conversion(cls, naive, tz, request=None): """[概要] 時刻変換処理を行う [戻り値] 変換した時刻""" conv_dt = naive.astimezone(pytz.timezone(tz)).strftime('%Y-%m-%d %H:%M:%S') logger.logic_log('LOSI13022', tz, naive, conv_dt, request=request) return conv_dt def get_ti...
the_stack_v2_python_sparse
oase-root/libs/webcommonlibs/common.py
exastro-suite/oase
train
10
fe4f4fbf0dc7df80f50bafb7bf083f1a1e9d6f1e
[ "super(AttachFile, self).__init__(**kwargs)\nself.dirty_path = os.path.expanduser(path)\nreturn", "params = {}\nif self._mimetype:\n params['mime'] = self._mimetype\nif self._name:\n params['name'] = self._name\nreturn 'file://{path}{params}'.format(path=self.quote(self.dirty_path), params='?{}'.format(self...
<|body_start_0|> super(AttachFile, self).__init__(**kwargs) self.dirty_path = os.path.expanduser(path) return <|end_body_0|> <|body_start_1|> params = {} if self._mimetype: params['mime'] = self._mimetype if self._name: params['name'] = self._name...
A wrapper for File based attachment sources
AttachFile
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttachFile: """A wrapper for File based attachment sources""" def __init__(self, path, **kwargs): """Initialize Local File Attachment Object""" <|body_0|> def url(self, privacy=False, *args, **kwargs): """Returns the URL built dynamically based on specified argum...
stack_v2_sparse_classes_36k_train_002204
4,260
permissive
[ { "docstring": "Initialize Local File Attachment Object", "name": "__init__", "signature": "def __init__(self, path, **kwargs)" }, { "docstring": "Returns the URL built dynamically based on specified arguments.", "name": "url", "signature": "def url(self, privacy=False, *args, **kwargs)"...
4
stack_v2_sparse_classes_30k_train_014842
Implement the Python class `AttachFile` described below. Class description: A wrapper for File based attachment sources Method signatures and docstrings: - def __init__(self, path, **kwargs): Initialize Local File Attachment Object - def url(self, privacy=False, *args, **kwargs): Returns the URL built dynamically bas...
Implement the Python class `AttachFile` described below. Class description: A wrapper for File based attachment sources Method signatures and docstrings: - def __init__(self, path, **kwargs): Initialize Local File Attachment Object - def url(self, privacy=False, *args, **kwargs): Returns the URL built dynamically bas...
784e073eea64d2ee37cc52e7a2391bce35b05720
<|skeleton|> class AttachFile: """A wrapper for File based attachment sources""" def __init__(self, path, **kwargs): """Initialize Local File Attachment Object""" <|body_0|> def url(self, privacy=False, *args, **kwargs): """Returns the URL built dynamically based on specified argum...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AttachFile: """A wrapper for File based attachment sources""" def __init__(self, path, **kwargs): """Initialize Local File Attachment Object""" super(AttachFile, self).__init__(**kwargs) self.dirty_path = os.path.expanduser(path) return def url(self, privacy=False, *a...
the_stack_v2_python_sparse
apprise/attachment/AttachFile.py
raman325/apprise
train
1
14ebbb9fbe80ef81332110dc2a3416b7b6b3f6f5
[ "self._attr_entity_category = EntityCategory.DIAGNOSTIC\nself.entity_domain = ENTITY_DOMAIN\nsuper().__init__(config_entry=config_entry, coordinator=coordinator, description=description)", "if self.coordinator.data:\n if self.entity_description.state_value:\n return self.entity_description.state_value(s...
<|body_start_0|> self._attr_entity_category = EntityCategory.DIAGNOSTIC self.entity_domain = ENTITY_DOMAIN super().__init__(config_entry=config_entry, coordinator=coordinator, description=description) <|end_body_0|> <|body_start_1|> if self.coordinator.data: if self.entity_d...
Representation of a binary sensor.
HDHomerunBinarySensor
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HDHomerunBinarySensor: """Representation of a binary sensor.""" def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None: """Initialise.""" <|body_0|> def is_on(self) -> bool: "...
stack_v2_sparse_classes_36k_train_002205
10,682
permissive
[ { "docstring": "Initialise.", "name": "__init__", "signature": "def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None" }, { "docstring": "Return if the service is on.", "name": "is_on", "signature": ...
2
stack_v2_sparse_classes_30k_train_018015
Implement the Python class `HDHomerunBinarySensor` described below. Class description: Representation of a binary sensor. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None: Initialise. - de...
Implement the Python class `HDHomerunBinarySensor` described below. Class description: Representation of a binary sensor. Method signatures and docstrings: - def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None: Initialise. - de...
8548d9999ddd54f13d6a307e013abcb8c897a74e
<|skeleton|> class HDHomerunBinarySensor: """Representation of a binary sensor.""" def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None: """Initialise.""" <|body_0|> def is_on(self) -> bool: "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HDHomerunBinarySensor: """Representation of a binary sensor.""" def __init__(self, config_entry: ConfigEntry, coordinator: DataUpdateCoordinator, description: HDHomerunBinarySensorEntityDescription) -> None: """Initialise.""" self._attr_entity_category = EntityCategory.DIAGNOSTIC ...
the_stack_v2_python_sparse
custom_components/hdhomerun/binary_sensor.py
bacco007/HomeAssistantConfig
train
98
ec2e87e055675cf26e17f8200c9f425fec1eadab
[ "data = parameter_required(('user_name', 'user_password'))\nuser = an_user.query.filter(an_user.isdelete == '0', an_user.user_name == data.get('user_name')).first_('未找到该账号或该账号被禁用')\nhash_password = hashlib.md5(data.get('user_password').encode('utf-8'))\nif user and hash_password.hexdigest() == user.user_password:\n...
<|body_start_0|> data = parameter_required(('user_name', 'user_password')) user = an_user.query.filter(an_user.isdelete == '0', an_user.user_name == data.get('user_name')).first_('未找到该账号或该账号被禁用') hash_password = hashlib.md5(data.get('user_password').encode('utf-8')) if user and hash_pass...
CUser
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CUser: def user_login(self): """用户登录""" <|body_0|> def user_password_repeat(self): """用户修改密码""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = parameter_required(('user_name', 'user_password')) user = an_user.query.filter(an_user.isdele...
stack_v2_sparse_classes_36k_train_002206
2,568
permissive
[ { "docstring": "用户登录", "name": "user_login", "signature": "def user_login(self)" }, { "docstring": "用户修改密码", "name": "user_password_repeat", "signature": "def user_password_repeat(self)" } ]
2
stack_v2_sparse_classes_30k_train_012241
Implement the Python class `CUser` described below. Class description: Implement the CUser class. Method signatures and docstrings: - def user_login(self): 用户登录 - def user_password_repeat(self): 用户修改密码
Implement the Python class `CUser` described below. Class description: Implement the CUser class. Method signatures and docstrings: - def user_login(self): 用户登录 - def user_password_repeat(self): 用户修改密码 <|skeleton|> class CUser: def user_login(self): """用户登录""" <|body_0|> def user_password_r...
37a9b0d6e7a3f110ba9285a3715fec2e30bdd7d2
<|skeleton|> class CUser: def user_login(self): """用户登录""" <|body_0|> def user_password_repeat(self): """用户修改密码""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CUser: def user_login(self): """用户登录""" data = parameter_required(('user_name', 'user_password')) user = an_user.query.filter(an_user.isdelete == '0', an_user.user_name == data.get('user_name')).first_('未找到该账号或该账号被禁用') hash_password = hashlib.md5(data.get('user_password').encod...
the_stack_v2_python_sparse
FanstiBgs/control/CUser.py
haobin12358/FanstiBgs
train
0
a810f7d73afe68b72a8c17cce7cdc34c888b8b6f
[ "self.model = model\nself.mode = mode\nself.epsilon = epsilon\nself.k = k\nself.a = a\nself.rand = random_start\nself.loss_fn = nn.CrossEntropyLoss()\nself.device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')\nself.pert_box = pert_box\nself.x_box_min, self.x_box_max = (x_box_min, x_box_max)", "...
<|body_start_0|> self.model = model self.mode = mode self.epsilon = epsilon self.k = k self.a = a self.rand = random_start self.loss_fn = nn.CrossEntropyLoss() self.device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') self.pert_b...
LinfPGDAttack
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinfPGDAttack: def __init__(self, mode, x_box_min=-1, x_box_max=0, pert_box=0.3, model=None, epsilon=0.3, k=40, a=0.01, random_start=True): """Attack parameter initialization. The attack performs k steps of size a, while always staying within epsilon from the initial point. https://githu...
stack_v2_sparse_classes_36k_train_002207
9,669
no_license
[ { "docstring": "Attack parameter initialization. The attack performs k steps of size a, while always staying within epsilon from the initial point. https://github.com/MadryLab/mnist_challenge/blob/master/pgd_attack.py", "name": "__init__", "signature": "def __init__(self, mode, x_box_min=-1, x_box_max=0...
2
null
Implement the Python class `LinfPGDAttack` described below. Class description: Implement the LinfPGDAttack class. Method signatures and docstrings: - def __init__(self, mode, x_box_min=-1, x_box_max=0, pert_box=0.3, model=None, epsilon=0.3, k=40, a=0.01, random_start=True): Attack parameter initialization. The attack...
Implement the Python class `LinfPGDAttack` described below. Class description: Implement the LinfPGDAttack class. Method signatures and docstrings: - def __init__(self, mode, x_box_min=-1, x_box_max=0, pert_box=0.3, model=None, epsilon=0.3, k=40, a=0.01, random_start=True): Attack parameter initialization. The attack...
24aa157bfaee452a5f0312f422c0c385c363d293
<|skeleton|> class LinfPGDAttack: def __init__(self, mode, x_box_min=-1, x_box_max=0, pert_box=0.3, model=None, epsilon=0.3, k=40, a=0.01, random_start=True): """Attack parameter initialization. The attack performs k steps of size a, while always staying within epsilon from the initial point. https://githu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinfPGDAttack: def __init__(self, mode, x_box_min=-1, x_box_max=0, pert_box=0.3, model=None, epsilon=0.3, k=40, a=0.01, random_start=True): """Attack parameter initialization. The attack performs k steps of size a, while always staying within epsilon from the initial point. https://github.com/MadryLab...
the_stack_v2_python_sparse
attacks/white_box/adv_box/attacks.py
SmartHomePrivacyProject/AdversarialTraffic
train
2
694cdef58bb4ac0a8809736306c74c5e562104e2
[ "self.counter = 0\nself.parent = [[0 for j in range(n)] for i in range(m)]\nfor i in range(m):\n for j in range(n):\n if grid[i][j] == '1':\n self.counter += 1\n self.parent[i][j] = (i, j)", "while self.parent[x][y] != (x, y):\n parent_x, parent_y = self.parent[x][y]\n self.p...
<|body_start_0|> self.counter = 0 self.parent = [[0 for j in range(n)] for i in range(m)] for i in range(m): for j in range(n): if grid[i][j] == '1': self.counter += 1 self.parent[i][j] = (i, j) <|end_body_0|> <|body_start_1|> ...
UF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UF: def __init__(self, m, n, grid): """m row n colomn grid""" <|body_0|> def find(self, x, y): """find the root and do path compression in the mean time""" <|body_1|> def union(self, x, y, i, j): """union (x, y) and (i, j)""" <|body_2|> ...
stack_v2_sparse_classes_36k_train_002208
9,064
no_license
[ { "docstring": "m row n colomn grid", "name": "__init__", "signature": "def __init__(self, m, n, grid)" }, { "docstring": "find the root and do path compression in the mean time", "name": "find", "signature": "def find(self, x, y)" }, { "docstring": "union (x, y) and (i, j)", ...
3
null
Implement the Python class `UF` described below. Class description: Implement the UF class. Method signatures and docstrings: - def __init__(self, m, n, grid): m row n colomn grid - def find(self, x, y): find the root and do path compression in the mean time - def union(self, x, y, i, j): union (x, y) and (i, j)
Implement the Python class `UF` described below. Class description: Implement the UF class. Method signatures and docstrings: - def __init__(self, m, n, grid): m row n colomn grid - def find(self, x, y): find the root and do path compression in the mean time - def union(self, x, y, i, j): union (x, y) and (i, j) <|s...
abb19fa2859634f5260d439812525bb14399ae55
<|skeleton|> class UF: def __init__(self, m, n, grid): """m row n colomn grid""" <|body_0|> def find(self, x, y): """find the root and do path compression in the mean time""" <|body_1|> def union(self, x, y, i, j): """union (x, y) and (i, j)""" <|body_2|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UF: def __init__(self, m, n, grid): """m row n colomn grid""" self.counter = 0 self.parent = [[0 for j in range(n)] for i in range(m)] for i in range(m): for j in range(n): if grid[i][j] == '1': self.counter += 1 ...
the_stack_v2_python_sparse
graph/200.number-of-islands.py
caitaozhan/LeetCode
train
6
c42145706873c6a924e3ab932bfa5561ad9c93c1
[ "if middle and stranded:\n pickleFileStr = self.fbBasename() + '_mid_strand.pick'\nelif middle:\n pickleFileStr = self.fbBasename() + '_mid.pick'\nelif stranded:\n pickleFileStr = self.fbBasename() + '_strand.pick'\nelse:\n pickleFileStr = self.fbBasename() + '.pick'\nfileExists = os.path.isfile(pickleF...
<|body_start_0|> if middle and stranded: pickleFileStr = self.fbBasename() + '_mid_strand.pick' elif middle: pickleFileStr = self.fbBasename() + '_mid.pick' elif stranded: pickleFileStr = self.fbBasename() + '_strand.pick' else: pickleFileS...
stores information about the start or midpoint of read
FileBED
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileBED: """stores information about the start or midpoint of read""" def getBedDict(self, middle=False, stranded=False): """return dictionary where key is chromosome, value is dictionary that dictionary has positions as key and value is number of reads that cover the position dictio...
stack_v2_sparse_classes_36k_train_002209
22,678
no_license
[ { "docstring": "return dictionary where key is chromosome, value is dictionary that dictionary has positions as key and value is number of reads that cover the position dictionary contains key '##counts##' that stores total number of reads in library", "name": "getBedDict", "signature": "def getBedDict(...
3
null
Implement the Python class `FileBED` described below. Class description: stores information about the start or midpoint of read Method signatures and docstrings: - def getBedDict(self, middle=False, stranded=False): return dictionary where key is chromosome, value is dictionary that dictionary has positions as key an...
Implement the Python class `FileBED` described below. Class description: stores information about the start or midpoint of read Method signatures and docstrings: - def getBedDict(self, middle=False, stranded=False): return dictionary where key is chromosome, value is dictionary that dictionary has positions as key an...
189bf355f0f878c5603b09a06b3b50b61a11ad93
<|skeleton|> class FileBED: """stores information about the start or midpoint of read""" def getBedDict(self, middle=False, stranded=False): """return dictionary where key is chromosome, value is dictionary that dictionary has positions as key and value is number of reads that cover the position dictio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FileBED: """stores information about the start or midpoint of read""" def getBedDict(self, middle=False, stranded=False): """return dictionary where key is chromosome, value is dictionary that dictionary has positions as key and value is number of reads that cover the position dictionary contains...
the_stack_v2_python_sparse
python_util/bioFiles.py
bhofmei/analysis-scripts
train
2
f1982f3a13007e1638159e23d6733e4f317d433b
[ "import bisect\nqueue = []\nres = []\nfor num in nums[::-1]:\n loc = bisect.bisect_left(queue, num)\n res.append(loc)\n queue.insert(loc, num)\nreturn res[::-1]", "arr = []\nres = [0] * len(nums)\nfor idx, num in enumerate(nums):\n arr.append((idx, num))\n\ndef merge_sort(arr):\n if len(arr) <= 1:\...
<|body_start_0|> import bisect queue = [] res = [] for num in nums[::-1]: loc = bisect.bisect_left(queue, num) res.append(loc) queue.insert(loc, num) return res[::-1] <|end_body_0|> <|body_start_1|> arr = [] res = [0] * len(num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countSmaller_2div(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def countSmaller_merge_sort(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> def countSmaller_Fenwick_Tree(self, nums): """...
stack_v2_sparse_classes_36k_train_002210
5,177
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "countSmaller_2div", "signature": "def countSmaller_2div(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[int]", "name": "countSmaller_merge_sort", "signature": "def countSmaller_merge_sort(self, nums)" ...
5
stack_v2_sparse_classes_30k_train_020809
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSmaller_2div(self, nums): :type nums: List[int] :rtype: List[int] - def countSmaller_merge_sort(self, nums): :type nums: List[int] :rtype: List[int] - def countSmaller_F...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSmaller_2div(self, nums): :type nums: List[int] :rtype: List[int] - def countSmaller_merge_sort(self, nums): :type nums: List[int] :rtype: List[int] - def countSmaller_F...
3f4284330f9771037ca59e2e6a94122e51e58540
<|skeleton|> class Solution: def countSmaller_2div(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_0|> def countSmaller_merge_sort(self, nums): """:type nums: List[int] :rtype: List[int]""" <|body_1|> def countSmaller_Fenwick_Tree(self, nums): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countSmaller_2div(self, nums): """:type nums: List[int] :rtype: List[int]""" import bisect queue = [] res = [] for num in nums[::-1]: loc = bisect.bisect_left(queue, num) res.append(loc) queue.insert(loc, num) re...
the_stack_v2_python_sparse
Leetcode/315.计算右侧小于当前元素的个数.py
myf-algorithm/Leetcode
train
1
bfa23529263e6c479f45427434bbf346e2cc932a
[ "n = len(nums)\ntarget_index = n - k\nleft, right = (0, n - 1)\nwhile True:\n index = self._partition(nums, left, right)\n if index == target_index:\n return nums[index]\n elif index < target_index:\n left = index + 1\n else:\n right = index - 1", "pivot = left\ni, j = (left, righ...
<|body_start_0|> n = len(nums) target_index = n - k left, right = (0, n - 1) while True: index = self._partition(nums, left, right) if index == target_index: return nums[index] elif index < target_index: left = index + 1...
OfficialSolution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OfficialSolution: def find_kth_largest(self, nums: List[int], k: int) -> int: """基于快速排序的选择方法。""" <|body_0|> def _partition(self, nums: List[int], left, right: int) -> int: """快排分区。""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) ...
stack_v2_sparse_classes_36k_train_002211
2,954
no_license
[ { "docstring": "基于快速排序的选择方法。", "name": "find_kth_largest", "signature": "def find_kth_largest(self, nums: List[int], k: int) -> int" }, { "docstring": "快排分区。", "name": "_partition", "signature": "def _partition(self, nums: List[int], left, right: int) -> int" } ]
2
null
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def find_kth_largest(self, nums: List[int], k: int) -> int: 基于快速排序的选择方法。 - def _partition(self, nums: List[int], left, right: int) -> int: 快排分区。
Implement the Python class `OfficialSolution` described below. Class description: Implement the OfficialSolution class. Method signatures and docstrings: - def find_kth_largest(self, nums: List[int], k: int) -> int: 基于快速排序的选择方法。 - def _partition(self, nums: List[int], left, right: int) -> int: 快排分区。 <|skeleton|> cla...
6932d69353b94ec824dd0ddc86a92453f6673232
<|skeleton|> class OfficialSolution: def find_kth_largest(self, nums: List[int], k: int) -> int: """基于快速排序的选择方法。""" <|body_0|> def _partition(self, nums: List[int], left, right: int) -> int: """快排分区。""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OfficialSolution: def find_kth_largest(self, nums: List[int], k: int) -> int: """基于快速排序的选择方法。""" n = len(nums) target_index = n - k left, right = (0, n - 1) while True: index = self._partition(nums, left, right) if index == target_index: ...
the_stack_v2_python_sparse
0215_kth-largest-element-in-an-array.py
Nigirimeshi/leetcode
train
0
2f169249abe3d136b6566049624a5acf748410e4
[ "project = AdviserProject.objects.get(id=project_id)\nif not request.user.is_superuser and project.id_company.id != request.user.adviseruser.id_company.id:\n return HttpResponseBadRequest('Permission denied')\nplayers = Player.objects.filter(project=project_id)\ndata = [model_to_dict(i) for i in players]\nreturn...
<|body_start_0|> project = AdviserProject.objects.get(id=project_id) if not request.user.is_superuser and project.id_company.id != request.user.adviseruser.id_company.id: return HttpResponseBadRequest('Permission denied') players = Player.objects.filter(project=project_id) da...
Class-based view used for handling adding project to players while edditing.
AdviserProjectToPlayers
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdviserProjectToPlayers: """Class-based view used for handling adding project to players while edditing.""" def get(self, request, project_id): """Handling GET method. :param request: Request to View. :param project_id: id of project for which players will be returned :return: Http r...
stack_v2_sparse_classes_36k_train_002212
4,916
no_license
[ { "docstring": "Handling GET method. :param request: Request to View. :param project_id: id of project for which players will be returned :return: Http response with list of players that have current project", "name": "get", "signature": "def get(self, request, project_id)" }, { "docstring": "Ha...
2
stack_v2_sparse_classes_30k_train_003712
Implement the Python class `AdviserProjectToPlayers` described below. Class description: Class-based view used for handling adding project to players while edditing. Method signatures and docstrings: - def get(self, request, project_id): Handling GET method. :param request: Request to View. :param project_id: id of p...
Implement the Python class `AdviserProjectToPlayers` described below. Class description: Class-based view used for handling adding project to players while edditing. Method signatures and docstrings: - def get(self, request, project_id): Handling GET method. :param request: Request to View. :param project_id: id of p...
46bbe0fb30ce151e398034720939fb4fecea9ac5
<|skeleton|> class AdviserProjectToPlayers: """Class-based view used for handling adding project to players while edditing.""" def get(self, request, project_id): """Handling GET method. :param request: Request to View. :param project_id: id of project for which players will be returned :return: Http r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdviserProjectToPlayers: """Class-based view used for handling adding project to players while edditing.""" def get(self, request, project_id): """Handling GET method. :param request: Request to View. :param project_id: id of project for which players will be returned :return: Http response with ...
the_stack_v2_python_sparse
itaplay/itaplay/projects/views.py
TarasStankovskyi/itaplay
train
0
06005864f49d8d7056eb9cbf0a53d337c3c907bb
[ "self._go = import_or_raise('plotly.graph_objects', error_msg='Cannot find dependency plotly.graph_objects')\nself.results = results\nself.objective = objective", "if not interactive_plot:\n plot_obj = SearchIterationPlot(self.results, self.objective)\n return self._go.Figure(plot_obj.best_score_by_iter_fig...
<|body_start_0|> self._go = import_or_raise('plotly.graph_objects', error_msg='Cannot find dependency plotly.graph_objects') self.results = results self.objective = objective <|end_body_0|> <|body_start_1|> if not interactive_plot: plot_obj = SearchIterationPlot(self.results...
Plots for the AutoMLSearch class.
PipelineSearchPlots
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PipelineSearchPlots: """Plots for the AutoMLSearch class.""" def __init__(self, results, objective): """Make plots for the AutoMLSearch class. Arguments: data (AutoMLSearch): Automated pipeline search object""" <|body_0|> def search_iteration_plot(self, interactive_plot=...
stack_v2_sparse_classes_36k_train_002213
4,225
permissive
[ { "docstring": "Make plots for the AutoMLSearch class. Arguments: data (AutoMLSearch): Automated pipeline search object", "name": "__init__", "signature": "def __init__(self, results, objective)" }, { "docstring": "Shows a plot of the best score at each iteration using data gathered during train...
2
stack_v2_sparse_classes_30k_train_013227
Implement the Python class `PipelineSearchPlots` described below. Class description: Plots for the AutoMLSearch class. Method signatures and docstrings: - def __init__(self, results, objective): Make plots for the AutoMLSearch class. Arguments: data (AutoMLSearch): Automated pipeline search object - def search_iterat...
Implement the Python class `PipelineSearchPlots` described below. Class description: Plots for the AutoMLSearch class. Method signatures and docstrings: - def __init__(self, results, objective): Make plots for the AutoMLSearch class. Arguments: data (AutoMLSearch): Automated pipeline search object - def search_iterat...
3b5bf62b08a5a5bc6485ba5387a08c32e1857473
<|skeleton|> class PipelineSearchPlots: """Plots for the AutoMLSearch class.""" def __init__(self, results, objective): """Make plots for the AutoMLSearch class. Arguments: data (AutoMLSearch): Automated pipeline search object""" <|body_0|> def search_iteration_plot(self, interactive_plot=...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PipelineSearchPlots: """Plots for the AutoMLSearch class.""" def __init__(self, results, objective): """Make plots for the AutoMLSearch class. Arguments: data (AutoMLSearch): Automated pipeline search object""" self._go = import_or_raise('plotly.graph_objects', error_msg='Cannot find depe...
the_stack_v2_python_sparse
evalml/automl/pipeline_search_plots.py
ObinnaObeleagu/evalml
train
1
9f8818bdf9c241d76a86cbbbe66aede528f85082
[ "if not node1 or not node2:\n return\nnode1.next = node2\nself.connect_two_node(node1.left, node1.right)\nself.connect_two_node(node2.left, node2.right)\nself.connect_two_node(node1.right, node2.left)", "if not root:\n return root\nself.connect_two_node(root.left, root.right)\nreturn root" ]
<|body_start_0|> if not node1 or not node2: return node1.next = node2 self.connect_two_node(node1.left, node1.right) self.connect_two_node(node2.left, node2.right) self.connect_two_node(node1.right, node2.left) <|end_body_0|> <|body_start_1|> if not root: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def connect_two_node(self, node1, node2): """负责连接每一个节点""" <|body_0|> def connect(self, root): """:type root: Node :rtype: Node""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not node1 or not node2: return node1.next...
stack_v2_sparse_classes_36k_train_002214
1,152
no_license
[ { "docstring": "负责连接每一个节点", "name": "connect_two_node", "signature": "def connect_two_node(self, node1, node2)" }, { "docstring": ":type root: Node :rtype: Node", "name": "connect", "signature": "def connect(self, root)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def connect_two_node(self, node1, node2): 负责连接每一个节点 - def connect(self, root): :type root: Node :rtype: Node
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def connect_two_node(self, node1, node2): 负责连接每一个节点 - def connect(self, root): :type root: Node :rtype: Node <|skeleton|> class Solution: def connect_two_node(self, node1, ...
f1bbd6b3197cd9ac4f0d35a37539c11b02272065
<|skeleton|> class Solution: def connect_two_node(self, node1, node2): """负责连接每一个节点""" <|body_0|> def connect(self, root): """:type root: Node :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def connect_two_node(self, node1, node2): """负责连接每一个节点""" if not node1 or not node2: return node1.next = node2 self.connect_two_node(node1.left, node1.right) self.connect_two_node(node2.left, node2.right) self.connect_two_node(node1.right, ...
the_stack_v2_python_sparse
leetcode/高频面试/树/116. 填充每个节点的下一个右侧节点指针/connect.py
guohaoyuan/algorithms-for-work
train
2
d33f5928e4414fbed5d4a09ae32baa2c6f413c19
[ "super(Encoder, self).__init__()\nself.input_size = input_size\nself.hidden_size = hidden_size\nself.num_layers = num_layers\nif rnn_type == 'LSTM':\n self.model = nn.LSTM(input_size=self.input_size, hidden_size=self.hidden_size, num_layers=self.num_layers, batch_first=batch_first, dropout=dropout)\nelif rnn_typ...
<|body_start_0|> super(Encoder, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layers = num_layers if rnn_type == 'LSTM': self.model = nn.LSTM(input_size=self.input_size, hidden_size=self.hidden_size, num_layers=self.num_layers, ...
Encoder Network
Encoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: """Encoder Network""" def __init__(self, input_size: int, hidden_size: int, num_layers: int, dropout: float=0, batch_first: bool=True, rnn_type: str='LSTM'): """Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes ...
stack_v2_sparse_classes_36k_train_002215
14,969
permissive
[ { "docstring": "Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step num_layers (int): number of layers dropout (float, optional): percentage of nodes that should switched out at any term. Defaults to 0. batch_first (bool, optional): if ...
2
stack_v2_sparse_classes_30k_train_015069
Implement the Python class `Encoder` described below. Class description: Encoder Network Method signatures and docstrings: - def __init__(self, input_size: int, hidden_size: int, num_layers: int, dropout: float=0, batch_first: bool=True, rnn_type: str='LSTM'): Create Encoder Args: input_size (int): number of features...
Implement the Python class `Encoder` described below. Class description: Encoder Network Method signatures and docstrings: - def __init__(self, input_size: int, hidden_size: int, num_layers: int, dropout: float=0, batch_first: bool=True, rnn_type: str='LSTM'): Create Encoder Args: input_size (int): number of features...
5b4a61b5dd0bc259ffe68223877949ef4ebfa5e3
<|skeleton|> class Encoder: """Encoder Network""" def __init__(self, input_size: int, hidden_size: int, num_layers: int, dropout: float=0, batch_first: bool=True, rnn_type: str='LSTM'): """Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: """Encoder Network""" def __init__(self, input_size: int, hidden_size: int, num_layers: int, dropout: float=0, batch_first: bool=True, rnn_type: str='LSTM'): """Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step...
the_stack_v2_python_sparse
src/models/anomalia/layers.py
maurony/ts-vrae
train
1
08e032e28b7cdabc2bc9e7f5312e2d79854f5b8d
[ "self.send_response(200)\nself.send_header('Content-type', 'text/plain')\nself.end_headers()\nself.wfile.write('Ca se passe en POST pour les requetes !')", "form = FieldStorage(fp=self.rfile, headers=self.headers, environ={'REQUEST_METHOD': 'POST', 'CONTENT_TYPE': self.headers['Content-Type']})\nuser = form.getva...
<|body_start_0|> self.send_response(200) self.send_header('Content-type', 'text/plain') self.end_headers() self.wfile.write('Ca se passe en POST pour les requetes !') <|end_body_0|> <|body_start_1|> form = FieldStorage(fp=self.rfile, headers=self.headers, environ={'REQUEST_METHO...
SpeechServerHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SpeechServerHandler: def do_GET(self): """Respond to a GET request""" <|body_0|> def do_POST(self): """Respond to a POST request""" <|body_1|> def buildXMLResponse(cls, data): """Build the XML doc response from the data dictionnary""" <|b...
stack_v2_sparse_classes_36k_train_002216
3,003
no_license
[ { "docstring": "Respond to a GET request", "name": "do_GET", "signature": "def do_GET(self)" }, { "docstring": "Respond to a POST request", "name": "do_POST", "signature": "def do_POST(self)" }, { "docstring": "Build the XML doc response from the data dictionnary", "name": "b...
4
stack_v2_sparse_classes_30k_train_012887
Implement the Python class `SpeechServerHandler` described below. Class description: Implement the SpeechServerHandler class. Method signatures and docstrings: - def do_GET(self): Respond to a GET request - def do_POST(self): Respond to a POST request - def buildXMLResponse(cls, data): Build the XML doc response from...
Implement the Python class `SpeechServerHandler` described below. Class description: Implement the SpeechServerHandler class. Method signatures and docstrings: - def do_GET(self): Respond to a GET request - def do_POST(self): Respond to a POST request - def buildXMLResponse(cls, data): Build the XML doc response from...
a19dd57beb18bd9e1f6978c4566b92c10d6974bd
<|skeleton|> class SpeechServerHandler: def do_GET(self): """Respond to a GET request""" <|body_0|> def do_POST(self): """Respond to a POST request""" <|body_1|> def buildXMLResponse(cls, data): """Build the XML doc response from the data dictionnary""" <|b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SpeechServerHandler: def do_GET(self): """Respond to a GET request""" self.send_response(200) self.send_header('Content-type', 'text/plain') self.end_headers() self.wfile.write('Ca se passe en POST pour les requetes !') def do_POST(self): """Respond to a PO...
the_stack_v2_python_sparse
src/speechserver/main.py
giliam/mig2013
train
2
24f2856da5d448cf2fb35641dea3462c2665a217
[ "if self is DoorStatusEnum.OPENED:\n return 'opened'\nif self is DoorStatusEnum.CLOSED:\n return 'closed'\nif self is DoorStatusEnum.LOCKED:\n return 'locked'\nif self is DoorStatusEnum.DESTROYED:\n return 'destroyed'\nassert False, 'Missing desc for DoorStatusEnum'\nreturn ''", "if self in [DoorStatu...
<|body_start_0|> if self is DoorStatusEnum.OPENED: return 'opened' if self is DoorStatusEnum.CLOSED: return 'closed' if self is DoorStatusEnum.LOCKED: return 'locked' if self is DoorStatusEnum.DESTROYED: return 'destroyed' assert Fa...
All possible door statuses
DoorStatusEnum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DoorStatusEnum: """All possible door statuses""" def desc(self) -> str: """desc""" <|body_0|> def glyph(self) -> str: """what to display""" <|body_1|> <|end_skeleton|> <|body_start_0|> if self is DoorStatusEnum.OPENED: return 'opened...
stack_v2_sparse_classes_36k_train_002217
4,891
no_license
[ { "docstring": "desc", "name": "desc", "signature": "def desc(self) -> str" }, { "docstring": "what to display", "name": "glyph", "signature": "def glyph(self) -> str" } ]
2
null
Implement the Python class `DoorStatusEnum` described below. Class description: All possible door statuses Method signatures and docstrings: - def desc(self) -> str: desc - def glyph(self) -> str: what to display
Implement the Python class `DoorStatusEnum` described below. Class description: All possible door statuses Method signatures and docstrings: - def desc(self) -> str: desc - def glyph(self) -> str: what to display <|skeleton|> class DoorStatusEnum: """All possible door statuses""" def desc(self) -> str: ...
5e4f00d2b0bd1be33607131db209affdb79f0390
<|skeleton|> class DoorStatusEnum: """All possible door statuses""" def desc(self) -> str: """desc""" <|body_0|> def glyph(self) -> str: """what to display""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DoorStatusEnum: """All possible door statuses""" def desc(self) -> str: """desc""" if self is DoorStatusEnum.OPENED: return 'opened' if self is DoorStatusEnum.CLOSED: return 'closed' if self is DoorStatusEnum.LOCKED: return 'locked' ...
the_stack_v2_python_sparse
src/hidden.py
lefranco/pnethack
train
0
74ba08f9061f4490e3a4ce0a14648d49fac40c25
[ "data_segments = []\nwhile compressed_data:\n data = zlib_decompressor.decompress(compressed_data)\n if not data:\n break\n data_segments.append(data)\n compressed_data = getattr(zlib_decompressor, 'unused_data', b'')\nreturn (b''.join(data_segments), compressed_data)", "zlib_decompressor = zli...
<|body_start_0|> data_segments = [] while compressed_data: data = zlib_decompressor.decompress(compressed_data) if not data: break data_segments.append(data) compressed_data = getattr(zlib_decompressor, 'unused_data', b'') return (b...
GZip (.gz) file.
GZipFile
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GZipFile: """GZip (.gz) file.""" def _ReadCompressedData(self, zlib_decompressor, compressed_data): """Reads compressed data. Args: zlib_decompressor (zlib.Decompress): zlib decompressor. compressed_data (bytes): compressed data. Returns: tuple[bytes, bytes]: decompressed data and re...
stack_v2_sparse_classes_36k_train_002218
5,252
permissive
[ { "docstring": "Reads compressed data. Args: zlib_decompressor (zlib.Decompress): zlib decompressor. compressed_data (bytes): compressed data. Returns: tuple[bytes, bytes]: decompressed data and remaining data.", "name": "_ReadCompressedData", "signature": "def _ReadCompressedData(self, zlib_decompresso...
5
stack_v2_sparse_classes_30k_train_007820
Implement the Python class `GZipFile` described below. Class description: GZip (.gz) file. Method signatures and docstrings: - def _ReadCompressedData(self, zlib_decompressor, compressed_data): Reads compressed data. Args: zlib_decompressor (zlib.Decompress): zlib decompressor. compressed_data (bytes): compressed dat...
Implement the Python class `GZipFile` described below. Class description: GZip (.gz) file. Method signatures and docstrings: - def _ReadCompressedData(self, zlib_decompressor, compressed_data): Reads compressed data. Args: zlib_decompressor (zlib.Decompress): zlib decompressor. compressed_data (bytes): compressed dat...
55007dcac48efff42c497e739208ebfb88e4048d
<|skeleton|> class GZipFile: """GZip (.gz) file.""" def _ReadCompressedData(self, zlib_decompressor, compressed_data): """Reads compressed data. Args: zlib_decompressor (zlib.Decompress): zlib decompressor. compressed_data (bytes): compressed data. Returns: tuple[bytes, bytes]: decompressed data and re...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GZipFile: """GZip (.gz) file.""" def _ReadCompressedData(self, zlib_decompressor, compressed_data): """Reads compressed data. Args: zlib_decompressor (zlib.Decompress): zlib decompressor. compressed_data (bytes): compressed data. Returns: tuple[bytes, bytes]: decompressed data and remaining data....
the_stack_v2_python_sparse
dtformats/gzipfile.py
libyal/dtformats
train
109
ce4f3652ea3f9af32a181eb52fa9f879083b2c91
[ "orig_query = self.request.get('query')\nlogging.debug('Received raw query %r', orig_query)\nif not self.QUERY_LIMIT_RE.search(orig_query):\n orig_query += ' LIMIT 30'\nquery = orig_query\nquery, columns = self._RemoveSelectFromQuery(query)\nif query == orig_query and columns == self.DEFAULT_COLUMNS:\n orig_q...
<|body_start_0|> orig_query = self.request.get('query') logging.debug('Received raw query %r', orig_query) if not self.QUERY_LIMIT_RE.search(orig_query): orig_query += ' LIMIT 30' query = orig_query query, columns = self._RemoveSelectFromQuery(query) if query ...
Provide interface for interacting with DB.
MainPage
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainPage: """Provide interface for interacting with DB.""" def get(self): """Support GET to stats page.""" <|body_0|> def _RemoveSelectFromQuery(self, query): """Remove SELECT clause from |query|, return tuple (new_query, columns).""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_002219
9,774
permissive
[ { "docstring": "Support GET to stats page.", "name": "get", "signature": "def get(self)" }, { "docstring": "Remove SELECT clause from |query|, return tuple (new_query, columns).", "name": "_RemoveSelectFromQuery", "signature": "def _RemoveSelectFromQuery(self, query)" }, { "docst...
5
stack_v2_sparse_classes_30k_train_019750
Implement the Python class `MainPage` described below. Class description: Provide interface for interacting with DB. Method signatures and docstrings: - def get(self): Support GET to stats page. - def _RemoveSelectFromQuery(self, query): Remove SELECT clause from |query|, return tuple (new_query, columns). - def _Adj...
Implement the Python class `MainPage` described below. Class description: Provide interface for interacting with DB. Method signatures and docstrings: - def get(self): Support GET to stats page. - def _RemoveSelectFromQuery(self, query): Remove SELECT clause from |query|, return tuple (new_query, columns). - def _Adj...
72a05af97787001756bae2511b7985e61498c965
<|skeleton|> class MainPage: """Provide interface for interacting with DB.""" def get(self): """Support GET to stats page.""" <|body_0|> def _RemoveSelectFromQuery(self, query): """Remove SELECT clause from |query|, return tuple (new_query, columns).""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainPage: """Provide interface for interacting with DB.""" def get(self): """Support GET to stats page.""" orig_query = self.request.get('query') logging.debug('Received raw query %r', orig_query) if not self.QUERY_LIMIT_RE.search(orig_query): orig_query += ' L...
the_stack_v2_python_sparse
third_party/chromite/appengine/chromiumos-build-stats/stats.py
metux/chromium-suckless
train
5
9cca4d0436123088fc965a428d3ef9cdc99d9176
[ "if not root:\n return True\nif not self.isValidBST(root.left):\n return False\nif not self.isValidBST(root.right):\n return False\nif root.left:\n if not self.get_largest(root.left) < root.val:\n return False\nif root.right:\n if not root.val < self.get_smallest(root.right):\n return F...
<|body_start_0|> if not root: return True if not self.isValidBST(root.left): return False if not self.isValidBST(root.right): return False if root.left: if not self.get_largest(root.left) < root.val: return False if ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isValidBST(self, root): """Google Phone Interview Question, 20 Sep 2013 recursive dfs alternative answer: convert the tree the array and judge whether it is sorted :param root: a tree node :return: boolean""" <|body_0|> def get_largest(self, root): """p...
stack_v2_sparse_classes_36k_train_002220
1,874
permissive
[ { "docstring": "Google Phone Interview Question, 20 Sep 2013 recursive dfs alternative answer: convert the tree the array and judge whether it is sorted :param root: a tree node :return: boolean", "name": "isValidBST", "signature": "def isValidBST(self, root)" }, { "docstring": "possible dp :par...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): Google Phone Interview Question, 20 Sep 2013 recursive dfs alternative answer: convert the tree the array and judge whether it is sorted :param root: ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isValidBST(self, root): Google Phone Interview Question, 20 Sep 2013 recursive dfs alternative answer: convert the tree the array and judge whether it is sorted :param root: ...
cbbd4a67ab342ada2421e13f82d660b1d47d4d20
<|skeleton|> class Solution: def isValidBST(self, root): """Google Phone Interview Question, 20 Sep 2013 recursive dfs alternative answer: convert the tree the array and judge whether it is sorted :param root: a tree node :return: boolean""" <|body_0|> def get_largest(self, root): """p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isValidBST(self, root): """Google Phone Interview Question, 20 Sep 2013 recursive dfs alternative answer: convert the tree the array and judge whether it is sorted :param root: a tree node :return: boolean""" if not root: return True if not self.isValidBST(roo...
the_stack_v2_python_sparse
098 Validate Binary Search Tree.py
Aminaba123/LeetCode
train
1
b6d751bee3e871bce59453d32b8c4bb19b1aa645
[ "self.parser = reqparse.RequestParser()\nself.parser.add_argument('name')\nself.parser.add_argument('token')\nsuper(CtaStrategyStart, self).__init__()", "args = self.parser.parse_args()\ntoken = args['token']\nname = 'strategyHedge_syt'\nengine = me.getApp('CtaStrategy')\nif not name:\n engine.startAll()\nelse...
<|body_start_0|> self.parser = reqparse.RequestParser() self.parser.add_argument('name') self.parser.add_argument('token') super(CtaStrategyStart, self).__init__() <|end_body_0|> <|body_start_1|> args = self.parser.parse_args() token = args['token'] name = 'strat...
启动策略
CtaStrategyStart
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CtaStrategyStart: """启动策略""" def __init__(self): """初始化""" <|body_0|> def post(self): """订阅""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.parser = reqparse.RequestParser() self.parser.add_argument('name') self.parser.add_a...
stack_v2_sparse_classes_36k_train_002221
24,002
permissive
[ { "docstring": "初始化", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "订阅", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_002190
Implement the Python class `CtaStrategyStart` described below. Class description: 启动策略 Method signatures and docstrings: - def __init__(self): 初始化 - def post(self): 订阅
Implement the Python class `CtaStrategyStart` described below. Class description: 启动策略 Method signatures and docstrings: - def __init__(self): 初始化 - def post(self): 订阅 <|skeleton|> class CtaStrategyStart: """启动策略""" def __init__(self): """初始化""" <|body_0|> def post(self): """订阅"...
c316649161086da2543d39bf0455d0f793cdd08f
<|skeleton|> class CtaStrategyStart: """启动策略""" def __init__(self): """初始化""" <|body_0|> def post(self): """订阅""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CtaStrategyStart: """启动策略""" def __init__(self): """初始化""" self.parser = reqparse.RequestParser() self.parser.add_argument('name') self.parser.add_argument('token') super(CtaStrategyStart, self).__init__() def post(self): """订阅""" args = self.p...
the_stack_v2_python_sparse
WebTrader/webServer.py
webclinic017/riskBacktestingPlatform
train
0
b724ba1afa0a4071f6114d4d6c9ba8ecc0f136aa
[ "super(RunTaskTemplateResponse, self).__init__(id=id, status=status, inputs=inputs, outputs=outputs, condition=condition, task_template_id_input=task_template_id_input, cascade_status_input=cascade_status_input, created=created, modified=modified, **kwargs)\nif outputs is None:\n self.task_id_output = task_id_ou...
<|body_start_0|> super(RunTaskTemplateResponse, self).__init__(id=id, status=status, inputs=inputs, outputs=outputs, condition=condition, task_template_id_input=task_template_id_input, cascade_status_input=cascade_status_input, created=created, modified=modified, **kwargs) if outputs is None: ...
Fetchcore response to run a task template as a subtask.
RunTaskTemplateResponse
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RunTaskTemplateResponse: """Fetchcore response to run a task template as a subtask.""" def __init__(self, id=None, status=ResponseStatus.NEW, task_template_id_input=None, cascade_status_input=None, inputs=None, outputs=None, condition=None, task_id_output=None, created=None, modified=None, *...
stack_v2_sparse_classes_36k_train_002222
3,046
no_license
[ { "docstring": ":param int id: The resource ID of the response. :param str status: Status of this response. :param int task_template_id_input: The ID of the task template to run. :param bool cascade_status_input: Whether to propagate the response's status to the action. :param inputs: Input parameters of the re...
3
null
Implement the Python class `RunTaskTemplateResponse` described below. Class description: Fetchcore response to run a task template as a subtask. Method signatures and docstrings: - def __init__(self, id=None, status=ResponseStatus.NEW, task_template_id_input=None, cascade_status_input=None, inputs=None, outputs=None,...
Implement the Python class `RunTaskTemplateResponse` described below. Class description: Fetchcore response to run a task template as a subtask. Method signatures and docstrings: - def __init__(self, id=None, status=ResponseStatus.NEW, task_template_id_input=None, cascade_status_input=None, inputs=None, outputs=None,...
7c30438f145c5e59522bb0f27a3914ce21a13c33
<|skeleton|> class RunTaskTemplateResponse: """Fetchcore response to run a task template as a subtask.""" def __init__(self, id=None, status=ResponseStatus.NEW, task_template_id_input=None, cascade_status_input=None, inputs=None, outputs=None, condition=None, task_id_output=None, created=None, modified=None, *...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RunTaskTemplateResponse: """Fetchcore response to run a task template as a subtask.""" def __init__(self, id=None, status=ResponseStatus.NEW, task_template_id_input=None, cascade_status_input=None, inputs=None, outputs=None, condition=None, task_id_output=None, created=None, modified=None, **kwargs): ...
the_stack_v2_python_sparse
fetchapp/lib/python2.7/site-packages/fetchcore/resources/tasks/actions/responses/definitions/run_task_template/run_task_template_response.py
JasonVranek/jason_fetchcore
train
0
cce9e38d3fb535d24e3727d984e4b18c3695ed43
[ "context = super(CreateAllGroupView, self).get_context_data(**kwargs)\ncontext['submit_text'] = 'Create'\ncontext['intro_text'] = 'You can use this form to create a new group that contains all currently active contacts.'\nreturn context", "g, created = RecipientGroup.objects.get_or_create(name=form.cleaned_data['...
<|body_start_0|> context = super(CreateAllGroupView, self).get_context_data(**kwargs) context['submit_text'] = 'Create' context['intro_text'] = 'You can use this form to create a new group that contains all currently active contacts.' return context <|end_body_0|> <|body_start_1|> ...
View to handle creation of an 'all' group.
CreateAllGroupView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CreateAllGroupView: """View to handle creation of an 'all' group.""" def get_context_data(self, **kwargs): """Inject intro and button text into context.""" <|body_0|> def form_valid(self, form): """Create the group and add all active users.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_002223
1,363
permissive
[ { "docstring": "Inject intro and button text into context.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" }, { "docstring": "Create the group and add all active users.", "name": "form_valid", "signature": "def form_valid(self, form)" } ]
2
stack_v2_sparse_classes_30k_train_019377
Implement the Python class `CreateAllGroupView` described below. Class description: View to handle creation of an 'all' group. Method signatures and docstrings: - def get_context_data(self, **kwargs): Inject intro and button text into context. - def form_valid(self, form): Create the group and add all active users.
Implement the Python class `CreateAllGroupView` described below. Class description: View to handle creation of an 'all' group. Method signatures and docstrings: - def get_context_data(self, **kwargs): Inject intro and button text into context. - def form_valid(self, form): Create the group and add all active users. ...
1827547b5a8cf94bf1708bb4029c0b0e834416a9
<|skeleton|> class CreateAllGroupView: """View to handle creation of an 'all' group.""" def get_context_data(self, **kwargs): """Inject intro and button text into context.""" <|body_0|> def form_valid(self, form): """Create the group and add all active users.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CreateAllGroupView: """View to handle creation of an 'all' group.""" def get_context_data(self, **kwargs): """Inject intro and button text into context.""" context = super(CreateAllGroupView, self).get_context_data(**kwargs) context['submit_text'] = 'Create' context['intro...
the_stack_v2_python_sparse
apostello/views/recipient_groups.py
armenzg/apostello
train
0
c88efdd63f9d9c079d2673fd0bcc97e673a92a32
[ "self.env = env\nself.lr = lr\nself.model_saving_file_path = model_saving_file_path\nself.model_saving_interval = model_saving_interval\nself.training_logs_file_path = training_logs_file_path\nif model is not None:\n self.model = model\nelse:\n self.model = Sequential()\n self.model.add(Dense(16, input_dim...
<|body_start_0|> self.env = env self.lr = lr self.model_saving_file_path = model_saving_file_path self.model_saving_interval = model_saving_interval self.training_logs_file_path = training_logs_file_path if model is not None: self.model = model else: ...
This class is responsible for the following. 1. Map observations to Q values using a neural network. 3. Update the model using the experience supplied by the agent. 4. Implement an epsilon greedy policy based on the model. This implementation assumes a continuous observation space and a discrete action space.
NeuralNetwork
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NeuralNetwork: """This class is responsible for the following. 1. Map observations to Q values using a neural network. 3. Update the model using the experience supplied by the agent. 4. Implement an epsilon greedy policy based on the model. This implementation assumes a continuous observation spa...
stack_v2_sparse_classes_36k_train_002224
6,369
no_license
[ { "docstring": "Arguments: env -- A Gym environment (can be vanilla or wrapped). We need this for infering input and output dimensions of the model. lr -- Learning rate model -- A compiled Keras model. If None, then the model is created. training_logs_file_path -- The file where we should save the logs for trai...
3
stack_v2_sparse_classes_30k_train_019752
Implement the Python class `NeuralNetwork` described below. Class description: This class is responsible for the following. 1. Map observations to Q values using a neural network. 3. Update the model using the experience supplied by the agent. 4. Implement an epsilon greedy policy based on the model. This implementati...
Implement the Python class `NeuralNetwork` described below. Class description: This class is responsible for the following. 1. Map observations to Q values using a neural network. 3. Update the model using the experience supplied by the agent. 4. Implement an epsilon greedy policy based on the model. This implementati...
09645ba04e43c7d6408b6e4b8cbbc4743c2fa5d8
<|skeleton|> class NeuralNetwork: """This class is responsible for the following. 1. Map observations to Q values using a neural network. 3. Update the model using the experience supplied by the agent. 4. Implement an epsilon greedy policy based on the model. This implementation assumes a continuous observation spa...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NeuralNetwork: """This class is responsible for the following. 1. Map observations to Q values using a neural network. 3. Update the model using the experience supplied by the agent. 4. Implement an epsilon greedy policy based on the model. This implementation assumes a continuous observation space and a disc...
the_stack_v2_python_sparse
09_fn_approx_neural_network/reference_implementation/fn_approx_neural_network/model_and_policy.py
lakhotiaharshit/practical_rl_for_coders
train
0
952c8476516bd959c5c594912f888eb02f23a609
[ "assert evictinterval > dedupinterval, '%r <= %r' % (evictinterval, dedupinterval)\nsuper(ReaderThread, self).__init__()\nself.readerq = ReaderQueue(100000)\nself.lines_collected = 0\nself.lines_dropped = 0\nself.dedupinterval = dedupinterval\nself.evictinterval = evictinterval\nself.run_state = run_state", "LOG....
<|body_start_0|> assert evictinterval > dedupinterval, '%r <= %r' % (evictinterval, dedupinterval) super(ReaderThread, self).__init__() self.readerq = ReaderQueue(100000) self.lines_collected = 0 self.lines_dropped = 0 self.dedupinterval = dedupinterval self.evict...
The main ReaderThread is responsible for reading from the collectors and assuring that we always read from the input no matter what. All data read is put into the self.readerq Queue, which is consumed by the SenderThread.
ReaderThread
[ "PSF-2.0", "LGPL-2.0-or-later", "BSD-3-Clause", "Apache-2.0", "BSD-2-Clause", "MPL-2.0", "LGPL-3.0-only", "GPL-3.0-only" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReaderThread: """The main ReaderThread is responsible for reading from the collectors and assuring that we always read from the input no matter what. All data read is put into the self.readerq Queue, which is consumed by the SenderThread.""" def __init__(self, dedupinterval, evictinterval, r...
stack_v2_sparse_classes_36k_train_002225
49,877
permissive
[ { "docstring": "Constructor. Args: dedupinterval: If a metric sends the same value over successive intervals, suppress sending the same value to the TSD until this many seconds have elapsed. This helps graphs over narrow time ranges still see timeseries with suppressed datapoints. evictinterval: In order to imp...
3
stack_v2_sparse_classes_30k_train_010644
Implement the Python class `ReaderThread` described below. Class description: The main ReaderThread is responsible for reading from the collectors and assuring that we always read from the input no matter what. All data read is put into the self.readerq Queue, which is consumed by the SenderThread. Method signatures ...
Implement the Python class `ReaderThread` described below. Class description: The main ReaderThread is responsible for reading from the collectors and assuring that we always read from the input no matter what. All data read is put into the self.readerq Queue, which is consumed by the SenderThread. Method signatures ...
5099a498edc47ab841965b483c2c32af49eb7dae
<|skeleton|> class ReaderThread: """The main ReaderThread is responsible for reading from the collectors and assuring that we always read from the input no matter what. All data read is put into the self.readerq Queue, which is consumed by the SenderThread.""" def __init__(self, dedupinterval, evictinterval, r...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReaderThread: """The main ReaderThread is responsible for reading from the collectors and assuring that we always read from the input no matter what. All data read is put into the self.readerq Queue, which is consumed by the SenderThread.""" def __init__(self, dedupinterval, evictinterval, run_state=None...
the_stack_v2_python_sparse
scalyr_agent/third_party/tcollector/tcollector.py
scalyr/scalyr-agent-2
train
75
9680a3db51fa62145d5b9823a41ba15568c1e153
[ "self.machinesets = []\nfor machineset_path in glob.glob(f'{ASSETS_DIR}/openshift/99_openshift-cluster-api_worker-machineset-*.yaml'):\n with open(machineset_path) as f:\n self.machinesets.append(yaml.load(f, Loader=yaml.FullLoader))\nwith open(f'{ASSETS_DIR}/manifests/cluster-config.yaml') as f:\n clu...
<|body_start_0|> self.machinesets = [] for machineset_path in glob.glob(f'{ASSETS_DIR}/openshift/99_openshift-cluster-api_worker-machineset-*.yaml'): with open(machineset_path) as f: self.machinesets.append(yaml.load(f, Loader=yaml.FullLoader)) with open(f'{ASSETS_DIR...
ConvertMachineSet
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConvertMachineSet: def setUp(self): """Parse the MachineSets into a Python data structure.""" <|body_0|> def test_flavor(self): """Assert that worker machinesets take flavor from machinepool.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.mach...
stack_v2_sparse_classes_36k_train_002226
2,668
permissive
[ { "docstring": "Parse the MachineSets into a Python data structure.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Assert that worker machinesets take flavor from machinepool.", "name": "test_flavor", "signature": "def test_flavor(self)" } ]
2
stack_v2_sparse_classes_30k_train_001358
Implement the Python class `ConvertMachineSet` described below. Class description: Implement the ConvertMachineSet class. Method signatures and docstrings: - def setUp(self): Parse the MachineSets into a Python data structure. - def test_flavor(self): Assert that worker machinesets take flavor from machinepool.
Implement the Python class `ConvertMachineSet` described below. Class description: Implement the ConvertMachineSet class. Method signatures and docstrings: - def setUp(self): Parse the MachineSets into a Python data structure. - def test_flavor(self): Assert that worker machinesets take flavor from machinepool. <|sk...
d7f39ed4836c9f57ada762ec393943ba1b5ce451
<|skeleton|> class ConvertMachineSet: def setUp(self): """Parse the MachineSets into a Python data structure.""" <|body_0|> def test_flavor(self): """Assert that worker machinesets take flavor from machinepool.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ConvertMachineSet: def setUp(self): """Parse the MachineSets into a Python data structure.""" self.machinesets = [] for machineset_path in glob.glob(f'{ASSETS_DIR}/openshift/99_openshift-cluster-api_worker-machineset-*.yaml'): with open(machineset_path) as f: ...
the_stack_v2_python_sparse
scripts/openstack/manifest-tests/convert/test_convert.py
openshift/installer
train
1,541
6d0c6787512ab67073c125a994031ad5987d3918
[ "self._args = args\nrecorder_str = self._get_recorder(self._args.log)\ncriteria_dict = self._get_criteria(self._args.criteria)\nmap_name = self._get_recorder_map(recorder_str)\nworld = self._client.load_world(map_name)\ntown_map = world.get_map()\nlog = MetricsLog(recorder_str)\nmetric_class = self._get_metric_clas...
<|body_start_0|> self._args = args recorder_str = self._get_recorder(self._args.log) criteria_dict = self._get_criteria(self._args.criteria) map_name = self._get_recorder_map(recorder_str) world = self._client.load_world(map_name) town_map = world.get_map() log = ...
Main class of the metrics module. Handles the parsing and execution of the metrics.
MetricsManager
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MetricsManager: """Main class of the metrics module. Handles the parsing and execution of the metrics.""" def __init__(self, args): """Initialization of the metrics manager. This creates the client, needed to parse the information from the recorder, extract the metrics class, and run...
stack_v2_sparse_classes_36k_train_002227
5,255
permissive
[ { "docstring": "Initialization of the metrics manager. This creates the client, needed to parse the information from the recorder, extract the metrics class, and runs it", "name": "__init__", "signature": "def __init__(self, args)" }, { "docstring": "Parses the log argument into readable informa...
5
null
Implement the Python class `MetricsManager` described below. Class description: Main class of the metrics module. Handles the parsing and execution of the metrics. Method signatures and docstrings: - def __init__(self, args): Initialization of the metrics manager. This creates the client, needed to parse the informat...
Implement the Python class `MetricsManager` described below. Class description: Main class of the metrics module. Handles the parsing and execution of the metrics. Method signatures and docstrings: - def __init__(self, args): Initialization of the metrics manager. This creates the client, needed to parse the informat...
7fe8bf9581c7df140947468c6d90d7217a299d1b
<|skeleton|> class MetricsManager: """Main class of the metrics module. Handles the parsing and execution of the metrics.""" def __init__(self, args): """Initialization of the metrics manager. This creates the client, needed to parse the information from the recorder, extract the metrics class, and run...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MetricsManager: """Main class of the metrics module. Handles the parsing and execution of the metrics.""" def __init__(self, args): """Initialization of the metrics manager. This creates the client, needed to parse the information from the recorder, extract the metrics class, and runs it""" ...
the_stack_v2_python_sparse
scenario_runner/metrics_manager.py
leotimus/WorldOnRails
train
1
655e61a395ab91d28f7be26099d56e71decb9594
[ "pre = p = j = head\nfor t in range(n - 1):\n p = p.next\nwhile p.next:\n pre = j\n j = j.next\n p = p.next\nif pre == j:\n if pre == p:\n return None\n else:\n head = pre.next\n return head\nelse:\n pre.next = j.next\n return head", "p = j = head\nfor _ in range(n):\n...
<|body_start_0|> pre = p = j = head for t in range(n - 1): p = p.next while p.next: pre = j j = j.next p = p.next if pre == j: if pre == p: return None else: head = pre.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEnd2(self, head, n): """an improved logic""" <|body_1|> <|end_skeleton|> <|body_start_0|> pre = p = j = head ...
stack_v2_sparse_classes_36k_train_002228
1,033
no_license
[ { "docstring": ":type head: ListNode :type n: int :rtype: ListNode", "name": "removeNthFromEnd", "signature": "def removeNthFromEnd(self, head, n)" }, { "docstring": "an improved logic", "name": "removeNthFromEnd2", "signature": "def removeNthFromEnd2(self, head, n)" } ]
2
stack_v2_sparse_classes_30k_train_008401
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEnd2(self, head, n): an improved logic
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeNthFromEnd(self, head, n): :type head: ListNode :type n: int :rtype: ListNode - def removeNthFromEnd2(self, head, n): an improved logic <|skeleton|> class Solution: ...
9c5f6621988ce3b15394e7a5d5b949f87e0d6265
<|skeleton|> class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" <|body_0|> def removeNthFromEnd2(self, head, n): """an improved logic""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeNthFromEnd(self, head, n): """:type head: ListNode :type n: int :rtype: ListNode""" pre = p = j = head for t in range(n - 1): p = p.next while p.next: pre = j j = j.next p = p.next if pre == j: ...
the_stack_v2_python_sparse
leetcode/2016/19_removeNthFromEnd.py
YulongWu/AlgoExercise_CPP
train
1
4ef99eb3f6d05e24033249d1e8c7946b9babd241
[ "if any((isinstance(x, (Collapse, Ordered)) for x in node.clauses)):\n raise NotImplementedError(_ERROR_MESSAGE)\nnode.loops.stmt = ensure_compound(self.visit(node.loops.stmt))\nreturn node", "node = self.generic_visit(node)\ncond = transform_loop_condition(node.cond)\nstmt = transform_loop_statement(node.stmt...
<|body_start_0|> if any((isinstance(x, (Collapse, Ordered)) for x in node.clauses)): raise NotImplementedError(_ERROR_MESSAGE) node.loops.stmt = ensure_compound(self.visit(node.loops.stmt)) return node <|end_body_0|> <|body_start_1|> node = self.generic_visit(node) c...
NodeTransformer to change for loops to while loops
ForToWhile
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ForToWhile: """NodeTransformer to change for loops to while loops""" def visit_OmpFor(self, node): """Don't transform the omp for loop, but go inside it to transform any loops that may be nested inside it.""" <|body_0|> def visit_For(self, node): """Transform a f...
stack_v2_sparse_classes_36k_train_002229
3,043
no_license
[ { "docstring": "Don't transform the omp for loop, but go inside it to transform any loops that may be nested inside it.", "name": "visit_OmpFor", "signature": "def visit_OmpFor(self, node)" }, { "docstring": "Transform a for loop to a while loop", "name": "visit_For", "signature": "def v...
2
null
Implement the Python class `ForToWhile` described below. Class description: NodeTransformer to change for loops to while loops Method signatures and docstrings: - def visit_OmpFor(self, node): Don't transform the omp for loop, but go inside it to transform any loops that may be nested inside it. - def visit_For(self,...
Implement the Python class `ForToWhile` described below. Class description: NodeTransformer to change for loops to while loops Method signatures and docstrings: - def visit_OmpFor(self, node): Don't transform the omp for loop, but go inside it to transform any loops that may be nested inside it. - def visit_For(self,...
51bd9de9f264545d78c03e3cb75fe1aa2a421444
<|skeleton|> class ForToWhile: """NodeTransformer to change for loops to while loops""" def visit_OmpFor(self, node): """Don't transform the omp for loop, but go inside it to transform any loops that may be nested inside it.""" <|body_0|> def visit_For(self, node): """Transform a f...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ForToWhile: """NodeTransformer to change for loops to while loops""" def visit_OmpFor(self, node): """Don't transform the omp for loop, but go inside it to transform any loops that may be nested inside it.""" if any((isinstance(x, (Collapse, Ordered)) for x in node.clauses)): ...
the_stack_v2_python_sparse
transforms/for_to_while.py
mrchristensen/Censor
train
0
5de0369b91676178df943a9061d6d0da7076aaaa
[ "super().__init__(self.PARAMS, parameters)\nself.summary_name = parameters['summary_name']\nself.summary_filename = parameters['summary_filename']\nself.type_tag = parameters['type_tag'].lower()\nself.append_timecode = parameters.get('append_timecode', False)", "df_new = df.copy()\nsummary = dispatcher.summary_di...
<|body_start_0|> super().__init__(self.PARAMS, parameters) self.summary_name = parameters['summary_name'] self.summary_filename = parameters['summary_filename'] self.type_tag = parameters['type_tag'].lower() self.append_timecode = parameters.get('append_timecode', False) <|end_bo...
Summarize a HED type tag in a collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **type_tag** (*str*):Type tag to get_summary (e.g. `condition-variable` or `task` tags). The purpose of this op ...
SummarizeHedTypeOp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SummarizeHedTypeOp: """Summarize a HED type tag in a collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **type_tag** (*str*):Type tag to get_summary (e.g. `condition-vari...
stack_v2_sparse_classes_36k_train_002230
10,497
permissive
[ { "docstring": "Constructor for the summarize hed type operation. Parameters: parameters (dict): Dictionary with the parameter values for required and optional parameters. :raises KeyError: - If a required parameter is missing. - If an unexpected parameter is provided. :raises TypeError: - If a parameter has th...
2
null
Implement the Python class `SummarizeHedTypeOp` described below. Class description: Summarize a HED type tag in a collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **type_tag** (*str*):Type t...
Implement the Python class `SummarizeHedTypeOp` described below. Class description: Summarize a HED type tag in a collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **type_tag** (*str*):Type t...
b871cae44bdf0ee68c688562c3b0af50b93343f5
<|skeleton|> class SummarizeHedTypeOp: """Summarize a HED type tag in a collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **type_tag** (*str*):Type tag to get_summary (e.g. `condition-vari...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SummarizeHedTypeOp: """Summarize a HED type tag in a collection of tabular files. Required remodeling parameters: - **summary_name** (*str*): The name of the summary. - **summary_filename** (*str*): Base filename of the summary. - **type_tag** (*str*):Type tag to get_summary (e.g. `condition-variable` or `tas...
the_stack_v2_python_sparse
hed/tools/remodeling/operations/summarize_hed_type_op.py
hed-standard/hed-python
train
5
5dcdc54368092f46aa396b1723e004a8af661fa1
[ "super(FasterRcnnResnetV1FeatureExtractor, self).__init__(reuse_weights=reuse_weights)\nself._resnet_name = resnet_name\nself._resnet_fn = resnet_fn\nself._output_stride = output_stride\nself._weight_decay = weight_decay", "with slim.arg_scope(resnet_utils.resnet_arg_scope(batch_norm_epsilon=1e-05, batch_norm_sca...
<|body_start_0|> super(FasterRcnnResnetV1FeatureExtractor, self).__init__(reuse_weights=reuse_weights) self._resnet_name = resnet_name self._resnet_fn = resnet_fn self._output_stride = output_stride self._weight_decay = weight_decay <|end_body_0|> <|body_start_1|> with s...
ResNet feature extractor for Faster RCNN model.
FasterRcnnResnetV1FeatureExtractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FasterRcnnResnetV1FeatureExtractor: """ResNet feature extractor for Faster RCNN model.""" def __init__(self, resnet_name, resnet_fn, output_stride, weight_decay=0.0, reuse_weights=None): """Constructor. Args: resnet_name: string scalar, ResNet model name (e.g. 'resnet_v1_101') resnet...
stack_v2_sparse_classes_36k_train_002231
3,880
no_license
[ { "docstring": "Constructor. Args: resnet_name: string scalar, ResNet model name (e.g. 'resnet_v1_101') resnet_fn: a callable that takes as input the input feature maps and generates the output feature map. output_stride: int scalar, output stride (e.g. 16, 32). weight_decay: float scalar, weight decay. reuse_w...
3
null
Implement the Python class `FasterRcnnResnetV1FeatureExtractor` described below. Class description: ResNet feature extractor for Faster RCNN model. Method signatures and docstrings: - def __init__(self, resnet_name, resnet_fn, output_stride, weight_decay=0.0, reuse_weights=None): Constructor. Args: resnet_name: strin...
Implement the Python class `FasterRcnnResnetV1FeatureExtractor` described below. Class description: ResNet feature extractor for Faster RCNN model. Method signatures and docstrings: - def __init__(self, resnet_name, resnet_fn, output_stride, weight_decay=0.0, reuse_weights=None): Constructor. Args: resnet_name: strin...
5a53e02c690632bcf140d1b17327959609aab395
<|skeleton|> class FasterRcnnResnetV1FeatureExtractor: """ResNet feature extractor for Faster RCNN model.""" def __init__(self, resnet_name, resnet_fn, output_stride, weight_decay=0.0, reuse_weights=None): """Constructor. Args: resnet_name: string scalar, ResNet model name (e.g. 'resnet_v1_101') resnet...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FasterRcnnResnetV1FeatureExtractor: """ResNet feature extractor for Faster RCNN model.""" def __init__(self, resnet_name, resnet_fn, output_stride, weight_decay=0.0, reuse_weights=None): """Constructor. Args: resnet_name: string scalar, ResNet model name (e.g. 'resnet_v1_101') resnet_fn: a callab...
the_stack_v2_python_sparse
feature_extractors/faster_rcnn_resnet_v1.py
chao-ji/tf-detection
train
2
31b553c5b2974bcc10b05798119d3f925969d73f
[ "PowerSpectrumSeries.__init__(self, *args, **kwargs)\nself.__cache = cache.Cache(maxsize=1000)\nif self.overlay.ndim < 4:\n raise ValueError('Overlay is not a 4D image')", "display = self.displayCtx.getDisplay(self.overlay)\nopts = display.opts\ncoords = opts.getVoxel()\nif coords is not None:\n return '{} ...
<|body_start_0|> PowerSpectrumSeries.__init__(self, *args, **kwargs) self.__cache = cache.Cache(maxsize=1000) if self.overlay.ndim < 4: raise ValueError('Overlay is not a 4D image') <|end_body_0|> <|body_start_1|> display = self.displayCtx.getDisplay(self.overlay) op...
The ``VoxelPowerSpectrumSeries`` class encapsulates the power spectrum of a single voxel from a 4D :class:`.Image` overlay. The voxel is dictated by the :attr:`.DisplayContext.location` property.
VoxelPowerSpectrumSeries
[ "BSD-3-Clause", "CC-BY-3.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VoxelPowerSpectrumSeries: """The ``VoxelPowerSpectrumSeries`` class encapsulates the power spectrum of a single voxel from a 4D :class:`.Image` overlay. The voxel is dictated by the :attr:`.DisplayContext.location` property.""" def __init__(self, *args, **kwargs): """Create a ``Voxel...
stack_v2_sparse_classes_36k_train_002232
8,639
permissive
[ { "docstring": "Create a ``VoxelPowerSpectrumSeries``. All arguments are passed to the :meth:`PowerSpectrumSeries.__init__` method. A :exc:`ValueError` is raised if the overlay is not a 4D :class:`.Image`.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring":...
3
stack_v2_sparse_classes_30k_train_011897
Implement the Python class `VoxelPowerSpectrumSeries` described below. Class description: The ``VoxelPowerSpectrumSeries`` class encapsulates the power spectrum of a single voxel from a 4D :class:`.Image` overlay. The voxel is dictated by the :attr:`.DisplayContext.location` property. Method signatures and docstrings...
Implement the Python class `VoxelPowerSpectrumSeries` described below. Class description: The ``VoxelPowerSpectrumSeries`` class encapsulates the power spectrum of a single voxel from a 4D :class:`.Image` overlay. The voxel is dictated by the :attr:`.DisplayContext.location` property. Method signatures and docstrings...
46ccb4fe2b2346eb57576247f49714032b61307a
<|skeleton|> class VoxelPowerSpectrumSeries: """The ``VoxelPowerSpectrumSeries`` class encapsulates the power spectrum of a single voxel from a 4D :class:`.Image` overlay. The voxel is dictated by the :attr:`.DisplayContext.location` property.""" def __init__(self, *args, **kwargs): """Create a ``Voxel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VoxelPowerSpectrumSeries: """The ``VoxelPowerSpectrumSeries`` class encapsulates the power spectrum of a single voxel from a 4D :class:`.Image` overlay. The voxel is dictated by the :attr:`.DisplayContext.location` property.""" def __init__(self, *args, **kwargs): """Create a ``VoxelPowerSpectrum...
the_stack_v2_python_sparse
fsleyes/plotting/powerspectrumseries.py
sanjayankur31/fsleyes
train
1
052627879465d8e25019a29266d9427fabaa0fca
[ "self.lines = []\ndict_one = {'timestamp': '2019-02-23T12:51:52', 'stuff': 'from bar to foobar', 'correct': False, 'random_number': 13245, 'vital_stats': 'gangverk'}\nself.lines.append(dict_one)\ndict_two = {'timestamp': '2019-06-17T20:11:23', 'stuff': 'fra sjalfstaedi til sjalfstaedis', 'correct': True, 'random_nu...
<|body_start_0|> self.lines = [] dict_one = {'timestamp': '2019-02-23T12:51:52', 'stuff': 'from bar to foobar', 'correct': False, 'random_number': 13245, 'vital_stats': 'gangverk'} self.lines.append(dict_one) dict_two = {'timestamp': '2019-06-17T20:11:23', 'stuff': 'fra sjalfstaedi til s...
Test Timesketch importer.
TimesketchImporterTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimesketchImporterTest: """Test Timesketch importer.""" def setUp(self): """Set up the test data frame.""" <|body_0|> def test_adding_data_frames(self): """Test adding a data frame to the importer.""" <|body_1|> def test_adding_dict(self): ""...
stack_v2_sparse_classes_36k_train_002233
6,646
permissive
[ { "docstring": "Set up the test data frame.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test adding a data frame to the importer.", "name": "test_adding_data_frames", "signature": "def test_adding_data_frames(self)" }, { "docstring": "Test adding a dict t...
5
null
Implement the Python class `TimesketchImporterTest` described below. Class description: Test Timesketch importer. Method signatures and docstrings: - def setUp(self): Set up the test data frame. - def test_adding_data_frames(self): Test adding a data frame to the importer. - def test_adding_dict(self): Test adding a ...
Implement the Python class `TimesketchImporterTest` described below. Class description: Test Timesketch importer. Method signatures and docstrings: - def setUp(self): Set up the test data frame. - def test_adding_data_frames(self): Test adding a data frame to the importer. - def test_adding_dict(self): Test adding a ...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class TimesketchImporterTest: """Test Timesketch importer.""" def setUp(self): """Set up the test data frame.""" <|body_0|> def test_adding_data_frames(self): """Test adding a data frame to the importer.""" <|body_1|> def test_adding_dict(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimesketchImporterTest: """Test Timesketch importer.""" def setUp(self): """Set up the test data frame.""" self.lines = [] dict_one = {'timestamp': '2019-02-23T12:51:52', 'stuff': 'from bar to foobar', 'correct': False, 'random_number': 13245, 'vital_stats': 'gangverk'} se...
the_stack_v2_python_sparse
importer_client/python/timesketch_import_client/importer_test.py
google/timesketch
train
2,263
8b7de4ed9111fb86c3463ffd0880b574d7323835
[ "from collections import deque\nfrom collections import Counter\nself.capacity = capacity\nself.cache = dict()\nself.keyQueue = deque()\nself.keyCounter = Counter()", "if len(self.keyQueue) > 2 * self.capacity:\n self.keyCounter.clear()\n from collections import deque\n newKeyQueue = deque()\n while l...
<|body_start_0|> from collections import deque from collections import Counter self.capacity = capacity self.cache = dict() self.keyQueue = deque() self.keyCounter = Counter() <|end_body_0|> <|body_start_1|> if len(self.keyQueue) > 2 * self.capacity: ...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def _shrinkKeyQueue(self): """When keyQueue has lots of keys appearing multiple times, we need to go over it and make it concise This is required, just to save space""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_002234
2,015
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": "When keyQueue has lots of keys appearing multiple times, we need to go over it and make it concise This is required, just to save space", "name": "_shrinkKeyQueue", "s...
4
stack_v2_sparse_classes_30k_train_003387
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 _shrinkKeyQueue(self): When keyQueue has lots of keys appearing multiple times, we need to go over it and make it concise ...
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 _shrinkKeyQueue(self): When keyQueue has lots of keys appearing multiple times, we need to go over it and make it concise ...
6e051eb554d9cf6f424f1e0a77f3072adf7f64c4
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def _shrinkKeyQueue(self): """When keyQueue has lots of keys appearing multiple times, we need to go over it and make it concise This is required, just to save space""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" from collections import deque from collections import Counter self.capacity = capacity self.cache = dict() self.keyQueue = deque() self.keyCounter = Counter() def _shrinkKeyQueue(self...
the_stack_v2_python_sparse
146. LRU Cache.py
vincent-kangzhou/LeetCode-Python
train
0
782003429c9eed71dea3055aabf4fd7e1e34df8e
[ "product_id = self.cleaned_data['product']\ntry:\n product = Product.objects.get(id=product_id)\nexcept Product.DoesNotExist:\n raise forms.ValidationError(\"Ce produit n'existe pas !\")\nreturn product", "group_member_id = self.cleaned_data['group_member']\ntry:\n group_member = GroupMember.objects.get(...
<|body_start_0|> product_id = self.cleaned_data['product'] try: product = Product.objects.get(id=product_id) except Product.DoesNotExist: raise forms.ValidationError("Ce produit n'existe pas !") return product <|end_body_0|> <|body_start_1|> group_member_...
Form to to permit community member (GroupMember objects), to rent products (Product object)
GroupMemberRentalForm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupMemberRentalForm: """Form to to permit community member (GroupMember objects), to rent products (Product object)""" def clean_product(self): """Return the Product object since the id input by user, if it exists""" <|body_0|> def clean_group_member(self): """...
stack_v2_sparse_classes_36k_train_002235
4,015
no_license
[ { "docstring": "Return the Product object since the id input by user, if it exists", "name": "clean_product", "signature": "def clean_product(self)" }, { "docstring": "Return the GroupMember object since the id input by user, if it exists", "name": "clean_group_member", "signature": "def...
4
stack_v2_sparse_classes_30k_test_000505
Implement the Python class `GroupMemberRentalForm` described below. Class description: Form to to permit community member (GroupMember objects), to rent products (Product object) Method signatures and docstrings: - def clean_product(self): Return the Product object since the id input by user, if it exists - def clean...
Implement the Python class `GroupMemberRentalForm` described below. Class description: Form to to permit community member (GroupMember objects), to rent products (Product object) Method signatures and docstrings: - def clean_product(self): Return the Product object since the id input by user, if it exists - def clean...
cf0b982a6df2b8b4318d12d344ef0827394eedfd
<|skeleton|> class GroupMemberRentalForm: """Form to to permit community member (GroupMember objects), to rent products (Product object)""" def clean_product(self): """Return the Product object since the id input by user, if it exists""" <|body_0|> def clean_group_member(self): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupMemberRentalForm: """Form to to permit community member (GroupMember objects), to rent products (Product object)""" def clean_product(self): """Return the Product object since the id input by user, if it exists""" product_id = self.cleaned_data['product'] try: pro...
the_stack_v2_python_sparse
group_member/forms.py
cleliofavoccia/Share
train
0
50fbd1041198fbd05fd2c8c54a1eb0dfc2d9e081
[ "self._center = center\nassert width is not None or width_fun is not None, 'Must specify width'\nif isinstance(center, numpy.ndarray) and width is not None:\n assert center.shape[0] == width.shape[0], 'for N element center, width must be Nx2'\n assert width.ndim == 2, 'for N element center, width must be Nx2'...
<|body_start_0|> self._center = center assert width is not None or width_fun is not None, 'Must specify width' if isinstance(center, numpy.ndarray) and width is not None: assert center.shape[0] == width.shape[0], 'for N element center, width must be Nx2' assert width.ndim...
Implement a deadband
Deadband
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Deadband: """Implement a deadband""" def __init__(self, center, width=None, width_fun=None): """Constructor Arguments: center: center of the deadband width: width, can be a scalar for symmetric deadband or a vector for variable upper / lower bounds. If center is a N vector then this ...
stack_v2_sparse_classes_36k_train_002236
5,273
permissive
[ { "docstring": "Constructor Arguments: center: center of the deadband width: width, can be a scalar for symmetric deadband or a vector for variable upper / lower bounds. If center is a N vector then this should be Nx2 matrix of bounds. Optional (can specify fun) width_fun: width function, evaluates a point and ...
3
stack_v2_sparse_classes_30k_val_000426
Implement the Python class `Deadband` described below. Class description: Implement a deadband Method signatures and docstrings: - def __init__(self, center, width=None, width_fun=None): Constructor Arguments: center: center of the deadband width: width, can be a scalar for symmetric deadband or a vector for variable...
Implement the Python class `Deadband` described below. Class description: Implement a deadband Method signatures and docstrings: - def __init__(self, center, width=None, width_fun=None): Constructor Arguments: center: center of the deadband width: width, can be a scalar for symmetric deadband or a vector for variable...
6827886916e36432ce1d806f0a78edef6c9270d9
<|skeleton|> class Deadband: """Implement a deadband""" def __init__(self, center, width=None, width_fun=None): """Constructor Arguments: center: center of the deadband width: width, can be a scalar for symmetric deadband or a vector for variable upper / lower bounds. If center is a N vector then this ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Deadband: """Implement a deadband""" def __init__(self, center, width=None, width_fun=None): """Constructor Arguments: center: center of the deadband width: width, can be a scalar for symmetric deadband or a vector for variable upper / lower bounds. If center is a N vector then this should be Nx2...
the_stack_v2_python_sparse
pybots/src/filters/nonlinearities.py
aivian/robots
train
0
523180d9ca36ae28f02cb325e7ff8bdde9ad6886
[ "oldpath = sys.path\nmod = tested._import_argmod(sys)\nself.assertEqual(mod, sys)", "with mock.patch('SConsArguments.Importer.GetDefaultArgpath') as mock_GetDefaultArgpath, mock.patch('SConsArguments.Importer._load_module_file') as mock_load_module_file:\n mock_GetDefaultArgpath.return_value = ['site_scons/sit...
<|body_start_0|> oldpath = sys.path mod = tested._import_argmod(sys) self.assertEqual(mod, sys) <|end_body_0|> <|body_start_1|> with mock.patch('SConsArguments.Importer.GetDefaultArgpath') as mock_GetDefaultArgpath, mock.patch('SConsArguments.Importer._load_module_file') as mock_load_mo...
Test__import_argmod
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test__import_argmod: def test__import_argmod_1(self): """Test SConsArguments.Importer._import_argmod(sys)""" <|body_0|> def test__import_argmod_2(self): """Test SConsArguments.Importer._import_argmod('foo')""" <|body_1|> def test__import_argmod_3(self): ...
stack_v2_sparse_classes_36k_train_002237
42,804
permissive
[ { "docstring": "Test SConsArguments.Importer._import_argmod(sys)", "name": "test__import_argmod_1", "signature": "def test__import_argmod_1(self)" }, { "docstring": "Test SConsArguments.Importer._import_argmod('foo')", "name": "test__import_argmod_2", "signature": "def test__import_argmo...
4
stack_v2_sparse_classes_30k_train_000905
Implement the Python class `Test__import_argmod` described below. Class description: Implement the Test__import_argmod class. Method signatures and docstrings: - def test__import_argmod_1(self): Test SConsArguments.Importer._import_argmod(sys) - def test__import_argmod_2(self): Test SConsArguments.Importer._import_ar...
Implement the Python class `Test__import_argmod` described below. Class description: Implement the Test__import_argmod class. Method signatures and docstrings: - def test__import_argmod_1(self): Test SConsArguments.Importer._import_argmod(sys) - def test__import_argmod_2(self): Test SConsArguments.Importer._import_ar...
f4b783fc79fe3fc16e8d0f58308099a67752d299
<|skeleton|> class Test__import_argmod: def test__import_argmod_1(self): """Test SConsArguments.Importer._import_argmod(sys)""" <|body_0|> def test__import_argmod_2(self): """Test SConsArguments.Importer._import_argmod('foo')""" <|body_1|> def test__import_argmod_3(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Test__import_argmod: def test__import_argmod_1(self): """Test SConsArguments.Importer._import_argmod(sys)""" oldpath = sys.path mod = tested._import_argmod(sys) self.assertEqual(mod, sys) def test__import_argmod_2(self): """Test SConsArguments.Importer._import_argm...
the_stack_v2_python_sparse
unit_tests/SConsArgumentsT/ImporterTests.py
mcqueen256/scons-arguments
train
0
8820a38633b04c945c8e979593fcdaba162d1494
[ "super().__init__(coordinator, serial)\nself.battery_cam_type = bool(self.data['device_category'] == DeviceCatagories.BATTERY_CAMERA_DEVICE_CATEGORY.value)\nself._attr_unique_id = f'{serial}_Light'\nself._attr_is_on = self.data['switches'][DeviceSwitchType.ALARM_LIGHT.value]\nself._attr_brightness = round(percentag...
<|body_start_0|> super().__init__(coordinator, serial) self.battery_cam_type = bool(self.data['device_category'] == DeviceCatagories.BATTERY_CAMERA_DEVICE_CATEGORY.value) self._attr_unique_id = f'{serial}_Light' self._attr_is_on = self.data['switches'][DeviceSwitchType.ALARM_LIGHT.value]...
Representation of a EZVIZ light.
EzvizLight
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EzvizLight: """Representation of a EZVIZ light.""" def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str) -> None: """Initialize the light.""" <|body_0|> async def async_turn_on(self, **kwargs: Any) -> None: """Turn on light.""" <|body_1...
stack_v2_sparse_classes_36k_train_002238
4,518
permissive
[ { "docstring": "Initialize the light.", "name": "__init__", "signature": "def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str) -> None" }, { "docstring": "Turn on light.", "name": "async_turn_on", "signature": "async def async_turn_on(self, **kwargs: Any) -> None" }...
4
null
Implement the Python class `EzvizLight` described below. Class description: Representation of a EZVIZ light. Method signatures and docstrings: - def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str) -> None: Initialize the light. - async def async_turn_on(self, **kwargs: Any) -> None: Turn on light...
Implement the Python class `EzvizLight` described below. Class description: Representation of a EZVIZ light. Method signatures and docstrings: - def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str) -> None: Initialize the light. - async def async_turn_on(self, **kwargs: Any) -> None: Turn on light...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class EzvizLight: """Representation of a EZVIZ light.""" def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str) -> None: """Initialize the light.""" <|body_0|> async def async_turn_on(self, **kwargs: Any) -> None: """Turn on light.""" <|body_1...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EzvizLight: """Representation of a EZVIZ light.""" def __init__(self, coordinator: EzvizDataUpdateCoordinator, serial: str) -> None: """Initialize the light.""" super().__init__(coordinator, serial) self.battery_cam_type = bool(self.data['device_category'] == DeviceCatagories.BATT...
the_stack_v2_python_sparse
homeassistant/components/ezviz/light.py
home-assistant/core
train
35,501
baa42aee071b62915a90015f799a829a341cfda1
[ "if bypass_roles is None:\n return []\n\ndef _coerce_to_int(input: int | str) -> int | str:\n try:\n return int(input)\n except ValueError:\n return input\nreturn map(_coerce_to_int, bypass_roles)", "if not isinstance(ctx.author, Member):\n return True\nreturn all((member_role.id not in ...
<|body_start_0|> if bypass_roles is None: return [] def _coerce_to_int(input: int | str) -> int | str: try: return int(input) except ValueError: return input return map(_coerce_to_int, bypass_roles) <|end_body_0|> <|body_start...
A setting entry which tells whether the roles the member has allow them to bypass the filter.
RoleBypass
[ "MIT", "BSD-3-Clause", "Python-2.0", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoleBypass: """A setting entry which tells whether the roles the member has allow them to bypass the filter.""" def init_if_bypass_roles_none(cls, bypass_roles: Sequence[int | str] | None) -> Sequence[int | str]: """Initialize an empty sequence if the value is None. This also coerces...
stack_v2_sparse_classes_36k_train_002239
1,617
permissive
[ { "docstring": "Initialize an empty sequence if the value is None. This also coerces each element of bypass_roles to an int, if possible.", "name": "init_if_bypass_roles_none", "signature": "def init_if_bypass_roles_none(cls, bypass_roles: Sequence[int | str] | None) -> Sequence[int | str]" }, { ...
2
stack_v2_sparse_classes_30k_train_009669
Implement the Python class `RoleBypass` described below. Class description: A setting entry which tells whether the roles the member has allow them to bypass the filter. Method signatures and docstrings: - def init_if_bypass_roles_none(cls, bypass_roles: Sequence[int | str] | None) -> Sequence[int | str]: Initialize ...
Implement the Python class `RoleBypass` described below. Class description: A setting entry which tells whether the roles the member has allow them to bypass the filter. Method signatures and docstrings: - def init_if_bypass_roles_none(cls, bypass_roles: Sequence[int | str] | None) -> Sequence[int | str]: Initialize ...
f2048684291cc6358565e96ef3562512fbeb2505
<|skeleton|> class RoleBypass: """A setting entry which tells whether the roles the member has allow them to bypass the filter.""" def init_if_bypass_roles_none(cls, bypass_roles: Sequence[int | str] | None) -> Sequence[int | str]: """Initialize an empty sequence if the value is None. This also coerces...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RoleBypass: """A setting entry which tells whether the roles the member has allow them to bypass the filter.""" def init_if_bypass_roles_none(cls, bypass_roles: Sequence[int | str] | None) -> Sequence[int | str]: """Initialize an empty sequence if the value is None. This also coerces each element...
the_stack_v2_python_sparse
bot/exts/filtering/_settings_types/validations/bypass_roles.py
python-discord/bot
train
1,479
a0c16dfd3b725f1560b3ba91ac35af2e347383bf
[ "n = len(s)\nfor i in range(int(n / 2)):\n if s[i] != s[n - i - 1]:\n return self.valid(s[i:n - i - 1]) or self.valid(s[i + 1:n - i])\nreturn True", "n = len(s)\nfor i in range(int(n / 2)):\n if s[i] != s[n - i - 1]:\n return False\nreturn True" ]
<|body_start_0|> n = len(s) for i in range(int(n / 2)): if s[i] != s[n - i - 1]: return self.valid(s[i:n - i - 1]) or self.valid(s[i + 1:n - i]) return True <|end_body_0|> <|body_start_1|> n = len(s) for i in range(int(n / 2)): if s[i] != ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def validPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def valid(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(s) for i in range(int(n / 2)): if s[i] !=...
stack_v2_sparse_classes_36k_train_002240
568
no_license
[ { "docstring": ":type s: str :rtype: bool", "name": "validPalindrome", "signature": "def validPalindrome(self, s)" }, { "docstring": ":type s: str :rtype: bool", "name": "valid", "signature": "def valid(self, s)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validPalindrome(self, s): :type s: str :rtype: bool - def valid(self, s): :type s: str :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def validPalindrome(self, s): :type s: str :rtype: bool - def valid(self, s): :type s: str :rtype: bool <|skeleton|> class Solution: def validPalindrome(self, s): "...
7d7740f4db4f8500c84eff353420c61242321f2e
<|skeleton|> class Solution: def validPalindrome(self, s): """:type s: str :rtype: bool""" <|body_0|> def valid(self, s): """:type s: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def validPalindrome(self, s): """:type s: str :rtype: bool""" n = len(s) for i in range(int(n / 2)): if s[i] != s[n - i - 1]: return self.valid(s[i:n - i - 1]) or self.valid(s[i + 1:n - i]) return True def valid(self, s): """:t...
the_stack_v2_python_sparse
problems/valid_palindrome.py
vchub/daily-python
train
0
b3a486a5572cf1997231f36f6b3148b1325be99c
[ "self.completion_percentage = completion_percentage\nself.error_message = error_message\nself.events = events\nself.in_progress = in_progress\nself.message = message\nself.seconds_remaining = seconds_remaining\nself.warnings_found = warnings_found", "if dictionary is None:\n return None\ncompletion_percentage ...
<|body_start_0|> self.completion_percentage = completion_percentage self.error_message = error_message self.events = events self.in_progress = in_progress self.message = message self.seconds_remaining = seconds_remaining self.warnings_found = warnings_found <|end_...
Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate completion percentage for the Cluster creation process. error_message (string): Specifies a descri...
ClusterCreationProgressResult
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusterCreationProgressResult: """Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate completion percentage for the Cluster cre...
stack_v2_sparse_classes_36k_train_002241
3,737
permissive
[ { "docstring": "Constructor for the ClusterCreationProgressResult class", "name": "__init__", "signature": "def __init__(self, completion_percentage=None, error_message=None, events=None, in_progress=None, message=None, seconds_remaining=None, warnings_found=None)" }, { "docstring": "Creates an ...
2
null
Implement the Python class `ClusterCreationProgressResult` described below. Class description: Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate co...
Implement the Python class `ClusterCreationProgressResult` described below. Class description: Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate co...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class ClusterCreationProgressResult: """Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate completion percentage for the Cluster cre...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClusterCreationProgressResult: """Implementation of the 'ClusterCreationProgressResult' model. Specifies the values returned after a successful request to get the Cluster creation progress. Attributes: completion_percentage (int): Specifies an approximate completion percentage for the Cluster creation process...
the_stack_v2_python_sparse
cohesity_management_sdk/models/cluster_creation_progress_result.py
cohesity/management-sdk-python
train
24
9cfa265a1dbfe5f394575eb74dc3fca408a743a5
[ "try:\n rule = SigmaRule.query.filter_by(rule_uuid=rule_uuid).first()\nexcept Exception as e:\n error_msg = 'Unable to get the Sigma rule {0!s}'.format(e)\n logger.error(error_msg, exc_info=True)\n abort(HTTP_STATUS_CODE_INTERNAL_SERVER_ERROR, error_msg)\nif not rule:\n abort(HTTP_STATUS_CODE_NOT_FOU...
<|body_start_0|> try: rule = SigmaRule.query.filter_by(rule_uuid=rule_uuid).first() except Exception as e: error_msg = 'Unable to get the Sigma rule {0!s}'.format(e) logger.error(error_msg, exc_info=True) abort(HTTP_STATUS_CODE_INTERNAL_SERVER_ERROR, error...
Resource to read / delete / create / update a Sigma rule.
SigmaRuleResource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SigmaRuleResource: """Resource to read / delete / create / update a Sigma rule.""" def get(self, rule_uuid): """Fetches a single Sigma rule from the database. Fetches a single Sigma rule selected by the `UUID` in `/sigmarule/<string:rule_uuid>/` and returns a JSON represantion of the...
stack_v2_sparse_classes_36k_train_002242
12,205
permissive
[ { "docstring": "Fetches a single Sigma rule from the database. Fetches a single Sigma rule selected by the `UUID` in `/sigmarule/<string:rule_uuid>/` and returns a JSON represantion of the rule. Args: rule_uuid: UUID of the rule. Returns: JSON sigma rule representation e.g.: {\"objects\": [return_rule], \"meta\...
3
stack_v2_sparse_classes_30k_train_015442
Implement the Python class `SigmaRuleResource` described below. Class description: Resource to read / delete / create / update a Sigma rule. Method signatures and docstrings: - def get(self, rule_uuid): Fetches a single Sigma rule from the database. Fetches a single Sigma rule selected by the `UUID` in `/sigmarule/<s...
Implement the Python class `SigmaRuleResource` described below. Class description: Resource to read / delete / create / update a Sigma rule. Method signatures and docstrings: - def get(self, rule_uuid): Fetches a single Sigma rule from the database. Fetches a single Sigma rule selected by the `UUID` in `/sigmarule/<s...
24f471b58ca4a87cb053961b5f05c07a544ca7b8
<|skeleton|> class SigmaRuleResource: """Resource to read / delete / create / update a Sigma rule.""" def get(self, rule_uuid): """Fetches a single Sigma rule from the database. Fetches a single Sigma rule selected by the `UUID` in `/sigmarule/<string:rule_uuid>/` and returns a JSON represantion of the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SigmaRuleResource: """Resource to read / delete / create / update a Sigma rule.""" def get(self, rule_uuid): """Fetches a single Sigma rule from the database. Fetches a single Sigma rule selected by the `UUID` in `/sigmarule/<string:rule_uuid>/` and returns a JSON represantion of the rule. Args: ...
the_stack_v2_python_sparse
timesketch/api/v1/resources/sigma.py
google/timesketch
train
2,263
02d9431ebfa90f74cf89bce310719b888383bdac
[ "if isinstance(other, GitIgnoreSpec):\n return super().__eq__(other)\nelif isinstance(other, PathSpec):\n return False\nelse:\n return NotImplemented", "if pattern_factory is None:\n pattern_factory = GitWildMatchPattern\nelif (isinstance(lines, str) or callable(lines)) and _is_iterable(pattern_factor...
<|body_start_0|> if isinstance(other, GitIgnoreSpec): return super().__eq__(other) elif isinstance(other, PathSpec): return False else: return NotImplemented <|end_body_0|> <|body_start_1|> if pattern_factory is None: pattern_factory = Git...
The :class:`GitIgnoreSpec` class extends :class:`PathSpec` to replicate *.gitignore* behavior.
GitIgnoreSpec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GitIgnoreSpec: """The :class:`GitIgnoreSpec` class extends :class:`PathSpec` to replicate *.gitignore* behavior.""" def __eq__(self, other: object) -> bool: """Tests the equality of this gitignore-spec with *other* (:class:`GitIgnoreSpec`) by comparing their :attr:`~PathSpec.patterns...
stack_v2_sparse_classes_36k_train_002243
3,895
permissive
[ { "docstring": "Tests the equality of this gitignore-spec with *other* (:class:`GitIgnoreSpec`) by comparing their :attr:`~PathSpec.patterns` attributes. A non-:class:`GitIgnoreSpec` will not compare equal.", "name": "__eq__", "signature": "def __eq__(self, other: object) -> bool" }, { "docstrin...
3
null
Implement the Python class `GitIgnoreSpec` described below. Class description: The :class:`GitIgnoreSpec` class extends :class:`PathSpec` to replicate *.gitignore* behavior. Method signatures and docstrings: - def __eq__(self, other: object) -> bool: Tests the equality of this gitignore-spec with *other* (:class:`Git...
Implement the Python class `GitIgnoreSpec` described below. Class description: The :class:`GitIgnoreSpec` class extends :class:`PathSpec` to replicate *.gitignore* behavior. Method signatures and docstrings: - def __eq__(self, other: object) -> bool: Tests the equality of this gitignore-spec with *other* (:class:`Git...
d72e5310ed4a8165d7ee516d79e0accccaf7748c
<|skeleton|> class GitIgnoreSpec: """The :class:`GitIgnoreSpec` class extends :class:`PathSpec` to replicate *.gitignore* behavior.""" def __eq__(self, other: object) -> bool: """Tests the equality of this gitignore-spec with *other* (:class:`GitIgnoreSpec`) by comparing their :attr:`~PathSpec.patterns...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GitIgnoreSpec: """The :class:`GitIgnoreSpec` class extends :class:`PathSpec` to replicate *.gitignore* behavior.""" def __eq__(self, other: object) -> bool: """Tests the equality of this gitignore-spec with *other* (:class:`GitIgnoreSpec`) by comparing their :attr:`~PathSpec.patterns` attributes....
the_stack_v2_python_sparse
robocorp-python-ls-core/src/robocorp_ls_core/libs/robotidy_lib/pathspec/gitignore.py
robocorp/robotframework-lsp
train
167
ff3fca948cf5e82e00dd85cc1c6b96e8278eb91c
[ "partial = kwargs.pop('partial', False)\ninstance = self.get_object()\nserializer = self.get_serializer(instance, data=request.data, partial=partial)\nserializer.is_valid(raise_exception=True)\nif Credential.objects.filter(owner=request.user, name=serializer.validated_data['name'], linux_user=serializer.validated_d...
<|body_start_0|> partial = kwargs.pop('partial', False) instance = self.get_object() serializer = self.get_serializer(instance, data=request.data, partial=partial) serializer.is_valid(raise_exception=True) if Credential.objects.filter(owner=request.user, name=serializer.validated...
UpdateCredentialView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateCredentialView: def update(self, request, *args, **kwargs): """Overwritten the default `update` method in order to catch unique constraint violation.""" <|body_0|> def perform_update(self, serializer): """Overwrite the default 'perform_update' method in order t...
stack_v2_sparse_classes_36k_train_002244
43,758
permissive
[ { "docstring": "Overwritten the default `update` method in order to catch unique constraint violation.", "name": "update", "signature": "def update(self, request, *args, **kwargs)" }, { "docstring": "Overwrite the default 'perform_update' method in order to properly handle tags received as value...
2
null
Implement the Python class `UpdateCredentialView` described below. Class description: Implement the UpdateCredentialView class. Method signatures and docstrings: - def update(self, request, *args, **kwargs): Overwritten the default `update` method in order to catch unique constraint violation. - def perform_update(se...
Implement the Python class `UpdateCredentialView` described below. Class description: Implement the UpdateCredentialView class. Method signatures and docstrings: - def update(self, request, *args, **kwargs): Overwritten the default `update` method in order to catch unique constraint violation. - def perform_update(se...
702254c48677cf5a6f2fe298bced854299868eef
<|skeleton|> class UpdateCredentialView: def update(self, request, *args, **kwargs): """Overwritten the default `update` method in order to catch unique constraint violation.""" <|body_0|> def perform_update(self, serializer): """Overwrite the default 'perform_update' method in order t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UpdateCredentialView: def update(self, request, *args, **kwargs): """Overwritten the default `update` method in order to catch unique constraint violation.""" partial = kwargs.pop('partial', False) instance = self.get_object() serializer = self.get_serializer(instance, data=req...
the_stack_v2_python_sparse
backend/device_registry/api_views.py
a-martynovich/api
train
0
cf06d4c271acece9e23a2de1b3090a1d352d3749
[ "Expr.__init__(self, template, line)\nself._var = var\nself._nodes = nodes", "try:\n var = self._env.get(self._var)\n params = [node.eval() for node in self._nodes]\nexcept KeyError:\n raise UnknownVariableError('.'.join(self._var), self._template._filename, self._line)\ntry:\n for param in params:\n ...
<|body_start_0|> Expr.__init__(self, template, line) self._var = var self._nodes = nodes <|end_body_0|> <|body_start_1|> try: var = self._env.get(self._var) params = [node.eval() for node in self._nodes] except KeyError: raise UnknownVariableE...
An array index expression node.
IndexExpr
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexExpr: """An array index expression node.""" def __init__(self, template, line, var, nodes): """Initialize the node.""" <|body_0|> def eval(self): """Evaluate the expression.""" <|body_1|> <|end_skeleton|> <|body_start_0|> Expr.__init__(self...
stack_v2_sparse_classes_36k_train_002245
3,521
permissive
[ { "docstring": "Initialize the node.", "name": "__init__", "signature": "def __init__(self, template, line, var, nodes)" }, { "docstring": "Evaluate the expression.", "name": "eval", "signature": "def eval(self)" } ]
2
stack_v2_sparse_classes_30k_train_002781
Implement the Python class `IndexExpr` described below. Class description: An array index expression node. Method signatures and docstrings: - def __init__(self, template, line, var, nodes): Initialize the node. - def eval(self): Evaluate the expression.
Implement the Python class `IndexExpr` described below. Class description: An array index expression node. Method signatures and docstrings: - def __init__(self, template, line, var, nodes): Initialize the node. - def eval(self): Evaluate the expression. <|skeleton|> class IndexExpr: """An array index expression...
6aeee9b229d3f62aace98a51d9014781bbe6cb52
<|skeleton|> class IndexExpr: """An array index expression node.""" def __init__(self, template, line, var, nodes): """Initialize the node.""" <|body_0|> def eval(self): """Evaluate the expression.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IndexExpr: """An array index expression node.""" def __init__(self, template, line, var, nodes): """Initialize the node.""" Expr.__init__(self, template, line) self._var = var self._nodes = nodes def eval(self): """Evaluate the expression.""" try: ...
the_stack_v2_python_sparse
mrbaviirc/template/expr.py
brianvanderburg2/mrbaviirc
train
0
660e8c3008156b24758079d3954032cbafaf2d3c
[ "create_count = 0\nnext(csvreader)\nfor row in csvreader:\n ci, created = CoinifyInvoice.objects.get_or_create(coinify_id=row[0], coinify_id_alpha=row[1], coinify_created=timezone.make_aware(datetime.strptime(row[2], '%Y-%m-%d %H:%M:%S'), timezone=timezone.utc), payment_amount=Decimal(row[3]), payment_currency=r...
<|body_start_0|> create_count = 0 next(csvreader) for row in csvreader: ci, created = CoinifyInvoice.objects.get_or_create(coinify_id=row[0], coinify_id_alpha=row[1], coinify_created=timezone.make_aware(datetime.strptime(row[2], '%Y-%m-%d %H:%M:%S'), timezone=timezone.utc), payment_a...
CoinifyCSVImporter
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoinifyCSVImporter: def import_coinify_invoice_csv(csvreader): """Import a CSV file with Coinify invoices exported from their webinterface. Assumes a CSV structure like this: id,id_alpha,created,payment_amount,payment_currency,payment_btc_amount,description,custom,credited_amount,credite...
stack_v2_sparse_classes_36k_train_002246
47,704
permissive
[ { "docstring": "Import a CSV file with Coinify invoices exported from their webinterface. Assumes a CSV structure like this: id,id_alpha,created,payment_amount,payment_currency,payment_btc_amount,description,custom,credited_amount,credited_currency,state,payment_type,original_payment_id 54276,sdJGd,\"2020-02-06...
3
null
Implement the Python class `CoinifyCSVImporter` described below. Class description: Implement the CoinifyCSVImporter class. Method signatures and docstrings: - def import_coinify_invoice_csv(csvreader): Import a CSV file with Coinify invoices exported from their webinterface. Assumes a CSV structure like this: id,id_...
Implement the Python class `CoinifyCSVImporter` described below. Class description: Implement the CoinifyCSVImporter class. Method signatures and docstrings: - def import_coinify_invoice_csv(csvreader): Import a CSV file with Coinify invoices exported from their webinterface. Assumes a CSV structure like this: id,id_...
767deb7f58429e9162e0c2ef79be9f0f38f37ce1
<|skeleton|> class CoinifyCSVImporter: def import_coinify_invoice_csv(csvreader): """Import a CSV file with Coinify invoices exported from their webinterface. Assumes a CSV structure like this: id,id_alpha,created,payment_amount,payment_currency,payment_btc_amount,description,custom,credited_amount,credite...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CoinifyCSVImporter: def import_coinify_invoice_csv(csvreader): """Import a CSV file with Coinify invoices exported from their webinterface. Assumes a CSV structure like this: id,id_alpha,created,payment_amount,payment_currency,payment_btc_amount,description,custom,credited_amount,credited_currency,sta...
the_stack_v2_python_sparse
src/economy/utils.py
bornhack/bornhack-website
train
9
ccfe61d89057966b67f4f46610e52cc9d70595cb
[ "self.size = 0\nself.head = None\nself.tail = None", "if self.head == None:\n self.addAtHead(index)\nx = self.head\nif index < self.size:\n for _ in range(index):\n x = x.next\n return x.key\nreturn -1", "if not self.head:\n self.head = Node(val)\nelse:\n new_node = Node(val)\n new_node...
<|body_start_0|> self.size = 0 self.head = None self.tail = None <|end_body_0|> <|body_start_1|> if self.head == None: self.addAtHead(index) x = self.head if index < self.size: for _ in range(index): x = x.next return x...
MyLinkedList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyLinkedList: def __init__(self): """Initialize your data structure here.""" <|body_0|> def get(self, index: int) -> int: """Get the value of the index-th node in the linked list. If the index is invalid, return -addAtIndexaddAtIndex1.""" <|body_1|> def ...
stack_v2_sparse_classes_36k_train_002247
2,808
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Get the value of the index-th node in the linked list. If the index is invalid, return -addAtIndexaddAtIndex1.", "name": "get", "signature": "def get(self, inde...
6
stack_v2_sparse_classes_30k_train_013411
Implement the Python class `MyLinkedList` described below. Class description: Implement the MyLinkedList class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def get(self, index: int) -> int: Get the value of the index-th node in the linked list. If the index is invali...
Implement the Python class `MyLinkedList` described below. Class description: Implement the MyLinkedList class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def get(self, index: int) -> int: Get the value of the index-th node in the linked list. If the index is invali...
8482bd12369b1f18faa4ac19bc3423750fea4695
<|skeleton|> class MyLinkedList: def __init__(self): """Initialize your data structure here.""" <|body_0|> def get(self, index: int) -> int: """Get the value of the index-th node in the linked list. If the index is invalid, return -addAtIndexaddAtIndex1.""" <|body_1|> def ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyLinkedList: def __init__(self): """Initialize your data structure here.""" self.size = 0 self.head = None self.tail = None def get(self, index: int) -> int: """Get the value of the index-th node in the linked list. If the index is invalid, return -addAtIndexaddAt...
the_stack_v2_python_sparse
dataStructures/linkedLists/linkedList.py
robahall/algosds
train
0
5ff24d115c0b53d9962b8aad7c909328bbd9859b
[ "try:\n driver = HomeElement(self.driver)\n driver.get(self.url)\n driver.new_table_click(location=1)\n driver.full_windows_screen(self.screenshots_path, 1920, 980)\n self.first = driver.news_assert(url=self.data[0])\n self.assertEqual(self.first, self.second)\nexcept Exception:\n self.error = ...
<|body_start_0|> try: driver = HomeElement(self.driver) driver.get(self.url) driver.new_table_click(location=1) driver.full_windows_screen(self.screenshots_path, 1920, 980) self.first = driver.news_assert(url=self.data[0]) self.assertEqual(...
:param: RE_LOGIN: 需要切换账号登录,当RE_LOGIN = True时,需要将LOGIN_INFO的value值全填写完成, 如果请求的账号中只有一家公司,那么company中的value就可以忽略不填写,否则会报错... :param: MODULE: 为当前运行的模块,根据当前运行的模块调用common中的对应的用例方法,需保留此变量方法
TestNewCenter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestNewCenter: """:param: RE_LOGIN: 需要切换账号登录,当RE_LOGIN = True时,需要将LOGIN_INFO的value值全填写完成, 如果请求的账号中只有一家公司,那么company中的value就可以忽略不填写,否则会报错... :param: MODULE: 为当前运行的模块,根据当前运行的模块调用common中的对应的用例方法,需保留此变量方法""" def test_good_news_table_one(self): """验证GoodNews是否能正常打开并跳转; 1、打开首页; 2、点击GoodNews...
stack_v2_sparse_classes_36k_train_002248
3,012
no_license
[ { "docstring": "验证GoodNews是否能正常打开并跳转; 1、打开首页; 2、点击GoodNews; 3、断言跳转的url是否包含{/news/71.html}", "name": "test_good_news_table_one", "signature": "def test_good_news_table_one(self)" }, { "docstring": "验证GoodNewsTwo是否能正常打开并跳转; 1、打开首页; 2、点击GoodNewsTwo; 3、断言跳转的url是否包含{/news/48.html}", "name": "test...
3
null
Implement the Python class `TestNewCenter` described below. Class description: :param: RE_LOGIN: 需要切换账号登录,当RE_LOGIN = True时,需要将LOGIN_INFO的value值全填写完成, 如果请求的账号中只有一家公司,那么company中的value就可以忽略不填写,否则会报错... :param: MODULE: 为当前运行的模块,根据当前运行的模块调用common中的对应的用例方法,需保留此变量方法 Method signatures and docstrings: - def test_good_news_ta...
Implement the Python class `TestNewCenter` described below. Class description: :param: RE_LOGIN: 需要切换账号登录,当RE_LOGIN = True时,需要将LOGIN_INFO的value值全填写完成, 如果请求的账号中只有一家公司,那么company中的value就可以忽略不填写,否则会报错... :param: MODULE: 为当前运行的模块,根据当前运行的模块调用common中的对应的用例方法,需保留此变量方法 Method signatures and docstrings: - def test_good_news_ta...
86bb051e62abdf2ed5bbdbea4c9008a6c1f49060
<|skeleton|> class TestNewCenter: """:param: RE_LOGIN: 需要切换账号登录,当RE_LOGIN = True时,需要将LOGIN_INFO的value值全填写完成, 如果请求的账号中只有一家公司,那么company中的value就可以忽略不填写,否则会报错... :param: MODULE: 为当前运行的模块,根据当前运行的模块调用common中的对应的用例方法,需保留此变量方法""" def test_good_news_table_one(self): """验证GoodNews是否能正常打开并跳转; 1、打开首页; 2、点击GoodNews...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestNewCenter: """:param: RE_LOGIN: 需要切换账号登录,当RE_LOGIN = True时,需要将LOGIN_INFO的value值全填写完成, 如果请求的账号中只有一家公司,那么company中的value就可以忽略不填写,否则会报错... :param: MODULE: 为当前运行的模块,根据当前运行的模块调用common中的对应的用例方法,需保留此变量方法""" def test_good_news_table_one(self): """验证GoodNews是否能正常打开并跳转; 1、打开首页; 2、点击GoodNews; 3、断言跳转的url是...
the_stack_v2_python_sparse
Manufacture/home/new_center_st.py
yushu1987/UI
train
0
c814413a89f1a2ba365ccf859a397170ddd11655
[ "super().__init__()\nself.reference_sequence_length = reference_sequence_length\nself.reference_hidden_size = reference_hidden_size\nself.context_sequence_length = context_sequence_length\nself.context_hidden_size = context_hidden_size\nself.attention_size = attention_size\nself.individual_nonlinearity = individual...
<|body_start_0|> super().__init__() self.reference_sequence_length = reference_sequence_length self.reference_hidden_size = reference_hidden_size self.context_sequence_length = context_sequence_length self.context_hidden_size = context_hidden_size self.attention_size = at...
Implements context attention as in the PaccMann paper (Figure 2C) in Molecular Pharmaceutics. With the additional option of having a hidden size in the context. NOTE: In tensorflow, weights were initialized from N(0,0.1). Instead, pytorch uses U(-stddev, stddev) where stddev=1./math.sqrt(weight.size(1)).
ContextAttentionLayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ContextAttentionLayer: """Implements context attention as in the PaccMann paper (Figure 2C) in Molecular Pharmaceutics. With the additional option of having a hidden size in the context. NOTE: In tensorflow, weights were initialized from N(0,0.1). Instead, pytorch uses U(-stddev, stddev) where st...
stack_v2_sparse_classes_36k_train_002249
25,239
no_license
[ { "docstring": "Constructor Arguments: reference_hidden_size (int): Hidden size of the reference input over which the attention will be computed (H). reference_sequence_length (int): Sequence length of the reference (T). context_hidden_size (int): This is either simply the amount of features used as context (G)...
2
stack_v2_sparse_classes_30k_train_003737
Implement the Python class `ContextAttentionLayer` described below. Class description: Implements context attention as in the PaccMann paper (Figure 2C) in Molecular Pharmaceutics. With the additional option of having a hidden size in the context. NOTE: In tensorflow, weights were initialized from N(0,0.1). Instead, p...
Implement the Python class `ContextAttentionLayer` described below. Class description: Implements context attention as in the PaccMann paper (Figure 2C) in Molecular Pharmaceutics. With the additional option of having a hidden size in the context. NOTE: In tensorflow, weights were initialized from N(0,0.1). Instead, p...
e88840528fa963066f85940ffeb31687773be2ba
<|skeleton|> class ContextAttentionLayer: """Implements context attention as in the PaccMann paper (Figure 2C) in Molecular Pharmaceutics. With the additional option of having a hidden size in the context. NOTE: In tensorflow, weights were initialized from N(0,0.1). Instead, pytorch uses U(-stddev, stddev) where st...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ContextAttentionLayer: """Implements context attention as in the PaccMann paper (Figure 2C) in Molecular Pharmaceutics. With the additional option of having a hidden size in the context. NOTE: In tensorflow, weights were initialized from N(0,0.1). Instead, pytorch uses U(-stddev, stddev) where stddev=1./math....
the_stack_v2_python_sparse
Utility/layers.py
kaicd/KAICD_pipeline
train
0
031e2e91533d1e57107a7a8d3ee840508aab3b85
[ "group = {}\nfor s in strs:\n key = [0] * 26\n for c in s:\n key[ord(c) - ord('a')] += 1\n key = tuple(key)\n if group.get(key):\n group[key].append(s)\n else:\n group[key] = [s]\nreturn group.values()", "group = {}\nfor s in strs:\n key = tuple(sorted(s))\n if group.get(...
<|body_start_0|> group = {} for s in strs: key = [0] * 26 for c in s: key[ord(c) - ord('a')] += 1 key = tuple(key) if group.get(key): group[key].append(s) else: group[key] = [s] return gro...
GroupAnagrams
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupAnagrams: def group(strs): """Use this method when the range of the chars are known (like lowercase chars only). :type strs: List[str] :rtype: List[List[str]]""" <|body_0|> def group_sorted(strs): """Use this method when the range of the chars are unknown. :type...
stack_v2_sparse_classes_36k_train_002250
977
permissive
[ { "docstring": "Use this method when the range of the chars are known (like lowercase chars only). :type strs: List[str] :rtype: List[List[str]]", "name": "group", "signature": "def group(strs)" }, { "docstring": "Use this method when the range of the chars are unknown. :type strs: List[str] :rt...
2
stack_v2_sparse_classes_30k_train_007772
Implement the Python class `GroupAnagrams` described below. Class description: Implement the GroupAnagrams class. Method signatures and docstrings: - def group(strs): Use this method when the range of the chars are known (like lowercase chars only). :type strs: List[str] :rtype: List[List[str]] - def group_sorted(str...
Implement the Python class `GroupAnagrams` described below. Class description: Implement the GroupAnagrams class. Method signatures and docstrings: - def group(strs): Use this method when the range of the chars are known (like lowercase chars only). :type strs: List[str] :rtype: List[List[str]] - def group_sorted(str...
77838c37e3fdae0f2ec628aa7ddc59f4a5949bbe
<|skeleton|> class GroupAnagrams: def group(strs): """Use this method when the range of the chars are known (like lowercase chars only). :type strs: List[str] :rtype: List[List[str]]""" <|body_0|> def group_sorted(strs): """Use this method when the range of the chars are unknown. :type...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupAnagrams: def group(strs): """Use this method when the range of the chars are known (like lowercase chars only). :type strs: List[str] :rtype: List[List[str]]""" group = {} for s in strs: key = [0] * 26 for c in s: key[ord(c) - ord('a')] += ...
the_stack_v2_python_sparse
Python/dev/arrays/group_anagrams.py
faisaldialpad/hellouniverse
train
0
04c9e321302ed20e361babd26f733f857436c8c1
[ "if len(matrix) == 0 or len(matrix[0]) == 0:\n return 0\nmaxSide = 0\nrows, columns = (len(matrix), len(matrix[0]))\ndp = [[0] * columns for _ in range(rows)]\nfor i in range(rows):\n for j in range(columns):\n if matrix[i][j] == '1':\n if i == 0 or j == 0:\n dp[i][j] = 1\n ...
<|body_start_0|> if len(matrix) == 0 or len(matrix[0]) == 0: return 0 maxSide = 0 rows, columns = (len(matrix), len(matrix[0])) dp = [[0] * columns for _ in range(rows)] for i in range(rows): for j in range(columns): if matrix[i][j] == '1':...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: """方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return:""" <|body_0|> def maximalSquare_optimize(self, matrix: List[List[str]]) -> int: """方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(0) :param matrix: :return:""...
stack_v2_sparse_classes_36k_train_002251
2,226
permissive
[ { "docstring": "方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return:", "name": "maximalSquare", "signature": "def maximalSquare(self, matrix: List[List[str]]) -> int" }, { "docstring": "方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(0) :param matrix: :return:", "name": "maximalSquare_optimize", "signa...
2
stack_v2_sparse_classes_30k_train_012490
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximalSquare(self, matrix: List[List[str]]) -> int: 方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return: - def maximalSquare_optimize(self, matrix: List[List[str]]) -> i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximalSquare(self, matrix: List[List[str]]) -> int: 方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return: - def maximalSquare_optimize(self, matrix: List[List[str]]) -> i...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: """方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return:""" <|body_0|> def maximalSquare_optimize(self, matrix: List[List[str]]) -> int: """方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(0) :param matrix: :return:""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: """方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return:""" if len(matrix) == 0 or len(matrix[0]) == 0: return 0 maxSide = 0 rows, columns = (len(matrix), len(matrix[0])) dp = [[0] * colum...
the_stack_v2_python_sparse
LeetCode 热题 HOT 100/maximalSquare.py
MaoningGuan/LeetCode
train
3
e34073f3c78763a7000b9d6e760914c7f68b695b
[ "if self.r_ear and self.l_ear:\n ear_dist = distance(self.r_ear, self.l_ear)\n if distance(self.r_wrist, self.r_ear) < ear_dist / 3 and distance(self.l_wrist, self.l_ear) < ear_dist / 3:\n return 'HANDS_ON_EARS'\nif self.shoulders_width and self.r_ear:\n near_dist = self.shoulders_width / 3\n if ...
<|body_start_0|> if self.r_ear and self.l_ear: ear_dist = distance(self.r_ear, self.l_ear) if distance(self.r_wrist, self.r_ear) < ear_dist / 3 and distance(self.l_wrist, self.l_ear) < ear_dist / 3: return 'HANDS_ON_EARS' if self.shoulders_width and self.r_ear: ...
Check Arm poses Attention - this is currently disabled!!!!!!!!!!
ArmPose
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArmPose: """Check Arm poses Attention - this is currently disabled!!!!!!!!!!""" def get_both_arms_pose(self): """Both hands up - Check if both hands are on the ears""" <|body_0|> def get_right_arm_pose(self, controller, vert_angle_right_arm): """Right ear and rig...
stack_v2_sparse_classes_36k_train_002252
7,610
permissive
[ { "docstring": "Both hands up - Check if both hands are on the ears", "name": "get_both_arms_pose", "signature": "def get_both_arms_pose(self)" }, { "docstring": "Right ear and right hand on the same side", "name": "get_right_arm_pose", "signature": "def get_right_arm_pose(self, controll...
3
stack_v2_sparse_classes_30k_train_014804
Implement the Python class `ArmPose` described below. Class description: Check Arm poses Attention - this is currently disabled!!!!!!!!!! Method signatures and docstrings: - def get_both_arms_pose(self): Both hands up - Check if both hands are on the ears - def get_right_arm_pose(self, controller, vert_angle_right_ar...
Implement the Python class `ArmPose` described below. Class description: Check Arm poses Attention - this is currently disabled!!!!!!!!!! Method signatures and docstrings: - def get_both_arms_pose(self): Both hands up - Check if both hands are on the ears - def get_right_arm_pose(self, controller, vert_angle_right_ar...
d276f7727d3a14fadb54c04d0771839bbe3ae14c
<|skeleton|> class ArmPose: """Check Arm poses Attention - this is currently disabled!!!!!!!!!!""" def get_both_arms_pose(self): """Both hands up - Check if both hands are on the ears""" <|body_0|> def get_right_arm_pose(self, controller, vert_angle_right_arm): """Right ear and rig...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArmPose: """Check Arm poses Attention - this is currently disabled!!!!!!!!!!""" def get_both_arms_pose(self): """Both hands up - Check if both hands are on the ears""" if self.r_ear and self.l_ear: ear_dist = distance(self.r_ear, self.l_ear) if distance(self.r_wris...
the_stack_v2_python_sparse
gesturecontrol/posecheck.py
jmhuer/DJITelloAutonomy2
train
0
11d7ad0146b63656733bc07d42cab8febb365031
[ "super().__init__()\nout_channels = channels * self.expansion\nif cardinality == 1:\n rc = channels\nelse:\n width_ratio = channels * (width / self.start_filts)\n rc = cardinality * math.floor(width_ratio)\nself.conv_reduce = ConvNd(n_dim, in_channels, rc, kernel_size=1, stride=1, padding=0, bias=False)\ns...
<|body_start_0|> super().__init__() out_channels = channels * self.expansion if cardinality == 1: rc = channels else: width_ratio = channels * (width / self.start_filts) rc = cardinality * math.floor(width_ratio) self.conv_reduce = ConvNd(n_dim...
_BottleneckX
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _BottleneckX: def __init__(self, in_channels: int, channels: int, stride: Union[int, Sequence[int]], cardinality: int, width: int, n_dim: int, norm_layer: str): """Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer cardinality : ...
stack_v2_sparse_classes_36k_train_002253
12,047
permissive
[ { "docstring": "Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer cardinality : int number of convolution groups width : int width of resnext block n_dim : int dimensionality of convolutions norm_layer: str type of normalization layer", "name": "__...
2
stack_v2_sparse_classes_30k_train_002309
Implement the Python class `_BottleneckX` described below. Class description: Implement the _BottleneckX class. Method signatures and docstrings: - def __init__(self, in_channels: int, channels: int, stride: Union[int, Sequence[int]], cardinality: int, width: int, n_dim: int, norm_layer: str): Parameters ---------- i...
Implement the Python class `_BottleneckX` described below. Class description: Implement the _BottleneckX class. Method signatures and docstrings: - def __init__(self, in_channels: int, channels: int, stride: Union[int, Sequence[int]], cardinality: int, width: int, n_dim: int, norm_layer: str): Parameters ---------- i...
1078f5030b8aac2bf022daf5fa14d66f74c3c893
<|skeleton|> class _BottleneckX: def __init__(self, in_channels: int, channels: int, stride: Union[int, Sequence[int]], cardinality: int, width: int, n_dim: int, norm_layer: str): """Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer cardinality : ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _BottleneckX: def __init__(self, in_channels: int, channels: int, stride: Union[int, Sequence[int]], cardinality: int, width: int, n_dim: int, norm_layer: str): """Parameters ---------- in_channels : int number of input channels stride : int stride of 3x3 convolution layer cardinality : int number of ...
the_stack_v2_python_sparse
dlutils/models/resnext.py
justusschock/dl-utils
train
15
79d49aea9d87b6460e6df937a2e497fe637e2e91
[ "if request.user.has_perm(VIEW_TEAM):\n teams = Team.objects.all()\n serializer = TeamSerializer(teams, many=True)\n return Response(serializer.data)\nreturn Response(status=status.HTTP_401_UNAUTHORIZED)", "if request.user.has_perm(ADD_TEAM):\n serializer = TeamSerializer(data=request.data)\n if se...
<|body_start_0|> if request.user.has_perm(VIEW_TEAM): teams = Team.objects.all() serializer = TeamSerializer(teams, many=True) return Response(serializer.data) return Response(status=status.HTTP_401_UNAUTHORIZED) <|end_body_0|> <|body_start_1|> if request.use...
Contains HTTP methods GET, POST used on /usermanagement/teams/.
TeamList
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeamList: """Contains HTTP methods GET, POST used on /usermanagement/teams/.""" def get(self, request, format='None'): """# Implement the GET method. Parameter : request (HttpRequest) : the request coming from the front-end Return : response (Response) : the response. GET request : l...
stack_v2_sparse_classes_36k_train_002254
10,635
permissive
[ { "docstring": "# Implement the GET method. Parameter : request (HttpRequest) : the request coming from the front-end Return : response (Response) : the response. GET request : list all teams and return the data.", "name": "get", "signature": "def get(self, request, format='None')" }, { "docstri...
2
stack_v2_sparse_classes_30k_train_017827
Implement the Python class `TeamList` described below. Class description: Contains HTTP methods GET, POST used on /usermanagement/teams/. Method signatures and docstrings: - def get(self, request, format='None'): # Implement the GET method. Parameter : request (HttpRequest) : the request coming from the front-end Ret...
Implement the Python class `TeamList` described below. Class description: Contains HTTP methods GET, POST used on /usermanagement/teams/. Method signatures and docstrings: - def get(self, request, format='None'): # Implement the GET method. Parameter : request (HttpRequest) : the request coming from the front-end Ret...
56511ebac83a5dc1fb8768a98bc675e88530a447
<|skeleton|> class TeamList: """Contains HTTP methods GET, POST used on /usermanagement/teams/.""" def get(self, request, format='None'): """# Implement the GET method. Parameter : request (HttpRequest) : the request coming from the front-end Return : response (Response) : the response. GET request : l...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TeamList: """Contains HTTP methods GET, POST used on /usermanagement/teams/.""" def get(self, request, format='None'): """# Implement the GET method. Parameter : request (HttpRequest) : the request coming from the front-end Return : response (Response) : the response. GET request : list all teams...
the_stack_v2_python_sparse
usersmanagement/views/views_team.py
Open-CMMS/openCMMS_backend
train
4
bae80197544cbf18f48a07764f8173d1257b9c45
[ "super(BasicBlock, self).__init__()\nself.conv1 = nn.Conv2d(in_channels, channels, kernel_size=3, stride=stride, padding=1, bias=False)\nself.bn1 = nn.BatchNorm2d(channels)\nself.relu = nn.ReLU(inplace=True)\nself.conv2 = nn.Conv2d(channels, channels, kernel_size=3, stride=1, padding=1, bias=False)\nself.bn2 = nn.B...
<|body_start_0|> super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(in_channels, channels, kernel_size=3, stride=stride, padding=1, bias=False) self.bn1 = nn.BatchNorm2d(channels) self.relu = nn.ReLU(inplace=True) self.conv2 = nn.Conv2d(channels, channels, kernel_size=3, s...
Basic block for ResNet. It applies two 3x3 convolutions to the input. After each convolution applies a batch normalization. You can provide a downsample module to downsample the input and sum to the output (Residual connection) if not provided it assumes that the input has the same dimension of the output. This block h...
BasicBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicBlock: """Basic block for ResNet. It applies two 3x3 convolutions to the input. After each convolution applies a batch normalization. You can provide a downsample module to downsample the input and sum to the output (Residual connection) if not provided it assumes that the input has the same...
stack_v2_sparse_classes_36k_train_002255
14,825
no_license
[ { "docstring": "Initialize the block and set all the modules needed. Args: in_channels (int): Number of channels of the input feature map. channels (int): Number of channels that the block must have. Also, this is the number of channels to output. stride (int): The stride of the convolutional layers. downsample...
2
stack_v2_sparse_classes_30k_test_000421
Implement the Python class `BasicBlock` described below. Class description: Basic block for ResNet. It applies two 3x3 convolutions to the input. After each convolution applies a batch normalization. You can provide a downsample module to downsample the input and sum to the output (Residual connection) if not provided...
Implement the Python class `BasicBlock` described below. Class description: Basic block for ResNet. It applies two 3x3 convolutions to the input. After each convolution applies a batch normalization. You can provide a downsample module to downsample the input and sum to the output (Residual connection) if not provided...
a22aa5b00369c2692bf4fa537bce20144d14d5cb
<|skeleton|> class BasicBlock: """Basic block for ResNet. It applies two 3x3 convolutions to the input. After each convolution applies a batch normalization. You can provide a downsample module to downsample the input and sum to the output (Residual connection) if not provided it assumes that the input has the same...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BasicBlock: """Basic block for ResNet. It applies two 3x3 convolutions to the input. After each convolution applies a batch normalization. You can provide a downsample module to downsample the input and sum to the output (Residual connection) if not provided it assumes that the input has the same dimension of...
the_stack_v2_python_sparse
torchsight/models/resnet.py
SetaSouto/torchsight
train
2
61aeabe7ad3cae689711c244d57a675c1721b50a
[ "try:\n return template_api.get(pk)\nexcept exceptions.DoesNotExist:\n raise Http404", "try:\n template_object = self.get_object(pk)\n serializer = TemplateSerializer(template_object)\n return Response(serializer.data)\nexcept Http404:\n content = {'message': 'Template not found.'}\n return R...
<|body_start_0|> try: return template_api.get(pk) except exceptions.DoesNotExist: raise Http404 <|end_body_0|> <|body_start_1|> try: template_object = self.get_object(pk) serializer = TemplateSerializer(template_object) return Response...
Retrieve a Template.
TemplateDetail
[ "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateDetail: """Retrieve a Template.""" def get_object(self, pk): """Get Template from db Args: pk: ObjectId Returns: Template""" <|body_0|> def get(self, request, pk): """Retrieve a Template Args: request: HTTP request pk: ObjectId Returns: - code: 200 conten...
stack_v2_sparse_classes_36k_train_002256
3,008
permissive
[ { "docstring": "Get Template from db Args: pk: ObjectId Returns: Template", "name": "get_object", "signature": "def get_object(self, pk)" }, { "docstring": "Retrieve a Template Args: request: HTTP request pk: ObjectId Returns: - code: 200 content: Template - code: 404 content: Object was not fou...
2
stack_v2_sparse_classes_30k_train_009678
Implement the Python class `TemplateDetail` described below. Class description: Retrieve a Template. Method signatures and docstrings: - def get_object(self, pk): Get Template from db Args: pk: ObjectId Returns: Template - def get(self, request, pk): Retrieve a Template Args: request: HTTP request pk: ObjectId Return...
Implement the Python class `TemplateDetail` described below. Class description: Retrieve a Template. Method signatures and docstrings: - def get_object(self, pk): Get Template from db Args: pk: ObjectId Returns: Template - def get(self, request, pk): Retrieve a Template Args: request: HTTP request pk: ObjectId Return...
568cb75a40ccff1d74a1a757866112535efd769a
<|skeleton|> class TemplateDetail: """Retrieve a Template.""" def get_object(self, pk): """Get Template from db Args: pk: ObjectId Returns: Template""" <|body_0|> def get(self, request, pk): """Retrieve a Template Args: request: HTTP request pk: ObjectId Returns: - code: 200 conten...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemplateDetail: """Retrieve a Template.""" def get_object(self, pk): """Get Template from db Args: pk: ObjectId Returns: Template""" try: return template_api.get(pk) except exceptions.DoesNotExist: raise Http404 def get(self, request, pk): """R...
the_stack_v2_python_sparse
core_main_app/rest/template/views.py
adilmania/core_main_app
train
0
5a05b1ae9131016628b39c4b06236f05dee2d6bf
[ "if storage is None:\n raise ImportError(_STORAGE_REQUIRED)\nif client is not None:\n self.client = client\nelif credentials is not None:\n self.client = storage.Client(credentials=credentials, project=project)\nelse:\n self.client = storage.Client()\nself.bucket_name = bucket_name", "if self.bucket_n...
<|body_start_0|> if storage is None: raise ImportError(_STORAGE_REQUIRED) if client is not None: self.client = client elif credentials is not None: self.client = storage.Client(credentials=credentials, project=project) else: self.client = s...
Uploads Pandas DataFrame to a bucket in Google Cloud Storage.
GcsClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GcsClient: """Uploads Pandas DataFrame to a bucket in Google Cloud Storage.""" def __init__(self, bucket_name=None, client=None, credentials=None, project=None): """Constructor. Args: bucket_name (Optional[str]): The name of Google Cloud Storage bucket for this client to send request...
stack_v2_sparse_classes_36k_train_002257
5,631
permissive
[ { "docstring": "Constructor. Args: bucket_name (Optional[str]): The name of Google Cloud Storage bucket for this client to send requests to. client (Optional[storage.Client]): A Google Cloud Storage Client instance. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to at...
3
stack_v2_sparse_classes_30k_train_012443
Implement the Python class `GcsClient` described below. Class description: Uploads Pandas DataFrame to a bucket in Google Cloud Storage. Method signatures and docstrings: - def __init__(self, bucket_name=None, client=None, credentials=None, project=None): Constructor. Args: bucket_name (Optional[str]): The name of Go...
Implement the Python class `GcsClient` described below. Class description: Uploads Pandas DataFrame to a bucket in Google Cloud Storage. Method signatures and docstrings: - def __init__(self, bucket_name=None, client=None, credentials=None, project=None): Constructor. Args: bucket_name (Optional[str]): The name of Go...
18cc1a4a45f9aa8cff5f9c0799166e509063f74e
<|skeleton|> class GcsClient: """Uploads Pandas DataFrame to a bucket in Google Cloud Storage.""" def __init__(self, bucket_name=None, client=None, credentials=None, project=None): """Constructor. Args: bucket_name (Optional[str]): The name of Google Cloud Storage bucket for this client to send request...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GcsClient: """Uploads Pandas DataFrame to a bucket in Google Cloud Storage.""" def __init__(self, bucket_name=None, client=None, credentials=None, project=None): """Constructor. Args: bucket_name (Optional[str]): The name of Google Cloud Storage bucket for this client to send requests to. client ...
the_stack_v2_python_sparse
google/cloud/automl_v1beta1/services/tables/gcs_client.py
googleapis/python-automl
train
90
00f7e48f26ccbff5fc6938d1b5f2dd403b2806bb
[ "self.timepoints = timepoints\nself.output_ids = output_ids\nself.output = output\nself.output_sensi = output_sensi\nself.output_weight = output_weight\nself.output_sigmay = output_sigmay\nself.x_names = x_names\nif x_names is None and output_sensi is not None:\n self.x_names = [f'parameter_{i_par}' for i_par in...
<|body_start_0|> self.timepoints = timepoints self.output_ids = output_ids self.output = output self.output_sensi = output_sensi self.output_weight = output_weight self.output_sigmay = output_sigmay self.x_names = x_names if x_names is None and output_sens...
Light-weight wrapper for the prediction of one simulation condition. It should provide a common api how amici predictions should look like in pyPESTO.
PredictionConditionResult
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PredictionConditionResult: """Light-weight wrapper for the prediction of one simulation condition. It should provide a common api how amici predictions should look like in pyPESTO.""" def __init__(self, timepoints: np.ndarray, output_ids: Sequence[str], output: np.ndarray=None, output_sensi:...
stack_v2_sparse_classes_36k_train_002258
12,223
permissive
[ { "docstring": "Initialize PredictionConditionResult. Parameters ---------- timepoints: Output timepoints for this simulation condition output_ids: IDs of outputs for this simulation condition output: Postprocessed outputs (ndarray) output_sensi: Sensitivities of postprocessed outputs (ndarray) output_weight: L...
3
stack_v2_sparse_classes_30k_train_012403
Implement the Python class `PredictionConditionResult` described below. Class description: Light-weight wrapper for the prediction of one simulation condition. It should provide a common api how amici predictions should look like in pyPESTO. Method signatures and docstrings: - def __init__(self, timepoints: np.ndarra...
Implement the Python class `PredictionConditionResult` described below. Class description: Light-weight wrapper for the prediction of one simulation condition. It should provide a common api how amici predictions should look like in pyPESTO. Method signatures and docstrings: - def __init__(self, timepoints: np.ndarra...
9a754573a7b77d30d5dc1f67a8dc1be6c29f1640
<|skeleton|> class PredictionConditionResult: """Light-weight wrapper for the prediction of one simulation condition. It should provide a common api how amici predictions should look like in pyPESTO.""" def __init__(self, timepoints: np.ndarray, output_ids: Sequence[str], output: np.ndarray=None, output_sensi:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PredictionConditionResult: """Light-weight wrapper for the prediction of one simulation condition. It should provide a common api how amici predictions should look like in pyPESTO.""" def __init__(self, timepoints: np.ndarray, output_ids: Sequence[str], output: np.ndarray=None, output_sensi: np.ndarray=N...
the_stack_v2_python_sparse
pypesto/result/predict.py
ICB-DCM/pyPESTO
train
174
a7e50911c603063dc3788e06b329ba278c078121
[ "if self.bot.selfbot:\n return\ntarget = member.server\ncemotes = member.server.emojis\nem_string = ''\nif cemotes:\n em_string = 'Try some custom emotes: ' + ' '.join([str(i) for i in cemotes]) + '! '\n if len(em_string) >= 1980 - len(welcome):\n em_string = ''\nbc = await self.store.get_prop(membe...
<|body_start_0|> if self.bot.selfbot: return target = member.server cemotes = member.server.emojis em_string = '' if cemotes: em_string = 'Try some custom emotes: ' + ' '.join([str(i) for i in cemotes]) + '! ' if len(em_string) >= 1980 - len(we...
Welcomes and goodbyes. 🤗
Welcome
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Welcome: """Welcomes and goodbyes. 🤗""" async def on_member_join(self, member: discord.Member): """On_member_join event for newly joined members.""" <|body_0|> async def on_member_remove(self, member: discord.Member): """On_member_remove event for members leavin...
stack_v2_sparse_classes_36k_train_002259
2,002
permissive
[ { "docstring": "On_member_join event for newly joined members.", "name": "on_member_join", "signature": "async def on_member_join(self, member: discord.Member)" }, { "docstring": "On_member_remove event for members leaving.", "name": "on_member_remove", "signature": "async def on_member_...
2
stack_v2_sparse_classes_30k_train_003363
Implement the Python class `Welcome` described below. Class description: Welcomes and goodbyes. 🤗 Method signatures and docstrings: - async def on_member_join(self, member: discord.Member): On_member_join event for newly joined members. - async def on_member_remove(self, member: discord.Member): On_member_remove eve...
Implement the Python class `Welcome` described below. Class description: Welcomes and goodbyes. 🤗 Method signatures and docstrings: - async def on_member_join(self, member: discord.Member): On_member_join event for newly joined members. - async def on_member_remove(self, member: discord.Member): On_member_remove eve...
edab25451b3620e6fea9a8f1b0afcaa9e1637faa
<|skeleton|> class Welcome: """Welcomes and goodbyes. 🤗""" async def on_member_join(self, member: discord.Member): """On_member_join event for newly joined members.""" <|body_0|> async def on_member_remove(self, member: discord.Member): """On_member_remove event for members leavin...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Welcome: """Welcomes and goodbyes. 🤗""" async def on_member_join(self, member: discord.Member): """On_member_join event for newly joined members.""" if self.bot.selfbot: return target = member.server cemotes = member.server.emojis em_string = '' ...
the_stack_v2_python_sparse
default_cogs/welcome.py
xrxbsx/goldmine
train
2
f7a9655c9fa4e3f485dd2dc898fcb34c7f503fa6
[ "def max(a, b):\n if a > b:\n return a\n return b\nif len(nums) == 0:\n return 0\nif len(nums) == 1:\n return nums[0]\nif len(nums) == 2:\n return max(nums[0], nums[1])\n\ndef my_rob(nums):\n cur, pre = (0, 0)\n for num in nums:\n cur, pre = (max(pre + num, cur), cur)\n return ...
<|body_start_0|> def max(a, b): if a > b: return a return b if len(nums) == 0: return 0 if len(nums) == 1: return nums[0] if len(nums) == 2: return max(nums[0], nums[1]) def my_rob(nums): cur...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums: List[int]) -> int: """213. 打家劫舍 II 执行用时: 32 ms , 在所有 Python3 提交中击败了 95.86% 的用户 内存消耗: 14.8 MB , 在所有 Python3 提交中击败了 75.00% 的用 :param nums: :return:""" <|body_0|> def rob5(self, nums: List[int]) -> int: """213. 打家劫舍 II 执行用时: 40 ms , 在所有 Pyt...
stack_v2_sparse_classes_36k_train_002260
3,370
no_license
[ { "docstring": "213. 打家劫舍 II 执行用时: 32 ms , 在所有 Python3 提交中击败了 95.86% 的用户 内存消耗: 14.8 MB , 在所有 Python3 提交中击败了 75.00% 的用 :param nums: :return:", "name": "rob", "signature": "def rob(self, nums: List[int]) -> int" }, { "docstring": "213. 打家劫舍 II 执行用时: 40 ms , 在所有 Python3 提交中击败了 60.10% 的用户 内存消耗: 15 M...
4
stack_v2_sparse_classes_30k_train_010507
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums: List[int]) -> int: 213. 打家劫舍 II 执行用时: 32 ms , 在所有 Python3 提交中击败了 95.86% 的用户 内存消耗: 14.8 MB , 在所有 Python3 提交中击败了 75.00% 的用 :param nums: :return: - def rob5(self...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums: List[int]) -> int: 213. 打家劫舍 II 执行用时: 32 ms , 在所有 Python3 提交中击败了 95.86% 的用户 内存消耗: 14.8 MB , 在所有 Python3 提交中击败了 75.00% 的用 :param nums: :return: - def rob5(self...
d613ed8a5a2c15ace7d513965b372d128845d66a
<|skeleton|> class Solution: def rob(self, nums: List[int]) -> int: """213. 打家劫舍 II 执行用时: 32 ms , 在所有 Python3 提交中击败了 95.86% 的用户 内存消耗: 14.8 MB , 在所有 Python3 提交中击败了 75.00% 的用 :param nums: :return:""" <|body_0|> def rob5(self, nums: List[int]) -> int: """213. 打家劫舍 II 执行用时: 40 ms , 在所有 Pyt...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, nums: List[int]) -> int: """213. 打家劫舍 II 执行用时: 32 ms , 在所有 Python3 提交中击败了 95.86% 的用户 内存消耗: 14.8 MB , 在所有 Python3 提交中击败了 75.00% 的用 :param nums: :return:""" def max(a, b): if a > b: return a return b if len(nums) == 0: ...
the_stack_v2_python_sparse
array/rob.py
nomboy/leetcode
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_36k_train_002261
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_019938
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_36k
data/stack_v2_sparse_classes_30k
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
1f11d1aa9246b51483f9f881a0aef16d0bbd2b22
[ "super(VGG19, self).__init__()\nassert len(output_blocks) >= 1, 'Need at least one output block'\nself.output_blocks = sorted(output_blocks)\nlast_needed_block = self.output_blocks[-1]\nassert last_needed_block <= 5, 'VGG19 has at most 6 blocks'\nlayers = models.vgg19(pretrained=True).features\nself.blocks = nn.Mod...
<|body_start_0|> super(VGG19, self).__init__() assert len(output_blocks) >= 1, 'Need at least one output block' self.output_blocks = sorted(output_blocks) last_needed_block = self.output_blocks[-1] assert last_needed_block <= 5, 'VGG19 has at most 6 blocks' layers = model...
Pretrained VGG19 network, without fully connected layers
VGG19
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VGG19: """Pretrained VGG19 network, without fully connected layers""" def __init__(self, output_blocks=[LAST_FEATURE_MAP], requires_grad=False): """Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indices of feature blocks to return. Each feature block ends be...
stack_v2_sparse_classes_36k_train_002262
2,538
permissive
[ { "docstring": "Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indices of feature blocks to return. Each feature block ends before a max-pooling layer, i.e. the output of a feature block is the output of the last convolutional layer and activation right before the feature map is downsc...
2
stack_v2_sparse_classes_30k_val_000452
Implement the Python class `VGG19` described below. Class description: Pretrained VGG19 network, without fully connected layers Method signatures and docstrings: - def __init__(self, output_blocks=[LAST_FEATURE_MAP], requires_grad=False): Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indice...
Implement the Python class `VGG19` described below. Class description: Pretrained VGG19 network, without fully connected layers Method signatures and docstrings: - def __init__(self, output_blocks=[LAST_FEATURE_MAP], requires_grad=False): Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indice...
1df1fd37e7adc812b7a5e3859801d8d4a5ff5905
<|skeleton|> class VGG19: """Pretrained VGG19 network, without fully connected layers""" def __init__(self, output_blocks=[LAST_FEATURE_MAP], requires_grad=False): """Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indices of feature blocks to return. Each feature block ends be...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class VGG19: """Pretrained VGG19 network, without fully connected layers""" def __init__(self, output_blocks=[LAST_FEATURE_MAP], requires_grad=False): """Build pretrained VGG19 Parameters ---------- output_blocks : list of int Indices of feature blocks to return. Each feature block ends before a max-po...
the_stack_v2_python_sparse
srgan/models/vgg.py
ZrbTz/HypernetworkSiren
train
1
6970ae1111edcedbc0605d81bc5c3dccbab5ff99
[ "email_template = EmailTemplate.objects.create(**validated_data)\nemail_template.save()\nreturn email_template", "instance.template = validated_data.get('template')\ninstance.subject = validated_data.get('subject')\ninstance.save()\nreturn instance" ]
<|body_start_0|> email_template = EmailTemplate.objects.create(**validated_data) email_template.save() return email_template <|end_body_0|> <|body_start_1|> instance.template = validated_data.get('template') instance.subject = validated_data.get('subject') instance.save(...
EmailTempaltesSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmailTempaltesSerializer: def create(self, validated_data): """Create email tempate details.""" <|body_0|> def update(self, instance, validated_data): """updates email tempate details.""" <|body_1|> <|end_skeleton|> <|body_start_0|> email_template =...
stack_v2_sparse_classes_36k_train_002263
1,279
no_license
[ { "docstring": "Create email tempate details.", "name": "create", "signature": "def create(self, validated_data)" }, { "docstring": "updates email tempate details.", "name": "update", "signature": "def update(self, instance, validated_data)" } ]
2
null
Implement the Python class `EmailTempaltesSerializer` described below. Class description: Implement the EmailTempaltesSerializer class. Method signatures and docstrings: - def create(self, validated_data): Create email tempate details. - def update(self, instance, validated_data): updates email tempate details.
Implement the Python class `EmailTempaltesSerializer` described below. Class description: Implement the EmailTempaltesSerializer class. Method signatures and docstrings: - def create(self, validated_data): Create email tempate details. - def update(self, instance, validated_data): updates email tempate details. <|sk...
5d5bc4c1eecbf627d38260e4d314d8451d67a4f5
<|skeleton|> class EmailTempaltesSerializer: def create(self, validated_data): """Create email tempate details.""" <|body_0|> def update(self, instance, validated_data): """updates email tempate details.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmailTempaltesSerializer: def create(self, validated_data): """Create email tempate details.""" email_template = EmailTemplate.objects.create(**validated_data) email_template.save() return email_template def update(self, instance, validated_data): """updates email ...
the_stack_v2_python_sparse
curation-api/src/patients/serializers/email_templates.py
mohanj1919/django_app_test
train
0
77bddbc3ebbf3c71dba50cf099459bad3a0b1691
[ "n = len(nums)\nself.tree = [0] * (2 * n)\nfor i in range(n, 2 * n, 1):\n self.tree[i] = nums[i - n]\nfor i in range(n - 1, 0, -1):\n self.tree[i] = self.tree[2 * i] + self.tree[2 * i + 1]\nself.nums = nums\nself.n = n\nreturn", "n = self.n\nself.nums[index] = val\nindex += n\nself.tree[index] = val\nindex ...
<|body_start_0|> n = len(nums) self.tree = [0] * (2 * n) for i in range(n, 2 * n, 1): self.tree[i] = nums[i - n] for i in range(n - 1, 0, -1): self.tree[i] = self.tree[2 * i] + self.tree[2 * i + 1] self.nums = nums self.n = n return <|end_b...
NumArray
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, index, val): """:type index: int :type val: int :rtype: None""" <|body_1|> def sumRange(self, left, right): """:type left: int :type right: int :rtype: in...
stack_v2_sparse_classes_36k_train_002264
2,072
no_license
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type index: int :type val: int :rtype: None", "name": "update", "signature": "def update(self, index, val)" }, { "docstring": ":type left: int :type right: int ...
3
stack_v2_sparse_classes_30k_train_002304
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, index, val): :type index: int :type val: int :rtype: None - def sumRange(self, left, right): :type left: int :t...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, index, val): :type index: int :type val: int :rtype: None - def sumRange(self, left, right): :type left: int :t...
ad1eabfa27dda65b743d7d93524f1ec8f1e0ebfc
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, index, val): """:type index: int :type val: int :rtype: None""" <|body_1|> def sumRange(self, left, right): """:type left: int :type right: int :rtype: in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" n = len(nums) self.tree = [0] * (2 * n) for i in range(n, 2 * n, 1): self.tree[i] = nums[i - n] for i in range(n - 1, 0, -1): self.tree[i] = self.tree[2 * i] + self.tree[2 * i + 1] ...
the_stack_v2_python_sparse
code/leetcode-307.py
kiyoxi2020/leetcode
train
3
ae8d8edf697aafed9bb5dbb4c318b53b0bf4417d
[ "tiling_options = {'verbose': 0, 'mode': 'LASSO', 'print_summary': True}\nself.problem = dict(problem.items() + {'tiling_options': tiling_options}.items())\nnp.random.seed(problem['random_seed'])\nrandom_state = np.random.get_state()\nself.problem['random_state'] = random_state\nA, y, u_real, v_real = create_specif...
<|body_start_0|> tiling_options = {'verbose': 0, 'mode': 'LASSO', 'print_summary': True} self.problem = dict(problem.items() + {'tiling_options': tiling_options}.items()) np.random.seed(problem['random_seed']) random_state = np.random.get_state() self.problem['random_state'] = ra...
Test class implementing a test that compares the tiling results with the scipy implementation of the Lasso-path algorithm. Concretely, we use the problem setup defined in the beginning of this file, and we create the support tiling for this problem. Afterwards, we run the scipy-lasso algorithm for each single beta in t...
CompareToScipyLASSOTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CompareToScipyLASSOTestCase: """Test class implementing a test that compares the tiling results with the scipy implementation of the Lasso-path algorithm. Concretely, we use the problem setup defined in the beginning of this file, and we create the support tiling for this problem. Afterwards, we ...
stack_v2_sparse_classes_36k_train_002265
9,738
no_license
[ { "docstring": "Set up for the tests by calculating the tiling and the lars-path for some distinct beta's given in problem['betas_to_test'].", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Tests the support and sign pattern equality of the scipy implementation and our tiling...
2
stack_v2_sparse_classes_30k_train_006293
Implement the Python class `CompareToScipyLASSOTestCase` described below. Class description: Test class implementing a test that compares the tiling results with the scipy implementation of the Lasso-path algorithm. Concretely, we use the problem setup defined in the beginning of this file, and we create the support t...
Implement the Python class `CompareToScipyLASSOTestCase` described below. Class description: Test class implementing a test that compares the tiling results with the scipy implementation of the Lasso-path algorithm. Concretely, we use the problem setup defined in the beginning of this file, and we create the support t...
2238f0a2bdd4c5acb01564977eada2be8450f413
<|skeleton|> class CompareToScipyLASSOTestCase: """Test class implementing a test that compares the tiling results with the scipy implementation of the Lasso-path algorithm. Concretely, we use the problem setup defined in the beginning of this file, and we create the support tiling for this problem. Afterwards, we ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CompareToScipyLASSOTestCase: """Test class implementing a test that compares the tiling results with the scipy implementation of the Lasso-path algorithm. Concretely, we use the problem setup defined in the beginning of this file, and we create the support tiling for this problem. Afterwards, we run the scipy...
the_stack_v2_python_sparse
test_utils/test_scipy_comparison.py
soply/mpgraph
train
0
7e31dccdfcf4efe2d5b4db6dd40fd8aa5d76a64e
[ "num_rows = self._parse_file_data_size(file_path)\npixels = zeros((num_rows, self.num_columns - 1), float32)\nnumbers = zeros((num_rows,), uint8)\nrow = 0\nfor sample_data in super(TrainingSetIO, self).parse(file_path):\n numbers[row] = uint8(sample_data[0])\n pixels[row] = uint8(sample_data[1:])\n row += ...
<|body_start_0|> num_rows = self._parse_file_data_size(file_path) pixels = zeros((num_rows, self.num_columns - 1), float32) numbers = zeros((num_rows,), uint8) row = 0 for sample_data in super(TrainingSetIO, self).parse(file_path): numbers[row] = uint8(sample_data[0])...
Parses kaggle input training and test set data for processing For training data input is expected in the form: label, pixel0, pixel1, ... pixelN 1,22,33,...250 9,53,0,...125 ... Where the label column is absent for testing, the format is otherwise identical Pixels can range from 0 -> 255 Labels can range from 0 -> 9
TrainingSetIO
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TrainingSetIO: """Parses kaggle input training and test set data for processing For training data input is expected in the form: label, pixel0, pixel1, ... pixelN 1,22,33,...250 9,53,0,...125 ... Where the label column is absent for testing, the format is otherwise identical Pixels can range from...
stack_v2_sparse_classes_36k_train_002266
2,146
no_license
[ { "docstring": "Parses the training set for labels (image numbers) and pixel values Generates tuples of integer labels and arrays of pixel values :param file_path: The path to be parsed :return: A tuple of (actual numbers, images). Where actual numbers is an array of the integer value of the associated image. I...
2
stack_v2_sparse_classes_30k_train_014683
Implement the Python class `TrainingSetIO` described below. Class description: Parses kaggle input training and test set data for processing For training data input is expected in the form: label, pixel0, pixel1, ... pixelN 1,22,33,...250 9,53,0,...125 ... Where the label column is absent for testing, the format is ot...
Implement the Python class `TrainingSetIO` described below. Class description: Parses kaggle input training and test set data for processing For training data input is expected in the form: label, pixel0, pixel1, ... pixelN 1,22,33,...250 9,53,0,...125 ... Where the label column is absent for testing, the format is ot...
164f8df98b82d6be55e01229feac7f09cd7b3be0
<|skeleton|> class TrainingSetIO: """Parses kaggle input training and test set data for processing For training data input is expected in the form: label, pixel0, pixel1, ... pixelN 1,22,33,...250 9,53,0,...125 ... Where the label column is absent for testing, the format is otherwise identical Pixels can range from...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TrainingSetIO: """Parses kaggle input training and test set data for processing For training data input is expected in the form: label, pixel0, pixel1, ... pixelN 1,22,33,...250 9,53,0,...125 ... Where the label column is absent for testing, the format is otherwise identical Pixels can range from 0 -> 255 Lab...
the_stack_v2_python_sparse
formatted_io/training_set_io.py
barryhennessy/digit_classifier
train
0
eec3ca61ec5b63365ec6b5aaa6c2654bf9720904
[ "super(EmbeddingCardSuperNet, self).__init__()\nself.cardinality_options = cardinality_options\nself.num_card_options = len(self.cardinality_options)\nself.dim = dim\nself.params_options = nn.Parameter(torch.Tensor([self.dim * curr_card for curr_card in self.cardinality_options]), requires_grad=False)\nself.num_emb...
<|body_start_0|> super(EmbeddingCardSuperNet, self).__init__() self.cardinality_options = cardinality_options self.num_card_options = len(self.cardinality_options) self.dim = dim self.params_options = nn.Parameter(torch.Tensor([self.dim * curr_card for curr_card in self.cardinali...
EmbeddingCardSuperNet
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EmbeddingCardSuperNet: def __init__(self, cardinality_options, dim): """Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the largest cardinality embedding and then using that becuase then hashed and unhashes embedding indices may be m...
stack_v2_sparse_classes_36k_train_002267
6,458
permissive
[ { "docstring": "Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the largest cardinality embedding and then using that becuase then hashed and unhashes embedding indices may be mapped to the same values. Further, because we will typically be choosing between...
5
stack_v2_sparse_classes_30k_train_009554
Implement the Python class `EmbeddingCardSuperNet` described below. Class description: Implement the EmbeddingCardSuperNet class. Method signatures and docstrings: - def __init__(self, cardinality_options, dim): Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the...
Implement the Python class `EmbeddingCardSuperNet` described below. Class description: Implement the EmbeddingCardSuperNet class. Method signatures and docstrings: - def __init__(self, cardinality_options, dim): Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the...
39aa5b13d66a3899350cb4e53d87a8cd3c5c198f
<|skeleton|> class EmbeddingCardSuperNet: def __init__(self, cardinality_options, dim): """Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the largest cardinality embedding and then using that becuase then hashed and unhashes embedding indices may be m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EmbeddingCardSuperNet: def __init__(self, cardinality_options, dim): """Implements an embedding cardinality search supernet. We cannot use the FBNetv2 method of just creating the largest cardinality embedding and then using that becuase then hashed and unhashes embedding indices may be mapped to the s...
the_stack_v2_python_sparse
nas_embedding_card.py
ravikucb/dnas
train
6
ce0211c5a8cb3561e751a35639df6f56abed625a
[ "filter_lookup = {'published_before': 'published_date__lte', 'published_after': 'published_date__gte', 'title': 'title__icontains', 'number': 'episode_number'}\nfilter_parameters = {}\nfor key, value in params.items():\n filter_parameters.update({filter_lookup[key]: value})\nreturn filter_parameters", "query_p...
<|body_start_0|> filter_lookup = {'published_before': 'published_date__lte', 'published_after': 'published_date__gte', 'title': 'title__icontains', 'number': 'episode_number'} filter_parameters = {} for key, value in params.items(): filter_parameters.update({filter_lookup[key]: value...
View Set to support creation and retrieval of Podcast Episodes
EpisodeViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EpisodeViewSet: """View Set to support creation and retrieval of Podcast Episodes""" def _filterify_query_params(params): """Method to convert simplified URL query parameters to their appropriate values to be unpacked in a .filter() call :param params: Query parameters passed in the ...
stack_v2_sparse_classes_36k_train_002268
6,303
no_license
[ { "docstring": "Method to convert simplified URL query parameters to their appropriate values to be unpacked in a .filter() call :param params: Query parameters passed in the request :return: Dictionary of the parameters that can be unpacked in QuerySet's .filter() method", "name": "_filterify_query_params"...
2
stack_v2_sparse_classes_30k_train_004131
Implement the Python class `EpisodeViewSet` described below. Class description: View Set to support creation and retrieval of Podcast Episodes Method signatures and docstrings: - def _filterify_query_params(params): Method to convert simplified URL query parameters to their appropriate values to be unpacked in a .fil...
Implement the Python class `EpisodeViewSet` described below. Class description: View Set to support creation and retrieval of Podcast Episodes Method signatures and docstrings: - def _filterify_query_params(params): Method to convert simplified URL query parameters to their appropriate values to be unpacked in a .fil...
38a09ce2fe68312338c8cb597a341853901eeaa3
<|skeleton|> class EpisodeViewSet: """View Set to support creation and retrieval of Podcast Episodes""" def _filterify_query_params(params): """Method to convert simplified URL query parameters to their appropriate values to be unpacked in a .filter() call :param params: Query parameters passed in the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EpisodeViewSet: """View Set to support creation and retrieval of Podcast Episodes""" def _filterify_query_params(params): """Method to convert simplified URL query parameters to their appropriate values to be unpacked in a .filter() call :param params: Query parameters passed in the request :retu...
the_stack_v2_python_sparse
apps/podcast/views.py
AOV-Team/aov-py-backend
train
0
93c6af025c29077888dda20465fa3c674ecdd5c4
[ "for col in self.columns:\n if lower(col.type) == 'geometry':\n return col", "for col in self.columns:\n col = col.column\n if col.is_geomref():\n return col" ]
<|body_start_0|> for col in self.columns: if lower(col.type) == 'geometry': return col <|end_body_0|> <|body_start_1|> for col in self.columns: col = col.column if col.is_geomref(): return col <|end_body_1|>
Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifier for this table. Is always qualified by the module name of the class that ...
OBSTable
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OBSTable: """Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifier for this table. Is always qualified b...
stack_v2_sparse_classes_36k_train_002269
38,974
permissive
[ { "docstring": "Return the column geometry column for this table, if it has one. Returns None if there is none.", "name": "geom_column", "signature": "def geom_column(self)" }, { "docstring": "Return the geomref column for this table, if it has one. Returns None if there is none.", "name": "...
2
stack_v2_sparse_classes_30k_val_000792
Implement the Python class `OBSTable` described below. Class description: Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifie...
Implement the Python class `OBSTable` described below. Class description: Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifie...
a32325382500f23b8a607e4e02cc0ec111360869
<|skeleton|> class OBSTable: """Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifier for this table. Is always qualified b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OBSTable: """Describes a physical table in our database. These should *never* be instantiated manually. They are automatically created by :meth:`~.tasks.TableTask.output`. The unique key is :attr:~.meta.OBSTable.id:. .. py:attribute:: id The unique identifier for this table. Is always qualified by the module ...
the_stack_v2_python_sparse
tasks/meta.py
CartoDB/bigmetadata
train
45
b756604d267a19ea6b386f7d8b889b9a131ef5d2
[ "user = request.user\ntry:\n product = Product.objects.get(pk=product_pk)\n wishlist, _ = WishList.objects.get_or_create(owner=user)\n wishlist.add(product)\n return Response(err_result(SUCCESS_CODE, u'关注成功').msg)\nexcept Exception as e:\n logging.exception(e)\n return Response(err_result(SYSTEM_E...
<|body_start_0|> user = request.user try: product = Product.objects.get(pk=product_pk) wishlist, _ = WishList.objects.get_or_create(owner=user) wishlist.add(product) return Response(err_result(SUCCESS_CODE, u'关注成功').msg) except Exception as e: ...
AppMyFavProduct
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AppMyFavProduct: def post(self, request, product_pk, *args, **kwargs): """添加商品到我的关注 :param request: :param product_pk: 商品id :param args: :param kwargs: :return:""" <|body_0|> def delete(self, request, product_pk, format=None): """从我的关注里删除关注商品 :param request: :param p...
stack_v2_sparse_classes_36k_train_002270
4,827
no_license
[ { "docstring": "添加商品到我的关注 :param request: :param product_pk: 商品id :param args: :param kwargs: :return:", "name": "post", "signature": "def post(self, request, product_pk, *args, **kwargs)" }, { "docstring": "从我的关注里删除关注商品 :param request: :param product_pk:商品id :param format: :return: SUCCESS_CODE...
2
null
Implement the Python class `AppMyFavProduct` described below. Class description: Implement the AppMyFavProduct class. Method signatures and docstrings: - def post(self, request, product_pk, *args, **kwargs): 添加商品到我的关注 :param request: :param product_pk: 商品id :param args: :param kwargs: :return: - def delete(self, requ...
Implement the Python class `AppMyFavProduct` described below. Class description: Implement the AppMyFavProduct class. Method signatures and docstrings: - def post(self, request, product_pk, *args, **kwargs): 添加商品到我的关注 :param request: :param product_pk: 商品id :param args: :param kwargs: :return: - def delete(self, requ...
3d6198c2a1abc97fa9286408f52c1f5153883b7a
<|skeleton|> class AppMyFavProduct: def post(self, request, product_pk, *args, **kwargs): """添加商品到我的关注 :param request: :param product_pk: 商品id :param args: :param kwargs: :return:""" <|body_0|> def delete(self, request, product_pk, format=None): """从我的关注里删除关注商品 :param request: :param p...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AppMyFavProduct: def post(self, request, product_pk, *args, **kwargs): """添加商品到我的关注 :param request: :param product_pk: 商品id :param args: :param kwargs: :return:""" user = request.user try: product = Product.objects.get(pk=product_pk) wishlist, _ = WishList.objec...
the_stack_v2_python_sparse
stars/apps/api/wishlists/views.py
lisongwei15931/stars
train
0
abccc51c178ec1f9a5e8af8e5c085c6faa882866
[ "self.aoi = aoi\nself.ds = ds\nself.mask_value = mask_value\nself.fill_value = fill_value", "import geopandas as gpd\nfrom downscale import utils\ngdf = gpd.read_file(self.aoi)\nshapes = [(geom, self.mask_value) for geom in gdf.geometry]\nds = self.ds.ds\ncoords = ds.coords\nreturn utils.rasterize(shapes, coords=...
<|body_start_0|> self.aoi = aoi self.ds = ds self.mask_value = mask_value self.fill_value = fill_value <|end_body_0|> <|body_start_1|> import geopandas as gpd from downscale import utils gdf = gpd.read_file(self.aoi) shapes = [(geom, self.mask_value) for ...
Mask
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mask: def __init__(self, aoi, ds, mask_value=1, fill_value=0, *args, **kwargs): """make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = [str] full read path of a shapefile with .shp extension ds = [downscale.Dataset] instance of ...
stack_v2_sparse_classes_36k_train_002271
6,957
permissive
[ { "docstring": "make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = [str] full read path of a shapefile with .shp extension ds = [downscale.Dataset] instance of file in a downscale.Dataset object mask_value = [int] value to use for masked areas. defaul...
4
null
Implement the Python class `Mask` described below. Class description: Implement the Mask class. Method signatures and docstrings: - def __init__(self, aoi, ds, mask_value=1, fill_value=0, *args, **kwargs): make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = ...
Implement the Python class `Mask` described below. Class description: Implement the Mask class. Method signatures and docstrings: - def __init__(self, aoi, ds, mask_value=1, fill_value=0, *args, **kwargs): make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = ...
3fe8ea1774cf82149d19561ce5f19b25e6cba6fb
<|skeleton|> class Mask: def __init__(self, aoi, ds, mask_value=1, fill_value=0, *args, **kwargs): """make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = [str] full read path of a shapefile with .shp extension ds = [downscale.Dataset] instance of ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mask: def __init__(self, aoi, ds, mask_value=1, fill_value=0, *args, **kwargs): """make a mask from a shapefile which is already in the CRS and domain of the input ds. ARGUMENTS: --------- aoi = [str] full read path of a shapefile with .shp extension ds = [downscale.Dataset] instance of file in a down...
the_stack_v2_python_sparse
downscale/dataset.py
yusheng-wang/downscale
train
0
3e5f1255c2276781a1a4f553bef9fa53919a388e
[ "s, e, i, r, c, m = xs\nif isinstance(parameters, Parameters):\n beta = parameters['beta'].value\n gamma = parameters['gamma'].value\n sigma = parameters['sigma'].value\n eta = parameters['eta'].value\n epsilon = parameters['sigma'].value\n T_quarantine = parameters['T'].value\nelif isinstance(par...
<|body_start_0|> s, e, i, r, c, m = xs if isinstance(parameters, Parameters): beta = parameters['beta'].value gamma = parameters['gamma'].value sigma = parameters['sigma'].value eta = parameters['eta'].value epsilon = parameters['sigma'].value ...
SEIR Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf with cumulative cases (C) and cumulative fatalities (M)
SEIRCM
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SEIRCM: """SEIR Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf with cumulative cases (C) and cumulative fatalities (M)""" def calibrate(cls, xs: tuple, t: float, parameters: Union[Parameters, tuple]) -> tuple: """SEIRCM model derivatives at t. :para...
stack_v2_sparse_classes_36k_train_002272
29,649
permissive
[ { "docstring": "SEIRCM model derivatives at t. :param xs: variables that we are solving for i.e. [S]usceptible, [E]xposed, [I]nfected, [R]emoved, [C]ases, [M]ortality :param t: time parameter :param parameters: parameters of the model (not including initial conditions) i.e. beta, gamma, sigma, eta, epsilon :ret...
2
null
Implement the Python class `SEIRCM` described below. Class description: SEIR Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf with cumulative cases (C) and cumulative fatalities (M) Method signatures and docstrings: - def calibrate(cls, xs: tuple, t: float, parameters: Union[Parameter...
Implement the Python class `SEIRCM` described below. Class description: SEIR Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf with cumulative cases (C) and cumulative fatalities (M) Method signatures and docstrings: - def calibrate(cls, xs: tuple, t: float, parameters: Union[Parameter...
4cf8ec75c4d85b16ec08371c46cc1a9ede9d72a2
<|skeleton|> class SEIRCM: """SEIR Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf with cumulative cases (C) and cumulative fatalities (M)""" def calibrate(cls, xs: tuple, t: float, parameters: Union[Parameters, tuple]) -> tuple: """SEIRCM model derivatives at t. :para...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SEIRCM: """SEIR Model from https://www.medrxiv.org/content/10.1101/2020.03.04.20031104v1.full.pdf with cumulative cases (C) and cumulative fatalities (M)""" def calibrate(cls, xs: tuple, t: float, parameters: Union[Parameters, tuple]) -> tuple: """SEIRCM model derivatives at t. :param xs: variabl...
the_stack_v2_python_sparse
gs_quant/models/epidemiology.py
goldmansachs/gs-quant
train
2,088
ba8cbde3934a244f362fc11ce2e8584d80fe25b9
[ "super(SimulatedExecutionHandler, self).__init__(data_handler.events, False)\nself.data_handler = data_handler\nself.transaction_cost = transaction_cost", "symbol = order_event.symbol\nquantity = order_event.quantity\naction = params.action_dict[order_event.direction, order_event.trade_type]\nprice_id = [params.P...
<|body_start_0|> super(SimulatedExecutionHandler, self).__init__(data_handler.events, False) self.data_handler = data_handler self.transaction_cost = transaction_cost <|end_body_0|> <|body_start_1|> symbol = order_event.symbol quantity = order_event.quantity action = par...
Simulated Execution Handler Class The simulated execution handler simply converts all order objects into their equivalent fill objects automatically without latency, slippage or fill-ratio issues. This allows a straightforward 'first go' test of any strategy, before implementation with a more sophisticated execution ha...
SimulatedExecutionHandler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimulatedExecutionHandler: """Simulated Execution Handler Class The simulated execution handler simply converts all order objects into their equivalent fill objects automatically without latency, slippage or fill-ratio issues. This allows a straightforward 'first go' test of any strategy, before ...
stack_v2_sparse_classes_36k_train_002273
2,574
permissive
[ { "docstring": "Initialize parameters of the simulated execution handler object.", "name": "__init__", "signature": "def __init__(self, data_handler, transaction_cost=0.0005)" }, { "docstring": "Implementation of abstract base class method.", "name": "execute_order", "signature": "def ex...
2
stack_v2_sparse_classes_30k_train_015693
Implement the Python class `SimulatedExecutionHandler` described below. Class description: Simulated Execution Handler Class The simulated execution handler simply converts all order objects into their equivalent fill objects automatically without latency, slippage or fill-ratio issues. This allows a straightforward '...
Implement the Python class `SimulatedExecutionHandler` described below. Class description: Simulated Execution Handler Class The simulated execution handler simply converts all order objects into their equivalent fill objects automatically without latency, slippage or fill-ratio issues. This allows a straightforward '...
e2e9d638c68947d24f1260d35a3527dd84c2523f
<|skeleton|> class SimulatedExecutionHandler: """Simulated Execution Handler Class The simulated execution handler simply converts all order objects into their equivalent fill objects automatically without latency, slippage or fill-ratio issues. This allows a straightforward 'first go' test of any strategy, before ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimulatedExecutionHandler: """Simulated Execution Handler Class The simulated execution handler simply converts all order objects into their equivalent fill objects automatically without latency, slippage or fill-ratio issues. This allows a straightforward 'first go' test of any strategy, before implementatio...
the_stack_v2_python_sparse
odin/handlers/execution_handler/simulated_execution_handler.py
stjordanis/Odin
train
0
56419470d2309cdc2c9a6843be95b3ef0ad43c15
[ "self.count_dict = {}\nself.count_dict.setdefault('product_errors', 0)\nself.count_dict.setdefault('customer_errors', 0)\nself.count_dict.setdefault('rentals_errors', 0)\nself.count_dict.setdefault('product_count_before', 0)\nself.count_dict.setdefault('product_count_after', 0)\nself.count_dict.setdefault('customer...
<|body_start_0|> self.count_dict = {} self.count_dict.setdefault('product_errors', 0) self.count_dict.setdefault('customer_errors', 0) self.count_dict.setdefault('rentals_errors', 0) self.count_dict.setdefault('product_count_before', 0) self.count_dict.setdefault('product...
This class contains the methods to import all the .csv info
ImportData
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImportData: """This class contains the methods to import all the .csv info""" def __init__(self): """Initiates the dictionary items""" <|body_0|> def import_all(self): """Imports everything without timing""" <|body_1|> def import_stats(self): ...
stack_v2_sparse_classes_36k_train_002274
10,744
no_license
[ { "docstring": "Initiates the dictionary items", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Imports everything without timing", "name": "import_all", "signature": "def import_all(self)" }, { "docstring": "This function returns the statistical data on...
6
null
Implement the Python class `ImportData` described below. Class description: This class contains the methods to import all the .csv info Method signatures and docstrings: - def __init__(self): Initiates the dictionary items - def import_all(self): Imports everything without timing - def import_stats(self): This functi...
Implement the Python class `ImportData` described below. Class description: This class contains the methods to import all the .csv info Method signatures and docstrings: - def __init__(self): Initiates the dictionary items - def import_all(self): Imports everything without timing - def import_stats(self): This functi...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class ImportData: """This class contains the methods to import all the .csv info""" def __init__(self): """Initiates the dictionary items""" <|body_0|> def import_all(self): """Imports everything without timing""" <|body_1|> def import_stats(self): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImportData: """This class contains the methods to import all the .csv info""" def __init__(self): """Initiates the dictionary items""" self.count_dict = {} self.count_dict.setdefault('product_errors', 0) self.count_dict.setdefault('customer_errors', 0) self.count_d...
the_stack_v2_python_sparse
students/dfspray/Lesson10/src/database.py
JavaRod/SP_Python220B_2019
train
1
7241ba88f8186037afd1cb47c55f5b36ea68ad1a
[ "self.s_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nself.h_name = socket.gethostname()\nself.p_number = 9994\nself.s_socket.bind((self.h_name, self.p_number))\nself.s_socket.listen(5)\nself.log = LogManager.get_logger()\nif self.log:\n self.log.log_info('ServerConnection', '__init__', 'opening a ...
<|body_start_0|> self.s_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.h_name = socket.gethostname() self.p_number = 9994 self.s_socket.bind((self.h_name, self.p_number)) self.s_socket.listen(5) self.log = LogManager.get_logger() if self.log: ...
ServerConnection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ServerConnection: def __init__(self): """Description: Initialization function for ServerConnection Class. It creates a socket at server end to handle the client request on specific port. Argument : None Return Type : None""" <|body_0|> def accept_connection(self): ""...
stack_v2_sparse_classes_36k_train_002275
4,005
no_license
[ { "docstring": "Description: Initialization function for ServerConnection Class. It creates a socket at server end to handle the client request on specific port. Argument : None Return Type : None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Description: Function to...
3
stack_v2_sparse_classes_30k_test_000550
Implement the Python class `ServerConnection` described below. Class description: Implement the ServerConnection class. Method signatures and docstrings: - def __init__(self): Description: Initialization function for ServerConnection Class. It creates a socket at server end to handle the client request on specific po...
Implement the Python class `ServerConnection` described below. Class description: Implement the ServerConnection class. Method signatures and docstrings: - def __init__(self): Description: Initialization function for ServerConnection Class. It creates a socket at server end to handle the client request on specific po...
0a16a9905a3b0689e3186c76089a99000a4c649d
<|skeleton|> class ServerConnection: def __init__(self): """Description: Initialization function for ServerConnection Class. It creates a socket at server end to handle the client request on specific port. Argument : None Return Type : None""" <|body_0|> def accept_connection(self): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ServerConnection: def __init__(self): """Description: Initialization function for ServerConnection Class. It creates a socket at server end to handle the client request on specific port. Argument : None Return Type : None""" self.s_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
the_stack_v2_python_sparse
com/itt/tds/comm/ServerConnection.py
mukultaneja/TaskDistributionSystem
train
0
19b97710650aff1a53fec93a6d1730a3c3a164aa
[ "new_list = ListNode(0)\ncur = new_list\nwhile l1 and l2:\n if l1.val < l2.val:\n cur.next = l1\n cur = cur.next\n l1 = l1.next\n else:\n cur.next = l2\n cur = cur.next\n l2 = l2.next\nif l1:\n cur.next = l1\nif l2:\n cur.next = l2\nreturn new_list.next", "if ...
<|body_start_0|> new_list = ListNode(0) cur = new_list while l1 and l2: if l1.val < l2.val: cur.next = l1 cur = cur.next l1 = l1.next else: cur.next = l2 cur = cur.next l2 = l2...
ListNodeOperator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListNodeOperator: def mergeTwoListNode(self, l1, l2): """方法一:迭代法""" <|body_0|> def mergeTwoListNode(self, l1, l2): """方法二: 递归""" <|body_1|> <|end_skeleton|> <|body_start_0|> new_list = ListNode(0) cur = new_list while l1 and l2: ...
stack_v2_sparse_classes_36k_train_002276
1,144
no_license
[ { "docstring": "方法一:迭代法", "name": "mergeTwoListNode", "signature": "def mergeTwoListNode(self, l1, l2)" }, { "docstring": "方法二: 递归", "name": "mergeTwoListNode", "signature": "def mergeTwoListNode(self, l1, l2)" } ]
2
stack_v2_sparse_classes_30k_train_016280
Implement the Python class `ListNodeOperator` described below. Class description: Implement the ListNodeOperator class. Method signatures and docstrings: - def mergeTwoListNode(self, l1, l2): 方法一:迭代法 - def mergeTwoListNode(self, l1, l2): 方法二: 递归
Implement the Python class `ListNodeOperator` described below. Class description: Implement the ListNodeOperator class. Method signatures and docstrings: - def mergeTwoListNode(self, l1, l2): 方法一:迭代法 - def mergeTwoListNode(self, l1, l2): 方法二: 递归 <|skeleton|> class ListNodeOperator: def mergeTwoListNode(self, l1...
417a5412398a29bd3ad5a996ea008327947a5245
<|skeleton|> class ListNodeOperator: def mergeTwoListNode(self, l1, l2): """方法一:迭代法""" <|body_0|> def mergeTwoListNode(self, l1, l2): """方法二: 递归""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListNodeOperator: def mergeTwoListNode(self, l1, l2): """方法一:迭代法""" new_list = ListNode(0) cur = new_list while l1 and l2: if l1.val < l2.val: cur.next = l1 cur = cur.next l1 = l1.next else: ...
the_stack_v2_python_sparse
treeAndLink/21.合并两个有序链表.py
lujiely/DataStructureAlgorithm_python
train
0
207076fd8ab3146cfe118ccec53b72566d9f2ea9
[ "rootSet = cmds.ls(sl=True)\nsubSets = cmds.sets(rootSet, q=True)\nsetTable = {}\nfor subSet in subSets:\n setMems = cmds.sets(subSet, q=True)\n setTable[subSet] = setMems\nreturn setTable", "for set in info.keys():\n if info[set] == None:\n continue\n existsObjLs = []\n for obj in info[set]...
<|body_start_0|> rootSet = cmds.ls(sl=True) subSets = cmds.sets(rootSet, q=True) setTable = {} for subSet in subSets: setMems = cmds.sets(subSet, q=True) setTable[subSet] = setMems return setTable <|end_body_0|> <|body_start_1|> for set in info.ke...
Set information class. Save set information and create set from saved information.
SetInfo
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SetInfo: """Set information class. Save set information and create set from saved information.""" def getSelSetInfo(self): """Get selected set and subset information.""" <|body_0|> def createSet(self, info): """Create set with information.""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_002277
5,415
no_license
[ { "docstring": "Get selected set and subset information.", "name": "getSelSetInfo", "signature": "def getSelSetInfo(self)" }, { "docstring": "Create set with information.", "name": "createSet", "signature": "def createSet(self, info)" } ]
2
null
Implement the Python class `SetInfo` described below. Class description: Set information class. Save set information and create set from saved information. Method signatures and docstrings: - def getSelSetInfo(self): Get selected set and subset information. - def createSet(self, info): Create set with information.
Implement the Python class `SetInfo` described below. Class description: Set information class. Save set information and create set from saved information. Method signatures and docstrings: - def getSelSetInfo(self): Get selected set and subset information. - def createSet(self, info): Create set with information. <...
bd98679cbab869a0c96eac34cb2f199dfbf8fee8
<|skeleton|> class SetInfo: """Set information class. Save set information and create set from saved information.""" def getSelSetInfo(self): """Get selected set and subset information.""" <|body_0|> def createSet(self, info): """Create set with information.""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SetInfo: """Set information class. Save set information and create set from saved information.""" def getSelSetInfo(self): """Get selected set and subset information.""" rootSet = cmds.ls(sl=True) subSets = cmds.sets(rootSet, q=True) setTable = {} for subSet in sub...
the_stack_v2_python_sparse
python/tak_saveSceneInfo.py
jasonbrackman/scripts
train
0
fb966322b9d5f78d5e116d502db6e94c96fc455a
[ "try:\n params = request._serialize()\n headers = request.headers\n body = self.call('DescribeMaterialList', params, headers=headers)\n response = json.loads(body)\n model = models.DescribeMaterialListResponse()\n model._deserialize(response['Response'])\n return model\nexcept Exception as e:\n...
<|body_start_0|> try: params = request._serialize() headers = request.headers body = self.call('DescribeMaterialList', params, headers=headers) response = json.loads(body) model = models.DescribeMaterialListResponse() model._deserialize(res...
FacefusionClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FacefusionClient: def DescribeMaterialList(self, request): """通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for DescribeMaterialList. :type request: :class:`tencentcloud.facefusion.v20181201.models.DescribeMaterialListR...
stack_v2_sparse_classes_36k_train_002278
5,785
permissive
[ { "docstring": "通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for DescribeMaterialList. :type request: :class:`tencentcloud.facefusion.v20181201.models.DescribeMaterialListRequest` :rtype: :class:`tencentcloud.facefusion.v20181201.models.Descr...
4
stack_v2_sparse_classes_30k_train_004465
Implement the Python class `FacefusionClient` described below. Class description: Implement the FacefusionClient class. Method signatures and docstrings: - def DescribeMaterialList(self, request): 通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for De...
Implement the Python class `FacefusionClient` described below. Class description: Implement the FacefusionClient class. Method signatures and docstrings: - def DescribeMaterialList(self, request): 通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for De...
6baf00a5a56ba58b6a1123423e0a1422d17a0201
<|skeleton|> class FacefusionClient: def DescribeMaterialList(self, request): """通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for DescribeMaterialList. :type request: :class:`tencentcloud.facefusion.v20181201.models.DescribeMaterialListR...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FacefusionClient: def DescribeMaterialList(self, request): """通常通过腾讯云人脸融合的控制台可以查看到素材相关的参数数据,可以满足使用。本接口返回活动的素材数据,包括素材状态等。用于用户通过Api查看素材相关数据,方便使用。 :param request: Request instance for DescribeMaterialList. :type request: :class:`tencentcloud.facefusion.v20181201.models.DescribeMaterialListRequest` :rtype...
the_stack_v2_python_sparse
tencentcloud/facefusion/v20181201/facefusion_client.py
TencentCloud/tencentcloud-sdk-python
train
594
f6c57e30a470dbffce4d734f9d22a6ac9e7a5305
[ "self.kids = [{}]\nself.root = 0\nself.vocabular = set([])", "flag = key in self.vocabular\ncurr = self.root\nself.vocabular.add(key)\nif flag:\n for ch in key:\n index = self.kids[curr][ch][1]\n self.kids[curr][ch] = [val, index]\n curr = index\nelse:\n curr = self.root\n for ch in ...
<|body_start_0|> self.kids = [{}] self.root = 0 self.vocabular = set([]) <|end_body_0|> <|body_start_1|> flag = key in self.vocabular curr = self.root self.vocabular.add(key) if flag: for ch in key: index = self.kids[curr][ch][1] ...
MapSum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapSum: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, key, val): """:type key: str :type val: int :rtype: void""" <|body_1|> def sum(self, prefix): """:type prefix: str :rtype: int""" <|body_2|...
stack_v2_sparse_classes_36k_train_002279
1,449
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": ":type key: str :type val: int :rtype: void", "name": "insert", "signature": "def insert(self, key, val)" }, { "docstring": ":type prefix: str :rtype: in...
3
stack_v2_sparse_classes_30k_train_006197
Implement the Python class `MapSum` described below. Class description: Implement the MapSum class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, key, val): :type key: str :type val: int :rtype: void - def sum(self, prefix): :type prefix: str :rtype: i...
Implement the Python class `MapSum` described below. Class description: Implement the MapSum class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def insert(self, key, val): :type key: str :type val: int :rtype: void - def sum(self, prefix): :type prefix: str :rtype: i...
c1b083733543e05b9f1e86ddcea1b4c6d0330aaa
<|skeleton|> class MapSum: def __init__(self): """Initialize your data structure here.""" <|body_0|> def insert(self, key, val): """:type key: str :type val: int :rtype: void""" <|body_1|> def sum(self, prefix): """:type prefix: str :rtype: int""" <|body_2|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MapSum: def __init__(self): """Initialize your data structure here.""" self.kids = [{}] self.root = 0 self.vocabular = set([]) def insert(self, key, val): """:type key: str :type val: int :rtype: void""" flag = key in self.vocabular curr = self.root...
the_stack_v2_python_sparse
solved/P677.py
lgdxiaobobo/Leetcoce
train
0
1df2328a215302f59c356ab06afdfaaa82f1d6fb
[ "super(PhasePlanePointwiseObjective, self).__init__(reference, **kwargs)\nself.thresh = dvdt_thresholds\nif self.thresh[0] < 0.0 or self.thresh[1] > 0.0:\n raise Exception('Start threshold must be above 0 and end threshold must be below 0 (found {})'.format(self.thresh))\nself.num_points = num_points\nself.no_sp...
<|body_start_0|> super(PhasePlanePointwiseObjective, self).__init__(reference, **kwargs) self.thresh = dvdt_thresholds if self.thresh[0] < 0.0 or self.thresh[1] > 0.0: raise Exception('Start threshold must be above 0 and end threshold must be below 0 (found {})'.format(self.thresh)) ...
PhasePlanePointwiseObjective
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhasePlanePointwiseObjective: def __init__(self, reference, num_points=100, dvdt_thresholds=(10, -10), no_spike_reference=(-100, 0.0), **kwargs): """Creates a phase plane histogram from the reference traces and compares that with the histograms from the simulated traces `reference` -- tr...
stack_v2_sparse_classes_36k_train_002280
18,902
no_license
[ { "docstring": "Creates a phase plane histogram from the reference traces and compares that with the histograms from the simulated traces `reference` -- traces (in Neo format) that are to be compared against [list(neo.AnalogSignal)] `num_points` -- the number of sample points to interpolate between the loop sta...
2
stack_v2_sparse_classes_30k_train_006198
Implement the Python class `PhasePlanePointwiseObjective` described below. Class description: Implement the PhasePlanePointwiseObjective class. Method signatures and docstrings: - def __init__(self, reference, num_points=100, dvdt_thresholds=(10, -10), no_spike_reference=(-100, 0.0), **kwargs): Creates a phase plane ...
Implement the Python class `PhasePlanePointwiseObjective` described below. Class description: Implement the PhasePlanePointwiseObjective class. Method signatures and docstrings: - def __init__(self, reference, num_points=100, dvdt_thresholds=(10, -10), no_spike_reference=(-100, 0.0), **kwargs): Creates a phase plane ...
30974ebe83da6c55f382312cf588a0d714c23f0c
<|skeleton|> class PhasePlanePointwiseObjective: def __init__(self, reference, num_points=100, dvdt_thresholds=(10, -10), no_spike_reference=(-100, 0.0), **kwargs): """Creates a phase plane histogram from the reference traces and compares that with the histograms from the simulated traces `reference` -- tr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhasePlanePointwiseObjective: def __init__(self, reference, num_points=100, dvdt_thresholds=(10, -10), no_spike_reference=(-100, 0.0), **kwargs): """Creates a phase plane histogram from the reference traces and compares that with the histograms from the simulated traces `reference` -- traces (in Neo f...
the_stack_v2_python_sparse
neurotune/objective/phase_plane.py
tclose/neurotune
train
0
8fb161cc5cfd4c736d4e3f4c3a0fc683e2e4508c
[ "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....
DecodeBlock class creates decoder layer
DecoderBlock
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DecoderBlock: """DecodeBlock class creates decoder layer""" def __init__(self, dm, h, hidden, drop_rate=0.1) -> None: """Initializer Arguments: dm {int} -- The output dimensionality h {int} -- The number of head hidden {int} -- The hidden units Keyword Arguments: drop_rate {float} --...
stack_v2_sparse_classes_36k_train_002281
2,545
no_license
[ { "docstring": "Initializer Arguments: dm {int} -- The output dimensionality h {int} -- The number of head hidden {int} -- The hidden units Keyword Arguments: drop_rate {float} -- Drop rate (default: {0.1})", "name": "__init__", "signature": "def __init__(self, dm, h, hidden, drop_rate=0.1) -> None" }...
2
stack_v2_sparse_classes_30k_train_003370
Implement the Python class `DecoderBlock` described below. Class description: DecodeBlock class creates decoder layer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1) -> None: Initializer Arguments: dm {int} -- The output dimensionality h {int} -- The number of head hidden {int} --...
Implement the Python class `DecoderBlock` described below. Class description: DecodeBlock class creates decoder layer Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1) -> None: Initializer Arguments: dm {int} -- The output dimensionality h {int} -- The number of head hidden {int} --...
2ddae38cc25d914488451b8c30e1234f1fa55ebe
<|skeleton|> class DecoderBlock: """DecodeBlock class creates decoder layer""" def __init__(self, dm, h, hidden, drop_rate=0.1) -> None: """Initializer Arguments: dm {int} -- The output dimensionality h {int} -- The number of head hidden {int} -- The hidden units Keyword Arguments: drop_rate {float} --...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DecoderBlock: """DecodeBlock class creates decoder layer""" def __init__(self, dm, h, hidden, drop_rate=0.1) -> None: """Initializer Arguments: dm {int} -- The output dimensionality h {int} -- The number of head hidden {int} -- The hidden units Keyword Arguments: drop_rate {float} -- Drop rate (d...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/8-transformer_decoder_block.py
KoeusIss/holbertonschool-machine_learning
train
0
7d2b8d639e6d7fbf51942b1287bed7e1f83d59c9
[ "data = {'text': 'test skill'}\nresponse = self.client.post(self.url, data, headers={'Content-Type': 'application/json'})\nself.assertEqual(200, response.status_code)", "self.skill = Skill.objects.create(text='Test')\nresponse = self.client.get(self.url)\nself.assertEqual(len(response.data['results']['data']), Sk...
<|body_start_0|> data = {'text': 'test skill'} response = self.client.post(self.url, data, headers={'Content-Type': 'application/json'}) self.assertEqual(200, response.status_code) <|end_body_0|> <|body_start_1|> self.skill = Skill.objects.create(text='Test') response = self.cli...
Test cases for skill list call
SkillListTestCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SkillListTestCase: """Test cases for skill list call""" def test_add_profession(self): """Test to add a skill""" <|body_0|> def test_profession(self): """Test to verify user created skill""" <|body_1|> <|end_skeleton|> <|body_start_0|> data = {'...
stack_v2_sparse_classes_36k_train_002282
21,995
no_license
[ { "docstring": "Test to add a skill", "name": "test_add_profession", "signature": "def test_add_profession(self)" }, { "docstring": "Test to verify user created skill", "name": "test_profession", "signature": "def test_profession(self)" } ]
2
null
Implement the Python class `SkillListTestCase` described below. Class description: Test cases for skill list call Method signatures and docstrings: - def test_add_profession(self): Test to add a skill - def test_profession(self): Test to verify user created skill
Implement the Python class `SkillListTestCase` described below. Class description: Test cases for skill list call Method signatures and docstrings: - def test_add_profession(self): Test to add a skill - def test_profession(self): Test to verify user created skill <|skeleton|> class SkillListTestCase: """Test cas...
f38ea1ff9283416f4b4b1a9eb134344a566856a4
<|skeleton|> class SkillListTestCase: """Test cases for skill list call""" def test_add_profession(self): """Test to add a skill""" <|body_0|> def test_profession(self): """Test to verify user created skill""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SkillListTestCase: """Test cases for skill list call""" def test_add_profession(self): """Test to add a skill""" data = {'text': 'test skill'} response = self.client.post(self.url, data, headers={'Content-Type': 'application/json'}) self.assertEqual(200, response.status_co...
the_stack_v2_python_sparse
userprofile/tests.py
meanwise-eng/meanwise-server
train
0
5e872aaf50142500d7a3573769ca37b9a7cc7d65
[ "super(ResNetBase, self).__init__()\nself.output_channel_block = [int(output_channel / 4), int(output_channel / 2), output_channel, output_channel]\nself.inplanes = int(output_channel / 8)\nself.conv0_1 = nn.Conv2d(input_channel, int(output_channel / 16), kernel_size=3, stride=1, padding=1, bias=False)\nself.bn0_1 ...
<|body_start_0|> super(ResNetBase, self).__init__() self.output_channel_block = [int(output_channel / 4), int(output_channel / 2), output_channel, output_channel] self.inplanes = int(output_channel / 8) self.conv0_1 = nn.Conv2d(input_channel, int(output_channel / 16), kernel_size=3, stri...
Base share backbone network
ResNetBase
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResNetBase: """Base share backbone network""" def __init__(self, input_channel, output_channel, block, layers): """Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution block layers (list): layers of the block""" <|body_...
stack_v2_sparse_classes_36k_train_002283
11,483
permissive
[ { "docstring": "Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution block layers (list): layers of the block", "name": "__init__", "signature": "def __init__(self, input_channel, output_channel, block, layers)" }, { "docstring": "Args: bl...
3
stack_v2_sparse_classes_30k_train_013478
Implement the Python class `ResNetBase` described below. Class description: Base share backbone network Method signatures and docstrings: - def __init__(self, input_channel, output_channel, block, layers): Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution bl...
Implement the Python class `ResNetBase` described below. Class description: Base share backbone network Method signatures and docstrings: - def __init__(self, input_channel, output_channel, block, layers): Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution bl...
fb47a96d1a38f5ce634c6f12d710ed5300cc89fc
<|skeleton|> class ResNetBase: """Base share backbone network""" def __init__(self, input_channel, output_channel, block, layers): """Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution block layers (list): layers of the block""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResNetBase: """Base share backbone network""" def __init__(self, input_channel, output_channel, block, layers): """Args: input_channel (int): input channel output_channel (int): output channel block (BasicBlock): convolution block layers (list): layers of the block""" super(ResNetBase, se...
the_stack_v2_python_sparse
davarocr/davarocr/davar_rcg/models/backbones/ResNetRFL.py
OCRWorld/DAVAR-Lab-OCR
train
0
8b6eec457c1d52828903130dddc183ebff086d99
[ "try:\n prefix, token = header.split()\nexcept ValueError:\n raise authentication.AuthenticationError('Unable to split prefix and token from Authorization header.')\nif prefix.upper() != 'JWT':\n raise authentication.AuthenticationError(f\"Invalid Authorization header prefix '{prefix}'.\")\nreturn token", ...
<|body_start_0|> try: prefix, token = header.split() except ValueError: raise authentication.AuthenticationError('Unable to split prefix and token from Authorization header.') if prefix.upper() != 'JWT': raise authentication.AuthenticationError(f"Invalid Autho...
Custom Starlette authentication backend for JWT.
JWTAuthenticationBackend
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JWTAuthenticationBackend: """Custom Starlette authentication backend for JWT.""" def get_token_from_header(header: str) -> str: """Parse JWT token from header value.""" <|body_0|> async def authenticate(self, request: Request) -> t.Optional[tuple[authentication.AuthCrede...
stack_v2_sparse_classes_36k_train_002284
1,656
permissive
[ { "docstring": "Parse JWT token from header value.", "name": "get_token_from_header", "signature": "def get_token_from_header(header: str) -> str" }, { "docstring": "Handles JWT authentication process.", "name": "authenticate", "signature": "async def authenticate(self, request: Request)...
2
stack_v2_sparse_classes_30k_train_014349
Implement the Python class `JWTAuthenticationBackend` described below. Class description: Custom Starlette authentication backend for JWT. Method signatures and docstrings: - def get_token_from_header(header: str) -> str: Parse JWT token from header value. - async def authenticate(self, request: Request) -> t.Optiona...
Implement the Python class `JWTAuthenticationBackend` described below. Class description: Custom Starlette authentication backend for JWT. Method signatures and docstrings: - def get_token_from_header(header: str) -> str: Parse JWT token from header value. - async def authenticate(self, request: Request) -> t.Optiona...
1b4b4fe6819352f1f072ce307eee892866a11dcf
<|skeleton|> class JWTAuthenticationBackend: """Custom Starlette authentication backend for JWT.""" def get_token_from_header(header: str) -> str: """Parse JWT token from header value.""" <|body_0|> async def authenticate(self, request: Request) -> t.Optional[tuple[authentication.AuthCrede...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class JWTAuthenticationBackend: """Custom Starlette authentication backend for JWT.""" def get_token_from_header(header: str) -> str: """Parse JWT token from header value.""" try: prefix, token = header.split() except ValueError: raise authentication.Authenticati...
the_stack_v2_python_sparse
backend/authentication/backend.py
MrGrote/forms-backend
train
0
c6cd01d1695b9d40a3c3ec862bfe86e4da2c1339
[ "url = utils.urljoin(self.base_path, image_id)\nresp = session.get(url, headers={'Accept': 'application/json'}, endpoint_filter=self.service)\nself.response = resp.json()\nself._translate_response(resp, has_body=True)\nreturn self", "url = utils.urljoin(self.base_path, image_id)\nattrs_list = json.dumps(attrs_lis...
<|body_start_0|> url = utils.urljoin(self.base_path, image_id) resp = session.get(url, headers={'Accept': 'application/json'}, endpoint_filter=self.service) self.response = resp.json() self._translate_response(resp, has_body=True) return self <|end_body_0|> <|body_start_1|> ...
Image
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Image: def get(self, session, image_id): """Get a single image's detailed information.""" <|body_0|> def update(self, session, image_id, attrs_list): """Updates a specified image.""" <|body_1|> def upload(self, session, image_id, image_data): """...
stack_v2_sparse_classes_36k_train_002285
10,107
permissive
[ { "docstring": "Get a single image's detailed information.", "name": "get", "signature": "def get(self, session, image_id)" }, { "docstring": "Updates a specified image.", "name": "update", "signature": "def update(self, session, image_id, attrs_list)" }, { "docstring": "Upload d...
5
null
Implement the Python class `Image` described below. Class description: Implement the Image class. Method signatures and docstrings: - def get(self, session, image_id): Get a single image's detailed information. - def update(self, session, image_id, attrs_list): Updates a specified image. - def upload(self, session, i...
Implement the Python class `Image` described below. Class description: Implement the Image class. Method signatures and docstrings: - def get(self, session, image_id): Get a single image's detailed information. - def update(self, session, image_id, attrs_list): Updates a specified image. - def upload(self, session, i...
c2dafba850c4e6fb55b5e10de79257bbc9a01af3
<|skeleton|> class Image: def get(self, session, image_id): """Get a single image's detailed information.""" <|body_0|> def update(self, session, image_id, attrs_list): """Updates a specified image.""" <|body_1|> def upload(self, session, image_id, image_data): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Image: def get(self, session, image_id): """Get a single image's detailed information.""" url = utils.urljoin(self.base_path, image_id) resp = session.get(url, headers={'Accept': 'application/json'}, endpoint_filter=self.service) self.response = resp.json() self._transl...
the_stack_v2_python_sparse
ecl/image/v2/image.py
nttcom/eclsdk
train
5
40988b73704fa81b343adbcd3a503af945f65206
[ "super(SentimentRNN, self).__init__()\nself.output_size = output_size\nself.n_layers = n_layers\nself.hidden_dim = hidden_dim\nself.embedding = nn.Embedding(vocab_size, embedding_dim)\nself.lstm = nn.LSTM(embedding_dim, hidden_dim, n_layers, dropout=drop_prob, batch_first=True)\nself.dropout = nn.Dropout(0.3)\nself...
<|body_start_0|> super(SentimentRNN, self).__init__() self.output_size = output_size self.n_layers = n_layers self.hidden_dim = hidden_dim self.embedding = nn.Embedding(vocab_size, embedding_dim) self.lstm = nn.LSTM(embedding_dim, hidden_dim, n_layers, dropout=drop_prob, ...
RNN 文本分类
SentimentRNN
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SentimentRNN: """RNN 文本分类""" def __init__(self, vocab_size, output_size, embedding_dim, hidden_dim, n_layers, drop_prob=0.5): """Initialize the model by setting up the layers.""" <|body_0|> def forward(self, x, hidden): """Perform a forward pass of our model on s...
stack_v2_sparse_classes_36k_train_002286
8,138
no_license
[ { "docstring": "Initialize the model by setting up the layers.", "name": "__init__", "signature": "def __init__(self, vocab_size, output_size, embedding_dim, hidden_dim, n_layers, drop_prob=0.5)" }, { "docstring": "Perform a forward pass of our model on some input and hidden state.", "name":...
3
stack_v2_sparse_classes_30k_train_014482
Implement the Python class `SentimentRNN` described below. Class description: RNN 文本分类 Method signatures and docstrings: - def __init__(self, vocab_size, output_size, embedding_dim, hidden_dim, n_layers, drop_prob=0.5): Initialize the model by setting up the layers. - def forward(self, x, hidden): Perform a forward p...
Implement the Python class `SentimentRNN` described below. Class description: RNN 文本分类 Method signatures and docstrings: - def __init__(self, vocab_size, output_size, embedding_dim, hidden_dim, n_layers, drop_prob=0.5): Initialize the model by setting up the layers. - def forward(self, x, hidden): Perform a forward p...
64714414c272149a0f83e9ea846348470d45d33a
<|skeleton|> class SentimentRNN: """RNN 文本分类""" def __init__(self, vocab_size, output_size, embedding_dim, hidden_dim, n_layers, drop_prob=0.5): """Initialize the model by setting up the layers.""" <|body_0|> def forward(self, x, hidden): """Perform a forward pass of our model on s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SentimentRNN: """RNN 文本分类""" def __init__(self, vocab_size, output_size, embedding_dim, hidden_dim, n_layers, drop_prob=0.5): """Initialize the model by setting up the layers.""" super(SentimentRNN, self).__init__() self.output_size = output_size self.n_layers = n_layers ...
the_stack_v2_python_sparse
任务二:基于深度学习(RNN)的文本分类(Pytorch).py
Zhangbingbin11/xiyu-NLPTrainee
train
1
ec55e7e8567fa0615f54ad5159259e02c2c55149
[ "recipe = Recipe.get_by_id(recipe_id=recipe_id)\nif recipe is None:\n return ({'message': 'recipe not found'}, HTTPStatus.NOT_FOUND)\ncurrent_user = get_jwt_identity()\nif current_user != recipe.user_id:\n return ({'message': 'Access is not allowed'}, HTTPStatus.FORBIDDEN)\nrecipe.is_publish = True\nrecipe.sa...
<|body_start_0|> recipe = Recipe.get_by_id(recipe_id=recipe_id) if recipe is None: return ({'message': 'recipe not found'}, HTTPStatus.NOT_FOUND) current_user = get_jwt_identity() if current_user != recipe.user_id: return ({'message': 'Access is not allowed'}, HTT...
RecipePublishResource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecipePublishResource: def put(self, recipe_id): """:param""" <|body_0|> def delete(self, recipe_id): """:param""" <|body_1|> <|end_skeleton|> <|body_start_0|> recipe = Recipe.get_by_id(recipe_id=recipe_id) if recipe is None: ret...
stack_v2_sparse_classes_36k_train_002287
8,070
no_license
[ { "docstring": ":param", "name": "put", "signature": "def put(self, recipe_id)" }, { "docstring": ":param", "name": "delete", "signature": "def delete(self, recipe_id)" } ]
2
stack_v2_sparse_classes_30k_train_000843
Implement the Python class `RecipePublishResource` described below. Class description: Implement the RecipePublishResource class. Method signatures and docstrings: - def put(self, recipe_id): :param - def delete(self, recipe_id): :param
Implement the Python class `RecipePublishResource` described below. Class description: Implement the RecipePublishResource class. Method signatures and docstrings: - def put(self, recipe_id): :param - def delete(self, recipe_id): :param <|skeleton|> class RecipePublishResource: def put(self, recipe_id): ...
875b8bc3cc5315efe8ccee8ce9b312056802c49d
<|skeleton|> class RecipePublishResource: def put(self, recipe_id): """:param""" <|body_0|> def delete(self, recipe_id): """:param""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RecipePublishResource: def put(self, recipe_id): """:param""" recipe = Recipe.get_by_id(recipe_id=recipe_id) if recipe is None: return ({'message': 'recipe not found'}, HTTPStatus.NOT_FOUND) current_user = get_jwt_identity() if current_user != recipe.user_id...
the_stack_v2_python_sparse
resources/recipe.py
ShayanRiyaz/TheDailyCook
train
1
26106f68a025c363d45a752f79cdeef0b771e8ae
[ "self.frequency = _frequency\nself.two_pi_frequency = 2 * pi * _frequency\nself.amplitude = _amplitude\nself.phase = _phase\nself.voltage_offset = voltage_offset\nself.noise_level = noise_level\nself.signal_log = []", "test_sig0 = self.amplitude * sin(_t * self.two_pi_frequency + self.phase) + (random.random() * ...
<|body_start_0|> self.frequency = _frequency self.two_pi_frequency = 2 * pi * _frequency self.amplitude = _amplitude self.phase = _phase self.voltage_offset = voltage_offset self.noise_level = noise_level self.signal_log = [] <|end_body_0|> <|body_start_1|> ...
ComplexSineSignal
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComplexSineSignal: def __init__(self, _amplitude, _frequency, _phase, noise_level=0, voltage_offset=0): """The constructor for a sine wave signal. :param _amplitude: the amplitude of the sine wave in volts :param _frequency: the frequency of the sine wave in Hz :param _phase: the phase o...
stack_v2_sparse_classes_36k_train_002288
3,002
no_license
[ { "docstring": "The constructor for a sine wave signal. :param _amplitude: the amplitude of the sine wave in volts :param _frequency: the frequency of the sine wave in Hz :param _phase: the phase of the sine wave in radians :param noise_level: (optional) the absolute noise level of the sine wave (default 0) :pa...
2
stack_v2_sparse_classes_30k_train_012111
Implement the Python class `ComplexSineSignal` described below. Class description: Implement the ComplexSineSignal class. Method signatures and docstrings: - def __init__(self, _amplitude, _frequency, _phase, noise_level=0, voltage_offset=0): The constructor for a sine wave signal. :param _amplitude: the amplitude of...
Implement the Python class `ComplexSineSignal` described below. Class description: Implement the ComplexSineSignal class. Method signatures and docstrings: - def __init__(self, _amplitude, _frequency, _phase, noise_level=0, voltage_offset=0): The constructor for a sine wave signal. :param _amplitude: the amplitude of...
b8061fe79f88c0892b55c2f4488355a8f68cc957
<|skeleton|> class ComplexSineSignal: def __init__(self, _amplitude, _frequency, _phase, noise_level=0, voltage_offset=0): """The constructor for a sine wave signal. :param _amplitude: the amplitude of the sine wave in volts :param _frequency: the frequency of the sine wave in Hz :param _phase: the phase o...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ComplexSineSignal: def __init__(self, _amplitude, _frequency, _phase, noise_level=0, voltage_offset=0): """The constructor for a sine wave signal. :param _amplitude: the amplitude of the sine wave in volts :param _frequency: the frequency of the sine wave in Hz :param _phase: the phase of the sine wav...
the_stack_v2_python_sparse
lib/signals/TestSignals.py
kevroy314/PLL-Neural-Network
train
3
0bd72cb09b7ccf50a08c15a23b3d680baab6f444
[ "log = logging.getLogger(__name__)\nif cls.LOCAL is not None:\n log.warn('Warning, %s is already configured. Ignoring new configuration.', str(cls))\nelse:\n log.info('Setting FDataMover.LOCAL (use_local_implementation) to: %s' % settings['bccvl.data_mover.use_local_implementation'])\n cls.LOCAL = asbool(s...
<|body_start_0|> log = logging.getLogger(__name__) if cls.LOCAL is not None: log.warn('Warning, %s is already configured. Ignoring new configuration.', str(cls)) else: log.info('Setting FDataMover.LOCAL (use_local_implementation) to: %s' % settings['bccvl.data_mover.use_l...
FDataMover
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FDataMover: def configure_from_config(cls, settings): """configure the FDataMover (and DataMover) constants""" <|body_0|> def new_data_mover(cls, *args, **kwargs): """Create a data mover""" <|body_1|> def get_data_mover_class(cls, *args, **kwargs): ...
stack_v2_sparse_classes_36k_train_002289
10,537
no_license
[ { "docstring": "configure the FDataMover (and DataMover) constants", "name": "configure_from_config", "signature": "def configure_from_config(cls, settings)" }, { "docstring": "Create a data mover", "name": "new_data_mover", "signature": "def new_data_mover(cls, *args, **kwargs)" }, ...
3
stack_v2_sparse_classes_30k_val_000652
Implement the Python class `FDataMover` described below. Class description: Implement the FDataMover class. Method signatures and docstrings: - def configure_from_config(cls, settings): configure the FDataMover (and DataMover) constants - def new_data_mover(cls, *args, **kwargs): Create a data mover - def get_data_mo...
Implement the Python class `FDataMover` described below. Class description: Implement the FDataMover class. Method signatures and docstrings: - def configure_from_config(cls, settings): configure the FDataMover (and DataMover) constants - def new_data_mover(cls, *args, **kwargs): Create a data mover - def get_data_mo...
ff41e44b5cf10136082a4d7349f1fdb61239f6c5
<|skeleton|> class FDataMover: def configure_from_config(cls, settings): """configure the FDataMover (and DataMover) constants""" <|body_0|> def new_data_mover(cls, *args, **kwargs): """Create a data mover""" <|body_1|> def get_data_mover_class(cls, *args, **kwargs): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FDataMover: def configure_from_config(cls, settings): """configure the FDataMover (and DataMover) constants""" log = logging.getLogger(__name__) if cls.LOCAL is not None: log.warn('Warning, %s is already configured. Ignoring new configuration.', str(cls)) else: ...
the_stack_v2_python_sparse
bccvl_visualiser/models/external_api/data_mover.py
BCCVL/BCCVL_Visualiser
train
1
73fd11624fa8a24d4153683638eed3bf71697318
[ "procurement_date_planned = datetime.strptime(procurement.date_planned, DEFAULT_SERVER_DATETIME_FORMAT)\nseller_delay = int(procurement.product_id.seller_delay)\nschedule_date = procurement_date_planned + relativedelta(days=company.po_lead) + relativedelta(days=seller_delay)\nreturn schedule_date", "procurement_d...
<|body_start_0|> procurement_date_planned = datetime.strptime(procurement.date_planned, DEFAULT_SERVER_DATETIME_FORMAT) seller_delay = int(procurement.product_id.seller_delay) schedule_date = procurement_date_planned + relativedelta(days=company.po_lead) + relativedelta(days=seller_delay) ...
procurement_order
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class procurement_order: def _get_purchase_schedule_date(self, cr, uid, procurement, company, context=None): """Return the datetime value to use as Schedule Date (``date_planned``) for the Purchase Order Lines created to satisfy the given procurement. :param browse_record procurement: the proc...
stack_v2_sparse_classes_36k_train_002290
2,336
no_license
[ { "docstring": "Return the datetime value to use as Schedule Date (``date_planned``) for the Purchase Order Lines created to satisfy the given procurement. :param browse_record procurement: the procurement for which a PO will be created. :param browse_report company: the company to which the new PO will belong ...
2
stack_v2_sparse_classes_30k_train_019509
Implement the Python class `procurement_order` described below. Class description: Implement the procurement_order class. Method signatures and docstrings: - def _get_purchase_schedule_date(self, cr, uid, procurement, company, context=None): Return the datetime value to use as Schedule Date (``date_planned``) for the...
Implement the Python class `procurement_order` described below. Class description: Implement the procurement_order class. Method signatures and docstrings: - def _get_purchase_schedule_date(self, cr, uid, procurement, company, context=None): Return the datetime value to use as Schedule Date (``date_planned``) for the...
faa4d22da620331b55c949dcb773ec2d2d19dab7
<|skeleton|> class procurement_order: def _get_purchase_schedule_date(self, cr, uid, procurement, company, context=None): """Return the datetime value to use as Schedule Date (``date_planned``) for the Purchase Order Lines created to satisfy the given procurement. :param browse_record procurement: the proc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class procurement_order: def _get_purchase_schedule_date(self, cr, uid, procurement, company, context=None): """Return the datetime value to use as Schedule Date (``date_planned``) for the Purchase Order Lines created to satisfy the given procurement. :param browse_record procurement: the procurement for wh...
the_stack_v2_python_sparse
purchase_osv.py
hjainavi/panipat_handloom
train
0
1e56fd0ad8e80953ff4f7bafbbe7ba6eecc4f9e7
[ "from gringotts.services import cinder\nfrom gringotts.services import neutron\nfrom gringotts.services import nova\nfrom gringotts.services import trove\nproject_id = acl.get_limited_to_project(request.headers, 'quota_update')\nif project_id:\n raise exception.NotAuthorized\nif data.project_id == wtypes.Unset o...
<|body_start_0|> from gringotts.services import cinder from gringotts.services import neutron from gringotts.services import nova from gringotts.services import trove project_id = acl.get_limited_to_project(request.headers, 'quota_update') if project_id: raise...
Operations on resources.
QuotasController
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QuotasController: """Operations on resources.""" def put(self, data): """Get all resources of specified project_id in all regions.""" <|body_0|> def get(self, project_id=None, user_id=None, region_name=None): """Get quota of specified project in specified region....
stack_v2_sparse_classes_36k_train_002291
6,777
no_license
[ { "docstring": "Get all resources of specified project_id in all regions.", "name": "put", "signature": "def put(self, data)" }, { "docstring": "Get quota of specified project in specified region.", "name": "get", "signature": "def get(self, project_id=None, user_id=None, region_name=Non...
2
stack_v2_sparse_classes_30k_val_000326
Implement the Python class `QuotasController` described below. Class description: Operations on resources. Method signatures and docstrings: - def put(self, data): Get all resources of specified project_id in all regions. - def get(self, project_id=None, user_id=None, region_name=None): Get quota of specified project...
Implement the Python class `QuotasController` described below. Class description: Operations on resources. Method signatures and docstrings: - def put(self, data): Get all resources of specified project_id in all regions. - def get(self, project_id=None, user_id=None, region_name=None): Get quota of specified project...
75f656398c11b0dbddf99bf429994624915c3565
<|skeleton|> class QuotasController: """Operations on resources.""" def put(self, data): """Get all resources of specified project_id in all regions.""" <|body_0|> def get(self, project_id=None, user_id=None, region_name=None): """Get quota of specified project in specified region....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QuotasController: """Operations on resources.""" def put(self, data): """Get all resources of specified project_id in all regions.""" from gringotts.services import cinder from gringotts.services import neutron from gringotts.services import nova from gringotts.ser...
the_stack_v2_python_sparse
gringotts/api/v2/quotas.py
rogeroger-yu/ustack-gringotts
train
1
c57f1160fb160f8e68a0ec2500ffeb2c7f442ab7
[ "n = len(nums1)\nm = len(nums2)\ni = -1\nj = 0\nans = []\nwhile k:\n ch = []\n if 0 <= i + 1 < n and 0 <= j < m:\n ch.append((nums1[i + 1] + nums2[j], i + 1, 0, nums1[i + 1], nums2[j]))\n if 0 <= j + 1 < m and 0 <= i < n:\n ch.append((nums1[i] + nums2[j + 1], 0, j + 1, nums1[i], nums2[j + 1])...
<|body_start_0|> n = len(nums1) m = len(nums2) i = -1 j = 0 ans = [] while k: ch = [] if 0 <= i + 1 < n and 0 <= j < m: ch.append((nums1[i + 1] + nums2[j], i + 1, 0, nums1[i + 1], nums2[j])) if 0 <= j + 1 < m and 0 <= i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kSmallestPairsWA(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]""" <|body_0|> def kSmallestPairs(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype:...
stack_v2_sparse_classes_36k_train_002292
2,425
no_license
[ { "docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]", "name": "kSmallestPairsWA", "signature": "def kSmallestPairsWA(self, nums1, nums2, k)" }, { "docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]", ...
2
stack_v2_sparse_classes_30k_train_003596
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kSmallestPairsWA(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]] - def kSmallestPairs(self, nums1, nums2, k): :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kSmallestPairsWA(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]] - def kSmallestPairs(self, nums1, nums2, k): :type...
02ebe56cd92b9f4baeee132c5077892590018650
<|skeleton|> class Solution: def kSmallestPairsWA(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]""" <|body_0|> def kSmallestPairs(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def kSmallestPairsWA(self, nums1, nums2, k): """:type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[List[int]]""" n = len(nums1) m = len(nums2) i = -1 j = 0 ans = [] while k: ch = [] if 0 <= i + 1 < n...
the_stack_v2_python_sparse
python/leetcode.373.py
CalvinNeo/LeetCode
train
3
60388b49b2e571ce8a13b0974a1ed0b213ade031
[ "EPS = 1e-05\npoints = set(map(tuple, points))\nret = float('inf')\nfor p1, p2, p3 in itertools.permutations(points, 3):\n p4 = (p2[0] + p3[0] - p1[0], p2[1] + p3[1] - p1[1])\n if p4 in points:\n v31 = complex(p3[0] - p1[0], p3[1] - p1[1])\n v21 = complex(p2[0] - p1[0], p2[1] - p1[1])\n i...
<|body_start_0|> EPS = 1e-05 points = set(map(tuple, points)) ret = float('inf') for p1, p2, p3 in itertools.permutations(points, 3): p4 = (p2[0] + p3[0] - p1[0], p2[1] + p3[1] - p1[1]) if p4 in points: v31 = complex(p3[0] - p1[0], p3[1] - p1[1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minAreaFreeRect1(self, points): """:type points: List[List[int]] :rtype: float""" <|body_0|> def minAreaFreeRect2(self, points): """:type points: List[List[int]] :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> EPS = 1e-05...
stack_v2_sparse_classes_36k_train_002293
2,530
no_license
[ { "docstring": ":type points: List[List[int]] :rtype: float", "name": "minAreaFreeRect1", "signature": "def minAreaFreeRect1(self, points)" }, { "docstring": ":type points: List[List[int]] :rtype: float", "name": "minAreaFreeRect2", "signature": "def minAreaFreeRect2(self, points)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAreaFreeRect1(self, points): :type points: List[List[int]] :rtype: float - def minAreaFreeRect2(self, points): :type points: List[List[int]] :rtype: float
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minAreaFreeRect1(self, points): :type points: List[List[int]] :rtype: float - def minAreaFreeRect2(self, points): :type points: List[List[int]] :rtype: float <|skeleton|> cl...
d3e8669f932fc2e22711e8b7590d3365d020e189
<|skeleton|> class Solution: def minAreaFreeRect1(self, points): """:type points: List[List[int]] :rtype: float""" <|body_0|> def minAreaFreeRect2(self, points): """:type points: List[List[int]] :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minAreaFreeRect1(self, points): """:type points: List[List[int]] :rtype: float""" EPS = 1e-05 points = set(map(tuple, points)) ret = float('inf') for p1, p2, p3 in itertools.permutations(points, 3): p4 = (p2[0] + p3[0] - p1[0], p2[1] + p3[1] - ...
the_stack_v2_python_sparse
leetcode/963.py
liuweilin17/algorithm
train
3
6fd893bd164680229de1f5cf40a2fd1de24361db
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Set of methods to view possible host configurations.
HostTypeServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HostTypeServiceServicer: """Set of methods to view possible host configurations.""" def Get(self, request, context): """Returns information about specified host type.""" <|body_0|> def List(self, request, context): """List avaliable host types.""" <|body_...
stack_v2_sparse_classes_36k_train_002294
4,759
permissive
[ { "docstring": "Returns information about specified host type.", "name": "Get", "signature": "def Get(self, request, context)" }, { "docstring": "List avaliable host types.", "name": "List", "signature": "def List(self, request, context)" } ]
2
null
Implement the Python class `HostTypeServiceServicer` described below. Class description: Set of methods to view possible host configurations. Method signatures and docstrings: - def Get(self, request, context): Returns information about specified host type. - def List(self, request, context): List avaliable host type...
Implement the Python class `HostTypeServiceServicer` described below. Class description: Set of methods to view possible host configurations. Method signatures and docstrings: - def Get(self, request, context): Returns information about specified host type. - def List(self, request, context): List avaliable host type...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class HostTypeServiceServicer: """Set of methods to view possible host configurations.""" def Get(self, request, context): """Returns information about specified host type.""" <|body_0|> def List(self, request, context): """List avaliable host types.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HostTypeServiceServicer: """Set of methods to view possible host configurations.""" def Get(self, request, context): """Returns information about specified host type.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise No...
the_stack_v2_python_sparse
yandex/cloud/compute/v1/host_type_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
6eb0e3c82c02edc76a91e724b1389aff8f84f610
[ "title = request.data.get('title', '')\nplugin = request.data.get('plugin', '')\ncondition = unquote(request.data.get('condition', ''))\nplan = request.data.get('plan', 0)\nids = request.data.get('ids', '')\nisupdate = request.data.get('isupdate', '0')\nconn = mongo.MongoConn()\nif plugin:\n targets = []\n fo...
<|body_start_0|> title = request.data.get('title', '') plugin = request.data.get('plugin', '') condition = unquote(request.data.get('condition', '')) plan = request.data.get('plan', 0) ids = request.data.get('ids', '') isupdate = request.data.get('isupdate', '0') ...
任务
TaskView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TaskView: """任务""" def post(self, request): """添加任务""" <|body_0|> def delete(self, request, id=None): """删除任务""" <|body_1|> <|end_skeleton|> <|body_start_0|> title = request.data.get('title', '') plugin = request.data.get('plugin', '') ...
stack_v2_sparse_classes_36k_train_002295
9,175
no_license
[ { "docstring": "添加任务", "name": "post", "signature": "def post(self, request)" }, { "docstring": "删除任务", "name": "delete", "signature": "def delete(self, request, id=None)" } ]
2
null
Implement the Python class `TaskView` described below. Class description: 任务 Method signatures and docstrings: - def post(self, request): 添加任务 - def delete(self, request, id=None): 删除任务
Implement the Python class `TaskView` described below. Class description: 任务 Method signatures and docstrings: - def post(self, request): 添加任务 - def delete(self, request, id=None): 删除任务 <|skeleton|> class TaskView: """任务""" def post(self, request): """添加任务""" <|body_0|> def delete(self,...
d6e025d7e9d9e3aecfd399c77f376130edd8a2df
<|skeleton|> class TaskView: """任务""" def post(self, request): """添加任务""" <|body_0|> def delete(self, request, id=None): """删除任务""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TaskView: """任务""" def post(self, request): """添加任务""" title = request.data.get('title', '') plugin = request.data.get('plugin', '') condition = unquote(request.data.get('condition', '')) plan = request.data.get('plan', 0) ids = request.data.get('ids', '') ...
the_stack_v2_python_sparse
soc_scan/views/task.py
sundw2015/841
train
4
711f0cc9120543dc7376a6280a2342f95e5c4de4
[ "from .transformer import Transformer\nfrom .reactor import Reactor\nfrom .macro import Macro, Path\nfrom .unilink import UniLink\nmanager = self._get_manager()\nif isinstance(target, UniLink):\n target = target.get_linked()\ntarget_subpath = None\nif isinstance(target, Inchannel):\n target_subpath = target.s...
<|body_start_0|> from .transformer import Transformer from .reactor import Reactor from .macro import Macro, Path from .unilink import UniLink manager = self._get_manager() if isinstance(target, UniLink): target = target.get_linked() target_subpath = N...
Connects the output of workers (transformers and reactors) to cells outputpin.connect(cell) connects an outputpin to a cell outputpin.cell() returns or creates a cell that is connected to the outputpin
OutputPin
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutputPin: """Connects the output of workers (transformers and reactors) to cells outputpin.connect(cell) connects an outputpin to a cell outputpin.cell() returns or creates a cell that is connected to the outputpin""" def connect(self, target): """connects the pin to a target""" ...
stack_v2_sparse_classes_36k_train_002296
10,150
permissive
[ { "docstring": "connects the pin to a target", "name": "connect", "signature": "def connect(self, target)" }, { "docstring": "returns or creates a cell that is connected to the pin", "name": "cell", "signature": "def cell(self, celltype=None)" }, { "docstring": "Returns all cell/...
3
stack_v2_sparse_classes_30k_train_014456
Implement the Python class `OutputPin` described below. Class description: Connects the output of workers (transformers and reactors) to cells outputpin.connect(cell) connects an outputpin to a cell outputpin.cell() returns or creates a cell that is connected to the outputpin Method signatures and docstrings: - def c...
Implement the Python class `OutputPin` described below. Class description: Connects the output of workers (transformers and reactors) to cells outputpin.connect(cell) connects an outputpin to a cell outputpin.cell() returns or creates a cell that is connected to the outputpin Method signatures and docstrings: - def c...
04802149d738c790f0ba8fc9e5188ea2a45ddb7d
<|skeleton|> class OutputPin: """Connects the output of workers (transformers and reactors) to cells outputpin.connect(cell) connects an outputpin to a cell outputpin.cell() returns or creates a cell that is connected to the outputpin""" def connect(self, target): """connects the pin to a target""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OutputPin: """Connects the output of workers (transformers and reactors) to cells outputpin.connect(cell) connects an outputpin to a cell outputpin.cell() returns or creates a cell that is connected to the outputpin""" def connect(self, target): """connects the pin to a target""" from .tr...
the_stack_v2_python_sparse
seamless/core/worker.py
sjdv1982/seamless
train
33
39e879cfa2b015b70198567b635042493ba6683a
[ "super(OmpdFrameDecorator, self).__init__(fobj)\nself.addr_space = ompd.addr_space\nself.fobj = None\nif isinstance(fobj, gdb.Frame):\n self.fobj = fobj\nelif isinstance(fobj, FrameDecorator):\n self.fobj = fobj.inferior_frame()\nself.curr_task_handle = curr_task_handle", "name = str(self.fobj.name())\nif s...
<|body_start_0|> super(OmpdFrameDecorator, self).__init__(fobj) self.addr_space = ompd.addr_space self.fobj = None if isinstance(fobj, gdb.Frame): self.fobj = fobj elif isinstance(fobj, FrameDecorator): self.fobj = fobj.inferior_frame() self.curr_t...
OmpdFrameDecorator
[ "MIT", "Apache-2.0", "LLVM-exception", "NCSA", "LicenseRef-scancode-arm-llvm-sga", "LicenseRef-scancode-generic-cla" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OmpdFrameDecorator: def __init__(self, fobj, curr_task_handle): """Initializes a FrameDecorator with the given GDB Frame object. The global OMPD address space defined in ompd.py is set as well.""" <|body_0|> def function(self): """This appends the name of a frame tha...
stack_v2_sparse_classes_36k_train_002297
12,548
permissive
[ { "docstring": "Initializes a FrameDecorator with the given GDB Frame object. The global OMPD address space defined in ompd.py is set as well.", "name": "__init__", "signature": "def __init__(self, fobj, curr_task_handle)" }, { "docstring": "This appends the name of a frame that is printed with ...
2
stack_v2_sparse_classes_30k_train_010481
Implement the Python class `OmpdFrameDecorator` described below. Class description: Implement the OmpdFrameDecorator class. Method signatures and docstrings: - def __init__(self, fobj, curr_task_handle): Initializes a FrameDecorator with the given GDB Frame object. The global OMPD address space defined in ompd.py is ...
Implement the Python class `OmpdFrameDecorator` described below. Class description: Implement the OmpdFrameDecorator class. Method signatures and docstrings: - def __init__(self, fobj, curr_task_handle): Initializes a FrameDecorator with the given GDB Frame object. The global OMPD address space defined in ompd.py is ...
764287f1ad69469cc264bb094e8fcdcfdd0fcdfb
<|skeleton|> class OmpdFrameDecorator: def __init__(self, fobj, curr_task_handle): """Initializes a FrameDecorator with the given GDB Frame object. The global OMPD address space defined in ompd.py is set as well.""" <|body_0|> def function(self): """This appends the name of a frame tha...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OmpdFrameDecorator: def __init__(self, fobj, curr_task_handle): """Initializes a FrameDecorator with the given GDB Frame object. The global OMPD address space defined in ompd.py is set as well.""" super(OmpdFrameDecorator, self).__init__(fobj) self.addr_space = ompd.addr_space ...
the_stack_v2_python_sparse
openmp/libompd/gdb-plugin/ompd/frame_filter.py
smeenai/llvm-project
train
0
181ddc7bada60c0c8c06021fe5a33d210d56d929
[ "self.curl = pycurl.Curl()\nfull_url = url if params is None else '%s?%s' % (url, urllib.parse.urlencode(params))\nself.curl.setopt(pycurl.URL, str(full_url))\nif bind is not None:\n self.curl.setopt(pycurl.INTERFACE, str(bind))\nself.curl.setopt(pycurl.FOLLOWLOCATION, allow_redirects)\nif headers is not None:\n...
<|body_start_0|> self.curl = pycurl.Curl() full_url = url if params is None else '%s?%s' % (url, urllib.parse.urlencode(params)) self.curl.setopt(pycurl.URL, str(full_url)) if bind is not None: self.curl.setopt(pycurl.INTERFACE, str(bind)) self.curl.setopt(pycurl.FOLL...
PycURLRunner
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PycURLRunner: def __init__(self, url, params, bind, timeout, allow_redirects, headers, verify_keys): """Constructor""" <|body_0|> def __call__(self, json, throw): """Fetch the URL""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.curl = pycurl.Cu...
stack_v2_sparse_classes_36k_train_002298
7,458
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, url, params, bind, timeout, allow_redirects, headers, verify_keys)" }, { "docstring": "Fetch the URL", "name": "__call__", "signature": "def __call__(self, json, throw)" } ]
2
stack_v2_sparse_classes_30k_test_000684
Implement the Python class `PycURLRunner` described below. Class description: Implement the PycURLRunner class. Method signatures and docstrings: - def __init__(self, url, params, bind, timeout, allow_redirects, headers, verify_keys): Constructor - def __call__(self, json, throw): Fetch the URL
Implement the Python class `PycURLRunner` described below. Class description: Implement the PycURLRunner class. Method signatures and docstrings: - def __init__(self, url, params, bind, timeout, allow_redirects, headers, verify_keys): Constructor - def __call__(self, json, throw): Fetch the URL <|skeleton|> class Py...
f6d04c0455e5be4d490df16ec1acb377f9025d9f
<|skeleton|> class PycURLRunner: def __init__(self, url, params, bind, timeout, allow_redirects, headers, verify_keys): """Constructor""" <|body_0|> def __call__(self, json, throw): """Fetch the URL""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PycURLRunner: def __init__(self, url, params, bind, timeout, allow_redirects, headers, verify_keys): """Constructor""" self.curl = pycurl.Curl() full_url = url if params is None else '%s?%s' % (url, urllib.parse.urlencode(params)) self.curl.setopt(pycurl.URL, str(full_url)) ...
the_stack_v2_python_sparse
python-pscheduler/pscheduler/pscheduler/psurl.py
perfsonar/pscheduler
train
53
8651b6bd2cbd75d9aba12ad4cab767cf2202e9af
[ "stakeholder_categories = set()\nfor stakeholder_category in self.stakeholdercategory_set.all():\n stakeholder_categories.add(stakeholder_category)\nreturn stakeholder_categories", "implementations = set()\nfor uic in self.userincasestudy_set.all():\n for implementation in uic.implementation_set.all():\n ...
<|body_start_0|> stakeholder_categories = set() for stakeholder_category in self.stakeholdercategory_set.all(): stakeholder_categories.add(stakeholder_category) return stakeholder_categories <|end_body_0|> <|body_start_1|> implementations = set() for uic in self.user...
CaseStudy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CaseStudy: def stakeholder_categories(self): """look for all stakeholder categories created by the users of the casestudy""" <|body_0|> def implementations(self): """look for all stakeholder categories created by the users of the casestudy""" <|body_1|> <|en...
stack_v2_sparse_classes_36k_train_002299
3,398
no_license
[ { "docstring": "look for all stakeholder categories created by the users of the casestudy", "name": "stakeholder_categories", "signature": "def stakeholder_categories(self)" }, { "docstring": "look for all stakeholder categories created by the users of the casestudy", "name": "implementation...
2
null
Implement the Python class `CaseStudy` described below. Class description: Implement the CaseStudy class. Method signatures and docstrings: - def stakeholder_categories(self): look for all stakeholder categories created by the users of the casestudy - def implementations(self): look for all stakeholder categories cre...
Implement the Python class `CaseStudy` described below. Class description: Implement the CaseStudy class. Method signatures and docstrings: - def stakeholder_categories(self): look for all stakeholder categories created by the users of the casestudy - def implementations(self): look for all stakeholder categories cre...
a5ba34f085f0d5af5ea3ded24706ea54ab39e7cb
<|skeleton|> class CaseStudy: def stakeholder_categories(self): """look for all stakeholder categories created by the users of the casestudy""" <|body_0|> def implementations(self): """look for all stakeholder categories created by the users of the casestudy""" <|body_1|> <|en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CaseStudy: def stakeholder_categories(self): """look for all stakeholder categories created by the users of the casestudy""" stakeholder_categories = set() for stakeholder_category in self.stakeholdercategory_set.all(): stakeholder_categories.add(stakeholder_category) ...
the_stack_v2_python_sparse
repair/apps/login/models/users.py
MaxBo/REPAiR-Web
train
9