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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bcb0304f544c78aa7454cc82b6d4a01724110714 | [
"if not sample_min_value:\n raise ValueError(f\"\\n Gumbel samplers can only sample a function's minimal value,\\n however received sample_min_value={sample_min_value}\\n \")\nsuper().__init__(sample_min_value)",
"tf.debugging.assert_positive(sample_size)\ntf.debugg... | <|body_start_0|>
if not sample_min_value:
raise ValueError(f"\n Gumbel samplers can only sample a function's minimal value,\n however received sample_min_value={sample_min_value}\n ")
super().__init__(sample_min_value)
<|end_body_0|>
<|body_start... | This sampler follows :cite:`wang2017max` and yields approximate samples of the objective minimum value :math:`y^*` via the empirical cdf :math:`\\operatorname{Pr}(y^*<y)`. The cdf is approximated by a Gumbel distribution .. math:: \\mathcal G(y; a, b) = 1 - e^{-e^\\frac{y - a}{b}} where :math:`a, b \\in \\mathbb R` are... | GumbelSampler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GumbelSampler:
"""This sampler follows :cite:`wang2017max` and yields approximate samples of the objective minimum value :math:`y^*` via the empirical cdf :math:`\\operatorname{Pr}(y^*<y)`. The cdf is approximated by a Gumbel distribution .. math:: \\mathcal G(y; a, b) = 1 - e^{-e^\\frac{y - a}{b... | stack_v2_sparse_classes_10k_train_002600 | 11,521 | permissive | [
{
"docstring": ":sample_min_value: If True then sample from the minimum value of the function, else sample the function's minimiser.",
"name": "__init__",
"signature": "def __init__(self, sample_min_value: bool=False)"
},
{
"docstring": "Return approximate samples from of the objective function'... | 2 | stack_v2_sparse_classes_30k_train_002823 | Implement the Python class `GumbelSampler` described below.
Class description:
This sampler follows :cite:`wang2017max` and yields approximate samples of the objective minimum value :math:`y^*` via the empirical cdf :math:`\\operatorname{Pr}(y^*<y)`. The cdf is approximated by a Gumbel distribution .. math:: \\mathcal... | Implement the Python class `GumbelSampler` described below.
Class description:
This sampler follows :cite:`wang2017max` and yields approximate samples of the objective minimum value :math:`y^*` via the empirical cdf :math:`\\operatorname{Pr}(y^*<y)`. The cdf is approximated by a Gumbel distribution .. math:: \\mathcal... | 56101c092f28ed87398c4cd63fdece2f16909451 | <|skeleton|>
class GumbelSampler:
"""This sampler follows :cite:`wang2017max` and yields approximate samples of the objective minimum value :math:`y^*` via the empirical cdf :math:`\\operatorname{Pr}(y^*<y)`. The cdf is approximated by a Gumbel distribution .. math:: \\mathcal G(y; a, b) = 1 - e^{-e^\\frac{y - a}{b... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GumbelSampler:
"""This sampler follows :cite:`wang2017max` and yields approximate samples of the objective minimum value :math:`y^*` via the empirical cdf :math:`\\operatorname{Pr}(y^*<y)`. The cdf is approximated by a Gumbel distribution .. math:: \\mathcal G(y; a, b) = 1 - e^{-e^\\frac{y - a}{b}} where :mat... | the_stack_v2_python_sparse | trieste/acquisition/sampler.py | secondmind-labs/trieste | train | 190 |
a40e07cf86d5e5e9fcaf2ad6b159c90d02679ccc | [
"buildingCount = len(buildings)\nif buildingCount == 0:\n return []\ncorners = [[L, H, R] for L, R, H in buildings]\ncorners += [[R, None, 0] for L, R, H in buildings]\ncorners.sort()\nskyline = []\nshift = corners[0][0] - 1\nskylineheight = -1\nh = [[0, float('inf')]]\nfor c in corners:\n if c[0] > shift:\n ... | <|body_start_0|>
buildingCount = len(buildings)
if buildingCount == 0:
return []
corners = [[L, H, R] for L, R, H in buildings]
corners += [[R, None, 0] for L, R, H in buildings]
corners.sort()
skyline = []
shift = corners[0][0] - 1
skylineheig... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getSkyline(self, buildings):
""":type buildings: List[List[int]] :rtype: List[List[int]]"""
<|body_0|>
def _getSkyline(self, buildings):
"""https://discuss.leetcode.com/topic/34119/10-line-python-solution-104-ms/2 credit : kitt"""
<|body_1|>
<|... | stack_v2_sparse_classes_10k_train_002601 | 2,450 | no_license | [
{
"docstring": ":type buildings: List[List[int]] :rtype: List[List[int]]",
"name": "getSkyline",
"signature": "def getSkyline(self, buildings)"
},
{
"docstring": "https://discuss.leetcode.com/topic/34119/10-line-python-solution-104-ms/2 credit : kitt",
"name": "_getSkyline",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_000608 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getSkyline(self, buildings): :type buildings: List[List[int]] :rtype: List[List[int]]
- def _getSkyline(self, buildings): https://discuss.leetcode.com/topic/34119/10-line-pyt... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getSkyline(self, buildings): :type buildings: List[List[int]] :rtype: List[List[int]]
- def _getSkyline(self, buildings): https://discuss.leetcode.com/topic/34119/10-line-pyt... | a2841fdb624548fdc6ef430e23ca46f3300e0558 | <|skeleton|>
class Solution:
def getSkyline(self, buildings):
""":type buildings: List[List[int]] :rtype: List[List[int]]"""
<|body_0|>
def _getSkyline(self, buildings):
"""https://discuss.leetcode.com/topic/34119/10-line-python-solution-104-ms/2 credit : kitt"""
<|body_1|>
<|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def getSkyline(self, buildings):
""":type buildings: List[List[int]] :rtype: List[List[int]]"""
buildingCount = len(buildings)
if buildingCount == 0:
return []
corners = [[L, H, R] for L, R, H in buildings]
corners += [[R, None, 0] for L, R, H in b... | the_stack_v2_python_sparse | getSkyLine.py | sfeng77/myleetcode | train | 1 | |
b341a80d0b98d20bd612ab580d168513811c5f8f | [
"fract1 = source.Fraction(5, 2)\nfract2 = source.Fraction(3, 2)\nfract3 = source.Fraction(25, 10)\nself.assertFalse(fract1 != fract3)\nself.assertTrue(fract1 == fract3)\nself.assertTrue(fract2 < fract3)\nself.assertTrue(fract1 >= fract2)\nself.assertFalse(fract2 >= fract3)\nself.assertTrue(fract1 >= 2)\nself.assert... | <|body_start_0|>
fract1 = source.Fraction(5, 2)
fract2 = source.Fraction(3, 2)
fract3 = source.Fraction(25, 10)
self.assertFalse(fract1 != fract3)
self.assertTrue(fract1 == fract3)
self.assertTrue(fract2 < fract3)
self.assertTrue(fract1 >= fract2)
self.ass... | Test exercise mod 06 Fraction | TestFraction | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFraction:
"""Test exercise mod 06 Fraction"""
def test_fraction_rich_comparisson(self):
"""Test fractions rich comparisson operators overloading"""
<|body_0|>
def test_fraction_math_ops(self):
"""Test fractions math operators overloading"""
<|body_1|>... | stack_v2_sparse_classes_10k_train_002602 | 8,327 | no_license | [
{
"docstring": "Test fractions rich comparisson operators overloading",
"name": "test_fraction_rich_comparisson",
"signature": "def test_fraction_rich_comparisson(self)"
},
{
"docstring": "Test fractions math operators overloading",
"name": "test_fraction_math_ops",
"signature": "def tes... | 3 | stack_v2_sparse_classes_30k_test_000051 | Implement the Python class `TestFraction` described below.
Class description:
Test exercise mod 06 Fraction
Method signatures and docstrings:
- def test_fraction_rich_comparisson(self): Test fractions rich comparisson operators overloading
- def test_fraction_math_ops(self): Test fractions math operators overloading
... | Implement the Python class `TestFraction` described below.
Class description:
Test exercise mod 06 Fraction
Method signatures and docstrings:
- def test_fraction_rich_comparisson(self): Test fractions rich comparisson operators overloading
- def test_fraction_math_ops(self): Test fractions math operators overloading
... | 8f082201e24f0f2b991d9388500fdbf95d6f073d | <|skeleton|>
class TestFraction:
"""Test exercise mod 06 Fraction"""
def test_fraction_rich_comparisson(self):
"""Test fractions rich comparisson operators overloading"""
<|body_0|>
def test_fraction_math_ops(self):
"""Test fractions math operators overloading"""
<|body_1|>... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestFraction:
"""Test exercise mod 06 Fraction"""
def test_fraction_rich_comparisson(self):
"""Test fractions rich comparisson operators overloading"""
fract1 = source.Fraction(5, 2)
fract2 = source.Fraction(3, 2)
fract3 = source.Fraction(25, 10)
self.assertFalse(f... | the_stack_v2_python_sparse | intermediate/exercises/mod_04_data_model/tests_mod_04.py | garciacastano09/pycourse | train | 0 |
670549b58a047804b987d2372be6a183d349aa92 | [
"couponInfoDict = self.getDictBykey(self.getSellListByPage(parkName), 'tmpName', refundCouponName)\nself.url = '/mgr/coupon/sell/refund.do'\ndata = {'id': couponInfoDict['id'], 'sellMoney': couponInfoDict['sellMoney'], 'payMoney': couponInfoDict['sellMoney'], 'actPayMoney': couponInfoDict['sellMoney'], 'refundMoney... | <|body_start_0|>
couponInfoDict = self.getDictBykey(self.getSellListByPage(parkName), 'tmpName', refundCouponName)
self.url = '/mgr/coupon/sell/refund.do'
data = {'id': couponInfoDict['id'], 'sellMoney': couponInfoDict['sellMoney'], 'payMoney': couponInfoDict['sellMoney'], 'actPayMoney': couponI... | 售卖管理 | SellManage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SellManage:
"""售卖管理"""
def couponRefund(self, parkName, refundCouponName):
"""优惠劵退款"""
<|body_0|>
def __getParkingBaseDataTree(self):
"""获取当前用户车场"""
<|body_1|>
def getSellListByPage(self, parkName):
"""获取售卖记录"""
<|body_2|>
<|end_skel... | stack_v2_sparse_classes_10k_train_002603 | 1,722 | no_license | [
{
"docstring": "优惠劵退款",
"name": "couponRefund",
"signature": "def couponRefund(self, parkName, refundCouponName)"
},
{
"docstring": "获取当前用户车场",
"name": "__getParkingBaseDataTree",
"signature": "def __getParkingBaseDataTree(self)"
},
{
"docstring": "获取售卖记录",
"name": "getSellLi... | 3 | stack_v2_sparse_classes_30k_train_000217 | Implement the Python class `SellManage` described below.
Class description:
售卖管理
Method signatures and docstrings:
- def couponRefund(self, parkName, refundCouponName): 优惠劵退款
- def __getParkingBaseDataTree(self): 获取当前用户车场
- def getSellListByPage(self, parkName): 获取售卖记录 | Implement the Python class `SellManage` described below.
Class description:
售卖管理
Method signatures and docstrings:
- def couponRefund(self, parkName, refundCouponName): 优惠劵退款
- def __getParkingBaseDataTree(self): 获取当前用户车场
- def getSellListByPage(self, parkName): 获取售卖记录
<|skeleton|>
class SellManage:
"""售卖管理"""
... | 34c368c109867da26d9256bca85f872b0fac2ea7 | <|skeleton|>
class SellManage:
"""售卖管理"""
def couponRefund(self, parkName, refundCouponName):
"""优惠劵退款"""
<|body_0|>
def __getParkingBaseDataTree(self):
"""获取当前用户车场"""
<|body_1|>
def getSellListByPage(self, parkName):
"""获取售卖记录"""
<|body_2|>
<|end_skel... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SellManage:
"""售卖管理"""
def couponRefund(self, parkName, refundCouponName):
"""优惠劵退款"""
couponInfoDict = self.getDictBykey(self.getSellListByPage(parkName), 'tmpName', refundCouponName)
self.url = '/mgr/coupon/sell/refund.do'
data = {'id': couponInfoDict['id'], 'sellMoney':... | the_stack_v2_python_sparse | Api/parkingManage_service/businessCoupon_service/sellManage.py | oyebino/pomp_api | train | 1 |
70f33b4ce9e669293dfb6c0a599db2a964ee4677 | [
"idx = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x\nidy = cuda.blockIdx.y * cuda.blockDim.y + cuda.threadIdx.y\nindex = idx * size + idy\nif idx < size and idy < size:\n if idx > i:\n mul = A[idx * size + i] / A[i * size + i]\n if idy >= i:\n A[index] -= A[i * size + idy] * mul\... | <|body_start_0|>
idx = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x
idy = cuda.blockIdx.y * cuda.blockDim.y + cuda.threadIdx.y
index = idx * size + idy
if idx < size and idy < size:
if idx > i:
mul = A[idx * size + i] / A[i * size + i]
... | GuassianLUDecomposition | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GuassianLUDecomposition:
def gaussian_lu_decomposition(A, L, size, i):
"""Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the multipliers. @param size Size of coefficiente matrix. @param i Integer representing the current column in which... | stack_v2_sparse_classes_10k_train_002604 | 4,828 | no_license | [
{
"docstring": "Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the multipliers. @param size Size of coefficiente matrix. @param i Integer representing the current column in which all threads are performing row operations. @return None",
"name": "gaussian_l... | 6 | stack_v2_sparse_classes_30k_train_001802 | Implement the Python class `GuassianLUDecomposition` described below.
Class description:
Implement the GuassianLUDecomposition class.
Method signatures and docstrings:
- def gaussian_lu_decomposition(A, L, size, i): Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the... | Implement the Python class `GuassianLUDecomposition` described below.
Class description:
Implement the GuassianLUDecomposition class.
Method signatures and docstrings:
- def gaussian_lu_decomposition(A, L, size, i): Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the... | b2b89a18260c25134d50c37a4fbb48981de79218 | <|skeleton|>
class GuassianLUDecomposition:
def gaussian_lu_decomposition(A, L, size, i):
"""Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the multipliers. @param size Size of coefficiente matrix. @param i Integer representing the current column in which... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GuassianLUDecomposition:
def gaussian_lu_decomposition(A, L, size, i):
"""Performs Gaussian LU elimination. @param A Coefficient matrix A. @param L Matrix in which to store the multipliers. @param size Size of coefficiente matrix. @param i Integer representing the current column in which all threads a... | the_stack_v2_python_sparse | project/lu_decomposition/gaussian_lu_decomposition.py | tllano11/Numerical-Methods | train | 3 | |
2738a587cdebd824e5a118e99e4aefeb834e1e21 | [
"super(DWSepConv, self).__init__()\nif norm_layer is None:\n norm_layer = nn.BatchNorm2d\nif kernel_size == 3:\n conv_dw = conv3x3\nelif kernel_size == 5:\n conv_dw = conv5x5\nelse:\n raise ValueError('DWSepConv class only supports kernel size 3x3, 5x5')\nself._outplanes = inplanes * stride\nself.convdw... | <|body_start_0|>
super(DWSepConv, self).__init__()
if norm_layer is None:
norm_layer = nn.BatchNorm2d
if kernel_size == 3:
conv_dw = conv3x3
elif kernel_size == 5:
conv_dw = conv5x5
else:
raise ValueError('DWSepConv class only suppo... | depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride | DWSepConv | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DWSepConv:
"""depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride"""
def __init__(self, inplanes, kernel_size, stride=1, dropout=0, norm_l... | stack_v2_sparse_classes_10k_train_002605 | 20,656 | no_license | [
{
"docstring": "Constructor Args: inplanes: (int) number of input channels to the block kernel_size: (int) kernel_size of conv-dw filter, either 3x3 or 5x5 is supported stride: (int) stride of conv-dw filter dropout: (float) p = dropout; default = 0 (no dropout effect) norm_layer: (nn.Module) normalization laye... | 2 | stack_v2_sparse_classes_30k_train_006838 | Implement the Python class `DWSepConv` described below.
Class description:
depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride
Method signatures and docstrings:
- d... | Implement the Python class `DWSepConv` described below.
Class description:
depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride
Method signatures and docstrings:
- d... | a0c51824b9c4c458918ef9a40a925cd576137d75 | <|skeleton|>
class DWSepConv:
"""depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride"""
def __init__(self, inplanes, kernel_size, stride=1, dropout=0, norm_l... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DWSepConv:
"""depthwise-separable convolution block structure: - conv-dw > bn > relu > 1x1-conv > bn notes: - kernel_size of conv-dw should be parametried, could be 3x3 or 5x5 - output channels = input channels * stride"""
def __init__(self, inplanes, kernel_size, stride=1, dropout=0, norm_layer=None):
... | the_stack_v2_python_sparse | model/mnasnet.py | baihuaxie/ConvLab | train | 0 |
6008284ce3f73614a1a2bc5ec2f0e692476b8616 | [
"self._args = args\nself._kwargs = kwargs\nself._template = template\nif not self._template:\n self._template = '{asctime} {message}'",
"self._kwargs['message'] = record.message\nif '{asctime}' in self._template:\n timestamp = getattr(record, 'timestamp', record.index)\n lt = time.localtime(timestamp)\n ... | <|body_start_0|>
self._args = args
self._kwargs = kwargs
self._template = template
if not self._template:
self._template = '{asctime} {message}'
<|end_body_0|>
<|body_start_1|>
self._kwargs['message'] = record.message
if '{asctime}' in self._template:
... | Class specifying how to format a Record. | Formatter | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Formatter:
"""Class specifying how to format a Record."""
def __init__(self, template=None, *args, **kwargs):
"""Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwargs or supported attributes. *args: Replacement field for p... | stack_v2_sparse_classes_10k_train_002606 | 8,298 | permissive | [
{
"docstring": "Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwargs or supported attributes. *args: Replacement field for positional argument. **kwargs: Replacement field for keyword argument.",
"name": "__init__",
"signature": "def __init_... | 2 | stack_v2_sparse_classes_30k_train_000619 | Implement the Python class `Formatter` described below.
Class description:
Class specifying how to format a Record.
Method signatures and docstrings:
- def __init__(self, template=None, *args, **kwargs): Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwarg... | Implement the Python class `Formatter` described below.
Class description:
Class specifying how to format a Record.
Method signatures and docstrings:
- def __init__(self, template=None, *args, **kwargs): Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwarg... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class Formatter:
"""Class specifying how to format a Record."""
def __init__(self, template=None, *args, **kwargs):
"""Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwargs or supported attributes. *args: Replacement field for p... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Formatter:
"""Class specifying how to format a Record."""
def __init__(self, template=None, *args, **kwargs):
"""Initializes formatter. Args: template: String template which can contain placeholders for arguments in args, kwargs or supported attributes. *args: Replacement field for positional arg... | the_stack_v2_python_sparse | third_party/catapult/dashboard/dashboard/quick_logger.py | metux/chromium-suckless | train | 5 |
59127335de0806c64425342931cbfd5edf9890b0 | [
"self.bc_file = bc_file\nself.beta = []\nself.code = []\nself.load_bc()",
"array = np.loadtxt(self.bc_file)\nself.beta = array[:, 0]\nself.code = array[:, 1].astype(int)"
] | <|body_start_0|>
self.bc_file = bc_file
self.beta = []
self.code = []
self.load_bc()
<|end_body_0|>
<|body_start_1|>
array = np.loadtxt(self.bc_file)
self.beta = array[:, 0]
self.code = array[:, 1].astype(int)
<|end_body_1|>
| Class for object that represents a beta code. beta, code (corresponding to OPER Case Matrix) | BETA_CODE | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BETA_CODE:
"""Class for object that represents a beta code. beta, code (corresponding to OPER Case Matrix)"""
def __init__(self, bc_file):
"""Method to initialize BETA_CODE class."""
<|body_0|>
def load_bc(self):
"""Method to load the beta code file."""
<... | stack_v2_sparse_classes_10k_train_002607 | 3,260 | no_license | [
{
"docstring": "Method to initialize BETA_CODE class.",
"name": "__init__",
"signature": "def __init__(self, bc_file)"
},
{
"docstring": "Method to load the beta code file.",
"name": "load_bc",
"signature": "def load_bc(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004957 | Implement the Python class `BETA_CODE` described below.
Class description:
Class for object that represents a beta code. beta, code (corresponding to OPER Case Matrix)
Method signatures and docstrings:
- def __init__(self, bc_file): Method to initialize BETA_CODE class.
- def load_bc(self): Method to load the beta co... | Implement the Python class `BETA_CODE` described below.
Class description:
Class for object that represents a beta code. beta, code (corresponding to OPER Case Matrix)
Method signatures and docstrings:
- def __init__(self, bc_file): Method to initialize BETA_CODE class.
- def load_bc(self): Method to load the beta co... | 6b37842203ff4318a48dbf0258cbe2b253436e7d | <|skeleton|>
class BETA_CODE:
"""Class for object that represents a beta code. beta, code (corresponding to OPER Case Matrix)"""
def __init__(self, bc_file):
"""Method to initialize BETA_CODE class."""
<|body_0|>
def load_bc(self):
"""Method to load the beta code file."""
<... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BETA_CODE:
"""Class for object that represents a beta code. beta, code (corresponding to OPER Case Matrix)"""
def __init__(self, bc_file):
"""Method to initialize BETA_CODE class."""
self.bc_file = bc_file
self.beta = []
self.code = []
self.load_bc()
def load_... | the_stack_v2_python_sparse | thermal/beta_code.py | tslowery78/PyLnD | train | 0 |
3077088e5e3a6ce5ab65a0e1aaa97dc97975f27a | [
"super(DynamicNet, self).__init__()\nself.input_linear = torch.nn.Linear(D_in, H)\nself.middle_linear = torch.nn.Linear(H, H)\nself.output_linear = torch.nn.Linear(H, D_out)",
"h_relu = self.input_linear(x).clamp(min=0)\nfor _ in range(random.randint(0, 3)):\n h_relu = self.middle_linear(h_relu).clamp(min=0)\n... | <|body_start_0|>
super(DynamicNet, self).__init__()
self.input_linear = torch.nn.Linear(D_in, H)
self.middle_linear = torch.nn.Linear(H, H)
self.output_linear = torch.nn.Linear(H, D_out)
<|end_body_0|>
<|body_start_1|>
h_relu = self.input_linear(x).clamp(min=0)
for _ in ... | DynamicNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DynamicNet:
def __init__(self, D_in, H, D_out):
"""在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。"""
<|body_0|>
def forward(self, x):
"""对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我们可以在定义模型的前向传播时使用常规Python控制流运算符,如循环或条件语句。 在这里,我们还看到,在定义计算图形时多次重用... | stack_v2_sparse_classes_10k_train_002608 | 16,194 | no_license | [
{
"docstring": "在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。",
"name": "__init__",
"signature": "def __init__(self, D_in, H, D_out)"
},
{
"docstring": "对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我们可以在定义模型的前向传播时使用常规Python控制流运算符,如循环或条件语句。 在这里,我们还看到,在定义计算图形时多次重用同一个模块是完全安全的。... | 2 | stack_v2_sparse_classes_30k_train_004149 | Implement the Python class `DynamicNet` described below.
Class description:
Implement the DynamicNet class.
Method signatures and docstrings:
- def __init__(self, D_in, H, D_out): 在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。
- def forward(self, x): 对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我... | Implement the Python class `DynamicNet` described below.
Class description:
Implement the DynamicNet class.
Method signatures and docstrings:
- def __init__(self, D_in, H, D_out): 在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。
- def forward(self, x): 对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我... | 272e0b674f2d8ebdca9eea0a35909d2c420212ae | <|skeleton|>
class DynamicNet:
def __init__(self, D_in, H, D_out):
"""在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。"""
<|body_0|>
def forward(self, x):
"""对于模型的前向传播,我们随机选择0、1、2、3, 并重用了多次计算隐藏层的middle_linear模块。 由于每个前向传播构建一个动态计算图, 我们可以在定义模型的前向传播时使用常规Python控制流运算符,如循环或条件语句。 在这里,我们还看到,在定义计算图形时多次重用... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DynamicNet:
def __init__(self, D_in, H, D_out):
"""在构造函数中,我们构造了三个nn.Linear实例,它们将在前向传播时被使用。"""
super(DynamicNet, self).__init__()
self.input_linear = torch.nn.Linear(D_in, H)
self.middle_linear = torch.nn.Linear(H, H)
self.output_linear = torch.nn.Linear(H, D_out)
d... | the_stack_v2_python_sparse | PyTorch/quick_start_2/function_try.py | StarkTan/Python | train | 0 | |
c408a9d4952e28cfb57a0a17bb0f3821c1729b79 | [
"result = []\n\ndef dfs(root):\n if root is None:\n return\n result.append(root.val)\n if root.children:\n for child in root.children:\n dfs(child)\ndfs(root)\nreturn result",
"result = []\nstack = []\nif root:\n stack.append(root)\n while stack:\n node = stack.pop()... | <|body_start_0|>
result = []
def dfs(root):
if root is None:
return
result.append(root.val)
if root.children:
for child in root.children:
dfs(child)
dfs(root)
return result
<|end_body_0|>
<|body_sta... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def preorder(self, root: 'Node') -> List[int]:
"""recursive"""
<|body_0|>
def preorder(self, root: 'Node') -> List[int]:
"""iterative"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = []
def dfs(root):
if root i... | stack_v2_sparse_classes_10k_train_002609 | 1,199 | no_license | [
{
"docstring": "recursive",
"name": "preorder",
"signature": "def preorder(self, root: 'Node') -> List[int]"
},
{
"docstring": "iterative",
"name": "preorder",
"signature": "def preorder(self, root: 'Node') -> List[int]"
}
] | 2 | stack_v2_sparse_classes_30k_train_004411 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def preorder(self, root: 'Node') -> List[int]: recursive
- def preorder(self, root: 'Node') -> List[int]: iterative | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def preorder(self, root: 'Node') -> List[int]: recursive
- def preorder(self, root: 'Node') -> List[int]: iterative
<|skeleton|>
class Solution:
def preorder(self, root: 'N... | fce451090ecaf5471aab5a9413ac0675639ace5d | <|skeleton|>
class Solution:
def preorder(self, root: 'Node') -> List[int]:
"""recursive"""
<|body_0|>
def preorder(self, root: 'Node') -> List[int]:
"""iterative"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def preorder(self, root: 'Node') -> List[int]:
"""recursive"""
result = []
def dfs(root):
if root is None:
return
result.append(root.val)
if root.children:
for child in root.children:
dfs... | the_stack_v2_python_sparse | tree/589N-aryTreePreorderTraversal.py | kidexp/91leetcode | train | 0 | |
c911ad9ad9d5d642c49a3911647dcf2839268888 | [
"self.id_ddi_interact_DB = id_ddi_interact_DB\nself.date_creation = date_creation\nself.FK_DDI_interaction = FK_DDI_interaction\nself.FK_DB_source = FK_DB_source\nself.database_name = database_name",
"listOfDDIIntDB = []\nsqlObj = _DDI_interaction_DB_SQL()\nresults = sqlObj.select_all_DDI_DB()\nfor element in res... | <|body_start_0|>
self.id_ddi_interact_DB = id_ddi_interact_DB
self.date_creation = date_creation
self.FK_DDI_interaction = FK_DDI_interaction
self.FK_DB_source = FK_DB_source
self.database_name = database_name
<|end_body_0|>
<|body_start_1|>
listOfDDIIntDB = []
s... | NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB table database It consistes on a conection class (N to N) to know for each DDI which s... | DDI_interaction_DB | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DDI_interaction_DB:
"""NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB table database It consistes on a conecti... | stack_v2_sparse_classes_10k_train_002610 | 4,149 | permissive | [
{
"docstring": "Constructor of the DDI_interactionDB object. All the parameters have a default value :param id_ddi_interact_DB: id of DDI interaction DB - -1 if unknown :param date_creation: Date of the creation - -1 if unknown :param FK_DDI_interaction: id of the DDI :param FK_DB_source: id of the Source :para... | 5 | null | Implement the Python class `DDI_interaction_DB` described below.
Class description:
NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB t... | Implement the Python class `DDI_interaction_DB` described below.
Class description:
NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB t... | 862eb85746e8a3a9bbc0d6aef9abbd5eebe9765f | <|skeleton|>
class DDI_interaction_DB:
"""NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB table database It consistes on a conecti... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DDI_interaction_DB:
"""NOTE: Here the date is only the date and it create automatically when an DDI_interaction_DB is inserted (only the day of the insertion is considered) This class treat the DDI interaction DB object has it exists in DDI_INTERACTIONS_DB table database It consistes on a conection class (N t... | the_stack_v2_python_sparse | objects_new/DDI_interactions_DB_new.py | diogo1790/inphinity | train | 1 |
d24410b51d52fc0801c4a5e82a343c499991e556 | [
"if not root:\n return ''\nret = []\n\ndef postSerialize(root):\n if not root:\n ret.append('# ')\n return\n ret.append(str(root.val) + ' ')\n postSerialize(root.left)\n postSerialize(root.right)\npostSerialize(root)\nreturn ''.join(ret)",
"if not data:\n return None\nsplitData = d... | <|body_start_0|>
if not root:
return ''
ret = []
def postSerialize(root):
if not root:
ret.append('# ')
return
ret.append(str(root.val) + ' ')
postSerialize(root.left)
postSerialize(root.right)
p... | 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_002611 | 2,764 | 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_001282 | 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:... | af5b37e45c89028aad119b1bc2c684e26dafd6e0 | <|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 ''
ret = []
def postSerialize(root):
if not root:
ret.append('# ')
return
ret.app... | the_stack_v2_python_sparse | BFS/449.py | LuluFighting/leetCodeEveryday | train | 2 | |
42914637a58c9b2509dc8d1e541b0a1aee3af026 | [
"self.devaddr = devaddr\nself.adr = adr\nself.adrackreq = adrackreq\nself.ack = ack\nself.fpending = fpending\nself.foptslen = foptslen\nself.fcnt = fcnt\nself.fopts = fopts\nself.fdir = fdir\nself.length = self.foptslen + 7",
"if len(data) < 7:\n raise DecodeError()\ndevaddr, fctrl, fcnt = struct.unpack('<LBH... | <|body_start_0|>
self.devaddr = devaddr
self.adr = adr
self.adrackreq = adrackreq
self.ack = ack
self.fpending = fpending
self.foptslen = foptslen
self.fcnt = fcnt
self.fopts = fopts
self.fdir = fdir
self.length = self.foptslen + 7
<|end_bo... | MAC Payload Frame Header. The frame header contains the short device address of the end device (devaddr), and frame control octet (fctrl), 2 octet frame counter (fcnt) and up to 15 octets used to transport MAC commands (fopts). Attributes: devaddr (str): Device address. adr (int): ADR bit adrackreq (int): ADR acknowled... | FrameHeader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrameHeader:
"""MAC Payload Frame Header. The frame header contains the short device address of the end device (devaddr), and frame control octet (fctrl), 2 octet frame counter (fcnt) and up to 15 octets used to transport MAC commands (fopts). Attributes: devaddr (str): Device address. adr (int):... | stack_v2_sparse_classes_10k_train_002612 | 26,915 | permissive | [
{
"docstring": "FrameHeader initialisation method.",
"name": "__init__",
"signature": "def __init__(self, devaddr, adr, adrackreq, ack, foptslen, fcnt, fopts, fpending=0, fdir='up')"
},
{
"docstring": "Create a FrameHeader object from binary representation. Args: data (str): MACPayload packet da... | 3 | stack_v2_sparse_classes_30k_train_002117 | Implement the Python class `FrameHeader` described below.
Class description:
MAC Payload Frame Header. The frame header contains the short device address of the end device (devaddr), and frame control octet (fctrl), 2 octet frame counter (fcnt) and up to 15 octets used to transport MAC commands (fopts). Attributes: de... | Implement the Python class `FrameHeader` described below.
Class description:
MAC Payload Frame Header. The frame header contains the short device address of the end device (devaddr), and frame control octet (fctrl), 2 octet frame counter (fcnt) and up to 15 octets used to transport MAC commands (fopts). Attributes: de... | add5a1129296dca6db55b7980c0c1091f1ca80aa | <|skeleton|>
class FrameHeader:
"""MAC Payload Frame Header. The frame header contains the short device address of the end device (devaddr), and frame control octet (fctrl), 2 octet frame counter (fcnt) and up to 15 octets used to transport MAC commands (fopts). Attributes: devaddr (str): Device address. adr (int):... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FrameHeader:
"""MAC Payload Frame Header. The frame header contains the short device address of the end device (devaddr), and frame control octet (fctrl), 2 octet frame counter (fcnt) and up to 15 octets used to transport MAC commands (fopts). Attributes: devaddr (str): Device address. adr (int): ADR bit adra... | the_stack_v2_python_sparse | floranet/lora/mac.py | chengzhongkai/floranet | train | 0 |
056225fae8253466fcbe8820d96d20941a6e3aa0 | [
"super().__init__(hass=hass, logger=_LOGGER, name=NAME, update_interval=INTERVAL_SLOW)\nself.device = device\nself.unique_id = format_mac(device.mac)",
"try:\n state = await self.device.get_state()\nexcept JvcProjectorConnectError as err:\n raise UpdateFailed(f'Unable to connect to {self.device.host}') from... | <|body_start_0|>
super().__init__(hass=hass, logger=_LOGGER, name=NAME, update_interval=INTERVAL_SLOW)
self.device = device
self.unique_id = format_mac(device.mac)
<|end_body_0|>
<|body_start_1|>
try:
state = await self.device.get_state()
except JvcProjectorConnectEr... | Data update coordinator for the JVC Projector integration. | JvcProjectorDataUpdateCoordinator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JvcProjectorDataUpdateCoordinator:
"""Data update coordinator for the JVC Projector integration."""
def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None:
"""Initialize the coordinator."""
<|body_0|>
async def _async_update_data(self) -> dict[str, str]:
... | stack_v2_sparse_classes_10k_train_002613 | 1,941 | permissive | [
{
"docstring": "Initialize the coordinator.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None"
},
{
"docstring": "Get the latest state data.",
"name": "_async_update_data",
"signature": "async def _async_update_data(self) -> dict[st... | 2 | stack_v2_sparse_classes_30k_train_001080 | Implement the Python class `JvcProjectorDataUpdateCoordinator` described below.
Class description:
Data update coordinator for the JVC Projector integration.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None: Initialize the coordinator.
- async def _async_update... | Implement the Python class `JvcProjectorDataUpdateCoordinator` described below.
Class description:
Data update coordinator for the JVC Projector integration.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None: Initialize the coordinator.
- async def _async_update... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class JvcProjectorDataUpdateCoordinator:
"""Data update coordinator for the JVC Projector integration."""
def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None:
"""Initialize the coordinator."""
<|body_0|>
async def _async_update_data(self) -> dict[str, str]:
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class JvcProjectorDataUpdateCoordinator:
"""Data update coordinator for the JVC Projector integration."""
def __init__(self, hass: HomeAssistant, device: JvcProjector) -> None:
"""Initialize the coordinator."""
super().__init__(hass=hass, logger=_LOGGER, name=NAME, update_interval=INTERVAL_SLOW... | the_stack_v2_python_sparse | homeassistant/components/jvc_projector/coordinator.py | home-assistant/core | train | 35,501 |
a9ceafab490122dac75b3d293f5f2c34a175258a | [
"super().__init__()\nself.set_config({'integrator_dict': integrator_dict, 'B_dict': B_dict, 't0': t0, 't_end': t_end, 'q0_dict': q0_dict, 'dq0_dict': dq0_dict, 'ddq0_dict': ddq0_dict, 'use_parallel': False, 'global_solver': PCPGsolver(), 'preconditioner': DirichletPreconditioner(), 'scaling': MultiplicityScaling()}... | <|body_start_0|>
super().__init__()
self.set_config({'integrator_dict': integrator_dict, 'B_dict': B_dict, 't0': t0, 't_end': t_end, 'q0_dict': q0_dict, 'dq0_dict': dq0_dict, 'ddq0_dict': ddq0_dict, 'use_parallel': False, 'global_solver': PCPGsolver(), 'preconditioner': DirichletPreconditioner(), 'scali... | FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration | LinearDynamicFetiSolver | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearDynamicFetiSolver:
"""FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration"""
def __init__(self, integrator_dict, ... | stack_v2_sparse_classes_10k_train_002614 | 13,384 | permissive | [
{
"docstring": "Parameters ---------- integrator_dict : dict integrator-objects describing the dynamic behavior of the local problems. For detailed specifications on the Integrator-class see `Basics of time-integration` or `Requirements to an Integrator-Class` and for the required API the :class:`~amfeti.local_... | 3 | stack_v2_sparse_classes_30k_train_003306 | Implement the Python class `LinearDynamicFetiSolver` described below.
Class description:
FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration
Meth... | Implement the Python class `LinearDynamicFetiSolver` described below.
Class description:
FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration
Meth... | be209dffe4d170aca735f1e912fd5cb448502119 | <|skeleton|>
class LinearDynamicFetiSolver:
"""FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration"""
def __init__(self, integrator_dict, ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LinearDynamicFetiSolver:
"""FETI-solver for linear dynamic problems Attributes ---------- _solver_manager : SolverManagerBase solver manager for the global problem _local_problem : LocalProblemBase local problem _config_dict : dict solver-configuration"""
def __init__(self, integrator_dict, B_dict, t0, t... | the_stack_v2_python_sparse | amfeti/feti_solvers/dynamic_feti_solver.py | AppliedMechanics/AMfeti | train | 3 |
441ea3621c9c35d3b7a435213c3460c9cdfe0c64 | [
"mapper = {}\naverages = []\nitems.sort()\nfor item in items:\n if item[0] in mapper:\n mapper[item[0]].append(item[1])\n else:\n mapper[item[0]] = [item[1]]\nfor id, scores in mapper.items():\n scores.sort(reverse=True)\n total, i = (0, 0)\n while i < 5 and i < len(scores):\n to... | <|body_start_0|>
mapper = {}
averages = []
items.sort()
for item in items:
if item[0] in mapper:
mapper[item[0]].append(item[1])
else:
mapper[item[0]] = [item[1]]
for id, scores in mapper.items():
scores.sort(rev... | HighFive | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HighFive:
def average_(self, items: List[List[int]]) -> List[int]:
"""Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:"""
<|body_0|>
def average(self, items: List[List[int]]) -> List[int]:
"""Approach: Pytho... | stack_v2_sparse_classes_10k_train_002615 | 1,699 | no_license | [
{
"docstring": "Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:",
"name": "average_",
"signature": "def average_(self, items: List[List[int]]) -> List[int]"
},
{
"docstring": "Approach: Python built-in Time Complexity: O(N log N) Space... | 2 | null | Implement the Python class `HighFive` described below.
Class description:
Implement the HighFive class.
Method signatures and docstrings:
- def average_(self, items: List[List[int]]) -> List[int]: Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:
- def averag... | Implement the Python class `HighFive` described below.
Class description:
Implement the HighFive class.
Method signatures and docstrings:
- def average_(self, items: List[List[int]]) -> List[int]: Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:
- def averag... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class HighFive:
def average_(self, items: List[List[int]]) -> List[int]:
"""Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:"""
<|body_0|>
def average(self, items: List[List[int]]) -> List[int]:
"""Approach: Pytho... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class HighFive:
def average_(self, items: List[List[int]]) -> List[int]:
"""Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:"""
mapper = {}
averages = []
items.sort()
for item in items:
if item[0] in mapp... | the_stack_v2_python_sparse | revisited_2021/arrays/high_five.py | Shiv2157k/leet_code | train | 1 | |
41e78d8664d25be15ae740d93651cd7da5b6a0b7 | [
"self.default = default\nself.defaultvalue = 'default value'\nsuper().__init__()\nsuper().__setitem__(self.default, self.defaultvalue)",
"try:\n return super().__getitem__(key)\nexcept KeyError:\n try:\n return super().__getitem__(self.default)\n except KeyError:\n print('Dammit! We came, ... | <|body_start_0|>
self.default = default
self.defaultvalue = 'default value'
super().__init__()
super().__setitem__(self.default, self.defaultvalue)
<|end_body_0|>
<|body_start_1|>
try:
return super().__getitem__(key)
except KeyError:
try:
... | This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its __getitem__() method should attempt to use the standard dict.__getitem__(),... | SubDict | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubDict:
"""This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its __getitem__() method should attempt to u... | stack_v2_sparse_classes_10k_train_002616 | 1,673 | no_license | [
{
"docstring": "'default' will be the default value for missing keys...",
"name": "__init__",
"signature": "def __init__(self, default)"
},
{
"docstring": "Use some exception handling if no 'key' exists",
"name": "__getitem__",
"signature": "def __getitem__(self, key)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006467 | Implement the Python class `SubDict` described below.
Class description:
This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its _... | Implement the Python class `SubDict` described below.
Class description:
This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its _... | b32f83aa1b705a5ad384b73c618f04f7d2622753 | <|skeleton|>
class SubDict:
"""This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its __getitem__() method should attempt to u... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SubDict:
"""This class subclasses the standard dict class. Its __init__() method should take one argument, which will be used as a default value when a non-existent key is accessed (it should also call the standard dict's __init__() with no arguments). Its __getitem__() method should attempt to use the standa... | the_stack_v2_python_sparse | ostPython4/subdictclass.py | deepbsd/OST_Python | train | 1 |
a8ff7ac422d604742a518efaed78426eef5312c6 | [
"stu_1 = Student('Robin', 'Wills', 25000)\nstu_2 = Student('Mark', 'Smith', 28000)\nself.assertEqual(stu_1.mail, 'Robin.Wills@xyz.com')\nself.assertEqual(stu_2.mail, 'Mark.Smith@xyz.com')\nstu_1.first = 'Jennifer'\nstu_2.first = 'Graham'\nself.assertEqual(stu_1.mail, 'Jennifer.Wills@xyz.com')\nself.assertEqual(stu_... | <|body_start_0|>
stu_1 = Student('Robin', 'Wills', 25000)
stu_2 = Student('Mark', 'Smith', 28000)
self.assertEqual(stu_1.mail, 'Robin.Wills@xyz.com')
self.assertEqual(stu_2.mail, 'Mark.Smith@xyz.com')
stu_1.first = 'Jennifer'
stu_2.first = 'Graham'
self.assertEqua... | This class is used to test all the features of the student class | Testing | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Testing:
"""This class is used to test all the features of the student class"""
def test_mail(self):
"""This is used to test the mail property of the Student class :return: Nothing"""
<|body_0|>
def test_fullname(self):
"""This function tests the fullname propert... | stack_v2_sparse_classes_10k_train_002617 | 1,731 | no_license | [
{
"docstring": "This is used to test the mail property of the Student class :return: Nothing",
"name": "test_mail",
"signature": "def test_mail(self)"
},
{
"docstring": "This function tests the fullname property of the student :return: Nothing",
"name": "test_fullname",
"signature": "def... | 3 | null | Implement the Python class `Testing` described below.
Class description:
This class is used to test all the features of the student class
Method signatures and docstrings:
- def test_mail(self): This is used to test the mail property of the Student class :return: Nothing
- def test_fullname(self): This function tests... | Implement the Python class `Testing` described below.
Class description:
This class is used to test all the features of the student class
Method signatures and docstrings:
- def test_mail(self): This is used to test the mail property of the Student class :return: Nothing
- def test_fullname(self): This function tests... | 2b7edfafc4e448bd558c034044570496ca68bf2d | <|skeleton|>
class Testing:
"""This class is used to test all the features of the student class"""
def test_mail(self):
"""This is used to test the mail property of the Student class :return: Nothing"""
<|body_0|>
def test_fullname(self):
"""This function tests the fullname propert... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Testing:
"""This class is used to test all the features of the student class"""
def test_mail(self):
"""This is used to test the mail property of the Student class :return: Nothing"""
stu_1 = Student('Robin', 'Wills', 25000)
stu_2 = Student('Mark', 'Smith', 28000)
self.ass... | the_stack_v2_python_sparse | AdvancedUnittest/test_student.py | gsudarshan1990/Training_Projects | train | 0 |
355193ea49364cb2f24d7d7a5c9175078dc6dea6 | [
"current_app.logger.info('<AccountStatementsSettings.get')\ncheck_auth(business_identifier=None, account_id=account_id, contains_role=EDIT_ROLE, is_premium=True)\nresponse, status = (StatementSettingsService.find_by_account_id(account_id), HTTPStatus.OK)\ncurrent_app.logger.debug('>AccountStatementsSettings.get')\n... | <|body_start_0|>
current_app.logger.info('<AccountStatementsSettings.get')
check_auth(business_identifier=None, account_id=account_id, contains_role=EDIT_ROLE, is_premium=True)
response, status = (StatementSettingsService.find_by_account_id(account_id), HTTPStatus.OK)
current_app.logger.... | Endpoint resource for statements. | AccountStatementsSettings | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountStatementsSettings:
"""Endpoint resource for statements."""
def get(account_id):
"""Get all statements records for an account."""
<|body_0|>
def post(account_id):
"""Update the statement settings ."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_002618 | 3,037 | permissive | [
{
"docstring": "Get all statements records for an account.",
"name": "get",
"signature": "def get(account_id)"
},
{
"docstring": "Update the statement settings .",
"name": "post",
"signature": "def post(account_id)"
}
] | 2 | null | Implement the Python class `AccountStatementsSettings` described below.
Class description:
Endpoint resource for statements.
Method signatures and docstrings:
- def get(account_id): Get all statements records for an account.
- def post(account_id): Update the statement settings . | Implement the Python class `AccountStatementsSettings` described below.
Class description:
Endpoint resource for statements.
Method signatures and docstrings:
- def get(account_id): Get all statements records for an account.
- def post(account_id): Update the statement settings .
<|skeleton|>
class AccountStatements... | 0d71d37b0e08d11f6b6d9f59a4b202dfabc98fc1 | <|skeleton|>
class AccountStatementsSettings:
"""Endpoint resource for statements."""
def get(account_id):
"""Get all statements records for an account."""
<|body_0|>
def post(account_id):
"""Update the statement settings ."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AccountStatementsSettings:
"""Endpoint resource for statements."""
def get(account_id):
"""Get all statements records for an account."""
current_app.logger.info('<AccountStatementsSettings.get')
check_auth(business_identifier=None, account_id=account_id, contains_role=EDIT_ROLE, i... | the_stack_v2_python_sparse | pay-api/src/pay_api/resources/account_statements_settings.py | bcgov/sbc-pay | train | 6 |
c7832914b90dc8456aa4978a9b2241af7038cd2d | [
"self.webservername = webservername\nself.processToFileMap = {}\nself._backend = backend\nself.registerdProcesses = []\nself.cacheCapacity = 5\nself.cache = defaultdict(list)",
"self.cacheCapacity = cacheCapacity\nprint('Initializing the cache and processNames are : {}'.format(processList))\nfor key in processLis... | <|body_start_0|>
self.webservername = webservername
self.processToFileMap = {}
self._backend = backend
self.registerdProcesses = []
self.cacheCapacity = 5
self.cache = defaultdict(list)
<|end_body_0|>
<|body_start_1|>
self.cacheCapacity = cacheCapacity
pr... | FrontEnd | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FrontEnd:
def __init__(self, backend, webservername):
"""Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername:"""
<|body_0|>
def initializeCache(self, cacheCapacity, processList):
"""Initiali... | stack_v2_sparse_classes_10k_train_002619 | 4,922 | no_license | [
{
"docstring": "Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername:",
"name": "__init__",
"signature": "def __init__(self, backend, webservername)"
},
{
"docstring": "Initialize the cache. Cache is write-through. :para... | 6 | stack_v2_sparse_classes_30k_train_006879 | Implement the Python class `FrontEnd` described below.
Class description:
Implement the FrontEnd class.
Method signatures and docstrings:
- def __init__(self, backend, webservername): Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername:
- de... | Implement the Python class `FrontEnd` described below.
Class description:
Implement the FrontEnd class.
Method signatures and docstrings:
- def __init__(self, backend, webservername): Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername:
- de... | f36779ce2f1a1071391ffcd32f695d6d8cd7ff92 | <|skeleton|>
class FrontEnd:
def __init__(self, backend, webservername):
"""Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername:"""
<|body_0|>
def initializeCache(self, cacheCapacity, processList):
"""Initiali... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class FrontEnd:
def __init__(self, backend, webservername):
"""Front End class which manages cache operations and accesses backend to write into database. :param backend: :param webservername:"""
self.webservername = webservername
self.processToFileMap = {}
self._backend = backend
... | the_stack_v2_python_sparse | src/webServer/FrontEnd.py | nehay06/Internet-of-Things-Part-2 | train | 0 | |
fa799cea89bfb17f5a23c9035105bbc576b79085 | [
"def dfs(node):\n if node is None:\n return 0\n l = dfs(node.left)\n r = dfs(node.right)\n if node.left and node.right:\n return min(l, r) + 1\n if node.left is None and node.right is None:\n return 1\n return max(l, r) + 1\nreturn dfs(root)",
"from collections import deque\... | <|body_start_0|>
def dfs(node):
if node is None:
return 0
l = dfs(node.left)
r = dfs(node.right)
if node.left and node.right:
return min(l, r) + 1
if node.left is None and node.right is None:
return 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minDepth(self, root) -> int:
"""DFS, Time: O(n), Space: O(n)"""
<|body_0|>
def minDepth(self, root) -> int:
"""BFS, Time: O(n), Space: O(n)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def dfs(node):
if node is None:
... | stack_v2_sparse_classes_10k_train_002620 | 1,176 | no_license | [
{
"docstring": "DFS, Time: O(n), Space: O(n)",
"name": "minDepth",
"signature": "def minDepth(self, root) -> int"
},
{
"docstring": "BFS, Time: O(n), Space: O(n)",
"name": "minDepth",
"signature": "def minDepth(self, root) -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth(self, root) -> int: DFS, Time: O(n), Space: O(n)
- def minDepth(self, root) -> int: BFS, Time: O(n), Space: O(n) | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth(self, root) -> int: DFS, Time: O(n), Space: O(n)
- def minDepth(self, root) -> int: BFS, Time: O(n), Space: O(n)
<|skeleton|>
class Solution:
def minDepth(self... | 72136e3487d239f5b37e2d6393e034262a6bf599 | <|skeleton|>
class Solution:
def minDepth(self, root) -> int:
"""DFS, Time: O(n), Space: O(n)"""
<|body_0|>
def minDepth(self, root) -> int:
"""BFS, Time: O(n), Space: O(n)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def minDepth(self, root) -> int:
"""DFS, Time: O(n), Space: O(n)"""
def dfs(node):
if node is None:
return 0
l = dfs(node.left)
r = dfs(node.right)
if node.left and node.right:
return min(l, r) + 1
... | the_stack_v2_python_sparse | python/111-Minimum Depth of Binary Tree.py | cwza/leetcode | train | 0 | |
6df6ae704ecc89105b950956ffc6364afbc8bb30 | [
"num_of_lists = len(lists)\nif num_of_lists == 0:\n return None\nelif num_of_lists == 1:\n return lists[0]\nelif num_of_lists == 2:\n return self.mergeTwoLists(lists[0], lists[1])\nelse:\n return self.mergeTwoLists(self.mergeKLists(lists[:num_of_lists / 2]), self.mergeKLists(lists[num_of_lists / 2:]))",... | <|body_start_0|>
num_of_lists = len(lists)
if num_of_lists == 0:
return None
elif num_of_lists == 1:
return lists[0]
elif num_of_lists == 2:
return self.mergeTwoLists(lists[0], lists[1])
else:
return self.mergeTwoLists(self.mergeKLi... | Solution_recursive | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution_recursive:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_002621 | 3,012 | no_license | [
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
},
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1, l2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006372 | Implement the Python class `Solution_recursive` described below.
Class description:
Implement the Solution_recursive class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: Li... | Implement the Python class `Solution_recursive` described below.
Class description:
Implement the Solution_recursive class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: Li... | ea492ec864b50547214ecbbb2cdeeac21e70229b | <|skeleton|>
class Solution_recursive:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeTwoLists(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution_recursive:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
num_of_lists = len(lists)
if num_of_lists == 0:
return None
elif num_of_lists == 1:
return lists[0]
elif num_of_lists == 2:
return se... | the_stack_v2_python_sparse | 23_merge_k_sorted_lists/sol.py | lianke123321/leetcode_sol | train | 0 | |
f9c5d5379db4ae514ea1f2ae3e60001c51a6d01b | [
"self.kubeconfig = kubeconfig\nself.name = sname\nself.namespace = namespace\nself.secrets = secrets\nself.data = {}\nself.create_dict()",
"self.data['apiVersion'] = 'v1'\nself.data['kind'] = 'Secret'\nself.data['metadata'] = {}\nself.data['metadata']['name'] = self.name\nself.data['metadata']['namespace'] = self... | <|body_start_0|>
self.kubeconfig = kubeconfig
self.name = sname
self.namespace = namespace
self.secrets = secrets
self.data = {}
self.create_dict()
<|end_body_0|>
<|body_start_1|>
self.data['apiVersion'] = 'v1'
self.data['kind'] = 'Secret'
self.da... | Handle secret options | SecretConfig | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SecretConfig:
"""Handle secret options"""
def __init__(self, sname, namespace, kubeconfig, secrets=None):
"""constructor for handling secret options"""
<|body_0|>
def create_dict(self):
"""return a secret as a dict"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_10k_train_002622 | 2,639 | permissive | [
{
"docstring": "constructor for handling secret options",
"name": "__init__",
"signature": "def __init__(self, sname, namespace, kubeconfig, secrets=None)"
},
{
"docstring": "return a secret as a dict",
"name": "create_dict",
"signature": "def create_dict(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000180 | Implement the Python class `SecretConfig` described below.
Class description:
Handle secret options
Method signatures and docstrings:
- def __init__(self, sname, namespace, kubeconfig, secrets=None): constructor for handling secret options
- def create_dict(self): return a secret as a dict | Implement the Python class `SecretConfig` described below.
Class description:
Handle secret options
Method signatures and docstrings:
- def __init__(self, sname, namespace, kubeconfig, secrets=None): constructor for handling secret options
- def create_dict(self): return a secret as a dict
<|skeleton|>
class SecretC... | e342f6659a4ef1a188ff403e2fc6b06ac6d119c7 | <|skeleton|>
class SecretConfig:
"""Handle secret options"""
def __init__(self, sname, namespace, kubeconfig, secrets=None):
"""constructor for handling secret options"""
<|body_0|>
def create_dict(self):
"""return a secret as a dict"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class SecretConfig:
"""Handle secret options"""
def __init__(self, sname, namespace, kubeconfig, secrets=None):
"""constructor for handling secret options"""
self.kubeconfig = kubeconfig
self.name = sname
self.namespace = namespace
self.secrets = secrets
self.dat... | the_stack_v2_python_sparse | ansible/roles/lib_openshift_3.2/build/lib/secret.py | openshift/openshift-tools | train | 170 |
e1ab14849e59d793c1ac52f26ef58f851bd4089a | [
"super().__init__()\nif isinstance(hidden_units, int):\n hidden_units = [hidden_units]\nself.fc_x = nn.Linear(x_size, hidden_units[0], bias=False)\nself.fc_y = nn.Linear(y_size, hidden_units[0], bias=False)\nself.xy_bias = nn.Parameter(torch.zeros(hidden_units[0]))\nself.fc_output = MLP(*hidden_units, 1)",
"hi... | <|body_start_0|>
super().__init__()
if isinstance(hidden_units, int):
hidden_units = [hidden_units]
self.fc_x = nn.Linear(x_size, hidden_units[0], bias=False)
self.fc_y = nn.Linear(y_size, hidden_units[0], bias=False)
self.xy_bias = nn.Parameter(torch.zeros(hidden_uni... | MINE_Net | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MINE_Net:
def __init__(self, x_size: int, y_size: int, hidden_units=(100, 50)):
"""A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size : int Number of neurons in X and Y. hidden_units : int or tuple of int Hidden layer size(s)."""
... | stack_v2_sparse_classes_10k_train_002623 | 9,660 | permissive | [
{
"docstring": "A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size : int Number of neurons in X and Y. hidden_units : int or tuple of int Hidden layer size(s).",
"name": "__init__",
"signature": "def __init__(self, x_size: int, y_size: int, hidden... | 2 | stack_v2_sparse_classes_30k_train_002861 | Implement the Python class `MINE_Net` described below.
Class description:
Implement the MINE_Net class.
Method signatures and docstrings:
- def __init__(self, x_size: int, y_size: int, hidden_units=(100, 50)): A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size ... | Implement the Python class `MINE_Net` described below.
Class description:
Implement the MINE_Net class.
Method signatures and docstrings:
- def __init__(self, x_size: int, y_size: int, hidden_units=(100, 50)): A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size ... | e5d7f7337328a2c5b82545de6d0bd27c88e52123 | <|skeleton|>
class MINE_Net:
def __init__(self, x_size: int, y_size: int, hidden_units=(100, 50)):
"""A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size : int Number of neurons in X and Y. hidden_units : int or tuple of int Hidden layer size(s)."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MINE_Net:
def __init__(self, x_size: int, y_size: int, hidden_units=(100, 50)):
"""A network to estimate the mutual information between X and Y, I(X; Y). Parameters ---------- x_size, y_size : int Number of neurons in X and Y. hidden_units : int or tuple of int Hidden layer size(s)."""
super()... | the_stack_v2_python_sparse | mighty/monitor/mutual_info/neural_estimation.py | dizcza/pytorch-mighty | train | 4 | |
ddd674a2949a18620c22f63ed1cf34bf921ef3e1 | [
"super(PaintingGenreBot, self).__init__()\nself.use_from_page = False\nself.genres = {'Q1400853': 'Q134307', 'Q2414609': 'Q2864737', 'Q214127': 'Q1047337', 'Q107425': 'Q191163', 'Q29969011': 'Q1935974', 'Q333357': 'Q128115', 'Q162150': 'Q128115', 'Q18535': 'Q2839016', 'Q11766730': 'Q2839016', 'Q11766734': 'Q158607'... | <|body_start_0|>
super(PaintingGenreBot, self).__init__()
self.use_from_page = False
self.genres = {'Q1400853': 'Q134307', 'Q2414609': 'Q2864737', 'Q214127': 'Q1047337', 'Q107425': 'Q191163', 'Q29969011': 'Q1935974', 'Q333357': 'Q128115', 'Q162150': 'Q128115', 'Q18535': 'Q2839016', 'Q11766730': ... | A bot to normalize painting genre. Uses the WikidataBot for the basics. | PaintingGenreBot | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PaintingGenreBot:
"""A bot to normalize painting genre. Uses the WikidataBot for the basics."""
def __init__(self):
"""No arguments, bot makes it's own generator based on the genres"""
<|body_0|>
def getGenerator(self):
"""Get a generator of paintings that have o... | stack_v2_sparse_classes_10k_train_002624 | 3,923 | no_license | [
{
"docstring": "No arguments, bot makes it's own generator based on the genres",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Get a generator of paintings that have one of the replacable genres :return: A generator that yields ItemPages",
"name": "getGenerator",
... | 3 | stack_v2_sparse_classes_30k_train_003640 | Implement the Python class `PaintingGenreBot` described below.
Class description:
A bot to normalize painting genre. Uses the WikidataBot for the basics.
Method signatures and docstrings:
- def __init__(self): No arguments, bot makes it's own generator based on the genres
- def getGenerator(self): Get a generator of ... | Implement the Python class `PaintingGenreBot` described below.
Class description:
A bot to normalize painting genre. Uses the WikidataBot for the basics.
Method signatures and docstrings:
- def __init__(self): No arguments, bot makes it's own generator based on the genres
- def getGenerator(self): Get a generator of ... | 99a96e49cfe6b2d3151da7ad5469792d80171be3 | <|skeleton|>
class PaintingGenreBot:
"""A bot to normalize painting genre. Uses the WikidataBot for the basics."""
def __init__(self):
"""No arguments, bot makes it's own generator based on the genres"""
<|body_0|>
def getGenerator(self):
"""Get a generator of paintings that have o... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PaintingGenreBot:
"""A bot to normalize painting genre. Uses the WikidataBot for the basics."""
def __init__(self):
"""No arguments, bot makes it's own generator based on the genres"""
super(PaintingGenreBot, self).__init__()
self.use_from_page = False
self.genres = {'Q140... | the_stack_v2_python_sparse | bot/wikidata/painting_genre_normalization.py | multichill/toollabs | train | 18 |
4d2cd9a3615bae19cb46a835b6601bfc607f525d | [
"self._query = '{!join}' + query\nself._from = from_field\nself._to = to_field",
"params = []\nparams.append(('from', self._from))\nparams.append(('to', self._to))\nreturn params"
] | <|body_start_0|>
self._query = '{!join}' + query
self._from = from_field
self._to = to_field
<|end_body_0|>
<|body_start_1|>
params = []
params.append(('from', self._from))
params.append(('to', self._to))
return params
<|end_body_1|>
| A base query for all join operations. | JoinBaseQuery | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JoinBaseQuery:
"""A base query for all join operations."""
def __init__(self, query, from_field, to_field):
"""Join base query takes care of joining syntax"""
<|body_0|>
def get_params(self):
"""Return the list of query params for the `JoinBaseQuery`."""
... | stack_v2_sparse_classes_10k_train_002625 | 2,190 | permissive | [
{
"docstring": "Join base query takes care of joining syntax",
"name": "__init__",
"signature": "def __init__(self, query, from_field, to_field)"
},
{
"docstring": "Return the list of query params for the `JoinBaseQuery`.",
"name": "get_params",
"signature": "def get_params(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003188 | Implement the Python class `JoinBaseQuery` described below.
Class description:
A base query for all join operations.
Method signatures and docstrings:
- def __init__(self, query, from_field, to_field): Join base query takes care of joining syntax
- def get_params(self): Return the list of query params for the `JoinBa... | Implement the Python class `JoinBaseQuery` described below.
Class description:
A base query for all join operations.
Method signatures and docstrings:
- def __init__(self, query, from_field, to_field): Join base query takes care of joining syntax
- def get_params(self): Return the list of query params for the `JoinBa... | 2810f3202166b045a7f5f9a21b964c681bfd8136 | <|skeleton|>
class JoinBaseQuery:
"""A base query for all join operations."""
def __init__(self, query, from_field, to_field):
"""Join base query takes care of joining syntax"""
<|body_0|>
def get_params(self):
"""Return the list of query params for the `JoinBaseQuery`."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class JoinBaseQuery:
"""A base query for all join operations."""
def __init__(self, query, from_field, to_field):
"""Join base query takes care of joining syntax"""
self._query = '{!join}' + query
self._from = from_field
self._to = to_field
def get_params(self):
"""... | the_stack_v2_python_sparse | dopplr/solr/query/join.py | renatoaquino/dopplr | train | 1 |
e297e65dd2a30a256885732ba0af914b89595189 | [
"n1 = self.list_to_number(l1)\nn2 = self.list_to_number(l2)\nn3 = n1 + n2\ntext = str(n3)\nhead = ListNode(int(text[0]))\nprev = head\nfor c in text[1:]:\n node = ListNode(int(c))\n prev.next = node\n prev = node\nreturn head",
"if l == None:\n return 0\ncurr = l\nnum = 0\nwhile curr != None:\n num... | <|body_start_0|>
n1 = self.list_to_number(l1)
n2 = self.list_to_number(l2)
n3 = n1 + n2
text = str(n3)
head = ListNode(int(text[0]))
prev = head
for c in text[1:]:
node = ListNode(int(c))
prev.next = node
prev = node
ret... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def list_to_number(self, l):
"""convert list to number"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n1 = self.list_to_number(l1)
... | stack_v2_sparse_classes_10k_train_002626 | 859 | no_license | [
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "addTwoNumbers",
"signature": "def addTwoNumbers(self, l1, l2)"
},
{
"docstring": "convert list to number",
"name": "list_to_number",
"signature": "def list_to_number(self, l)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def list_to_number(self, l): convert list to number | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def list_to_number(self, l): convert list to number
<|skeleton|>
class Solution:
d... | e00cf94c5b86c8cca27e3bee69ad21e727b7679b | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def list_to_number(self, l):
"""convert list to number"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
n1 = self.list_to_number(l1)
n2 = self.list_to_number(l2)
n3 = n1 + n2
text = str(n3)
head = ListNode(int(text[0]))
prev = head
for c in text[... | the_stack_v2_python_sparse | linkedlist/prob445.py | binchen15/leet-python | train | 1 | |
7961ed9fccc54d98ae719f2fa5695615c3c71a09 | [
"if not nums:\n return None\nelse:\n maxnum = nums[0]\n for i in range(len(nums)):\n num = nums[i]\n if num > maxnum:\n maxnum = num\n for j in range(i + 1, len(nums)):\n num += nums[j]\n if num > maxnum:\n maxnum = num\n return maxnum... | <|body_start_0|>
if not nums:
return None
else:
maxnum = nums[0]
for i in range(len(nums)):
num = nums[i]
if num > maxnum:
maxnum = num
for j in range(i + 1, len(nums)):
num += num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)"""
<|body_0|>
def maxSubArray1(self, nums):
""":type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],status[n] + nums[n+1]) 定义一个函数f(n),以第n个数为结束点的子数列的最大和,存在一个递推关系f(... | stack_v2_sparse_classes_10k_train_002627 | 1,970 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)",
"name": "maxSubArray",
"signature": "def maxSubArray(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],status[n] + nums[n+1]) 定义一个函数f(n),以第n个数为结束点的子数列的最大和,存在一个递推关系f(n) = max(f(n-1)... | 3 | stack_v2_sparse_classes_30k_train_002974 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray(self, nums): :type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)
- def maxSubArray1(self, nums): :type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],s... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray(self, nums): :type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)
- def maxSubArray1(self, nums): :type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],s... | 2dc982e690b153c33bc7e27a63604f754a0df90c | <|skeleton|>
class Solution:
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)"""
<|body_0|>
def maxSubArray1(self, nums):
""":type nums: List[int] :rtype: int 动态规划:status[n+1] = max(status[n],status[n] + nums[n+1]) 定义一个函数f(n),以第n个数为结束点的子数列的最大和,存在一个递推关系f(... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSubArray(self, nums):
""":type nums: List[int] :rtype: int 暴力划窗,复杂度O(n^2)"""
if not nums:
return None
else:
maxnum = nums[0]
for i in range(len(nums)):
num = nums[i]
if num > maxnum:
... | the_stack_v2_python_sparse | 53_maximum-subarray.py | 95275059/Algorithm | train | 0 | |
5f6ccbb3eade070963786b511a82294022aa7900 | [
"for name, extension in extensions.items():\n if name not in self.unchained.extensions:\n if isinstance(extension, (list, tuple)):\n extension, dependencies = extension\n self.unchained.extensions[name] = extension",
"extensions = {}\nfor b in bundle._iter_class_hierarchy():\n for m... | <|body_start_0|>
for name, extension in extensions.items():
if name not in self.unchained.extensions:
if isinstance(extension, (list, tuple)):
extension, dependencies = extension
self.unchained.extensions[name] = extension
<|end_body_0|>
<|body_st... | Registers extensions found in bundles with the ``unchained`` extension. | RegisterExtensionsHook | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegisterExtensionsHook:
"""Registers extensions found in bundles with the ``unchained`` extension."""
def process_objects(self, app: FlaskUnchained, extensions: Dict[str, object]) -> None:
"""Discover extensions in bundles and register them with the Unchained extension."""
<|... | stack_v2_sparse_classes_10k_train_002628 | 1,568 | permissive | [
{
"docstring": "Discover extensions in bundles and register them with the Unchained extension.",
"name": "process_objects",
"signature": "def process_objects(self, app: FlaskUnchained, extensions: Dict[str, object]) -> None"
},
{
"docstring": "Collect declared extensions from a bundle hierarchy.... | 2 | stack_v2_sparse_classes_30k_test_000118 | Implement the Python class `RegisterExtensionsHook` described below.
Class description:
Registers extensions found in bundles with the ``unchained`` extension.
Method signatures and docstrings:
- def process_objects(self, app: FlaskUnchained, extensions: Dict[str, object]) -> None: Discover extensions in bundles and ... | Implement the Python class `RegisterExtensionsHook` described below.
Class description:
Registers extensions found in bundles with the ``unchained`` extension.
Method signatures and docstrings:
- def process_objects(self, app: FlaskUnchained, extensions: Dict[str, object]) -> None: Discover extensions in bundles and ... | a1f1323f63f59760e430001efef43af9b829ebed | <|skeleton|>
class RegisterExtensionsHook:
"""Registers extensions found in bundles with the ``unchained`` extension."""
def process_objects(self, app: FlaskUnchained, extensions: Dict[str, object]) -> None:
"""Discover extensions in bundles and register them with the Unchained extension."""
<|... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RegisterExtensionsHook:
"""Registers extensions found in bundles with the ``unchained`` extension."""
def process_objects(self, app: FlaskUnchained, extensions: Dict[str, object]) -> None:
"""Discover extensions in bundles and register them with the Unchained extension."""
for name, exten... | the_stack_v2_python_sparse | flask_unchained/hooks/register_extensions_hook.py | briancappello/flask-unchained | train | 77 |
e98c17b010c1258e3c9b144718ae074979299732 | [
"self.needed_locks = {}\nif self.op.duration <= 0:\n raise errors.OpPrereqError('Duration must be greater than zero')\nif not self.op.no_locks and (self.op.on_nodes or self.op.on_master):\n self.needed_locks[locking.LEVEL_NODE] = []\nself.op.on_node_uuids = []\nif self.op.on_nodes:\n self.op.on_node_uuids,... | <|body_start_0|>
self.needed_locks = {}
if self.op.duration <= 0:
raise errors.OpPrereqError('Duration must be greater than zero')
if not self.op.no_locks and (self.op.on_nodes or self.op.on_master):
self.needed_locks[locking.LEVEL_NODE] = []
self.op.on_node_uuids... | Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time. | LUTestDelay | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LUTestDelay:
"""Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time."""
def ExpandNames(self):
"""Expand names and set required locks. This expands the node list, if any."""
<|body_0|>
def _InterruptibleDelay(sel... | stack_v2_sparse_classes_10k_train_002629 | 16,228 | permissive | [
{
"docstring": "Expand names and set required locks. This expands the node list, if any.",
"name": "ExpandNames",
"signature": "def ExpandNames(self)"
},
{
"docstring": "Delays but provides the mechanisms necessary to interrupt the delay as needed.",
"name": "_InterruptibleDelay",
"signa... | 5 | stack_v2_sparse_classes_30k_train_002797 | Implement the Python class `LUTestDelay` described below.
Class description:
Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time.
Method signatures and docstrings:
- def ExpandNames(self): Expand names and set required locks. This expands the node list, if an... | Implement the Python class `LUTestDelay` described below.
Class description:
Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time.
Method signatures and docstrings:
- def ExpandNames(self): Expand names and set required locks. This expands the node list, if an... | 456ea285a7583183c2c8e5bcffe9006ec8a9d658 | <|skeleton|>
class LUTestDelay:
"""Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time."""
def ExpandNames(self):
"""Expand names and set required locks. This expands the node list, if any."""
<|body_0|>
def _InterruptibleDelay(sel... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class LUTestDelay:
"""Sleep for a specified amount of time. This LU sleeps on the master and/or nodes for a specified amount of time."""
def ExpandNames(self):
"""Expand names and set required locks. This expands the node list, if any."""
self.needed_locks = {}
if self.op.duration <= 0:... | the_stack_v2_python_sparse | lib/cmdlib/test.py | ganeti/ganeti | train | 465 |
36d3447e383906243ed73eb832b293d660c64551 | [
"self.x = x\nself.y = y\nself.speed = speed\nself.image = pygame.image.load('data/bullet.png').convert_alpha()",
"self.y -= self.speed\nif self.y < 0:\n return -1\nelse:\n return 1",
"x = self.x - self.image.get_width() / 2\ny = self.y - self.image.get_height() / 2\nscreen.blit(self.image, (x, y))"
] | <|body_start_0|>
self.x = x
self.y = y
self.speed = speed
self.image = pygame.image.load('data/bullet.png').convert_alpha()
<|end_body_0|>
<|body_start_1|>
self.y -= self.speed
if self.y < 0:
return -1
else:
return 1
<|end_body_1|>
<|body... | 子弹类 | Bullet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Bullet:
"""子弹类"""
def __init__(self, x=0, y=-1, speed=1):
"""初始化成员变量"""
<|body_0|>
def move(self):
"""子弹运动 return -1:子弹摧毁,否则子弹存在"""
<|body_1|>
def show(self, screen):
"""子弹显示在屏幕上"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_002630 | 840 | no_license | [
{
"docstring": "初始化成员变量",
"name": "__init__",
"signature": "def __init__(self, x=0, y=-1, speed=1)"
},
{
"docstring": "子弹运动 return -1:子弹摧毁,否则子弹存在",
"name": "move",
"signature": "def move(self)"
},
{
"docstring": "子弹显示在屏幕上",
"name": "show",
"signature": "def show(self, scr... | 3 | null | Implement the Python class `Bullet` described below.
Class description:
子弹类
Method signatures and docstrings:
- def __init__(self, x=0, y=-1, speed=1): 初始化成员变量
- def move(self): 子弹运动 return -1:子弹摧毁,否则子弹存在
- def show(self, screen): 子弹显示在屏幕上 | Implement the Python class `Bullet` described below.
Class description:
子弹类
Method signatures and docstrings:
- def __init__(self, x=0, y=-1, speed=1): 初始化成员变量
- def move(self): 子弹运动 return -1:子弹摧毁,否则子弹存在
- def show(self, screen): 子弹显示在屏幕上
<|skeleton|>
class Bullet:
"""子弹类"""
def __init__(self, x=0, y=-1, s... | a1e624f0afc24ea5f159fa66fed178aa61bb0179 | <|skeleton|>
class Bullet:
"""子弹类"""
def __init__(self, x=0, y=-1, speed=1):
"""初始化成员变量"""
<|body_0|>
def move(self):
"""子弹运动 return -1:子弹摧毁,否则子弹存在"""
<|body_1|>
def show(self, screen):
"""子弹显示在屏幕上"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Bullet:
"""子弹类"""
def __init__(self, x=0, y=-1, speed=1):
"""初始化成员变量"""
self.x = x
self.y = y
self.speed = speed
self.image = pygame.image.load('data/bullet.png').convert_alpha()
def move(self):
"""子弹运动 return -1:子弹摧毁,否则子弹存在"""
self.y -= self.s... | the_stack_v2_python_sparse | pygame/aircraft/bullet.py | HappyRocky/pythonAI | train | 2 |
750d68a880d4ef486ff4ce430cb6dce1a705bbfd | [
"allure.dynamic.title('Testing toJadenCase function (positive)')\nallure.dynamic.severity(allure.severity_level.NORMAL)\nallure.dynamic.description_html('<h3>Codewars badge:</h3><img src=\"https://www.codewars.com/users/myFirstCode/badges/large\"><h3>Test Description:</h3><p></p>')\nwith allure.step('Pass string an... | <|body_start_0|>
allure.dynamic.title('Testing toJadenCase function (positive)')
allure.dynamic.severity(allure.severity_level.NORMAL)
allure.dynamic.description_html('<h3>Codewars badge:</h3><img src="https://www.codewars.com/users/myFirstCode/badges/large"><h3>Test Description:</h3><p></p>')
... | Testing toJadenCase function | JadenCasingStringsTestCase | [
"Unlicense",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JadenCasingStringsTestCase:
"""Testing toJadenCase function"""
def test_to_jaden_case_positive(self):
"""Simple positive test :return:"""
<|body_0|>
def test_to_jaden_case_negative(self):
"""Simple negative test :return:"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_10k_train_002631 | 2,430 | permissive | [
{
"docstring": "Simple positive test :return:",
"name": "test_to_jaden_case_positive",
"signature": "def test_to_jaden_case_positive(self)"
},
{
"docstring": "Simple negative test :return:",
"name": "test_to_jaden_case_negative",
"signature": "def test_to_jaden_case_negative(self)"
}
] | 2 | null | Implement the Python class `JadenCasingStringsTestCase` described below.
Class description:
Testing toJadenCase function
Method signatures and docstrings:
- def test_to_jaden_case_positive(self): Simple positive test :return:
- def test_to_jaden_case_negative(self): Simple negative test :return: | Implement the Python class `JadenCasingStringsTestCase` described below.
Class description:
Testing toJadenCase function
Method signatures and docstrings:
- def test_to_jaden_case_positive(self): Simple positive test :return:
- def test_to_jaden_case_negative(self): Simple negative test :return:
<|skeleton|>
class J... | ba3ea81125b6082d867f0ae34c6c9be15e153966 | <|skeleton|>
class JadenCasingStringsTestCase:
"""Testing toJadenCase function"""
def test_to_jaden_case_positive(self):
"""Simple positive test :return:"""
<|body_0|>
def test_to_jaden_case_negative(self):
"""Simple negative test :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class JadenCasingStringsTestCase:
"""Testing toJadenCase function"""
def test_to_jaden_case_positive(self):
"""Simple positive test :return:"""
allure.dynamic.title('Testing toJadenCase function (positive)')
allure.dynamic.severity(allure.severity_level.NORMAL)
allure.dynamic.de... | the_stack_v2_python_sparse | kyu_7/jaden_casing_strings/test_jaden_casing_strings.py | qamine-test/codewars | train | 0 |
d8867a2bdc58722c5ce95cf4555e9c4c6b326771 | [
"length = len(nums)\nfor i in range(0, length):\n for j in range(i + 1, length):\n sum = nums[i] + nums[j]\n if sum == target:\n return (i, j)",
"dic = {}\nfor i, num in enumerate(nums):\n dic[num] = i\nfor i, num in enumerate(nums):\n j = target - num\n if j in dic and dic[j]... | <|body_start_0|>
length = len(nums)
for i in range(0, length):
for j in range(i + 1, length):
sum = nums[i] + nums[j]
if sum == target:
return (i, j)
<|end_body_0|>
<|body_start_1|>
dic = {}
for i, num in enumerate(nums):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def two_sum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def two_pass_dict(self, nums, target):
""":param nums: List[int] :param target: int :return: List[int]"""
<|body_1|>
def one_pass_dict(s... | stack_v2_sparse_classes_10k_train_002632 | 1,077 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "two_sum",
"signature": "def two_sum(self, nums, target)"
},
{
"docstring": ":param nums: List[int] :param target: int :return: List[int]",
"name": "two_pass_dict",
"signature": "def two_pass_dict(self, n... | 3 | stack_v2_sparse_classes_30k_train_006295 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def two_sum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def two_pass_dict(self, nums, target): :param nums: List[int] :param target: int :ret... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def two_sum(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def two_pass_dict(self, nums, target): :param nums: List[int] :param target: int :ret... | f234bd7b62cb7bc2150faa764bf05a9095e19192 | <|skeleton|>
class Solution:
def two_sum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def two_pass_dict(self, nums, target):
""":param nums: List[int] :param target: int :return: List[int]"""
<|body_1|>
def one_pass_dict(s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def two_sum(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
length = len(nums)
for i in range(0, length):
for j in range(i + 1, length):
sum = nums[i] + nums[j]
if sum == target:
... | the_stack_v2_python_sparse | alg/two_sum.py | nyannko/leetcode-python | train | 0 | |
530addee1d0e708c6cb58c382ecbc5158fb2aeb6 | [
"query = \"SELECT AML.DATE AS DATE,\\n \\tCASE\\n \\t\\t\\t\\t\\tWHEN INV.SUPPLIER_INVOICE_NUMBER IS NOT NULL THEN AJ.NAME || ' ' || INV.SUPPLIER_INVOICE_NUMBER\\n \\t\\t\\t\\t\\tWHEN INV.NUMBER IS NOT NULL THEN AJ.NAME || ' ' || INV.NUMBER\\n \\t\\t\\t\\t\\tELSE AJ.NAME\\n \\tEND AS DESCRIPTION,\\n ... | <|body_start_0|>
query = "SELECT AML.DATE AS DATE,\n \tCASE\n \t\t\t\t\tWHEN INV.SUPPLIER_INVOICE_NUMBER IS NOT NULL THEN AJ.NAME || ' ' || INV.SUPPLIER_INVOICE_NUMBER\n \t\t\t\t\tWHEN INV.NUMBER IS NOT NULL THEN AJ.NAME || ' ' || INV.NUMBER\n \t\t\t\t\tELSE AJ.NAME\n \tEND AS DESCRIPTION,\n \... | AccountFullReconcile | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountFullReconcile:
def get_report_data(self):
"""Returns report dictionary for currency difference report for reconcilation"""
<|body_0|>
def unlink(self):
"""When removing a full reconciliation, we choose to remove partial reconciliations also"""
<|body_1... | stack_v2_sparse_classes_10k_train_002633 | 5,368 | no_license | [
{
"docstring": "Returns report dictionary for currency difference report for reconcilation",
"name": "get_report_data",
"signature": "def get_report_data(self)"
},
{
"docstring": "When removing a full reconciliation, we choose to remove partial reconciliations also",
"name": "unlink",
"s... | 2 | null | Implement the Python class `AccountFullReconcile` described below.
Class description:
Implement the AccountFullReconcile class.
Method signatures and docstrings:
- def get_report_data(self): Returns report dictionary for currency difference report for reconcilation
- def unlink(self): When removing a full reconciliat... | Implement the Python class `AccountFullReconcile` described below.
Class description:
Implement the AccountFullReconcile class.
Method signatures and docstrings:
- def get_report_data(self): Returns report dictionary for currency difference report for reconcilation
- def unlink(self): When removing a full reconciliat... | c04e2b9730db07848c153d8245d2df65ec4e2c8f | <|skeleton|>
class AccountFullReconcile:
def get_report_data(self):
"""Returns report dictionary for currency difference report for reconcilation"""
<|body_0|>
def unlink(self):
"""When removing a full reconciliation, we choose to remove partial reconciliations also"""
<|body_1... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AccountFullReconcile:
def get_report_data(self):
"""Returns report dictionary for currency difference report for reconcilation"""
query = "SELECT AML.DATE AS DATE,\n \tCASE\n \t\t\t\t\tWHEN INV.SUPPLIER_INVOICE_NUMBER IS NOT NULL THEN AJ.NAME || ' ' || INV.SUPPLIER_INVOICE_NUMBER\n \t... | the_stack_v2_python_sparse | currency_difference_invoice/models/account_partial_reconcile.py | aaltinisik/customaddons | train | 15 | |
c7bdd9a54bc9288d40edad0da10c9efe01dea791 | [
"fields = super(RelationSerializer, self).get_fields()\nif self.request.method == 'GET':\n fields['type'] = serializers.CharField(source='type.name')\nelse:\n fields['type'] = serializers.PrimaryKeyRelatedField(queryset=RelationType.objects.all())\nreturn fields",
"entities = validated_data.pop('positioninr... | <|body_start_0|>
fields = super(RelationSerializer, self).get_fields()
if self.request.method == 'GET':
fields['type'] = serializers.CharField(source='type.name')
else:
fields['type'] = serializers.PrimaryKeyRelatedField(queryset=RelationType.objects.all())
return... | Serializer for Relation objects. | RelationSerializer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelationSerializer:
"""Serializer for Relation objects."""
def get_fields(self):
"""Dynamically adapt fields based on the current request."""
<|body_0|>
def create(self, validated_data):
"""Create ``Relation`` object and add ``Entities``."""
<|body_1|>
<... | stack_v2_sparse_classes_10k_train_002634 | 2,651 | permissive | [
{
"docstring": "Dynamically adapt fields based on the current request.",
"name": "get_fields",
"signature": "def get_fields(self)"
},
{
"docstring": "Create ``Relation`` object and add ``Entities``.",
"name": "create",
"signature": "def create(self, validated_data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002018 | Implement the Python class `RelationSerializer` described below.
Class description:
Serializer for Relation objects.
Method signatures and docstrings:
- def get_fields(self): Dynamically adapt fields based on the current request.
- def create(self, validated_data): Create ``Relation`` object and add ``Entities``. | Implement the Python class `RelationSerializer` described below.
Class description:
Serializer for Relation objects.
Method signatures and docstrings:
- def get_fields(self): Dynamically adapt fields based on the current request.
- def create(self, validated_data): Create ``Relation`` object and add ``Entities``.
<|... | cf7b0d63a3cf9bd6d85ab891ded6aeb2208636c0 | <|skeleton|>
class RelationSerializer:
"""Serializer for Relation objects."""
def get_fields(self):
"""Dynamically adapt fields based on the current request."""
<|body_0|>
def create(self, validated_data):
"""Create ``Relation`` object and add ``Entities``."""
<|body_1|>
<... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RelationSerializer:
"""Serializer for Relation objects."""
def get_fields(self):
"""Dynamically adapt fields based on the current request."""
fields = super(RelationSerializer, self).get_fields()
if self.request.method == 'GET':
fields['type'] = serializers.CharField(s... | the_stack_v2_python_sparse | resolwe/flow/serializers/relation.py | mstajdohar/resolwe | train | 0 |
2e9f82b97bf7ac9725f67a748634c71cc6b7dd0e | [
"cache_key = (calendar_year, market_class_id)\nif cache_key not in PriceModifications._cache:\n price_modification = 0\n start_years = PriceModifications._data['start_year']\n if len(start_years[start_years <= calendar_year]) > 0:\n calendar_year = max(start_years[start_years <= calendar_year])\n ... | <|body_start_0|>
cache_key = (calendar_year, market_class_id)
if cache_key not in PriceModifications._cache:
price_modification = 0
start_years = PriceModifications._data['start_year']
if len(start_years[start_years <= calendar_year]) > 0:
calendar_yea... | **Loads and provides access to price modification data by model year and market class ID.** | PriceModifications | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PriceModifications:
"""**Loads and provides access to price modification data by model year and market class ID.**"""
def get_price_modification(calendar_year, market_class_id):
"""Get the price modification (if any) for the given year and market class ID. Args: calendar_year (int): ... | stack_v2_sparse_classes_10k_train_002635 | 6,957 | no_license | [
{
"docstring": "Get the price modification (if any) for the given year and market class ID. Args: calendar_year (int): calendar year to get price modification for market_class_id (str): market class id, e.g. 'hauling.ICE' Returns: The requested price modification, or 0 if there is none.",
"name": "get_price... | 2 | stack_v2_sparse_classes_30k_train_004321 | Implement the Python class `PriceModifications` described below.
Class description:
**Loads and provides access to price modification data by model year and market class ID.**
Method signatures and docstrings:
- def get_price_modification(calendar_year, market_class_id): Get the price modification (if any) for the gi... | Implement the Python class `PriceModifications` described below.
Class description:
**Loads and provides access to price modification data by model year and market class ID.**
Method signatures and docstrings:
- def get_price_modification(calendar_year, market_class_id): Get the price modification (if any) for the gi... | afe912c57383b9de90ef30820f7977c3367a30c4 | <|skeleton|>
class PriceModifications:
"""**Loads and provides access to price modification data by model year and market class ID.**"""
def get_price_modification(calendar_year, market_class_id):
"""Get the price modification (if any) for the given year and market class ID. Args: calendar_year (int): ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PriceModifications:
"""**Loads and provides access to price modification data by model year and market class ID.**"""
def get_price_modification(calendar_year, market_class_id):
"""Get the price modification (if any) for the given year and market class ID. Args: calendar_year (int): calendar year... | the_stack_v2_python_sparse | omega_model/context/price_modifications.py | USEPA/EPA_OMEGA_Model | train | 17 |
d0c44c99119ac2e02260ff2f0b0d23a3c6d45be4 | [
"super(AttentionPooling, self).__init__()\ntotal_features_channels = molecule_channels + hidden_channels\nself.lin = nn.Linear(total_features_channels, hidden_channels)\nself.last_rep = nn.Linear(hidden_channels, hidden_channels)",
"att = torch.sigmoid(self.lin(torch.cat((input_rep, final_rep), dim=1)))\ng = att.... | <|body_start_0|>
super(AttentionPooling, self).__init__()
total_features_channels = molecule_channels + hidden_channels
self.lin = nn.Linear(total_features_channels, hidden_channels)
self.last_rep = nn.Linear(hidden_channels, hidden_channels)
<|end_body_0|>
<|body_start_1|>
att ... | The attention pooling layer from [chen2020]_. | AttentionPooling | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttentionPooling:
"""The attention pooling layer from [chen2020]_."""
def __init__(self, molecule_channels: int, hidden_channels: int):
"""Instantiate the attention pooling layer. :param molecule_channels: Input node features. :param hidden_channels: Final node representation."""
... | stack_v2_sparse_classes_10k_train_002636 | 25,672 | no_license | [
{
"docstring": "Instantiate the attention pooling layer. :param molecule_channels: Input node features. :param hidden_channels: Final node representation.",
"name": "__init__",
"signature": "def __init__(self, molecule_channels: int, hidden_channels: int)"
},
{
"docstring": "Compute an attention... | 2 | stack_v2_sparse_classes_30k_train_003046 | Implement the Python class `AttentionPooling` described below.
Class description:
The attention pooling layer from [chen2020]_.
Method signatures and docstrings:
- def __init__(self, molecule_channels: int, hidden_channels: int): Instantiate the attention pooling layer. :param molecule_channels: Input node features. ... | Implement the Python class `AttentionPooling` described below.
Class description:
The attention pooling layer from [chen2020]_.
Method signatures and docstrings:
- def __init__(self, molecule_channels: int, hidden_channels: int): Instantiate the attention pooling layer. :param molecule_channels: Input node features. ... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class AttentionPooling:
"""The attention pooling layer from [chen2020]_."""
def __init__(self, molecule_channels: int, hidden_channels: int):
"""Instantiate the attention pooling layer. :param molecule_channels: Input node features. :param hidden_channels: Final node representation."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AttentionPooling:
"""The attention pooling layer from [chen2020]_."""
def __init__(self, molecule_channels: int, hidden_channels: int):
"""Instantiate the attention pooling layer. :param molecule_channels: Input node features. :param hidden_channels: Final node representation."""
super(At... | the_stack_v2_python_sparse | generated/test_AstraZeneca_chemicalx.py | jansel/pytorch-jit-paritybench | train | 35 |
008acc477c6de384db81166439581d21a3140acd | [
"if not root:\n return 'null'\nnodes = collections.deque([root])\nmaps = collections.deque([{'v': root.val}])\ntree = maps[0]\nwhile nodes:\n frontNode = nodes.popleft()\n frontMap = maps.popleft()\n if frontNode.left:\n frontMap['l'] = {'v': frontNode.left.val}\n nodes.append(frontNode.le... | <|body_start_0|>
if not root:
return 'null'
nodes = collections.deque([root])
maps = collections.deque([{'v': root.val}])
tree = maps[0]
while nodes:
frontNode = nodes.popleft()
frontMap = maps.popleft()
if frontNode.left:
... | 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_002637 | 17,936 | 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:... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|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 'null'
nodes = collections.deque([root])
maps = collections.deque([{'v': root.val}])
tree = maps[0]
while nodes:
... | the_stack_v2_python_sparse | leetcode_python/Tree/serialize-and-deserialize-binary-tree.py | yennanliu/CS_basics | train | 64 | |
8f628d9883f132531e7589e207ab2ae7091bff3e | [
"referenced_value = value.referenced_value()\nExplorer.explore_expr(expr, referenced_value, is_child)\nreturn False",
"target_type = datatype.target()\nExplorer.explore_type(name, target_type, is_child)\nreturn False"
] | <|body_start_0|>
referenced_value = value.referenced_value()
Explorer.explore_expr(expr, referenced_value, is_child)
return False
<|end_body_0|>
<|body_start_1|>
target_type = datatype.target()
Explorer.explore_type(name, target_type, is_child)
return False
<|end_body_1|... | Internal class used to explore reference (TYPE_CODE_REF) values. | ReferenceExplorer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReferenceExplorer:
"""Internal class used to explore reference (TYPE_CODE_REF) values."""
def explore_expr(expr, value, is_child):
"""Function to explore array values. See Explorer.explore_expr for more information."""
<|body_0|>
def explore_type(name, datatype, is_child... | stack_v2_sparse_classes_10k_train_002638 | 26,692 | permissive | [
{
"docstring": "Function to explore array values. See Explorer.explore_expr for more information.",
"name": "explore_expr",
"signature": "def explore_expr(expr, value, is_child)"
},
{
"docstring": "Function to explore pointer types. See Explorer.explore_type for more information.",
"name": "... | 2 | stack_v2_sparse_classes_30k_train_004504 | Implement the Python class `ReferenceExplorer` described below.
Class description:
Internal class used to explore reference (TYPE_CODE_REF) values.
Method signatures and docstrings:
- def explore_expr(expr, value, is_child): Function to explore array values. See Explorer.explore_expr for more information.
- def explo... | Implement the Python class `ReferenceExplorer` described below.
Class description:
Internal class used to explore reference (TYPE_CODE_REF) values.
Method signatures and docstrings:
- def explore_expr(expr, value, is_child): Function to explore array values. See Explorer.explore_expr for more information.
- def explo... | b90664de0bd4c1897a9f1f5d9e360a9631d38b34 | <|skeleton|>
class ReferenceExplorer:
"""Internal class used to explore reference (TYPE_CODE_REF) values."""
def explore_expr(expr, value, is_child):
"""Function to explore array values. See Explorer.explore_expr for more information."""
<|body_0|>
def explore_type(name, datatype, is_child... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ReferenceExplorer:
"""Internal class used to explore reference (TYPE_CODE_REF) values."""
def explore_expr(expr, value, is_child):
"""Function to explore array values. See Explorer.explore_expr for more information."""
referenced_value = value.referenced_value()
Explorer.explore_e... | the_stack_v2_python_sparse | toolchain/riscv/Linux/share/gdb/python/gdb/command/explore.py | bouffalolab/bl_iot_sdk | train | 244 |
63713407184a93986c403a48e68e687c41b2b73f | [
"def count(inv_idx, m, left, right):\n return bisect.bisect_right(inv_idx[m], right) - bisect.bisect_left(inv_idx[m], left)\nself.__arr = arr\nself.__inv_idx = collections.defaultdict(list)\nfor i, x in enumerate(self.__arr):\n self.__inv_idx[x].append(i)\nself.__segment_tree = SegmentTreeRecu(arr, functools.... | <|body_start_0|>
def count(inv_idx, m, left, right):
return bisect.bisect_right(inv_idx[m], right) - bisect.bisect_left(inv_idx[m], left)
self.__arr = arr
self.__inv_idx = collections.defaultdict(list)
for i, x in enumerate(self.__arr):
self.__inv_idx[x].append(i)... | MajorityChecker1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MajorityChecker1:
def __init__(self, arr):
""":type arr: List[int]"""
<|body_0|>
def query(self, left, right, threshold):
""":type left: int :type right: int :type threshold: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def count(... | stack_v2_sparse_classes_10k_train_002639 | 6,042 | no_license | [
{
"docstring": ":type arr: List[int]",
"name": "__init__",
"signature": "def __init__(self, arr)"
},
{
"docstring": ":type left: int :type right: int :type threshold: int :rtype: int",
"name": "query",
"signature": "def query(self, left, right, threshold)"
}
] | 2 | null | Implement the Python class `MajorityChecker1` described below.
Class description:
Implement the MajorityChecker1 class.
Method signatures and docstrings:
- def __init__(self, arr): :type arr: List[int]
- def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int | Implement the Python class `MajorityChecker1` described below.
Class description:
Implement the MajorityChecker1 class.
Method signatures and docstrings:
- def __init__(self, arr): :type arr: List[int]
- def query(self, left, right, threshold): :type left: int :type right: int :type threshold: int :rtype: int
<|skel... | 44765a7d89423b7ec2c159f70b1a6f6e446523c2 | <|skeleton|>
class MajorityChecker1:
def __init__(self, arr):
""":type arr: List[int]"""
<|body_0|>
def query(self, left, right, threshold):
""":type left: int :type right: int :type threshold: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MajorityChecker1:
def __init__(self, arr):
""":type arr: List[int]"""
def count(inv_idx, m, left, right):
return bisect.bisect_right(inv_idx[m], right) - bisect.bisect_left(inv_idx[m], left)
self.__arr = arr
self.__inv_idx = collections.defaultdict(list)
for... | the_stack_v2_python_sparse | python/_1001_1500/1157_online-majority-element-in-subarray.py | Wang-Yann/LeetCodeMe | train | 0 | |
49919c2323266cadcc59c59e708a976a5f266ba7 | [
"flags.AddParentFlagsToParser(parser)\nparser.add_argument('--location', metavar='LOCATION', required=True, help='Location')\nparser.add_argument('--insight-type', metavar='INSIGHT_TYPE', required=True, help='Insight type to list insights for. Supported insight-types can be found here: https://cloud.google.com/reco... | <|body_start_0|>
flags.AddParentFlagsToParser(parser)
parser.add_argument('--location', metavar='LOCATION', required=True, help='Location')
parser.add_argument('--insight-type', metavar='INSIGHT_TYPE', required=True, help='Insight type to list insights for. Supported insight-types can be found h... | List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: project, billing_account, folder a... | ListOriginal | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListOriginal:
"""List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are suppo... | stack_v2_sparse_classes_10k_train_002640 | 6,196 | permissive | [
{
"docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use to add arguments that go on the command line after this command.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstring": "Run 'gcloud recommender insight... | 2 | stack_v2_sparse_classes_30k_train_003698 | Implement the Python class `ListOriginal` described below.
Class description:
List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the... | Implement the Python class `ListOriginal` described below.
Class description:
List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class ListOriginal:
"""List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are suppo... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ListOriginal:
"""List insights for a cloud entity. This command lists all insights for a given cloud entity, location and insight type. Supported insight-types can be found here: https://cloud.google.com/recommender/docs/insights/insight-types. Currently the following cloud_entity_types are supported: project... | the_stack_v2_python_sparse | lib/surface/recommender/insights/list.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
6c430eafa9e0a5e6493c7a0c725e43cfb199fed9 | [
"if G.Env.save_transformed_metrics:\n self.evaluate('oof', self.data_oof.target.T.fold, self.data_oof.prediction.T.run)\nelse:\n self.evaluate('oof', self.data_oof.target.fold, self.data_oof.prediction.run)\nsuper().on_run_end()",
"if G.Env.save_transformed_metrics:\n self.evaluate('oof', self.data_oof.t... | <|body_start_0|>
if G.Env.save_transformed_metrics:
self.evaluate('oof', self.data_oof.target.T.fold, self.data_oof.prediction.T.run)
else:
self.evaluate('oof', self.data_oof.target.fold, self.data_oof.prediction.run)
super().on_run_end()
<|end_body_0|>
<|body_start_1|>
... | EvaluatorOOF | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EvaluatorOOF:
def on_run_end(self):
"""Evaluate out-of-fold predictions for the run"""
<|body_0|>
def on_fold_end(self):
"""Evaluate (run-averaged) out-of-fold predictions for the fold"""
<|body_1|>
def on_rep_end(self):
"""Evaluate (run-averaged... | stack_v2_sparse_classes_10k_train_002641 | 5,856 | permissive | [
{
"docstring": "Evaluate out-of-fold predictions for the run",
"name": "on_run_end",
"signature": "def on_run_end(self)"
},
{
"docstring": "Evaluate (run-averaged) out-of-fold predictions for the fold",
"name": "on_fold_end",
"signature": "def on_fold_end(self)"
},
{
"docstring":... | 4 | stack_v2_sparse_classes_30k_test_000351 | Implement the Python class `EvaluatorOOF` described below.
Class description:
Implement the EvaluatorOOF class.
Method signatures and docstrings:
- def on_run_end(self): Evaluate out-of-fold predictions for the run
- def on_fold_end(self): Evaluate (run-averaged) out-of-fold predictions for the fold
- def on_rep_end(... | Implement the Python class `EvaluatorOOF` described below.
Class description:
Implement the EvaluatorOOF class.
Method signatures and docstrings:
- def on_run_end(self): Evaluate out-of-fold predictions for the run
- def on_fold_end(self): Evaluate (run-averaged) out-of-fold predictions for the fold
- def on_rep_end(... | 3709d5e97dd23efa0df1b79982ae029789e1af57 | <|skeleton|>
class EvaluatorOOF:
def on_run_end(self):
"""Evaluate out-of-fold predictions for the run"""
<|body_0|>
def on_fold_end(self):
"""Evaluate (run-averaged) out-of-fold predictions for the fold"""
<|body_1|>
def on_rep_end(self):
"""Evaluate (run-averaged... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class EvaluatorOOF:
def on_run_end(self):
"""Evaluate out-of-fold predictions for the run"""
if G.Env.save_transformed_metrics:
self.evaluate('oof', self.data_oof.target.T.fold, self.data_oof.prediction.T.run)
else:
self.evaluate('oof', self.data_oof.target.fold, self... | the_stack_v2_python_sparse | hyperparameter_hunter/callbacks/evaluators.py | shaoeric/hyperparameter_hunter | train | 0 | |
c5f5490146234380dcb74910bddcb9bbdd8399c6 | [
"s = math.factorial(n)\nl = 0\nfor i in reversed(str(s)):\n if i == '0':\n l += 1\n else:\n return l\nreturn l",
"if n == 0:\n return 0\nreturn n / 5 + self.trailingZeroes(n - 1) if n % 5 == 0 else self.trailingZeroes(n - 1)",
"if n == 0:\n return 0\nreturn n / 5 + self.trailingZeroes(... | <|body_start_0|>
s = math.factorial(n)
l = 0
for i in reversed(str(s)):
if i == '0':
l += 1
else:
return l
return l
<|end_body_0|>
<|body_start_1|>
if n == 0:
return 0
return n / 5 + self.trailingZeroes(... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _trailingZeroes(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def __trailingZeroes(self, n):
""":type n: int :rtype: int"""
<|body_1|>
def trailingZeroes(self, n):
""":type n: int :rtype: int"""
<|body_2|>
def ___... | stack_v2_sparse_classes_10k_train_002642 | 1,964 | permissive | [
{
"docstring": ":type n: int :rtype: int",
"name": "_trailingZeroes",
"signature": "def _trailingZeroes(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "__trailingZeroes",
"signature": "def __trailingZeroes(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
... | 4 | stack_v2_sparse_classes_30k_train_005032 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _trailingZeroes(self, n): :type n: int :rtype: int
- def __trailingZeroes(self, n): :type n: int :rtype: int
- def trailingZeroes(self, n): :type n: int :rtype: int
- def ___... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _trailingZeroes(self, n): :type n: int :rtype: int
- def __trailingZeroes(self, n): :type n: int :rtype: int
- def trailingZeroes(self, n): :type n: int :rtype: int
- def ___... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _trailingZeroes(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def __trailingZeroes(self, n):
""":type n: int :rtype: int"""
<|body_1|>
def trailingZeroes(self, n):
""":type n: int :rtype: int"""
<|body_2|>
def ___... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def _trailingZeroes(self, n):
""":type n: int :rtype: int"""
s = math.factorial(n)
l = 0
for i in reversed(str(s)):
if i == '0':
l += 1
else:
return l
return l
def __trailingZeroes(self, n):
... | the_stack_v2_python_sparse | 172.factorial-trailing-zeroes.py | windard/leeeeee | train | 0 | |
f398e5b6d3a97e2f039feea93f2450ed05c87e59 | [
"self.rad = radius\nself.xc = x_center\nself.yc = y_center",
"while True:\n x = self.xc + random.uniform(-1, 1) * self.rad\n y = self.yc + random.uniform(-1, 1) * self.rad\n if (x - self.xc) ** 2 + (y - self.yc) ** 2 <= self.rad ** 2:\n return [x, y]"
] | <|body_start_0|>
self.rad = radius
self.xc = x_center
self.yc = y_center
<|end_body_0|>
<|body_start_1|>
while True:
x = self.xc + random.uniform(-1, 1) * self.rad
y = self.yc + random.uniform(-1, 1) * self.rad
if (x - self.xc) ** 2 + (y - self.yc) **... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
<|body_0|>
def randPoint(self):
""":rtype: List[float]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.rad = radius
... | stack_v2_sparse_classes_10k_train_002643 | 1,035 | no_license | [
{
"docstring": ":type radius: float :type x_center: float :type y_center: float",
"name": "__init__",
"signature": "def __init__(self, radius, x_center, y_center)"
},
{
"docstring": ":rtype: List[float]",
"name": "randPoint",
"signature": "def randPoint(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006645 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float
- def randPoint(self): :rtype: List[float] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def __init__(self, radius, x_center, y_center): :type radius: float :type x_center: float :type y_center: float
- def randPoint(self): :rtype: List[float]
<|skeleton|>
class Sol... | 6fec95b9b4d735727160905e754a698513bfb7d8 | <|skeleton|>
class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
<|body_0|>
def randPoint(self):
""":rtype: List[float]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def __init__(self, radius, x_center, y_center):
""":type radius: float :type x_center: float :type y_center: float"""
self.rad = radius
self.xc = x_center
self.yc = y_center
def randPoint(self):
""":rtype: List[float]"""
while True:
x ... | the_stack_v2_python_sparse | leetcode/math/generate-random-point-in-a-circle.py | jwyx3/practices | train | 2 | |
f7542da8340f0c6d3b57e7b58e81522c4f3a6587 | [
"node = Node()\nnode.id = '1234'\nself.assertEqual(node.getId(), node.id)",
"node = Node()\nnode.properties['datawire_nodeId'] = '4567'\nself.assertEqual(node.getId(), '4567')"
] | <|body_start_0|>
node = Node()
node.id = '1234'
self.assertEqual(node.getId(), node.id)
<|end_body_0|>
<|body_start_1|>
node = Node()
node.properties['datawire_nodeId'] = '4567'
self.assertEqual(node.getId(), '4567')
<|end_body_1|>
| Tests for Node. | NodeTests | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NodeTests:
"""Tests for Node."""
def test_id(self):
"""Node.getId() uses Node.id if present."""
<|body_0|>
def test_missingId(self):
"""Node.getId() uses the datawire_nodeId property if the id is not set."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_10k_train_002644 | 35,450 | permissive | [
{
"docstring": "Node.getId() uses Node.id if present.",
"name": "test_id",
"signature": "def test_id(self)"
},
{
"docstring": "Node.getId() uses the datawire_nodeId property if the id is not set.",
"name": "test_missingId",
"signature": "def test_missingId(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001616 | Implement the Python class `NodeTests` described below.
Class description:
Tests for Node.
Method signatures and docstrings:
- def test_id(self): Node.getId() uses Node.id if present.
- def test_missingId(self): Node.getId() uses the datawire_nodeId property if the id is not set. | Implement the Python class `NodeTests` described below.
Class description:
Tests for Node.
Method signatures and docstrings:
- def test_id(self): Node.getId() uses Node.id if present.
- def test_missingId(self): Node.getId() uses the datawire_nodeId property if the id is not set.
<|skeleton|>
class NodeTests:
""... | 8b4ad9aa1e3602f4ec7f3bdd5f2c22abcfe81463 | <|skeleton|>
class NodeTests:
"""Tests for Node."""
def test_id(self):
"""Node.getId() uses Node.id if present."""
<|body_0|>
def test_missingId(self):
"""Node.getId() uses the datawire_nodeId property if the id is not set."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NodeTests:
"""Tests for Node."""
def test_id(self):
"""Node.getId() uses Node.id if present."""
node = Node()
node.id = '1234'
self.assertEqual(node.getId(), node.id)
def test_missingId(self):
"""Node.getId() uses the datawire_nodeId property if the id is not ... | the_stack_v2_python_sparse | unittests/test_discovery.py | casualuser/mdk | train | 0 |
c41fc58f338093078e3aa771f9a7fa301d4955c4 | [
"self.drive.find_element_by_xpath(\".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[1]/div/div/label[2]/span[1]/span\").click()\nusername = self.drive.find_element_by_xpath(\".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[2]/div/div/input\")\npassword = self.drive.find_element_by_... | <|body_start_0|>
self.drive.find_element_by_xpath(".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[1]/div/div/label[2]/span[1]/span").click()
username = self.drive.find_element_by_xpath(".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[2]/div/div/input")
password... | portal_fabu_001 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class portal_fabu_001:
def test_login_001(self):
"""登录"""
<|body_0|>
def test_fabu_001(self):
"""流转发布第一步"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.drive.find_element_by_xpath(".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[1]/... | stack_v2_sparse_classes_10k_train_002645 | 3,377 | no_license | [
{
"docstring": "登录",
"name": "test_login_001",
"signature": "def test_login_001(self)"
},
{
"docstring": "流转发布第一步",
"name": "test_fabu_001",
"signature": "def test_fabu_001(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001239 | Implement the Python class `portal_fabu_001` described below.
Class description:
Implement the portal_fabu_001 class.
Method signatures and docstrings:
- def test_login_001(self): 登录
- def test_fabu_001(self): 流转发布第一步 | Implement the Python class `portal_fabu_001` described below.
Class description:
Implement the portal_fabu_001 class.
Method signatures and docstrings:
- def test_login_001(self): 登录
- def test_fabu_001(self): 流转发布第一步
<|skeleton|>
class portal_fabu_001:
def test_login_001(self):
"""登录"""
<|body_... | 87d713a5c8d3763b3dfa191cd7a00933899679b9 | <|skeleton|>
class portal_fabu_001:
def test_login_001(self):
"""登录"""
<|body_0|>
def test_fabu_001(self):
"""流转发布第一步"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class portal_fabu_001:
def test_login_001(self):
"""登录"""
self.drive.find_element_by_xpath(".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[1]/div/div/label[2]/span[1]/span").click()
username = self.drive.find_element_by_xpath(".//*[@id='app']/div[3]/div[2]/div/div[2]/div/di... | the_stack_v2_python_sparse | por/portalA.py | Zhaokun-max/workspaces | train | 0 | |
0f4c485eb4324fd63468979bf018562474699973 | [
"if target == 'html':\n return f'<a href=\"{link}\">{description}</a>'\nelif target == 'md':\n return f'[{description}]({link})'\nelse:\n raise ValueError(f'Can only template links to `html` or `md`, got `{target}`')",
"link_format = request.query_params.get('link_format', 'md')\nif link_format not in ('... | <|body_start_0|>
if target == 'html':
return f'<a href="{link}">{description}</a>'
elif target == 'md':
return f'[{description}]({link})'
else:
raise ValueError(f'Can only template links to `html` or `md`, got `{target}`')
<|end_body_0|>
<|body_start_1|>
... | Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wake_up", "early", "early_bird"]], ... ["Take your medicine.", ["medicine", "he... | RulesView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RulesView:
"""Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wake_up", "early", "early_bird"]], ... ["T... | stack_v2_sparse_classes_10k_train_002646 | 7,527 | permissive | [
{
"docstring": "Build the markup for rendering the link. This will render `link` with `description` as its description in the given `target` language. Arguments: description (str): A textual description of the string. Represents the content between the `<a>` tags in HTML, or the content between the array bracke... | 2 | stack_v2_sparse_classes_30k_train_005172 | Implement the Python class `RulesView` described below.
Class description:
Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wak... | Implement the Python class `RulesView` described below.
Class description:
Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wak... | cb6326cabee6570a5725702cb2893ae39f752279 | <|skeleton|>
class RulesView:
"""Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wake_up", "early", "early_bird"]], ... ["T... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RulesView:
"""Return a list of the server's rules. ## Routes ### GET /rules Returns a JSON array containing the server's rules and keywords relating to each rule. Example response: >>> [ ... ["Eat candy.", ["candy", "sweets"]], ... ["Wake up at 4 AM.", ["wake_up", "early", "early_bird"]], ... ["Take your medi... | the_stack_v2_python_sparse | pydis_site/apps/api/views.py | python-discord/site | train | 746 |
e70daf7dbb037bd71d8f8aa4bb4ab6b239ee09de | [
"self.value_list = w\nfor i in range(1, len(w)):\n self.value_list[i] += self.value_list[i - 1]",
"temp_value = 0\nlow = 0\nhigh = len(self.value_list)\ntarget_value = random.randint(1, self.value_list[-1])\nwhile low < high:\n mid = (low + high) // 2\n if self.value_list[mid] < target_value:\n lo... | <|body_start_0|>
self.value_list = w
for i in range(1, len(w)):
self.value_list[i] += self.value_list[i - 1]
<|end_body_0|>
<|body_start_1|>
temp_value = 0
low = 0
high = len(self.value_list)
target_value = random.randint(1, self.value_list[-1])
while... | 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.value_list = w
for i in range(1, len(w)):
self.value_list[i] += self.va... | stack_v2_sparse_classes_10k_train_002647 | 880 | 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]"""
<|... | dc45210cb2cc50bfefd8c21c865e6ee2163a022a | <|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.value_list = w
for i in range(1, len(w)):
self.value_list[i] += self.value_list[i - 1]
def pickIndex(self):
""":rtype: int"""
temp_value = 0
low = 0
high = len(self.value_lis... | the_stack_v2_python_sparse | practice/solution/0528_random_pick_with_weight.py | kesarb/leetcode-summary-python | train | 0 | |
051a4a20994cba91e2de1bdbf1fa5da6a4c37bbe | [
"super(QIntSpinner3DS, self).__init__(parent)\nself.size = size\nself.step = step\nself.default_value = default_value\nself.mouseStartPosY = 0\nself.startValue = 0\nself.current_value = 0\nself.setMaximumSize(self.size)\nself.setSingleStep(self.step)\nself.setValue(self.default_value)",
"if event.type() == qtc.QE... | <|body_start_0|>
super(QIntSpinner3DS, self).__init__(parent)
self.size = size
self.step = step
self.default_value = default_value
self.mouseStartPosY = 0
self.startValue = 0
self.current_value = 0
self.setMaximumSize(self.size)
self.setSingleStep(... | Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent | QIntSpinner3DS | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QIntSpinner3DS:
"""Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent"""
def __init__(self, size, step=1, default_value=0, parent=None):
"""Initialization"""
<|body_0|>
def mousePressEvent(self, e... | stack_v2_sparse_classes_10k_train_002648 | 4,069 | no_license | [
{
"docstring": "Initialization",
"name": "__init__",
"signature": "def __init__(self, size, step=1, default_value=0, parent=None)"
},
{
"docstring": "Re-define mousePressEvent to implement right-click/left-click",
"name": "mousePressEvent",
"signature": "def mousePressEvent(self, event)"... | 4 | stack_v2_sparse_classes_30k_train_002066 | Implement the Python class `QIntSpinner3DS` described below.
Class description:
Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent
Method signatures and docstrings:
- def __init__(self, size, step=1, default_value=0, parent=None): Initializati... | Implement the Python class `QIntSpinner3DS` described below.
Class description:
Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent
Method signatures and docstrings:
- def __init__(self, size, step=1, default_value=0, parent=None): Initializati... | 6537d2f4a62afa0b5ea745a93193d1bc1379a24d | <|skeleton|>
class QIntSpinner3DS:
"""Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent"""
def __init__(self, size, step=1, default_value=0, parent=None):
"""Initialization"""
<|body_0|>
def mousePressEvent(self, e... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QIntSpinner3DS:
"""Custom QDoubleSpinBox widget mimicking 3dsMax style "UI Spinner Controls" initialize with : size, step, default_value, parent"""
def __init__(self, size, step=1, default_value=0, parent=None):
"""Initialization"""
super(QIntSpinner3DS, self).__init__(parent)
sel... | the_stack_v2_python_sparse | Custom_Widgets/Custom_3dsMaxStyleSpinner.py | LucasPancarte/learning_PySide2 | train | 0 |
d3f2ba6ece097e389f63d9be6e284cee59ab2bf6 | [
"super().__init__()\nself.queue = queue\nself.data_incoming = True",
"while self.data_incoming is True or len(self.queue) > 0:\n if len(self.queue) > 0:\n print(self.queue.data_queue.pop(0))\n time.sleep(0.5)\n else:\n time.sleep(0.75)"
] | <|body_start_0|>
super().__init__()
self.queue = queue
self.data_incoming = True
<|end_body_0|>
<|body_start_1|>
while self.data_incoming is True or len(self.queue) > 0:
if len(self.queue) > 0:
print(self.queue.data_queue.pop(0))
time.sleep(0.... | ConsumerThread class used to print the data out. | ConsumerThread | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConsumerThread:
"""ConsumerThread class used to print the data out."""
def __init__(self, queue: CityOverheadTimeQueue):
"""constructs the queue proxy and sets the data incoming status. :param queue: CityOverheadTimeQueue"""
<|body_0|>
def run(self) -> None:
"""i... | stack_v2_sparse_classes_10k_train_002649 | 4,615 | no_license | [
{
"docstring": "constructs the queue proxy and sets the data incoming status. :param queue: CityOverheadTimeQueue",
"name": "__init__",
"signature": "def __init__(self, queue: CityOverheadTimeQueue)"
},
{
"docstring": "if the queue list is not empty, remove the last item in the queue and if the ... | 2 | stack_v2_sparse_classes_30k_test_000161 | Implement the Python class `ConsumerThread` described below.
Class description:
ConsumerThread class used to print the data out.
Method signatures and docstrings:
- def __init__(self, queue: CityOverheadTimeQueue): constructs the queue proxy and sets the data incoming status. :param queue: CityOverheadTimeQueue
- def... | Implement the Python class `ConsumerThread` described below.
Class description:
ConsumerThread class used to print the data out.
Method signatures and docstrings:
- def __init__(self, queue: CityOverheadTimeQueue): constructs the queue proxy and sets the data incoming status. :param queue: CityOverheadTimeQueue
- def... | 7061af6821d25bf7df6fd6e419ad828f5c1e7d61 | <|skeleton|>
class ConsumerThread:
"""ConsumerThread class used to print the data out."""
def __init__(self, queue: CityOverheadTimeQueue):
"""constructs the queue proxy and sets the data incoming status. :param queue: CityOverheadTimeQueue"""
<|body_0|>
def run(self) -> None:
"""i... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ConsumerThread:
"""ConsumerThread class used to print the data out."""
def __init__(self, queue: CityOverheadTimeQueue):
"""constructs the queue proxy and sets the data incoming status. :param queue: CityOverheadTimeQueue"""
super().__init__()
self.queue = queue
self.data_... | the_stack_v2_python_sparse | Labs/Lab10/producer_consumer.py | jieunyu0623/3522_A00998343 | train | 1 |
b6fd5d32b0168cd5333d304423e1bf3ad90d25a8 | [
"gt_labels = self.data_infos[idx]['gt_label']\ncat_ids = np.where(gt_labels == 1)[0].tolist()\nreturn cat_ids",
"if metric_options is None or metric_options == {}:\n metric_options = {'thr': 0.5}\nif isinstance(metric, str):\n metrics = [metric]\nelse:\n metrics = metric\nallowed_metrics = ['mAP', 'CP', ... | <|body_start_0|>
gt_labels = self.data_infos[idx]['gt_label']
cat_ids = np.where(gt_labels == 1)[0].tolist()
return cat_ids
<|end_body_0|>
<|body_start_1|>
if metric_options is None or metric_options == {}:
metric_options = {'thr': 0.5}
if isinstance(metric, str):
... | Multi-label Dataset. | MultiLabelDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiLabelDataset:
"""Multi-label Dataset."""
def get_cat_ids(self, idx: int) -> List[int]:
"""Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index."""
<|body_0|>
def evaluate(self, results, metric='... | stack_v2_sparse_classes_10k_train_002650 | 2,802 | permissive | [
{
"docstring": "Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index.",
"name": "get_cat_ids",
"signature": "def get_cat_ids(self, idx: int) -> List[int]"
},
{
"docstring": "Evaluate the dataset. Args: results (list): Testin... | 2 | stack_v2_sparse_classes_30k_train_000021 | Implement the Python class `MultiLabelDataset` described below.
Class description:
Multi-label Dataset.
Method signatures and docstrings:
- def get_cat_ids(self, idx: int) -> List[int]: Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index.
- def ... | Implement the Python class `MultiLabelDataset` described below.
Class description:
Multi-label Dataset.
Method signatures and docstrings:
- def get_cat_ids(self, idx: int) -> List[int]: Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index.
- def ... | 2b8882b2da41d4e175fe49a33fcefad1423216f4 | <|skeleton|>
class MultiLabelDataset:
"""Multi-label Dataset."""
def get_cat_ids(self, idx: int) -> List[int]:
"""Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index."""
<|body_0|>
def evaluate(self, results, metric='... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class MultiLabelDataset:
"""Multi-label Dataset."""
def get_cat_ids(self, idx: int) -> List[int]:
"""Get category ids by index. Args: idx (int): Index of data. Returns: cat_ids (List[int]): Image categories of specified index."""
gt_labels = self.data_infos[idx]['gt_label']
cat_ids = np... | the_stack_v2_python_sparse | mmcls/datasets/multi_label.py | ChenhongyiYang/GPViT | train | 78 |
e0b9cd210119845623f2893e4e800322245972e9 | [
"User = get_user_model()\nuser = User.objects.create(email='fatemeh@email.com', password='customusertest12345')\nself.assertEqual(user.email, 'fatemeh@email.com')\nself.assertTrue(user.is_active)\nself.assertFalse(user.is_staff)\nself.assertFalse(user.is_superuser)",
"User = get_user_model()\nadmin = User.objects... | <|body_start_0|>
User = get_user_model()
user = User.objects.create(email='fatemeh@email.com', password='customusertest12345')
self.assertEqual(user.email, 'fatemeh@email.com')
self.assertTrue(user.is_active)
self.assertFalse(user.is_staff)
self.assertFalse(user.is_superu... | تست کیس دو متد ایجاد یوزر و سوپریوزر از مدل کاستوم یوزر | CustomUserTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomUserTests:
"""تست کیس دو متد ایجاد یوزر و سوپریوزر از مدل کاستوم یوزر"""
def test_create_user(self):
"""ایجاد یوزر تنها با ایمیل و پسورد. چک می کند که فیلدهای: is_active حتما true و issuperuser, is_staff حتما false باشد"""
<|body_0|>
def test_create_superuser(self)... | stack_v2_sparse_classes_10k_train_002651 | 1,468 | no_license | [
{
"docstring": "ایجاد یوزر تنها با ایمیل و پسورد. چک می کند که فیلدهای: is_active حتما true و issuperuser, is_staff حتما false باشد",
"name": "test_create_user",
"signature": "def test_create_user(self)"
},
{
"docstring": "ایجاد ادمین با استفاده از ایمیل و پسورد. چک می کند که فیلد های issuperuse... | 2 | stack_v2_sparse_classes_30k_train_005141 | Implement the Python class `CustomUserTests` described below.
Class description:
تست کیس دو متد ایجاد یوزر و سوپریوزر از مدل کاستوم یوزر
Method signatures and docstrings:
- def test_create_user(self): ایجاد یوزر تنها با ایمیل و پسورد. چک می کند که فیلدهای: is_active حتما true و issuperuser, is_staff حتما false باشد
-... | Implement the Python class `CustomUserTests` described below.
Class description:
تست کیس دو متد ایجاد یوزر و سوپریوزر از مدل کاستوم یوزر
Method signatures and docstrings:
- def test_create_user(self): ایجاد یوزر تنها با ایمیل و پسورد. چک می کند که فیلدهای: is_active حتما true و issuperuser, is_staff حتما false باشد
-... | 1846897db084d72697571900bc41dacbd9b6059b | <|skeleton|>
class CustomUserTests:
"""تست کیس دو متد ایجاد یوزر و سوپریوزر از مدل کاستوم یوزر"""
def test_create_user(self):
"""ایجاد یوزر تنها با ایمیل و پسورد. چک می کند که فیلدهای: is_active حتما true و issuperuser, is_staff حتما false باشد"""
<|body_0|>
def test_create_superuser(self)... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CustomUserTests:
"""تست کیس دو متد ایجاد یوزر و سوپریوزر از مدل کاستوم یوزر"""
def test_create_user(self):
"""ایجاد یوزر تنها با ایمیل و پسورد. چک می کند که فیلدهای: is_active حتما true و issuperuser, is_staff حتما false باشد"""
User = get_user_model()
user = User.objects.create(e... | the_stack_v2_python_sparse | src/accounts/tests.py | FatemehRahmanzadeh/Book_store_Persian_rtl | train | 0 |
13e0c372fb6ae46c74b95fde7d92b4e96178cb9f | [
"day, month, year = str_date.split('.')\nDate.day = int(day)\nDate.month = int(month)\nDate.year = int(year)",
"if scale.lower() == 'day':\n result = Date.day\nelif scale.lower() == 'month':\n result = Date.month\nelif scale.lower() == 'year':\n result = Date.year\nelse:\n result = -1\nreturn result",... | <|body_start_0|>
day, month, year = str_date.split('.')
Date.day = int(day)
Date.month = int(month)
Date.year = int(year)
<|end_body_0|>
<|body_start_1|>
if scale.lower() == 'day':
result = Date.day
elif scale.lower() == 'month':
result = Date.mon... | Класс дата нашей эры (видимо ээто будет синглтон) | Date | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Date:
"""Класс дата нашей эры (видимо ээто будет синглтон)"""
def __init__(self, str_date):
"""делаем из строки числа и заводим свойства класа :param str_date: сторка с датой"""
<|body_0|>
def to_int(cls, scale):
"""перевод шкалы в int :param scale: шкала интовое... | stack_v2_sparse_classes_10k_train_002652 | 2,341 | no_license | [
{
"docstring": "делаем из строки числа и заводим свойства класа :param str_date: сторка с датой",
"name": "__init__",
"signature": "def __init__(self, str_date)"
},
{
"docstring": "перевод шкалы в int :param scale: шкала интовое значение которой хотим получить :return: щкала привденая в int",
... | 3 | stack_v2_sparse_classes_30k_train_002450 | Implement the Python class `Date` described below.
Class description:
Класс дата нашей эры (видимо ээто будет синглтон)
Method signatures and docstrings:
- def __init__(self, str_date): делаем из строки числа и заводим свойства класа :param str_date: сторка с датой
- def to_int(cls, scale): перевод шкалы в int :param... | Implement the Python class `Date` described below.
Class description:
Класс дата нашей эры (видимо ээто будет синглтон)
Method signatures and docstrings:
- def __init__(self, str_date): делаем из строки числа и заводим свойства класа :param str_date: сторка с датой
- def to_int(cls, scale): перевод шкалы в int :param... | 57c79f021606453de2c2626deb9ec48720927b36 | <|skeleton|>
class Date:
"""Класс дата нашей эры (видимо ээто будет синглтон)"""
def __init__(self, str_date):
"""делаем из строки числа и заводим свойства класа :param str_date: сторка с датой"""
<|body_0|>
def to_int(cls, scale):
"""перевод шкалы в int :param scale: шкала интовое... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Date:
"""Класс дата нашей эры (видимо ээто будет синглтон)"""
def __init__(self, str_date):
"""делаем из строки числа и заводим свойства класа :param str_date: сторка с датой"""
day, month, year = str_date.split('.')
Date.day = int(day)
Date.month = int(month)
Date... | the_stack_v2_python_sparse | lessons/lesson8/lesson8_1.py | Alexidis/python_basics | train | 0 |
44aa5ecc53b7637fb6b3caec17d746cc98e78562 | [
"left, right = (1, n)\nwhile left <= right:\n mid = (left + right) // 2\n if not isBadVersion(mid - 1) and isBadVersion(mid):\n return mid\n if isBadVersion(mid):\n right = mid - 1\n else:\n left = mid + 1",
"l = 1\nr = n\nwhile l < r:\n mid = (l + r) / 2\n if isBadVersion(m... | <|body_start_0|>
left, right = (1, n)
while left <= right:
mid = (left + right) // 2
if not isBadVersion(mid - 1) and isBadVersion(mid):
return mid
if isBadVersion(mid):
right = mid - 1
else:
left = mid + 1
<... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def firstBadVersion(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def firstBadVersion2(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
left, right = (1, n)
while left <= right:
... | stack_v2_sparse_classes_10k_train_002653 | 962 | no_license | [
{
"docstring": ":type n: int :rtype: int",
"name": "firstBadVersion",
"signature": "def firstBadVersion(self, n)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "firstBadVersion2",
"signature": "def firstBadVersion2(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002483 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def firstBadVersion(self, n): :type n: int :rtype: int
- def firstBadVersion2(self, n): :type n: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def firstBadVersion(self, n): :type n: int :rtype: int
- def firstBadVersion2(self, n): :type n: int :rtype: int
<|skeleton|>
class Solution:
def firstBadVersion(self, n):
... | 85128e7d26157b3c36eb43868269de42ea2fcb98 | <|skeleton|>
class Solution:
def firstBadVersion(self, n):
""":type n: int :rtype: int"""
<|body_0|>
def firstBadVersion2(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def firstBadVersion(self, n):
""":type n: int :rtype: int"""
left, right = (1, n)
while left <= right:
mid = (left + right) // 2
if not isBadVersion(mid - 1) and isBadVersion(mid):
return mid
if isBadVersion(mid):
... | the_stack_v2_python_sparse | src/First Bad Version.py | jsdiuf/leetcode | train | 1 | |
5b02f834f75e614edd7bc231d118adb268174d31 | [
"mocked_backend = FakeSuccessQasmSimulator(time_alive=0)\nqr = QuantumRegister(1)\ncr = ClassicalRegister(1)\nsucceed_circuit = QuantumCircuit(qr, cr)\nquantum_circuit = transpile(succeed_circuit, mocked_backend)\nqobj = assemble_circuits(quantum_circuit)\nresult = mocked_backend.run(qobj).result()\nself.is_complet... | <|body_start_0|>
mocked_backend = FakeSuccessQasmSimulator(time_alive=0)
qr = QuantumRegister(1)
cr = ClassicalRegister(1)
succeed_circuit = QuantumCircuit(qr, cr)
quantum_circuit = transpile(succeed_circuit, mocked_backend)
qobj = assemble_circuits(quantum_circuit)
... | QasmSimulator basic tests. | QasmBasicsTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QasmBasicsTests:
"""QasmSimulator basic tests."""
def test_simulation_succeed(self):
"""Test the we properly manage simulation failures."""
<|body_0|>
def test_simulation_failed(self):
"""Test the we properly manage simulation failures."""
<|body_1|>
<|e... | stack_v2_sparse_classes_10k_train_002654 | 1,551 | permissive | [
{
"docstring": "Test the we properly manage simulation failures.",
"name": "test_simulation_succeed",
"signature": "def test_simulation_succeed(self)"
},
{
"docstring": "Test the we properly manage simulation failures.",
"name": "test_simulation_failed",
"signature": "def test_simulation... | 2 | stack_v2_sparse_classes_30k_val_000314 | Implement the Python class `QasmBasicsTests` described below.
Class description:
QasmSimulator basic tests.
Method signatures and docstrings:
- def test_simulation_succeed(self): Test the we properly manage simulation failures.
- def test_simulation_failed(self): Test the we properly manage simulation failures. | Implement the Python class `QasmBasicsTests` described below.
Class description:
QasmSimulator basic tests.
Method signatures and docstrings:
- def test_simulation_succeed(self): Test the we properly manage simulation failures.
- def test_simulation_failed(self): Test the we properly manage simulation failures.
<|sk... | 0c1c805fd5dfce465a8955ee3faf81037023a23e | <|skeleton|>
class QasmBasicsTests:
"""QasmSimulator basic tests."""
def test_simulation_succeed(self):
"""Test the we properly manage simulation failures."""
<|body_0|>
def test_simulation_failed(self):
"""Test the we properly manage simulation failures."""
<|body_1|>
<|e... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class QasmBasicsTests:
"""QasmSimulator basic tests."""
def test_simulation_succeed(self):
"""Test the we properly manage simulation failures."""
mocked_backend = FakeSuccessQasmSimulator(time_alive=0)
qr = QuantumRegister(1)
cr = ClassicalRegister(1)
succeed_circuit = Q... | the_stack_v2_python_sparse | artifacts/old_dataset_versions/original_commits_v02/qiskit-aer/qiskit-aer#167/after/qasm_basics.py | MattePalte/Bugs-Quantum-Computing-Platforms | train | 4 |
4b612ccddcca123d374e51540159ac2215f18f3c | [
"group = Group.query.get(id)\nif not group:\n api.abort(code=404, message='Group not found')\nreturn {'data': group.__jsonapi__()}",
"group = Group.query.get(id)\nif not group:\n api.abort(code=404, message='Group not found')\ndata = request.get_json()['data']\nif 'name' in data['attributes']:\n group.na... | <|body_start_0|>
group = Group.query.get(id)
if not group:
api.abort(code=404, message='Group not found')
return {'data': group.__jsonapi__()}
<|end_body_0|>
<|body_start_1|>
group = Group.query.get(id)
if not group:
api.abort(code=404, message='Group not... | Groups | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Groups:
def get(self, id):
"""Get group"""
<|body_0|>
def put(self, id):
"""Update group"""
<|body_1|>
def delete(self, id):
"""Delete group"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
group = Group.query.get(id)
if ... | stack_v2_sparse_classes_10k_train_002655 | 46,738 | permissive | [
{
"docstring": "Get group",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstring": "Update group",
"name": "put",
"signature": "def put(self, id)"
},
{
"docstring": "Delete group",
"name": "delete",
"signature": "def delete(self, id)"
}
] | 3 | stack_v2_sparse_classes_30k_train_001928 | Implement the Python class `Groups` described below.
Class description:
Implement the Groups class.
Method signatures and docstrings:
- def get(self, id): Get group
- def put(self, id): Update group
- def delete(self, id): Delete group | Implement the Python class `Groups` described below.
Class description:
Implement the Groups class.
Method signatures and docstrings:
- def get(self, id): Get group
- def put(self, id): Update group
- def delete(self, id): Delete group
<|skeleton|>
class Groups:
def get(self, id):
"""Get group"""
... | 3439a2dd0bd527c5d604801fec3a5aac904a72e2 | <|skeleton|>
class Groups:
def get(self, id):
"""Get group"""
<|body_0|>
def put(self, id):
"""Update group"""
<|body_1|>
def delete(self, id):
"""Delete group"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Groups:
def get(self, id):
"""Get group"""
group = Group.query.get(id)
if not group:
api.abort(code=404, message='Group not found')
return {'data': group.__jsonapi__()}
def put(self, id):
"""Update group"""
group = Group.query.get(id)
if... | the_stack_v2_python_sparse | app/views.py | taidos/lxc-rest | train | 0 | |
711d3d0969e312c9f467c2458b9d17def42666e8 | [
"super(BottleNeck, self).__init__()\nself.inp_bn = inp_bn\nadd_block = []\nif droprate > 0:\n add_block += [nn.Dropout(p=droprate)]\nadd_block += [nn.Linear(input_dim, num_bottleneck)]\nadd_block += [nn.BatchNorm1D(num_bottleneck)]\nadd_block += [nn.LeakyReLU(0.1)]\nadd_block = nn.Sequential(*add_block)\nself.ad... | <|body_start_0|>
super(BottleNeck, self).__init__()
self.inp_bn = inp_bn
add_block = []
if droprate > 0:
add_block += [nn.Dropout(p=droprate)]
add_block += [nn.Linear(input_dim, num_bottleneck)]
add_block += [nn.BatchNorm1D(num_bottleneck)]
add_block +... | bottleneck | BottleNeck | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BottleNeck:
"""bottleneck"""
def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False):
"""init"""
<|body_0|>
def forward(self, x):
"""forward"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(BottleNeck, self).__init__()
... | stack_v2_sparse_classes_10k_train_002656 | 994 | permissive | [
{
"docstring": "init",
"name": "__init__",
"signature": "def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False)"
},
{
"docstring": "forward",
"name": "forward",
"signature": "def forward(self, x)"
}
] | 2 | null | Implement the Python class `BottleNeck` described below.
Class description:
bottleneck
Method signatures and docstrings:
- def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False): init
- def forward(self, x): forward | Implement the Python class `BottleNeck` described below.
Class description:
bottleneck
Method signatures and docstrings:
- def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False): init
- def forward(self, x): forward
<|skeleton|>
class BottleNeck:
"""bottleneck"""
def __init__(self, input_... | b8ec015fa9e16c0a879c619ee1f2aab8a393c7bd | <|skeleton|>
class BottleNeck:
"""bottleneck"""
def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False):
"""init"""
<|body_0|>
def forward(self, x):
"""forward"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BottleNeck:
"""bottleneck"""
def __init__(self, input_dim, num_bottleneck, droprate=0.5, inp_bn=False):
"""init"""
super(BottleNeck, self).__init__()
self.inp_bn = inp_bn
add_block = []
if droprate > 0:
add_block += [nn.Dropout(p=droprate)]
add_... | the_stack_v2_python_sparse | ST_DM/KDD2022-DuMapper/DME/arch/gears/neck.py | sserdoubleh/Research | train | 10 |
dfa4e8a3b835f727db2f547abb07baa15e14b723 | [
"result = {}\nfor into in inputs:\n for i in into:\n if i in self.sim.agents:\n agentTags = self.sim.agents[i].access['tags']\n if tag in agentTags:\n result[i] = agentTags[tag]\nreturn result",
"result = {}\nag = bpy.context.scene.objects[self.userid]\nfor into in i... | <|body_start_0|>
result = {}
for into in inputs:
for i in into:
if i in self.sim.agents:
agentTags = self.sim.agents[i].access['tags']
if tag in agentTags:
result[i] = agentTags[tag]
return result
<|end_b... | Used to get information about other agent in a scene | AgentInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AgentInfo:
"""Used to get information about other agent in a scene"""
def getTag(self, inputs, tag):
"""For each agent in the input look up their tag"""
<|body_0|>
def headingRz(self, inputs):
"""For each agent in the input look up the relative heading about the ... | stack_v2_sparse_classes_10k_train_002657 | 4,006 | no_license | [
{
"docstring": "For each agent in the input look up their tag",
"name": "getTag",
"signature": "def getTag(self, inputs, tag)"
},
{
"docstring": "For each agent in the input look up the relative heading about the z axis",
"name": "headingRz",
"signature": "def headingRz(self, inputs)"
... | 3 | stack_v2_sparse_classes_30k_train_004869 | Implement the Python class `AgentInfo` described below.
Class description:
Used to get information about other agent in a scene
Method signatures and docstrings:
- def getTag(self, inputs, tag): For each agent in the input look up their tag
- def headingRz(self, inputs): For each agent in the input look up the relati... | Implement the Python class `AgentInfo` described below.
Class description:
Used to get information about other agent in a scene
Method signatures and docstrings:
- def getTag(self, inputs, tag): For each agent in the input look up their tag
- def headingRz(self, inputs): For each agent in the input look up the relati... | 7b796d30dfd22b7706a93e4419ed913d18d29a44 | <|skeleton|>
class AgentInfo:
"""Used to get information about other agent in a scene"""
def getTag(self, inputs, tag):
"""For each agent in the input look up their tag"""
<|body_0|>
def headingRz(self, inputs):
"""For each agent in the input look up the relative heading about the ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AgentInfo:
"""Used to get information about other agent in a scene"""
def getTag(self, inputs, tag):
"""For each agent in the input look up their tag"""
result = {}
for into in inputs:
for i in into:
if i in self.sim.agents:
agentTag... | the_stack_v2_python_sparse | All_In_One/addons/CrowdMaster/cm_channels/cm_agentInfoChannels.py | 2434325680/Learnbgame | train | 0 |
503c72178d8d2931ae0e3700e7ee3a0b5478a821 | [
"result = {'result': 'NG'}\ndata = request.get_json(force=True)\nif data:\n succsee, message = CtrlQuotations().add_combination_by_quotation_id3(quotation_id, data)\n if succsee:\n result = {'result': 'OK', 'content': message}\n else:\n result['error'] = message\nelse:\n result['error'] = ... | <|body_start_0|>
result = {'result': 'NG'}
data = request.get_json(force=True)
if data:
succsee, message = CtrlQuotations().add_combination_by_quotation_id3(quotation_id, data)
if succsee:
result = {'result': 'OK', 'content': message}
else:
... | ApiOptionCombinationInfo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiOptionCombinationInfo:
def post(self, quotation_id):
"""更新/添加此报价下的Combination :return:"""
<|body_0|>
def get(self, quotation_id):
"""获取此报价下的所有Option :return:"""
<|body_1|>
def delete(self, op_id):
"""删除此条Option :return:"""
<|body_2|>
... | stack_v2_sparse_classes_10k_train_002658 | 10,406 | no_license | [
{
"docstring": "更新/添加此报价下的Combination :return:",
"name": "post",
"signature": "def post(self, quotation_id)"
},
{
"docstring": "获取此报价下的所有Option :return:",
"name": "get",
"signature": "def get(self, quotation_id)"
},
{
"docstring": "删除此条Option :return:",
"name": "delete",
... | 3 | null | Implement the Python class `ApiOptionCombinationInfo` described below.
Class description:
Implement the ApiOptionCombinationInfo class.
Method signatures and docstrings:
- def post(self, quotation_id): 更新/添加此报价下的Combination :return:
- def get(self, quotation_id): 获取此报价下的所有Option :return:
- def delete(self, op_id): 删除... | Implement the Python class `ApiOptionCombinationInfo` described below.
Class description:
Implement the ApiOptionCombinationInfo class.
Method signatures and docstrings:
- def post(self, quotation_id): 更新/添加此报价下的Combination :return:
- def get(self, quotation_id): 获取此报价下的所有Option :return:
- def delete(self, op_id): 删除... | 64b31e7bdfcb8a4c95f0a8a607f0bcff576cec11 | <|skeleton|>
class ApiOptionCombinationInfo:
def post(self, quotation_id):
"""更新/添加此报价下的Combination :return:"""
<|body_0|>
def get(self, quotation_id):
"""获取此报价下的所有Option :return:"""
<|body_1|>
def delete(self, op_id):
"""删除此条Option :return:"""
<|body_2|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ApiOptionCombinationInfo:
def post(self, quotation_id):
"""更新/添加此报价下的Combination :return:"""
result = {'result': 'NG'}
data = request.get_json(force=True)
if data:
succsee, message = CtrlQuotations().add_combination_by_quotation_id3(quotation_id, data)
i... | the_stack_v2_python_sparse | koala/koala_server/app/api_1_0/api_quotations.py | lsn1183/web_project | train | 0 | |
9a181d0b77fc0adbe92df149cbfd84bd2627d551 | [
"Module.__init__(self, **kwargs)\nPipelineMixin.__init__(self, pipeline)\nself._camera = camera\nself._telescope = telescope\nself._apply = get_object(apply, ApplyOffsets)\nif isinstance(camera, str):\n exc.register_exception(exc.RemoteError, 3, timespan=600, module=camera, callback=self._default_remote_error_ca... | <|body_start_0|>
Module.__init__(self, **kwargs)
PipelineMixin.__init__(self, pipeline)
self._camera = camera
self._telescope = telescope
self._apply = get_object(apply, ApplyOffsets)
if isinstance(camera, str):
exc.register_exception(exc.RemoteError, 3, times... | Base class for guiding and acquisition modules. | BasePointing | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasePointing:
"""Base class for guiding and acquisition modules."""
def __init__(self, camera: Union[str, ICamera], telescope: Union[str, ITelescope], pipeline: List[Union[Dict[str, Any], ImageProcessor]], apply: Union[Dict[str, Any], ApplyOffsets], **kwargs: Any):
"""Initializes a n... | stack_v2_sparse_classes_10k_train_002659 | 2,488 | permissive | [
{
"docstring": "Initializes a new base pointing. Args: telescope: Telescope to use. pipeline: Pipeline steps to run on new image. MUST include a step calculating offsets! apply: Object that handles applying offsets to telescope. log_file: Name of file to write log to. log_absolute: Log absolute offsets instead ... | 2 | null | Implement the Python class `BasePointing` described below.
Class description:
Base class for guiding and acquisition modules.
Method signatures and docstrings:
- def __init__(self, camera: Union[str, ICamera], telescope: Union[str, ITelescope], pipeline: List[Union[Dict[str, Any], ImageProcessor]], apply: Union[Dict[... | Implement the Python class `BasePointing` described below.
Class description:
Base class for guiding and acquisition modules.
Method signatures and docstrings:
- def __init__(self, camera: Union[str, ICamera], telescope: Union[str, ITelescope], pipeline: List[Union[Dict[str, Any], ImageProcessor]], apply: Union[Dict[... | 2d7a06e5485b61b6ca7e51d99b08651ea6021086 | <|skeleton|>
class BasePointing:
"""Base class for guiding and acquisition modules."""
def __init__(self, camera: Union[str, ICamera], telescope: Union[str, ITelescope], pipeline: List[Union[Dict[str, Any], ImageProcessor]], apply: Union[Dict[str, Any], ApplyOffsets], **kwargs: Any):
"""Initializes a n... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BasePointing:
"""Base class for guiding and acquisition modules."""
def __init__(self, camera: Union[str, ICamera], telescope: Union[str, ITelescope], pipeline: List[Union[Dict[str, Any], ImageProcessor]], apply: Union[Dict[str, Any], ApplyOffsets], **kwargs: Any):
"""Initializes a new base point... | the_stack_v2_python_sparse | pyobs/modules/pointing/_base.py | pyobs/pyobs-core | train | 9 |
ba26be49d413a32d17bce1f137cbe61aafc28959 | [
"if self.search(cr, uid, [('id', 'in', ids), ('state', '=', 'receive'), ('pay_type', 'in', ('chk', 'letter')), ('chk_seq', '=', False)], context=context):\n raise orm.except_orm(_('Warning !'), _('Kindly print your payment check or bank letter before delivery it.'))\nreturn super(account_voucher, self).action_mo... | <|body_start_0|>
if self.search(cr, uid, [('id', 'in', ids), ('state', '=', 'receive'), ('pay_type', 'in', ('chk', 'letter')), ('chk_seq', '=', False)], context=context):
raise orm.except_orm(_('Warning !'), _('Kindly print your payment check or bank letter before delivery it.'))
return supe... | account_voucher | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class account_voucher:
def action_move_line_create(self, cr, uid, ids, vals={}, context=None):
"""Inherit action_move_line_create method to prevent creating journal entries when pay_type check or bank letter and doesn't print yet @return: super action_move_line_create"""
<|body_0|>
... | stack_v2_sparse_classes_10k_train_002660 | 2,922 | no_license | [
{
"docstring": "Inherit action_move_line_create method to prevent creating journal entries when pay_type check or bank letter and doesn't print yet @return: super action_move_line_create",
"name": "action_move_line_create",
"signature": "def action_move_line_create(self, cr, uid, ids, vals={}, context=N... | 3 | null | Implement the Python class `account_voucher` described below.
Class description:
Implement the account_voucher class.
Method signatures and docstrings:
- def action_move_line_create(self, cr, uid, ids, vals={}, context=None): Inherit action_move_line_create method to prevent creating journal entries when pay_type che... | Implement the Python class `account_voucher` described below.
Class description:
Implement the account_voucher class.
Method signatures and docstrings:
- def action_move_line_create(self, cr, uid, ids, vals={}, context=None): Inherit action_move_line_create method to prevent creating journal entries when pay_type che... | 0b997095c260d58b026440967fea3a202bef7efb | <|skeleton|>
class account_voucher:
def action_move_line_create(self, cr, uid, ids, vals={}, context=None):
"""Inherit action_move_line_create method to prevent creating journal entries when pay_type check or bank letter and doesn't print yet @return: super action_move_line_create"""
<|body_0|>
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class account_voucher:
def action_move_line_create(self, cr, uid, ids, vals={}, context=None):
"""Inherit action_move_line_create method to prevent creating journal entries when pay_type check or bank letter and doesn't print yet @return: super action_move_line_create"""
if self.search(cr, uid, [('i... | the_stack_v2_python_sparse | v_7/Dongola/wafi/account_check_writing_wafi/account_voucher.py | musabahmed/baba | train | 0 | |
8812f47eb38f9700810240dff7a326fe915ee01e | [
"sheets = dict(((name, sheet) for name, sheet in kwds.items() if isinstance(sheet, cls.pyre_tabulator)))\nif len(sheets) > 1:\n import journal\n raise journal.firewall('pyre.tabular').log('charts need precisely one sheet')\nfor name in sheets:\n del kwds[name]\nattributes = super().__prepare__(name, bases,... | <|body_start_0|>
sheets = dict(((name, sheet) for name, sheet in kwds.items() if isinstance(sheet, cls.pyre_tabulator)))
if len(sheets) > 1:
import journal
raise journal.firewall('pyre.tabular').log('charts need precisely one sheet')
for name in sheets:
del kw... | Inspect charts and harvest their dimensions | Surveyor | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Surveyor:
"""Inspect charts and harvest their dimensions"""
def __prepare__(cls, name, bases, **kwds):
"""Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available as class attributes during the chart declaration. This mak... | stack_v2_sparse_classes_10k_train_002661 | 2,891 | permissive | [
{
"docstring": "Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available as class attributes during the chart declaration. This makes it possible to refer to sheets when setting up the chart dimensions",
"name": "__prepare__",
"signature": "... | 2 | null | Implement the Python class `Surveyor` described below.
Class description:
Inspect charts and harvest their dimensions
Method signatures and docstrings:
- def __prepare__(cls, name, bases, **kwds): Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available a... | Implement the Python class `Surveyor` described below.
Class description:
Inspect charts and harvest their dimensions
Method signatures and docstrings:
- def __prepare__(cls, name, bases, **kwds): Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available a... | d741c44ffb3e9e1f726bf492202ac8738bb4aa1c | <|skeleton|>
class Surveyor:
"""Inspect charts and harvest their dimensions"""
def __prepare__(cls, name, bases, **kwds):
"""Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available as class attributes during the chart declaration. This mak... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Surveyor:
"""Inspect charts and harvest their dimensions"""
def __prepare__(cls, name, bases, **kwds):
"""Prepare a container for the attributes of a chart by looking through {kwds} for sheet aliases and making them available as class attributes during the chart declaration. This makes it possibl... | the_stack_v2_python_sparse | packages/pyre/tabular/Surveyor.py | pyre/pyre | train | 27 |
0e9a9d838a1bd57c7cafcd15b2b9e9410df5458b | [
"super(AddKNgramModel, self).__init__(*args)\nself.k = k\nself.k_norm = len(self.ngram_counter.vocabulary) * k",
"context = self.check_context(context)\ncontext_freqdist = self.ngrams[context]\nword_count = context_freqdist[word]\ncontext_count = context_freqdist.N()\nreturn (word_count + self.k) / (context_count... | <|body_start_0|>
super(AddKNgramModel, self).__init__(*args)
self.k = k
self.k_norm = len(self.ngram_counter.vocabulary) * k
<|end_body_0|>
<|body_start_1|>
context = self.check_context(context)
context_freqdist = self.ngrams[context]
word_count = context_freqdist[word]
... | Provides Add-k-smoothed scores. | AddKNgramModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddKNgramModel:
"""Provides Add-k-smoothed scores."""
def __init__(self, k, *args):
"""Expects an input value, k, a number by which to increment word counts during scoring."""
<|body_0|>
def score(self, word, context):
"""With Add-k-smoothing, the score is normal... | stack_v2_sparse_classes_10k_train_002662 | 7,225 | permissive | [
{
"docstring": "Expects an input value, k, a number by which to increment word counts during scoring.",
"name": "__init__",
"signature": "def __init__(self, k, *args)"
},
{
"docstring": "With Add-k-smoothing, the score is normalized with a k value.",
"name": "score",
"signature": "def sc... | 2 | stack_v2_sparse_classes_30k_train_004684 | Implement the Python class `AddKNgramModel` described below.
Class description:
Provides Add-k-smoothed scores.
Method signatures and docstrings:
- def __init__(self, k, *args): Expects an input value, k, a number by which to increment word counts during scoring.
- def score(self, word, context): With Add-k-smoothing... | Implement the Python class `AddKNgramModel` described below.
Class description:
Provides Add-k-smoothed scores.
Method signatures and docstrings:
- def __init__(self, k, *args): Expects an input value, k, a number by which to increment word counts during scoring.
- def score(self, word, context): With Add-k-smoothing... | 43fd3317b641e0830905a734226afad3a0ea19f6 | <|skeleton|>
class AddKNgramModel:
"""Provides Add-k-smoothed scores."""
def __init__(self, k, *args):
"""Expects an input value, k, a number by which to increment word counts during scoring."""
<|body_0|>
def score(self, word, context):
"""With Add-k-smoothing, the score is normal... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AddKNgramModel:
"""Provides Add-k-smoothed scores."""
def __init__(self, k, *args):
"""Expects an input value, k, a number by which to increment word counts during scoring."""
super(AddKNgramModel, self).__init__(*args)
self.k = k
self.k_norm = len(self.ngram_counter.vocab... | the_stack_v2_python_sparse | snippets/ch07/model.py | foxbook/atap | train | 401 |
ca60386c219f28e2a6cc022b98731172f1ae6bc0 | [
"self.sum_matrix = [[0] * len(matrix[0]) for j in range(len(matrix))]\nself.matrix = matrix\nfor i in range(len(matrix)):\n summ = 0\n for j in range(len(matrix[0])):\n summ += matrix[i][j]\n self.sum_matrix[i][j] = summ",
"diff = val - self.matrix[row][col]\nself.matrix[row][col] = val\nfor i... | <|body_start_0|>
self.sum_matrix = [[0] * len(matrix[0]) for j in range(len(matrix))]
self.matrix = matrix
for i in range(len(matrix)):
summ = 0
for j in range(len(matrix[0])):
summ += matrix[i][j]
self.sum_matrix[i][j] = summ
<|end_body_0|... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rtype: void"""
<|body_1|>
def sumRegion(self, row1, col1, row2, col2):
""":typ... | stack_v2_sparse_classes_10k_train_002663 | 2,415 | no_license | [
{
"docstring": ":type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": ":type row: int :type col: int :type val: int :rtype: void",
"name": "update",
"signature": "def update(self, row, col, val)"
},
{
"docstring": ":type r... | 3 | null | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void
- def sumRegion(self, row... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): :type matrix: List[List[int]]
- def update(self, row, col, val): :type row: int :type col: int :type val: int :rtype: void
- def sumRegion(self, row... | 6e4894c2d80413b13dc247d1783afd709ad984c8 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
<|body_0|>
def update(self, row, col, val):
""":type row: int :type col: int :type val: int :rtype: void"""
<|body_1|>
def sumRegion(self, row1, col1, row2, col2):
""":typ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class NumMatrix:
def __init__(self, matrix):
""":type matrix: List[List[int]]"""
self.sum_matrix = [[0] * len(matrix[0]) for j in range(len(matrix))]
self.matrix = matrix
for i in range(len(matrix)):
summ = 0
for j in range(len(matrix[0])):
sum... | the_stack_v2_python_sparse | leet_code308.py | tejamupparaju/LeetCode_Python | train | 2 | |
34111399be25279218275ead78c5ab8a74d7af9c | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId()",
"from .entity import Entity\nfrom .entity import Entity\nfields: Dict[str, Callable[[Any], None]] = {'appCrashCount': lambda n: setattr(self, 'app_crash_count', n.g... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .entity import Entity
fields: Dict[str, Calla... | The user experience analytics application performance entity contains application performance by application version device id. | UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId:
"""The user experience analytics application performance entity contains application performance by application version device id."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienc... | stack_v2_sparse_classes_10k_train_002664 | 4,506 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId",
"name": "create_from_discriminator_value",
... | 3 | stack_v2_sparse_classes_30k_train_002446 | Implement the Python class `UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId` described below.
Class description:
The user experience analytics application performance entity contains application performance by application version device id.
Method signatures and docstrings:
- def create_from_discri... | Implement the Python class `UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId` described below.
Class description:
The user experience analytics application performance entity contains application performance by application version device id.
Method signatures and docstrings:
- def create_from_discri... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId:
"""The user experience analytics application performance entity contains application performance by application version device id."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienc... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserExperienceAnalyticsAppHealthAppPerformanceByAppVersionDeviceId:
"""The user experience analytics application performance entity contains application performance by application version device id."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> UserExperienceAnalyticsApp... | the_stack_v2_python_sparse | msgraph/generated/models/user_experience_analytics_app_health_app_performance_by_app_version_device_id.py | microsoftgraph/msgraph-sdk-python | train | 135 |
88c10e162d8c9e4f32954becb73f9742e39f2479 | [
"super(AdbShellSshConnectionBuilder, self).__init__(*args, **kwargs)\nself._serial_number = None\nreturn",
"if self._serial_number is None:\n if hasattr(self.parameters, 'serial_number'):\n self._serial_number = self.parameters.serial_number\nreturn self._serial_number",
"if self._connection is None:\... | <|body_start_0|>
super(AdbShellSshConnectionBuilder, self).__init__(*args, **kwargs)
self._serial_number = None
return
<|end_body_0|>
<|body_start_1|>
if self._serial_number is None:
if hasattr(self.parameters, 'serial_number'):
self._serial_number = self.par... | A class to build an adb-shell connection over ssh | AdbShellSshConnectionBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdbShellSshConnectionBuilder:
"""A class to build an adb-shell connection over ssh"""
def __init__(self, *args, **kwargs):
""":param: - `parameters`: An object with `hostname`, `username`, and `password` attributes"""
<|body_0|>
def serial_number(self):
"""A seri... | stack_v2_sparse_classes_10k_train_002665 | 10,538 | permissive | [
{
"docstring": ":param: - `parameters`: An object with `hostname`, `username`, and `password` attributes",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "A serial number for the USB connection",
"name": "serial_number",
"signature": "def serial_... | 3 | stack_v2_sparse_classes_30k_train_001733 | Implement the Python class `AdbShellSshConnectionBuilder` described below.
Class description:
A class to build an adb-shell connection over ssh
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): :param: - `parameters`: An object with `hostname`, `username`, and `password` attributes
- def serial... | Implement the Python class `AdbShellSshConnectionBuilder` described below.
Class description:
A class to build an adb-shell connection over ssh
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): :param: - `parameters`: An object with `hostname`, `username`, and `password` attributes
- def serial... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class AdbShellSshConnectionBuilder:
"""A class to build an adb-shell connection over ssh"""
def __init__(self, *args, **kwargs):
""":param: - `parameters`: An object with `hostname`, `username`, and `password` attributes"""
<|body_0|>
def serial_number(self):
"""A seri... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AdbShellSshConnectionBuilder:
"""A class to build an adb-shell connection over ssh"""
def __init__(self, *args, **kwargs):
""":param: - `parameters`: An object with `hostname`, `username`, and `password` attributes"""
super(AdbShellSshConnectionBuilder, self).__init__(*args, **kwargs)
... | the_stack_v2_python_sparse | apetools/builders/subbuilders/connectionbuilder.py | russell-n/oldape | train | 0 |
b65d05b115860dda9377cd9da396bf67eb5f016a | [
"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 transformer | Transformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transformer:
"""Class transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""ARGS: -N - the number of blocks in the encoder and decoder -dm - the dimensionality of the model -h - the number of heads -hidden - t... | stack_v2_sparse_classes_10k_train_002666 | 2,562 | no_license | [
{
"docstring": "ARGS: -N - the number of blocks in the encoder and decoder -dm - the dimensionality of the model -h - the number of heads -hidden - the number of hidden units in the fully connected layers -input_vocab - the size of the input vocabulary -target_vocab - the size of the target vocabulary -max_seq_... | 2 | stack_v2_sparse_classes_30k_train_001570 | Implement the Python class `Transformer` described below.
Class description:
Class transformer
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): ARGS: -N - the number of blocks in the encoder and decoder -dm - the dimensi... | Implement the Python class `Transformer` described below.
Class description:
Class transformer
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): ARGS: -N - the number of blocks in the encoder and decoder -dm - the dimensi... | 7dafc37d306fcf2ea0f5af5bd97dfd78d388100c | <|skeleton|>
class Transformer:
"""Class transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""ARGS: -N - the number of blocks in the encoder and decoder -dm - the dimensionality of the model -h - the number of heads -hidden - t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Transformer:
"""Class transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, target_vocab, max_seq_input, max_seq_target, drop_rate=0.1):
"""ARGS: -N - the number of blocks in the encoder and decoder -dm - the dimensionality of the model -h - the number of heads -hidden - the number of ... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/11-transformer.py | AndresSern/holbertonschool-machine_learning-1 | train | 0 |
657893acf92692cc4b3de5707d3ad983154575a9 | [
"super().__init__(game, pos)\nself.image = self.game.imageLoader.item_img['heart']\nself.rect = self.image.get_rect()\nself.rect.center = self.pos\nself.hit_rect = self.rect",
"self.player.hp += 1\nself.game.soundLoader.get['heart'].play()\nsuper().collect()"
] | <|body_start_0|>
super().__init__(game, pos)
self.image = self.game.imageLoader.item_img['heart']
self.rect = self.image.get_rect()
self.rect.center = self.pos
self.hit_rect = self.rect
<|end_body_0|>
<|body_start_1|>
self.player.hp += 1
self.game.soundLoader.get... | This class is derived from ItemDrop class and contains settings for a dropped heart item. | heart | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class heart:
"""This class is derived from ItemDrop class and contains settings for a dropped heart item."""
def __init__(self, game, pos):
"""__init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. pos (tuple length 2) : position of the player (x,y)."""
... | stack_v2_sparse_classes_10k_train_002667 | 7,384 | no_license | [
{
"docstring": "__init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. pos (tuple length 2) : position of the player (x,y).",
"name": "__init__",
"signature": "def __init__(self, game, pos)"
},
{
"docstring": "heart class method to update after heart is collect... | 2 | stack_v2_sparse_classes_30k_train_006500 | Implement the Python class `heart` described below.
Class description:
This class is derived from ItemDrop class and contains settings for a dropped heart item.
Method signatures and docstrings:
- def __init__(self, game, pos): __init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. ... | Implement the Python class `heart` described below.
Class description:
This class is derived from ItemDrop class and contains settings for a dropped heart item.
Method signatures and docstrings:
- def __init__(self, game, pos): __init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. ... | 74524cd52988c4c3f720150a418ff283a8d05683 | <|skeleton|>
class heart:
"""This class is derived from ItemDrop class and contains settings for a dropped heart item."""
def __init__(self, game, pos):
"""__init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. pos (tuple length 2) : position of the player (x,y)."""
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class heart:
"""This class is derived from ItemDrop class and contains settings for a dropped heart item."""
def __init__(self, game, pos):
"""__init__ method for heart class Args: game (Integrate.Game): Integrate.Game class object. pos (tuple length 2) : position of the player (x,y)."""
super(... | the_stack_v2_python_sparse | Item.py | ImpulseLimited/momentus-proto | train | 0 |
c20c6be83f59da5e5ef9e782dbb2811071cf77e0 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | The temperature service definition. | IndoorTemperaturePredictionServicer | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IndoorTemperaturePredictionServicer:
"""The temperature service definition."""
def GetSecondOrderPrediction(self, request, context):
"""A simple RPC. Predicts indoor temperatures."""
<|body_0|>
def GetSecondOrderError(self, request, context):
"""Get errors associ... | stack_v2_sparse_classes_10k_train_002668 | 2,633 | permissive | [
{
"docstring": "A simple RPC. Predicts indoor temperatures.",
"name": "GetSecondOrderPrediction",
"signature": "def GetSecondOrderPrediction(self, request, context)"
},
{
"docstring": "Get errors associated with prediction",
"name": "GetSecondOrderError",
"signature": "def GetSecondOrder... | 2 | stack_v2_sparse_classes_30k_train_003599 | Implement the Python class `IndoorTemperaturePredictionServicer` described below.
Class description:
The temperature service definition.
Method signatures and docstrings:
- def GetSecondOrderPrediction(self, request, context): A simple RPC. Predicts indoor temperatures.
- def GetSecondOrderError(self, request, contex... | Implement the Python class `IndoorTemperaturePredictionServicer` described below.
Class description:
The temperature service definition.
Method signatures and docstrings:
- def GetSecondOrderPrediction(self, request, context): A simple RPC. Predicts indoor temperatures.
- def GetSecondOrderError(self, request, contex... | 1604ae035a3bd81e87a4037326b7935d1f268452 | <|skeleton|>
class IndoorTemperaturePredictionServicer:
"""The temperature service definition."""
def GetSecondOrderPrediction(self, request, context):
"""A simple RPC. Predicts indoor temperatures."""
<|body_0|>
def GetSecondOrderError(self, request, context):
"""Get errors associ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class IndoorTemperaturePredictionServicer:
"""The temperature service definition."""
def GetSecondOrderPrediction(self, request, context):
"""A simple RPC. Predicts indoor temperatures."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | services/indoor_temperature_prediction/indoor_temperature_prediction_pb2_grpc.py | vishalbelsare/XBOS | train | 1 |
0240c7cde659d874e199cf82c07eb1b3f85ac2eb | [
"generic.printerr('some error')\nself.assertEqual(mocked_stderr.write.call_count, 1)\nself.assertEqual(mocked_stderr.flush.call_count, 1)",
"generic.printerr('some error')\nargs, _ = mocked_stderr.write.call_args\nmessage = args[0]\nself.assertTrue(message.endswith('\\n'))"
] | <|body_start_0|>
generic.printerr('some error')
self.assertEqual(mocked_stderr.write.call_count, 1)
self.assertEqual(mocked_stderr.flush.call_count, 1)
<|end_body_0|>
<|body_start_1|>
generic.printerr('some error')
args, _ = mocked_stderr.write.call_args
message = args[0... | A suite of test cases for the iiqtools.utils.generic module | TestGenericUtils | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestGenericUtils:
"""A suite of test cases for the iiqtools.utils.generic module"""
def test_printerr_happy_path(self, mocked_stderr):
"""printerr writes to stderr"""
<|body_0|>
def test_printerr_newline(self, mocked_stderr):
"""printerr appends a newline charact... | stack_v2_sparse_classes_10k_train_002669 | 2,169 | permissive | [
{
"docstring": "printerr writes to stderr",
"name": "test_printerr_happy_path",
"signature": "def test_printerr_happy_path(self, mocked_stderr)"
},
{
"docstring": "printerr appends a newline character automatically",
"name": "test_printerr_newline",
"signature": "def test_printerr_newlin... | 2 | stack_v2_sparse_classes_30k_train_001324 | Implement the Python class `TestGenericUtils` described below.
Class description:
A suite of test cases for the iiqtools.utils.generic module
Method signatures and docstrings:
- def test_printerr_happy_path(self, mocked_stderr): printerr writes to stderr
- def test_printerr_newline(self, mocked_stderr): printerr appe... | Implement the Python class `TestGenericUtils` described below.
Class description:
A suite of test cases for the iiqtools.utils.generic module
Method signatures and docstrings:
- def test_printerr_happy_path(self, mocked_stderr): printerr writes to stderr
- def test_printerr_newline(self, mocked_stderr): printerr appe... | a44a8ee9a299c7711b3abd69d21c24f55f2ae84e | <|skeleton|>
class TestGenericUtils:
"""A suite of test cases for the iiqtools.utils.generic module"""
def test_printerr_happy_path(self, mocked_stderr):
"""printerr writes to stderr"""
<|body_0|>
def test_printerr_newline(self, mocked_stderr):
"""printerr appends a newline charact... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class TestGenericUtils:
"""A suite of test cases for the iiqtools.utils.generic module"""
def test_printerr_happy_path(self, mocked_stderr):
"""printerr writes to stderr"""
generic.printerr('some error')
self.assertEqual(mocked_stderr.write.call_count, 1)
self.assertEqual(mocked... | the_stack_v2_python_sparse | iiqtools_tests/utils/test_generic.py | willnx/iiqtools | train | 5 |
489bd58459c31c1a923e4a6ded9e9938ee9178c0 | [
"super().__init__(vim)\nself.name = 'options'\nself.kind = 'word'\nself.syntax_name = 'deniteSource_options'\nself.vars = {'data_dir': vim.vars.get('tcd#data_dir', '~/.cache/tcd')}",
"context['data_file'] = expand(self.vars['data_dir'] + '/options.json')\nif not exists(context['data_file']):\n error(self.vim, ... | <|body_start_0|>
super().__init__(vim)
self.name = 'options'
self.kind = 'word'
self.syntax_name = 'deniteSource_options'
self.vars = {'data_dir': vim.vars.get('tcd#data_dir', '~/.cache/tcd')}
<|end_body_0|>
<|body_start_1|>
context['data_file'] = expand(self.vars['data_... | Describe the purpose of our source. | Source | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Source:
"""Describe the purpose of our source."""
def __init__(self, vim):
"""Initialize thyself."""
<|body_0|>
def on_init(self, context):
"""Parse, gather, or set variables, settings, etc."""
<|body_1|>
def gather_candidates(self, context):
... | stack_v2_sparse_classes_10k_train_002670 | 5,532 | no_license | [
{
"docstring": "Initialize thyself.",
"name": "__init__",
"signature": "def __init__(self, vim)"
},
{
"docstring": "Parse, gather, or set variables, settings, etc.",
"name": "on_init",
"signature": "def on_init(self, context)"
},
{
"docstring": "Fill a list with the candidates an... | 5 | stack_v2_sparse_classes_30k_test_000092 | Implement the Python class `Source` described below.
Class description:
Describe the purpose of our source.
Method signatures and docstrings:
- def __init__(self, vim): Initialize thyself.
- def on_init(self, context): Parse, gather, or set variables, settings, etc.
- def gather_candidates(self, context): Fill a list... | Implement the Python class `Source` described below.
Class description:
Describe the purpose of our source.
Method signatures and docstrings:
- def __init__(self, vim): Initialize thyself.
- def on_init(self, context): Parse, gather, or set variables, settings, etc.
- def gather_candidates(self, context): Fill a list... | 61fc2d853222069dc4948632c30297d97ee77a9d | <|skeleton|>
class Source:
"""Describe the purpose of our source."""
def __init__(self, vim):
"""Initialize thyself."""
<|body_0|>
def on_init(self, context):
"""Parse, gather, or set variables, settings, etc."""
<|body_1|>
def gather_candidates(self, context):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Source:
"""Describe the purpose of our source."""
def __init__(self, vim):
"""Initialize thyself."""
super().__init__(vim)
self.name = 'options'
self.kind = 'word'
self.syntax_name = 'deniteSource_options'
self.vars = {'data_dir': vim.vars.get('tcd#data_dir... | the_stack_v2_python_sparse | rplugin/python3/denite/source/options.py | dunstontc/tcd | train | 0 |
14c4bc9375274d83f0d9cdd9799505ba24934674 | [
"assert isinstance(output_size, (int, tuple))\nassert isinstance(return_tensor, bool)\nassert isinstance(channel_first, bool)\nself.output_size = output_size\nself.return_tensor = return_tensor\nself.channel_first = channel_first\nself.rescale_transform = BatchResize(output_size=self.output_size, return_tensor=self... | <|body_start_0|>
assert isinstance(output_size, (int, tuple))
assert isinstance(return_tensor, bool)
assert isinstance(channel_first, bool)
self.output_size = output_size
self.return_tensor = return_tensor
self.channel_first = channel_first
self.rescale_transform ... | Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation. | BatchResizeNormalize | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BatchResizeNormalize:
"""Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation."""
def __init__(self, output_size, return_tensor=True, channel_first=True):
"""Instantiates a new BatchResizeNormalize object. Parameters ---... | stack_v2_sparse_classes_10k_train_002671 | 14,169 | no_license | [
{
"docstring": "Instantiates a new BatchResizeNormalize object. Parameters ---------- output_size : int or tuple The output size of the image (height and width). If an integer is passed as input, then the output size of the image is determined by scaling the height and width of the original image. return_tensor... | 2 | stack_v2_sparse_classes_30k_train_001920 | Implement the Python class `BatchResizeNormalize` described below.
Class description:
Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation.
Method signatures and docstrings:
- def __init__(self, output_size, return_tensor=True, channel_first=True): Insta... | Implement the Python class `BatchResizeNormalize` described below.
Class description:
Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation.
Method signatures and docstrings:
- def __init__(self, output_size, return_tensor=True, channel_first=True): Insta... | a7c30481822ecb945e3ff6ad184d104361a40ed1 | <|skeleton|>
class BatchResizeNormalize:
"""Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation."""
def __init__(self, output_size, return_tensor=True, channel_first=True):
"""Instantiates a new BatchResizeNormalize object. Parameters ---... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BatchResizeNormalize:
"""Resizes and normalizes the color channels, for a collection of images, to have zero mean and unit standard deviation."""
def __init__(self, output_size, return_tensor=True, channel_first=True):
"""Instantiates a new BatchResizeNormalize object. Parameters ---------- outpu... | the_stack_v2_python_sparse | cheapfake/contrib/transforms.py | hu-simon/cheapfake | train | 0 |
837865c2e0b9c7e69d141b4a30ee76ca7ebf023d | [
"self.total_records = total_records\nself.total_pages = total_pages\nself.page_number = page_number\nself.number_of_records_per_page = number_of_records_per_page\nself.applications = applications\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\ntotal_records = dictio... | <|body_start_0|>
self.total_records = total_records
self.total_pages = total_pages
self.page_number = page_number
self.number_of_records_per_page = number_of_records_per_page
self.applications = applications
self.additional_properties = additional_properties
<|end_body_0|... | Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attributes: total_records (long|int): Total number of applications in query total_page... | AppStatuses | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AppStatuses:
"""Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attributes: total_records (long|int): Total num... | stack_v2_sparse_classes_10k_train_002672 | 3,503 | permissive | [
{
"docstring": "Constructor for the AppStatuses class",
"name": "__init__",
"signature": "def __init__(self, total_records=None, total_pages=None, page_number=None, number_of_records_per_page=None, applications=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model... | 2 | stack_v2_sparse_classes_30k_train_003330 | Implement the Python class `AppStatuses` described below.
Class description:
Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attribut... | Implement the Python class `AppStatuses` described below.
Class description:
Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attribut... | b2ab1ded435db75c78d42261f5e4acd2a3061487 | <|skeleton|>
class AppStatuses:
"""Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attributes: total_records (long|int): Total num... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AppStatuses:
"""Implementation of the 'App Statuses' model. The response for the Get App Registration Status endpoint which returns an array of App Status objects to be able to determine their registration status. This is version 2 of this response. Attributes: total_records (long|int): Total number of applic... | the_stack_v2_python_sparse | finicityapi/models/app_statuses.py | monarchmoney/finicity-python | train | 0 |
944d8ac6e854cc311959fd3e513e9bc8932e7ce9 | [
"response = self.client.get(reverse('blog_post_list'))\nself.assertEqual(response.status_code, 200)\nresponse = self.client.get(reverse('blog_post_feed', args=('rss',)))\nself.assertEqual(response.status_code, 200)\nresponse = self.client.get(reverse('blog_post_feed', args=('atom',)))\nself.assertEqual(response.sta... | <|body_start_0|>
response = self.client.get(reverse('blog_post_list'))
self.assertEqual(response.status_code, 200)
response = self.client.get(reverse('blog_post_feed', args=('rss',)))
self.assertEqual(response.status_code, 200)
response = self.client.get(reverse('blog_post_feed',... | BlogTests | [
"BSD-2-Clause",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlogTests:
def test_blog_views(self):
"""Basic status code test for blog views."""
<|body_0|>
def test_login_protected_blog(self):
"""Test the blog is login protected if its page has login_required set to True."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_10k_train_002673 | 2,048 | permissive | [
{
"docstring": "Basic status code test for blog views.",
"name": "test_blog_views",
"signature": "def test_blog_views(self)"
},
{
"docstring": "Test the blog is login protected if its page has login_required set to True.",
"name": "test_login_protected_blog",
"signature": "def test_login... | 2 | stack_v2_sparse_classes_30k_train_000351 | Implement the Python class `BlogTests` described below.
Class description:
Implement the BlogTests class.
Method signatures and docstrings:
- def test_blog_views(self): Basic status code test for blog views.
- def test_login_protected_blog(self): Test the blog is login protected if its page has login_required set to ... | Implement the Python class `BlogTests` described below.
Class description:
Implement the BlogTests class.
Method signatures and docstrings:
- def test_blog_views(self): Basic status code test for blog views.
- def test_login_protected_blog(self): Test the blog is login protected if its page has login_required set to ... | 66b5a1089ed0ce2e615f889f35b5e39db91950ae | <|skeleton|>
class BlogTests:
def test_blog_views(self):
"""Basic status code test for blog views."""
<|body_0|>
def test_login_protected_blog(self):
"""Test the blog is login protected if its page has login_required set to True."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BlogTests:
def test_blog_views(self):
"""Basic status code test for blog views."""
response = self.client.get(reverse('blog_post_list'))
self.assertEqual(response.status_code, 200)
response = self.client.get(reverse('blog_post_feed', args=('rss',)))
self.assertEqual(res... | the_stack_v2_python_sparse | mezzanine/blog/tests.py | yasakawa/mezzanine | train | 4 | |
37c585c0ed5e4ce24230ca74ecffef3c117ab1f2 | [
"requires = field.requires\nif not hasattr(requires, 'options'):\n return TAG['input'](self.label(), **attr)\nitems = [self.label(), self.hint()] + self.items(requires.options())\nreturn TAG['select1'](items, **attr)",
"items = []\nsetstr = self.setstr\ngetstr = self.getstr\nfor index, option in enumerate(opti... | <|body_start_0|>
requires = field.requires
if not hasattr(requires, 'options'):
return TAG['input'](self.label(), **attr)
items = [self.label(), self.hint()] + self.items(requires.options())
return TAG['select1'](items, **attr)
<|end_body_0|>
<|body_start_1|>
items =... | Options Widget for XForms | S3XFormsOptionsWidget | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class S3XFormsOptionsWidget:
"""Options Widget for XForms"""
def widget(self, field, attr):
"""Widget renderer (parameter description see base class)"""
<|body_0|>
def items(self, options):
"""Render the items for the selector Args: options: the options, list of tuples... | stack_v2_sparse_classes_10k_train_002674 | 29,818 | permissive | [
{
"docstring": "Widget renderer (parameter description see base class)",
"name": "widget",
"signature": "def widget(self, field, attr)"
},
{
"docstring": "Render the items for the selector Args: options: the options, list of tuples (value, text)",
"name": "items",
"signature": "def items... | 2 | null | Implement the Python class `S3XFormsOptionsWidget` described below.
Class description:
Options Widget for XForms
Method signatures and docstrings:
- def widget(self, field, attr): Widget renderer (parameter description see base class)
- def items(self, options): Render the items for the selector Args: options: the op... | Implement the Python class `S3XFormsOptionsWidget` described below.
Class description:
Options Widget for XForms
Method signatures and docstrings:
- def widget(self, field, attr): Widget renderer (parameter description see base class)
- def items(self, options): Render the items for the selector Args: options: the op... | 7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6 | <|skeleton|>
class S3XFormsOptionsWidget:
"""Options Widget for XForms"""
def widget(self, field, attr):
"""Widget renderer (parameter description see base class)"""
<|body_0|>
def items(self, options):
"""Render the items for the selector Args: options: the options, list of tuples... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class S3XFormsOptionsWidget:
"""Options Widget for XForms"""
def widget(self, field, attr):
"""Widget renderer (parameter description see base class)"""
requires = field.requires
if not hasattr(requires, 'options'):
return TAG['input'](self.label(), **attr)
items = [... | the_stack_v2_python_sparse | modules/core/methods/xforms.py | nursix/drkcm | train | 3 |
2e75f3f70ab13799d3b163d4f2873035a0de5839 | [
"Container.__init__(self, name, padding=5)\nself.callback = callback\nol = OptionList('option_list', option_list, width, lineheight)\nself.sub(ol)\nbutton = Button('OK', pygame.Rect((0, 0), (width, lineheight)), self.selection_made)\nself.sub(button)\nreturn",
"self.callback(self.option_list.selected)\nself.destr... | <|body_start_0|>
Container.__init__(self, name, padding=5)
self.callback = callback
ol = OptionList('option_list', option_list, width, lineheight)
self.sub(ol)
button = Button('OK', pygame.Rect((0, 0), (width, lineheight)), self.selection_made)
self.sub(button)
re... | An OptionSelector wraps an OptionList and an OK button, calling a callback when a selection is confirmed. | OptionSelector | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OptionSelector:
"""An OptionSelector wraps an OptionList and an OK button, calling a callback when a selection is confirmed."""
def __init__(self, name, option_list, callback, width=200, lineheight=30):
"""Initialise the OptionList. option_list is a list of strings to be displayed as... | stack_v2_sparse_classes_10k_train_002675 | 27,668 | permissive | [
{
"docstring": "Initialise the OptionList. option_list is a list of strings to be displayed as options. callback is a function to be called with the selected Option instance as argument once the selection is made.",
"name": "__init__",
"signature": "def __init__(self, name, option_list, callback, width=... | 2 | stack_v2_sparse_classes_30k_train_006944 | Implement the Python class `OptionSelector` described below.
Class description:
An OptionSelector wraps an OptionList and an OK button, calling a callback when a selection is confirmed.
Method signatures and docstrings:
- def __init__(self, name, option_list, callback, width=200, lineheight=30): Initialise the Option... | Implement the Python class `OptionSelector` described below.
Class description:
An OptionSelector wraps an OptionList and an OK button, calling a callback when a selection is confirmed.
Method signatures and docstrings:
- def __init__(self, name, option_list, callback, width=200, lineheight=30): Initialise the Option... | c2fc3d4e9beedb8487cfa4bfa13bdf55ec36af97 | <|skeleton|>
class OptionSelector:
"""An OptionSelector wraps an OptionList and an OK button, calling a callback when a selection is confirmed."""
def __init__(self, name, option_list, callback, width=200, lineheight=30):
"""Initialise the OptionList. option_list is a list of strings to be displayed as... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class OptionSelector:
"""An OptionSelector wraps an OptionList and an OK button, calling a callback when a selection is confirmed."""
def __init__(self, name, option_list, callback, width=200, lineheight=30):
"""Initialise the OptionList. option_list is a list of strings to be displayed as options. cal... | the_stack_v2_python_sparse | reference_scripts/clickndrag-0.4.1/clickndrag/gui.py | stivosaurus/rpi-snippets | train | 1 |
d17c80544fcdf8b0e2b46de91c4396d462210da9 | [
"pre, curr = (None, root)\nin_order = []\nwhile curr:\n if not curr.left:\n in_order.append(curr.val)\n curr = curr.right\n else:\n pre = curr.left\n while pre.right:\n pre = pre.right\n pre.right = curr\n temp = curr\n curr = curr.left\n temp... | <|body_start_0|>
pre, curr = (None, root)
in_order = []
while curr:
if not curr.left:
in_order.append(curr.val)
curr = curr.right
else:
pre = curr.left
while pre.right:
pre = pre.right
... | BinaryTree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinaryTree:
def in_order_traversal_(self, root: 'TreeNode'):
"""Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return:"""
<|body_0|>
def in_order_traversal(self, root: 'TreeNode'):
"""Approach: Using stack Time Complexity: O(N) ... | stack_v2_sparse_classes_10k_train_002676 | 1,689 | no_license | [
{
"docstring": "Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return:",
"name": "in_order_traversal_",
"signature": "def in_order_traversal_(self, root: 'TreeNode')"
},
{
"docstring": "Approach: Using stack Time Complexity: O(N) Space Complexity: O(N) :par... | 2 | stack_v2_sparse_classes_30k_train_004531 | Implement the Python class `BinaryTree` described below.
Class description:
Implement the BinaryTree class.
Method signatures and docstrings:
- def in_order_traversal_(self, root: 'TreeNode'): Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return:
- def in_order_traversal(self, ... | Implement the Python class `BinaryTree` described below.
Class description:
Implement the BinaryTree class.
Method signatures and docstrings:
- def in_order_traversal_(self, root: 'TreeNode'): Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return:
- def in_order_traversal(self, ... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class BinaryTree:
def in_order_traversal_(self, root: 'TreeNode'):
"""Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return:"""
<|body_0|>
def in_order_traversal(self, root: 'TreeNode'):
"""Approach: Using stack Time Complexity: O(N) ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class BinaryTree:
def in_order_traversal_(self, root: 'TreeNode'):
"""Approach: Morris Traversal Time Complexity: O(N) Space Complexity: O(N) :param root: :return:"""
pre, curr = (None, root)
in_order = []
while curr:
if not curr.left:
in_order.append(curr... | the_stack_v2_python_sparse | revisited/trees/inorder_traversal.py | Shiv2157k/leet_code | train | 1 | |
f06cb35527d7a7276caeb09b9a543b2c3e54f776 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | RVizServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RVizServicer:
"""Missing associated documentation comment in .proto file."""
def run_code(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def create_instance(self, request, context):
"""Missing associated documen... | stack_v2_sparse_classes_10k_train_002677 | 3,787 | permissive | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "run_code",
"signature": "def run_code(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "create_instance",
"signature": "def create_instance(se... | 2 | stack_v2_sparse_classes_30k_train_003594 | Implement the Python class `RVizServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def run_code(self, request, context): Missing associated documentation comment in .proto file.
- def create_instance(self, request, context): Missi... | Implement the Python class `RVizServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def run_code(self, request, context): Missing associated documentation comment in .proto file.
- def create_instance(self, request, context): Missi... | 03c9e59779a30e2f6dedf2732ad8a46e6ac3c9f0 | <|skeleton|>
class RVizServicer:
"""Missing associated documentation comment in .proto file."""
def run_code(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def create_instance(self, request, context):
"""Missing associated documen... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RVizServicer:
"""Missing associated documentation comment in .proto file."""
def run_code(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
... | the_stack_v2_python_sparse | visualization/panda/rpc/rviz_pb2_grpc.py | kazuki0824/wrs | train | 1 |
0210827486969a7cc3b2265141370854334e5f7b | [
"if not nums:\n return 0\ndp = [1] * len(nums)\nfor i in range(len(nums)):\n for j in range(i):\n if nums[i] > nums[j]:\n dp[i] = max(dp[i], dp[j] + 1)\nreturn max(dp)",
"size = len(nums)\nif size < 2:\n return size\ntail = [nums[0]]\nfor i in range(1, size):\n if nums[i] > tail[-1]:... | <|body_start_0|>
if not nums:
return 0
dp = [1] * len(nums)
for i in range(len(nums)):
for j in range(i):
if nums[i] > nums[j]:
dp[i] = max(dp[i], dp[j] + 1)
return max(dp)
<|end_body_0|>
<|body_start_1|>
size = len(num... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLIS1(self, nums: List[int]) -> int:
"""思路:动态规划法 1. 判断每个点构成的最大长度时,判断前面比自己小的元素构成的最大长度 2. 当前状态由前面状态决定,容易想到动态规划法"""
<|body_0|>
def lengthOfLIS2(self, nums: List[int]) -> int:
"""思路:二分 时间复杂度:O(NlogN)"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_10k_train_002678 | 2,864 | no_license | [
{
"docstring": "思路:动态规划法 1. 判断每个点构成的最大长度时,判断前面比自己小的元素构成的最大长度 2. 当前状态由前面状态决定,容易想到动态规划法",
"name": "lengthOfLIS1",
"signature": "def lengthOfLIS1(self, nums: List[int]) -> int"
},
{
"docstring": "思路:二分 时间复杂度:O(NlogN)",
"name": "lengthOfLIS2",
"signature": "def lengthOfLIS2(self, nums: List[... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS1(self, nums: List[int]) -> int: 思路:动态规划法 1. 判断每个点构成的最大长度时,判断前面比自己小的元素构成的最大长度 2. 当前状态由前面状态决定,容易想到动态规划法
- def lengthOfLIS2(self, nums: List[int]) -> int: 思路:二分 时间复杂... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLIS1(self, nums: List[int]) -> int: 思路:动态规划法 1. 判断每个点构成的最大长度时,判断前面比自己小的元素构成的最大长度 2. 当前状态由前面状态决定,容易想到动态规划法
- def lengthOfLIS2(self, nums: List[int]) -> int: 思路:二分 时间复杂... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def lengthOfLIS1(self, nums: List[int]) -> int:
"""思路:动态规划法 1. 判断每个点构成的最大长度时,判断前面比自己小的元素构成的最大长度 2. 当前状态由前面状态决定,容易想到动态规划法"""
<|body_0|>
def lengthOfLIS2(self, nums: List[int]) -> int:
"""思路:二分 时间复杂度:O(NlogN)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLIS1(self, nums: List[int]) -> int:
"""思路:动态规划法 1. 判断每个点构成的最大长度时,判断前面比自己小的元素构成的最大长度 2. 当前状态由前面状态决定,容易想到动态规划法"""
if not nums:
return 0
dp = [1] * len(nums)
for i in range(len(nums)):
for j in range(i):
if nums[i] > nu... | the_stack_v2_python_sparse | LeetCode/动态规划法(dp)/300. Longest Increasing Subsequence.py | yiming1012/MyLeetCode | train | 2 | |
206824568a0a155303ffc99e08954bbd0f041f68 | [
"y = np.array(y)\nif len(y.shape) == 2 and y.shape[1] > 1:\n self.classes_ = np.arange(y.shape[1])\nelif len(y.shape) == 2 and y.shape[1] == 1 or len(y.shape) == 1:\n self.classes_ = np.unique(y)\n y = np.searchsorted(self.classes_, y)\nelse:\n raise ValueError('Invalid shape for y: ' + str(y.shape))\ns... | <|body_start_0|>
y = np.array(y)
if len(y.shape) == 2 and y.shape[1] > 1:
self.classes_ = np.arange(y.shape[1])
elif len(y.shape) == 2 and y.shape[1] == 1 or len(y.shape) == 1:
self.classes_ = np.unique(y)
y = np.searchsorted(self.classes_, y)
else:
... | Implementation of the scikit-learn classifier API for Keras. | KerasClassifier | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KerasClassifier:
"""Implementation of the scikit-learn classifier API for Keras."""
def fit(self, x, y, **kwargs):
"""Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samples, n_features)` Training samples where n_samples in the... | stack_v2_sparse_classes_10k_train_002679 | 12,728 | permissive | [
{
"docstring": "Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samples, n_features)` Training samples where n_samples in the number of samples and n_features is the number of features. y : array-like, shape `(n_samples,)` or `(n_samples, n_outputs)` True... | 4 | stack_v2_sparse_classes_30k_train_005068 | Implement the Python class `KerasClassifier` described below.
Class description:
Implementation of the scikit-learn classifier API for Keras.
Method signatures and docstrings:
- def fit(self, x, y, **kwargs): Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samp... | Implement the Python class `KerasClassifier` described below.
Class description:
Implementation of the scikit-learn classifier API for Keras.
Method signatures and docstrings:
- def fit(self, x, y, **kwargs): Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samp... | cabf6e4f1970dc14302f87414f170de19944bac2 | <|skeleton|>
class KerasClassifier:
"""Implementation of the scikit-learn classifier API for Keras."""
def fit(self, x, y, **kwargs):
"""Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samples, n_features)` Training samples where n_samples in the... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KerasClassifier:
"""Implementation of the scikit-learn classifier API for Keras."""
def fit(self, x, y, **kwargs):
"""Constructs a new model with `build_fn` & fit the model to `(x, y)`. Arguments: x : array-like, shape `(n_samples, n_features)` Training samples where n_samples in the number of sa... | the_stack_v2_python_sparse | Tensorflow_Pandas_Numpy/source3.6/tensorflow/python/keras/_impl/keras/wrappers/scikit_learn.py | ryfeus/lambda-packs | train | 1,283 |
2961fdc7a2391ad590457dfa8068c0f763d96bec | [
"if gain_factor != 1 and gain_factor != 2:\n raise ValueError('DAC __init__: Invalid gain factor. Must be 1 or 2')\nelse:\n self.gain = gain_factor\n self.maxdacvoltage = self.__dacMaxOutput__[self.gain]",
"if channel > 2 or channel < 1:\n raise ValueError('read_adc_voltage... | <|body_start_0|>
if gain_factor != 1 and gain_factor != 2:
raise ValueError('DAC __init__: Invalid gain factor. Must be 1 or 2')
else:
self.gain = gain_factor
self.maxdacvoltage = self.__dacMaxOutput__[self.gain]
<|end_body_0|>
<|body_star... | Based on the Microchip MCP3202 and MCP4822 | ADCDACPi | [
"Apache-2.0",
"GPL-2.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ADCDACPi:
"""Based on the Microchip MCP3202 and MCP4822"""
def __init__(self, gain_factor=1):
"""Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G ... | stack_v2_sparse_classes_10k_train_002680 | 5,074 | permissive | [
{
"docstring": "Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G is gain factor, Vref (for this chip) is 2.048 and D is the 12-bit digital value",
"name": "__init__",
... | 6 | stack_v2_sparse_classes_30k_train_002530 | Implement the Python class `ADCDACPi` described below.
Class description:
Based on the Microchip MCP3202 and MCP4822
Method signatures and docstrings:
- def __init__(self, gain_factor=1): Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output vo... | Implement the Python class `ADCDACPi` described below.
Class description:
Based on the Microchip MCP3202 and MCP4822
Method signatures and docstrings:
- def __init__(self, gain_factor=1): Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output vo... | 2529ca149d7f584ede780de1cb695a2f55b7031f | <|skeleton|>
class ADCDACPi:
"""Based on the Microchip MCP3202 and MCP4822"""
def __init__(self, gain_factor=1):
"""Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G ... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ADCDACPi:
"""Based on the Microchip MCP3202 and MCP4822"""
def __init__(self, gain_factor=1):
"""Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G is gain facto... | the_stack_v2_python_sparse | reinvent-2020/RhythmCloud/lib/ABElectronics_Python_Libraries/ADCDACPi/ADCDACPi.py | aws-samples/aws-builders-fair-projects | train | 89 |
c5f92d9a9aadea98e16f229fc545e6c3e53515eb | [
"self.description = description\nself.group_info = group_info\nself.name = name\nself.primary_s_m_t_p_address = primary_s_m_t_p_address\nself.proxy_host_source_id_list = proxy_host_source_id_list\nself.site_info = site_info\nself.team_info = team_info\nself.mtype = mtype\nself.user_info = user_info\nself.uuid = uui... | <|body_start_0|>
self.description = description
self.group_info = group_info
self.name = name
self.primary_s_m_t_p_address = primary_s_m_t_p_address
self.proxy_host_source_id_list = proxy_host_source_id_list
self.site_info = site_info
self.team_info = team_info
... | Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupInfo): Specifies the information about Office365 group. name (string): Specifies the name of t... | Office365ProtectionSource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Office365ProtectionSource:
"""Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupInfo): Specifies the information about Of... | stack_v2_sparse_classes_10k_train_002681 | 5,284 | permissive | [
{
"docstring": "Constructor for the Office365ProtectionSource class",
"name": "__init__",
"signature": "def __init__(self, description=None, group_info=None, name=None, primary_s_m_t_p_address=None, proxy_host_source_id_list=None, site_info=None, team_info=None, mtype=None, user_info=None, uuid=None, we... | 2 | null | Implement the Python class `Office365ProtectionSource` described below.
Class description:
Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupIn... | Implement the Python class `Office365ProtectionSource` described below.
Class description:
Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupIn... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class Office365ProtectionSource:
"""Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupInfo): Specifies the information about Of... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Office365ProtectionSource:
"""Implementation of the 'Office365ProtectionSource' model. Specifies a Protection Source in Office 365 environment. Attributes: description (string): Specifies the description of the Office 365 entity. group_info (Office365GroupInfo): Specifies the information about Office365 group... | the_stack_v2_python_sparse | cohesity_management_sdk/models/office_365_protection_source.py | cohesity/management-sdk-python | train | 24 |
0fec10dbe543db399a8f78a81dcec6ce15dc74af | [
"allowed_fields = super().filter_allowed_fields\nallowed_fields.remove('assignment_id')\nreturn allowed_fields",
"assignment_id = self.request.matchdict.get('assignment_id')\nif assignment_id:\n query.filter(self.model.assignment_id == assignment_id)\nreturn query"
] | <|body_start_0|>
allowed_fields = super().filter_allowed_fields
allowed_fields.remove('assignment_id')
return allowed_fields
<|end_body_0|>
<|body_start_1|>
assignment_id = self.request.matchdict.get('assignment_id')
if assignment_id:
query.filter(self.model.assignme... | Assets service. | AssetService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AssetService:
"""Assets service."""
def filter_allowed_fields(self):
"""List of fields allowed in filtering and sorting."""
<|body_0|>
def default_filters(self, query) -> object:
"""Default filters for this Service."""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_10k_train_002682 | 2,803 | no_license | [
{
"docstring": "List of fields allowed in filtering and sorting.",
"name": "filter_allowed_fields",
"signature": "def filter_allowed_fields(self)"
},
{
"docstring": "Default filters for this Service.",
"name": "default_filters",
"signature": "def default_filters(self, query) -> object"
... | 2 | stack_v2_sparse_classes_30k_train_004618 | Implement the Python class `AssetService` described below.
Class description:
Assets service.
Method signatures and docstrings:
- def filter_allowed_fields(self): List of fields allowed in filtering and sorting.
- def default_filters(self, query) -> object: Default filters for this Service. | Implement the Python class `AssetService` described below.
Class description:
Assets service.
Method signatures and docstrings:
- def filter_allowed_fields(self): List of fields allowed in filtering and sorting.
- def default_filters(self, query) -> object: Default filters for this Service.
<|skeleton|>
class AssetS... | e85c0ba0992bccb80878e89ec791ee64754646b0 | <|skeleton|>
class AssetService:
"""Assets service."""
def filter_allowed_fields(self):
"""List of fields allowed in filtering and sorting."""
<|body_0|>
def default_filters(self, query) -> object:
"""Default filters for this Service."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AssetService:
"""Assets service."""
def filter_allowed_fields(self):
"""List of fields allowed in filtering and sorting."""
allowed_fields = super().filter_allowed_fields
allowed_fields.remove('assignment_id')
return allowed_fields
def default_filters(self, query) -> ... | the_stack_v2_python_sparse | src/briefy/leica/views/assets.py | BriefyHQ/briefy.leica | train | 0 |
7f88013ee78a015c7b76312bf6d6339e007671cd | [
"all_positions = set(itertools.product(set(range(self.grid_size)), list(range(self.grid_size))))\navailable_positions = all_positions - self._occupied_positions\nrelative_positions = set(DIR_TO_DIR_VEC.keys())\nif exclude_locations is not None:\n relative_positions = relative_positions - set(exclude_locations)\n... | <|body_start_0|>
all_positions = set(itertools.product(set(range(self.grid_size)), list(range(self.grid_size))))
available_positions = all_positions - self._occupied_positions
relative_positions = set(DIR_TO_DIR_VEC.keys())
if exclude_locations is not None:
relative_positions... | The world class that considers object spatial relations. Similar to the original gSCAN world state but allows sampling positions basaed on specific conditions. See https://github.com/LauraRuis/groundedSCAN/blob/master/GroundedScan/world.py for more details. | RelationWorld | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RelationWorld:
"""The world class that considers object spatial relations. Similar to the original gSCAN world state but allows sampling positions basaed on specific conditions. See https://github.com/LauraRuis/groundedSCAN/blob/master/GroundedScan/world.py for more details."""
def get_nearb... | stack_v2_sparse_classes_10k_train_002683 | 3,796 | permissive | [
{
"docstring": "Return a list of available positions that are next to the given position.",
"name": "get_nearby_positions",
"signature": "def get_nearby_positions(self, position, exclude_locations=None)"
},
{
"docstring": "Sample an available position that is next to the given position.",
"n... | 4 | stack_v2_sparse_classes_30k_val_000357 | Implement the Python class `RelationWorld` described below.
Class description:
The world class that considers object spatial relations. Similar to the original gSCAN world state but allows sampling positions basaed on specific conditions. See https://github.com/LauraRuis/groundedSCAN/blob/master/GroundedScan/world.py ... | Implement the Python class `RelationWorld` described below.
Class description:
The world class that considers object spatial relations. Similar to the original gSCAN world state but allows sampling positions basaed on specific conditions. See https://github.com/LauraRuis/groundedSCAN/blob/master/GroundedScan/world.py ... | ac9447064195e06de48cc91ff642f7fffa28ffe8 | <|skeleton|>
class RelationWorld:
"""The world class that considers object spatial relations. Similar to the original gSCAN world state but allows sampling positions basaed on specific conditions. See https://github.com/LauraRuis/groundedSCAN/blob/master/GroundedScan/world.py for more details."""
def get_nearb... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RelationWorld:
"""The world class that considers object spatial relations. Similar to the original gSCAN world state but allows sampling positions basaed on specific conditions. See https://github.com/LauraRuis/groundedSCAN/blob/master/GroundedScan/world.py for more details."""
def get_nearby_positions(s... | the_stack_v2_python_sparse | language/gscan/data/world.py | google-research/language | train | 1,567 |
2d9fba639fd15308a0d651a9bb2ec33924b7bcf7 | [
"score_map = {}\nfor i, s in items:\n self._insert_score(i, s, score_map)\nres = [[k, sum(v) // len(v)] for k, v in score_map.items()]\nreturn sorted(res, key=lambda x: x[0])",
"if i not in score_map:\n score_map[i] = [s]\nelif len(score_map[i]) < 5:\n heapq.heappush(score_map[i], s)\nelif score_map[i][0... | <|body_start_0|>
score_map = {}
for i, s in items:
self._insert_score(i, s, score_map)
res = [[k, sum(v) // len(v)] for k, v in score_map.items()]
return sorted(res, key=lambda x: x[0])
<|end_body_0|>
<|body_start_1|>
if i not in score_map:
score_map[i] =... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def highFive(self, items: List[List[int]]) -> List[List[int]]:
"""Hash table. Running time: O(nlogn) where n is the length of items."""
<|body_0|>
def _insert_score(self, i, s, score_map):
"""Heap. Running time: O(logn) where n is the length of score_map[i]... | stack_v2_sparse_classes_10k_train_002684 | 772 | permissive | [
{
"docstring": "Hash table. Running time: O(nlogn) where n is the length of items.",
"name": "highFive",
"signature": "def highFive(self, items: List[List[int]]) -> List[List[int]]"
},
{
"docstring": "Heap. Running time: O(logn) where n is the length of score_map[i].",
"name": "_insert_score... | 2 | stack_v2_sparse_classes_30k_train_003425 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def highFive(self, items: List[List[int]]) -> List[List[int]]: Hash table. Running time: O(nlogn) where n is the length of items.
- def _insert_score(self, i, s, score_map): Heap... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def highFive(self, items: List[List[int]]) -> List[List[int]]: Hash table. Running time: O(nlogn) where n is the length of items.
- def _insert_score(self, i, s, score_map): Heap... | 4a508a982b125a3a90ea893ae70863df7c99cc70 | <|skeleton|>
class Solution:
def highFive(self, items: List[List[int]]) -> List[List[int]]:
"""Hash table. Running time: O(nlogn) where n is the length of items."""
<|body_0|>
def _insert_score(self, i, s, score_map):
"""Heap. Running time: O(logn) where n is the length of score_map[i]... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def highFive(self, items: List[List[int]]) -> List[List[int]]:
"""Hash table. Running time: O(nlogn) where n is the length of items."""
score_map = {}
for i, s in items:
self._insert_score(i, s, score_map)
res = [[k, sum(v) // len(v)] for k, v in score_map... | the_stack_v2_python_sparse | solutions/1086_high_five.py | YiqunPeng/leetcode_pro | train | 0 | |
14d1908f657668fba848745530c877edceb280ed | [
"self.records = records\nself.cheapMetric = cheapDistanceMetric\nif not callable(self.cheapMetric):\n raise ValueError('Cheap distance metric must be callable function.')\nself.method = ermethod\nself.t1 = t1\nself.t2 = t2\nif scoreType == ScoreTypes.DISTANCE:\n self.scoreIsBetter = lambda score, best: score ... | <|body_start_0|>
self.records = records
self.cheapMetric = cheapDistanceMetric
if not callable(self.cheapMetric):
raise ValueError('Cheap distance metric must be callable function.')
self.method = ermethod
self.t1 = t1
self.t2 = t2
if scoreType == Scor... | Class to do blocking using canopies. | CanopiesBlocker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CanopiesBlocker:
"""Class to do blocking using canopies."""
def __init__(self, records, cheapDistanceMetric, ermethod, t1, t2, scoreType, randomize=True):
"""Constructor :param records: all the records to cluster :param cheapDistanceMetric: A cheap distance metric used to form the ca... | stack_v2_sparse_classes_10k_train_002685 | 6,582 | no_license | [
{
"docstring": "Constructor :param records: all the records to cluster :param cheapDistanceMetric: A cheap distance metric used to form the canopies. :param ermethod: An ER method to do the full clustering within each canopy. :param t1: First threshold for canopies :param t2: Second threshold for canopies :para... | 6 | stack_v2_sparse_classes_30k_train_004270 | Implement the Python class `CanopiesBlocker` described below.
Class description:
Class to do blocking using canopies.
Method signatures and docstrings:
- def __init__(self, records, cheapDistanceMetric, ermethod, t1, t2, scoreType, randomize=True): Constructor :param records: all the records to cluster :param cheapDi... | Implement the Python class `CanopiesBlocker` described below.
Class description:
Class to do blocking using canopies.
Method signatures and docstrings:
- def __init__(self, records, cheapDistanceMetric, ermethod, t1, t2, scoreType, randomize=True): Constructor :param records: all the records to cluster :param cheapDi... | 8399c88ab0fdc7736dddcf5239eea655d613c61d | <|skeleton|>
class CanopiesBlocker:
"""Class to do blocking using canopies."""
def __init__(self, records, cheapDistanceMetric, ermethod, t1, t2, scoreType, randomize=True):
"""Constructor :param records: all the records to cluster :param cheapDistanceMetric: A cheap distance metric used to form the ca... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class CanopiesBlocker:
"""Class to do blocking using canopies."""
def __init__(self, records, cheapDistanceMetric, ermethod, t1, t2, scoreType, randomize=True):
"""Constructor :param records: all the records to cluster :param cheapDistanceMetric: A cheap distance metric used to form the canopies. :para... | the_stack_v2_python_sparse | canopies.py | timdestan/quiz-bowl-entity-resolution | train | 1 |
a5a80c8b69b152058ecded2ab89ad3c4f03981c4 | [
"horizontal = ['.'] * n\nvertical = ['.'] * n\nleft_oblique = ['.'] * 2 * n\nright_oblique = ['.'] * 2 * n\nqueens = []\nboard = Board(horizontal, vertical, left_oblique, right_oblique, [], n)\nreturn self.put_queen(board, n)",
"res = []\nif len(board.queens) == n:\n res.append(board.output())\n return res\... | <|body_start_0|>
horizontal = ['.'] * n
vertical = ['.'] * n
left_oblique = ['.'] * 2 * n
right_oblique = ['.'] * 2 * n
queens = []
board = Board(horizontal, vertical, left_oblique, right_oblique, [], n)
return self.put_queen(board, n)
<|end_body_0|>
<|body_start... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def solveNQueens(self, n):
""":type n: int :rtype: List[List[str]]"""
<|body_0|>
def put_queen(self, board, n):
"""put xth queen on the board"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
horizontal = ['.'] * n
vertical = ['.'] *... | stack_v2_sparse_classes_10k_train_002686 | 2,324 | permissive | [
{
"docstring": ":type n: int :rtype: List[List[str]]",
"name": "solveNQueens",
"signature": "def solveNQueens(self, n)"
},
{
"docstring": "put xth queen on the board",
"name": "put_queen",
"signature": "def put_queen(self, board, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001673 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solveNQueens(self, n): :type n: int :rtype: List[List[str]]
- def put_queen(self, board, n): put xth queen on the board | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solveNQueens(self, n): :type n: int :rtype: List[List[str]]
- def put_queen(self, board, n): put xth queen on the board
<|skeleton|>
class Solution:
def solveNQueens(se... | 7a072d453085e5830eeb597a36ab5e24f4821418 | <|skeleton|>
class Solution:
def solveNQueens(self, n):
""":type n: int :rtype: List[List[str]]"""
<|body_0|>
def put_queen(self, board, n):
"""put xth queen on the board"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def solveNQueens(self, n):
""":type n: int :rtype: List[List[str]]"""
horizontal = ['.'] * n
vertical = ['.'] * n
left_oblique = ['.'] * 2 * n
right_oblique = ['.'] * 2 * n
queens = []
board = Board(horizontal, vertical, left_oblique, right_obl... | the_stack_v2_python_sparse | n_queens.py | luozhaoyu/leetcode | train | 0 | |
caeaf1d808ac9917645b985392db23e63befdf42 | [
"user = User.objects.create_user(username='hede', password='hede')\nurl = reverse('user-reports', args=[user.username])\nself.token_login()\ndata = simplejson.dumps({'text': 'Test'})\nrequest = self.c.post(path=url, content_type='application/json', data=data, **self.client_header)\nself.assertEqual(request.status_c... | <|body_start_0|>
user = User.objects.create_user(username='hede', password='hede')
url = reverse('user-reports', args=[user.username])
self.token_login()
data = simplejson.dumps({'text': 'Test'})
request = self.c.post(path=url, content_type='application/json', data=data, **self.c... | UserReportTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserReportTestCase:
def test_report_create(self):
"""Create Report"""
<|body_0|>
def test_invalid_user_create_report(self):
"""invalid user Create Report"""
<|body_1|>
def test_report_list(self):
"""Report List"""
<|body_2|>
def test... | stack_v2_sparse_classes_10k_train_002687 | 10,007 | no_license | [
{
"docstring": "Create Report",
"name": "test_report_create",
"signature": "def test_report_create(self)"
},
{
"docstring": "invalid user Create Report",
"name": "test_invalid_user_create_report",
"signature": "def test_invalid_user_create_report(self)"
},
{
"docstring": "Report ... | 5 | stack_v2_sparse_classes_30k_test_000010 | Implement the Python class `UserReportTestCase` described below.
Class description:
Implement the UserReportTestCase class.
Method signatures and docstrings:
- def test_report_create(self): Create Report
- def test_invalid_user_create_report(self): invalid user Create Report
- def test_report_list(self): Report List
... | Implement the Python class `UserReportTestCase` described below.
Class description:
Implement the UserReportTestCase class.
Method signatures and docstrings:
- def test_report_create(self): Create Report
- def test_invalid_user_create_report(self): invalid user Create Report
- def test_report_list(self): Report List
... | b8ba25fdde5d4ee92a3f73cb42ff892ed436d3f2 | <|skeleton|>
class UserReportTestCase:
def test_report_create(self):
"""Create Report"""
<|body_0|>
def test_invalid_user_create_report(self):
"""invalid user Create Report"""
<|body_1|>
def test_report_list(self):
"""Report List"""
<|body_2|>
def test... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class UserReportTestCase:
def test_report_create(self):
"""Create Report"""
user = User.objects.create_user(username='hede', password='hede')
url = reverse('user-reports', args=[user.username])
self.token_login()
data = simplejson.dumps({'text': 'Test'})
request = sel... | the_stack_v2_python_sparse | chatproject/apps/account/tests.py | QilinGu/chat-project | train | 0 | |
e5f16ab42246ccbdd6206fc64668c979c27528dc | [
"words.sort()\nvalid_words, longest_word = ({''}, '')\nfor word in words:\n if word[:-1] in valid_words:\n valid_words.add(word)\n if len(word) > len(longest_word):\n longest_word = word\nreturn longest_word",
"trie = Trie()\nfor word in words:\n trie.add(word)\nreturn trie.bfs()"
] | <|body_start_0|>
words.sort()
valid_words, longest_word = ({''}, '')
for word in words:
if word[:-1] in valid_words:
valid_words.add(word)
if len(word) > len(longest_word):
longest_word = word
return longest_word
<|end_body_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestWord1(self, words):
""":type words: List[str] :rtype: str"""
<|body_0|>
def longestWord2(self, words):
""":type words: List[str] :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
words.sort()
valid_words, longe... | stack_v2_sparse_classes_10k_train_002688 | 4,497 | no_license | [
{
"docstring": ":type words: List[str] :rtype: str",
"name": "longestWord1",
"signature": "def longestWord1(self, words)"
},
{
"docstring": ":type words: List[str] :rtype: str",
"name": "longestWord2",
"signature": "def longestWord2(self, words)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004254 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestWord1(self, words): :type words: List[str] :rtype: str
- def longestWord2(self, words): :type words: List[str] :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestWord1(self, words): :type words: List[str] :rtype: str
- def longestWord2(self, words): :type words: List[str] :rtype: str
<|skeleton|>
class Solution:
def longe... | b1764cd62e1c8cb062869992d9eaa8b2d2fdf9c2 | <|skeleton|>
class Solution:
def longestWord1(self, words):
""":type words: List[str] :rtype: str"""
<|body_0|>
def longestWord2(self, words):
""":type words: List[str] :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def longestWord1(self, words):
""":type words: List[str] :rtype: str"""
words.sort()
valid_words, longest_word = ({''}, '')
for word in words:
if word[:-1] in valid_words:
valid_words.add(word)
if len(word) > len(longest_wor... | the_stack_v2_python_sparse | leetcode/trie/easy/720. Longest Word in Dictionary.py | Hk4Fun/algorithm_offer | train | 1 | |
0b62e5048083e9acc4ffb7788dc51e54bae28e9b | [
"self.account_id = account_id\nself.name = name\nself.org_no = org_no\nself.uni_customer_no = uni_customer_no\nself.created = APIHelper.RFC3339DateTime(created) if created else None\nself.last_modified = APIHelper.RFC3339DateTime(last_modified) if last_modified else None\nself.dealer_id = dealer_id\nself.dealer_nam... | <|body_start_0|>
self.account_id = account_id
self.name = name
self.org_no = org_no
self.uni_customer_no = uni_customer_no
self.created = APIHelper.RFC3339DateTime(created) if created else None
self.last_modified = APIHelper.RFC3339DateTime(last_modified) if last_modified... | Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description here. created (datetime): TODO: ... | AccountListItem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountListItem:
"""Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type d... | stack_v2_sparse_classes_10k_train_002689 | 4,399 | permissive | [
{
"docstring": "Constructor for the AccountListItem class",
"name": "__init__",
"signature": "def __init__(self, account_id=None, name=None, org_no=None, uni_customer_no=None, created=None, last_modified=None, dealer_id=None, dealer_name=None, dealer_reference=None, enabled=None, additional_properties={... | 2 | stack_v2_sparse_classes_30k_train_000775 | Implement the Python class `AccountListItem` described below.
Class description:
Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here.... | Implement the Python class `AccountListItem` described below.
Class description:
Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here.... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class AccountListItem:
"""Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type d... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class AccountListItem:
"""Implementation of the 'AccountListItem' model. TODO: type model description here. Attributes: account_id (uuid|string): TODO: type description here. name (string): TODO: type description here. org_no (string): TODO: type description here. uni_customer_no (string): TODO: type description he... | the_stack_v2_python_sparse | idfy_rest_client/models/account_list_item.py | dealflowteam/Idfy | train | 0 |
9786952b6889a2254568a02489762ec36bbde4dc | [
"self.hash_func = hash_func\nself.group_size = group_size\nif self.hash_func is None:\n raise ValueError('hash_func must be specified when using GroupHashingPartitioner')\nif self.group_size < 1:\n raise ValueError('group_size cannot be < 1 when using GroupHashingPartitioner')",
"if key is None:\n raise ... | <|body_start_0|>
self.hash_func = hash_func
self.group_size = group_size
if self.hash_func is None:
raise ValueError('hash_func must be specified when using GroupHashingPartitioner')
if self.group_size < 1:
raise ValueError('group_size cannot be < 1 when using Gro... | Messages published with the identical keys will be directed to a consistent subset of 'n' partitions from the set of available partitions. For example, if there are 16 partitions and group_size=4, messages with the identical keys will be shared equally between a subset of four partitions, instead of always being direct... | GroupHashingPartitioner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupHashingPartitioner:
"""Messages published with the identical keys will be directed to a consistent subset of 'n' partitions from the set of available partitions. For example, if there are 16 partitions and group_size=4, messages with the identical keys will be shared equally between a subset... | stack_v2_sparse_classes_10k_train_002690 | 5,870 | permissive | [
{
"docstring": ":param hash_func: A hash function :type hash_func: function :param group_size: Size of the partition group to assign to. For example, if there are 16 partitions, and we want to smooth the distribution of identical keys between a set of 4, use 4 as the group_size. :type group_size: Integer value ... | 2 | stack_v2_sparse_classes_30k_train_004195 | Implement the Python class `GroupHashingPartitioner` described below.
Class description:
Messages published with the identical keys will be directed to a consistent subset of 'n' partitions from the set of available partitions. For example, if there are 16 partitions and group_size=4, messages with the identical keys ... | Implement the Python class `GroupHashingPartitioner` described below.
Class description:
Messages published with the identical keys will be directed to a consistent subset of 'n' partitions from the set of available partitions. For example, if there are 16 partitions and group_size=4, messages with the identical keys ... | c7054bd05b127385b8c6f56a4e2241d92ff42ab4 | <|skeleton|>
class GroupHashingPartitioner:
"""Messages published with the identical keys will be directed to a consistent subset of 'n' partitions from the set of available partitions. For example, if there are 16 partitions and group_size=4, messages with the identical keys will be shared equally between a subset... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class GroupHashingPartitioner:
"""Messages published with the identical keys will be directed to a consistent subset of 'n' partitions from the set of available partitions. For example, if there are 16 partitions and group_size=4, messages with the identical keys will be shared equally between a subset of four part... | the_stack_v2_python_sparse | py_kafk/tar/pykafka-2.8.1-dev.1/pykafka/partitioners.py | liuansen/python-utils-class | train | 3 |
3a7e23424e3b5808423657f247230eb6bc73b742 | [
"from sagas.ja.knp_helper import knp\nresult = knp.parse(sents)\nknp_deps(result)\nprint('bnst list', '-' * 15)\nfor bnst in result.bnst_list():\n print(f'{bnst.bnst_id}, {bnst.midasi}, {bnst.parent_id}, {bnst.repname}, {bnst.dpndtype}')\nprint('\\nbnst tree', '-' * 15)\nresult.draw_bnst_tree()\nprint('\\ntag tr... | <|body_start_0|>
from sagas.ja.knp_helper import knp
result = knp.parse(sents)
knp_deps(result)
print('bnst list', '-' * 15)
for bnst in result.bnst_list():
print(f'{bnst.bnst_id}, {bnst.midasi}, {bnst.parent_id}, {bnst.repname}, {bnst.dpndtype}')
print('\nbns... | KnpCli | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KnpCli:
def deps(self, sents):
"""$ python -m sagas.ja.knp_cli deps "望遠鏡で泳いでいる少女を見た。" :param sents: :return:"""
<|body_0|>
def parse(self, sents, output='console'):
"""$ python -m sagas.ja.knp_cli parse "望遠鏡で泳いでいる少女を見た。" $ python -m sagas.ja.knp_cli parse "どのおかずを注文した... | stack_v2_sparse_classes_10k_train_002691 | 1,412 | permissive | [
{
"docstring": "$ python -m sagas.ja.knp_cli deps \"望遠鏡で泳いでいる少女を見た。\" :param sents: :return:",
"name": "deps",
"signature": "def deps(self, sents)"
},
{
"docstring": "$ python -m sagas.ja.knp_cli parse \"望遠鏡で泳いでいる少女を見た。\" $ python -m sagas.ja.knp_cli parse \"どのおかずを注文したの?\" :param sents: :param o... | 2 | null | Implement the Python class `KnpCli` described below.
Class description:
Implement the KnpCli class.
Method signatures and docstrings:
- def deps(self, sents): $ python -m sagas.ja.knp_cli deps "望遠鏡で泳いでいる少女を見た。" :param sents: :return:
- def parse(self, sents, output='console'): $ python -m sagas.ja.knp_cli parse "望遠鏡で... | Implement the Python class `KnpCli` described below.
Class description:
Implement the KnpCli class.
Method signatures and docstrings:
- def deps(self, sents): $ python -m sagas.ja.knp_cli deps "望遠鏡で泳いでいる少女を見た。" :param sents: :return:
- def parse(self, sents, output='console'): $ python -m sagas.ja.knp_cli parse "望遠鏡で... | 9958d18ee5e75cf9794f546c904097dc1ff4f3a0 | <|skeleton|>
class KnpCli:
def deps(self, sents):
"""$ python -m sagas.ja.knp_cli deps "望遠鏡で泳いでいる少女を見た。" :param sents: :return:"""
<|body_0|>
def parse(self, sents, output='console'):
"""$ python -m sagas.ja.knp_cli parse "望遠鏡で泳いでいる少女を見た。" $ python -m sagas.ja.knp_cli parse "どのおかずを注文した... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class KnpCli:
def deps(self, sents):
"""$ python -m sagas.ja.knp_cli deps "望遠鏡で泳いでいる少女を見た。" :param sents: :return:"""
from sagas.ja.knp_helper import knp
result = knp.parse(sents)
knp_deps(result)
print('bnst list', '-' * 15)
for bnst in result.bnst_list():
... | the_stack_v2_python_sparse | sagas/ja/knp_cli.py | samlet/stack | train | 3 | |
d5c52e5229d54dd387ea596200db5b68b2f4a848 | [
"if isinstance(kernel_size, int) and isinstance(stride, int):\n kernel_size = np.array([kernel_size] * 3)\n stride = [stride] * 3\nelif isinstance(kernel_size, int):\n kernel_size = np.array([kernel_size] * len(stride))\nelif isinstance(stride, int):\n stride = [stride] * len(kernel_size)\nself.out_filt... | <|body_start_0|>
if isinstance(kernel_size, int) and isinstance(stride, int):
kernel_size = np.array([kernel_size] * 3)
stride = [stride] * 3
elif isinstance(kernel_size, int):
kernel_size = np.array([kernel_size] * len(stride))
elif isinstance(stride, int):
... | Vanilla pre-activation residual unit pre-activation residual unit as proposed by He, Kaiming, et al. "Identity mappings in deep residual networks." ECCV, 2016. - https://link.springer.com/chapter/10.1007/978-3-319-46493-0_38 | VanillaResidualUnit | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VanillaResidualUnit:
"""Vanilla pre-activation residual unit pre-activation residual unit as proposed by He, Kaiming, et al. "Identity mappings in deep residual networks." ECCV, 2016. - https://link.springer.com/chapter/10.1007/978-3-319-46493-0_38"""
def __init__(self, out_filters, kernel_s... | stack_v2_sparse_classes_10k_train_002692 | 4,131 | permissive | [
{
"docstring": "Builds a residual unit Parameters ---------- out_filters : int number of output filters kernel_size : int or tuple or list, optional size of the kernel for the convolutions stride : int or tuple or list, optional stride used for first convolution in unit relu_leakiness : float leakiness of relu ... | 2 | stack_v2_sparse_classes_30k_train_005785 | Implement the Python class `VanillaResidualUnit` described below.
Class description:
Vanilla pre-activation residual unit pre-activation residual unit as proposed by He, Kaiming, et al. "Identity mappings in deep residual networks." ECCV, 2016. - https://link.springer.com/chapter/10.1007/978-3-319-46493-0_38
Method s... | Implement the Python class `VanillaResidualUnit` described below.
Class description:
Vanilla pre-activation residual unit pre-activation residual unit as proposed by He, Kaiming, et al. "Identity mappings in deep residual networks." ECCV, 2016. - https://link.springer.com/chapter/10.1007/978-3-319-46493-0_38
Method s... | 80d1a04dc163590aa44b62688b06aece78fb7fd6 | <|skeleton|>
class VanillaResidualUnit:
"""Vanilla pre-activation residual unit pre-activation residual unit as proposed by He, Kaiming, et al. "Identity mappings in deep residual networks." ECCV, 2016. - https://link.springer.com/chapter/10.1007/978-3-319-46493-0_38"""
def __init__(self, out_filters, kernel_s... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class VanillaResidualUnit:
"""Vanilla pre-activation residual unit pre-activation residual unit as proposed by He, Kaiming, et al. "Identity mappings in deep residual networks." ECCV, 2016. - https://link.springer.com/chapter/10.1007/978-3-319-46493-0_38"""
def __init__(self, out_filters, kernel_size=3, stride... | the_stack_v2_python_sparse | dltk/core/modules/residual_units.py | pawni/DLTK-1 | train | 1 |
69a7db37f552a29e804b6bdf8cd3878c590c8602 | [
"_LOGGER.debug('Enable max range charging: %s', self.name)\nawait self.tesla_device.set_max()\nself.async_write_ha_state()",
"_LOGGER.debug('Disable max range charging: %s', self.name)\nawait self.tesla_device.set_standard()\nself.async_write_ha_state()",
"if self.tesla_device.is_maxrange() is None:\n return... | <|body_start_0|>
_LOGGER.debug('Enable max range charging: %s', self.name)
await self.tesla_device.set_max()
self.async_write_ha_state()
<|end_body_0|>
<|body_start_1|>
_LOGGER.debug('Disable max range charging: %s', self.name)
await self.tesla_device.set_standard()
self... | Representation of a Tesla max range charging switch. | RangeSwitch | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RangeSwitch:
"""Representation of a Tesla max range charging switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
<|body_0|>
async def async_turn_off(self, **kwargs):
"""Send the off command."""
<|body_1|>
def is_on(self):
... | stack_v2_sparse_classes_10k_train_002693 | 4,636 | permissive | [
{
"docstring": "Send the on command.",
"name": "async_turn_on",
"signature": "async def async_turn_on(self, **kwargs)"
},
{
"docstring": "Send the off command.",
"name": "async_turn_off",
"signature": "async def async_turn_off(self, **kwargs)"
},
{
"docstring": "Get whether the s... | 3 | null | Implement the Python class `RangeSwitch` described below.
Class description:
Representation of a Tesla max range charging switch.
Method signatures and docstrings:
- async def async_turn_on(self, **kwargs): Send the on command.
- async def async_turn_off(self, **kwargs): Send the off command.
- def is_on(self): Get w... | Implement the Python class `RangeSwitch` described below.
Class description:
Representation of a Tesla max range charging switch.
Method signatures and docstrings:
- async def async_turn_on(self, **kwargs): Send the on command.
- async def async_turn_off(self, **kwargs): Send the off command.
- def is_on(self): Get w... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class RangeSwitch:
"""Representation of a Tesla max range charging switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
<|body_0|>
async def async_turn_off(self, **kwargs):
"""Send the off command."""
<|body_1|>
def is_on(self):
... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class RangeSwitch:
"""Representation of a Tesla max range charging switch."""
async def async_turn_on(self, **kwargs):
"""Send the on command."""
_LOGGER.debug('Enable max range charging: %s', self.name)
await self.tesla_device.set_max()
self.async_write_ha_state()
async de... | the_stack_v2_python_sparse | homeassistant/components/tesla/switch.py | BenWoodford/home-assistant | train | 11 |
5f3a445898b096e21ec5b174ec7f46d36c60555a | [
"dfile_dct = {} if dfile_dct is None else dfile_dct\nassert isinstance(ddir, DataDir)\nself.dir = ddir\nself.file = types.SimpleNamespace()\nfor name, obj in dfile_dct.items():\n assert isinstance(name, str)\n assert isinstance(obj, DataFile)\n setattr(self.file, name, obj)",
"ddir = self.dir.stacked_ove... | <|body_start_0|>
dfile_dct = {} if dfile_dct is None else dfile_dct
assert isinstance(ddir, DataDir)
self.dir = ddir
self.file = types.SimpleNamespace()
for name, obj in dfile_dct.items():
assert isinstance(name, str)
assert isinstance(obj, DataFile)
... | a single-layered system of directories and files | DataLayer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataLayer:
"""a single-layered system of directories and files"""
def __init__(self, ddir, dfile_dct=None):
""":param ddir: a DataDir object :param dfiles: a sequence of pairs `(name, obj)` where `obj` is a DataFile instance that will be accessible as `obj.file.name`"""
<|bod... | stack_v2_sparse_classes_10k_train_002694 | 6,832 | permissive | [
{
"docstring": ":param ddir: a DataDir object :param dfiles: a sequence of pairs `(name, obj)` where `obj` is a DataFile instance that will be accessible as `obj.file.name`",
"name": "__init__",
"signature": "def __init__(self, ddir, dfile_dct=None)"
},
{
"docstring": "get a copy of this DataLay... | 2 | stack_v2_sparse_classes_30k_train_004987 | Implement the Python class `DataLayer` described below.
Class description:
a single-layered system of directories and files
Method signatures and docstrings:
- def __init__(self, ddir, dfile_dct=None): :param ddir: a DataDir object :param dfiles: a sequence of pairs `(name, obj)` where `obj` is a DataFile instance th... | Implement the Python class `DataLayer` described below.
Class description:
a single-layered system of directories and files
Method signatures and docstrings:
- def __init__(self, ddir, dfile_dct=None): :param ddir: a DataDir object :param dfiles: a sequence of pairs `(name, obj)` where `obj` is a DataFile instance th... | e52341a2b77b5e79b0e2cee73f48735d00fd6209 | <|skeleton|>
class DataLayer:
"""a single-layered system of directories and files"""
def __init__(self, ddir, dfile_dct=None):
""":param ddir: a DataDir object :param dfiles: a sequence of pairs `(name, obj)` where `obj` is a DataFile instance that will be accessible as `obj.file.name`"""
<|bod... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class DataLayer:
"""a single-layered system of directories and files"""
def __init__(self, ddir, dfile_dct=None):
""":param ddir: a DataDir object :param dfiles: a sequence of pairs `(name, obj)` where `obj` is a DataFile instance that will be accessible as `obj.file.name`"""
dfile_dct = {} if ... | the_stack_v2_python_sparse | old_autodir/factory.py | avcopan/filesystem | train | 0 |
22e5e62e5ce6f2a0ce16c5fb276d3c0675432bb0 | [
"self.conn = MySQLdb.connect(host=config_reader.get('host'), db=config_reader.get('dbname'), read_default_file=config_reader.get('defaultcnf'), use_unicode=1, charset='utf8')\nself.cursor = self.conn.cursor()\nself.queries = hb_queries.Query(config_reader.get('wikidb'), config_reader.get('invitee_table'))",
"quer... | <|body_start_0|>
self.conn = MySQLdb.connect(host=config_reader.get('host'), db=config_reader.get('dbname'), read_default_file=config_reader.get('defaultcnf'), use_unicode=1, charset='utf8')
self.cursor = self.conn.cursor()
self.queries = hb_queries.Query(config_reader.get('wikidb'), config_read... | Create, parse, and post formatted messages to wiki. | Samples | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Samples:
"""Create, parse, and post formatted messages to wiki."""
def __init__(self):
"""Set up the db connection."""
<|body_0|>
def insertInvitees(self, query_key):
"""Insert today's potential invitees into the database"""
<|body_1|>
def updateTalk... | stack_v2_sparse_classes_10k_train_002695 | 5,945 | no_license | [
{
"docstring": "Set up the db connection.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Insert today's potential invitees into the database",
"name": "insertInvitees",
"signature": "def insertInvitees(self, query_key)"
},
{
"docstring": "Updates the d... | 5 | stack_v2_sparse_classes_30k_train_004867 | Implement the Python class `Samples` described below.
Class description:
Create, parse, and post formatted messages to wiki.
Method signatures and docstrings:
- def __init__(self): Set up the db connection.
- def insertInvitees(self, query_key): Insert today's potential invitees into the database
- def updateTalkPage... | Implement the Python class `Samples` described below.
Class description:
Create, parse, and post formatted messages to wiki.
Method signatures and docstrings:
- def __init__(self): Set up the db connection.
- def insertInvitees(self, query_key): Insert today's potential invitees into the database
- def updateTalkPage... | 5359b875e9c22f2b517368b22e42e1304dd75bb3 | <|skeleton|>
class Samples:
"""Create, parse, and post formatted messages to wiki."""
def __init__(self):
"""Set up the db connection."""
<|body_0|>
def insertInvitees(self, query_key):
"""Insert today's potential invitees into the database"""
<|body_1|>
def updateTalk... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Samples:
"""Create, parse, and post formatted messages to wiki."""
def __init__(self):
"""Set up the db connection."""
self.conn = MySQLdb.connect(host=config_reader.get('host'), db=config_reader.get('dbname'), read_default_file=config_reader.get('defaultcnf'), use_unicode=1, charset='utf... | the_stack_v2_python_sparse | hb_profiles.py | Wikimedia-Sverige/hostbot | train | 2 |
ee4b445bf9292faddcb6f1d7c6f6c1d365f3276f | [
"if len(s) < 10:\n return []\ndic = {}\nres = []\nfor i in range(len(s) - 9):\n curr = s[i:i + 10]\n print(curr)\n if curr in dic:\n if dic[curr] == 1:\n res.append(curr)\n dic[curr] += 1\n else:\n dic[curr] = 1\nreturn res",
"if len(s) <= 10:\n return []\ndic... | <|body_start_0|>
if len(s) < 10:
return []
dic = {}
res = []
for i in range(len(s) - 9):
curr = s[i:i + 10]
print(curr)
if curr in dic:
if dic[curr] == 1:
res.append(curr)
dic[curr] +=... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findRepeatedDnaSequences(self, s):
""":type s: str :rtype: List[str]"""
<|body_0|>
def findRepeatedDnaSequences2(self, s):
""":type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(s) < 10:
re... | stack_v2_sparse_classes_10k_train_002696 | 1,010 | no_license | [
{
"docstring": ":type s: str :rtype: List[str]",
"name": "findRepeatedDnaSequences",
"signature": "def findRepeatedDnaSequences(self, s)"
},
{
"docstring": ":type s: str :rtype: List[str]",
"name": "findRepeatedDnaSequences2",
"signature": "def findRepeatedDnaSequences2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004229 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findRepeatedDnaSequences(self, s): :type s: str :rtype: List[str]
- def findRepeatedDnaSequences2(self, s): :type s: str :rtype: List[str] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findRepeatedDnaSequences(self, s): :type s: str :rtype: List[str]
- def findRepeatedDnaSequences2(self, s): :type s: str :rtype: List[str]
<|skeleton|>
class Solution:
... | 11c8fc663888b48b5417256aab1bf872190267ba | <|skeleton|>
class Solution:
def findRepeatedDnaSequences(self, s):
""":type s: str :rtype: List[str]"""
<|body_0|>
def findRepeatedDnaSequences2(self, s):
""":type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class Solution:
def findRepeatedDnaSequences(self, s):
""":type s: str :rtype: List[str]"""
if len(s) < 10:
return []
dic = {}
res = []
for i in range(len(s) - 9):
curr = s[i:i + 10]
print(curr)
if curr in dic:
i... | the_stack_v2_python_sparse | Repeated DNA Sequences.py | lfdyf20/Leetcode | train | 1 | |
09de470be2c2634ab66936a3c925e44de07bb43b | [
"if text.startswith('\"'):\n return PVS_dquotedString.decode(text)\nreturn PVS_ptoken.decode(text)",
"m = PVS_ptoken._re.match(value)\nif m is not None and len(value) == m.end():\n return PVS_ptoken.encode(value)\nreturn PVS_dquotedString.encode(value)"
] | <|body_start_0|>
if text.startswith('"'):
return PVS_dquotedString.decode(text)
return PVS_ptoken.decode(text)
<|end_body_0|>
<|body_start_1|>
m = PVS_ptoken._re.match(value)
if m is not None and len(value) == m.end():
return PVS_ptoken.encode(value)
retu... | Value support for unrecognized parameters. This matches either :class:`PVS_ptoken` or :class:`PVS_dquotedString`, depending on the content of the value. | PVS_unknown | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PVS_unknown:
"""Value support for unrecognized parameters. This matches either :class:`PVS_ptoken` or :class:`PVS_dquotedString`, depending on the content of the value."""
def decode(self, text):
"""Override base class to support either dquotedString or ptoken. If the text begins wit... | stack_v2_sparse_classes_10k_train_002697 | 11,879 | permissive | [
{
"docstring": "Override base class to support either dquotedString or ptoken. If the text begins with double-quotes, this processes as :meth:`PVS_dquotedString.decode`. Otherwise, it processes as :meth:`PVS_ptoken.decode`.",
"name": "decode",
"signature": "def decode(self, text)"
},
{
"docstrin... | 2 | null | Implement the Python class `PVS_unknown` described below.
Class description:
Value support for unrecognized parameters. This matches either :class:`PVS_ptoken` or :class:`PVS_dquotedString`, depending on the content of the value.
Method signatures and docstrings:
- def decode(self, text): Override base class to suppo... | Implement the Python class `PVS_unknown` described below.
Class description:
Value support for unrecognized parameters. This matches either :class:`PVS_ptoken` or :class:`PVS_dquotedString`, depending on the content of the value.
Method signatures and docstrings:
- def decode(self, text): Override base class to suppo... | f512355c5fde6bf027d23558e256b96e2296e0f2 | <|skeleton|>
class PVS_unknown:
"""Value support for unrecognized parameters. This matches either :class:`PVS_ptoken` or :class:`PVS_dquotedString`, depending on the content of the value."""
def decode(self, text):
"""Override base class to support either dquotedString or ptoken. If the text begins wit... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class PVS_unknown:
"""Value support for unrecognized parameters. This matches either :class:`PVS_ptoken` or :class:`PVS_dquotedString`, depending on the content of the value."""
def decode(self, text):
"""Override base class to support either dquotedString or ptoken. If the text begins with double-quot... | the_stack_v2_python_sparse | eds/openmtc-gevent/common/openmtc/lib/coap/coapy/coapy/link.py | elastest/elastest-device-emulator-service | train | 3 |
133942505a1e2b2037048a20188683b3314f0d2b | [
"SBIg.alert('verbose', self, 'Writting object to file {0}'.format(object_file))\ndumpFile = File(file_name=object_file, action='w', overwrite=overwrite)\npickle.dump(self, dumpFile._fd)\ndumpFile.close()",
"SBIg.alert('verbose', StorableObject(), 'Preparing to load object from file {0}'.format(object_file))\nObje... | <|body_start_0|>
SBIg.alert('verbose', self, 'Writting object to file {0}'.format(object_file))
dumpFile = File(file_name=object_file, action='w', overwrite=overwrite)
pickle.dump(self, dumpFile._fd)
dumpFile.close()
<|end_body_0|>
<|body_start_1|>
SBIg.alert('verbose', Storable... | An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards. | StorableObject | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StorableObject:
"""An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards."""
def dump(self, object_file, overwrite=None):
"""St... | stack_v2_sparse_classes_10k_train_002698 | 1,791 | permissive | [
{
"docstring": "Stores the object into a file. @param: object_file @pdef: Name for the output file @ptype: {String} @param: overwrite @pdef: write over a existing file @pdefault: _SBIglobals.overwrite_ @ptype: {Boolean}",
"name": "dump",
"signature": "def dump(self, object_file, overwrite=None)"
},
... | 2 | stack_v2_sparse_classes_30k_train_004482 | Implement the Python class `StorableObject` described below.
Class description:
An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards.
Method signatures and docs... | Implement the Python class `StorableObject` described below.
Class description:
An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards.
Method signatures and docs... | 946b7afdac16aef391ddd162daabfcc968eb9110 | <|skeleton|>
class StorableObject:
"""An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards."""
def dump(self, object_file, overwrite=None):
"""St... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class StorableObject:
"""An abstract "dumping" class. This means that it is basically useful for those who would like to extend this library. Basically, it gives the object the ability to be "dumped" on disk and be recovered afterwards."""
def dump(self, object_file, overwrite=None):
"""Stores the obje... | the_stack_v2_python_sparse | SBI/beans/StorableObject.py | structuralbioinformatics/SPServer | train | 3 |
692e281bc1b15c2b203422cad166b68cb6e91216 | [
"params = dict()\nparams['applicationguid'] = applicationguid\nreturn q.workflowengine.actionmanager.startActorAction('ras', 'initialize', params, jobguid=jobguid, executionparams=executionparams)",
"params = dict()\nparams['sourceport'] = sourceport\nparams['destinationmachineguid'] = destinationmachineguid\npar... | <|body_start_0|>
params = dict()
params['applicationguid'] = applicationguid
return q.workflowengine.actionmanager.startActorAction('ras', 'initialize', params, jobguid=jobguid, executionparams=executionparams)
<|end_body_0|>
<|body_start_1|>
params = dict()
params['sourceport']... | ras | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ras:
def initialize(self, applicationguid, jobguid='', executionparams={}):
"""Configures the ras service to be ready to use in the cloud. @param applicationguid: Guid of the application of which to initialize the RAS service @type applicationguid: guid @param jobguid: Guid of the job @t... | stack_v2_sparse_classes_10k_train_002699 | 6,543 | no_license | [
{
"docstring": "Configures the ras service to be ready to use in the cloud. @param applicationguid: Guid of the application of which to initialize the RAS service @type applicationguid: guid @param jobguid: Guid of the job @type jobguid: guid @param executionparams: dictionary with additional executionparams @t... | 4 | stack_v2_sparse_classes_30k_train_001090 | Implement the Python class `ras` described below.
Class description:
Implement the ras class.
Method signatures and docstrings:
- def initialize(self, applicationguid, jobguid='', executionparams={}): Configures the ras service to be ready to use in the cloud. @param applicationguid: Guid of the application of which ... | Implement the Python class `ras` described below.
Class description:
Implement the ras class.
Method signatures and docstrings:
- def initialize(self, applicationguid, jobguid='', executionparams={}): Configures the ras service to be ready to use in the cloud. @param applicationguid: Guid of the application of which ... | 53d349fa6bee0ccead29afd6676979b44c109a61 | <|skeleton|>
class ras:
def initialize(self, applicationguid, jobguid='', executionparams={}):
"""Configures the ras service to be ready to use in the cloud. @param applicationguid: Guid of the application of which to initialize the RAS service @type applicationguid: guid @param jobguid: Guid of the job @t... | stack_v2_sparse_classes_10k | data/stack_v2_sparse_classes_30k | class ras:
def initialize(self, applicationguid, jobguid='', executionparams={}):
"""Configures the ras service to be ready to use in the cloud. @param applicationguid: Guid of the application of which to initialize the RAS service @type applicationguid: guid @param jobguid: Guid of the job @type jobguid: g... | the_stack_v2_python_sparse | apps/cloud_api_generator/actor/ras.py | racktivity/ext-pylabs-core | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.