blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
b62173335183be65b5f41cc1779a5b84b3e2cbfb
[ "super(IQN, self).__init__()\nobs_shape, action_shape = (squeeze(obs_shape), squeeze(action_shape))\nif head_hidden_size is None:\n head_hidden_size = encoder_hidden_size_list[-1]\nif isinstance(obs_shape, int) or len(obs_shape) == 1:\n self.encoder = FCEncoder(obs_shape, encoder_hidden_size_list, activation=...
<|body_start_0|> super(IQN, self).__init__() obs_shape, action_shape = (squeeze(obs_shape), squeeze(action_shape)) if head_hidden_size is None: head_hidden_size = encoder_hidden_size_list[-1] if isinstance(obs_shape, int) or len(obs_shape) == 1: self.encoder = FCE...
IQN
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IQN: def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], head_hidden_size: Optional[int]=None, head_layer_num: int=1, num_quantiles: int=32, quantile_embedding_size: int=128, activation: Optional[n...
stack_v2_sparse_classes_10k_train_000700
30,380
permissive
[ { "docstring": "Overview: Init the IQN Model according to input arguments. Arguments: - obs_shape (:obj:`Union[int, SequenceType]`): Observation space shape. - action_shape (:obj:`Union[int, SequenceType]`): Action space shape. - encoder_hidden_size_list (:obj:`SequenceType`): Collection of ``hidden_size`` to p...
2
null
Implement the Python class `IQN` described below. Class description: Implement the IQN class. Method signatures and docstrings: - def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], head_hidden_size: Optional[int]=None,...
Implement the Python class `IQN` described below. Class description: Implement the IQN class. Method signatures and docstrings: - def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], head_hidden_size: Optional[int]=None,...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class IQN: def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], head_hidden_size: Optional[int]=None, head_layer_num: int=1, num_quantiles: int=32, quantile_embedding_size: int=128, activation: Optional[n...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IQN: def __init__(self, obs_shape: Union[int, SequenceType], action_shape: Union[int, SequenceType], encoder_hidden_size_list: SequenceType=[128, 128, 64], head_hidden_size: Optional[int]=None, head_layer_num: int=1, num_quantiles: int=32, quantile_embedding_size: int=128, activation: Optional[nn.Module]=nn.R...
the_stack_v2_python_sparse
ding/model/template/q_learning.py
shengxuesun/DI-engine
train
1
d43b7ebba3c8d859469b2168efecb696a855bdf9
[ "if not prices:\n return 0\nn = len(prices)\ndp, min_buy_stock_value = ([0] * n, prices[0])\nfor i in range(1, n):\n min_buy_stock_value = min(prices[i], min_buy_stock_value)\n dp[i] = max(prices[i] - min_buy_stock_value, dp[i - 1])\nreturn dp[n - 1]", "if not prices:\n return 0\nn, min_buy_stock_valu...
<|body_start_0|> if not prices: return 0 n = len(prices) dp, min_buy_stock_value = ([0] * n, prices[0]) for i in range(1, n): min_buy_stock_value = min(prices[i], min_buy_stock_value) dp[i] = max(prices[i] - min_buy_stock_value, dp[i - 1]) retu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: list) -> int: """动态规划 先找到最小的买入价格,然后和当前价格相减,得出利润,再和之前的利润比较,得出最大利润 dp[i]就表示第i天的利润 dp[i] = max(prices[i] - min_buy_stock_value, dp[i-1])""" <|body_0|> def maxProfit_1(self, prices: list) -> int: """迭代""" <|body_1|> def ...
stack_v2_sparse_classes_10k_train_000701
3,964
no_license
[ { "docstring": "动态规划 先找到最小的买入价格,然后和当前价格相减,得出利润,再和之前的利润比较,得出最大利润 dp[i]就表示第i天的利润 dp[i] = max(prices[i] - min_buy_stock_value, dp[i-1])", "name": "maxProfit", "signature": "def maxProfit(self, prices: list) -> int" }, { "docstring": "迭代", "name": "maxProfit_1", "signature": "def maxProfit_1...
4
stack_v2_sparse_classes_30k_train_006593
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: list) -> int: 动态规划 先找到最小的买入价格,然后和当前价格相减,得出利润,再和之前的利润比较,得出最大利润 dp[i]就表示第i天的利润 dp[i] = max(prices[i] - min_buy_stock_value, dp[i-1]) - def maxProfit_1(s...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: list) -> int: 动态规划 先找到最小的买入价格,然后和当前价格相减,得出利润,再和之前的利润比较,得出最大利润 dp[i]就表示第i天的利润 dp[i] = max(prices[i] - min_buy_stock_value, dp[i-1]) - def maxProfit_1(s...
3508e1ce089131b19603c3206aab4cf43023bb19
<|skeleton|> class Solution: def maxProfit(self, prices: list) -> int: """动态规划 先找到最小的买入价格,然后和当前价格相减,得出利润,再和之前的利润比较,得出最大利润 dp[i]就表示第i天的利润 dp[i] = max(prices[i] - min_buy_stock_value, dp[i-1])""" <|body_0|> def maxProfit_1(self, prices: list) -> int: """迭代""" <|body_1|> def ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: list) -> int: """动态规划 先找到最小的买入价格,然后和当前价格相减,得出利润,再和之前的利润比较,得出最大利润 dp[i]就表示第i天的利润 dp[i] = max(prices[i] - min_buy_stock_value, dp[i-1])""" if not prices: return 0 n = len(prices) dp, min_buy_stock_value = ([0] * n, prices[0]) ...
the_stack_v2_python_sparse
algorithm/leetcode/dp/08-买卖股票的最佳时机.py
lxconfig/UbuntuCode_bak
train
0
1b78c7d9d8a926db4786577ea8ebd650eecd1d3c
[ "super(LandmarkGeneratorMultipleHeatmap, self).__init__(dim, output_size, landmark_indizes, landmark_flip_pairs, data_format, pre_transformation, post_transformation)\nself.output_size_np = list(reversed(self.output_size))\nself.sigma = sigma\nself.scale_factor = scale_factor\nself.normalize_center = normalize_cent...
<|body_start_0|> super(LandmarkGeneratorMultipleHeatmap, self).__init__(dim, output_size, landmark_indizes, landmark_flip_pairs, data_format, pre_transformation, post_transformation) self.output_size_np = list(reversed(self.output_size)) self.sigma = sigma self.scale_factor = scale_facto...
Generates heatmap images with multiple Gaussian peaks
LandmarkGeneratorMultipleHeatmap
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LandmarkGeneratorMultipleHeatmap: """Generates heatmap images with multiple Gaussian peaks""" def __init__(self, dim, output_size, sigma, scale_factor, normalize_center, landmark_indizes=None, landmark_flip_pairs=None, data_format='channels_first', pre_transformation=None, post_transformatio...
stack_v2_sparse_classes_10k_train_000702
16,690
no_license
[ { "docstring": "Initializer :param output_size: output image size :param sigma: Gaussian sigma :param scale_factor: heatmap scale factor, each value of the Gaussian will be multiplied with this value :param normalize_center: if True, the value on the center is set to scale_factor otherwise, the default gaussian...
2
stack_v2_sparse_classes_30k_train_002388
Implement the Python class `LandmarkGeneratorMultipleHeatmap` described below. Class description: Generates heatmap images with multiple Gaussian peaks Method signatures and docstrings: - def __init__(self, dim, output_size, sigma, scale_factor, normalize_center, landmark_indizes=None, landmark_flip_pairs=None, data_...
Implement the Python class `LandmarkGeneratorMultipleHeatmap` described below. Class description: Generates heatmap images with multiple Gaussian peaks Method signatures and docstrings: - def __init__(self, dim, output_size, sigma, scale_factor, normalize_center, landmark_indizes=None, landmark_flip_pairs=None, data_...
ef6cee91264ba1fe6b40d9823a07647b95bcc2c4
<|skeleton|> class LandmarkGeneratorMultipleHeatmap: """Generates heatmap images with multiple Gaussian peaks""" def __init__(self, dim, output_size, sigma, scale_factor, normalize_center, landmark_indizes=None, landmark_flip_pairs=None, data_format='channels_first', pre_transformation=None, post_transformatio...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LandmarkGeneratorMultipleHeatmap: """Generates heatmap images with multiple Gaussian peaks""" def __init__(self, dim, output_size, sigma, scale_factor, normalize_center, landmark_indizes=None, landmark_flip_pairs=None, data_format='channels_first', pre_transformation=None, post_transformation=None): ...
the_stack_v2_python_sparse
generators/landmark_generator.py
XiaoweiXu/MedicalDataAugmentationTool
train
1
9491a39cf700a2c335c03197b903861e6eaca755
[ "head = ListNode(0)\nl3 = head\naddon = 0\nwhile l1 is not None or l2 is not None:\n if l1 is None:\n tmp = l2.val + addon * 1\n elif l2 is None:\n tmp = l1.val + addon * 1\n else:\n tmp = l1.val + l2.val + addon * 1\n addon = 0\n if tmp >= 10:\n l3.val = tmp - 10\n ...
<|body_start_0|> head = ListNode(0) l3 = head addon = 0 while l1 is not None or l2 is not None: if l1 is None: tmp = l2.val + addon * 1 elif l2 is None: tmp = l1.val + addon * 1 else: tmp = l1.val + l2.va...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2) -> ListNode: """最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val报错, 遍历的时候也忽略为空的那个 Q:还有最后可能也有进位 5 + 5 A: 判断都为空的时候再判断进位标志位是否为1,是的话一个节点值为1""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_000703
3,769
no_license
[ { "docstring": "最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val报错, 遍历的时候也忽略为空的那个 Q:还有最后可能也有进位 5 + 5 A: 判断都为空的时候再判断进位标志位是否为1,是的话一个节点值为1", "name": "addTwoNumbers", "signature": "def addTwoNumbers(self, l1, l2) -> ListNod...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2) -> ListNode: 最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def addTwoNumbers(self, l1, l2) -> ListNode: 最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val...
95dddb78bccd169d9d219a473627361fe739ab5e
<|skeleton|> class Solution: def addTwoNumbers(self, l1, l2) -> ListNode: """最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val报错, 遍历的时候也忽略为空的那个 Q:还有最后可能也有进位 5 + 5 A: 判断都为空的时候再判断进位标志位是否为1,是的话一个节点值为1""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def addTwoNumbers(self, l1, l2) -> ListNode: """最直接的方法:遍历两个链表到最后,执行加操作 Q:l1,l2为空之后,继续执行增加一个节点,导致最后多一位0 A:加一个判断,都为空直接结束 Q:其中一个链表对应的数位数多一位 1 8 + 2 A:有一个不为空则继续加,只不过不加为空的那个链表的值,None.val报错, 遍历的时候也忽略为空的那个 Q:还有最后可能也有进位 5 + 5 A: 判断都为空的时候再判断进位标志位是否为1,是的话一个节点值为1""" head = ListNode(0) l...
the_stack_v2_python_sparse
LinkListOperation/addTwoNumbers.py
Philex5/codingPractice
train
0
e1693b454a5a36cbb1ef53743dbad728954c1078
[ "team.trusted = trusted\nteam.save(update_fields=['trusted'])\nreturn Response({'detail': 'Mapping Team set as {}.'.format('trusted' if trusted else 'untrusted')}, status=status.HTTP_200_OK)", "team = self.get_object()\nif team.trusted:\n return Response({'detail': 'Mapping team is already trusted.'}, status=s...
<|body_start_0|> team.trusted = trusted team.save(update_fields=['trusted']) return Response({'detail': 'Mapping Team set as {}.'.format('trusted' if trusted else 'untrusted')}, status=status.HTTP_200_OK) <|end_body_0|> <|body_start_1|> team = self.get_object() if team.trusted: ...
MappingTeamTrustingAPIView
[ "BSD-3-Clause", "BSD-2-Clause", "ISC", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MappingTeamTrustingAPIView: def update_team(self, team, request, trusted): """Update 'checked', 'harmful', 'check_user', 'check_date' fields of the changeset and return a 200 response""" <|body_0|> def set_trusted(self, request, pk): """Set a Mapping Team as trusted....
stack_v2_sparse_classes_10k_train_000704
9,317
permissive
[ { "docstring": "Update 'checked', 'harmful', 'check_user', 'check_date' fields of the changeset and return a 200 response", "name": "update_team", "signature": "def update_team(self, team, request, trusted)" }, { "docstring": "Set a Mapping Team as trusted. You don't need to send data, just make...
3
stack_v2_sparse_classes_30k_train_001405
Implement the Python class `MappingTeamTrustingAPIView` described below. Class description: Implement the MappingTeamTrustingAPIView class. Method signatures and docstrings: - def update_team(self, team, request, trusted): Update 'checked', 'harmful', 'check_user', 'check_date' fields of the changeset and return a 20...
Implement the Python class `MappingTeamTrustingAPIView` described below. Class description: Implement the MappingTeamTrustingAPIView class. Method signatures and docstrings: - def update_team(self, team, request, trusted): Update 'checked', 'harmful', 'check_user', 'check_date' fields of the changeset and return a 20...
603496dce834bf3ecf28cc949da619b837e2873c
<|skeleton|> class MappingTeamTrustingAPIView: def update_team(self, team, request, trusted): """Update 'checked', 'harmful', 'check_user', 'check_date' fields of the changeset and return a 200 response""" <|body_0|> def set_trusted(self, request, pk): """Set a Mapping Team as trusted....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MappingTeamTrustingAPIView: def update_team(self, team, request, trusted): """Update 'checked', 'harmful', 'check_user', 'check_date' fields of the changeset and return a 200 response""" team.trusted = trusted team.save(update_fields=['trusted']) return Response({'detail': 'Map...
the_stack_v2_python_sparse
Backend/osmchadjango/users/views.py
habi/srz-edi
train
1
dd9c6a80e3cdb9dad37839d2c6d98e65e3e248d4
[ "if type(FocalPlaneInfo) == type(None):\n self.FocalPlaneInfo = [{'xpos': 0.0, 'ypos': 0.0, 'Pf': 0, 'Px': 0, 'Py': 0, 'Pc': 0, 'Pn': 0, 'Pa': 0, 'Pb': 0}]\nelse:\n self.FocalPlaneInfo = FocalPlaneInfo\nif type(ReceiverInfo) == type(None):\n self.ReceiverInfo = [{'sigma': 1.0, 'fknee': 1.0, 'SampRate': 100...
<|body_start_0|> if type(FocalPlaneInfo) == type(None): self.FocalPlaneInfo = [{'xpos': 0.0, 'ypos': 0.0, 'Pf': 0, 'Px': 0, 'Py': 0, 'Pc': 0, 'Pn': 0, 'Pa': 0, 'Pb': 0}] else: self.FocalPlaneInfo = FocalPlaneInfo if type(ReceiverInfo) == type(None): self.Recei...
Telescope
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Telescope: def __init__(self, FocalPlaneInfo=None, ReceiverInfo=None, SkyMap=None, Healpix=False): """Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Arguments FocalPlaneInfo -- Information on focal positions of horns and TPoint values ReceiverInfo -- In...
stack_v2_sparse_classes_10k_train_000705
2,432
no_license
[ { "docstring": "Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Arguments FocalPlaneInfo -- Information on focal positions of horns and TPoint values ReceiverInfo -- Information of receiver noise and 1/f characteristics SkyMap -- Fits file containing image to be sampled", "...
2
stack_v2_sparse_classes_30k_train_001511
Implement the Python class `Telescope` described below. Class description: Implement the Telescope class. Method signatures and docstrings: - def __init__(self, FocalPlaneInfo=None, ReceiverInfo=None, SkyMap=None, Healpix=False): Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Argume...
Implement the Python class `Telescope` described below. Class description: Implement the Telescope class. Method signatures and docstrings: - def __init__(self, FocalPlaneInfo=None, ReceiverInfo=None, SkyMap=None, Healpix=False): Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Argume...
ef7caf1b05880a4a2f4c1c12ca439014f82dfe6b
<|skeleton|> class Telescope: def __init__(self, FocalPlaneInfo=None, ReceiverInfo=None, SkyMap=None, Healpix=False): """Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Arguments FocalPlaneInfo -- Information on focal positions of horns and TPoint values ReceiverInfo -- In...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Telescope: def __init__(self, FocalPlaneInfo=None, ReceiverInfo=None, SkyMap=None, Healpix=False): """Simulated Telescope Arguments ObsInfo-- List of user defined observations KeyWord Arguments FocalPlaneInfo -- Information on focal positions of horns and TPoint values ReceiverInfo -- Information of r...
the_stack_v2_python_sparse
SIMTELE/Telescope.py
SharperJBCA/MFI-Pipeline
train
0
81af6202e57d9a4e0d3f5e47c160aeefcf7db447
[ "address = u'local@domain'\nexpected = address.encode(config.charset)\nself.failUnlessEqual(mail.encodeAddress(address, self.charset), expected)", "address = u'Phrase <local@domain>'\nphrase = str(Header(u'Phrase '.encode('utf-8'), self.charset))\nexpected = phrase + '<local@domain>'\nself.failUnlessEqual(mail.en...
<|body_start_0|> address = u'local@domain' expected = address.encode(config.charset) self.failUnlessEqual(mail.encodeAddress(address, self.charset), expected) <|end_body_0|> <|body_start_1|> address = u'Phrase <local@domain>' phrase = str(Header(u'Phrase '.encode('utf-8'), self....
Address encoding tests See http://www.faqs.org/rfcs/rfc2822.html section 3.4. Address Specification. mailbox = name-addr / addr-spec name-addr = [display-name] angle-addr angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
EncodeAddressTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncodeAddressTests: """Address encoding tests See http://www.faqs.org/rfcs/rfc2822.html section 3.4. Address Specification. mailbox = name-addr / addr-spec name-addr = [display-name] angle-addr angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr""" def testSimpleAddress(self): ...
stack_v2_sparse_classes_10k_train_000706
4,366
no_license
[ { "docstring": "util.mail: encode simple address: local@domain", "name": "testSimpleAddress", "signature": "def testSimpleAddress(self)" }, { "docstring": "util.mail: encode address: 'Phrase <local@domain>'", "name": "testComposite", "signature": "def testComposite(self)" }, { "d...
6
null
Implement the Python class `EncodeAddressTests` described below. Class description: Address encoding tests See http://www.faqs.org/rfcs/rfc2822.html section 3.4. Address Specification. mailbox = name-addr / addr-spec name-addr = [display-name] angle-addr angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr M...
Implement the Python class `EncodeAddressTests` described below. Class description: Address encoding tests See http://www.faqs.org/rfcs/rfc2822.html section 3.4. Address Specification. mailbox = name-addr / addr-spec name-addr = [display-name] angle-addr angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr M...
a17b987c5adaa13befb0fd74ac400c8edbe62ef5
<|skeleton|> class EncodeAddressTests: """Address encoding tests See http://www.faqs.org/rfcs/rfc2822.html section 3.4. Address Specification. mailbox = name-addr / addr-spec name-addr = [display-name] angle-addr angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr""" def testSimpleAddress(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EncodeAddressTests: """Address encoding tests See http://www.faqs.org/rfcs/rfc2822.html section 3.4. Address Specification. mailbox = name-addr / addr-spec name-addr = [display-name] angle-addr angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr""" def testSimpleAddress(self): """util.m...
the_stack_v2_python_sparse
moin/lib/python2.4/site-packages/MoinMoin/_tests/test_util_mail.py
imosts/flume
train
0
abba8f84e256d582a94f4ecf3ecd451f8bdadc25
[ "out_x = u_x * scale_x - u_y * scale_y + shift_x\nout_y = u_x * scale_y + u_y * scale_x + shift_y\nreturn (out_x, out_y)", "norm2 = self.get_square_norm(u)\neps = 1e-07\nout = ops.sqrt(norm2 + eps)\nreturn out", "u_r, u_i = get_real_and_imag(u)\nout = u_r ** 2 + u_i ** 2\nreturn out" ]
<|body_start_0|> out_x = u_x * scale_x - u_y * scale_y + shift_x out_y = u_x * scale_y + u_y * scale_x + shift_y return (out_x, out_y) <|end_body_0|> <|body_start_1|> norm2 = self.get_square_norm(u) eps = 1e-07 out = ops.sqrt(norm2 + eps) return out <|end_body_1|...
The implementor class of the Batch Normalization layer for complex numbers. Implements the functionality specific to complex numbers and needed by the 'BatchNorm' class. This includes: getting the norm of complex number, applying scaling and shift to a complex tensor, and updating the running mean and variance, which a...
_BatchNormImpl
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license", "MPL-1.0", "OpenSSL", "LGPL-3.0-only", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause-Open-MPI", "MIT", "MPL-2.0-no-copyleft-exception", "NTP", "BSD-3-Clause", "GPL-1.0-or-later", "0BSD", "MPL-2.0", "LicenseRef-scancode-f...
stack_v2_sparse_python_classes_v1
<|skeleton|> class _BatchNormImpl: """The implementor class of the Batch Normalization layer for complex numbers. Implements the functionality specific to complex numbers and needed by the 'BatchNorm' class. This includes: getting the norm of complex number, applying scaling and shift to a complex tensor, and updat...
stack_v2_sparse_classes_10k_train_000707
7,025
permissive
[ { "docstring": "Applies complex scaling and shift to an input tensor. This function implements the operation as: .. math:: \\\\begin{align} \\\\text{Re(out)} = \\\\text{Re(inp)} * \\\\text{Re(scale)} - \\\\text{Im(inp)} * \\\\text{Im(scale)} + \\\\text{Re(shift)}\\\\\\\\ \\\\text{Im(out)} = \\\\text{Re(inp)} * ...
3
null
Implement the Python class `_BatchNormImpl` described below. Class description: The implementor class of the Batch Normalization layer for complex numbers. Implements the functionality specific to complex numbers and needed by the 'BatchNorm' class. This includes: getting the norm of complex number, applying scaling a...
Implement the Python class `_BatchNormImpl` described below. Class description: The implementor class of the Batch Normalization layer for complex numbers. Implements the functionality specific to complex numbers and needed by the 'BatchNorm' class. This includes: getting the norm of complex number, applying scaling a...
54acb15d435533c815ee1bd9f6dc0b56b4d4cf83
<|skeleton|> class _BatchNormImpl: """The implementor class of the Batch Normalization layer for complex numbers. Implements the functionality specific to complex numbers and needed by the 'BatchNorm' class. This includes: getting the norm of complex number, applying scaling and shift to a complex tensor, and updat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _BatchNormImpl: """The implementor class of the Batch Normalization layer for complex numbers. Implements the functionality specific to complex numbers and needed by the 'BatchNorm' class. This includes: getting the norm of complex number, applying scaling and shift to a complex tensor, and updating the runni...
the_stack_v2_python_sparse
mindspore/python/mindspore/hypercomplex/complex/_complex_bn_impl.py
mindspore-ai/mindspore
train
4,178
6dea838389ac83e4eab6519a632ccd1dff39842f
[ "if this is None:\n return copy.deepcopy(that)\nif that is None:\n return copy.deepcopy(this)\nresult = copy.deepcopy(this)\nresult_key_set = set(result.ids().keys())\nthat_key_set = set(that.ids().keys())\nresult._ids = {x: 1 for x in result_key_set.union(that_key_set)}\nreturn result", "if this is None or...
<|body_start_0|> if this is None: return copy.deepcopy(that) if that is None: return copy.deepcopy(this) result = copy.deepcopy(this) result_key_set = set(result.ids().keys()) that_key_set = set(that.ids().keys()) result._ids = {x: 1 for x in resul...
Set operations for ExactSet. The methods below all accept an ExactMultiSet object and returning an ExactMultiSet object.
ExactSetOperator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExactSetOperator: """Set operations for ExactSet. The methods below all accept an ExactMultiSet object and returning an ExactMultiSet object.""" def union(cls, this, that): """Union operation for ExactSet.""" <|body_0|> def intersection(cls, this, that): """Inter...
stack_v2_sparse_classes_10k_train_000708
19,268
permissive
[ { "docstring": "Union operation for ExactSet.", "name": "union", "signature": "def union(cls, this, that)" }, { "docstring": "Intersection operation for ExactSet.", "name": "intersection", "signature": "def intersection(cls, this, that)" }, { "docstring": "Difference operation fo...
3
stack_v2_sparse_classes_30k_val_000150
Implement the Python class `ExactSetOperator` described below. Class description: Set operations for ExactSet. The methods below all accept an ExactMultiSet object and returning an ExactMultiSet object. Method signatures and docstrings: - def union(cls, this, that): Union operation for ExactSet. - def intersection(cl...
Implement the Python class `ExactSetOperator` described below. Class description: Set operations for ExactSet. The methods below all accept an ExactMultiSet object and returning an ExactMultiSet object. Method signatures and docstrings: - def union(cls, this, that): Union operation for ExactSet. - def intersection(cl...
1727e9545a8f219b543c1b67da6b6653e36d931e
<|skeleton|> class ExactSetOperator: """Set operations for ExactSet. The methods below all accept an ExactMultiSet object and returning an ExactMultiSet object.""" def union(cls, this, that): """Union operation for ExactSet.""" <|body_0|> def intersection(cls, this, that): """Inter...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ExactSetOperator: """Set operations for ExactSet. The methods below all accept an ExactMultiSet object and returning an ExactMultiSet object.""" def union(cls, this, that): """Union operation for ExactSet.""" if this is None: return copy.deepcopy(that) if that is None:...
the_stack_v2_python_sparse
src/estimators/stratified_sketch.py
world-federation-of-advertisers/cardinality_estimation_evaluation_framework
train
21
9e72d71ab50682762f33ec8557006432fbb41843
[ "self.d = collections.deque()\nself.sum = 0\nself.size = size", "self.d.append(val)\nself.sum += val\nif len(self.d) > self.size:\n self.sum -= self.d.popleft()\nreturn self.sum / len(self.d)" ]
<|body_start_0|> self.d = collections.deque() self.sum = 0 self.size = size <|end_body_0|> <|body_start_1|> self.d.append(val) self.sum += val if len(self.d) > self.size: self.sum -= self.d.popleft() return self.sum / len(self.d) <|end_body_1|>
MovingAverage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.d = collections.deque() ...
stack_v2_sparse_classes_10k_train_000709
854
no_license
[ { "docstring": "Initialize your data structure here. :type size: int", "name": "__init__", "signature": "def __init__(self, size)" }, { "docstring": ":type val: int :rtype: float", "name": "next", "signature": "def next(self, val)" } ]
2
stack_v2_sparse_classes_30k_train_004900
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float
Implement the Python class `MovingAverage` described below. Class description: Implement the MovingAverage class. Method signatures and docstrings: - def __init__(self, size): Initialize your data structure here. :type size: int - def next(self, val): :type val: int :rtype: float <|skeleton|> class MovingAverage: ...
c27f19fac14b4acef8c631ad5569e1a5c29e9e1f
<|skeleton|> class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" <|body_0|> def next(self, val): """:type val: int :rtype: float""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MovingAverage: def __init__(self, size): """Initialize your data structure here. :type size: int""" self.d = collections.deque() self.sum = 0 self.size = size def next(self, val): """:type val: int :rtype: float""" self.d.append(val) self.sum += val...
the_stack_v2_python_sparse
leetcode/p0346 - Moving Average from Data Stream.py
liseyko/CtCI
train
0
649c00d62dfe4aa3e741000804b3b5daec97222a
[ "self._negate = False\nself.values = [v.strip() for v in value.split() if v.strip() != '']\nself._policy_files = policy_files\nself._ignoremissingpolicyfiles = ignoremissingpolicyfiles", "if value.startswith('!'):\n return (value[1:], True)\nreturn (value, False)", "current_dir = os.path.abspath(os.path.dirn...
<|body_start_0|> self._negate = False self.values = [v.strip() for v in value.split() if v.strip() != ''] self._policy_files = policy_files self._ignoremissingpolicyfiles = ignoremissingpolicyfiles <|end_body_0|> <|body_start_1|> if value.startswith('!'): return (val...
A selector that selects files based on other criteria. It is similar to the Ant file selector objects in design. This one selects files based on whether the root-most Distribution.Policy.S60 file matches the given value.
DistributionPolicySelector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DistributionPolicySelector: """A selector that selects files based on other criteria. It is similar to the Ant file selector objects in design. This one selects files based on whether the root-most Distribution.Policy.S60 file matches the given value.""" def __init__(self, policy_files, valu...
stack_v2_sparse_classes_10k_train_000710
7,073
no_license
[ { "docstring": "Initialization.", "name": "__init__", "signature": "def __init__(self, policy_files, value, ignoremissingpolicyfiles=False)" }, { "docstring": "get value and negate it", "name": "get_value_and_negate", "signature": "def get_value_and_negate(self, value)" }, { "doc...
3
stack_v2_sparse_classes_30k_train_001910
Implement the Python class `DistributionPolicySelector` described below. Class description: A selector that selects files based on other criteria. It is similar to the Ant file selector objects in design. This one selects files based on whether the root-most Distribution.Policy.S60 file matches the given value. Metho...
Implement the Python class `DistributionPolicySelector` described below. Class description: A selector that selects files based on other criteria. It is similar to the Ant file selector objects in design. This one selects files based on whether the root-most Distribution.Policy.S60 file matches the given value. Metho...
f458a4ce83f74d603362fe6b71eaa647ccc62fee
<|skeleton|> class DistributionPolicySelector: """A selector that selects files based on other criteria. It is similar to the Ant file selector objects in design. This one selects files based on whether the root-most Distribution.Policy.S60 file matches the given value.""" def __init__(self, policy_files, valu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DistributionPolicySelector: """A selector that selects files based on other criteria. It is similar to the Ant file selector objects in design. This one selects files based on whether the root-most Distribution.Policy.S60 file matches the given value.""" def __init__(self, policy_files, value, ignoremiss...
the_stack_v2_python_sparse
buildframework/helium/sf/python/pythoncore/lib/archive/selectors.py
anagovitsyn/oss.FCL.sftools.dev.build
train
0
5dbcada26174abe15d3fab2e2fa678c1c8888d83
[ "super().__init__(*args, **kwargs)\nself.data_type = data_type\nself.processor = processor or (lambda x: x)\nself.allow_fallback = allow_fallback", "if isinstance(value, self.data_type):\n return self.processor(value)\ntry:\n return self.processor(self.data_type(value))\nexcept ValueError:\n if not self....
<|body_start_0|> super().__init__(*args, **kwargs) self.data_type = data_type self.processor = processor or (lambda x: x) self.allow_fallback = allow_fallback <|end_body_0|> <|body_start_1|> if isinstance(value, self.data_type): return self.processor(value) t...
Basic property to handle int, Decimal and other basic types.
Basic
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Basic: """Basic property to handle int, Decimal and other basic types.""" def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs): """Init method.""" <|body_0|> def handle(self...
stack_v2_sparse_classes_10k_train_000711
4,580
permissive
[ { "docstring": "Init method.", "name": "__init__", "signature": "def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs)" }, { "docstring": "Handle value.", "name": "handle", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_003274
Implement the Python class `Basic` described below. Class description: Basic property to handle int, Decimal and other basic types. Method signatures and docstrings: - def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs)...
Implement the Python class `Basic` described below. Class description: Basic property to handle int, Decimal and other basic types. Method signatures and docstrings: - def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs)...
00909d2c47d158bfeac300e1d7477c4f87c52096
<|skeleton|> class Basic: """Basic property to handle int, Decimal and other basic types.""" def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs): """Init method.""" <|body_0|> def handle(self...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Basic: """Basic property to handle int, Decimal and other basic types.""" def __init__(self, *args: str, data_type: typing.Type, processor: typing.Optional[typing.Callable[[T], T]]=None, allow_fallback: bool=False, **kwargs): """Init method.""" super().__init__(*args, **kwargs) se...
the_stack_v2_python_sparse
knowit/properties/general.py
ratoaq2/knowit
train
27
0d15a41e684c9ef3b962b106f147bbdf02c38bd6
[ "prev = None\ncur = head\nwhile cur:\n tmp = cur.next\n cur.next = prev\n prev = cur\n cur = tmp\nreturn prev", "fast = slow = head\nwhile fast and fast.next:\n slow = slow.next\n fast = fast.next.next\nslow = self.reverseList(slow)\ncur = head\nslow_cur = slow\nwhile slow_cur:\n if slow_cur....
<|body_start_0|> prev = None cur = head while cur: tmp = cur.next cur.next = prev prev = cur cur = tmp return prev <|end_body_0|> <|body_start_1|> fast = slow = head while fast and fast.next: slow = slow.next ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reorderList(self, head): """:type head: ListNode :rtype: void Do not return anything, modify head in-place instead.""" <|body_1|> <|end_skeleton|> <|body_start...
stack_v2_sparse_classes_10k_train_000712
1,163
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "reverseList", "signature": "def reverseList(self, head)" }, { "docstring": ":type head: ListNode :rtype: void Do not return anything, modify head in-place instead.", "name": "reorderList", "signature": "def reorderList(self...
2
stack_v2_sparse_classes_30k_train_002670
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reorderList(self, head): :type head: ListNode :rtype: void Do not return anything, modify head in-place i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverseList(self, head): :type head: ListNode :rtype: ListNode - def reorderList(self, head): :type head: ListNode :rtype: void Do not return anything, modify head in-place i...
9bd2d706f014ce84356ba38fc7801da0285a91d3
<|skeleton|> class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def reorderList(self, head): """:type head: ListNode :rtype: void Do not return anything, modify head in-place instead.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def reverseList(self, head): """:type head: ListNode :rtype: ListNode""" prev = None cur = head while cur: tmp = cur.next cur.next = prev prev = cur cur = tmp return prev def reorderList(self, head): ...
the_stack_v2_python_sparse
leetcode/reorderList-143.py
pittcat/Algorithm_Practice
train
0
4d078befe570d6124c37f52c6aed5d2cc561fab6
[ "wordsets = set(words)\nfor word in words:\n for i in range(1, len(word) + 1):\n if word[i:] in wordsets:\n wordsets.remove(word[i:])\nLens = sum([len(word) + 1 for word in wordsets])\nreturn Lens", "root = TrieNode(0)\nfor word in words:\n node = root\n for w in word[::-1]:\n if...
<|body_start_0|> wordsets = set(words) for word in words: for i in range(1, len(word) + 1): if word[i:] in wordsets: wordsets.remove(word[i:]) Lens = sum([len(word) + 1 for word in wordsets]) return Lens <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minimumLengthEncoding(self, words) -> int: """查找,没有后缀的单词 :param list[str] words: :return:""" <|body_0|> def minimumLengthEncoding2(self, words) -> int: """字典树,Trie :param list[str] words: :return:""" <|body_1|> def minimumLengthEncoding3(se...
stack_v2_sparse_classes_10k_train_000713
3,061
no_license
[ { "docstring": "查找,没有后缀的单词 :param list[str] words: :return:", "name": "minimumLengthEncoding", "signature": "def minimumLengthEncoding(self, words) -> int" }, { "docstring": "字典树,Trie :param list[str] words: :return:", "name": "minimumLengthEncoding2", "signature": "def minimumLengthEnco...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumLengthEncoding(self, words) -> int: 查找,没有后缀的单词 :param list[str] words: :return: - def minimumLengthEncoding2(self, words) -> int: 字典树,Trie :param list[str] words: :ret...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minimumLengthEncoding(self, words) -> int: 查找,没有后缀的单词 :param list[str] words: :return: - def minimumLengthEncoding2(self, words) -> int: 字典树,Trie :param list[str] words: :ret...
837957ea22aa07ce28a6c23ea0419bd2011e1f88
<|skeleton|> class Solution: def minimumLengthEncoding(self, words) -> int: """查找,没有后缀的单词 :param list[str] words: :return:""" <|body_0|> def minimumLengthEncoding2(self, words) -> int: """字典树,Trie :param list[str] words: :return:""" <|body_1|> def minimumLengthEncoding3(se...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def minimumLengthEncoding(self, words) -> int: """查找,没有后缀的单词 :param list[str] words: :return:""" wordsets = set(words) for word in words: for i in range(1, len(word) + 1): if word[i:] in wordsets: wordsets.remove(word[i:]) ...
the_stack_v2_python_sparse
华为题库/单词压缩编码.py
2226171237/Algorithmpractice
train
0
b00f119c871ab01134e58d807bf7c121968b0076
[ "parser = MagicCommandParser(prog='compress', description='display the content of a repository (GIT or SVN)')\nparser.add_argument('dest', type=str, help='destination, the extension defines the compression format, zip, gzip 7z')\nparser.add_argument('files', type=str, nargs='?', help='files to compress or a python ...
<|body_start_0|> parser = MagicCommandParser(prog='compress', description='display the content of a repository (GIT or SVN)') parser.add_argument('dest', type=str, help='destination, the extension defines the compression format, zip, gzip 7z') parser.add_argument('files', type=str, nargs='?', he...
Defines magic commands to compress files.
MagicCompress
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MagicCompress: """Defines magic commands to compress files.""" def compress_parser(): """defines the way to parse the magic command ``%compress``""" <|body_0|> def compress(self, line): """.. nbref:: :title: %compress It compresses a list of files, it returns the...
stack_v2_sparse_classes_10k_train_000714
2,650
permissive
[ { "docstring": "defines the way to parse the magic command ``%compress``", "name": "compress_parser", "signature": "def compress_parser()" }, { "docstring": ".. nbref:: :title: %compress It compresses a list of files, it returns the number of compressed files:: from pyquickhelper import zip_file...
2
null
Implement the Python class `MagicCompress` described below. Class description: Defines magic commands to compress files. Method signatures and docstrings: - def compress_parser(): defines the way to parse the magic command ``%compress`` - def compress(self, line): .. nbref:: :title: %compress It compresses a list of ...
Implement the Python class `MagicCompress` described below. Class description: Defines magic commands to compress files. Method signatures and docstrings: - def compress_parser(): defines the way to parse the magic command ``%compress`` - def compress(self, line): .. nbref:: :title: %compress It compresses a list of ...
860ec5b9a53bae4fc616076c0b52dbe2a1153d30
<|skeleton|> class MagicCompress: """Defines magic commands to compress files.""" def compress_parser(): """defines the way to parse the magic command ``%compress``""" <|body_0|> def compress(self, line): """.. nbref:: :title: %compress It compresses a list of files, it returns the...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MagicCompress: """Defines magic commands to compress files.""" def compress_parser(): """defines the way to parse the magic command ``%compress``""" parser = MagicCommandParser(prog='compress', description='display the content of a repository (GIT or SVN)') parser.add_argument('de...
the_stack_v2_python_sparse
src/pyquickhelper/ipythonhelper/magic_class_compress.py
Pandinosaurus/pyquickhelper
train
0
0d9d0fcb29341f051b4b31640a98976da53f2422
[ "for id, op in vars(cls).items():\n if isinstance(op, IOperation) and op.is_valid(operator, left, right):\n if isinstance(op, BinaryOperation):\n return op.build(left, right)\n else:\n from boa3.model.type.type import Type\n operand = right if left is Type.none else...
<|body_start_0|> for id, op in vars(cls).items(): if isinstance(op, IOperation) and op.is_valid(operator, left, right): if isinstance(op, BinaryOperation): return op.build(left, right) else: from boa3.model.type.type import Type...
BinaryOp
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryOp: def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: """Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right opera...
stack_v2_sparse_classes_10k_train_000715
4,052
permissive
[ { "docstring": "Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right operand :return: The operation if exists. None otherwise; :rtype: BinaryOperation or None", "name": "validate_type", "...
3
stack_v2_sparse_classes_30k_train_006494
Implement the Python class `BinaryOp` described below. Class description: Implement the BinaryOp class. Method signatures and docstrings: - def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: Gets a binary operation given the operator and the operands types. :param oper...
Implement the Python class `BinaryOp` described below. Class description: Implement the BinaryOp class. Method signatures and docstrings: - def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: Gets a binary operation given the operator and the operands types. :param oper...
e4ef340744b5bd25ade26f847eac50789b97f3e9
<|skeleton|> class BinaryOp: def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: """Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right opera...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BinaryOp: def validate_type(cls, operator: Operator, left: IType, right: IType) -> Optional[BinaryOperation]: """Gets a binary operation given the operator and the operands types. :param operator: binary operator :param left: type of the left operand :param right: type of the right operand :return: Th...
the_stack_v2_python_sparse
boa3/model/operation/binaryop.py
DanPopa46/neo3-boa
train
0
1c7371fa786f45b30039391075b7c6b4a990bdf8
[ "self.prefix = list(w)\nfor i in range(1, len(w)):\n self.prefix[i] = self.prefix[i - 1] + w[i]", "target = random.randint(0, self.prefix[-1] - 1)\nleft, right = (0, len(self.prefix) - 1)\nwhile left < right:\n mid = left + (right - left) // 2\n if self.prefix[mid] <= target:\n left = mid + 1\n ...
<|body_start_0|> self.prefix = list(w) for i in range(1, len(w)): self.prefix[i] = self.prefix[i - 1] + w[i] <|end_body_0|> <|body_start_1|> target = random.randint(0, self.prefix[-1] - 1) left, right = (0, len(self.prefix) - 1) while left < right: mid = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.prefix = list(w) for i in range(1, len(w)): self.prefix[i] = self.prefi...
stack_v2_sparse_classes_10k_train_000716
841
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|...
5b14b6f42baf59b04cbcc8e115df4272029b64c8
<|skeleton|> class Solution: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def __init__(self, w): """:type w: List[int]""" self.prefix = list(w) for i in range(1, len(w)): self.prefix[i] = self.prefix[i - 1] + w[i] def pickIndex(self): """:rtype: int""" target = random.randint(0, self.prefix[-1] - 1) left, ri...
the_stack_v2_python_sparse
LeetCode/0528.Random-Pick-With-Weight/Random-Pick-With-Weight.py
htingwang/HandsOnAlgoDS
train
12
5a9daab4114da3539b8233b71115e085b5a9a4fe
[ "paginated = Paginator(models.SiteInvite.objects.filter(user=request.user).order_by('-created_date'), PAGE_LENGTH)\npage = paginated.get_page(request.GET.get('page'))\ndata = {'invites': page, 'page_range': paginated.get_elided_page_range(page.number, on_each_side=2, on_ends=1), 'form': forms.CreateInviteForm()}\nr...
<|body_start_0|> paginated = Paginator(models.SiteInvite.objects.filter(user=request.user).order_by('-created_date'), PAGE_LENGTH) page = paginated.get_page(request.GET.get('page')) data = {'invites': page, 'page_range': paginated.get_elided_page_range(page.number, on_each_side=2, on_ends=1), 'f...
create invites
ManageInvites
[ "LicenseRef-scancode-warranty-disclaimer" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageInvites: """create invites""" def get(self, request): """invite management page""" <|body_0|> def post(self, request): """creates an invite database entry""" <|body_1|> <|end_skeleton|> <|body_start_0|> paginated = Paginator(models.SiteInv...
stack_v2_sparse_classes_10k_train_000717
6,414
no_license
[ { "docstring": "invite management page", "name": "get", "signature": "def get(self, request)" }, { "docstring": "creates an invite database entry", "name": "post", "signature": "def post(self, request)" } ]
2
null
Implement the Python class `ManageInvites` described below. Class description: create invites Method signatures and docstrings: - def get(self, request): invite management page - def post(self, request): creates an invite database entry
Implement the Python class `ManageInvites` described below. Class description: create invites Method signatures and docstrings: - def get(self, request): invite management page - def post(self, request): creates an invite database entry <|skeleton|> class ManageInvites: """create invites""" def get(self, re...
0f8da5b738047f3c34d60d93f59bdedd8f797224
<|skeleton|> class ManageInvites: """create invites""" def get(self, request): """invite management page""" <|body_0|> def post(self, request): """creates an invite database entry""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ManageInvites: """create invites""" def get(self, request): """invite management page""" paginated = Paginator(models.SiteInvite.objects.filter(user=request.user).order_by('-created_date'), PAGE_LENGTH) page = paginated.get_page(request.GET.get('page')) data = {'invites': ...
the_stack_v2_python_sparse
bookwyrm/views/admin/invite.py
bookwyrm-social/bookwyrm
train
1,398
e5e327f31990ba02267e9b8dffa25f2fe1269096
[ "self.name = name\nself.owner = owner\nself.tag = tag\nself.state = state\nself.countr = countr", "if self.tag is not None:\n query = '\\n { repository(name: \"%s\", owner: \"%s\") {\\n pullRequests(states: %s, last: %i, orderBy: {field: CREATED_AT, direction: ASC},labels:\"...
<|body_start_0|> self.name = name self.owner = owner self.tag = tag self.state = state self.countr = countr <|end_body_0|> <|body_start_1|> if self.tag is not None: query = '\n { repository(name: "%s", owner: "%s") {\n pull...
The Queries class defines an object that represents a pull request query
Queries
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Queries: """The Queries class defines an object that represents a pull request query""" def __init__(self, owner, name, state, tag=None, countr=30): """initialize query object with state, name, owner, tag and counter.""" <|body_0|> def pulls(self): """this functi...
stack_v2_sparse_classes_10k_train_000718
2,463
permissive
[ { "docstring": "initialize query object with state, name, owner, tag and counter.", "name": "__init__", "signature": "def __init__(self, owner, name, state, tag=None, countr=30)" }, { "docstring": "this function returns pull request query", "name": "pulls", "signature": "def pulls(self)"...
2
null
Implement the Python class `Queries` described below. Class description: The Queries class defines an object that represents a pull request query Method signatures and docstrings: - def __init__(self, owner, name, state, tag=None, countr=30): initialize query object with state, name, owner, tag and counter. - def pul...
Implement the Python class `Queries` described below. Class description: The Queries class defines an object that represents a pull request query Method signatures and docstrings: - def __init__(self, owner, name, state, tag=None, countr=30): initialize query object with state, name, owner, tag and counter. - def pul...
31fd3fb1233f39ea2252a7a44160ff8a2140f7bd
<|skeleton|> class Queries: """The Queries class defines an object that represents a pull request query""" def __init__(self, owner, name, state, tag=None, countr=30): """initialize query object with state, name, owner, tag and counter.""" <|body_0|> def pulls(self): """this functi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Queries: """The Queries class defines an object that represents a pull request query""" def __init__(self, owner, name, state, tag=None, countr=30): """initialize query object with state, name, owner, tag and counter.""" self.name = name self.owner = owner self.tag = tag ...
the_stack_v2_python_sparse
Python/PR_Workflow/src/graphqlapi.py
HarshCasper/Rotten-Scripts
train
1,474
8b085fff21261152e2cd43b3d0704ed56eb23550
[ "blackTypeDict = self.getDictBykey(self.__getBlacklistConfig().json(), 'name', blackType)\nself.url = '/mgr/park/parkBlacklist/save.do'\ndata = {'specialCarTypeConfigId': blackTypeDict['id'], 'carLicenseNumber': carNum, 'owner': 'apipytest', 'reason': 'pytest', 'remark1': 'pytest', 'blacklistForeverFlag': 'CLOSE', ...
<|body_start_0|> blackTypeDict = self.getDictBykey(self.__getBlacklistConfig().json(), 'name', blackType) self.url = '/mgr/park/parkBlacklist/save.do' data = {'specialCarTypeConfigId': blackTypeDict['id'], 'carLicenseNumber': carNum, 'owner': 'apipytest', 'reason': 'pytest', 'remark1': 'pytest',...
黑名单录入
ParkBlacklist
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParkBlacklist: """黑名单录入""" def addBlacklist(self, blackType, carNum): """新建黑名单车辆""" <|body_0|> def __getBlacklistConfig(self): """获取黑名单配置""" <|body_1|> def delBlacklist(self, parkName, carNum): """删除黑名单""" <|body_2|> def getBlack...
stack_v2_sparse_classes_10k_train_000719
13,467
no_license
[ { "docstring": "新建黑名单车辆", "name": "addBlacklist", "signature": "def addBlacklist(self, blackType, carNum)" }, { "docstring": "获取黑名单配置", "name": "__getBlacklistConfig", "signature": "def __getBlacklistConfig(self)" }, { "docstring": "删除黑名单", "name": "delBlacklist", "signat...
4
stack_v2_sparse_classes_30k_train_002272
Implement the Python class `ParkBlacklist` described below. Class description: 黑名单录入 Method signatures and docstrings: - def addBlacklist(self, blackType, carNum): 新建黑名单车辆 - def __getBlacklistConfig(self): 获取黑名单配置 - def delBlacklist(self, parkName, carNum): 删除黑名单 - def getBlacklist(self, parkName): 获取黑名单列表
Implement the Python class `ParkBlacklist` described below. Class description: 黑名单录入 Method signatures and docstrings: - def addBlacklist(self, blackType, carNum): 新建黑名单车辆 - def __getBlacklistConfig(self): 获取黑名单配置 - def delBlacklist(self, parkName, carNum): 删除黑名单 - def getBlacklist(self, parkName): 获取黑名单列表 <|skeleto...
34c368c109867da26d9256bca85f872b0fac2ea7
<|skeleton|> class ParkBlacklist: """黑名单录入""" def addBlacklist(self, blackType, carNum): """新建黑名单车辆""" <|body_0|> def __getBlacklistConfig(self): """获取黑名单配置""" <|body_1|> def delBlacklist(self, parkName, carNum): """删除黑名单""" <|body_2|> def getBlack...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ParkBlacklist: """黑名单录入""" def addBlacklist(self, blackType, carNum): """新建黑名单车辆""" blackTypeDict = self.getDictBykey(self.__getBlacklistConfig().json(), 'name', blackType) self.url = '/mgr/park/parkBlacklist/save.do' data = {'specialCarTypeConfigId': blackTypeDict['id'], ...
the_stack_v2_python_sparse
Api/parkingManage_service/carTypeManage_service/carTypeConfig.py
oyebino/pomp_api
train
1
aff8e4a8bc7571ae75464bb5a38286570ff77ea2
[ "super().__init__()\nself.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate)\nself.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate)\nself.linear = tf.keras.layers.Dense(target_vocab)", "enc_output = self.encoder(inputs, training, encoder_mask)\ndec_output = self...
<|body_start_0|> super().__init__() self.encoder = Encoder(N, dm, h, hidden, input_vocab, max_seq_input, drop_rate) self.decoder = Decoder(N, dm, h, hidden, target_vocab, max_seq_target, drop_rate) self.linear = tf.keras.layers.Dense(target_vocab) <|end_body_0|> <|body_start_1|> ...
class Transform
Transformer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformer: """class Transform""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Sets the following public instance attributes: * encoder - the encoder layer * decoder - the decoder layer * linear - a final Dense lay...
stack_v2_sparse_classes_10k_train_000720
1,535
no_license
[ { "docstring": "Sets the following public instance attributes: * encoder - the encoder layer * decoder - the decoder layer * linear - a final Dense layer with target_vocab units", "name": "__init__", "signature": "def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_tar...
2
stack_v2_sparse_classes_30k_train_003720
Implement the Python class `Transformer` described below. Class description: class Transform Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Sets the following public instance attributes: * encoder - the encoder layer *...
Implement the Python class `Transformer` described below. Class description: class Transform Method signatures and docstrings: - def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): Sets the following public instance attributes: * encoder - the encoder layer *...
9ff78818c132d1233c11b8fc8fd469878b23b14e
<|skeleton|> class Transformer: """class Transform""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Sets the following public instance attributes: * encoder - the encoder layer * decoder - the decoder layer * linear - a final Dense lay...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Transformer: """class Transform""" def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1): """Sets the following public instance attributes: * encoder - the encoder layer * decoder - the decoder layer * linear - a final Dense layer with targe...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/11-transformer.py
Nzparra/holbertonschool-machine_learning
train
0
8417dc42f77c4855434f754f63be1bfa4d47bf15
[ "super().__init__()\nlogger.debug('Create PaddleTextConnectionHandler to process the text request')\nself.text_engine = text_engine\nself.task = self.text_engine.executor.task\nself.model = self.text_engine.executor.model\nself.tokenizer = self.text_engine.executor.tokenizer\nself._punc_list = self.text_engine.exec...
<|body_start_0|> super().__init__() logger.debug('Create PaddleTextConnectionHandler to process the text request') self.text_engine = text_engine self.task = self.text_engine.executor.task self.model = self.text_engine.executor.model self.tokenizer = self.text_engine.exec...
PaddleTextConnectionHandler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaddleTextConnectionHandler: def __init__(self, text_engine): """The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_engine (TextEngine): The Text engine""" <|body_0|> def run(self, text): """The connection process ...
stack_v2_sparse_classes_10k_train_000721
6,419
permissive
[ { "docstring": "The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_engine (TextEngine): The Text engine", "name": "__init__", "signature": "def __init__(self, text_engine)" }, { "docstring": "The connection process the request text Args: text ...
5
null
Implement the Python class `PaddleTextConnectionHandler` described below. Class description: Implement the PaddleTextConnectionHandler class. Method signatures and docstrings: - def __init__(self, text_engine): The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_eng...
Implement the Python class `PaddleTextConnectionHandler` described below. Class description: Implement the PaddleTextConnectionHandler class. Method signatures and docstrings: - def __init__(self, text_engine): The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_eng...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class PaddleTextConnectionHandler: def __init__(self, text_engine): """The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_engine (TextEngine): The Text engine""" <|body_0|> def run(self, text): """The connection process ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PaddleTextConnectionHandler: def __init__(self, text_engine): """The PaddleSpeech Text Server Connection Handler This connection process every server request Args: text_engine (TextEngine): The Text engine""" super().__init__() logger.debug('Create PaddleTextConnectionHandler to proces...
the_stack_v2_python_sparse
paddlespeech/server/engine/text/python/text_engine.py
anniyanvr/DeepSpeech-1
train
0
5e03adcad67aef73b6801d5bf8aad51652f4b4eb
[ "bin1, bin2, w2 = self._calc_bin(logits, target)\nw1 = 1 - w2\nnlp = -F.log_softmax(logits, dim=-1)\nB = _get_indexer(logits.shape[:-1])\nloss = w1 * nlp[B + (bin1,)] + w2 * nlp[B + (bin2,)]\nneg_entropy = w1.xlogy(w1) + w2.xlogy(w2)\nreturn (loss + neg_entropy).relu()", "support = self._calc_support(logits.shape...
<|body_start_0|> bin1, bin2, w2 = self._calc_bin(logits, target) w1 = 1 - w2 nlp = -F.log_softmax(logits, dim=-1) B = _get_indexer(logits.shape[:-1]) loss = w1 * nlp[B + (bin1,)] + w2 * nlp[B + (bin2,)] neg_entropy = w1.xlogy(w1) + w2.xlogy(w2) return (loss + neg_...
A loss for predicting the distribution of a scalar. The target is assumed to be in the range ``[-(n-1)//2, n//2]``, where ``n=logits.shape[-1]``. The logits are used to calculate the probabilities of being one of the ``n`` values. If a target value y is not an integer, it is treated as having prabability mass of :math:...
DiscreteRegressionLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiscreteRegressionLoss: """A loss for predicting the distribution of a scalar. The target is assumed to be in the range ``[-(n-1)//2, n//2]``, where ``n=logits.shape[-1]``. The logits are used to calculate the probabilities of being one of the ``n`` values. If a target value y is not an integer, ...
stack_v2_sparse_classes_10k_train_000722
31,133
permissive
[ { "docstring": "Caculate the loss. Args: logits: shape is [B, n] target: the shape is [B] Returns: loss with the same shape as target", "name": "__call__", "signature": "def __call__(self, logits: torch.Tensor, target: torch.Tensor)" }, { "docstring": "Calculate the expected predition in the unt...
3
stack_v2_sparse_classes_30k_train_000082
Implement the Python class `DiscreteRegressionLoss` described below. Class description: A loss for predicting the distribution of a scalar. The target is assumed to be in the range ``[-(n-1)//2, n//2]``, where ``n=logits.shape[-1]``. The logits are used to calculate the probabilities of being one of the ``n`` values. ...
Implement the Python class `DiscreteRegressionLoss` described below. Class description: A loss for predicting the distribution of a scalar. The target is assumed to be in the range ``[-(n-1)//2, n//2]``, where ``n=logits.shape[-1]``. The logits are used to calculate the probabilities of being one of the ``n`` values. ...
b00ff2fa5e660de31020338ba340263183fbeaa4
<|skeleton|> class DiscreteRegressionLoss: """A loss for predicting the distribution of a scalar. The target is assumed to be in the range ``[-(n-1)//2, n//2]``, where ``n=logits.shape[-1]``. The logits are used to calculate the probabilities of being one of the ``n`` values. If a target value y is not an integer, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DiscreteRegressionLoss: """A loss for predicting the distribution of a scalar. The target is assumed to be in the range ``[-(n-1)//2, n//2]``, where ``n=logits.shape[-1]``. The logits are used to calculate the probabilities of being one of the ``n`` values. If a target value y is not an integer, it is treated...
the_stack_v2_python_sparse
alf/utils/losses.py
HorizonRobotics/alf
train
288
a8c90bd1f109a271af58a5767da9b95bbcf07318
[ "super(SharedAdam, self).__init__(params, lr=lr, betas=betas, eps=eps, weight_decay=weight_decay, amsgrad=amsgrad)\nfor group in self.param_groups:\n for p in group['params']:\n state = self.state[p]\n state['step'] = 0\n state['shared_step'] = torch.zeros(1).share_memory_()\n state['...
<|body_start_0|> super(SharedAdam, self).__init__(params, lr=lr, betas=betas, eps=eps, weight_decay=weight_decay, amsgrad=amsgrad) for group in self.param_groups: for p in group['params']: state = self.state[p] state['step'] = 0 state['shared_s...
SharedAdam
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SharedAdam: def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): """arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term ...
stack_v2_sparse_classes_10k_train_000723
23,572
no_license
[ { "docstring": "arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term to denominator, weight_decay is L2 penalty, and amsgrad is boolean weather to use AMSGrad. Adam is subclass of torch.optim....
2
stack_v2_sparse_classes_30k_train_005961
Implement the Python class `SharedAdam` described below. Class description: Implement the SharedAdam class. Method signatures and docstrings: - def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): arguments are all default arguments of torch.optim.Adam. Params are weight...
Implement the Python class `SharedAdam` described below. Class description: Implement the SharedAdam class. Method signatures and docstrings: - def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): arguments are all default arguments of torch.optim.Adam. Params are weight...
6f38cfd121c504e78ecd4b7762e86f4825bb596d
<|skeleton|> class SharedAdam: def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): """arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SharedAdam: def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-08, weight_decay=0, amsgrad=False): """arguments are all default arguments of torch.optim.Adam. Params are weights of neural network. Betas are coefficients for gradient averages, eps is numerical stability term to denominator...
the_stack_v2_python_sparse
algorithm/a3c_breakout.py
corot/reinforcement-learning
train
0
bbb127e8589cb421126a51c11224c730e89465e3
[ "try:\n return Gateway.objects.get(reservoir=self, task=task)\nexcept Gateway.DoesNotExist:\n return None", "gateway = self.get_gateway(task)\nif gateway and gateway.pipe:\n return gateway.pipe\nelse:\n return None" ]
<|body_start_0|> try: return Gateway.objects.get(reservoir=self, task=task) except Gateway.DoesNotExist: return None <|end_body_0|> <|body_start_1|> gateway = self.get_gateway(task) if gateway and gateway.pipe: return gateway.pipe else: ...
Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter').
Reservoir
[ "MIT", "LicenseRef-scancode-proprietary-license", "GPL-3.0-only", "LicenseRef-scancode-unknown-license-reference", "GPL-1.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reservoir: """Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter').""" def get_gateway(self, task): """Returns the g...
stack_v2_sparse_classes_10k_train_000724
3,199
permissive
[ { "docstring": "Returns the gateway for a given task, or None if the gateway doesn't exist.", "name": "get_gateway", "signature": "def get_gateway(self, task)" }, { "docstring": "Takes the primary key (name) of a SearchTask and returns the Pipe for that task, if one exists. Otherwise, returns No...
2
stack_v2_sparse_classes_30k_train_005478
Implement the Python class `Reservoir` described below. Class description: Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter'). Method signatures and...
Implement the Python class `Reservoir` described below. Class description: Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter'). Method signatures and...
a379a134c0c5af14df4ed2afa066c1626506b754
<|skeleton|> class Reservoir: """Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter').""" def get_gateway(self, task): """Returns the g...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Reservoir: """Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter').""" def get_gateway(self, task): """Returns the gateway for a ...
the_stack_v2_python_sparse
Incident-Response/Tools/cyphon/cyphon/aggregator/reservoirs/models.py
foss2cyber/Incident-Playbook
train
1
e70c1d480265b0ad4ea553ce9a2f1cd0d0bd4a43
[ "lower_bound = float('-inf')\nstack = []\nfor val in preorder:\n if val < lower_bound:\n return False\n while stack and val > stack[-1]:\n lower_bound = stack.pop()\n stack.append(val)\nreturn True", "lower_bound = float('-inf')\ni = 0\nfor val in preorder:\n if val < lower_bound:\n ...
<|body_start_0|> lower_bound = float('-inf') stack = [] for val in preorder: if val < lower_bound: return False while stack and val > stack[-1]: lower_bound = stack.pop() stack.append(val) return True <|end_body_0|> <|b...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def verifyPreorder(self, preorder: List[int]) -> bool: """In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a de...
stack_v2_sparse_classes_10k_train_000725
2,035
no_license
[ { "docstring": "In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a decreasing val subseq. If we see a val that's greater than its preceeding val ...
2
stack_v2_sparse_classes_30k_train_006300
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def verifyPreorder(self, preorder: List[int]) -> bool: In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def verifyPreorder(self, preorder: List[int]) -> bool: In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf...
6ff1941ff213a843013100ac7033e2d4f90fbd6a
<|skeleton|> class Solution: def verifyPreorder(self, preorder: List[int]) -> bool: """In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def verifyPreorder(self, preorder: List[int]) -> bool: """In BST, node.left.val < node.val < node.right.val, and the preorder traversal will visit left child all the way to the leaf before visiting any right child. This traversal order will reflect in the preorder array as a decreasing val s...
the_stack_v2_python_sparse
Leetcode 0255. Verify Preorder Sequence in Binary Search Tree.py
Chaoran-sjsu/leetcode
train
0
e1d712db8bdc8619ba3de8b15c107fd1ec058cc1
[ "super().__init__()\nself.W = tf.keras.layers.Dense(units=units)\nself.U = tf.keras.layers.Dense(units=units)\nself.V = tf.keras.layers.Dense(units=1)", "s_expanded = tf.expand_dims(input=s_prev, axis=1)\nfirst = self.W(s_expanded)\nsecond = self.U(hidden_states)\nscore = self.V(tf.nn.tanh(first + second))\natten...
<|body_start_0|> super().__init__() self.W = tf.keras.layers.Dense(units=units) self.U = tf.keras.layers.Dense(units=units) self.V = tf.keras.layers.Dense(units=1) <|end_body_0|> <|body_start_1|> s_expanded = tf.expand_dims(input=s_prev, axis=1) first = self.W(s_expanded...
class SelfAttention
SelfAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SelfAttention: """class SelfAttention""" def __init__(self, units): """* units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer with units units, to be applied to the previous decoder hid...
stack_v2_sparse_classes_10k_train_000726
1,978
no_license
[ { "docstring": "* units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer with units units, to be applied to the previous decoder hidden state * U - a Dense layer with units units, to be applied to the encoder hidden...
2
stack_v2_sparse_classes_30k_train_003294
Implement the Python class `SelfAttention` described below. Class description: class SelfAttention Method signatures and docstrings: - def __init__(self, units): * units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer wi...
Implement the Python class `SelfAttention` described below. Class description: class SelfAttention Method signatures and docstrings: - def __init__(self, units): * units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer wi...
8ad4c2594ff78b345dbd92e9d54d2a143ac4071a
<|skeleton|> class SelfAttention: """class SelfAttention""" def __init__(self, units): """* units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer with units units, to be applied to the previous decoder hid...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SelfAttention: """class SelfAttention""" def __init__(self, units): """* units is an integer representing the number of hidden units in the alignment model * Sets the following public instance attributes: * W - a Dense layer with units units, to be applied to the previous decoder hidden state * U...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/1-self_attention.py
jorgezafra94/holbertonschool-machine_learning
train
1
662423ab416d826e04f11ca0e33e718f6e0c9e1a
[ "self.sum = w[0:]\nif len(w) <= 0:\n return\nfor i in range(1, len(w)):\n self.sum[i] = self.sum[i - 1] + w[i]\nprint(self.sum)", "import numpy as np\nrnd = np.random.randint(0, self.sum[-1])\nlow = 0\nhigh = len(self.sum) - 1\nwhile low < high:\n mid = low + (high - low) / 2\n if self.sum[mid] <= rnd...
<|body_start_0|> self.sum = w[0:] if len(w) <= 0: return for i in range(1, len(w)): self.sum[i] = self.sum[i - 1] + w[i] print(self.sum) <|end_body_0|> <|body_start_1|> import numpy as np rnd = np.random.randint(0, self.sum[-1]) low = 0 ...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.sum = w[0:] if len(w) <= 0: return for i in range(1, len(w)): ...
stack_v2_sparse_classes_10k_train_000727
1,927
no_license
[ { "docstring": ":type w: List[int]", "name": "__init__", "signature": "def __init__(self, w)" }, { "docstring": ":rtype: int", "name": "pickIndex", "signature": "def pickIndex(self)" } ]
2
null
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def __init__(self, w): :type w: List[int] - def pickIndex(self): :rtype: int <|skeleton|> class Solution1: def __init__(self, w): """:type w: List[int]""" ...
176cc1db3291843fb068f06d0180766dd8c3122c
<|skeleton|> class Solution1: def __init__(self, w): """:type w: List[int]""" <|body_0|> def pickIndex(self): """:rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution1: def __init__(self, w): """:type w: List[int]""" self.sum = w[0:] if len(w) <= 0: return for i in range(1, len(w)): self.sum[i] = self.sum[i - 1] + w[i] print(self.sum) def pickIndex(self): """:rtype: int""" import ...
the_stack_v2_python_sparse
2019/sampling/random_pick_with_weight_528.py
yehongyu/acode
train
0
6cbb073eefcb2371ff40183a96f348d5313c11f0
[ "n = len(s)\ndp = [[0] * n for _ in range(n)]\nres = 0\nfor i in range(n - 1, -1, -1):\n for j in range(i, n):\n if s[i] == s[j]:\n if j - i < 3 or dp[i + 1][j - 1] == 1:\n dp[i][j] = 1\n res += 1\nreturn res", "def helper(s, left, right):\n res = 0\n while...
<|body_start_0|> n = len(s) dp = [[0] * n for _ in range(n)] res = 0 for i in range(n - 1, -1, -1): for j in range(i, n): if s[i] == s[j]: if j - i < 3 or dp[i + 1][j - 1] == 1: dp[i][j] = 1 r...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countSubstrings0(self, s): """:type s: str :rtype: int""" <|body_0|> def countSubstrings(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(s) dp = [[0] * n for _ in range(n)] ...
stack_v2_sparse_classes_10k_train_000728
1,490
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "countSubstrings0", "signature": "def countSubstrings0(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "countSubstrings", "signature": "def countSubstrings(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_001400
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubstrings0(self, s): :type s: str :rtype: int - def countSubstrings(self, s): :type s: str :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countSubstrings0(self, s): :type s: str :rtype: int - def countSubstrings(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def countSubstrings0(self, s):...
6e18c5d257840489cc3fb1079ae3804c743982a4
<|skeleton|> class Solution: def countSubstrings0(self, s): """:type s: str :rtype: int""" <|body_0|> def countSubstrings(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def countSubstrings0(self, s): """:type s: str :rtype: int""" n = len(s) dp = [[0] * n for _ in range(n)] res = 0 for i in range(n - 1, -1, -1): for j in range(i, n): if s[i] == s[j]: if j - i < 3 or dp[i + 1][j ...
the_stack_v2_python_sparse
剑指 Offer II 020. 回文子字符串的个数.py
yangyuxiang1996/leetcode
train
0
b7e27af93232c5796fac5c6476a8b4a654a90240
[ "repo_ref = registry_model.lookup_repository(namespace_name, repository_name)\nif repo_ref is None:\n raise NotFound()\nmanifest = registry_model.lookup_manifest_by_digest(repo_ref, manifestref)\nif manifest is None:\n raise NotFound()\nlabel = registry_model.get_manifest_label(manifest, labelid)\nif label is...
<|body_start_0|> repo_ref = registry_model.lookup_repository(namespace_name, repository_name) if repo_ref is None: raise NotFound() manifest = registry_model.lookup_manifest_by_digest(repo_ref, manifestref) if manifest is None: raise NotFound() label = reg...
Resource for managing the labels on a specific repository manifest.
ManageRepositoryManifestLabel
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManageRepositoryManifestLabel: """Resource for managing the labels on a specific repository manifest.""" def get(self, namespace_name, repository_name, manifestref, labelid): """Retrieves the label with the specific ID under the manifest.""" <|body_0|> def delete(self, n...
stack_v2_sparse_classes_10k_train_000729
10,731
permissive
[ { "docstring": "Retrieves the label with the specific ID under the manifest.", "name": "get", "signature": "def get(self, namespace_name, repository_name, manifestref, labelid)" }, { "docstring": "Deletes an existing label from a manifest.", "name": "delete", "signature": "def delete(sel...
2
stack_v2_sparse_classes_30k_train_002866
Implement the Python class `ManageRepositoryManifestLabel` described below. Class description: Resource for managing the labels on a specific repository manifest. Method signatures and docstrings: - def get(self, namespace_name, repository_name, manifestref, labelid): Retrieves the label with the specific ID under th...
Implement the Python class `ManageRepositoryManifestLabel` described below. Class description: Resource for managing the labels on a specific repository manifest. Method signatures and docstrings: - def get(self, namespace_name, repository_name, manifestref, labelid): Retrieves the label with the specific ID under th...
e400a0c22c5f89dd35d571654b13d262b1f6e3b3
<|skeleton|> class ManageRepositoryManifestLabel: """Resource for managing the labels on a specific repository manifest.""" def get(self, namespace_name, repository_name, manifestref, labelid): """Retrieves the label with the specific ID under the manifest.""" <|body_0|> def delete(self, n...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ManageRepositoryManifestLabel: """Resource for managing the labels on a specific repository manifest.""" def get(self, namespace_name, repository_name, manifestref, labelid): """Retrieves the label with the specific ID under the manifest.""" repo_ref = registry_model.lookup_repository(nam...
the_stack_v2_python_sparse
endpoints/api/manifest.py
quay/quay
train
2,363
c7cca67e7cc2d5a5ded317040857073e9293f2a8
[ "maxArea = 0\nhist = []\ni = 0\nwhile i < len(heights):\n if not hist or heights[hist[-1]] <= heights[i]:\n hist.append(i)\n i += 1\n else:\n h = heights[hist.pop()]\n if not hist:\n w = i\n else:\n w = i - 1 - hist[-1]\n maxArea = max(h * w, max...
<|body_start_0|> maxArea = 0 hist = [] i = 0 while i < len(heights): if not hist or heights[hist[-1]] <= heights[i]: hist.append(i) i += 1 else: h = heights[hist.pop()] if not hist: ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_0|> def maximalRectangle(self, matrix): """:type matrix: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> maxArea = 0 ...
stack_v2_sparse_classes_10k_train_000730
2,261
no_license
[ { "docstring": ":type heights: List[int] :rtype: int", "name": "largestRectangleArea", "signature": "def largestRectangleArea(self, heights)" }, { "docstring": ":type matrix: List[List[str]] :rtype: int", "name": "maximalRectangle", "signature": "def maximalRectangle(self, matrix)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int - def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def largestRectangleArea(self, heights): :type heights: List[int] :rtype: int - def maximalRectangle(self, matrix): :type matrix: List[List[str]] :rtype: int <|skeleton|> class ...
635af6e22aa8eef8e7920a585d43a45a891a8157
<|skeleton|> class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" <|body_0|> def maximalRectangle(self, matrix): """:type matrix: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def largestRectangleArea(self, heights): """:type heights: List[int] :rtype: int""" maxArea = 0 hist = [] i = 0 while i < len(heights): if not hist or heights[hist[-1]] <= heights[i]: hist.append(i) i += 1 ...
the_stack_v2_python_sparse
code85MaximalRectangle.py
cybelewang/leetcode-python
train
0
2ef5a697b1f5d3a1870f107696efcbf58e5e0c73
[ "try:\n courses = (yield Course.get_courses_from_ids(self.handler.room.courses))\n ids = {c['user_id'] for c in courses}\n names = (yield {id_: User.get_name(id_) for id_ in ids})\n for course in courses:\n course['owner'] = names[course['user_id']]\n del course['user_id']\n self.pub_su...
<|body_start_0|> try: courses = (yield Course.get_courses_from_ids(self.handler.room.courses)) ids = {c['user_id'] for c in courses} names = (yield {id_: User.get_name(id_) for id_ in ids}) for course in courses: course['owner'] = names[course['use...
CoursesWSC
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoursesWSC: def send_room_courses(self, message): """Send current room's courses to the client. This method is subscribed to the ``courses.room.get`` message type. The ``user_id`` field of each course is replaced by the ``owner`` field. The ``owner`` field contains the name of the user, ...
stack_v2_sparse_classes_10k_train_000731
2,550
no_license
[ { "docstring": "Send current room's courses to the client. This method is subscribed to the ``courses.room.get`` message type. The ``user_id`` field of each course is replaced by the ``owner`` field. The ``owner`` field contains the name of the user, instead of it's ID. :param dict message: The client's message...
2
stack_v2_sparse_classes_30k_train_002484
Implement the Python class `CoursesWSC` described below. Class description: Implement the CoursesWSC class. Method signatures and docstrings: - def send_room_courses(self, message): Send current room's courses to the client. This method is subscribed to the ``courses.room.get`` message type. The ``user_id`` field of ...
Implement the Python class `CoursesWSC` described below. Class description: Implement the CoursesWSC class. Method signatures and docstrings: - def send_room_courses(self, message): Send current room's courses to the client. This method is subscribed to the ``courses.room.get`` message type. The ``user_id`` field of ...
bc3870f809ad43feb78fbc39e7a4cead62207b27
<|skeleton|> class CoursesWSC: def send_room_courses(self, message): """Send current room's courses to the client. This method is subscribed to the ``courses.room.get`` message type. The ``user_id`` field of each course is replaced by the ``owner`` field. The ``owner`` field contains the name of the user, ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CoursesWSC: def send_room_courses(self, message): """Send current room's courses to the client. This method is subscribed to the ``courses.room.get`` message type. The ``user_id`` field of each course is replaced by the ``owner`` field. The ``owner`` field contains the name of the user, instead of it'...
the_stack_v2_python_sparse
backend_modules/courses/wsclass.py
pipegreyback/artificialAlan
train
1
0253a1abeaa438a51e1fdcc8141b1615475d9bd1
[ "if isinstance(models, dict):\n included_models = {model: val for model, val in models.items() if model in included_model_types}\n missing_models = set(included_model_types) - set(included_models.keys())\nelif isinstance(models, list):\n included_models = [model for model in models if model in included_mod...
<|body_start_0|> if isinstance(models, dict): included_models = {model: val for model, val in models.items() if model in included_model_types} missing_models = set(included_model_types) - set(included_models.keys()) elif isinstance(models, list): included_models = [mo...
Class to filter models given user requirements
ModelFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelFilter: """Class to filter models given user requirements""" def include_models(models: Union[Dict[str, Any], List[str]], included_model_types: List[str]) -> Union[Dict[str, Any], List[str]]: """Only include models specified in `included_model_types`, other models will be remove...
stack_v2_sparse_classes_10k_train_000732
4,609
permissive
[ { "docstring": "Only include models specified in `included_model_types`, other models will be removed If model specified in `included_model_types` doesn't present in `models`, will warn users and ignore Parameters ---------- models: Union[Dict[str, Any], List[str]] A dictionary containing models and their hyper...
3
null
Implement the Python class `ModelFilter` described below. Class description: Class to filter models given user requirements Method signatures and docstrings: - def include_models(models: Union[Dict[str, Any], List[str]], included_model_types: List[str]) -> Union[Dict[str, Any], List[str]]: Only include models specifi...
Implement the Python class `ModelFilter` described below. Class description: Class to filter models given user requirements Method signatures and docstrings: - def include_models(models: Union[Dict[str, Any], List[str]], included_model_types: List[str]) -> Union[Dict[str, Any], List[str]]: Only include models specifi...
6af92e149491f6e5062495d87306b3625d12d992
<|skeleton|> class ModelFilter: """Class to filter models given user requirements""" def include_models(models: Union[Dict[str, Any], List[str]], included_model_types: List[str]) -> Union[Dict[str, Any], List[str]]: """Only include models specified in `included_model_types`, other models will be remove...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModelFilter: """Class to filter models given user requirements""" def include_models(models: Union[Dict[str, Any], List[str]], included_model_types: List[str]) -> Union[Dict[str, Any], List[str]]: """Only include models specified in `included_model_types`, other models will be removed If model sp...
the_stack_v2_python_sparse
common/src/autogluon/common/model_filter/_model_filter.py
stjordanis/autogluon
train
0
da07c5ea03b747c7333afc677373ed9bbf657aac
[ "res = []\n\ndef dfs(root):\n if root is None:\n res.append('N')\n return\n res.append(str(root.val))\n dfs(root.left)\n dfs(root.right)\ndfs(root)\nres = ','.join(res)\nreturn res", "data = data.split(',')\nself.idx = 0\n\ndef dfs():\n if data[self.idx] == 'N':\n self.idx += 1...
<|body_start_0|> res = [] def dfs(root): if root is None: res.append('N') return res.append(str(root.val)) dfs(root.left) dfs(root.right) dfs(root) res = ','.join(res) return res <|end_body_0|> <|bo...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_000733
1,410
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_003736
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
86875d7436a78420591a60b716acd2780287b4a8
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" res = [] def dfs(root): if root is None: res.append('N') return res.append(str(root.val)) dfs(root.left) ...
the_stack_v2_python_sparse
leetcode/LeetCode-150/Trees/297-Serialize-and-Deserialize-Binary-Tree.py
hrishikeshtak/Coding_Practises_Solutions
train
0
3e889150e6eb1ea1efac6e168fe3e5e0dde6c8bf
[ "self.player1 = player1\nself.player2 = player2\nself.game = game\nself.display = display", "players = [self.player1, self.player1, self.player1]\ncurPlayer = 1\nboard = self.game.getInitBoard_fix_sonet(sonete, sequences, nround)\nit = 0\nwhile self.game.getGameEnded(board, curPlayer) == 0:\n it += 1\n if v...
<|body_start_0|> self.player1 = player1 self.player2 = player2 self.game = game self.display = display <|end_body_0|> <|body_start_1|> players = [self.player1, self.player1, self.player1] curPlayer = 1 board = self.game.getInitBoard_fix_sonet(sonete, sequences, n...
An Arena class where any 2 agents can be pit against each other.
Arena
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Arena: """An Arena class where any 2 agents can be pit against each other.""" def __init__(self, player1, player2, game, display=None): """Input: player 1,2: two functions that takes board as input, return action game: Game object display: a function that takes board as input and pri...
stack_v2_sparse_classes_10k_train_000734
3,337
permissive
[ { "docstring": "Input: player 1,2: two functions that takes board as input, return action game: Game object display: a function that takes board as input and prints it (e.g. display in othello/OthelloGame). Is necessary for verbose mode. see othello/OthelloPlayers.py for an example. See pit.py for pitting human...
3
stack_v2_sparse_classes_30k_val_000000
Implement the Python class `Arena` described below. Class description: An Arena class where any 2 agents can be pit against each other. Method signatures and docstrings: - def __init__(self, player1, player2, game, display=None): Input: player 1,2: two functions that takes board as input, return action game: Game obj...
Implement the Python class `Arena` described below. Class description: An Arena class where any 2 agents can be pit against each other. Method signatures and docstrings: - def __init__(self, player1, player2, game, display=None): Input: player 1,2: two functions that takes board as input, return action game: Game obj...
2ba6f153e428227fcf6f27080bdd0183d395ef64
<|skeleton|> class Arena: """An Arena class where any 2 agents can be pit against each other.""" def __init__(self, player1, player2, game, display=None): """Input: player 1,2: two functions that takes board as input, return action game: Game object display: a function that takes board as input and pri...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Arena: """An Arena class where any 2 agents can be pit against each other.""" def __init__(self, player1, player2, game, display=None): """Input: player 1,2: two functions that takes board as input, return action game: Game object display: a function that takes board as input and prints it (e.g. ...
the_stack_v2_python_sparse
alpha-zero-general_one_step/Arena_2.py
rubenrtorrado/NLP
train
0
a462a969e0eec08f456f34f64f849b88965c4688
[ "self.index = 0\nself.counter = 0\nself.amount = ''\nself.cs = compressedString\nself.leng = len(compressedString)\nself.char = ''\ni = self.index\nwhile i < self.leng:\n self.char = compressedString[i]\n stringnum = ''\n i += 1\n while not compressedString[i].isalpha():\n stringnum += compressed...
<|body_start_0|> self.index = 0 self.counter = 0 self.amount = '' self.cs = compressedString self.leng = len(compressedString) self.char = '' i = self.index while i < self.leng: self.char = compressedString[i] stringnum = '' ...
StringIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_10k_train_000735
2,237
no_license
[ { "docstring": ":type compressedString: str", "name": "__init__", "signature": "def __init__(self, compressedString)" }, { "docstring": ":rtype: str", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasN...
3
null
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool <|skeleton|> class StringIterator: ...
05d49ca91ac2a4d414dbb38b01266962ce68f34a
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" self.index = 0 self.counter = 0 self.amount = '' self.cs = compressedString self.leng = len(compressedString) self.char = '' i = self.index while i < ...
the_stack_v2_python_sparse
leetcode/contest/2017/june10/604.py
jonathantsang/CompetitiveProgramming
train
2
55abbed335856edce14fdfad7a592c34b81a6378
[ "if isinstance(self.id, str):\n self.id = [self.id]\nif 'entit' in self.data_type.value and 'instance' not in self.data_type.value:\n for id in self.id:\n if '_' not in id:\n print(f'WARNING: {id} not valid for {self.data_type.value}.')\nelif 'instance' in self.data_type.value:\n for id i...
<|body_start_0|> if isinstance(self.id, str): self.id = [self.id] if 'entit' in self.data_type.value and 'instance' not in self.data_type.value: for id in self.id: if '_' not in id: print(f'WARNING: {id} not valid for {self.data_type.value}.') ...
General class that will host various data types, as detailed above.
DataFetcher
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataFetcher: """General class that will host various data types, as detailed above.""" def __post_init__(self): """Check types of IDs given, format accordingly.""" <|body_0|> def add_property(self, property): """Add property to the list of data to fetch from the ...
stack_v2_sparse_classes_10k_train_000736
6,236
permissive
[ { "docstring": "Check types of IDs given, format accordingly.", "name": "__post_init__", "signature": "def __post_init__(self)" }, { "docstring": "Add property to the list of data to fetch from the PDB. property is a python dict, with keys as properties, and values as subproperties. e.g.: {\"cel...
5
stack_v2_sparse_classes_30k_train_003966
Implement the Python class `DataFetcher` described below. Class description: General class that will host various data types, as detailed above. Method signatures and docstrings: - def __post_init__(self): Check types of IDs given, format accordingly. - def add_property(self, property): Add property to the list of da...
Implement the Python class `DataFetcher` described below. Class description: General class that will host various data types, as detailed above. Method signatures and docstrings: - def __post_init__(self): Check types of IDs given, format accordingly. - def add_property(self, property): Add property to the list of da...
386359f91c5e064c0b51966a007c5475403e37a0
<|skeleton|> class DataFetcher: """General class that will host various data types, as detailed above.""" def __post_init__(self): """Check types of IDs given, format accordingly.""" <|body_0|> def add_property(self, property): """Add property to the list of data to fetch from the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataFetcher: """General class that will host various data types, as detailed above.""" def __post_init__(self): """Check types of IDs given, format accordingly.""" if isinstance(self.id, str): self.id = [self.id] if 'entit' in self.data_type.value and 'instance' not in...
the_stack_v2_python_sparse
pypdb/clients/data/data_types.py
williamgilpin/pypdb
train
268
8413b45f0f4d872fe6755e67ff45a7e0316747ae
[ "self.nums = []\nself.values = []\nfor i in range(0, len(A), 2):\n self.nums.append(A[i])\n self.values.append(A[i + 1])\nself.off = 0\nfor i in range(1, len(self.nums)):\n self.nums[i] += self.nums[i - 1]\nself.lo = 0", "if self.off > self.nums[-1]:\n return -1\nself.off += n\nif self.off > self.nums...
<|body_start_0|> self.nums = [] self.values = [] for i in range(0, len(A), 2): self.nums.append(A[i]) self.values.append(A[i + 1]) self.off = 0 for i in range(1, len(self.nums)): self.nums[i] += self.nums[i - 1] self.lo = 0 <|end_body_0...
RLEIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.nums = [] self.values = [] for i in range(0, len(A), 2): ...
stack_v2_sparse_classes_10k_train_000737
827
no_license
[ { "docstring": ":type A: List[int]", "name": "__init__", "signature": "def __init__(self, A)" }, { "docstring": ":type n: int :rtype: int", "name": "next", "signature": "def next(self, n)" } ]
2
null
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int
Implement the Python class `RLEIterator` described below. Class description: Implement the RLEIterator class. Method signatures and docstrings: - def __init__(self, A): :type A: List[int] - def next(self, n): :type n: int :rtype: int <|skeleton|> class RLEIterator: def __init__(self, A): """:type A: Lis...
c026f2969c784827fac702b34b07a9268b70b62a
<|skeleton|> class RLEIterator: def __init__(self, A): """:type A: List[int]""" <|body_0|> def next(self, n): """:type n: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RLEIterator: def __init__(self, A): """:type A: List[int]""" self.nums = [] self.values = [] for i in range(0, len(A), 2): self.nums.append(A[i]) self.values.append(A[i + 1]) self.off = 0 for i in range(1, len(self.nums)): sel...
the_stack_v2_python_sparse
codes/contest/leetcode/rle-iterator.py
jiluhu/dirtysalt.github.io
train
0
46cf3286b9b2c65c1cb301a0f2abdc6bb683ae6c
[ "assert batch_size is not None and max_len is not None\nself.src_dataset = src_dataset\nself.src_vocab = src_vocab\nself.tgt_dataset = tgt_dataset\nself.tgt_vocab = tgt_vocab\nself.batch_size = batch_size\nself.max_len = max_len", "src_tgt_dataset = tf.data.Dataset.zip((self.src_dataset, self.tgt_dataset))\nif sh...
<|body_start_0|> assert batch_size is not None and max_len is not None self.src_dataset = src_dataset self.src_vocab = src_vocab self.tgt_dataset = tgt_dataset self.tgt_vocab = tgt_vocab self.batch_size = batch_size self.max_len = max_len <|end_body_0|> <|body_st...
Iterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Iterator: def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None): """Constructs and Iterator for the given Model Note: batch size and datasets can be placeholders""" <|body_0|> def create_iterator(self, shuffle=True, reshu...
stack_v2_sparse_classes_10k_train_000738
6,517
no_license
[ { "docstring": "Constructs and Iterator for the given Model Note: batch size and datasets can be placeholders", "name": "__init__", "signature": "def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None)" }, { "docstring": "Constructs the Trainin...
3
stack_v2_sparse_classes_30k_val_000228
Implement the Python class `Iterator` described below. Class description: Implement the Iterator class. Method signatures and docstrings: - def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None): Constructs and Iterator for the given Model Note: batch size and data...
Implement the Python class `Iterator` described below. Class description: Implement the Iterator class. Method signatures and docstrings: - def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None): Constructs and Iterator for the given Model Note: batch size and data...
271955ab3a5543bdc38c57291d28f4736a5d067a
<|skeleton|> class Iterator: def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None): """Constructs and Iterator for the given Model Note: batch size and datasets can be placeholders""" <|body_0|> def create_iterator(self, shuffle=True, reshu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Iterator: def __init__(self, src_dataset, src_vocab, tgt_dataset=None, tgt_vocab=None, batch_size=None, max_len=None): """Constructs and Iterator for the given Model Note: batch size and datasets can be placeholders""" assert batch_size is not None and max_len is not None self.src_data...
the_stack_v2_python_sparse
tf/nmt/utils/iterator_utils.py
oneTimePad/neural_networks
train
1
d1fb5f84538822f6219b18608e3ece32372eef08
[ "super().__init__(max_n_sources)\nif use_band is None and (not use_mean):\n raise ValueError(\"Either set 'use_mean=True' OR indicate a 'use_band' index\")\nif use_band is not None and use_mean:\n raise ValueError(\"Only one of the parameters 'use_band' and 'use_mean' has to be set\")\nself.use_mean = use_mea...
<|body_start_0|> super().__init__(max_n_sources) if use_band is None and (not use_mean): raise ValueError("Either set 'use_mean=True' OR indicate a 'use_band' index") if use_band is not None and use_mean: raise ValueError("Only one of the parameters 'use_band' and 'use_me...
Return detection, segmentation and deblending information running SEP on a single band. The function performs detection and deblending of the sources based on the provided band index. If `use_mean` feature is used, then we use the average of all the bands. For more details on SEP (Source-Extractor Python), see: https:/...
SepSingleBand
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SepSingleBand: """Return detection, segmentation and deblending information running SEP on a single band. The function performs detection and deblending of the sources based on the provided band index. If `use_mean` feature is used, then we use the average of all the bands. For more details on SE...
stack_v2_sparse_classes_10k_train_000739
24,907
permissive
[ { "docstring": "Initializes measurement class. Exactly one of 'use_mean' or 'use_band' must be specified. Args: max_n_sources: See parent class. thresh: Threshold pixel value for detection use in `sep.extract`. This is interpreted as a relative threshold: the absolute threshold at pixel (j, i) will be `thresh *...
2
stack_v2_sparse_classes_30k_train_002148
Implement the Python class `SepSingleBand` described below. Class description: Return detection, segmentation and deblending information running SEP on a single band. The function performs detection and deblending of the sources based on the provided band index. If `use_mean` feature is used, then we use the average o...
Implement the Python class `SepSingleBand` described below. Class description: Return detection, segmentation and deblending information running SEP on a single band. The function performs detection and deblending of the sources based on the provided band index. If `use_mean` feature is used, then we use the average o...
f5b716a373f130238100db8980aa0d282822983a
<|skeleton|> class SepSingleBand: """Return detection, segmentation and deblending information running SEP on a single band. The function performs detection and deblending of the sources based on the provided band index. If `use_mean` feature is used, then we use the average of all the bands. For more details on SE...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SepSingleBand: """Return detection, segmentation and deblending information running SEP on a single band. The function performs detection and deblending of the sources based on the provided band index. If `use_mean` feature is used, then we use the average of all the bands. For more details on SEP (Source-Ext...
the_stack_v2_python_sparse
btk/deblend.py
LSSTDESC/BlendingToolKit
train
22
cdc578138d2b4d7413dcd6cdffb9d7717708b746
[ "r = [str(len(strs))]\nfor s in strs:\n r.append(str(len(s)))\n r.append(s)\nreturn ' '.join(r)", "q = 0\np = s.find(' ')\np = p if p > 0 else len(s)\nlistlen = int(s[q:p])\nstrs = []\nfor _ in xrange(listlen):\n q = p + 1\n p = s.find(' ', q)\n strlen = int(s[q:p])\n q = p + 1\n p = q + strl...
<|body_start_0|> r = [str(len(strs))] for s in strs: r.append(str(len(s))) r.append(s) return ' '.join(r) <|end_body_0|> <|body_start_1|> q = 0 p = s.find(' ') p = p if p > 0 else len(s) listlen = int(s[q:p]) strs = [] for ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k_train_000740
877
no_license
[ { "docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str", "name": "encode", "signature": "def encode(self, strs)" }, { "docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]", "name": "decode", "signature": "def ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str - def decode(self, s): Decodes a single string to a list of strings. :type s: st...
20580185c6f72f3c09a725168af48893156161f5
<|skeleton|> class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" <|body_0|> def decode(self, s): """Decodes a single string to a list of strings. :type s: str :rtype: List[str]""" <|body_1|> <|end_skeleton|...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, strs): """Encodes a list of strings to a single string. :type strs: List[str] :rtype: str""" r = [str(len(strs))] for s in strs: r.append(str(len(s))) r.append(s) return ' '.join(r) def decode(self, s): """Decodes a s...
the_stack_v2_python_sparse
coding/00271-encode-decode-str/solution.py
misaka-10032/leetcode
train
3
e5d1fbd725e3dcfa1fa4c667e06a871641547634
[ "user = User.objects.create_user(username='some_username', password='some_password', email='some_email@gmail.com')\nProfile.objects.create_player(username='some_username')\ndata = {'username': 'some_username', 'password': 'some_password'}\nresponse = self.client.post(self.url, data)\nself.assertEqual(response.statu...
<|body_start_0|> user = User.objects.create_user(username='some_username', password='some_password', email='some_email@gmail.com') Profile.objects.create_player(username='some_username') data = {'username': 'some_username', 'password': 'some_password'} response = self.client.post(self.ur...
UserAuthenticationTests
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserAuthenticationTests: def test_valid_user_auth(self): """Ensure we get token in case of correct credentials""" <|body_0|> def test_invalid_user_auth(self): """Ensure we do not get token in case of wrong credentials""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_000741
13,549
permissive
[ { "docstring": "Ensure we get token in case of correct credentials", "name": "test_valid_user_auth", "signature": "def test_valid_user_auth(self)" }, { "docstring": "Ensure we do not get token in case of wrong credentials", "name": "test_invalid_user_auth", "signature": "def test_invalid...
2
stack_v2_sparse_classes_30k_train_005866
Implement the Python class `UserAuthenticationTests` described below. Class description: Implement the UserAuthenticationTests class. Method signatures and docstrings: - def test_valid_user_auth(self): Ensure we get token in case of correct credentials - def test_invalid_user_auth(self): Ensure we do not get token in...
Implement the Python class `UserAuthenticationTests` described below. Class description: Implement the UserAuthenticationTests class. Method signatures and docstrings: - def test_valid_user_auth(self): Ensure we get token in case of correct credentials - def test_invalid_user_auth(self): Ensure we do not get token in...
9fa31e01c8fc3496f92540081a8c078474d59c0f
<|skeleton|> class UserAuthenticationTests: def test_valid_user_auth(self): """Ensure we get token in case of correct credentials""" <|body_0|> def test_invalid_user_auth(self): """Ensure we do not get token in case of wrong credentials""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UserAuthenticationTests: def test_valid_user_auth(self): """Ensure we get token in case of correct credentials""" user = User.objects.create_user(username='some_username', password='some_password', email='some_email@gmail.com') Profile.objects.create_player(username='some_username') ...
the_stack_v2_python_sparse
player/tests.py
apoorvaeternity/DirectMe
train
1
cbeccddb5d6c8d11f1e7abc36756e6213413386c
[ "self.first_register = False\ndecorator_name = ''.join(('@', Implement.__name__.lower()))\nself.decorator_name = decorator_name\nself.args = args\nself.kwargs = kwargs\nself.scope = CONTEXT.in_pycompss()\nself.core_element = None\nself.core_element_configured = False\nif self.scope:\n check_arguments(MANDATORY_A...
<|body_start_0|> self.first_register = False decorator_name = ''.join(('@', Implement.__name__.lower())) self.decorator_name = decorator_name self.args = args self.kwargs = kwargs self.scope = CONTEXT.in_pycompss() self.core_element = None self.core_elemen...
Implement decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on implementation task creation.
Implement
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Implement: """Implement decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on implementation task creation.""" def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: """Store arguments passed to the decorat...
stack_v2_sparse_classes_10k_train_000742
6,895
permissive
[ { "docstring": "Store arguments passed to the decorator. self = itself. args = not used. kwargs = dictionary with the given implement parameters. :param args: Arguments. :param kwargs: Keyword arguments.", "name": "__init__", "signature": "def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> N...
3
stack_v2_sparse_classes_30k_train_006366
Implement the Python class `Implement` described below. Class description: Implement decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on implementation task creation. Method signatures and docstrings: - def __init__(self, *args: typing.Any, **kwargs: t...
Implement the Python class `Implement` described below. Class description: Implement decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on implementation task creation. Method signatures and docstrings: - def __init__(self, *args: typing.Any, **kwargs: t...
5f7a31436d0e6f5acbeb66fa36ab8aad18dc4092
<|skeleton|> class Implement: """Implement decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on implementation task creation.""" def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: """Store arguments passed to the decorat...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Implement: """Implement decorator class. This decorator also preserves the argspec, but includes the __init__ and __call__ methods, useful on implementation task creation.""" def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: """Store arguments passed to the decorator. self = it...
the_stack_v2_python_sparse
compss/programming_model/bindings/python/src/pycompss/api/implement.py
bsc-wdc/compss
train
39
2ae1bf7118a0e407bcfd215da6c9f87518f22f02
[ "def build_string(root):\n if not root:\n return ['#']\n return [str(root.val)] + build_string(root.left) + build_string(root.right)\nreturn ','.join(build_string(root))", "def build_tree(values):\n value = values.popleft()\n if value == '#':\n return None\n root = TreeNode(value)\n ...
<|body_start_0|> def build_string(root): if not root: return ['#'] return [str(root.val)] + build_string(root.left) + build_string(root.right) return ','.join(build_string(root)) <|end_body_0|> <|body_start_1|> def build_tree(values): value = ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_000743
1,884
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
086b7c9b3651a0e70c5794f6c264eb975cc90363
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def build_string(root): if not root: return ['#'] return [str(root.val)] + build_string(root.left) + build_string(root.right) return ','.j...
the_stack_v2_python_sparse
serialize_and_deserialize_binary_tree.py
chunweiliu/leetcode2
train
4
52b95326eb5183ab8628d0a34c59b46b9fe72bec
[ "if len(inputFiles) == 0:\n self.inputFiles = glob.glob('z_ls-R_contents-*.txt')\nelse:\n self.inputFiles = list(inputFiles)\nself.process()", "for i, inputFile in enumerate(self.inputFiles):\n seqInputFile = i + 1\n print(str(seqInputFile) + ' Processing ' + inputFile)\n newText = ''\n saveAppl...
<|body_start_0|> if len(inputFiles) == 0: self.inputFiles = glob.glob('z_ls-R_contents-*.txt') else: self.inputFiles = list(inputFiles) self.process() <|end_body_0|> <|body_start_1|> for i, inputFile in enumerate(self.inputFiles): seqInputFile = i + 1...
FileSizeMinimizer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileSizeMinimizer: def __init__(self, inputFiles=[]): """:param inputFiles:""" <|body_0|> def process(self): """:return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if len(inputFiles) == 0: self.inputFiles = glob.glob('z_ls-R_content...
stack_v2_sparse_classes_10k_train_000744
3,244
no_license
[ { "docstring": ":param inputFiles:", "name": "__init__", "signature": "def __init__(self, inputFiles=[])" }, { "docstring": ":return:", "name": "process", "signature": "def process(self)" } ]
2
stack_v2_sparse_classes_30k_train_003715
Implement the Python class `FileSizeMinimizer` described below. Class description: Implement the FileSizeMinimizer class. Method signatures and docstrings: - def __init__(self, inputFiles=[]): :param inputFiles: - def process(self): :return:
Implement the Python class `FileSizeMinimizer` described below. Class description: Implement the FileSizeMinimizer class. Method signatures and docstrings: - def __init__(self, inputFiles=[]): :param inputFiles: - def process(self): :return: <|skeleton|> class FileSizeMinimizer: def __init__(self, inputFiles=[]...
b4c5642c8d5843846d529630f8d93a7103676539
<|skeleton|> class FileSizeMinimizer: def __init__(self, inputFiles=[]): """:param inputFiles:""" <|body_0|> def process(self): """:return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileSizeMinimizer: def __init__(self, inputFiles=[]): """:param inputFiles:""" if len(inputFiles) == 0: self.inputFiles = glob.glob('z_ls-R_contents-*.txt') else: self.inputFiles = list(inputFiles) self.process() def process(self): """:retur...
the_stack_v2_python_sparse
uTubeCompressContentsTxt.py
alclass/bin
train
0
2c94347df29165ac2a5109083de89f3ed8cec80b
[ "try:\n customer, _created = Customer.get_or_create(subscriber=subscriber_request_callback(self.request))\n serializer = SubscriptionSerializer(customer.subscription)\n return Response(serializer.data)\nexcept:\n return Response(status=status.HTTP_204_NO_CONTENT)", "serializer = CreateSubscriptionSeri...
<|body_start_0|> try: customer, _created = Customer.get_or_create(subscriber=subscriber_request_callback(self.request)) serializer = SubscriptionSerializer(customer.subscription) return Response(serializer.data) except: return Response(status=status.HTTP_2...
API Endpoints for the Subscription object.
SubscriptionRestView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SubscriptionRestView: """API Endpoints for the Subscription object.""" def get(self, request, **kwargs): """Return the customer's valid subscriptions. Returns with status code 200.""" <|body_0|> def post(self, request, **kwargs): """Create a new current subscript...
stack_v2_sparse_classes_10k_train_000745
4,950
permissive
[ { "docstring": "Return the customer's valid subscriptions. Returns with status code 200.", "name": "get", "signature": "def get(self, request, **kwargs)" }, { "docstring": "Create a new current subscription for the user. Returns with status code 201.", "name": "post", "signature": "def p...
3
stack_v2_sparse_classes_30k_train_000714
Implement the Python class `SubscriptionRestView` described below. Class description: API Endpoints for the Subscription object. Method signatures and docstrings: - def get(self, request, **kwargs): Return the customer's valid subscriptions. Returns with status code 200. - def post(self, request, **kwargs): Create a ...
Implement the Python class `SubscriptionRestView` described below. Class description: API Endpoints for the Subscription object. Method signatures and docstrings: - def get(self, request, **kwargs): Return the customer's valid subscriptions. Returns with status code 200. - def post(self, request, **kwargs): Create a ...
325cc11fbc28eee7507778e387714e9465880d68
<|skeleton|> class SubscriptionRestView: """API Endpoints for the Subscription object.""" def get(self, request, **kwargs): """Return the customer's valid subscriptions. Returns with status code 200.""" <|body_0|> def post(self, request, **kwargs): """Create a new current subscript...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SubscriptionRestView: """API Endpoints for the Subscription object.""" def get(self, request, **kwargs): """Return the customer's valid subscriptions. Returns with status code 200.""" try: customer, _created = Customer.get_or_create(subscriber=subscriber_request_callback(self....
the_stack_v2_python_sparse
djstripe/contrib/rest_framework/views.py
talpor/dj-stripe
train
1
bb0c5155111e0c6ad0be0dcc95af68e9fde7e24b
[ "response = self.client.get(reverse('education:demographic_detail', args=('XYZ',)))\nself.assertEqual(response.status_code, 200)\nself.assertEqual(response.context.get('json_rate_data'), None)\nself.assertNotEqual(response.context.get('message'), None)\nself.assertContains(response, 'Home')\nself.assertContains(res...
<|body_start_0|> response = self.client.get(reverse('education:demographic_detail', args=('XYZ',))) self.assertEqual(response.status_code, 200) self.assertEqual(response.context.get('json_rate_data'), None) self.assertNotEqual(response.context.get('message'), None) self.assertCon...
EducationDemographicDetailsViewTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EducationDemographicDetailsViewTest: def test_fake_group(self): """Make sure the page gives an error message if a group is specified that does not actually exist.""" <|body_0|> def test_no_data(self): """Make sure all demographic pages render even when there is no da...
stack_v2_sparse_classes_10k_train_000746
9,266
no_license
[ { "docstring": "Make sure the page gives an error message if a group is specified that does not actually exist.", "name": "test_fake_group", "signature": "def test_fake_group(self)" }, { "docstring": "Make sure all demographic pages render even when there is no data in the database.", "name"...
3
stack_v2_sparse_classes_30k_train_004881
Implement the Python class `EducationDemographicDetailsViewTest` described below. Class description: Implement the EducationDemographicDetailsViewTest class. Method signatures and docstrings: - def test_fake_group(self): Make sure the page gives an error message if a group is specified that does not actually exist. -...
Implement the Python class `EducationDemographicDetailsViewTest` described below. Class description: Implement the EducationDemographicDetailsViewTest class. Method signatures and docstrings: - def test_fake_group(self): Make sure the page gives an error message if a group is specified that does not actually exist. -...
2a8e2dc4e9b3cb92d4d437b37e61940a9486b81f
<|skeleton|> class EducationDemographicDetailsViewTest: def test_fake_group(self): """Make sure the page gives an error message if a group is specified that does not actually exist.""" <|body_0|> def test_no_data(self): """Make sure all demographic pages render even when there is no da...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EducationDemographicDetailsViewTest: def test_fake_group(self): """Make sure the page gives an error message if a group is specified that does not actually exist.""" response = self.client.get(reverse('education:demographic_detail', args=('XYZ',))) self.assertEqual(response.status_code...
the_stack_v2_python_sparse
education/tests.py
smeds1/mysite
train
1
cab1175a1f05b916f942b1f7256aeebfa52af0fa
[ "super(IPAMAddressPool, self).__init__()\nself.schema_class = 'ipam_address_pool_schema.IPAMAddressPoolSchema'\nself.set_connection(vsm.get_connection())\nself.set_create_endpoint('/services/ipam/pools/scope/globalroot-0')\nself.set_read_endpoint('/services/ipam/pools')\nself.set_delete_endpoint('/services/ipam/poo...
<|body_start_0|> super(IPAMAddressPool, self).__init__() self.schema_class = 'ipam_address_pool_schema.IPAMAddressPoolSchema' self.set_connection(vsm.get_connection()) self.set_create_endpoint('/services/ipam/pools/scope/globalroot-0') self.set_read_endpoint('/services/ipam/pools...
IPAMAddressPool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IPAMAddressPool: def __init__(self, vsm): """Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured""" <|body_0|> def delete(self, schema_object=None, url_parameters=None): """When delete ippool, the sch...
stack_v2_sparse_classes_10k_train_000747
2,254
no_license
[ { "docstring": "Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured", "name": "__init__", "signature": "def __init__(self, vsm)" }, { "docstring": "When delete ippool, the scheam_obj should be set None.", "name": "delete", ...
2
stack_v2_sparse_classes_30k_train_000692
Implement the Python class `IPAMAddressPool` described below. Class description: Implement the IPAMAddressPool class. Method signatures and docstrings: - def __init__(self, vsm): Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured - def delete(self, s...
Implement the Python class `IPAMAddressPool` described below. Class description: Implement the IPAMAddressPool class. Method signatures and docstrings: - def __init__(self, vsm): Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured - def delete(self, s...
5b55817c050b637e2747084290f6206d2e622938
<|skeleton|> class IPAMAddressPool: def __init__(self, vsm): """Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured""" <|body_0|> def delete(self, schema_object=None, url_parameters=None): """When delete ippool, the sch...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IPAMAddressPool: def __init__(self, vsm): """Constructor to create IPAMAddressPool managed object @param vsm object on which IPAM address pool has to be configured""" super(IPAMAddressPool, self).__init__() self.schema_class = 'ipam_address_pool_schema.IPAMAddressPoolSchema' se...
the_stack_v2_python_sparse
SystemTesting/pylib/nsx/vsm/ipam_address_pool/ipam_address_pool.py
Cloudxtreme/MyProject
train
0
7d7bdccc4bd70b6cf6830b6d0d9fafa1fdcbdc5b
[ "self.nc_file = nc_file\nxr_variables, global_attributes = self._readXarrayFile(var_ids, exclude_vars)\nsuper().__init__(xr_variables, global_attributes=global_attributes, na_items_to_override=na_items_to_override, only_return_file_names=only_return_file_names, requested_ffi=requested_ffi)", "exclude_vars = exclu...
<|body_start_0|> self.nc_file = nc_file xr_variables, global_attributes = self._readXarrayFile(var_ids, exclude_vars) super().__init__(xr_variables, global_attributes=global_attributes, na_items_to_override=na_items_to_override, only_return_file_names=only_return_file_names, requested_ffi=reques...
Converts a NetCDF file to one or more NASA Ames files.
NCToNA
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NCToNA: """Converts a NetCDF file to one or more NASA Ames files.""" def __init__(self, nc_file, var_ids=None, na_items_to_override=None, only_return_file_names=False, exclude_vars=None, requested_ffi=None): """Sets up instance variables. Typical usage is: >>> import nappy.nc_interfa...
stack_v2_sparse_classes_10k_train_000748
3,661
permissive
[ { "docstring": "Sets up instance variables. Typical usage is: >>> import nappy.nc_interface.nc_to_na as nc_to_na >>> c = nc_to_na.NCToNA(\"old_file.nc\") >>> c.convert() >>> c.writeNAFiles(\"new_file.na\", delimiter=\",\") OR: >>> c = nc_to_na.NCToNA(\"old_file.nc\") >>> file_names = c.constructNAFileNames()", ...
2
stack_v2_sparse_classes_30k_train_000723
Implement the Python class `NCToNA` described below. Class description: Converts a NetCDF file to one or more NASA Ames files. Method signatures and docstrings: - def __init__(self, nc_file, var_ids=None, na_items_to_override=None, only_return_file_names=False, exclude_vars=None, requested_ffi=None): Sets up instance...
Implement the Python class `NCToNA` described below. Class description: Converts a NetCDF file to one or more NASA Ames files. Method signatures and docstrings: - def __init__(self, nc_file, var_ids=None, na_items_to_override=None, only_return_file_names=False, exclude_vars=None, requested_ffi=None): Sets up instance...
71e42a91112f52eef86183e35129b9ee2019e55b
<|skeleton|> class NCToNA: """Converts a NetCDF file to one or more NASA Ames files.""" def __init__(self, nc_file, var_ids=None, na_items_to_override=None, only_return_file_names=False, exclude_vars=None, requested_ffi=None): """Sets up instance variables. Typical usage is: >>> import nappy.nc_interfa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NCToNA: """Converts a NetCDF file to one or more NASA Ames files.""" def __init__(self, nc_file, var_ids=None, na_items_to_override=None, only_return_file_names=False, exclude_vars=None, requested_ffi=None): """Sets up instance variables. Typical usage is: >>> import nappy.nc_interface.nc_to_na a...
the_stack_v2_python_sparse
nappy/nc_interface/nc_to_na.py
cedadev/nappy
train
9
fb8278608e00a9762c37261d6e5d43f91f5995f1
[ "if isinstance(rules, str):\n rules = re.split('\\\\s|,\\\\s*', rules)\npositive_rules = [rule for rule in rules if not rule.startswith('!') and (not rule.strip() == '')]\nnegative_rules = [rule[1:] for rule in rules if rule not in positive_rules]\nif len(positive_rules) == 0:\n positive_rules.append('*')\nma...
<|body_start_0|> if isinstance(rules, str): rules = re.split('\\s|,\\s*', rules) positive_rules = [rule for rule in rules if not rule.startswith('!') and (not rule.strip() == '')] negative_rules = [rule[1:] for rule in rules if rule not in positive_rules] if len(positive_rule...
Device name matching against the devices specification in tuning profiles. The devices specification consists of multiple rules separated by spaces. The rules have a syntax of shell-style wildcards and are either positive or negative. The negative rules are prefixed with an exclamation mark.
DeviceMatcher
[ "GPL-2.0-or-later", "CC-BY-SA-3.0", "GPL-2.0-only", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DeviceMatcher: """Device name matching against the devices specification in tuning profiles. The devices specification consists of multiple rules separated by spaces. The rules have a syntax of shell-style wildcards and are either positive or negative. The negative rules are prefixed with an excl...
stack_v2_sparse_classes_10k_train_000749
1,576
permissive
[ { "docstring": "Match a device against the specification in the profile. If there is no positive rule in the specification, implicit rule which matches all devices is added. The device matches if and only if it matches some positive rule, but no negative rule.", "name": "match", "signature": "def match(...
2
stack_v2_sparse_classes_30k_train_004666
Implement the Python class `DeviceMatcher` described below. Class description: Device name matching against the devices specification in tuning profiles. The devices specification consists of multiple rules separated by spaces. The rules have a syntax of shell-style wildcards and are either positive or negative. The n...
Implement the Python class `DeviceMatcher` described below. Class description: Device name matching against the devices specification in tuning profiles. The devices specification consists of multiple rules separated by spaces. The rules have a syntax of shell-style wildcards and are either positive or negative. The n...
6784795578ba558593cc9f620610bcf99fb26de5
<|skeleton|> class DeviceMatcher: """Device name matching against the devices specification in tuning profiles. The devices specification consists of multiple rules separated by spaces. The rules have a syntax of shell-style wildcards and are either positive or negative. The negative rules are prefixed with an excl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DeviceMatcher: """Device name matching against the devices specification in tuning profiles. The devices specification consists of multiple rules separated by spaces. The rules have a syntax of shell-style wildcards and are either positive or negative. The negative rules are prefixed with an exclamation mark....
the_stack_v2_python_sparse
assets/tuned/daemon/tuned/hardware/device_matcher.py
openshift/cluster-node-tuning-operator
train
90
71534e1658e74b28b9807e2dabc914c65f59002f
[ "self.aws_region = aws_region\nself.bucket_name = bucket_name\nself.key_prefix = key_prefix", "if dictionary is None:\n return None\naws_region = dictionary.get('awsRegion')\nbucket_name = dictionary.get('bucketName')\nkey_prefix = dictionary.get('keyPrefix')\nreturn cls(aws_region, bucket_name, key_prefix)" ]
<|body_start_0|> self.aws_region = aws_region self.bucket_name = bucket_name self.key_prefix = key_prefix <|end_body_0|> <|body_start_1|> if dictionary is None: return None aws_region = dictionary.get('awsRegion') bucket_name = dictionary.get('bucketName') ...
Implementation of the 'S3BucketInfo' model. TODO: type description here. Attributes: aws_region (string): AWS region of the S3 bucket. bucket_name (string): Name of the S3 bucket. key_prefix (string): Complete path of the sub folder in the s3 bucket. This job will create all keys within the given key prefix.
S3BucketInfo
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class S3BucketInfo: """Implementation of the 'S3BucketInfo' model. TODO: type description here. Attributes: aws_region (string): AWS region of the S3 bucket. bucket_name (string): Name of the S3 bucket. key_prefix (string): Complete path of the sub folder in the s3 bucket. This job will create all keys...
stack_v2_sparse_classes_10k_train_000750
1,870
permissive
[ { "docstring": "Constructor for the S3BucketInfo class", "name": "__init__", "signature": "def __init__(self, aws_region=None, bucket_name=None, key_prefix=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of ...
2
null
Implement the Python class `S3BucketInfo` described below. Class description: Implementation of the 'S3BucketInfo' model. TODO: type description here. Attributes: aws_region (string): AWS region of the S3 bucket. bucket_name (string): Name of the S3 bucket. key_prefix (string): Complete path of the sub folder in the s...
Implement the Python class `S3BucketInfo` described below. Class description: Implementation of the 'S3BucketInfo' model. TODO: type description here. Attributes: aws_region (string): AWS region of the S3 bucket. bucket_name (string): Name of the S3 bucket. key_prefix (string): Complete path of the sub folder in the s...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class S3BucketInfo: """Implementation of the 'S3BucketInfo' model. TODO: type description here. Attributes: aws_region (string): AWS region of the S3 bucket. bucket_name (string): Name of the S3 bucket. key_prefix (string): Complete path of the sub folder in the s3 bucket. This job will create all keys...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class S3BucketInfo: """Implementation of the 'S3BucketInfo' model. TODO: type description here. Attributes: aws_region (string): AWS region of the S3 bucket. bucket_name (string): Name of the S3 bucket. key_prefix (string): Complete path of the sub folder in the s3 bucket. This job will create all keys within the g...
the_stack_v2_python_sparse
cohesity_management_sdk/models/s3_bucket_info.py
cohesity/management-sdk-python
train
24
34efde1c8fe38fb5cfe4d603d1e1a693d1a02129
[ "start = self.isodate_param(timezone.now())\nend = self.isodate_param(timezone.now() + datetime.timedelta(days=31))\nself.send_and_compare_request('getActivityStream', [start, end], None, [])\nself.send_and_compare_request('getActivityStream', [start, end], self.data['token1'], [])", "_gen_activities(10)\nactivit...
<|body_start_0|> start = self.isodate_param(timezone.now()) end = self.isodate_param(timezone.now() + datetime.timedelta(days=31)) self.send_and_compare_request('getActivityStream', [start, end], None, []) self.send_and_compare_request('getActivityStream', [start, end], self.data['token1...
GetActivityStreamTest
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetActivityStreamTest: def test_empty(self): """Test the getActivityStream() call without contents.""" <|body_0|> def test_public(self): """Test the getActivityStream() call with public events.""" <|body_1|> def test_private(self): """Test the ge...
stack_v2_sparse_classes_10k_train_000751
17,825
permissive
[ { "docstring": "Test the getActivityStream() call without contents.", "name": "test_empty", "signature": "def test_empty(self)" }, { "docstring": "Test the getActivityStream() call with public events.", "name": "test_public", "signature": "def test_public(self)" }, { "docstring":...
4
null
Implement the Python class `GetActivityStreamTest` described below. Class description: Implement the GetActivityStreamTest class. Method signatures and docstrings: - def test_empty(self): Test the getActivityStream() call without contents. - def test_public(self): Test the getActivityStream() call with public events....
Implement the Python class `GetActivityStreamTest` described below. Class description: Implement the GetActivityStreamTest class. Method signatures and docstrings: - def test_empty(self): Test the getActivityStream() call without contents. - def test_public(self): Test the getActivityStream() call with public events....
5e46b82cab225b452eceffd4a5be6dadccceddd2
<|skeleton|> class GetActivityStreamTest: def test_empty(self): """Test the getActivityStream() call without contents.""" <|body_0|> def test_public(self): """Test the getActivityStream() call with public events.""" <|body_1|> def test_private(self): """Test the ge...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GetActivityStreamTest: def test_empty(self): """Test the getActivityStream() call without contents.""" start = self.isodate_param(timezone.now()) end = self.isodate_param(timezone.now() + datetime.timedelta(days=31)) self.send_and_compare_request('getActivityStream', [start, en...
the_stack_v2_python_sparse
amelie/api/test_activitystream.py
Inter-Actief/amelie
train
11
cd3d1bce5b87f875b31bd963f4a1f6bbccc68708
[ "port = 8773\nconfig = [('ResNetBlockSpace2', {'block_mask': [0]})]\nrlnas = RLNAS(key='lstm', configs=config, server_addr=('', port), is_sync=False, controller_batch_size=1, lstm_num_layers=1, hidden_size=10, temperature=1.0, save_controller=False)\ninput = paddle.static.data(name='input', shape=[None, 3, 32, 32],...
<|body_start_0|> port = 8773 config = [('ResNetBlockSpace2', {'block_mask': [0]})] rlnas = RLNAS(key='lstm', configs=config, server_addr=('', port), is_sync=False, controller_batch_size=1, lstm_num_layers=1, hidden_size=10, temperature=1.0, save_controller=False) input = paddle.static.da...
Test classpaddleslim.nas.RLNAS(key,...)
TestRLNAS
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestRLNAS: """Test classpaddleslim.nas.RLNAS(key,...)""" def test_RLNAS1(self): """classpaddleslim.nas.RLNAS(key, configs, use_gpu=False, server_addr=("", 8881), is_server=True, is_sync=False, save_controller=None, load_controller=None, **kwargs) :return:""" <|body_0|> d...
stack_v2_sparse_classes_10k_train_000752
3,697
no_license
[ { "docstring": "classpaddleslim.nas.RLNAS(key, configs, use_gpu=False, server_addr=(\"\", 8881), is_server=True, is_sync=False, save_controller=None, load_controller=None, **kwargs) :return:", "name": "test_RLNAS1", "signature": "def test_RLNAS1(self)" }, { "docstring": "is_server=False,is_sync=...
3
stack_v2_sparse_classes_30k_test_000095
Implement the Python class `TestRLNAS` described below. Class description: Test classpaddleslim.nas.RLNAS(key,...) Method signatures and docstrings: - def test_RLNAS1(self): classpaddleslim.nas.RLNAS(key, configs, use_gpu=False, server_addr=("", 8881), is_server=True, is_sync=False, save_controller=None, load_control...
Implement the Python class `TestRLNAS` described below. Class description: Test classpaddleslim.nas.RLNAS(key,...) Method signatures and docstrings: - def test_RLNAS1(self): classpaddleslim.nas.RLNAS(key, configs, use_gpu=False, server_addr=("", 8881), is_server=True, is_sync=False, save_controller=None, load_control...
bd3790ce72a2a26611b5eda3901651b5a809348f
<|skeleton|> class TestRLNAS: """Test classpaddleslim.nas.RLNAS(key,...)""" def test_RLNAS1(self): """classpaddleslim.nas.RLNAS(key, configs, use_gpu=False, server_addr=("", 8881), is_server=True, is_sync=False, save_controller=None, load_controller=None, **kwargs) :return:""" <|body_0|> d...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestRLNAS: """Test classpaddleslim.nas.RLNAS(key,...)""" def test_RLNAS1(self): """classpaddleslim.nas.RLNAS(key, configs, use_gpu=False, server_addr=("", 8881), is_server=True, is_sync=False, save_controller=None, load_controller=None, **kwargs) :return:""" port = 8773 config = [...
the_stack_v2_python_sparse
models/PaddleSlim/CI/Slim_CI_all_case/p1_api_case_static/te_api_rl_nas.py
PaddlePaddle/PaddleTest
train
42
20cc3b56e07bbaf04f98f1258f3b0c7e4eb37e44
[ "if cls._driver is None:\n if browser_name == 'Chrome':\n cls._driver = webdriver.Chrome(driverPath['Chrome'])\n elif browser_name == 'Firefox':\n cls._driver = webdriver.Firefox(driverPath['Firefox'])\n cls._driver.maximize_window()\n cls._driver.get(URL)\n cls.__login()\n cls._driv...
<|body_start_0|> if cls._driver is None: if browser_name == 'Chrome': cls._driver = webdriver.Chrome(driverPath['Chrome']) elif browser_name == 'Firefox': cls._driver = webdriver.Firefox(driverPath['Firefox']) cls._driver.maximize_window() ...
浏览器驱动工具类
Driver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Driver: """浏览器驱动工具类""" def get_driver(cls, browser_name='Chrome'): """获取浏览器驱动对象 :param browser_name: :return:""" <|body_0|> def __login(cls): """私有方法, 只能在类里边使用 类外部无法使用, 子类不能继承 解决登录问题 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> if cl...
stack_v2_sparse_classes_10k_train_000753
2,453
no_license
[ { "docstring": "获取浏览器驱动对象 :param browser_name: :return:", "name": "get_driver", "signature": "def get_driver(cls, browser_name='Chrome')" }, { "docstring": "私有方法, 只能在类里边使用 类外部无法使用, 子类不能继承 解决登录问题 :return:", "name": "__login", "signature": "def __login(cls)" } ]
2
stack_v2_sparse_classes_30k_train_006107
Implement the Python class `Driver` described below. Class description: 浏览器驱动工具类 Method signatures and docstrings: - def get_driver(cls, browser_name='Chrome'): 获取浏览器驱动对象 :param browser_name: :return: - def __login(cls): 私有方法, 只能在类里边使用 类外部无法使用, 子类不能继承 解决登录问题 :return:
Implement the Python class `Driver` described below. Class description: 浏览器驱动工具类 Method signatures and docstrings: - def get_driver(cls, browser_name='Chrome'): 获取浏览器驱动对象 :param browser_name: :return: - def __login(cls): 私有方法, 只能在类里边使用 类外部无法使用, 子类不能继承 解决登录问题 :return: <|skeleton|> class Driver: """浏览器驱动工具类""" ...
c777f2f8f532d58577e9f023db38a0d404c3a150
<|skeleton|> class Driver: """浏览器驱动工具类""" def get_driver(cls, browser_name='Chrome'): """获取浏览器驱动对象 :param browser_name: :return:""" <|body_0|> def __login(cls): """私有方法, 只能在类里边使用 类外部无法使用, 子类不能继承 解决登录问题 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Driver: """浏览器驱动工具类""" def get_driver(cls, browser_name='Chrome'): """获取浏览器驱动对象 :param browser_name: :return:""" if cls._driver is None: if browser_name == 'Chrome': cls._driver = webdriver.Chrome(driverPath['Chrome']) elif browser_name == 'Firefox'...
the_stack_v2_python_sparse
day6/day6作业.py
gongzuo666/pycharm.web
train
0
ea8c39bc97a8e417a50e5e3755f7ac3f1c4180d4
[ "self._logger = logging.getLogger('stone.compiler')\nself.api = api\nself.backend_module = backend_module\nself.backend_args = backend_args\nself.build_path = build_path\nif clean_build and os.path.exists(self.build_path):\n logging.info('Cleaning existing build directory %s...', self.build_path)\n shutil.rmt...
<|body_start_0|> self._logger = logging.getLogger('stone.compiler') self.api = api self.backend_module = backend_module self.backend_args = backend_args self.build_path = build_path if clean_build and os.path.exists(self.build_path): logging.info('Cleaning exi...
Applies a collection of backends found in a single backend module to an API specification.
Compiler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Compiler: """Applies a collection of backends found in a single backend module to an API specification.""" def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): """Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param back...
stack_v2_sparse_classes_10k_train_000754
4,380
permissive
[ { "docstring": "Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param backend_module: Python module that contains at least one top-level class definition that descends from a :class:`stone.backend.Backend`. :param list(str) backend_args: A list of command-line arguments to pass to ...
5
stack_v2_sparse_classes_30k_train_006581
Implement the Python class `Compiler` described below. Class description: Applies a collection of backends found in a single backend module to an API specification. Method signatures and docstrings: - def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): Creates a Compiler. :param ston...
Implement the Python class `Compiler` described below. Class description: Applies a collection of backends found in a single backend module to an API specification. Method signatures and docstrings: - def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): Creates a Compiler. :param ston...
0c9ceb748ac4dcdea5ff69c97704daccdcb7e60e
<|skeleton|> class Compiler: """Applies a collection of backends found in a single backend module to an API specification.""" def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): """Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param back...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Compiler: """Applies a collection of backends found in a single backend module to an API specification.""" def __init__(self, api, backend_module, backend_args, build_path, clean_build=False): """Creates a Compiler. :param stone.ir.Api api: A Stone description of the API. :param backend_module: P...
the_stack_v2_python_sparse
stone/compiler.py
dropbox/stone
train
440
4a2686406b220a6c21244889000fa0b7a858aa81
[ "tests = ['test.1', 'test.2']\nexpected = 'test.1:test.2'\nself.assertEqual(test_apps.get_gtest_filter(tests), expected)", "tests = ['test.1', 'test.2']\nexpected = '-test.1:test.2'\nself.assertEqual(test_apps.get_gtest_filter(tests, invert=True), expected)" ]
<|body_start_0|> tests = ['test.1', 'test.2'] expected = 'test.1:test.2' self.assertEqual(test_apps.get_gtest_filter(tests), expected) <|end_body_0|> <|body_start_1|> tests = ['test.1', 'test.2'] expected = '-test.1:test.2' self.assertEqual(test_apps.get_gtest_filter(tes...
Tests for test_runner.get_gtest_filter.
GetGTestFilterTest
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetGTestFilterTest: """Tests for test_runner.get_gtest_filter.""" def test_correct(self): """Ensures correctness of filter.""" <|body_0|> def test_correct_inverted(self): """Ensures correctness of inverted filter.""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_10k_train_000755
1,492
permissive
[ { "docstring": "Ensures correctness of filter.", "name": "test_correct", "signature": "def test_correct(self)" }, { "docstring": "Ensures correctness of inverted filter.", "name": "test_correct_inverted", "signature": "def test_correct_inverted(self)" } ]
2
stack_v2_sparse_classes_30k_train_004818
Implement the Python class `GetGTestFilterTest` described below. Class description: Tests for test_runner.get_gtest_filter. Method signatures and docstrings: - def test_correct(self): Ensures correctness of filter. - def test_correct_inverted(self): Ensures correctness of inverted filter.
Implement the Python class `GetGTestFilterTest` described below. Class description: Tests for test_runner.get_gtest_filter. Method signatures and docstrings: - def test_correct(self): Ensures correctness of filter. - def test_correct_inverted(self): Ensures correctness of inverted filter. <|skeleton|> class GetGTest...
64bee65c921db7e78e25d08f1e98da2668b57be5
<|skeleton|> class GetGTestFilterTest: """Tests for test_runner.get_gtest_filter.""" def test_correct(self): """Ensures correctness of filter.""" <|body_0|> def test_correct_inverted(self): """Ensures correctness of inverted filter.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GetGTestFilterTest: """Tests for test_runner.get_gtest_filter.""" def test_correct(self): """Ensures correctness of filter.""" tests = ['test.1', 'test.2'] expected = 'test.1:test.2' self.assertEqual(test_apps.get_gtest_filter(tests), expected) def test_correct_invert...
the_stack_v2_python_sparse
ios/build/bots/scripts/test_apps_test.py
otcshare/chromium-src
train
18
8bc48e38b4d6a2bed4730d64e8552f6a8041451c
[ "self.output_raw = output_raw\nif isinstance(filter_spec, dict):\n self.output_raw = filter_spec.get('output-raw', output_raw)\n filter_spec = filter_spec.get('script', '.')\nif isinstance(filter_spec, list):\n filter_spec = '\\n'.join([str(line) for line in filter_spec])\nif not isinstance(filter_spec, st...
<|body_start_0|> self.output_raw = output_raw if isinstance(filter_spec, dict): self.output_raw = filter_spec.get('output-raw', output_raw) filter_spec = filter_spec.get('script', '.') if isinstance(filter_spec, list): filter_spec = '\n'.join([str(line) for li...
JQ JSON filter
JQFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class JQFilter: """JQ JSON filter""" def __init__(self, filter_spec='.', args={}, output_raw=False, groom=False): """Construct a filter. Arguments: filter_spec - The JQ script to be used for this filter. This may be any subclass of basestring, a list or a dict. Strings are interpreted dire...
stack_v2_sparse_classes_10k_train_000756
4,966
permissive
[ { "docstring": "Construct a filter. Arguments: filter_spec - The JQ script to be used for this filter. This may be any subclass of basestring, a list or a dict. Strings are interpreted directly, lists are stringified and joined with newlines (to make multi-line scripts readable in JSON) and dicts give their \"s...
2
null
Implement the Python class `JQFilter` described below. Class description: JQ JSON filter Method signatures and docstrings: - def __init__(self, filter_spec='.', args={}, output_raw=False, groom=False): Construct a filter. Arguments: filter_spec - The JQ script to be used for this filter. This may be any subclass of b...
Implement the Python class `JQFilter` described below. Class description: JQ JSON filter Method signatures and docstrings: - def __init__(self, filter_spec='.', args={}, output_raw=False, groom=False): Construct a filter. Arguments: filter_spec - The JQ script to be used for this filter. This may be any subclass of b...
f6d04c0455e5be4d490df16ec1acb377f9025d9f
<|skeleton|> class JQFilter: """JQ JSON filter""" def __init__(self, filter_spec='.', args={}, output_raw=False, groom=False): """Construct a filter. Arguments: filter_spec - The JQ script to be used for this filter. This may be any subclass of basestring, a list or a dict. Strings are interpreted dire...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class JQFilter: """JQ JSON filter""" def __init__(self, filter_spec='.', args={}, output_raw=False, groom=False): """Construct a filter. Arguments: filter_spec - The JQ script to be used for this filter. This may be any subclass of basestring, a list or a dict. Strings are interpreted directly, lists a...
the_stack_v2_python_sparse
python-pscheduler/pscheduler/pscheduler/jqfilter.py
perfsonar/pscheduler
train
53
cc7eba945a11325885ab4dd86da5078746bb3a0c
[ "delete_database()\ntest_import = import_data(self.folder_name, 'inventory.csv', 'customers.csv', 'rental.csv')\nself.assertEqual(test_import, ((7, 9, 7), (0, 0, 0)))\n'test import bad data'\ndelete_database()\ntest_import = import_data(self.folder_name, 'inventory1.csv', 'customers2.csv', 'rental3.csv')\nself.asse...
<|body_start_0|> delete_database() test_import = import_data(self.folder_name, 'inventory.csv', 'customers.csv', 'rental.csv') self.assertEqual(test_import, ((7, 9, 7), (0, 0, 0))) 'test import bad data' delete_database() test_import = import_data(self.folder_name, 'inven...
"test for Mongo database.py
TestDatabase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestDatabase: """"test for Mongo database.py""" def test_import_data(self): """test import all good data""" <|body_0|> def test_show_rentals(self): """test for show_rentals""" <|body_1|> def test_show_available_products(self): """rest for sho...
stack_v2_sparse_classes_10k_train_000757
3,154
no_license
[ { "docstring": "test import all good data", "name": "test_import_data", "signature": "def test_import_data(self)" }, { "docstring": "test for show_rentals", "name": "test_show_rentals", "signature": "def test_show_rentals(self)" }, { "docstring": "rest for show_available_products...
4
stack_v2_sparse_classes_30k_train_004314
Implement the Python class `TestDatabase` described below. Class description: "test for Mongo database.py Method signatures and docstrings: - def test_import_data(self): test import all good data - def test_show_rentals(self): test for show_rentals - def test_show_available_products(self): rest for show_available_pro...
Implement the Python class `TestDatabase` described below. Class description: "test for Mongo database.py Method signatures and docstrings: - def test_import_data(self): test import all good data - def test_show_rentals(self): test for show_rentals - def test_show_available_products(self): rest for show_available_pro...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class TestDatabase: """"test for Mongo database.py""" def test_import_data(self): """test import all good data""" <|body_0|> def test_show_rentals(self): """test for show_rentals""" <|body_1|> def test_show_available_products(self): """rest for sho...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestDatabase: """"test for Mongo database.py""" def test_import_data(self): """test import all good data""" delete_database() test_import = import_data(self.folder_name, 'inventory.csv', 'customers.csv', 'rental.csv') self.assertEqual(test_import, ((7, 9, 7), (0, 0, 0))) ...
the_stack_v2_python_sparse
students/ethan_nguyen/Lesson05/assignment/test_unit.py
JavaRod/SP_Python220B_2019
train
1
236e095119e026f3d122a24d26c154997b812528
[ "super(Atom_Wise_Convolution, self).__init__()\nself.conv_weights = nn.Linear(input_feature, output_feature)\nself.batch_norm = nn.LayerNorm(output_feature)\nself.UseBN = UseBN\nself.activation = Shifted_softplus()\nself.dropout = nn.Dropout(p=dropout)", "node_feats = self.conv_weights(node_feats)\nif self.UseBN:...
<|body_start_0|> super(Atom_Wise_Convolution, self).__init__() self.conv_weights = nn.Linear(input_feature, output_feature) self.batch_norm = nn.LayerNorm(output_feature) self.UseBN = UseBN self.activation = Shifted_softplus() self.dropout = nn.Dropout(p=dropout) <|end_bo...
Performs self convolution to each node
Atom_Wise_Convolution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Atom_Wise_Convolution: """Performs self convolution to each node""" def __init__(self, input_feature: int, output_feature: int, dropout: float=0.2, UseBN: bool=True): """Parameters ---------- input_feature: int Size of input feature size output_feature: int Size of output feature siz...
stack_v2_sparse_classes_10k_train_000758
18,579
permissive
[ { "docstring": "Parameters ---------- input_feature: int Size of input feature size output_feature: int Size of output feature size dropout: float, defult 0.2 p value for dropout between 0.0 to 1.0 UseBN: bool Setting it to True will perform Batch Normalisation", "name": "__init__", "signature": "def __...
2
stack_v2_sparse_classes_30k_train_002590
Implement the Python class `Atom_Wise_Convolution` described below. Class description: Performs self convolution to each node Method signatures and docstrings: - def __init__(self, input_feature: int, output_feature: int, dropout: float=0.2, UseBN: bool=True): Parameters ---------- input_feature: int Size of input fe...
Implement the Python class `Atom_Wise_Convolution` described below. Class description: Performs self convolution to each node Method signatures and docstrings: - def __init__(self, input_feature: int, output_feature: int, dropout: float=0.2, UseBN: bool=True): Parameters ---------- input_feature: int Size of input fe...
ee6e67ebcf7bf04259cf13aff6388e2b791fea3d
<|skeleton|> class Atom_Wise_Convolution: """Performs self convolution to each node""" def __init__(self, input_feature: int, output_feature: int, dropout: float=0.2, UseBN: bool=True): """Parameters ---------- input_feature: int Size of input feature size output_feature: int Size of output feature siz...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Atom_Wise_Convolution: """Performs self convolution to each node""" def __init__(self, input_feature: int, output_feature: int, dropout: float=0.2, UseBN: bool=True): """Parameters ---------- input_feature: int Size of input feature size output_feature: int Size of output feature size dropout: fl...
the_stack_v2_python_sparse
deepchem/models/torch_models/lcnn.py
deepchem/deepchem
train
4,876
3207b24b55371b1f12e102101a7bc8a2abad83d4
[ "res = []\nif not root:\n return []\n\ndef _recur_func(node, level):\n if len(res) == level:\n res.append([])\n res[level].append(node.val)\n if node.left:\n _recur_func(node.left, level + 1)\n if node.right:\n _recur_func(node.right, level + 1)\n_recur_func(root, 0)\nreturn res"...
<|body_start_0|> res = [] if not root: return [] def _recur_func(node, level): if len(res) == level: res.append([]) res[level].append(node.val) if node.left: _recur_func(node.left, level + 1) if node.rig...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def levelOrder_recursion(self, root: TreeNode): """递归实现层次遍历二叉树,并逐层返回该层的值列表。 :param root: :return: list""" <|body_0|> def levelOrder_iteration_t(self, root: TreeNode): """迭代实现层次遍历二叉树,并逐层返回该层的值列表。 :param root: :return: res""" <|body_1|> def level...
stack_v2_sparse_classes_10k_train_000759
3,953
no_license
[ { "docstring": "递归实现层次遍历二叉树,并逐层返回该层的值列表。 :param root: :return: list", "name": "levelOrder_recursion", "signature": "def levelOrder_recursion(self, root: TreeNode)" }, { "docstring": "迭代实现层次遍历二叉树,并逐层返回该层的值列表。 :param root: :return: res", "name": "levelOrder_iteration_t", "signature": "def ...
3
stack_v2_sparse_classes_30k_val_000300
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder_recursion(self, root: TreeNode): 递归实现层次遍历二叉树,并逐层返回该层的值列表。 :param root: :return: list - def levelOrder_iteration_t(self, root: TreeNode): 迭代实现层次遍历二叉树,并逐层返回该层的值列表。 :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def levelOrder_recursion(self, root: TreeNode): 递归实现层次遍历二叉树,并逐层返回该层的值列表。 :param root: :return: list - def levelOrder_iteration_t(self, root: TreeNode): 迭代实现层次遍历二叉树,并逐层返回该层的值列表。 :...
62ad010a992c031e8c0fe4d1a9b6f9364f96ed4c
<|skeleton|> class Solution: def levelOrder_recursion(self, root: TreeNode): """递归实现层次遍历二叉树,并逐层返回该层的值列表。 :param root: :return: list""" <|body_0|> def levelOrder_iteration_t(self, root: TreeNode): """迭代实现层次遍历二叉树,并逐层返回该层的值列表。 :param root: :return: res""" <|body_1|> def level...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def levelOrder_recursion(self, root: TreeNode): """递归实现层次遍历二叉树,并逐层返回该层的值列表。 :param root: :return: list""" res = [] if not root: return [] def _recur_func(node, level): if len(res) == level: res.append([]) res[level]...
the_stack_v2_python_sparse
leetcode/solved/102_.py
usnnu/python_foundation
train
0
e07e35976407d5147f6c4b3c88d7e9014483afa4
[ "self._d = d\nself._seed = seed\nself._inv_transform = inv_transform\nif inv_transform:\n sobol_dim = d\nelse:\n sobol_dim = 2 * math.ceil(d / 2)\nself._sobol_engine = SobolEngine(dimension=sobol_dim, scramble=True, seed=seed)", "samples = self._sobol_engine.draw(n, dtype=dtype)\nif self._inv_transform:\n ...
<|body_start_0|> self._d = d self._seed = seed self._inv_transform = inv_transform if inv_transform: sobol_dim = d else: sobol_dim = 2 * math.ceil(d / 2) self._sobol_engine = SobolEngine(dimension=sobol_dim, scramble=True, seed=seed) <|end_body_0|>...
Engine for qMC sampling from a Multivariate Normal `N(0, I_d)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, set `inv_transform=True`. Example: >>> engine = NormalQMCEngine(3) >>> samples = engine.draw(16)
NormalQMCEngine
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NormalQMCEngine: """Engine for qMC sampling from a Multivariate Normal `N(0, I_d)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, set `inv_transform=True`. Example: >>> engine = NormalQMCEn...
stack_v2_sparse_classes_10k_train_000760
6,555
permissive
[ { "docstring": "Engine for drawing qMC samples from a multivariate normal `N(0, I_d)`. Args: d: The dimension of the samples. seed: The seed with which to seed the random number generator of the underlying SobolEngine. inv_transform: If True, use inverse transform instead of Box-Muller.", "name": "__init__"...
2
stack_v2_sparse_classes_30k_train_001870
Implement the Python class `NormalQMCEngine` described below. Class description: Engine for qMC sampling from a Multivariate Normal `N(0, I_d)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, set `inv_transform=T...
Implement the Python class `NormalQMCEngine` described below. Class description: Engine for qMC sampling from a Multivariate Normal `N(0, I_d)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, set `inv_transform=T...
4cc5ed59b2e8a9c780f786830c548e05cc74d53c
<|skeleton|> class NormalQMCEngine: """Engine for qMC sampling from a Multivariate Normal `N(0, I_d)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, set `inv_transform=True`. Example: >>> engine = NormalQMCEn...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NormalQMCEngine: """Engine for qMC sampling from a Multivariate Normal `N(0, I_d)`. By default, this implementation uses Box-Muller transformed Sobol samples following pg. 123 in [Pages2018numprob]_. To use the inverse transform instead, set `inv_transform=True`. Example: >>> engine = NormalQMCEngine(3) >>> s...
the_stack_v2_python_sparse
botorch/sampling/qmc.py
pytorch/botorch
train
2,891
bff211b69b352fbe9174ecaa7060f6d379c6c711
[ "self.control_points = Vec3.list(control_points)\nself.degree = degree\nself.closed = closed", "if self.closed:\n spline = closed_uniform_bspline(self.control_points, order=self.degree + 1)\nelse:\n spline = BSpline(self.control_points, order=self.degree + 1)\nvertices = spline.approximate(segments)\nif ucs...
<|body_start_0|> self.control_points = Vec3.list(control_points) self.degree = degree self.closed = closed <|end_body_0|> <|body_start_1|> if self.closed: spline = closed_uniform_bspline(self.control_points, order=self.degree + 1) else: spline = BSpline(s...
DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transformed into the 3D object by elevation and extrusion (:ref:`OCS`, :ref:`UCS`). T...
R12Spline
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class R12Spline: """DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transformed into the 3D object by elevation and ...
stack_v2_sparse_classes_10k_train_000761
7,650
permissive
[ { "docstring": "Args: control_points: B-spline control frame vertices degree: degree of B-spline, only 2 and 3 is supported closed: ``True`` for closed curve", "name": "__init__", "signature": "def __init__(self, control_points: Iterable[UVec], degree: int=2, closed: bool=True)" }, { "docstring"...
3
null
Implement the Python class `R12Spline` described below. Class description: DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transform...
Implement the Python class `R12Spline` described below. Class description: DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transform...
ba6ab0264dcb6833173042a37b1b5ae878d75113
<|skeleton|> class R12Spline: """DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transformed into the 3D object by elevation and ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class R12Spline: """DXF R12 supports 2D B-splines, but Autodesk do not document the usage in the DXF Reference. The base entity for splines in DXF R12 is the POLYLINE entity. The spline itself is always in a plane, but as any 2D entity, the spline can be transformed into the 3D object by elevation and extrusion (:r...
the_stack_v2_python_sparse
src/ezdxf/render/r12spline.py
mozman/ezdxf
train
750
957d1156ec560bbec583cde8a123231ef0151415
[ "res = {}\nfor vehi in self.browse(cr, uid, ids, context=context):\n res[vehi['id']] = len(vehi.vehi_participants_ids)\nreturn res", "if context is None:\n context = {}\nif context.get('name'):\n transport_obj = self.pool.get('student.transport')\n transport_data = transport_obj.browse(cr, uid, contex...
<|body_start_0|> res = {} for vehi in self.browse(cr, uid, ids, context=context): res[vehi['id']] = len(vehi.vehi_participants_ids) return res <|end_body_0|> <|body_start_1|> if context is None: context = {} if context.get('name'): transport_o...
transport_vehicle
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class transport_vehicle: def _participants(self, cr, uid, ids, name, vals, context=None): """This method calculate total participants @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param name : Functional field's name ...
stack_v2_sparse_classes_10k_train_000762
21,327
no_license
[ { "docstring": "This method calculate total participants @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param name : Functional field's name @param vals : Other arguments @param context : standard Dictionary @return : Dictionary having ...
2
null
Implement the Python class `transport_vehicle` described below. Class description: Implement the transport_vehicle class. Method signatures and docstrings: - def _participants(self, cr, uid, ids, name, vals, context=None): This method calculate total participants @param self : Object Pointer @param cr : Database Curs...
Implement the Python class `transport_vehicle` described below. Class description: Implement the transport_vehicle class. Method signatures and docstrings: - def _participants(self, cr, uid, ids, name, vals, context=None): This method calculate total participants @param self : Object Pointer @param cr : Database Curs...
c5a5678379649ccdf57a9d55b09b30436428b430
<|skeleton|> class transport_vehicle: def _participants(self, cr, uid, ids, name, vals, context=None): """This method calculate total participants @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param name : Functional field's name ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class transport_vehicle: def _participants(self, cr, uid, ids, name, vals, context=None): """This method calculate total participants @param self : Object Pointer @param cr : Database Cursor @param uid : Current Logged in User @param ids : Current Records @param name : Functional field's name @param vals : ...
the_stack_v2_python_sparse
education/school_transport/transport.py
adahra/addons
train
1
1448e8715b7f0dd20ceed73ec4e74d2632c57585
[ "self.directory = directory\nself.function_table = {}\nself.status = DataPackStatus.INACTIVE\nself.name = directory.split('/')[-1].split('\\\\')[-1]\nself.access = None\nself.description = ''", "if self.status == DataPackStatus.SYSTEM_ERROR:\n return\ntry:\n if self.status in (DataPackStatus.ACTIVATED, Data...
<|body_start_0|> self.directory = directory self.function_table = {} self.status = DataPackStatus.INACTIVE self.name = directory.split('/')[-1].split('\\')[-1] self.access = None self.description = '' <|end_body_0|> <|body_start_1|> if self.status == DataPackStat...
Class for a single data pack
DataPack
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataPack: """Class for a single data pack""" def __init__(self, directory: str): """Will create a new DataPack-object :param directory: where the datapack is located""" <|body_0|> async def load(self): """Will load the data pack""" <|body_1|> def unl...
stack_v2_sparse_classes_10k_train_000763
10,029
permissive
[ { "docstring": "Will create a new DataPack-object :param directory: where the datapack is located", "name": "__init__", "signature": "def __init__(self, directory: str)" }, { "docstring": "Will load the data pack", "name": "load", "signature": "async def load(self)" }, { "docstri...
4
stack_v2_sparse_classes_30k_train_002945
Implement the Python class `DataPack` described below. Class description: Class for a single data pack Method signatures and docstrings: - def __init__(self, directory: str): Will create a new DataPack-object :param directory: where the datapack is located - async def load(self): Will load the data pack - def unload(...
Implement the Python class `DataPack` described below. Class description: Class for a single data pack Method signatures and docstrings: - def __init__(self, directory: str): Will create a new DataPack-object :param directory: where the datapack is located - async def load(self): Will load the data pack - def unload(...
644ef36a70c45a70820f6f6069b2f36545a187e5
<|skeleton|> class DataPack: """Class for a single data pack""" def __init__(self, directory: str): """Will create a new DataPack-object :param directory: where the datapack is located""" <|body_0|> async def load(self): """Will load the data pack""" <|body_1|> def unl...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataPack: """Class for a single data pack""" def __init__(self, directory: str): """Will create a new DataPack-object :param directory: where the datapack is located""" self.directory = directory self.function_table = {} self.status = DataPackStatus.INACTIVE self.n...
the_stack_v2_python_sparse
mcpython/common/data/DataPacks.py
mcpython4-coding/core
train
4
e6ef78007a4e0ed5904b72b50e2d0e941384de24
[ "super().__init__()\nself.cost_class = cost_class\nself.cost_bbox = cost_bbox\nself.cost_giou = cost_giou\nassert cost_class != 0 or cost_bbox != 0 or cost_giou != 0, 'all costs cant be 0'", "bs, num_queries = outputs['pred_logits'].shape[:2]\nout_prob = outputs['pred_logits'].flatten(0, 1).softmax(-1)\nout_bbox ...
<|body_start_0|> super().__init__() self.cost_class = cost_class self.cost_bbox = cost_bbox self.cost_giou = cost_giou assert cost_class != 0 or cost_bbox != 0 or cost_giou != 0, 'all costs cant be 0' <|end_body_0|> <|body_start_1|> bs, num_queries = outputs['pred_logits...
This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best predictions, while the others are un-matched (...
HungarianMatcher
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HungarianMatcher: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best pr...
stack_v2_sparse_classes_10k_train_000764
4,250
permissive
[ { "docstring": "Creates the matcher Params: cost_class: This is the relative weight of the classification error in the matching cost cost_bbox: This is the relative weight of the L1 error of the bounding box coordinates in the matching cost cost_giou: This is the relative weight of the giou loss of the bounding...
2
stack_v2_sparse_classes_30k_train_007346
Implement the Python class `HungarianMatcher` described below. Class description: This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case,...
Implement the Python class `HungarianMatcher` described below. Class description: This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case,...
3af9fa878e73b6894ce3596450a8d9b89d918ca9
<|skeleton|> class HungarianMatcher: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best pr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HungarianMatcher: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best predictions, wh...
the_stack_v2_python_sparse
models/matcher.py
facebookresearch/detr
train
12,104
afb56ce2864fb14579beda356238f2d3c34d755d
[ "if root == None:\n return '[]'\nque = []\nque.append(root)\nres = []\nwhile any(que):\n next_level = []\n while len(que) > 0:\n cur = que.pop(0)\n if cur == None:\n res.append(None)\n next_level.append(None)\n next_level.append(None)\n else:\n ...
<|body_start_0|> if root == None: return '[]' que = [] que.append(root) res = [] while any(que): next_level = [] while len(que) > 0: cur = que.pop(0) if cur == None: res.append(None) ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_000765
3,172
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_004524
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
0d6f414e7610fedb2ec4818ecf88d51aa69e1355
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if root == None: return '[]' que = [] que.append(root) res = [] while any(que): next_level = [] while len(que) > 0: ...
the_stack_v2_python_sparse
0449_Serialize_and_Deserialize_BST.py
chien-wei/LeetCode
train
0
812248a8164863b123be84ff54d8eaf319a53f08
[ "super().__init__(main_window)\nstacked_layout = QStackedLayout()\nmain_window.communication.item_selected.connect(stacked_layout.setCurrentIndex)\nself.setLayout(stacked_layout)\nself.showEvent = self._get_show_event(main_window)\nfor item in items:\n frame = AttributesFrame(main_window=main_window, item=item)\...
<|body_start_0|> super().__init__(main_window) stacked_layout = QStackedLayout() main_window.communication.item_selected.connect(stacked_layout.setCurrentIndex) self.setLayout(stacked_layout) self.showEvent = self._get_show_event(main_window) for item in items: ...
DataWidget
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataWidget: def __init__(self, main_window, items): """Widget contains items with inputs.""" <|body_0|> def _get_show_event(main_window): """Emit signal to hide ActionButton.""" <|body_1|> <|end_skeleton|> <|body_start_0|> super().__init__(main_wind...
stack_v2_sparse_classes_10k_train_000766
946
no_license
[ { "docstring": "Widget contains items with inputs.", "name": "__init__", "signature": "def __init__(self, main_window, items)" }, { "docstring": "Emit signal to hide ActionButton.", "name": "_get_show_event", "signature": "def _get_show_event(main_window)" } ]
2
null
Implement the Python class `DataWidget` described below. Class description: Implement the DataWidget class. Method signatures and docstrings: - def __init__(self, main_window, items): Widget contains items with inputs. - def _get_show_event(main_window): Emit signal to hide ActionButton.
Implement the Python class `DataWidget` described below. Class description: Implement the DataWidget class. Method signatures and docstrings: - def __init__(self, main_window, items): Widget contains items with inputs. - def _get_show_event(main_window): Emit signal to hide ActionButton. <|skeleton|> class DataWidge...
606e188e88ee3a2b2e1daee60c71948c678228e1
<|skeleton|> class DataWidget: def __init__(self, main_window, items): """Widget contains items with inputs.""" <|body_0|> def _get_show_event(main_window): """Emit signal to hide ActionButton.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DataWidget: def __init__(self, main_window, items): """Widget contains items with inputs.""" super().__init__(main_window) stacked_layout = QStackedLayout() main_window.communication.item_selected.connect(stacked_layout.setCurrentIndex) self.setLayout(stacked_layout) ...
the_stack_v2_python_sparse
Hospital-Helper-2-master/app/gui/data_widget.py
JoaoBueno/estudos-python
train
2
49ce6e2a0ecf10003ba26fdd3def56ec42be51db
[ "mro = self.CustomError.mro()\nassert 'RuntimeError' == mro[1].__name__\nassert 'Exception' == mro[2].__name__\nassert 'BaseException' == mro[3].__name__", "result = None\ntry:\n self.fail('Oops')\nexcept Exception as e:\n result = 'exception handled'\n e2 = e\nassert 'exception handled' == result\nasser...
<|body_start_0|> mro = self.CustomError.mro() assert 'RuntimeError' == mro[1].__name__ assert 'Exception' == mro[2].__name__ assert 'BaseException' == mro[3].__name__ <|end_body_0|> <|body_start_1|> result = None try: self.fail('Oops') except Exceptio...
파이썬으로 코딩을 할 때 피할 수는 있지만 피하기 어려운 것이 에러입니다. 파이썬에서는 이들을 예외 (Exception) 이라고 부릅니다. pyt 이번에는 파이썬의 예외 처리는 어떻게 하고 어떤 예외들이 있는지 등 보겠습니다.
PythonExceptions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PythonExceptions: """파이썬으로 코딩을 할 때 피할 수는 있지만 피하기 어려운 것이 에러입니다. 파이썬에서는 이들을 예외 (Exception) 이라고 부릅니다. pyt 이번에는 파이썬의 예외 처리는 어떻게 하고 어떤 예외들이 있는지 등 보겠습니다.""" def test_about_exception_inheritance(self): """여기에서 나오는 `mro` 에 대해서는 자세히 아실 필요는 없습니다. 다만 해당 테스트를 통과하면서 어떤 것들이 나오는지 살펴보시면 될 것 같습니다. 직접...
stack_v2_sparse_classes_10k_train_000767
21,323
no_license
[ { "docstring": "여기에서 나오는 `mro` 에 대해서는 자세히 아실 필요는 없습니다. 다만 해당 테스트를 통과하면서 어떤 것들이 나오는지 살펴보시면 될 것 같습니다. 직접 파이썬으로 확인해 보시면서 테스트를 통과해주세요", "name": "test_about_exception_inheritance", "signature": "def test_about_exception_inheritance(self)" }, { "docstring": "try... except 는 파이썬에서 예외처리할 때 사용되는 매우 중요한 기...
5
stack_v2_sparse_classes_30k_train_006345
Implement the Python class `PythonExceptions` described below. Class description: 파이썬으로 코딩을 할 때 피할 수는 있지만 피하기 어려운 것이 에러입니다. 파이썬에서는 이들을 예외 (Exception) 이라고 부릅니다. pyt 이번에는 파이썬의 예외 처리는 어떻게 하고 어떤 예외들이 있는지 등 보겠습니다. Method signatures and docstrings: - def test_about_exception_inheritance(self): 여기에서 나오는 `mro` 에 대해서는 자세히 아실 ...
Implement the Python class `PythonExceptions` described below. Class description: 파이썬으로 코딩을 할 때 피할 수는 있지만 피하기 어려운 것이 에러입니다. 파이썬에서는 이들을 예외 (Exception) 이라고 부릅니다. pyt 이번에는 파이썬의 예외 처리는 어떻게 하고 어떤 예외들이 있는지 등 보겠습니다. Method signatures and docstrings: - def test_about_exception_inheritance(self): 여기에서 나오는 `mro` 에 대해서는 자세히 아실 ...
8dbd1eea6195df8b0dc1798d1ba2e27929c4eda7
<|skeleton|> class PythonExceptions: """파이썬으로 코딩을 할 때 피할 수는 있지만 피하기 어려운 것이 에러입니다. 파이썬에서는 이들을 예외 (Exception) 이라고 부릅니다. pyt 이번에는 파이썬의 예외 처리는 어떻게 하고 어떤 예외들이 있는지 등 보겠습니다.""" def test_about_exception_inheritance(self): """여기에서 나오는 `mro` 에 대해서는 자세히 아실 필요는 없습니다. 다만 해당 테스트를 통과하면서 어떤 것들이 나오는지 살펴보시면 될 것 같습니다. 직접...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PythonExceptions: """파이썬으로 코딩을 할 때 피할 수는 있지만 피하기 어려운 것이 에러입니다. 파이썬에서는 이들을 예외 (Exception) 이라고 부릅니다. pyt 이번에는 파이썬의 예외 처리는 어떻게 하고 어떤 예외들이 있는지 등 보겠습니다.""" def test_about_exception_inheritance(self): """여기에서 나오는 `mro` 에 대해서는 자세히 아실 필요는 없습니다. 다만 해당 테스트를 통과하면서 어떤 것들이 나오는지 살펴보시면 될 것 같습니다. 직접 파이썬으로 확인해 보시...
the_stack_v2_python_sparse
Python/src/Part_2.py
effection00/Study-Record
train
0
7c7471a52f98172edc9172da3e1782b9bfa80fc9
[ "if not root:\n return []\ndata = []\nqueue = deque()\nqueue.append(root)\nwhile queue:\n node = queue.popleft()\n if not node:\n data.append('#')\n continue\n data.append(node.val)\n queue.append(node.left)\n queue.append(node.right)\nwhile data[-1] == '#':\n data.pop()\nreturn d...
<|body_start_0|> if not root: return [] data = [] queue = deque() queue.append(root) while queue: node = queue.popleft() if not node: data.append('#') continue data.append(node.val) queue....
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_10k_train_000768
1,914
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
b75b06fa1551f5e4d8a559ef64e1ac29db79c083
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" if not root: return [] data = [] queue = deque() queue.append(root) while queue: node = queue.popleft() if not node: ...
the_stack_v2_python_sparse
Python/297.py
arnabs542/Leetcode-38
train
0
62da1c75cfc3b08a5c306e4bee070e1e3de30cf2
[ "self.snake = [[0, 0]]\nself.food = food\nself.width = width\nself.height = height\nself.eat = 0", "x, y = self.snake[0]\nif direction == 'U':\n x = x - 1\nelif direction == 'L':\n y = y - 1\nelif direction == 'R':\n y = y + 1\nelif direction == 'D':\n x = x + 1\nif 0 <= x < self.height and 0 <= y < s...
<|body_start_0|> self.snake = [[0, 0]] self.food = food self.width = width self.height = height self.eat = 0 <|end_body_0|> <|body_start_1|> x, y = self.snake[0] if direction == 'U': x = x - 1 elif direction == 'L': y = y - 1 ...
SnakeGame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_10k_train_000769
15,245
no_license
[ { "docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].", "name": "__init__", "signature": "def __init__(self, widt...
2
null
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
Implement the Python class `SnakeGame` described below. Class description: Implement the SnakeGame class. Method signatures and docstrings: - def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -...
035ef08434fa1ca781a6fb2f9eed3538b7d20c02
<|skeleton|> class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SnakeGame: def __init__(self, width: int, height: int, food: List[List[int]]): """Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a...
the_stack_v2_python_sparse
leetcode_python/Design/design-snake-game.py
yennanliu/CS_basics
train
64
af7701e084d96e61f35705798cf82747af601c85
[ "n = len(nums) - 1\nleft, right = (1, n)\nwhile left < right:\n mid = left + (right - left) // 2\n count = 0\n for num in nums:\n if num <= mid:\n count += 1\n if count > mid:\n right = mid\n else:\n left = mid + 1\nreturn right", "slow, fast = (nums[0], nums[nums[0]...
<|body_start_0|> n = len(nums) - 1 left, right = (1, n) while left < right: mid = left + (right - left) // 2 count = 0 for num in nums: if num <= mid: count += 1 if count > mid: right = mid ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def findDuplicate1(self, nums: List[int]) -> int: """一般意义上,我们都在索引维度上(空间),在给定target的情况下去二分查找。 为什么能二分,是因为索引维度上数组有序。 本题是在数值维度上去二分查找 为什么能二分,是因为在数值维度上元素分布不均,存在二分条件(抽屉原理)。""" <|body_0|> def findDuplicate2(self, nums: List[int]) -> int: """快慢指针,比较难理解,参考142题解""" ...
stack_v2_sparse_classes_10k_train_000770
2,089
no_license
[ { "docstring": "一般意义上,我们都在索引维度上(空间),在给定target的情况下去二分查找。 为什么能二分,是因为索引维度上数组有序。 本题是在数值维度上去二分查找 为什么能二分,是因为在数值维度上元素分布不均,存在二分条件(抽屉原理)。", "name": "findDuplicate1", "signature": "def findDuplicate1(self, nums: List[int]) -> int" }, { "docstring": "快慢指针,比较难理解,参考142题解", "name": "findDuplicate2", "...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate1(self, nums: List[int]) -> int: 一般意义上,我们都在索引维度上(空间),在给定target的情况下去二分查找。 为什么能二分,是因为索引维度上数组有序。 本题是在数值维度上去二分查找 为什么能二分,是因为在数值维度上元素分布不均,存在二分条件(抽屉原理)。 - def findDupli...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def findDuplicate1(self, nums: List[int]) -> int: 一般意义上,我们都在索引维度上(空间),在给定target的情况下去二分查找。 为什么能二分,是因为索引维度上数组有序。 本题是在数值维度上去二分查找 为什么能二分,是因为在数值维度上元素分布不均,存在二分条件(抽屉原理)。 - def findDupli...
2bbb1640589aab34f2bc42489283033cc11fb885
<|skeleton|> class Solution: def findDuplicate1(self, nums: List[int]) -> int: """一般意义上,我们都在索引维度上(空间),在给定target的情况下去二分查找。 为什么能二分,是因为索引维度上数组有序。 本题是在数值维度上去二分查找 为什么能二分,是因为在数值维度上元素分布不均,存在二分条件(抽屉原理)。""" <|body_0|> def findDuplicate2(self, nums: List[int]) -> int: """快慢指针,比较难理解,参考142题解""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def findDuplicate1(self, nums: List[int]) -> int: """一般意义上,我们都在索引维度上(空间),在给定target的情况下去二分查找。 为什么能二分,是因为索引维度上数组有序。 本题是在数值维度上去二分查找 为什么能二分,是因为在数值维度上元素分布不均,存在二分条件(抽屉原理)。""" n = len(nums) - 1 left, right = (1, n) while left < right: mid = left + (right - left) ...
the_stack_v2_python_sparse
287_find-the-duplicate-number.py
helloocc/algorithm
train
1
910653a277a53b772235680a3a5f51295e1fc6ca
[ "try:\n params = request._serialize()\n headers = request.headers\n body = self.call('DescribeKBComponent', params, headers=headers)\n response = json.loads(body)\n model = models.DescribeKBComponentResponse()\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('DescribeKBComponent', params, headers=headers) response = json.loads(body) model = models.DescribeKBComponentResponse() model._deserialize(respo...
BscaClient
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BscaClient: def DescribeKBComponent(self, request): """本接口(DescribeKBComponent)用于在知识库中查询开源组件信息。本接口根据用户输入的PURL在知识库中寻找对应的开源组件,其中Name为必填字段。 :param request: Request instance for DescribeKBComponent. :type request: :class:`tencentcloud.bsca.v20210811.models.DescribeKBComponentRequest` :rtype:...
stack_v2_sparse_classes_10k_train_000771
5,975
permissive
[ { "docstring": "本接口(DescribeKBComponent)用于在知识库中查询开源组件信息。本接口根据用户输入的PURL在知识库中寻找对应的开源组件,其中Name为必填字段。 :param request: Request instance for DescribeKBComponent. :type request: :class:`tencentcloud.bsca.v20210811.models.DescribeKBComponentRequest` :rtype: :class:`tencentcloud.bsca.v20210811.models.DescribeKBComponent...
5
null
Implement the Python class `BscaClient` described below. Class description: Implement the BscaClient class. Method signatures and docstrings: - def DescribeKBComponent(self, request): 本接口(DescribeKBComponent)用于在知识库中查询开源组件信息。本接口根据用户输入的PURL在知识库中寻找对应的开源组件,其中Name为必填字段。 :param request: Request instance for DescribeKBCompo...
Implement the Python class `BscaClient` described below. Class description: Implement the BscaClient class. Method signatures and docstrings: - def DescribeKBComponent(self, request): 本接口(DescribeKBComponent)用于在知识库中查询开源组件信息。本接口根据用户输入的PURL在知识库中寻找对应的开源组件,其中Name为必填字段。 :param request: Request instance for DescribeKBCompo...
6baf00a5a56ba58b6a1123423e0a1422d17a0201
<|skeleton|> class BscaClient: def DescribeKBComponent(self, request): """本接口(DescribeKBComponent)用于在知识库中查询开源组件信息。本接口根据用户输入的PURL在知识库中寻找对应的开源组件,其中Name为必填字段。 :param request: Request instance for DescribeKBComponent. :type request: :class:`tencentcloud.bsca.v20210811.models.DescribeKBComponentRequest` :rtype:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BscaClient: def DescribeKBComponent(self, request): """本接口(DescribeKBComponent)用于在知识库中查询开源组件信息。本接口根据用户输入的PURL在知识库中寻找对应的开源组件,其中Name为必填字段。 :param request: Request instance for DescribeKBComponent. :type request: :class:`tencentcloud.bsca.v20210811.models.DescribeKBComponentRequest` :rtype: :class:`tence...
the_stack_v2_python_sparse
tencentcloud/bsca/v20210811/bsca_client.py
TencentCloud/tencentcloud-sdk-python
train
594
723c65584fffc4099c0923cb6e3f67b1090099fc
[ "date_time = None\ncreation_time = self._GetJSONValue(json_dict, 'CreationTime')\nif creation_time:\n try:\n date_time = dfdatetime_time_elements.TimeElements()\n date_time.CopyFromStringISO8601(creation_time)\n except ValueError as exception:\n parser_mediator.ProduceExtractionWarning('U...
<|body_start_0|> date_time = None creation_time = self._GetJSONValue(json_dict, 'CreationTime') if creation_time: try: date_time = dfdatetime_time_elements.TimeElements() date_time.CopyFromStringISO8601(creation_time) except ValueError as e...
JSON-L parser plugin for Microsoft (Office) 365 audit log files.
Microsoft365AuditLogJSONLPlugin
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Microsoft365AuditLogJSONLPlugin: """JSON-L parser plugin for Microsoft (Office) 365 audit log files.""" def _ParseRecord(self, parser_mediator, json_dict): """Parses a Microsoft (Office) 365 audit log record. Args: parser_mediator (ParserMediator): mediates interactions between parse...
stack_v2_sparse_classes_10k_train_000772
4,708
permissive
[ { "docstring": "Parses a Microsoft (Office) 365 audit log record. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfVFS. json_dict (dict): JSON dictionary of the log record.", "name": "_ParseRecord", "signature": "def _ParseRecord(s...
2
null
Implement the Python class `Microsoft365AuditLogJSONLPlugin` described below. Class description: JSON-L parser plugin for Microsoft (Office) 365 audit log files. Method signatures and docstrings: - def _ParseRecord(self, parser_mediator, json_dict): Parses a Microsoft (Office) 365 audit log record. Args: parser_media...
Implement the Python class `Microsoft365AuditLogJSONLPlugin` described below. Class description: JSON-L parser plugin for Microsoft (Office) 365 audit log files. Method signatures and docstrings: - def _ParseRecord(self, parser_mediator, json_dict): Parses a Microsoft (Office) 365 audit log record. Args: parser_media...
d6022f8cfebfddf2d08ab2d300a41b61f3349933
<|skeleton|> class Microsoft365AuditLogJSONLPlugin: """JSON-L parser plugin for Microsoft (Office) 365 audit log files.""" def _ParseRecord(self, parser_mediator, json_dict): """Parses a Microsoft (Office) 365 audit log record. Args: parser_mediator (ParserMediator): mediates interactions between parse...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Microsoft365AuditLogJSONLPlugin: """JSON-L parser plugin for Microsoft (Office) 365 audit log files.""" def _ParseRecord(self, parser_mediator, json_dict): """Parses a Microsoft (Office) 365 audit log record. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other ...
the_stack_v2_python_sparse
plaso/parsers/jsonl_plugins/microsoft365_audit_log.py
log2timeline/plaso
train
1,506
fee352831935669d24c68eafbc5df41218c493d3
[ "self.file_path = file_path\nself.current_row = 0\nself.workbook = ''\nself.sheet = ''\nself.load_workbook()", "if os.path.exists(self.file_path):\n temp_workbook = xlrd.open_workbook(self.file_path)\n self.workbook = copy(temp_workbook)\nelse:\n self.workbook = xlwt.Workbook(encoding='utf-8')", "try:\...
<|body_start_0|> self.file_path = file_path self.current_row = 0 self.workbook = '' self.sheet = '' self.load_workbook() <|end_body_0|> <|body_start_1|> if os.path.exists(self.file_path): temp_workbook = xlrd.open_workbook(self.file_path) self.wor...
It is for printer discovery tests
Excel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Excel: """It is for printer discovery tests""" def __init__(self, file_path): """Initialize workbook instance with sheet instance :param file_path: path of Excel file""" <|body_0|> def load_workbook(self): """Load a workbook :return:""" <|body_1|> de...
stack_v2_sparse_classes_10k_train_000773
4,409
no_license
[ { "docstring": "Initialize workbook instance with sheet instance :param file_path: path of Excel file", "name": "__init__", "signature": "def __init__(self, file_path)" }, { "docstring": "Load a workbook :return:", "name": "load_workbook", "signature": "def load_workbook(self)" }, { ...
6
stack_v2_sparse_classes_30k_train_002666
Implement the Python class `Excel` described below. Class description: It is for printer discovery tests Method signatures and docstrings: - def __init__(self, file_path): Initialize workbook instance with sheet instance :param file_path: path of Excel file - def load_workbook(self): Load a workbook :return: - def lo...
Implement the Python class `Excel` described below. Class description: It is for printer discovery tests Method signatures and docstrings: - def __init__(self, file_path): Initialize workbook instance with sheet instance :param file_path: path of Excel file - def load_workbook(self): Load a workbook :return: - def lo...
b5230c51d3bc7bb04b3448d1a1fe5a076d8898d5
<|skeleton|> class Excel: """It is for printer discovery tests""" def __init__(self, file_path): """Initialize workbook instance with sheet instance :param file_path: path of Excel file""" <|body_0|> def load_workbook(self): """Load a workbook :return:""" <|body_1|> de...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Excel: """It is for printer discovery tests""" def __init__(self, file_path): """Initialize workbook instance with sheet instance :param file_path: path of Excel file""" self.file_path = file_path self.current_row = 0 self.workbook = '' self.sheet = '' self...
the_stack_v2_python_sparse
MobileApps/libs/ma_misc/excel.py
Amal548/QAMA
train
0
d0076b53aa907cac14adbf074e95388152652485
[ "super().__init__(z3_mask=z3_mask)\nself.edge_length = edge_length\nself.window_size = window_size", "z3_mask, result = self._optimize()\nmask = np.zeros((self.edge_length, self.edge_length))\nnum_masks_along_row = math.ceil(self.edge_length / self.window_size)\nfor row in range(self.edge_length):\n for column...
<|body_start_0|> super().__init__(z3_mask=z3_mask) self.edge_length = edge_length self.window_size = window_size <|end_body_0|> <|body_start_1|> z3_mask, result = self._optimize() mask = np.zeros((self.edge_length, self.edge_length)) num_masks_along_row = math.ceil(self....
Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask.
ImageOptimizer
[ "Apache-2.0", "CC-BY-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageOptimizer: """Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask.""" def __init__(self, z3_mask, window_size, edge_length): """Initializer. Args: z...
stack_v2_sparse_classes_10k_train_000774
39,568
permissive
[ { "docstring": "Initializer. Args: z3_mask: list, contains mask bits as z3 vars. window_size: int, side length of the square mask. edge_length: int, side length of the 2D array (image) whose pixels are to be masked.", "name": "__init__", "signature": "def __init__(self, z3_mask, window_size, edge_length...
2
null
Implement the Python class `ImageOptimizer` described below. Class description: Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask. Method signatures and docstrings: - def __init__(self,...
Implement the Python class `ImageOptimizer` described below. Class description: Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask. Method signatures and docstrings: - def __init__(self,...
5573d9c5822f4e866b6692769963ae819cb3f10d
<|skeleton|> class ImageOptimizer: """Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask.""" def __init__(self, z3_mask, window_size, edge_length): """Initializer. Args: z...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ImageOptimizer: """Creates a solver by using z3 solver. Attributes: edge_length: int, side length of the 2D array (image) whose pixels are to be masked. window_size: int, side length of the square mask.""" def __init__(self, z3_mask, window_size, edge_length): """Initializer. Args: z3_mask: list,...
the_stack_v2_python_sparse
smug_saliency/utils.py
Jimmy-INL/google-research
train
1
b20c07118efd6f48d1a54ef1f6ebb8eb150d7cac
[ "if cls.instance is None:\n cls.instance = super().__new__(cls)\nreturn cls.instance", "if not MusicPlayer.init_flag:\n print('初始化音乐播放器')\n MusicPlayer.init_flag = True" ]
<|body_start_0|> if cls.instance is None: cls.instance = super().__new__(cls) return cls.instance <|end_body_0|> <|body_start_1|> if not MusicPlayer.init_flag: print('初始化音乐播放器') MusicPlayer.init_flag = True <|end_body_1|>
MusicPlayer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MusicPlayer: def __new__(cls, *args, **kwargs): """重写创建方法""" <|body_0|> def __init__(self): """重写初始化方法""" <|body_1|> <|end_skeleton|> <|body_start_0|> if cls.instance is None: cls.instance = super().__new__(cls) return cls.instan...
stack_v2_sparse_classes_10k_train_000775
2,738
no_license
[ { "docstring": "重写创建方法", "name": "__new__", "signature": "def __new__(cls, *args, **kwargs)" }, { "docstring": "重写初始化方法", "name": "__init__", "signature": "def __init__(self)" } ]
2
stack_v2_sparse_classes_30k_train_002054
Implement the Python class `MusicPlayer` described below. Class description: Implement the MusicPlayer class. Method signatures and docstrings: - def __new__(cls, *args, **kwargs): 重写创建方法 - def __init__(self): 重写初始化方法
Implement the Python class `MusicPlayer` described below. Class description: Implement the MusicPlayer class. Method signatures and docstrings: - def __new__(cls, *args, **kwargs): 重写创建方法 - def __init__(self): 重写初始化方法 <|skeleton|> class MusicPlayer: def __new__(cls, *args, **kwargs): """重写创建方法""" ...
a4a1ae34daaa2764ee8d7005f414772c12d90c6a
<|skeleton|> class MusicPlayer: def __new__(cls, *args, **kwargs): """重写创建方法""" <|body_0|> def __init__(self): """重写初始化方法""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MusicPlayer: def __new__(cls, *args, **kwargs): """重写创建方法""" if cls.instance is None: cls.instance = super().__new__(cls) return cls.instance def __init__(self): """重写初始化方法""" if not MusicPlayer.init_flag: print('初始化音乐播放器') Music...
the_stack_v2_python_sparse
02_面向对象/py_09_单例模式.py
sunweiye12/python-BasicLearning
train
0
23050faaaaca4daad88eb1029b3ac34fd2f90920
[ "attribution_key = metrics_for_slice_pb2.AttributionsKey()\nif self.name:\n attribution_key.name = self.name\nif self.model_name:\n attribution_key.model_name = self.model_name\nif self.output_name:\n attribution_key.output_name = self.output_name\nif self.sub_key:\n attribution_key.sub_key.CopyFrom(sel...
<|body_start_0|> attribution_key = metrics_for_slice_pb2.AttributionsKey() if self.name: attribution_key.name = self.name if self.model_name: attribution_key.model_name = self.model_name if self.output_name: attribution_key.output_name = self.output_na...
An AttributionsKey is a metric key uniquely identifying attributions.
AttributionsKey
[ "BSD-3-Clause", "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AttributionsKey: """An AttributionsKey is a metric key uniquely identifying attributions.""" def to_proto(self) -> metrics_for_slice_pb2.AttributionsKey: """Converts key to proto.""" <|body_0|> def from_proto(pb: metrics_for_slice_pb2.AttributionsKey) -> 'AttributionsKey...
stack_v2_sparse_classes_10k_train_000776
44,385
permissive
[ { "docstring": "Converts key to proto.", "name": "to_proto", "signature": "def to_proto(self) -> metrics_for_slice_pb2.AttributionsKey" }, { "docstring": "Configures class from proto.", "name": "from_proto", "signature": "def from_proto(pb: metrics_for_slice_pb2.AttributionsKey) -> 'Attr...
2
stack_v2_sparse_classes_30k_test_000082
Implement the Python class `AttributionsKey` described below. Class description: An AttributionsKey is a metric key uniquely identifying attributions. Method signatures and docstrings: - def to_proto(self) -> metrics_for_slice_pb2.AttributionsKey: Converts key to proto. - def from_proto(pb: metrics_for_slice_pb2.Attr...
Implement the Python class `AttributionsKey` described below. Class description: An AttributionsKey is a metric key uniquely identifying attributions. Method signatures and docstrings: - def to_proto(self) -> metrics_for_slice_pb2.AttributionsKey: Converts key to proto. - def from_proto(pb: metrics_for_slice_pb2.Attr...
ee0d8eff562bfe068a3ffdc4da0472cc90adaf41
<|skeleton|> class AttributionsKey: """An AttributionsKey is a metric key uniquely identifying attributions.""" def to_proto(self) -> metrics_for_slice_pb2.AttributionsKey: """Converts key to proto.""" <|body_0|> def from_proto(pb: metrics_for_slice_pb2.AttributionsKey) -> 'AttributionsKey...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AttributionsKey: """An AttributionsKey is a metric key uniquely identifying attributions.""" def to_proto(self) -> metrics_for_slice_pb2.AttributionsKey: """Converts key to proto.""" attribution_key = metrics_for_slice_pb2.AttributionsKey() if self.name: attribution_ke...
the_stack_v2_python_sparse
tensorflow_model_analysis/metrics/metric_types.py
tensorflow/model-analysis
train
1,200
5fcbf9e26312bdeb82d6991a2b3d7997501675eb
[ "src_type, src_path = cls.identify_path_type(src)\ndest_type, dest_path = cls.identify_path_type(dest)\nformat_table = {'s3': cls.format_s3_path, 'local': cls.format_local_path}\nsrc_path = format_table[src_type](src_path)[0]\ndest_path, use_src_name = format_table[dest_type](dest_path)\nreturn {'dest': {'path': de...
<|body_start_0|> src_type, src_path = cls.identify_path_type(src) dest_type, dest_path = cls.identify_path_type(dest) format_table = {'s3': cls.format_s3_path, 'local': cls.format_local_path} src_path = format_table[src_type](src_path)[0] dest_path, use_src_name = format_table[de...
Path format base class.
FormatPath
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormatPath: """Path format base class.""" def format(cls, src: str, dest: str) -> FormatPathResult: """Format the source and destination for use in the file factory.""" <|body_0|> def format_local_path(path: str, dir_op: bool=True) -> Tuple[str, bool]: """Format ...
stack_v2_sparse_classes_10k_train_000777
4,460
permissive
[ { "docstring": "Format the source and destination for use in the file factory.", "name": "format", "signature": "def format(cls, src: str, dest: str) -> FormatPathResult" }, { "docstring": "Format the path of local files. Returns whether the destination will keep its own name or take the source'...
4
null
Implement the Python class `FormatPath` described below. Class description: Path format base class. Method signatures and docstrings: - def format(cls, src: str, dest: str) -> FormatPathResult: Format the source and destination for use in the file factory. - def format_local_path(path: str, dir_op: bool=True) -> Tupl...
Implement the Python class `FormatPath` described below. Class description: Path format base class. Method signatures and docstrings: - def format(cls, src: str, dest: str) -> FormatPathResult: Format the source and destination for use in the file factory. - def format_local_path(path: str, dir_op: bool=True) -> Tupl...
0763b06aee07d2cf3f037a49ca0cb81a048c5deb
<|skeleton|> class FormatPath: """Path format base class.""" def format(cls, src: str, dest: str) -> FormatPathResult: """Format the source and destination for use in the file factory.""" <|body_0|> def format_local_path(path: str, dir_op: bool=True) -> Tuple[str, bool]: """Format ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FormatPath: """Path format base class.""" def format(cls, src: str, dest: str) -> FormatPathResult: """Format the source and destination for use in the file factory.""" src_type, src_path = cls.identify_path_type(src) dest_type, dest_path = cls.identify_path_type(dest) for...
the_stack_v2_python_sparse
runway/core/providers/aws/s3/_helpers/format_path.py
onicagroup/runway
train
156
52c9b76566500cea20db5a0f88432ef9581a160c
[ "super().__init__('DiseaseService')\nself.declare_parameter('model_file')\nself.declare_parameter('diseases')\nmodel_file = self.get_parameter('model_file').get_parameter_value().string_value\nself.get_logger().info('Loading Model %s' % model_file)\nself.model = tf.keras.models.load_model(model_file)\nself.bridge =...
<|body_start_0|> super().__init__('DiseaseService') self.declare_parameter('model_file') self.declare_parameter('diseases') model_file = self.get_parameter('model_file').get_parameter_value().string_value self.get_logger().info('Loading Model %s' % model_file) self.model ...
Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.
DiseaseService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiseaseService: """Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.""" def __init__(self): """Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of va...
stack_v2_sparse_classes_10k_train_000778
4,255
no_license
[ { "docstring": "Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of valid disease classes.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Callback for handeling incomeing requests. Basically updates dise...
3
stack_v2_sparse_classes_30k_train_004656
Implement the Python class `DiseaseService` described below. Class description: Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model. Method signatures and docstrings: - def __init__(self): Initialises the service by creating the cvBridge, loading the ...
Implement the Python class `DiseaseService` described below. Class description: Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model. Method signatures and docstrings: - def __init__(self): Initialises the service by creating the cvBridge, loading the ...
d8d6c05c52673dc90ed7296235196c544461d940
<|skeleton|> class DiseaseService: """Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.""" def __init__(self): """Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of va...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DiseaseService: """Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.""" def __init__(self): """Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of valid disease c...
the_stack_v2_python_sparse
fruit_detection_component/scripts/disease_service.py
robmosys-tum/PapPercComp
train
2
8bf0b83201a493179a273db5372f82e287190faa
[ "if not head:\n return True\nself.h = head\n\ndef travel(tail):\n if tail.next:\n t = travel(tail.next)\n self.h = self.h.next\n return t and self.h.val == tail.val\n else:\n return self.h.val == tail.val\nreturn travel(head)", "if not head:\n return True\nr = []\nt = head\...
<|body_start_0|> if not head: return True self.h = head def travel(tail): if tail.next: t = travel(tail.next) self.h = self.h.next return t and self.h.val == tail.val else: return self.h.val == t...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPalindrome1(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def isPalindrome(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head: return True ...
stack_v2_sparse_classes_10k_train_000779
1,213
no_license
[ { "docstring": ":type head: ListNode :rtype: bool", "name": "isPalindrome1", "signature": "def isPalindrome1(self, head)" }, { "docstring": ":type head: ListNode :rtype: bool", "name": "isPalindrome", "signature": "def isPalindrome(self, head)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome1(self, head): :type head: ListNode :rtype: bool - def isPalindrome(self, head): :type head: ListNode :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPalindrome1(self, head): :type head: ListNode :rtype: bool - def isPalindrome(self, head): :type head: ListNode :rtype: bool <|skeleton|> class Solution: def isPalind...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def isPalindrome1(self, head): """:type head: ListNode :rtype: bool""" <|body_0|> def isPalindrome(self, head): """:type head: ListNode :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def isPalindrome1(self, head): """:type head: ListNode :rtype: bool""" if not head: return True self.h = head def travel(tail): if tail.next: t = travel(tail.next) self.h = self.h.next return t a...
the_stack_v2_python_sparse
py/leetcode/234.py
wfeng1991/learnpy
train
0
c979fb8409696f1d1e25d2716c8f6b0404e5ad1f
[ "from .wrapper import NCNNWrapper\nif deploy_cfg:\n backend_config = get_backend_config(deploy_cfg)\n use_vulkan = backend_config.get('use_vulkan', False)\nelse:\n use_vulkan = False\nreturn NCNNWrapper(param_file=backend_files[0], bin_file=backend_files[1], output_names=output_names, use_vulkan=use_vulkan...
<|body_start_0|> from .wrapper import NCNNWrapper if deploy_cfg: backend_config = get_backend_config(deploy_cfg) use_vulkan = backend_config.get('use_vulkan', False) else: use_vulkan = False return NCNNWrapper(param_file=backend_files[0], bin_file=back...
NCNNManager
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NCNNManager: def build_wrapper(cls, backend_files: Sequence[str], device: str='cpu', input_names: Optional[Sequence[str]]=None, output_names: Optional[Sequence[str]]=None, deploy_cfg: Optional[Any]=None, **kwargs): """Build the wrapper for the backend model. Args: backend_files (Sequence...
stack_v2_sparse_classes_10k_train_000780
5,173
permissive
[ { "docstring": "Build the wrapper for the backend model. Args: backend_files (Sequence[str]): Backend files. device (str, optional): The device info. Defaults to 'cpu'. input_names (Optional[Sequence[str]], optional): input names. Defaults to None. output_names (Optional[Sequence[str]], optional): output names....
5
stack_v2_sparse_classes_30k_train_005210
Implement the Python class `NCNNManager` described below. Class description: Implement the NCNNManager class. Method signatures and docstrings: - def build_wrapper(cls, backend_files: Sequence[str], device: str='cpu', input_names: Optional[Sequence[str]]=None, output_names: Optional[Sequence[str]]=None, deploy_cfg: O...
Implement the Python class `NCNNManager` described below. Class description: Implement the NCNNManager class. Method signatures and docstrings: - def build_wrapper(cls, backend_files: Sequence[str], device: str='cpu', input_names: Optional[Sequence[str]]=None, output_names: Optional[Sequence[str]]=None, deploy_cfg: O...
5479c8774f5b88d7ed9d399d4e305cb42cc2e73a
<|skeleton|> class NCNNManager: def build_wrapper(cls, backend_files: Sequence[str], device: str='cpu', input_names: Optional[Sequence[str]]=None, output_names: Optional[Sequence[str]]=None, deploy_cfg: Optional[Any]=None, **kwargs): """Build the wrapper for the backend model. Args: backend_files (Sequence...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NCNNManager: def build_wrapper(cls, backend_files: Sequence[str], device: str='cpu', input_names: Optional[Sequence[str]]=None, output_names: Optional[Sequence[str]]=None, deploy_cfg: Optional[Any]=None, **kwargs): """Build the wrapper for the backend model. Args: backend_files (Sequence[str]): Backen...
the_stack_v2_python_sparse
mmdeploy/backend/ncnn/backend_manager.py
open-mmlab/mmdeploy
train
2,164
c0f3183c2e6059364952387a0aeea4b781730ee7
[ "if len(intervals) == 0:\n return [newInterval]\nfor i in range(len(intervals)):\n if i == 0 and intervals[0].start >= newInterval.start:\n intervals.insert(0, newInterval)\n break\n if intervals[i].start <= newInterval.start:\n if intervals[i].end >= newInterval.start:\n in...
<|body_start_0|> if len(intervals) == 0: return [newInterval] for i in range(len(intervals)): if i == 0 and intervals[0].start >= newInterval.start: intervals.insert(0, newInterval) break if intervals[i].start <= newInterval.start: ...
Ex57
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ex57: def insert(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]""" <|body_0|> def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_10k_train_000781
4,210
no_license
[ { "docstring": ":type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]", "name": "insert", "signature": "def insert(self, intervals, newInterval)" }, { "docstring": ":type intervals: List[Interval] :rtype: List[Interval]", "name": "merge", "signature": "def me...
2
null
Implement the Python class `Ex57` described below. Class description: Implement the Ex57 class. Method signatures and docstrings: - def insert(self, intervals, newInterval): :type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval] - def merge(self, intervals): :type intervals: List[Interval]...
Implement the Python class `Ex57` described below. Class description: Implement the Ex57 class. Method signatures and docstrings: - def insert(self, intervals, newInterval): :type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval] - def merge(self, intervals): :type intervals: List[Interval]...
8f9327a1879949f61b462cc6c82e00e7c27b8b07
<|skeleton|> class Ex57: def insert(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]""" <|body_0|> def merge(self, intervals): """:type intervals: List[Interval] :rtype: List[Interval]""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Ex57: def insert(self, intervals, newInterval): """:type intervals: List[Interval] :type newInterval: Interval :rtype: List[Interval]""" if len(intervals) == 0: return [newInterval] for i in range(len(intervals)): if i == 0 and intervals[0].start >= newInterval....
the_stack_v2_python_sparse
LeetCode/Ex0/Ex57.py
JasonVann/CrackingCodingInterview
train
0
df4d3c58825ba83a47f08c1c2dac58d23b94e7aa
[ "n = len(nums)\n\n@lru_cache(None)\ndef dfs(total):\n if total > target:\n return 0\n if total == target:\n return 1\n result = 0\n for num in nums:\n result += dfs(total + num)\n return result\nreturn dfs(0)", "dp = [0] * (target + 1)\ndp[0] = 1\nfor i in range(1, target + 1):...
<|body_start_0|> n = len(nums) @lru_cache(None) def dfs(total): if total > target: return 0 if total == target: return 1 result = 0 for num in nums: result += dfs(total + num) return resu...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def combinationSum4(self, nums: List[int], target: int) -> int: """DFS""" <|body_0|> def combinationSum4(self, nums: List[int], target: int) -> int: """DP, Time: O(n*target), Space: O(target)""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_000782
980
no_license
[ { "docstring": "DFS", "name": "combinationSum4", "signature": "def combinationSum4(self, nums: List[int], target: int) -> int" }, { "docstring": "DP, Time: O(n*target), Space: O(target)", "name": "combinationSum4", "signature": "def combinationSum4(self, nums: List[int], target: int) -> ...
2
stack_v2_sparse_classes_30k_train_006090
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4(self, nums: List[int], target: int) -> int: DFS - def combinationSum4(self, nums: List[int], target: int) -> int: DP, Time: O(n*target), Space: O(target)
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def combinationSum4(self, nums: List[int], target: int) -> int: DFS - def combinationSum4(self, nums: List[int], target: int) -> int: DP, Time: O(n*target), Space: O(target) <|s...
72136e3487d239f5b37e2d6393e034262a6bf599
<|skeleton|> class Solution: def combinationSum4(self, nums: List[int], target: int) -> int: """DFS""" <|body_0|> def combinationSum4(self, nums: List[int], target: int) -> int: """DP, Time: O(n*target), Space: O(target)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def combinationSum4(self, nums: List[int], target: int) -> int: """DFS""" n = len(nums) @lru_cache(None) def dfs(total): if total > target: return 0 if total == target: return 1 result = 0 ...
the_stack_v2_python_sparse
python/377-Combination Sum IV.py
cwza/leetcode
train
0
a5b0584ea5548fdd57e313ef050bec4723fb3293
[ "result = []\nfor c in range(C):\n for r in range(R):\n result.append([abs(r - r0), abs(c - c0)])\nreturn result", "from collections import defaultdict\ndistance = defaultdict(list)\nfor r in range(R):\n for c in range(C):\n distance[abs(r - r0) + abs(c - c0)].append([r, c])\nresult = []\nfor ...
<|body_start_0|> result = [] for c in range(C): for r in range(R): result.append([abs(r - r0), abs(c - c0)]) return result <|end_body_0|> <|body_start_1|> from collections import defaultdict distance = defaultdict(list) for r in range(R): ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def _allCellsDistOrder(self, R, C, r0, c0): """:type R: int :type C: int :type r0: int :type c0: int :rtype: List[List[int]]""" <|body_0|> def allCellsDistOrder(self, R, C, r0, c0): """:type R: int :type C: int :type r0: int :type c0: int :rtype: List[List[...
stack_v2_sparse_classes_10k_train_000783
2,764
permissive
[ { "docstring": ":type R: int :type C: int :type r0: int :type c0: int :rtype: List[List[int]]", "name": "_allCellsDistOrder", "signature": "def _allCellsDistOrder(self, R, C, r0, c0)" }, { "docstring": ":type R: int :type C: int :type r0: int :type c0: int :rtype: List[List[int]]", "name": "...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _allCellsDistOrder(self, R, C, r0, c0): :type R: int :type C: int :type r0: int :type c0: int :rtype: List[List[int]] - def allCellsDistOrder(self, R, C, r0, c0): :type R: in...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def _allCellsDistOrder(self, R, C, r0, c0): :type R: int :type C: int :type r0: int :type c0: int :rtype: List[List[int]] - def allCellsDistOrder(self, R, C, r0, c0): :type R: in...
0dd67edca4e0b0323cb5a7239f02ea46383cd15a
<|skeleton|> class Solution: def _allCellsDistOrder(self, R, C, r0, c0): """:type R: int :type C: int :type r0: int :type c0: int :rtype: List[List[int]]""" <|body_0|> def allCellsDistOrder(self, R, C, r0, c0): """:type R: int :type C: int :type r0: int :type c0: int :rtype: List[List[...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def _allCellsDistOrder(self, R, C, r0, c0): """:type R: int :type C: int :type r0: int :type c0: int :rtype: List[List[int]]""" result = [] for c in range(C): for r in range(R): result.append([abs(r - r0), abs(c - c0)]) return result d...
the_stack_v2_python_sparse
1030.matrix-cells-in-distance-order.py
windard/leeeeee
train
0
6e6408893207a3ae9634aff5985f9527d690e142
[ "button_list = [u'业务管理', u'投注卡管理', u'投注卡信息', u'展开']\nself.click_button_for_one(button_list[0])\nsleep(2)\nself.click_more_button_for_one(button_list[1:4])", "if info_list[0] != u'':\n self.input_text_message_for_inside_text(u'请输入投注卡编号', info_list[0])\nif info_list[1] != u'':\n self.open_list_menu_by_inside_...
<|body_start_0|> button_list = [u'业务管理', u'投注卡管理', u'投注卡信息', u'展开'] self.click_button_for_one(button_list[0]) sleep(2) self.click_more_button_for_one(button_list[1:4]) <|end_body_0|> <|body_start_1|> if info_list[0] != u'': self.input_text_message_for_inside_text(u'请...
投注卡信息页面
cardInformationPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cardInformationPage: """投注卡信息页面""" def open_card_information(self): """打开投注卡信息页面""" <|body_0|> def search_card_information(self, info_list): """投注卡信息查询""" <|body_1|> def switch_to_card_information(self): """切换至投注卡信息查页面""" <|body_2|> ...
stack_v2_sparse_classes_10k_train_000784
1,510
no_license
[ { "docstring": "打开投注卡信息页面", "name": "open_card_information", "signature": "def open_card_information(self)" }, { "docstring": "投注卡信息查询", "name": "search_card_information", "signature": "def search_card_information(self, info_list)" }, { "docstring": "切换至投注卡信息查页面", "name": "sw...
3
stack_v2_sparse_classes_30k_train_006217
Implement the Python class `cardInformationPage` described below. Class description: 投注卡信息页面 Method signatures and docstrings: - def open_card_information(self): 打开投注卡信息页面 - def search_card_information(self, info_list): 投注卡信息查询 - def switch_to_card_information(self): 切换至投注卡信息查页面
Implement the Python class `cardInformationPage` described below. Class description: 投注卡信息页面 Method signatures and docstrings: - def open_card_information(self): 打开投注卡信息页面 - def search_card_information(self, info_list): 投注卡信息查询 - def switch_to_card_information(self): 切换至投注卡信息查页面 <|skeleton|> class cardInformationPag...
dcae68955b2857bbfe411145432865c57561c9ef
<|skeleton|> class cardInformationPage: """投注卡信息页面""" def open_card_information(self): """打开投注卡信息页面""" <|body_0|> def search_card_information(self, info_list): """投注卡信息查询""" <|body_1|> def switch_to_card_information(self): """切换至投注卡信息查页面""" <|body_2|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class cardInformationPage: """投注卡信息页面""" def open_card_information(self): """打开投注卡信息页面""" button_list = [u'业务管理', u'投注卡管理', u'投注卡信息', u'展开'] self.click_button_for_one(button_list[0]) sleep(2) self.click_more_button_for_one(button_list[1:4]) def search_card_informati...
the_stack_v2_python_sparse
genlot_vlt2/pages/Business_management/card_balance_page/card_manage_card_information_page.py
bbwdi/auto
train
1
ed48c783fbe2f6dad6e5fa15eaf7e71a08a55584
[ "config_settings = {}\nif os.path.isfile(config_path):\n with open(config_path, 'r') as clam_config:\n yaml_config = yaml.load(clam_config)\n if yaml_config['ocav_ops_files']:\n config_settings['ocav_ops_files'] = yaml_config['ocav_ops_files']\n if yaml_config['ocav_s3_bucket']:\n...
<|body_start_0|> config_settings = {} if os.path.isfile(config_path): with open(config_path, 'r') as clam_config: yaml_config = yaml.load(clam_config) if yaml_config['ocav_ops_files']: config_settings['ocav_ops_files'] = yaml_config['ocav_o...
Class to upload clam config files and databases to an S3 bucket.
UpdateBucket
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateBucket: """Class to upload clam config files and databases to an S3 bucket.""" def get_config(config_path): """Open and read config data from the variables file.""" <|body_0|> def upload_files(bucket, file_list, aws_creds_file, timestamp): """Use the provid...
stack_v2_sparse_classes_10k_train_000785
3,647
permissive
[ { "docstring": "Open and read config data from the variables file.", "name": "get_config", "signature": "def get_config(config_path)" }, { "docstring": "Use the provided credentials to upload files to the specified bucket. Raises: A ValueError if the specified bucket can not be found.", "nam...
3
null
Implement the Python class `UpdateBucket` described below. Class description: Class to upload clam config files and databases to an S3 bucket. Method signatures and docstrings: - def get_config(config_path): Open and read config data from the variables file. - def upload_files(bucket, file_list, aws_creds_file, times...
Implement the Python class `UpdateBucket` described below. Class description: Class to upload clam config files and databases to an S3 bucket. Method signatures and docstrings: - def get_config(config_path): Open and read config data from the variables file. - def upload_files(bucket, file_list, aws_creds_file, times...
e342f6659a4ef1a188ff403e2fc6b06ac6d119c7
<|skeleton|> class UpdateBucket: """Class to upload clam config files and databases to an S3 bucket.""" def get_config(config_path): """Open and read config data from the variables file.""" <|body_0|> def upload_files(bucket, file_list, aws_creds_file, timestamp): """Use the provid...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateBucket: """Class to upload clam config files and databases to an S3 bucket.""" def get_config(config_path): """Open and read config data from the variables file.""" config_settings = {} if os.path.isfile(config_path): with open(config_path, 'r') as clam_config: ...
the_stack_v2_python_sparse
scripts/clam-update/push_clam_signatures.py
openshift/openshift-tools
train
170
b4643d057c94727aab206871daa05d033c2da29a
[ "self.vectors = vec2d\nself.list_index = 0\nself.element_index = 0", "if self.hasNext():\n value = self.vectors[self.list_index][self.element_index]\n self.element_index += 1\n return value", "while self.list_index < len(self.vectors):\n if self.element_index < len(self.vectors[self.list_index]):\n ...
<|body_start_0|> self.vectors = vec2d self.list_index = 0 self.element_index = 0 <|end_body_0|> <|body_start_1|> if self.hasNext(): value = self.vectors[self.list_index][self.element_index] self.element_index += 1 return value <|end_body_1|> <|body_s...
Vector2D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_10k_train_000786
1,316
no_license
[ { "docstring": "Initialize your data structure here. :type vec2d: List[List[int]]", "name": "__init__", "signature": "def __init__(self, vec2d)" }, { "docstring": ":rtype: int", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext",...
3
stack_v2_sparse_classes_30k_train_000760
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool
Implement the Python class `Vector2D` described below. Class description: Implement the Vector2D class. Method signatures and docstrings: - def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]] - def next(self): :rtype: int - def hasNext(self): :rtype: bool <|skeleton|> class V...
086b7c9b3651a0e70c5794f6c264eb975cc90363
<|skeleton|> class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" <|body_0|> def next(self): """:rtype: int""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Vector2D: def __init__(self, vec2d): """Initialize your data structure here. :type vec2d: List[List[int]]""" self.vectors = vec2d self.list_index = 0 self.element_index = 0 def next(self): """:rtype: int""" if self.hasNext(): value = self.vector...
the_stack_v2_python_sparse
flatten_2d_vector.py
chunweiliu/leetcode2
train
4
c75f973a3205155925e4538aa1611d10b3548397
[ "self.client = Client()\nself.form_url = reverse('index')\nself.form_url_II = reverse('create')", "response = self.client.get(self.form_url)\nself.assertEqual(response.status_code, 200)\nself.assertTemplateUsed(response, 'index.html')" ]
<|body_start_0|> self.client = Client() self.form_url = reverse('index') self.form_url_II = reverse('create') <|end_body_0|> <|body_start_1|> response = self.client.get(self.form_url) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'index.ht...
Class with unittests for views.
TestViews
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestViews: """Class with unittests for views.""" def setUp(self): """Set up for tests.""" <|body_0|> def test_GET_index(self): """GET method for index, tests.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.client = Client() self.fo...
stack_v2_sparse_classes_10k_train_000787
709
no_license
[ { "docstring": "Set up for tests.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "GET method for index, tests.", "name": "test_GET_index", "signature": "def test_GET_index(self)" } ]
2
null
Implement the Python class `TestViews` described below. Class description: Class with unittests for views. Method signatures and docstrings: - def setUp(self): Set up for tests. - def test_GET_index(self): GET method for index, tests.
Implement the Python class `TestViews` described below. Class description: Class with unittests for views. Method signatures and docstrings: - def setUp(self): Set up for tests. - def test_GET_index(self): GET method for index, tests. <|skeleton|> class TestViews: """Class with unittests for views.""" def s...
3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f
<|skeleton|> class TestViews: """Class with unittests for views.""" def setUp(self): """Set up for tests.""" <|body_0|> def test_GET_index(self): """GET method for index, tests.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestViews: """Class with unittests for views.""" def setUp(self): """Set up for tests.""" self.client = Client() self.form_url = reverse('index') self.form_url_II = reverse('create') def test_GET_index(self): """GET method for index, tests.""" response...
the_stack_v2_python_sparse
Django/Django_three_projects/urlshortner/shortner/test_views.py
JakubKazimierski/PythonPortfolio
train
9
54c4f3520d5d633aec41806b924b17ff1faf61a8
[ "QtWidgets.QDialog.__init__(self)\nself.df = pandaTable\nself.layout = QtWidgets.QGridLayout(self)\nself.rankSelect = QtWidgets.QComboBox()\nself.rankSelect.addItems(self.df.columns.values)\nself.programSelect = QtWidgets.QComboBox()\nself.programSelect.addItems(self.df.columns.values)\nself.layout.addWidget(self.p...
<|body_start_0|> QtWidgets.QDialog.__init__(self) self.df = pandaTable self.layout = QtWidgets.QGridLayout(self) self.rankSelect = QtWidgets.QComboBox() self.rankSelect.addItems(self.df.columns.values) self.programSelect = QtWidgets.QComboBox() self.programSelect....
A dialog box to get the information required by the ranksbyPrograms function.
RanksByProgramsDialogBox
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RanksByProgramsDialogBox: """A dialog box to get the information required by the ranksbyPrograms function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" <|body_0|> def getResult...
stack_v2_sparse_classes_10k_train_000788
29,548
no_license
[ { "docstring": "Initializes the UI and sets the two dropdowns to display column names of the active Panda.", "name": "__init__", "signature": "def __init__(self, pandaTable, parent)" }, { "docstring": "Returns the user's input", "name": "getResults", "signature": "def getResults(self, pa...
2
stack_v2_sparse_classes_30k_train_000425
Implement the Python class `RanksByProgramsDialogBox` described below. Class description: A dialog box to get the information required by the ranksbyPrograms function. Method signatures and docstrings: - def __init__(self, pandaTable, parent): Initializes the UI and sets the two dropdowns to display column names of t...
Implement the Python class `RanksByProgramsDialogBox` described below. Class description: A dialog box to get the information required by the ranksbyPrograms function. Method signatures and docstrings: - def __init__(self, pandaTable, parent): Initializes the UI and sets the two dropdowns to display column names of t...
1a3c5ad967472faf66236a311cc07a5128f5f911
<|skeleton|> class RanksByProgramsDialogBox: """A dialog box to get the information required by the ranksbyPrograms function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" <|body_0|> def getResult...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RanksByProgramsDialogBox: """A dialog box to get the information required by the ranksbyPrograms function.""" def __init__(self, pandaTable, parent): """Initializes the UI and sets the two dropdowns to display column names of the active Panda.""" QtWidgets.QDialog.__init__(self) s...
the_stack_v2_python_sparse
datatool/gui/Model.py
scottawalton/datatool
train
0
9192d05768c17a08011946c8b55794d195f22761
[ "self.root = Node()\nfor i, word in enumerate(words):\n longw = word + '#' + word\n for j in range(len(word)):\n cur = self.root\n cur.index = i\n for c in longw[j:]:\n cur = cur[c]\n cur.index = i", "word = suffix + '#' + prefix\ncur = self.root\nfor c in word:\n ...
<|body_start_0|> self.root = Node() for i, word in enumerate(words): longw = word + '#' + word for j in range(len(word)): cur = self.root cur.index = i for c in longw[j:]: cur = cur[c] cur.ind...
WordFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.root = Node() for i, word in ...
stack_v2_sparse_classes_10k_train_000789
2,614
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type prefix: str :type suffix: str :rtype: int", "name": "f", "signature": "def f(self, prefix, suffix)" } ]
2
stack_v2_sparse_classes_30k_train_002247
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int <|skeleton|> class WordFilter: def __in...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WordFilter: def __init__(self, words): """:type words: List[str]""" self.root = Node() for i, word in enumerate(words): longw = word + '#' + word for j in range(len(word)): cur = self.root cur.index = i for c in lo...
the_stack_v2_python_sparse
P/PrefixandSuffixSearch.py
bssrdf/pyleet
train
2
4bcb3b48cba68dea3d255a9dd531c4f161fc1429
[ "cnt1, cnt2 = (Counter(ransomNote), Counter(magazine))\nfor letter, v in cnt1.items():\n if v > cnt2.get(letter, 0):\n return False\nreturn True", "cnt = Counter(ransomNote)\nfor letter, v in cnt.items():\n if v > magazine.count(letter):\n return False\nreturn True", "pos = {}\nfor c in rans...
<|body_start_0|> cnt1, cnt2 = (Counter(ransomNote), Counter(magazine)) for letter, v in cnt1.items(): if v > cnt2.get(letter, 0): return False return True <|end_body_0|> <|body_start_1|> cnt = Counter(ransomNote) for letter, v in cnt.items(): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def canConstruct1(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_0|> def canConstruct2(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_1|> def ca...
stack_v2_sparse_classes_10k_train_000790
1,855
no_license
[ { "docstring": ":type ransomNote: str :type magazine: str :rtype: bool", "name": "canConstruct1", "signature": "def canConstruct1(self, ransomNote, magazine)" }, { "docstring": ":type ransomNote: str :type magazine: str :rtype: bool", "name": "canConstruct2", "signature": "def canConstru...
3
stack_v2_sparse_classes_30k_train_002691
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canConstruct1(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool - def canConstruct2(self, ransomNote, magazine): :type ransomNote: str :type...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def canConstruct1(self, ransomNote, magazine): :type ransomNote: str :type magazine: str :rtype: bool - def canConstruct2(self, ransomNote, magazine): :type ransomNote: str :type...
4a1747b6497305f3821612d9c358a6795b1690da
<|skeleton|> class Solution: def canConstruct1(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_0|> def canConstruct2(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" <|body_1|> def ca...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def canConstruct1(self, ransomNote, magazine): """:type ransomNote: str :type magazine: str :rtype: bool""" cnt1, cnt2 = (Counter(ransomNote), Counter(magazine)) for letter, v in cnt1.items(): if v > cnt2.get(letter, 0): return False return...
the_stack_v2_python_sparse
String/q383_ransom_note.py
sevenhe716/LeetCode
train
0
aeda58e49a488dbebde457d4dc86fa231f11d5e2
[ "self.warmup_epochs = warmup_epochs\nself.total_epochs = total_epochs\nself.warmup_start_lr = warmup_start_lr\nself.start_lr = start_lr\nself.end_lr = end_lr\nself.cycles = cycles\nsuper(WarmupCosineScheduler, self).__init__(learning_rate, last_epoch, verbose)", "if self.last_epoch < self.warmup_epochs:\n val ...
<|body_start_0|> self.warmup_epochs = warmup_epochs self.total_epochs = total_epochs self.warmup_start_lr = warmup_start_lr self.start_lr = start_lr self.end_lr = end_lr self.cycles = cycles super(WarmupCosineScheduler, self).__init__(learning_rate, last_epoch, ve...
Warmup Cosine Scheduler First apply linear warmup, then apply cosine decay schedule. Linearly increase learning rate from "warmup_start_lr" to "start_lr" over "warmup_epochs" Cosinely decrease learning rate from "start_lr" to "end_lr" over remaining "total_epochs - warmup_epochs" Attributes: learning_rate: the starting...
WarmupCosineScheduler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WarmupCosineScheduler: """Warmup Cosine Scheduler First apply linear warmup, then apply cosine decay schedule. Linearly increase learning rate from "warmup_start_lr" to "start_lr" over "warmup_epochs" Cosinely decrease learning rate from "start_lr" to "end_lr" over remaining "total_epochs - warmu...
stack_v2_sparse_classes_10k_train_000791
8,472
permissive
[ { "docstring": "init WarmupCosineScheduler", "name": "__init__", "signature": "def __init__(self, learning_rate, warmup_start_lr, start_lr, end_lr, warmup_epochs, total_epochs, cycles=0.5, last_epoch=-1, verbose=False)" }, { "docstring": "return lr value", "name": "get_lr", "signature": ...
2
stack_v2_sparse_classes_30k_train_006440
Implement the Python class `WarmupCosineScheduler` described below. Class description: Warmup Cosine Scheduler First apply linear warmup, then apply cosine decay schedule. Linearly increase learning rate from "warmup_start_lr" to "start_lr" over "warmup_epochs" Cosinely decrease learning rate from "start_lr" to "end_l...
Implement the Python class `WarmupCosineScheduler` described below. Class description: Warmup Cosine Scheduler First apply linear warmup, then apply cosine decay schedule. Linearly increase learning rate from "warmup_start_lr" to "start_lr" over "warmup_epochs" Cosinely decrease learning rate from "start_lr" to "end_l...
c90a6c8dc3787e69cef3a37b9a260bd59eeff1f7
<|skeleton|> class WarmupCosineScheduler: """Warmup Cosine Scheduler First apply linear warmup, then apply cosine decay schedule. Linearly increase learning rate from "warmup_start_lr" to "start_lr" over "warmup_epochs" Cosinely decrease learning rate from "start_lr" to "end_lr" over remaining "total_epochs - warmu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class WarmupCosineScheduler: """Warmup Cosine Scheduler First apply linear warmup, then apply cosine decay schedule. Linearly increase learning rate from "warmup_start_lr" to "start_lr" over "warmup_epochs" Cosinely decrease learning rate from "start_lr" to "end_lr" over remaining "total_epochs - warmup_epochs" Att...
the_stack_v2_python_sparse
object_detection/DETR/utils.py
Dongsheng-Bi/PaddleViT
train
1
fe679d5f56871253bef8e90afee1deaa87381d75
[ "res = super(create_quick_purchase, self)._onchange_product_id()\nproduct = self.product_id\nif product:\n if product.purchase_line_warn != 'no-message':\n res = {'warning': {'title': _('Warning for %s') % product.name, 'message': product.purchase_line_warn_msg}}\nreturn res", "warning = {}\ntitle = Fal...
<|body_start_0|> res = super(create_quick_purchase, self)._onchange_product_id() product = self.product_id if product: if product.purchase_line_warn != 'no-message': res = {'warning': {'title': _('Warning for %s') % product.name, 'message': product.purchase_line_warn_...
create_quick_purchase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class create_quick_purchase: def _onchange_product_id(self): """Surcharge du onchange des produits du wizard de création rapide d'achat, lorsqu'on sélectionne un produit on vérifie s'il dispose ou non d'un warning et on l'affiche si c'est le cas.""" <|body_0|> def _onchange_partne...
stack_v2_sparse_classes_10k_train_000792
1,707
no_license
[ { "docstring": "Surcharge du onchange des produits du wizard de création rapide d'achat, lorsqu'on sélectionne un produit on vérifie s'il dispose ou non d'un warning et on l'affiche si c'est le cas.", "name": "_onchange_product_id", "signature": "def _onchange_product_id(self)" }, { "docstring":...
2
stack_v2_sparse_classes_30k_train_006827
Implement the Python class `create_quick_purchase` described below. Class description: Implement the create_quick_purchase class. Method signatures and docstrings: - def _onchange_product_id(self): Surcharge du onchange des produits du wizard de création rapide d'achat, lorsqu'on sélectionne un produit on vérifie s'i...
Implement the Python class `create_quick_purchase` described below. Class description: Implement the create_quick_purchase class. Method signatures and docstrings: - def _onchange_product_id(self): Surcharge du onchange des produits du wizard de création rapide d'achat, lorsqu'on sélectionne un produit on vérifie s'i...
eb394e1f79ba1995da2dcd81adfdd511c22caff9
<|skeleton|> class create_quick_purchase: def _onchange_product_id(self): """Surcharge du onchange des produits du wizard de création rapide d'achat, lorsqu'on sélectionne un produit on vérifie s'il dispose ou non d'un warning et on l'affiche si c'est le cas.""" <|body_0|> def _onchange_partne...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class create_quick_purchase: def _onchange_product_id(self): """Surcharge du onchange des produits du wizard de création rapide d'achat, lorsqu'on sélectionne un produit on vérifie s'il dispose ou non d'un warning et on l'affiche si c'est le cas.""" res = super(create_quick_purchase, self)._onchange...
the_stack_v2_python_sparse
OpenPROD/openprod-addons/warning/wizard/create_quick_purchase.py
kazacube-mziouadi/ceci
train
0
44ca53d6280718d50d5b49a3c1a6f28f7f28fc63
[ "super().__init__()\nself.mask_l2_weight = mask_l2_weight\nself.channel_weight = channel_weight\nself.spatial_weight = spatial_weight\nself.nonloacl_weight = nonloacl_weight\nself.loss_weight = loss_weight", "losses = 0.0\ns_spatial_mask, s_channel_mask, s_channel_pool_adapt, s_spatial_pool_adapt, s_relation_adap...
<|body_start_0|> super().__init__() self.mask_l2_weight = mask_l2_weight self.channel_weight = channel_weight self.spatial_weight = spatial_weight self.nonloacl_weight = nonloacl_weight self.loss_weight = loss_weight <|end_body_0|> <|body_start_1|> losses = 0.0 ...
Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l2 loss. Defaults to 7e-5, which is the default value in source code. channe...
FBKDLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FBKDLoss: """Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l2 loss. Defaults to 7e-5, which is the ...
stack_v2_sparse_classes_10k_train_000793
4,435
permissive
[ { "docstring": "Inits FBKDLoss.", "name": "__init__", "signature": "def __init__(self, mask_l2_weight: float=7e-05, channel_weight: float=0.004, spatial_weight: float=0.004, nonloacl_weight: float=7e-05, loss_weight: float=1.0) -> None" }, { "docstring": "Forward function of FBKDLoss, including ...
2
null
Implement the Python class `FBKDLoss` described below. Class description: Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l...
Implement the Python class `FBKDLoss` described below. Class description: Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l...
9d643e88946fc4a24f2d4d073c08b05ea693f4c5
<|skeleton|> class FBKDLoss: """Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l2 loss. Defaults to 7e-5, which is the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FBKDLoss: """Loss For FBKD, which includs feat_loss, channel_loss, spatial_loss and nonlocal_loss. Source code: https://github.com/ArchipLab-LinfengZhang/Object-Detection-Knowledge- Distillation-ICLR2021 Args: mask_l2_weight (float): The weight of the mask l2 loss. Defaults to 7e-5, which is the default value...
the_stack_v2_python_sparse
cv/distiller/CWD/pytorch/mmrazor/mmrazor/models/losses/fbkd_loss.py
Deep-Spark/DeepSparkHub
train
7
66284f5d00c672fdd26fd53213b47ab1fb673281
[ "if request.user.has_perm(CHANGE_TASK):\n task = Task.objects.get(pk=request.data['id_task'])\n team = Team.objects.get(pk=request.data['id_team'])\n task.teams.add(team)\n return Response(status=status.HTTP_201_CREATED)\nreturn Response(status=status.HTTP_401_UNAUTHORIZED)", "if request.user.has_perm...
<|body_start_0|> if request.user.has_perm(CHANGE_TASK): task = Task.objects.get(pk=request.data['id_task']) team = Team.objects.get(pk=request.data['id_team']) task.teams.add(team) return Response(status=status.HTTP_201_CREATED) return Response(status=stat...
\\n# Assign a team to a task. Parameters : request (HttpRequest) : the request coming from the front-end id (int) : the id of the task Return : response (Response) : the response. POST request : add team to task PUT request : remove team from task If the user doesn't have the permissions, it will send HTTP 401. Both re...
AddTeamToTask
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddTeamToTask: """\\n# Assign a team to a task. Parameters : request (HttpRequest) : the request coming from the front-end id (int) : the id of the task Return : response (Response) : the response. POST request : add team to task PUT request : remove team from task If the user doesn't have the pe...
stack_v2_sparse_classes_10k_train_000794
21,722
permissive
[ { "docstring": "Assign a team to a task.", "name": "post", "signature": "def post(self, request)" }, { "docstring": "Remove a team from a task.", "name": "put", "signature": "def put(self, request)" } ]
2
stack_v2_sparse_classes_30k_train_007113
Implement the Python class `AddTeamToTask` described below. Class description: \\n# Assign a team to a task. Parameters : request (HttpRequest) : the request coming from the front-end id (int) : the id of the task Return : response (Response) : the response. POST request : add team to task PUT request : remove team fr...
Implement the Python class `AddTeamToTask` described below. Class description: \\n# Assign a team to a task. Parameters : request (HttpRequest) : the request coming from the front-end id (int) : the id of the task Return : response (Response) : the response. POST request : add team to task PUT request : remove team fr...
56511ebac83a5dc1fb8768a98bc675e88530a447
<|skeleton|> class AddTeamToTask: """\\n# Assign a team to a task. Parameters : request (HttpRequest) : the request coming from the front-end id (int) : the id of the task Return : response (Response) : the response. POST request : add team to task PUT request : remove team from task If the user doesn't have the pe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AddTeamToTask: """\\n# Assign a team to a task. Parameters : request (HttpRequest) : the request coming from the front-end id (int) : the id of the task Return : response (Response) : the response. POST request : add team to task PUT request : remove team from task If the user doesn't have the permissions, it...
the_stack_v2_python_sparse
maintenancemanagement/views/views_task.py
Open-CMMS/openCMMS_backend
train
4
dbbf5d183f25689802b0dad86796eca5b1bca4bd
[ "self.count = count\nself.environment = environment\nself.size = size", "if dictionary is None:\n return None\ncount = dictionary.get('count')\nenvironment = dictionary.get('environment')\nsize = dictionary.get('size')\nreturn cls(count, environment, size)" ]
<|body_start_0|> self.count = count self.environment = environment self.size = size <|end_body_0|> <|body_start_1|> if dictionary is None: return None count = dictionary.get('count') environment = dictionary.get('environment') size = dictionary.get('s...
Implementation of the 'VaultProviderStatsByEnv' model. Specifies the Vault stats by environments. Attributes: count (long|int): Specifies the count of the objects of the specified environment. environment (EnvironmentVaultProviderStatsByEnvEnum): Specifies the environment type. size (long|int): Specifies the size of th...
VaultProviderStatsByEnv
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VaultProviderStatsByEnv: """Implementation of the 'VaultProviderStatsByEnv' model. Specifies the Vault stats by environments. Attributes: count (long|int): Specifies the count of the objects of the specified environment. environment (EnvironmentVaultProviderStatsByEnvEnum): Specifies the environm...
stack_v2_sparse_classes_10k_train_000795
1,885
permissive
[ { "docstring": "Constructor for the VaultProviderStatsByEnv class", "name": "__init__", "signature": "def __init__(self, count=None, environment=None, size=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of ...
2
null
Implement the Python class `VaultProviderStatsByEnv` described below. Class description: Implementation of the 'VaultProviderStatsByEnv' model. Specifies the Vault stats by environments. Attributes: count (long|int): Specifies the count of the objects of the specified environment. environment (EnvironmentVaultProvider...
Implement the Python class `VaultProviderStatsByEnv` described below. Class description: Implementation of the 'VaultProviderStatsByEnv' model. Specifies the Vault stats by environments. Attributes: count (long|int): Specifies the count of the objects of the specified environment. environment (EnvironmentVaultProvider...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class VaultProviderStatsByEnv: """Implementation of the 'VaultProviderStatsByEnv' model. Specifies the Vault stats by environments. Attributes: count (long|int): Specifies the count of the objects of the specified environment. environment (EnvironmentVaultProviderStatsByEnvEnum): Specifies the environm...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class VaultProviderStatsByEnv: """Implementation of the 'VaultProviderStatsByEnv' model. Specifies the Vault stats by environments. Attributes: count (long|int): Specifies the count of the objects of the specified environment. environment (EnvironmentVaultProviderStatsByEnvEnum): Specifies the environment type. siz...
the_stack_v2_python_sparse
cohesity_management_sdk/models/vault_provider_stats_by_env.py
cohesity/management-sdk-python
train
24
6544b630174ec46621b87b7fff5e3fddeef21266
[ "url = self.trimUrlPrefix(urlTrait.url)\nif url and self.isTnsStyle(url):\n EMPTY = OracleTnsRecordParser.EMPTY\n obj = OracleTnsRecordParser().parse(url)\n uniqueHostCount = self._countUniqueHosts(obj)\n description = self._getDescription(obj)\n serviceName = description.connect_data.service_name\n ...
<|body_start_0|> url = self.trimUrlPrefix(urlTrait.url) if url and self.isTnsStyle(url): EMPTY = OracleTnsRecordParser.EMPTY obj = OracleTnsRecordParser().parse(url) uniqueHostCount = self._countUniqueHosts(obj) description = self._getDescription(obj) ...
OracleThinHasSidCase
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OracleThinHasSidCase: def isApplicableUrlTrait(self, urlTrait): """@types: jdbc_url_parser.Trait -> bool""" <|body_0|> def parse(self, url): """@types: str -> tuple[db.DatabaseServer]""" <|body_1|> <|end_skeleton|> <|body_start_0|> url = self.trimUr...
stack_v2_sparse_classes_10k_train_000796
40,819
no_license
[ { "docstring": "@types: jdbc_url_parser.Trait -> bool", "name": "isApplicableUrlTrait", "signature": "def isApplicableUrlTrait(self, urlTrait)" }, { "docstring": "@types: str -> tuple[db.DatabaseServer]", "name": "parse", "signature": "def parse(self, url)" } ]
2
stack_v2_sparse_classes_30k_test_000154
Implement the Python class `OracleThinHasSidCase` described below. Class description: Implement the OracleThinHasSidCase class. Method signatures and docstrings: - def isApplicableUrlTrait(self, urlTrait): @types: jdbc_url_parser.Trait -> bool - def parse(self, url): @types: str -> tuple[db.DatabaseServer]
Implement the Python class `OracleThinHasSidCase` described below. Class description: Implement the OracleThinHasSidCase class. Method signatures and docstrings: - def isApplicableUrlTrait(self, urlTrait): @types: jdbc_url_parser.Trait -> bool - def parse(self, url): @types: str -> tuple[db.DatabaseServer] <|skeleto...
c431e809e8d0f82e1bca7e3429dd0245560b5680
<|skeleton|> class OracleThinHasSidCase: def isApplicableUrlTrait(self, urlTrait): """@types: jdbc_url_parser.Trait -> bool""" <|body_0|> def parse(self, url): """@types: str -> tuple[db.DatabaseServer]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OracleThinHasSidCase: def isApplicableUrlTrait(self, urlTrait): """@types: jdbc_url_parser.Trait -> bool""" url = self.trimUrlPrefix(urlTrait.url) if url and self.isTnsStyle(url): EMPTY = OracleTnsRecordParser.EMPTY obj = OracleTnsRecordParser().parse(url) ...
the_stack_v2_python_sparse
reference/ucmdb/discovery/jdbc_url_parser.py
madmonkyang/cda-record
train
0
cb88c5175ce1714d6e75bda08b33c25e19a3e474
[ "self.end_time_msecs = end_time_msecs\nself.env_type = env_type\nself.job_id = job_id\nself.job_name = job_name\nself.job_run_id = job_run_id\nself.job_type = job_type\nself.start_time_msecs = start_time_msecs\nself.view_box_id = view_box_id", "if dictionary is None:\n return None\nend_time_msecs = dictionary....
<|body_start_0|> self.end_time_msecs = end_time_msecs self.env_type = env_type self.job_id = job_id self.job_name = job_name self.job_run_id = job_run_id self.job_type = job_type self.start_time_msecs = start_time_msecs self.view_box_id = view_box_id <|end...
Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the run. env_type (EnvTypeEnum): Specifies the environment type of the job. Supported envi...
GetAllJobRunsResult
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetAllJobRunsResult: """Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the run. env_type (EnvTypeEnum): Specifies ...
stack_v2_sparse_classes_10k_train_000797
6,994
permissive
[ { "docstring": "Constructor for the GetAllJobRunsResult class", "name": "__init__", "signature": "def __init__(self, end_time_msecs=None, env_type=None, job_id=None, job_name=None, job_run_id=None, job_type=None, start_time_msecs=None, view_box_id=None)" }, { "docstring": "Creates an instance of...
2
null
Implement the Python class `GetAllJobRunsResult` described below. Class description: Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the ...
Implement the Python class `GetAllJobRunsResult` described below. Class description: Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the ...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class GetAllJobRunsResult: """Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the run. env_type (EnvTypeEnum): Specifies ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GetAllJobRunsResult: """Implementation of the 'GetAllJobRunsResult' model. Specifies the common result structure of the response of all runs info ( protection, replication, archival etc.). Attributes: end_time_msecs (long|int): Specifies the end time of the run. env_type (EnvTypeEnum): Specifies the environme...
the_stack_v2_python_sparse
cohesity_management_sdk/models/get_all_job_runs_result.py
cohesity/management-sdk-python
train
24
8d00f6f2379b4c050501c270cd78756fa3737ac7
[ "filters = filters or {}\nif not is_user_action_allowed('manage_others_tokens'):\n filters['_user_fk'] = current_user.id\nsm = get_storage_manager()\nresult = sm.list(models.Token, filters=filters, pagination=pagination, sort=sort)\nreturn result", "_purge_expired_user_tokens()\nrequest_dict = get_json_and_ver...
<|body_start_0|> filters = filters or {} if not is_user_action_allowed('manage_others_tokens'): filters['_user_fk'] = current_user.id sm = get_storage_manager() result = sm.list(models.Token, filters=filters, pagination=pagination, sort=sort) return result <|end_body_...
Tokens
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Tokens: def get(self, filters=None, pagination=None, sort=None): """Get a list of tokens.""" <|body_0|> def post(self): """Create a new token.""" <|body_1|> <|end_skeleton|> <|body_start_0|> filters = filters or {} if not is_user_action_allo...
stack_v2_sparse_classes_10k_train_000798
3,246
permissive
[ { "docstring": "Get a list of tokens.", "name": "get", "signature": "def get(self, filters=None, pagination=None, sort=None)" }, { "docstring": "Create a new token.", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_006784
Implement the Python class `Tokens` described below. Class description: Implement the Tokens class. Method signatures and docstrings: - def get(self, filters=None, pagination=None, sort=None): Get a list of tokens. - def post(self): Create a new token.
Implement the Python class `Tokens` described below. Class description: Implement the Tokens class. Method signatures and docstrings: - def get(self, filters=None, pagination=None, sort=None): Get a list of tokens. - def post(self): Create a new token. <|skeleton|> class Tokens: def get(self, filters=None, pagi...
c0de6442e1d7653fad824d75e571802a74eee605
<|skeleton|> class Tokens: def get(self, filters=None, pagination=None, sort=None): """Get a list of tokens.""" <|body_0|> def post(self): """Create a new token.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Tokens: def get(self, filters=None, pagination=None, sort=None): """Get a list of tokens.""" filters = filters or {} if not is_user_action_allowed('manage_others_tokens'): filters['_user_fk'] = current_user.id sm = get_storage_manager() result = sm.list(mode...
the_stack_v2_python_sparse
rest-service/manager_rest/rest/resources_v3_1/tokens.py
cloudify-cosmo/cloudify-manager
train
146
d349de07b292bdeab635290cd1dfcd044933b896
[ "res = 0\nfor i in range(len(nums)):\n res = max(res, nums[i] + self.rob(nums[i + 2:]))\nreturn res", "if not nums:\n return 0\np_0 = nums[0]\nif len(nums) == 1:\n return p_0\np_1 = max(p_0, nums[1])\nfor i in range(2, len(nums)):\n p_2 = max(p_1, p_0 + nums[i])\n p_0 = p_1\n p_1 = p_2\nreturn p...
<|body_start_0|> res = 0 for i in range(len(nums)): res = max(res, nums[i] + self.rob(nums[i + 2:])) return res <|end_body_0|> <|body_start_1|> if not nums: return 0 p_0 = nums[0] if len(nums) == 1: return p_0 p_1 = max(p_0, nu...
Solution
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """Brute Force (Time Limit Exceeded)""" <|body_0|> def rob2(self, nums): """DP""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = 0 for i in range(len(nums)): res = max(res, nums[i] + self.rob(nu...
stack_v2_sparse_classes_10k_train_000799
1,489
permissive
[ { "docstring": "Brute Force (Time Limit Exceeded)", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": "DP", "name": "rob2", "signature": "def rob2(self, nums)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): Brute Force (Time Limit Exceeded) - def rob2(self, nums): DP
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): Brute Force (Time Limit Exceeded) - def rob2(self, nums): DP <|skeleton|> class Solution: def rob(self, nums): """Brute Force (Time Limit Excee...
49a0b03c55d8a702785888d473ef96539265ce9c
<|skeleton|> class Solution: def rob(self, nums): """Brute Force (Time Limit Exceeded)""" <|body_0|> def rob2(self, nums): """DP""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def rob(self, nums): """Brute Force (Time Limit Exceeded)""" res = 0 for i in range(len(nums)): res = max(res, nums[i] + self.rob(nums[i + 2:])) return res def rob2(self, nums): """DP""" if not nums: return 0 p_0 = ...
the_stack_v2_python_sparse
leetcode/0198_house_robber.py
chaosWsF/Python-Practice
train
1