blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1209066ef8157b43915fdb793604480119fc91c5 | [
"state_spec = alf.nest.map_structure(lambda spec: alf.TensorSpec((n,) + spec.shape, spec.dtype), network.state_spec)\nname = name if name else 'naive_parallel_%s' % network.name\nsuper().__init__(network.input_tensor_spec, state_spec=state_spec, name=name)\nself._networks = nn.ModuleList([network.copy(name=self.nam... | <|body_start_0|>
state_spec = alf.nest.map_structure(lambda spec: alf.TensorSpec((n,) + spec.shape, spec.dtype), network.state_spec)
name = name if name else 'naive_parallel_%s' % network.name
super().__init__(network.input_tensor_spec, state_spec=state_spec, name=name)
self._networks = ... | Naive implementation of parallel network. | NaiveParallelNetwork | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NaiveParallelNetwork:
"""Naive implementation of parallel network."""
def __init__(self, network, n, name=None):
"""A parallel network has ``n`` copies of network with the same structure but different indepently initialized parameters. ``NaiveParallelNetwork`` created ``n`` independe... | stack_v2_sparse_classes_75kplus_train_067800 | 17,347 | permissive | [
{
"docstring": "A parallel network has ``n`` copies of network with the same structure but different indepently initialized parameters. ``NaiveParallelNetwork`` created ``n`` independent networks with the same structure as ``network`` and evaluate them separately in loop during ``forward()``. Args: network (Net... | 2 | null | Implement the Python class `NaiveParallelNetwork` described below.
Class description:
Naive implementation of parallel network.
Method signatures and docstrings:
- def __init__(self, network, n, name=None): A parallel network has ``n`` copies of network with the same structure but different indepently initialized par... | Implement the Python class `NaiveParallelNetwork` described below.
Class description:
Naive implementation of parallel network.
Method signatures and docstrings:
- def __init__(self, network, n, name=None): A parallel network has ``n`` copies of network with the same structure but different indepently initialized par... | b00ff2fa5e660de31020338ba340263183fbeaa4 | <|skeleton|>
class NaiveParallelNetwork:
"""Naive implementation of parallel network."""
def __init__(self, network, n, name=None):
"""A parallel network has ``n`` copies of network with the same structure but different indepently initialized parameters. ``NaiveParallelNetwork`` created ``n`` independe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NaiveParallelNetwork:
"""Naive implementation of parallel network."""
def __init__(self, network, n, name=None):
"""A parallel network has ``n`` copies of network with the same structure but different indepently initialized parameters. ``NaiveParallelNetwork`` created ``n`` independent networks w... | the_stack_v2_python_sparse | alf/networks/network.py | HorizonRobotics/alf | train | 288 |
7650ecfebbddf9cf2df44436335096637af0a5d0 | [
"super().__init__(apply_sd, apply_ls, apply_svls, apply_mask, class_weights, edge_weight)\nself.alpha = alpha\nself.gamma = gamma\nself.eps = 1e-08",
"input_soft = F.softmax(yhat, dim=1) + self.eps\nnum_classes = yhat.shape[1]\ntarget_one_hot = tensor_one_hot(target, num_classes)\nassert target_one_hot.shape == y... | <|body_start_0|>
super().__init__(apply_sd, apply_ls, apply_svls, apply_mask, class_weights, edge_weight)
self.alpha = alpha
self.gamma = gamma
self.eps = 1e-08
<|end_body_0|>
<|body_start_1|>
input_soft = F.softmax(yhat, dim=1) + self.eps
num_classes = yhat.shape[1]
... | FocalLoss | [
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FocalLoss:
def __init__(self, alpha: float=0.5, gamma: float=2.0, apply_sd: bool=False, apply_ls: bool=False, apply_svls: bool=False, apply_mask: bool=False, edge_weight: float=None, class_weights: torch.Tensor=None, **kwargs) -> None:
"""Focal loss. https://arxiv.org/abs/1708.02002 Opti... | stack_v2_sparse_classes_75kplus_train_067801 | 3,788 | permissive | [
{
"docstring": "Focal loss. https://arxiv.org/abs/1708.02002 Optionally applies, label smoothing, spatially varying label smoothing or weights at the object edges or class weights to the loss. Parameters ---------- alpha : float, default=0.5 Weight factor b/w [0,1]. gamma : float, default=2.0 Focusing factor. a... | 2 | stack_v2_sparse_classes_30k_val_000418 | Implement the Python class `FocalLoss` described below.
Class description:
Implement the FocalLoss class.
Method signatures and docstrings:
- def __init__(self, alpha: float=0.5, gamma: float=2.0, apply_sd: bool=False, apply_ls: bool=False, apply_svls: bool=False, apply_mask: bool=False, edge_weight: float=None, clas... | Implement the Python class `FocalLoss` described below.
Class description:
Implement the FocalLoss class.
Method signatures and docstrings:
- def __init__(self, alpha: float=0.5, gamma: float=2.0, apply_sd: bool=False, apply_ls: bool=False, apply_svls: bool=False, apply_mask: bool=False, edge_weight: float=None, clas... | 7f79405012eb934b419bbdba8de23f35e840ca85 | <|skeleton|>
class FocalLoss:
def __init__(self, alpha: float=0.5, gamma: float=2.0, apply_sd: bool=False, apply_ls: bool=False, apply_svls: bool=False, apply_mask: bool=False, edge_weight: float=None, class_weights: torch.Tensor=None, **kwargs) -> None:
"""Focal loss. https://arxiv.org/abs/1708.02002 Opti... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FocalLoss:
def __init__(self, alpha: float=0.5, gamma: float=2.0, apply_sd: bool=False, apply_ls: bool=False, apply_svls: bool=False, apply_mask: bool=False, edge_weight: float=None, class_weights: torch.Tensor=None, **kwargs) -> None:
"""Focal loss. https://arxiv.org/abs/1708.02002 Optionally applies... | the_stack_v2_python_sparse | cellseg_models_pytorch/losses/criterions/focal.py | okunator/cellseg_models.pytorch | train | 43 | |
d0001782d71f7f067b1ce90db03942cf721f663c | [
"if max_value % triangle_span != 0:\n max_value = (max_value // triangle_span + 1) * triangle_span\nn_nodes_half = int(max_value / triangle_span)\nn_nodes = n_nodes_half * 2 + 1\ncoding = tf.zeros((n_nodes,), dtype=tf.float32, name='ingametime')\nself.n_nodes_python = n_nodes\nself.n_nodes = tf.constant(n_nodes,... | <|body_start_0|>
if max_value % triangle_span != 0:
max_value = (max_value // triangle_span + 1) * triangle_span
n_nodes_half = int(max_value / triangle_span)
n_nodes = n_nodes_half * 2 + 1
coding = tf.zeros((n_nodes,), dtype=tf.float32, name='ingametime')
self.n_node... | TriangularValueEncoding | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TriangularValueEncoding:
def __init__(self, max_value: int, triangle_span: int):
"""Encodes an integer value with range [0, max_value] as multiple activations between 0 and 1 via triangles of width triangle_span; LSTM profits from having an integer input with large range split into multi... | stack_v2_sparse_classes_75kplus_train_067802 | 8,557 | permissive | [
{
"docstring": "Encodes an integer value with range [0, max_value] as multiple activations between 0 and 1 via triangles of width triangle_span; LSTM profits from having an integer input with large range split into multiple input nodes; This class encodes an integer as multiple nodes with activations of range [... | 2 | stack_v2_sparse_classes_30k_train_046581 | Implement the Python class `TriangularValueEncoding` described below.
Class description:
Implement the TriangularValueEncoding class.
Method signatures and docstrings:
- def __init__(self, max_value: int, triangle_span: int): Encodes an integer value with range [0, max_value] as multiple activations between 0 and 1 v... | Implement the Python class `TriangularValueEncoding` described below.
Class description:
Implement the TriangularValueEncoding class.
Method signatures and docstrings:
- def __init__(self, max_value: int, triangle_span: int): Encodes an integer value with range [0, max_value] as multiple activations between 0 and 1 v... | c4c71b59c034f4ec894580943e161c2971a92035 | <|skeleton|>
class TriangularValueEncoding:
def __init__(self, max_value: int, triangle_span: int):
"""Encodes an integer value with range [0, max_value] as multiple activations between 0 and 1 via triangles of width triangle_span; LSTM profits from having an integer input with large range split into multi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TriangularValueEncoding:
def __init__(self, max_value: int, triangle_span: int):
"""Encodes an integer value with range [0, max_value] as multiple activations between 0 and 1 via triangles of width triangle_span; LSTM profits from having an integer input with large range split into multiple input node... | the_stack_v2_python_sparse | TeLL/utility/misc_tensorflow.py | Sergiodiaz53/tensorflow-layer-library | train | 0 | |
4bc1c7956d246798c6432acedc08f32fae3b718b | [
"if self._disk_subformat is None:\n with open(self.path, 'rb') as fileobj:\n header = fileobj.read(1000).decode('ascii', 'ignore')\n match = re.search('createType=\"(.*)\"', header)\n if not match:\n raise RuntimeError(\"Could not find VMDK 'createType' in the file header:\\n{0}\".format(head... | <|body_start_0|>
if self._disk_subformat is None:
with open(self.path, 'rb') as fileobj:
header = fileobj.read(1000).decode('ascii', 'ignore')
match = re.search('createType="(.*)"', header)
if not match:
raise RuntimeError("Could not find VMDK ... | VMDK disk image file representation. | VMDK | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VMDK:
"""VMDK disk image file representation."""
def disk_subformat(self):
"""Disk subformat, such as 'streamOptimized'."""
<|body_0|>
def from_other_image(cls, input_image, output_dir, output_subformat='streamOptimized'):
"""Convert the other disk image into an ... | stack_v2_sparse_classes_75kplus_train_067803 | 7,641 | permissive | [
{
"docstring": "Disk subformat, such as 'streamOptimized'.",
"name": "disk_subformat",
"signature": "def disk_subformat(self)"
},
{
"docstring": "Convert the other disk image into an image of this type. Args: input_image (DiskRepresentation): Existing image representation. output_dir (str): Outp... | 3 | stack_v2_sparse_classes_30k_train_033591 | Implement the Python class `VMDK` described below.
Class description:
VMDK disk image file representation.
Method signatures and docstrings:
- def disk_subformat(self): Disk subformat, such as 'streamOptimized'.
- def from_other_image(cls, input_image, output_dir, output_subformat='streamOptimized'): Convert the othe... | Implement the Python class `VMDK` described below.
Class description:
VMDK disk image file representation.
Method signatures and docstrings:
- def disk_subformat(self): Disk subformat, such as 'streamOptimized'.
- def from_other_image(cls, input_image, output_dir, output_subformat='streamOptimized'): Convert the othe... | 0811b96311881a8293f28f2e300f6bed1b77ee31 | <|skeleton|>
class VMDK:
"""VMDK disk image file representation."""
def disk_subformat(self):
"""Disk subformat, such as 'streamOptimized'."""
<|body_0|>
def from_other_image(cls, input_image, output_dir, output_subformat='streamOptimized'):
"""Convert the other disk image into an ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VMDK:
"""VMDK disk image file representation."""
def disk_subformat(self):
"""Disk subformat, such as 'streamOptimized'."""
if self._disk_subformat is None:
with open(self.path, 'rb') as fileobj:
header = fileobj.read(1000).decode('ascii', 'ignore')
... | the_stack_v2_python_sparse | COT/disks/vmdk.py | glennmatthews/cot | train | 88 |
ba797cf4e696070a9240441f7f0833ca0ee4238a | [
"gaps, ranges, time = dc.detectGaps(gapFactor=10)\nfor r in ranges:\n t = time[r[0]:r[1] + 1]\n zCoord = dc.z\n var = np.squeeze(dc.data[:, iField, r[0]:r[1] + 1])\n profileTimeSeries.addSample(self, t, zCoord, var, **kwargs)",
"gaps, ranges, time = dc.detectGaps(gapFactor=10)\nfor r in ranges:\n t... | <|body_start_0|>
gaps, ranges, time = dc.detectGaps(gapFactor=10)
for r in ranges:
t = time[r[0]:r[1] + 1]
zCoord = dc.z
var = np.squeeze(dc.data[:, iField, r[0]:r[1] + 1])
profileTimeSeries.addSample(self, t, zCoord, var, **kwargs)
<|end_body_0|>
<|body_... | profileTimeSeriesDC | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class profileTimeSeriesDC:
def addSample(self, dc, iField=0, **kwargs):
"""Add profile time series"""
<|body_0|>
def addOverlay(self, dc, iField=0, **kwargs):
"""Overlay time series on plot"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
gaps, ranges, tim... | stack_v2_sparse_classes_75kplus_train_067804 | 11,640 | no_license | [
{
"docstring": "Add profile time series",
"name": "addSample",
"signature": "def addSample(self, dc, iField=0, **kwargs)"
},
{
"docstring": "Overlay time series on plot",
"name": "addOverlay",
"signature": "def addOverlay(self, dc, iField=0, **kwargs)"
}
] | 2 | null | Implement the Python class `profileTimeSeriesDC` described below.
Class description:
Implement the profileTimeSeriesDC class.
Method signatures and docstrings:
- def addSample(self, dc, iField=0, **kwargs): Add profile time series
- def addOverlay(self, dc, iField=0, **kwargs): Overlay time series on plot | Implement the Python class `profileTimeSeriesDC` described below.
Class description:
Implement the profileTimeSeriesDC class.
Method signatures and docstrings:
- def addSample(self, dc, iField=0, **kwargs): Add profile time series
- def addOverlay(self, dc, iField=0, **kwargs): Overlay time series on plot
<|skeleton... | b8313d0373d8206685d81aadccc425e432c6a010 | <|skeleton|>
class profileTimeSeriesDC:
def addSample(self, dc, iField=0, **kwargs):
"""Add profile time series"""
<|body_0|>
def addOverlay(self, dc, iField=0, **kwargs):
"""Overlay time series on plot"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class profileTimeSeriesDC:
def addSample(self, dc, iField=0, **kwargs):
"""Add profile time series"""
gaps, ranges, time = dc.detectGaps(gapFactor=10)
for r in ranges:
t = time[r[0]:r[1] + 1]
zCoord = dc.z
var = np.squeeze(dc.data[:, iField, r[0]:r[1] + 1]... | the_stack_v2_python_sparse | crane/plotting/profilePlot.py | tkarna/crane | train | 1 | |
a3f66ede47443dce5335f74b6965c1ba65079b65 | [
"super().__init__()\nif num_samples is None:\n num_samples = 10\n warnings.warn('num_samples not provided, defaulting to {}'.format(num_samples))\nif guide is None:\n guide = poutine.block(model, hide_types=['observe'])\nself.num_samples = num_samples\nself.model = model\nself.guide = guide",
"for i in r... | <|body_start_0|>
super().__init__()
if num_samples is None:
num_samples = 10
warnings.warn('num_samples not provided, defaulting to {}'.format(num_samples))
if guide is None:
guide = poutine.block(model, hide_types=['observe'])
self.num_samples = num_s... | :param model: probabilistic model defined as a function :param guide: guide used for sampling defined as a function :param num_samples: number of samples to draw from the guide (default 10) This method performs posterior inference by importance sampling using the guide as the proposal distribution. If no guide is provi... | Importance | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Importance:
""":param model: probabilistic model defined as a function :param guide: guide used for sampling defined as a function :param num_samples: number of samples to draw from the guide (default 10) This method performs posterior inference by importance sampling using the guide as the propo... | stack_v2_sparse_classes_75kplus_train_067805 | 9,701 | permissive | [
{
"docstring": "Constructor. default to num_samples = 10, guide = model",
"name": "__init__",
"signature": "def __init__(self, model, guide=None, num_samples=None)"
},
{
"docstring": "Generator of weighted samples from the proposal distribution.",
"name": "_traces",
"signature": "def _tr... | 5 | stack_v2_sparse_classes_30k_train_016512 | Implement the Python class `Importance` described below.
Class description:
:param model: probabilistic model defined as a function :param guide: guide used for sampling defined as a function :param num_samples: number of samples to draw from the guide (default 10) This method performs posterior inference by importanc... | Implement the Python class `Importance` described below.
Class description:
:param model: probabilistic model defined as a function :param guide: guide used for sampling defined as a function :param num_samples: number of samples to draw from the guide (default 10) This method performs posterior inference by importanc... | 0e82cad30f75b892a07e6c9a5f9e24f2cb5d0d81 | <|skeleton|>
class Importance:
""":param model: probabilistic model defined as a function :param guide: guide used for sampling defined as a function :param num_samples: number of samples to draw from the guide (default 10) This method performs posterior inference by importance sampling using the guide as the propo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Importance:
""":param model: probabilistic model defined as a function :param guide: guide used for sampling defined as a function :param num_samples: number of samples to draw from the guide (default 10) This method performs posterior inference by importance sampling using the guide as the proposal distribut... | the_stack_v2_python_sparse | pyro/infer/importance.py | pyro-ppl/pyro | train | 3,647 |
c3ff6f17591fdd0e8e2e21dd2f07224f889835c4 | [
"if not re.match('^1[3-9]\\\\d{9}$', value):\n raise serializers.ValidationError('手机号不合法')\nreturn value",
"if value != 'true':\n raise serializers.ValidationError('请同意协议')\nreturn value",
"password = attrs['password']\npassword2 = attrs['password2']\nif password != password2:\n raise serializers.Valid... | <|body_start_0|>
if not re.match('^1[3-9]\\d{9}$', value):
raise serializers.ValidationError('手机号不合法')
return value
<|end_body_0|>
<|body_start_1|>
if value != 'true':
raise serializers.ValidationError('请同意协议')
return value
<|end_body_1|>
<|body_start_2|>
... | CreateUserSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateUserSerializer:
def validate_mobile(self, value):
"""手机号是否合法"""
<|body_0|>
def validate_allow(self, value):
"""是否同意协议"""
<|body_1|>
def validate(self, attrs):
"""两次密码是否一致,短信验证码是否正确"""
<|body_2|>
def create(self, validated_data)... | stack_v2_sparse_classes_75kplus_train_067806 | 7,626 | no_license | [
{
"docstring": "手机号是否合法",
"name": "validate_mobile",
"signature": "def validate_mobile(self, value)"
},
{
"docstring": "是否同意协议",
"name": "validate_allow",
"signature": "def validate_allow(self, value)"
},
{
"docstring": "两次密码是否一致,短信验证码是否正确",
"name": "validate",
"signature... | 4 | stack_v2_sparse_classes_30k_train_025377 | Implement the Python class `CreateUserSerializer` described below.
Class description:
Implement the CreateUserSerializer class.
Method signatures and docstrings:
- def validate_mobile(self, value): 手机号是否合法
- def validate_allow(self, value): 是否同意协议
- def validate(self, attrs): 两次密码是否一致,短信验证码是否正确
- def create(self, val... | Implement the Python class `CreateUserSerializer` described below.
Class description:
Implement the CreateUserSerializer class.
Method signatures and docstrings:
- def validate_mobile(self, value): 手机号是否合法
- def validate_allow(self, value): 是否同意协议
- def validate(self, attrs): 两次密码是否一致,短信验证码是否正确
- def create(self, val... | fa58d99b66b31cf6ce8919357b556d20309f1cbf | <|skeleton|>
class CreateUserSerializer:
def validate_mobile(self, value):
"""手机号是否合法"""
<|body_0|>
def validate_allow(self, value):
"""是否同意协议"""
<|body_1|>
def validate(self, attrs):
"""两次密码是否一致,短信验证码是否正确"""
<|body_2|>
def create(self, validated_data)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreateUserSerializer:
def validate_mobile(self, value):
"""手机号是否合法"""
if not re.match('^1[3-9]\\d{9}$', value):
raise serializers.ValidationError('手机号不合法')
return value
def validate_allow(self, value):
"""是否同意协议"""
if value != 'true':
raise ... | the_stack_v2_python_sparse | meiduo_mall/meiduo_mall/apps/users/serializers.py | yjz111/meiduo | train | 0 | |
80c2eaddcd0ec49f6763834b695024faf6c9aa13 | [
"self.create_review_request(summary='Test 1', publish=True)\nself.create_review_request(summary='Test 2', publish=True)\nself.create_review_request(summary='Test 3', publish=True)\nself.client.login(username='grumpy', password='grumpy')\nresponse = self.client.get('/r/')\nself.assertEqual(response.status_code, 200)... | <|body_start_0|>
self.create_review_request(summary='Test 1', publish=True)
self.create_review_request(summary='Test 2', publish=True)
self.create_review_request(summary='Test 3', publish=True)
self.client.login(username='grumpy', password='grumpy')
response = self.client.get('/r... | Unit tests for the all_review_requests view. | AllReviewRequestViewTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllReviewRequestViewTests:
"""Unit tests for the all_review_requests view."""
def test_with_access(self):
"""Testing all_review_requests view"""
<|body_0|>
def test_as_anonymous_and_redirect(self):
"""Testing all_review_requests view as anonymous user with anonym... | stack_v2_sparse_classes_75kplus_train_067807 | 49,494 | permissive | [
{
"docstring": "Testing all_review_requests view",
"name": "test_with_access",
"signature": "def test_with_access(self)"
},
{
"docstring": "Testing all_review_requests view as anonymous user with anonymous access disabled",
"name": "test_as_anonymous_and_redirect",
"signature": "def test... | 4 | stack_v2_sparse_classes_30k_train_008853 | Implement the Python class `AllReviewRequestViewTests` described below.
Class description:
Unit tests for the all_review_requests view.
Method signatures and docstrings:
- def test_with_access(self): Testing all_review_requests view
- def test_as_anonymous_and_redirect(self): Testing all_review_requests view as anony... | Implement the Python class `AllReviewRequestViewTests` described below.
Class description:
Unit tests for the all_review_requests view.
Method signatures and docstrings:
- def test_with_access(self): Testing all_review_requests view
- def test_as_anonymous_and_redirect(self): Testing all_review_requests view as anony... | 563c1e8d4dfd860f372281dc0f380a0809f6ae15 | <|skeleton|>
class AllReviewRequestViewTests:
"""Unit tests for the all_review_requests view."""
def test_with_access(self):
"""Testing all_review_requests view"""
<|body_0|>
def test_as_anonymous_and_redirect(self):
"""Testing all_review_requests view as anonymous user with anonym... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AllReviewRequestViewTests:
"""Unit tests for the all_review_requests view."""
def test_with_access(self):
"""Testing all_review_requests view"""
self.create_review_request(summary='Test 1', publish=True)
self.create_review_request(summary='Test 2', publish=True)
self.creat... | the_stack_v2_python_sparse | reviewboard/datagrids/tests.py | LloydFinch/reviewboard | train | 2 |
d214fb4ce6cc323b5836ded99adda0ebaee202f7 | [
"for d in bp.Policy.ACTIONS:\n new_pos = pos.move(bp.Policy.TURNS[direction][d])\n if board[new_pos[0], new_pos[1]] == obj_num:\n return 1\nreturn 0",
"features_for_pos = np.zeros(11 * 2)\nboard, head = new_state\nhead_pos, direction = head\nnext_direction = bp.Policy.TURNS[direction][action]\nnext_p... | <|body_start_0|>
for d in bp.Policy.ACTIONS:
new_pos = pos.move(bp.Policy.TURNS[direction][d])
if board[new_pos[0], new_pos[1]] == obj_num:
return 1
return 0
<|end_body_0|>
<|body_start_1|>
features_for_pos = np.zeros(11 * 2)
board, head = new_sta... | Feature2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Feature2:
def obj_in_pos(pos, direction, obj_num, board):
"""Checks if obj_num is around the given position and return 0 or 1 according the result :param pos: current position :param direction: current direction :param obj_num: number of the object :param board: board :return: 0 or 1"""
... | stack_v2_sparse_classes_75kplus_train_067808 | 1,452 | no_license | [
{
"docstring": "Checks if obj_num is around the given position and return 0 or 1 according the result :param pos: current position :param direction: current direction :param obj_num: number of the object :param board: board :return: 0 or 1",
"name": "obj_in_pos",
"signature": "def obj_in_pos(pos, direct... | 2 | null | Implement the Python class `Feature2` described below.
Class description:
Implement the Feature2 class.
Method signatures and docstrings:
- def obj_in_pos(pos, direction, obj_num, board): Checks if obj_num is around the given position and return 0 or 1 according the result :param pos: current position :param directio... | Implement the Python class `Feature2` described below.
Class description:
Implement the Feature2 class.
Method signatures and docstrings:
- def obj_in_pos(pos, direction, obj_num, board): Checks if obj_num is around the given position and return 0 or 1 according the result :param pos: current position :param directio... | d42d64300da96ac3c9c5378b1faba9693e93f14d | <|skeleton|>
class Feature2:
def obj_in_pos(pos, direction, obj_num, board):
"""Checks if obj_num is around the given position and return 0 or 1 according the result :param pos: current position :param direction: current direction :param obj_num: number of the object :param board: board :return: 0 or 1"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Feature2:
def obj_in_pos(pos, direction, obj_num, board):
"""Checks if obj_num is around the given position and return 0 or 1 according the result :param pos: current position :param direction: current direction :param obj_num: number of the object :param board: board :return: 0 or 1"""
for d ... | the_stack_v2_python_sparse | policies/Feature2.py | LotanLevy/snake_game | train | 0 | |
030e56909adbee6c5f81d0c796437ce7e5d77313 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.iosMobileAppConfiguration'.casefold():\n ... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
try:
mapping_value = parse_node.get_child_node('@odata.type').get_str_value()
except AttributeError:
mapping_value = None
if mapping_value and mapping_value.casefold() ==... | An abstract class for Mobile app configuration for enrolled devices. | ManagedDeviceMobileAppConfiguration | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ManagedDeviceMobileAppConfiguration:
"""An abstract class for Mobile app configuration for enrolled devices."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedDeviceMobileAppConfiguration:
"""Creates a new instance of the appropriate class based o... | stack_v2_sparse_classes_75kplus_train_067809 | 7,877 | 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: ManagedDeviceMobileAppConfiguration",
"name": "create_from_discriminator_value",
"signature": "def create_fr... | 3 | stack_v2_sparse_classes_30k_train_013459 | Implement the Python class `ManagedDeviceMobileAppConfiguration` described below.
Class description:
An abstract class for Mobile app configuration for enrolled devices.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedDeviceMobileAppConfiguration... | Implement the Python class `ManagedDeviceMobileAppConfiguration` described below.
Class description:
An abstract class for Mobile app configuration for enrolled devices.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedDeviceMobileAppConfiguration... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ManagedDeviceMobileAppConfiguration:
"""An abstract class for Mobile app configuration for enrolled devices."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedDeviceMobileAppConfiguration:
"""Creates a new instance of the appropriate class based o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ManagedDeviceMobileAppConfiguration:
"""An abstract class for Mobile app configuration for enrolled devices."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ManagedDeviceMobileAppConfiguration:
"""Creates a new instance of the appropriate class based on discriminat... | the_stack_v2_python_sparse | msgraph/generated/models/managed_device_mobile_app_configuration.py | microsoftgraph/msgraph-sdk-python | train | 135 |
7c6e8b23f0a5942c17e27522ebf808b0310ca1fa | [
"allure.dynamic.title('Testing length function where head = None')\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('Enter test n... | <|body_start_0|>
allure.dynamic.title('Testing length function where head = None')
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 length function | LengthTestCase | [
"Unlicense",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LengthTestCase:
"""Testing length function"""
def test_length_none(self):
"""Testing length function where head = None The method length, which accepts a linked list (head), and returns the length of the list. :return:"""
<|body_0|>
def test_length(self):
"""Test... | stack_v2_sparse_classes_75kplus_train_067810 | 2,506 | permissive | [
{
"docstring": "Testing length function where head = None The method length, which accepts a linked list (head), and returns the length of the list. :return:",
"name": "test_length_none",
"signature": "def test_length_none(self)"
},
{
"docstring": "Testing length function The method length, whic... | 2 | stack_v2_sparse_classes_30k_train_014156 | Implement the Python class `LengthTestCase` described below.
Class description:
Testing length function
Method signatures and docstrings:
- def test_length_none(self): Testing length function where head = None The method length, which accepts a linked list (head), and returns the length of the list. :return:
- def te... | Implement the Python class `LengthTestCase` described below.
Class description:
Testing length function
Method signatures and docstrings:
- def test_length_none(self): Testing length function where head = None The method length, which accepts a linked list (head), and returns the length of the list. :return:
- def te... | ba3ea81125b6082d867f0ae34c6c9be15e153966 | <|skeleton|>
class LengthTestCase:
"""Testing length function"""
def test_length_none(self):
"""Testing length function where head = None The method length, which accepts a linked list (head), and returns the length of the list. :return:"""
<|body_0|>
def test_length(self):
"""Test... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LengthTestCase:
"""Testing length function"""
def test_length_none(self):
"""Testing length function where head = None The method length, which accepts a linked list (head), and returns the length of the list. :return:"""
allure.dynamic.title('Testing length function where head = None')
... | the_stack_v2_python_sparse | kyu_7/fun_with_lists_length/test_length.py | qamine-test/codewars | train | 0 |
b51e406eb5407c683aeb88af0c09e31f97b84e74 | [
"if self.action_type == Action.PERSONALIZED_TEXT or self.action_type == Action.RUBRIC_TEXT or self.action_type == Action.EMAIL_REPORT or (self.action_type == Action.JSON_REPORT) or (self.action_type == Action.PERSONALIZED_CANVAS_EMAIL and settings.CANVAS_INFO_DICT is not None):\n return None\nif self.action_type... | <|body_start_0|>
if self.action_type == Action.PERSONALIZED_TEXT or self.action_type == Action.RUBRIC_TEXT or self.action_type == Action.EMAIL_REPORT or (self.action_type == Action.JSON_REPORT) or (self.action_type == Action.PERSONALIZED_CANVAS_EMAIL and settings.CANVAS_INFO_DICT is not None):
retur... | Object storing an action: content, conditions, filter, etc. | Action | [
"LGPL-2.0-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LGPL-2.1-only",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Action:
"""Object storing an action: content, conditions, filter, etc."""
def is_executable(self) -> Optional[str]:
"""Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why."""
<|body_0|>
def log(self, user, operation_typ... | stack_v2_sparse_classes_75kplus_train_067811 | 18,431 | permissive | [
{
"docstring": "Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why.",
"name": "is_executable",
"signature": "def is_executable(self) -> Optional[str]"
},
{
"docstring": "Log the operation with the object.",
"name": "log",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_025228 | Implement the Python class `Action` described below.
Class description:
Object storing an action: content, conditions, filter, etc.
Method signatures and docstrings:
- def is_executable(self) -> Optional[str]: Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why.
- d... | Implement the Python class `Action` described below.
Class description:
Object storing an action: content, conditions, filter, etc.
Method signatures and docstrings:
- def is_executable(self) -> Optional[str]: Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why.
- d... | c432745dfff932cbe7397100422d49df78f0a882 | <|skeleton|>
class Action:
"""Object storing an action: content, conditions, filter, etc."""
def is_executable(self) -> Optional[str]:
"""Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why."""
<|body_0|>
def log(self, user, operation_typ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Action:
"""Object storing an action: content, conditions, filter, etc."""
def is_executable(self) -> Optional[str]:
"""Answer if an action is ready to execute. :return: None if it is executable, or a message explaining why."""
if self.action_type == Action.PERSONALIZED_TEXT or self.action... | the_stack_v2_python_sparse | ontask/models/action.py | abelardopardo/ontask_b | train | 43 |
f02f7536c6e04f28b9d402e281ecb4d675e095dc | [
"self.sealed_by = sealed_by\nself.sealed_timestamp = APIHelper.RFC3339DateTime(sealed_timestamp) if sealed_timestamp else None\nself.certificate = certificate\nself.seal_valid = seal_valid\nself.additional_properties = additional_properties",
"if dictionary is None:\n return None\nsealed_by = dictionary.get('s... | <|body_start_0|>
self.sealed_by = sealed_by
self.sealed_timestamp = APIHelper.RFC3339DateTime(sealed_timestamp) if sealed_timestamp else None
self.certificate = certificate
self.seal_valid = seal_valid
self.additional_properties = additional_properties
<|end_body_0|>
<|body_star... | Implementation of the 'Seal' model. TODO: type model description here. Attributes: sealed_by (string): TODO: type description here. sealed_timestamp (datetime): TODO: type description here. certificate (Certificate): TODO: type description here. seal_valid (bool): TODO: type description here. | Seal | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Seal:
"""Implementation of the 'Seal' model. TODO: type model description here. Attributes: sealed_by (string): TODO: type description here. sealed_timestamp (datetime): TODO: type description here. certificate (Certificate): TODO: type description here. seal_valid (bool): TODO: type description ... | stack_v2_sparse_classes_75kplus_train_067812 | 2,951 | permissive | [
{
"docstring": "Constructor for the Seal class",
"name": "__init__",
"signature": "def __init__(self, sealed_by=None, sealed_timestamp=None, certificate=None, seal_valid=None, additional_properties={})"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dict... | 2 | stack_v2_sparse_classes_30k_train_043017 | Implement the Python class `Seal` described below.
Class description:
Implementation of the 'Seal' model. TODO: type model description here. Attributes: sealed_by (string): TODO: type description here. sealed_timestamp (datetime): TODO: type description here. certificate (Certificate): TODO: type description here. sea... | Implement the Python class `Seal` described below.
Class description:
Implementation of the 'Seal' model. TODO: type model description here. Attributes: sealed_by (string): TODO: type description here. sealed_timestamp (datetime): TODO: type description here. certificate (Certificate): TODO: type description here. sea... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class Seal:
"""Implementation of the 'Seal' model. TODO: type model description here. Attributes: sealed_by (string): TODO: type description here. sealed_timestamp (datetime): TODO: type description here. certificate (Certificate): TODO: type description here. seal_valid (bool): TODO: type description ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Seal:
"""Implementation of the 'Seal' model. TODO: type model description here. Attributes: sealed_by (string): TODO: type description here. sealed_timestamp (datetime): TODO: type description here. certificate (Certificate): TODO: type description here. seal_valid (bool): TODO: type description here."""
... | the_stack_v2_python_sparse | idfy_rest_client/models/seal.py | dealflowteam/Idfy | train | 0 |
6cf3987ab86059dcda403513ba3b0e51ecd966c4 | [
"pipeBase.Task.__init__(self, *args, **kwargs)\nself._badPixelMask = MaskU.getPlaneBitMask(self.config.badMaskPlanes)\nself._statsControl = afwMath.StatisticsControl()\nself._statsControl.setNumSigmaClip(self.config.numSigmaClip)\nself._statsControl.setNumIter(self.config.numIter)\nself._statsControl.setAndMask(sel... | <|body_start_0|>
pipeBase.Task.__init__(self, *args, **kwargs)
self._badPixelMask = MaskU.getPlaneBitMask(self.config.badMaskPlanes)
self._statsControl = afwMath.StatisticsControl()
self._statsControl.setNumSigmaClip(self.config.numSigmaClip)
self._statsControl.setNumIter(self.co... | !Example task to compute sigma-clipped mean and standard deviation of an image \\section pipeTasks_ExampleSigmaClippedStatsTask_Contents Contents - ef pipeTasks_ExampleSigmaClippedStatsTask_Purpose - ef pipeTasks_ExampleSigmaClippedStatsTask_Config - ef pipeTasks_ExampleSigmaClippedStatsTask_Debug - ef pipeTasks_Exampl... | ExampleSigmaClippedStatsTask | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExampleSigmaClippedStatsTask:
"""!Example task to compute sigma-clipped mean and standard deviation of an image \\section pipeTasks_ExampleSigmaClippedStatsTask_Contents Contents - ef pipeTasks_ExampleSigmaClippedStatsTask_Purpose - ef pipeTasks_ExampleSigmaClippedStatsTask_Config - ef pipeTasks_... | stack_v2_sparse_classes_75kplus_train_067813 | 8,927 | no_license | [
{
"docstring": "!Construct an ExampleSigmaClippedStatsTask The init method may compute anything that that does not require data. In this case we create a statistics control object using the config (which cannot change once the task is created).",
"name": "__init__",
"signature": "def __init__(self, *arg... | 2 | null | Implement the Python class `ExampleSigmaClippedStatsTask` described below.
Class description:
!Example task to compute sigma-clipped mean and standard deviation of an image \\section pipeTasks_ExampleSigmaClippedStatsTask_Contents Contents - ef pipeTasks_ExampleSigmaClippedStatsTask_Purpose - ef pipeTasks_ExampleSigma... | Implement the Python class `ExampleSigmaClippedStatsTask` described below.
Class description:
!Example task to compute sigma-clipped mean and standard deviation of an image \\section pipeTasks_ExampleSigmaClippedStatsTask_Contents Contents - ef pipeTasks_ExampleSigmaClippedStatsTask_Purpose - ef pipeTasks_ExampleSigma... | 4aa99acb1adbd868263f7b465f8619ae343f197e | <|skeleton|>
class ExampleSigmaClippedStatsTask:
"""!Example task to compute sigma-clipped mean and standard deviation of an image \\section pipeTasks_ExampleSigmaClippedStatsTask_Contents Contents - ef pipeTasks_ExampleSigmaClippedStatsTask_Purpose - ef pipeTasks_ExampleSigmaClippedStatsTask_Config - ef pipeTasks_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExampleSigmaClippedStatsTask:
"""!Example task to compute sigma-clipped mean and standard deviation of an image \\section pipeTasks_ExampleSigmaClippedStatsTask_Contents Contents - ef pipeTasks_ExampleSigmaClippedStatsTask_Purpose - ef pipeTasks_ExampleSigmaClippedStatsTask_Config - ef pipeTasks_ExampleSigmaC... | the_stack_v2_python_sparse | python/lsst/pipe/tasks/exampleStatsTasks.py | DominiqueFouchez/pipe_tasks | train | 0 |
993b3e3652dc7eebbb9ce2ace77f83b1b4caed27 | [
"try:\n if not data['project_id'] or not data['url']:\n return JsonResponse(code='999996', msg='参数有误!')\n if not isinstance(data['project_id'], int):\n return JsonResponse(code='999996', msg='参数有误!')\nexcept KeyError:\n return JsonResponse(code='999996', msg='参数有误!')",
"data = JSONParser().... | <|body_start_0|>
try:
if not data['project_id'] or not data['url']:
return JsonResponse(code='999996', msg='参数有误!')
if not isinstance(data['project_id'], int):
return JsonResponse(code='999996', msg='参数有误!')
except KeyError:
return Json... | LeadSwagger | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LeadSwagger:
def parameter_check(self, data):
"""校验参数 :param data: :return:"""
<|body_0|>
def post(self, request):
"""导入swagger接口信息 :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
if not data['project_id'] o... | stack_v2_sparse_classes_75kplus_train_067814 | 47,841 | permissive | [
{
"docstring": "校验参数 :param data: :return:",
"name": "parameter_check",
"signature": "def parameter_check(self, data)"
},
{
"docstring": "导入swagger接口信息 :param request: :return:",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001710 | Implement the Python class `LeadSwagger` described below.
Class description:
Implement the LeadSwagger class.
Method signatures and docstrings:
- def parameter_check(self, data): 校验参数 :param data: :return:
- def post(self, request): 导入swagger接口信息 :param request: :return: | Implement the Python class `LeadSwagger` described below.
Class description:
Implement the LeadSwagger class.
Method signatures and docstrings:
- def parameter_check(self, data): 校验参数 :param data: :return:
- def post(self, request): 导入swagger接口信息 :param request: :return:
<|skeleton|>
class LeadSwagger:
def para... | 6d08f58fa6985415ef7beae733e6f8147026806e | <|skeleton|>
class LeadSwagger:
def parameter_check(self, data):
"""校验参数 :param data: :return:"""
<|body_0|>
def post(self, request):
"""导入swagger接口信息 :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LeadSwagger:
def parameter_check(self, data):
"""校验参数 :param data: :return:"""
try:
if not data['project_id'] or not data['url']:
return JsonResponse(code='999996', msg='参数有误!')
if not isinstance(data['project_id'], int):
return JsonRespo... | the_stack_v2_python_sparse | api_test/api/ApiDoc.py | yourant/tapi | train | 0 | |
2dc784993669e5e4178f6ddf5b3188731b4f8ee3 | [
"self.image = pygame.image.load('resources/Horizon_GroundSky.png').convert()\nself.frameImage = pygame.image.load('resources/Horizon_Background.png').convert()\nself.maquetteImage = pygame.image.load('resources/Maquette_Avion.png').convert()\nDial.__init__(self, self.image, self.frameImage, x, y, w, h)",
"angleX ... | <|body_start_0|>
self.image = pygame.image.load('resources/Horizon_GroundSky.png').convert()
self.frameImage = pygame.image.load('resources/Horizon_Background.png').convert()
self.maquetteImage = pygame.image.load('resources/Maquette_Avion.png').convert()
Dial.__init__(self, self.image, ... | Artificial horizon dial. | Horizon | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Horizon:
"""Artificial horizon dial."""
def __init__(self, x=0, y=0, w=0, h=0):
"""Initialise dial at x,y. Default size of 300px can be overidden using w,h."""
<|body_0|>
def update(self, screen, angleX, angleY):
"""Called to update an Artificial horizon dial. "a... | stack_v2_sparse_classes_75kplus_train_067815 | 18,287 | no_license | [
{
"docstring": "Initialise dial at x,y. Default size of 300px can be overidden using w,h.",
"name": "__init__",
"signature": "def __init__(self, x=0, y=0, w=0, h=0)"
},
{
"docstring": "Called to update an Artificial horizon dial. \"angleX\" and \"angleY\" are the inputs. \"screen\" is the surfac... | 2 | stack_v2_sparse_classes_30k_train_003404 | Implement the Python class `Horizon` described below.
Class description:
Artificial horizon dial.
Method signatures and docstrings:
- def __init__(self, x=0, y=0, w=0, h=0): Initialise dial at x,y. Default size of 300px can be overidden using w,h.
- def update(self, screen, angleX, angleY): Called to update an Artifi... | Implement the Python class `Horizon` described below.
Class description:
Artificial horizon dial.
Method signatures and docstrings:
- def __init__(self, x=0, y=0, w=0, h=0): Initialise dial at x,y. Default size of 300px can be overidden using w,h.
- def update(self, screen, angleX, angleY): Called to update an Artifi... | 60520a770d935e5dc40cc92940e01c378b2df610 | <|skeleton|>
class Horizon:
"""Artificial horizon dial."""
def __init__(self, x=0, y=0, w=0, h=0):
"""Initialise dial at x,y. Default size of 300px can be overidden using w,h."""
<|body_0|>
def update(self, screen, angleX, angleY):
"""Called to update an Artificial horizon dial. "a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Horizon:
"""Artificial horizon dial."""
def __init__(self, x=0, y=0, w=0, h=0):
"""Initialise dial at x,y. Default size of 300px can be overidden using w,h."""
self.image = pygame.image.load('resources/Horizon_GroundSky.png').convert()
self.frameImage = pygame.image.load('resource... | the_stack_v2_python_sparse | code/python/dials.py | MarkAhlbrecht/DasBoot | train | 2 |
414066553086dd0ceb7e4a5861656b1c1695ed38 | [
"super(UserApplicationChangeForm, self).__init__(data=data, initial=initial, instance=instance)\nlocal_site_field = self.fields['local_site']\nlocal_site_field.queryset = LocalSite.objects.filter(users=user)\nlocal_site_field.widget.attrs['disabled'] = True",
"super(UserApplicationChangeForm, self).clean()\nif 'l... | <|body_start_0|>
super(UserApplicationChangeForm, self).__init__(data=data, initial=initial, instance=instance)
local_site_field = self.fields['local_site']
local_site_field.queryset = LocalSite.objects.filter(users=user)
local_site_field.widget.attrs['disabled'] = True
<|end_body_0|>
<... | A form for an end user to change an Application. | UserApplicationChangeForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserApplicationChangeForm:
"""A form for an end user to change an Application."""
def __init__(self, user, data=None, initial=None, instance=None):
"""Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:met... | stack_v2_sparse_classes_75kplus_train_067816 | 13,782 | permissive | [
{
"docstring": "Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`UserApplicationCreationForm.__init__`. data (dict): The provided data. initial (dict, optional): The initial form values. instance (reviewboard.oauth.models.App... | 2 | stack_v2_sparse_classes_30k_train_044514 | Implement the Python class `UserApplicationChangeForm` described below.
Class description:
A form for an end user to change an Application.
Method signatures and docstrings:
- def __init__(self, user, data=None, initial=None, instance=None): Initialize the form. Args: user (django.contrib.auth.models.User): The user ... | Implement the Python class `UserApplicationChangeForm` described below.
Class description:
A form for an end user to change an Application.
Method signatures and docstrings:
- def __init__(self, user, data=None, initial=None, instance=None): Initialize the form. Args: user (django.contrib.auth.models.User): The user ... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class UserApplicationChangeForm:
"""A form for an end user to change an Application."""
def __init__(self, user, data=None, initial=None, instance=None):
"""Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:met... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserApplicationChangeForm:
"""A form for an end user to change an Application."""
def __init__(self, user, data=None, initial=None, instance=None):
"""Initialize the form. Args: user (django.contrib.auth.models.User): The user changing the form. Ignored, but included to match :py:meth:`UserApplic... | the_stack_v2_python_sparse | reviewboard/oauth/forms.py | reviewboard/reviewboard | train | 1,141 |
288a7a869273e2890ad9a830660f26a62ebe3230 | [
"await self._async_send_command(self._power_on_command)\nself._attr_is_on = True\nself.async_write_ha_state()",
"await self._async_send_command(self._power_off_command)\nself._attr_is_on = False\nself.async_write_ha_state()",
"if len(status) != 4:\n return\nstate = status[0]\nself._attr_is_on = state == '1'"... | <|body_start_0|>
await self._async_send_command(self._power_on_command)
self._attr_is_on = True
self.async_write_ha_state()
<|end_body_0|>
<|body_start_1|>
await self._async_send_command(self._power_off_command)
self._attr_is_on = False
self.async_write_ha_state()
<|end_... | A lookin IR controlled light. | LookinLightEntity | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LookinLightEntity:
"""A lookin IR controlled light."""
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the light."""
<|body_0|>
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the light."""
<|body_1|>
def _update_f... | stack_v2_sparse_classes_75kplus_train_067817 | 2,281 | permissive | [
{
"docstring": "Turn on the light.",
"name": "async_turn_on",
"signature": "async def async_turn_on(self, **kwargs: Any) -> None"
},
{
"docstring": "Turn off the light.",
"name": "async_turn_off",
"signature": "async def async_turn_off(self, **kwargs: Any) -> None"
},
{
"docstrin... | 3 | stack_v2_sparse_classes_30k_train_013274 | Implement the Python class `LookinLightEntity` described below.
Class description:
A lookin IR controlled light.
Method signatures and docstrings:
- async def async_turn_on(self, **kwargs: Any) -> None: Turn on the light.
- async def async_turn_off(self, **kwargs: Any) -> None: Turn off the light.
- def _update_from_... | Implement the Python class `LookinLightEntity` described below.
Class description:
A lookin IR controlled light.
Method signatures and docstrings:
- async def async_turn_on(self, **kwargs: Any) -> None: Turn on the light.
- async def async_turn_off(self, **kwargs: Any) -> None: Turn off the light.
- def _update_from_... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class LookinLightEntity:
"""A lookin IR controlled light."""
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the light."""
<|body_0|>
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn off the light."""
<|body_1|>
def _update_f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LookinLightEntity:
"""A lookin IR controlled light."""
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn on the light."""
await self._async_send_command(self._power_on_command)
self._attr_is_on = True
self.async_write_ha_state()
async def async_turn_off(se... | the_stack_v2_python_sparse | homeassistant/components/lookin/light.py | home-assistant/core | train | 35,501 |
9bf1b12cff892b77680f3e11c860e6b606d13358 | [
"self.cpu = conf.getcmdValue('cpu')\nself.men = conf.getcmdValue('men')\nself.fps = conf.getcmdValue('fps')",
"get_cpu = os.popen(self.cpu).readlines()\nfor info in get_cpu:\n cpu_info = float(info.split()[2].split('%')[0])\n return cpu_info",
"total = 'TOTAL'\nget_men = os.popen(self.men).readlines()\nfo... | <|body_start_0|>
self.cpu = conf.getcmdValue('cpu')
self.men = conf.getcmdValue('men')
self.fps = conf.getcmdValue('fps')
<|end_body_0|>
<|body_start_1|>
get_cpu = os.popen(self.cpu).readlines()
for info in get_cpu:
cpu_info = float(info.split()[2].split('%')[0])
... | Performance | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Performance:
def __init__(self):
"""从config配置文件中获取adb命令"""
<|body_0|>
def get_cpu(self):
"""获取CPU"""
<|body_1|>
def get_men(self):
"""内存泄漏"""
<|body_2|>
def get_fps(self):
"""获取帧率"""
<|body_3|>
<|end_skeleton|>
<|bo... | stack_v2_sparse_classes_75kplus_train_067818 | 2,146 | no_license | [
{
"docstring": "从config配置文件中获取adb命令",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "获取CPU",
"name": "get_cpu",
"signature": "def get_cpu(self)"
},
{
"docstring": "内存泄漏",
"name": "get_men",
"signature": "def get_men(self)"
},
{
"docstring... | 4 | stack_v2_sparse_classes_30k_val_001348 | Implement the Python class `Performance` described below.
Class description:
Implement the Performance class.
Method signatures and docstrings:
- def __init__(self): 从config配置文件中获取adb命令
- def get_cpu(self): 获取CPU
- def get_men(self): 内存泄漏
- def get_fps(self): 获取帧率 | Implement the Python class `Performance` described below.
Class description:
Implement the Performance class.
Method signatures and docstrings:
- def __init__(self): 从config配置文件中获取adb命令
- def get_cpu(self): 获取CPU
- def get_men(self): 内存泄漏
- def get_fps(self): 获取帧率
<|skeleton|>
class Performance:
def __init__(se... | cec5448b2292ffd414ac5dff01e931f985f2ebb8 | <|skeleton|>
class Performance:
def __init__(self):
"""从config配置文件中获取adb命令"""
<|body_0|>
def get_cpu(self):
"""获取CPU"""
<|body_1|>
def get_men(self):
"""内存泄漏"""
<|body_2|>
def get_fps(self):
"""获取帧率"""
<|body_3|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Performance:
def __init__(self):
"""从config配置文件中获取adb命令"""
self.cpu = conf.getcmdValue('cpu')
self.men = conf.getcmdValue('men')
self.fps = conf.getcmdValue('fps')
def get_cpu(self):
"""获取CPU"""
get_cpu = os.popen(self.cpu).readlines()
for info in g... | the_stack_v2_python_sparse | common/performance.py | tany-92/FocusApp_Autotest | train | 0 | |
f5a6f20e03a173cf23aac44bfdbb98c9e446cce3 | [
"self.amr_year = amr_year\nassert amr_year in ['2015', '2017']\nself.tool_dir = tool_dir\nself.alto_path = alto_path\nself.show_output = show_output",
"assert gold_file in ['dev', 'test'], f'In case of AMR, set gold_file in the validation_evaluator to dev or test (got {gold_file})'\nwith TemporaryDirectory() as d... | <|body_start_0|>
self.amr_year = amr_year
assert amr_year in ['2015', '2017']
self.tool_dir = tool_dir
self.alto_path = alto_path
self.show_output = show_output
<|end_body_0|>
<|body_start_1|>
assert gold_file in ['dev', 'test'], f'In case of AMR, set gold_file in the va... | An evaluation command for AMR that can be configured with jsonnet files. | AMREvaluationCommand | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AMREvaluationCommand:
"""An evaluation command for AMR that can be configured with jsonnet files."""
def __init__(self, amr_year: str, tool_dir: str, alto_path: str, show_output: bool=True) -> None:
"""Sets up an evaluator. :param amr_year: 2015 or 2017 :param tool_dir: the path to t... | stack_v2_sparse_classes_75kplus_train_067819 | 8,851 | permissive | [
{
"docstring": "Sets up an evaluator. :param amr_year: 2015 or 2017 :param tool_dir: the path to the evaluation tools used for AMR (2019rerun) :param alto_path: the path to the Alto .jar file :param show_output: show Smatch results on commmand line?",
"name": "__init__",
"signature": "def __init__(self,... | 2 | stack_v2_sparse_classes_30k_test_003038 | Implement the Python class `AMREvaluationCommand` described below.
Class description:
An evaluation command for AMR that can be configured with jsonnet files.
Method signatures and docstrings:
- def __init__(self, amr_year: str, tool_dir: str, alto_path: str, show_output: bool=True) -> None: Sets up an evaluator. :pa... | Implement the Python class `AMREvaluationCommand` described below.
Class description:
An evaluation command for AMR that can be configured with jsonnet files.
Method signatures and docstrings:
- def __init__(self, amr_year: str, tool_dir: str, alto_path: str, show_output: bool=True) -> None: Sets up an evaluator. :pa... | 81432b9e3c165f8c0efb84a23e5a0d0493717e63 | <|skeleton|>
class AMREvaluationCommand:
"""An evaluation command for AMR that can be configured with jsonnet files."""
def __init__(self, amr_year: str, tool_dir: str, alto_path: str, show_output: bool=True) -> None:
"""Sets up an evaluator. :param amr_year: 2015 or 2017 :param tool_dir: the path to t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AMREvaluationCommand:
"""An evaluation command for AMR that can be configured with jsonnet files."""
def __init__(self, amr_year: str, tool_dir: str, alto_path: str, show_output: bool=True) -> None:
"""Sets up an evaluator. :param amr_year: 2015 or 2017 :param tool_dir: the path to the evaluation... | the_stack_v2_python_sparse | graph_dependency_parser/components/evaluation/commands.py | coli-saar/am-parser | train | 30 |
da8091bc1649b808f9ee65dfd57b4e3bb34ecb64 | [
"blocks_args_str = ['r1_k3_s11_e1_i32_o16_se0.25', 'r2_k3_s22_e6_i16_o24_se0.25', 'r2_k5_s22_e6_i24_o40_se0.25', 'r3_k3_s22_e6_i40_o80_se0.25', 'r3_k5_s11_e6_i80_o112_se0.25', 'r4_k5_s22_e6_i112_o192_se0.25', 'r1_k3_s11_e6_i192_o320_se0.25']\nif model_name not in efficientnet_params:\n model_name_string = ', '.j... | <|body_start_0|>
blocks_args_str = ['r1_k3_s11_e1_i32_o16_se0.25', 'r2_k3_s22_e6_i16_o24_se0.25', 'r2_k5_s22_e6_i24_o40_se0.25', 'r3_k3_s22_e6_i40_o80_se0.25', 'r3_k5_s11_e6_i80_o112_se0.25', 'r4_k5_s22_e6_i112_o192_se0.25', 'r1_k3_s11_e6_i192_o320_se0.25']
if model_name not in efficientnet_params:
... | EfficientNetBNFeatures | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EfficientNetBNFeatures:
def __init__(self, model_name: str, pretrained: bool=True, progress: bool=True, spatial_dims: int=2, in_channels: int=3, num_classes: int=1000, norm: str | tuple=('batch', {'eps': 0.001, 'momentum': 0.01}), adv_prop: bool=False) -> None:
"""Initialize EfficientNet... | stack_v2_sparse_classes_75kplus_train_067820 | 40,667 | permissive | [
{
"docstring": "Initialize EfficientNet-B0 to EfficientNet-B7 models as a backbone, the backbone can be used as an encoder for segmentation and objection models. Compared with the class `EfficientNetBN`, the only different place is the forward function. This class refers to `PyTorch image models <https://github... | 2 | stack_v2_sparse_classes_30k_train_050321 | Implement the Python class `EfficientNetBNFeatures` described below.
Class description:
Implement the EfficientNetBNFeatures class.
Method signatures and docstrings:
- def __init__(self, model_name: str, pretrained: bool=True, progress: bool=True, spatial_dims: int=2, in_channels: int=3, num_classes: int=1000, norm: ... | Implement the Python class `EfficientNetBNFeatures` described below.
Class description:
Implement the EfficientNetBNFeatures class.
Method signatures and docstrings:
- def __init__(self, model_name: str, pretrained: bool=True, progress: bool=True, spatial_dims: int=2, in_channels: int=3, num_classes: int=1000, norm: ... | e48c3e2c741fa3fc705c4425d17ac4a5afac6c47 | <|skeleton|>
class EfficientNetBNFeatures:
def __init__(self, model_name: str, pretrained: bool=True, progress: bool=True, spatial_dims: int=2, in_channels: int=3, num_classes: int=1000, norm: str | tuple=('batch', {'eps': 0.001, 'momentum': 0.01}), adv_prop: bool=False) -> None:
"""Initialize EfficientNet... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EfficientNetBNFeatures:
def __init__(self, model_name: str, pretrained: bool=True, progress: bool=True, spatial_dims: int=2, in_channels: int=3, num_classes: int=1000, norm: str | tuple=('batch', {'eps': 0.001, 'momentum': 0.01}), adv_prop: bool=False) -> None:
"""Initialize EfficientNet-B0 to Efficie... | the_stack_v2_python_sparse | monai/networks/nets/efficientnet.py | Project-MONAI/MONAI | train | 4,805 | |
f4476dabd55328958cfba42ffc97ee2aaab170f7 | [
"self.name = name\nself.matches = matcheslist\nself.startTime = datetime.now().strftime('%d/%m/%Y %H:%M:%S')\nself.endTime = ''\nself.rdb = managedb.TournamentDb()",
"ii = 0\nfor result in results:\n if result == 'a':\n self.matches[ii][0][1] = 1\n self.matches[ii][1][1] = 0\n elif result == '... | <|body_start_0|>
self.name = name
self.matches = matcheslist
self.startTime = datetime.now().strftime('%d/%m/%Y %H:%M:%S')
self.endTime = ''
self.rdb = managedb.TournamentDb()
<|end_body_0|>
<|body_start_1|>
ii = 0
for result in results:
if result == ... | Round | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Round:
def __init__(self, name, matcheslist):
""":param name: round name :param matcheslist: matches in the round"""
<|body_0|>
def enter_scores(self, results):
""":param results: results to enter in match :return: matches, with results, with end time"""
<|bo... | stack_v2_sparse_classes_75kplus_train_067821 | 2,588 | no_license | [
{
"docstring": ":param name: round name :param matcheslist: matches in the round",
"name": "__init__",
"signature": "def __init__(self, name, matcheslist)"
},
{
"docstring": ":param results: results to enter in match :return: matches, with results, with end time",
"name": "enter_scores",
... | 4 | null | Implement the Python class `Round` described below.
Class description:
Implement the Round class.
Method signatures and docstrings:
- def __init__(self, name, matcheslist): :param name: round name :param matcheslist: matches in the round
- def enter_scores(self, results): :param results: results to enter in match :re... | Implement the Python class `Round` described below.
Class description:
Implement the Round class.
Method signatures and docstrings:
- def __init__(self, name, matcheslist): :param name: round name :param matcheslist: matches in the round
- def enter_scores(self, results): :param results: results to enter in match :re... | dd645e141e290d2d0af4b7ff45a38d0a14634749 | <|skeleton|>
class Round:
def __init__(self, name, matcheslist):
""":param name: round name :param matcheslist: matches in the round"""
<|body_0|>
def enter_scores(self, results):
""":param results: results to enter in match :return: matches, with results, with end time"""
<|bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Round:
def __init__(self, name, matcheslist):
""":param name: round name :param matcheslist: matches in the round"""
self.name = name
self.matches = matcheslist
self.startTime = datetime.now().strftime('%d/%m/%Y %H:%M:%S')
self.endTime = ''
self.rdb = managedb.T... | the_stack_v2_python_sparse | app/models/round.py | jdoucet-OC/P4MVC | train | 0 | |
2a1170a5bacb7646ea8ca6ac788ba393c245eff1 | [
"Validation.check_param_empty(train_id=train_id, tag=tag)\njob_response = []\ntry:\n tensors = self._data_manager.list_tensors(train_id, tag)\nexcept ParamValueError as ex:\n raise ScalarNotExistError(ex.message)\nfor tensor in tensors:\n job_response.append({'wall_time': tensor.wall_time, 'step': tensor.s... | <|body_start_0|>
Validation.check_param_empty(train_id=train_id, tag=tag)
job_response = []
try:
tensors = self._data_manager.list_tensors(train_id, tag)
except ParamValueError as ex:
raise ScalarNotExistError(ex.message)
for tensor in tensors:
... | Scalar Processor. | ScalarsProcessor | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScalarsProcessor:
"""Scalar Processor."""
def get_metadata_list(self, train_id, tag):
"""Builds a JSON-serializable object with information about scalars. Args: train_id (str): The ID of the events data. tag (str): The name of the tag the scalars all belonging to. Returns: list[dict]... | stack_v2_sparse_classes_75kplus_train_067822 | 3,823 | permissive | [
{
"docstring": "Builds a JSON-serializable object with information about scalars. Args: train_id (str): The ID of the events data. tag (str): The name of the tag the scalars all belonging to. Returns: list[dict], a list of dictionaries containing the `wall_time`, `step`, `value` for each scalar.",
"name": "... | 3 | stack_v2_sparse_classes_30k_train_001390 | Implement the Python class `ScalarsProcessor` described below.
Class description:
Scalar Processor.
Method signatures and docstrings:
- def get_metadata_list(self, train_id, tag): Builds a JSON-serializable object with information about scalars. Args: train_id (str): The ID of the events data. tag (str): The name of ... | Implement the Python class `ScalarsProcessor` described below.
Class description:
Scalar Processor.
Method signatures and docstrings:
- def get_metadata_list(self, train_id, tag): Builds a JSON-serializable object with information about scalars. Args: train_id (str): The ID of the events data. tag (str): The name of ... | a774d893fb2f21dbc3edb5cd89f9e6eec274ebf1 | <|skeleton|>
class ScalarsProcessor:
"""Scalar Processor."""
def get_metadata_list(self, train_id, tag):
"""Builds a JSON-serializable object with information about scalars. Args: train_id (str): The ID of the events data. tag (str): The name of the tag the scalars all belonging to. Returns: list[dict]... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScalarsProcessor:
"""Scalar Processor."""
def get_metadata_list(self, train_id, tag):
"""Builds a JSON-serializable object with information about scalars. Args: train_id (str): The ID of the events data. tag (str): The name of the tag the scalars all belonging to. Returns: list[dict], a list of d... | the_stack_v2_python_sparse | mindinsight/datavisual/processors/scalars_processor.py | mindspore-ai/mindinsight | train | 224 |
811a8a367e47b4b81b59a9a3ce8ed44bbf87866f | [
"super(TranslatorData, self).build()\nif self.config.outlet_state_defined and self.config.has_phase_equilibrium:\n raise ConfigurationError('{} cannot calculate phase equilibrium (has_phase_equilibrium = True) when outlet state is set to be fully defined (outlet_state_defined = True).'.format(self.name))\nself.p... | <|body_start_0|>
super(TranslatorData, self).build()
if self.config.outlet_state_defined and self.config.has_phase_equilibrium:
raise ConfigurationError('{} cannot calculate phase equilibrium (has_phase_equilibrium = True) when outlet state is set to be fully defined (outlet_state_defined = ... | Standard Translator Block Class | TranslatorData | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TranslatorData:
"""Standard Translator Block Class"""
def build(self):
"""Begin building model. Args: None Returns: None"""
<|body_0|>
def initialize_build(blk, state_args_in=None, state_args_out=None, outlvl=idaeslog.NOTSET, solver=None, optarg=None):
"""This me... | stack_v2_sparse_classes_75kplus_train_067823 | 9,225 | permissive | [
{
"docstring": "Begin building model. Args: None Returns: None",
"name": "build",
"signature": "def build(self)"
},
{
"docstring": "This method calls the initialization method of the state blocks. Keyword Arguments: state_args_in : a dict of arguments to be passed to the inlet property package (... | 2 | stack_v2_sparse_classes_30k_train_030554 | Implement the Python class `TranslatorData` described below.
Class description:
Standard Translator Block Class
Method signatures and docstrings:
- def build(self): Begin building model. Args: None Returns: None
- def initialize_build(blk, state_args_in=None, state_args_out=None, outlvl=idaeslog.NOTSET, solver=None, ... | Implement the Python class `TranslatorData` described below.
Class description:
Standard Translator Block Class
Method signatures and docstrings:
- def build(self): Begin building model. Args: None Returns: None
- def initialize_build(blk, state_args_in=None, state_args_out=None, outlvl=idaeslog.NOTSET, solver=None, ... | deacf4c422bc9e50cb347e11a8cbfa0195bd4274 | <|skeleton|>
class TranslatorData:
"""Standard Translator Block Class"""
def build(self):
"""Begin building model. Args: None Returns: None"""
<|body_0|>
def initialize_build(blk, state_args_in=None, state_args_out=None, outlvl=idaeslog.NOTSET, solver=None, optarg=None):
"""This me... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TranslatorData:
"""Standard Translator Block Class"""
def build(self):
"""Begin building model. Args: None Returns: None"""
super(TranslatorData, self).build()
if self.config.outlet_state_defined and self.config.has_phase_equilibrium:
raise ConfigurationError('{} canno... | the_stack_v2_python_sparse | idaes/models/unit_models/translator.py | IDAES/idaes-pse | train | 173 |
e09a961e144f4f93d4ae10fcab6dbc4668e97652 | [
"if not self.segments:\n self.warnings.append('sql() save failed with no segments?')\n return\nfor seg in self.segments:\n if not seg.ugcs:\n continue\n _sql_segment(self, txn, seg)",
"channels = self.get_channels()\nfor ugc in segment.ugcs:\n sugc = str(ugc)\n channels.append(f'{self.afo... | <|body_start_0|>
if not self.segments:
self.warnings.append('sql() save failed with no segments?')
return
for seg in self.segments:
if not seg.ugcs:
continue
_sql_segment(self, txn, seg)
<|end_body_0|>
<|body_start_1|>
channels = s... | A Special Weather Statement | SPSProduct | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SPSProduct:
"""A Special Weather Statement"""
def sql(self, txn):
"""Do database save in the case of a polygon"""
<|body_0|>
def _get_channels(self, segment):
"""Returns a list of channels for this SPS."""
<|body_1|>
def get_jabbers(self, uri, _uri2=... | stack_v2_sparse_classes_75kplus_train_067824 | 5,789 | permissive | [
{
"docstring": "Do database save in the case of a polygon",
"name": "sql",
"signature": "def sql(self, txn)"
},
{
"docstring": "Returns a list of channels for this SPS.",
"name": "_get_channels",
"signature": "def _get_channels(self, segment)"
},
{
"docstring": "return the standa... | 3 | stack_v2_sparse_classes_30k_train_053884 | Implement the Python class `SPSProduct` described below.
Class description:
A Special Weather Statement
Method signatures and docstrings:
- def sql(self, txn): Do database save in the case of a polygon
- def _get_channels(self, segment): Returns a list of channels for this SPS.
- def get_jabbers(self, uri, _uri2=None... | Implement the Python class `SPSProduct` described below.
Class description:
A Special Weather Statement
Method signatures and docstrings:
- def sql(self, txn): Do database save in the case of a polygon
- def _get_channels(self, segment): Returns a list of channels for this SPS.
- def get_jabbers(self, uri, _uri2=None... | 460f44394be05e1b655111595a3d7de3f7e47757 | <|skeleton|>
class SPSProduct:
"""A Special Weather Statement"""
def sql(self, txn):
"""Do database save in the case of a polygon"""
<|body_0|>
def _get_channels(self, segment):
"""Returns a list of channels for this SPS."""
<|body_1|>
def get_jabbers(self, uri, _uri2=... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SPSProduct:
"""A Special Weather Statement"""
def sql(self, txn):
"""Do database save in the case of a polygon"""
if not self.segments:
self.warnings.append('sql() save failed with no segments?')
return
for seg in self.segments:
if not seg.ugcs:... | the_stack_v2_python_sparse | src/pyiem/nws/products/sps.py | akrherz/pyIEM | train | 38 |
718523d3a138c4cef7194946a9bfe0aa0ae5fafc | [
"self.open(self.url)\nself.wait(2)\nself.click(args=self.classify, context='分类下拉框')\nself.wait(1)\nself.click(args=self.classify_value, context='分类的具体值')\nself.wait(2)\nself.click(args=self.classify, context='分类下拉框')\nself.wait(1)\nself.click(args=self.classify_bx, context='不限')\nself.wait(2)\nself.click(args=self.... | <|body_start_0|>
self.open(self.url)
self.wait(2)
self.click(args=self.classify, context='分类下拉框')
self.wait(1)
self.click(args=self.classify_value, context='分类的具体值')
self.wait(2)
self.click(args=self.classify, context='分类下拉框')
self.wait(1)
self.cli... | 专项整治类 | SpecialRectificationList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpecialRectificationList:
"""专项整治类"""
def special_rectification_filter(self):
"""专项整治筛选相关的功能测试 :return:"""
<|body_0|>
def special_rectification_detail_and_update(self):
"""查看专项整治详情 :return:"""
<|body_1|>
def special_rectification_detail_flow(self):
... | stack_v2_sparse_classes_75kplus_train_067825 | 8,991 | no_license | [
{
"docstring": "专项整治筛选相关的功能测试 :return:",
"name": "special_rectification_filter",
"signature": "def special_rectification_filter(self)"
},
{
"docstring": "查看专项整治详情 :return:",
"name": "special_rectification_detail_and_update",
"signature": "def special_rectification_detail_and_update(self)... | 4 | stack_v2_sparse_classes_30k_train_012560 | Implement the Python class `SpecialRectificationList` described below.
Class description:
专项整治类
Method signatures and docstrings:
- def special_rectification_filter(self): 专项整治筛选相关的功能测试 :return:
- def special_rectification_detail_and_update(self): 查看专项整治详情 :return:
- def special_rectification_detail_flow(self): 查看详情并... | Implement the Python class `SpecialRectificationList` described below.
Class description:
专项整治类
Method signatures and docstrings:
- def special_rectification_filter(self): 专项整治筛选相关的功能测试 :return:
- def special_rectification_detail_and_update(self): 查看专项整治详情 :return:
- def special_rectification_detail_flow(self): 查看详情并... | 1598890cc4b1ac44b5bf3ae9dd24145c49068b33 | <|skeleton|>
class SpecialRectificationList:
"""专项整治类"""
def special_rectification_filter(self):
"""专项整治筛选相关的功能测试 :return:"""
<|body_0|>
def special_rectification_detail_and_update(self):
"""查看专项整治详情 :return:"""
<|body_1|>
def special_rectification_detail_flow(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SpecialRectificationList:
"""专项整治类"""
def special_rectification_filter(self):
"""专项整治筛选相关的功能测试 :return:"""
self.open(self.url)
self.wait(2)
self.click(args=self.classify, context='分类下拉框')
self.wait(1)
self.click(args=self.classify_value, context='分类的具体值')
... | the_stack_v2_python_sparse | Lib/base/page_object/special/special_rectification_list.py | zhanpei10/skyline_lingang_ui | train | 0 |
acdeb0ae8076e8448f8140d5ec45e7c45216eeee | [
"req_body = cli.make_body(managementAddress=management_address, localUsername=local_username, localPassword=local_password, remoteUsername=remote_username, remotePassword=remote_password, connectionType=connection_type)\nresp = cli.post(cls().resource_class, **req_body)\nresp.raise_if_err()\nreturn cls.get(cli, res... | <|body_start_0|>
req_body = cli.make_body(managementAddress=management_address, localUsername=local_username, localPassword=local_password, remoteUsername=remote_username, remotePassword=remote_password, connectionType=connection_type)
resp = cli.post(cls().resource_class, **req_body)
resp.raise... | UnityRemoteSystem | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnityRemoteSystem:
def create(cls, cli, management_address, local_username=None, local_password=None, remote_username=None, remote_password=None, connection_type=None):
"""Configures a remote system for remote replication. :param cls: this class. :param cli: the rest client. :param manag... | stack_v2_sparse_classes_75kplus_train_067826 | 3,443 | permissive | [
{
"docstring": "Configures a remote system for remote replication. :param cls: this class. :param cli: the rest client. :param management_address: the management IP address of the remote system. :param local_username: administrative username of local system. :param local_password: administrative password of loc... | 3 | stack_v2_sparse_classes_30k_train_052649 | Implement the Python class `UnityRemoteSystem` described below.
Class description:
Implement the UnityRemoteSystem class.
Method signatures and docstrings:
- def create(cls, cli, management_address, local_username=None, local_password=None, remote_username=None, remote_password=None, connection_type=None): Configures... | Implement the Python class `UnityRemoteSystem` described below.
Class description:
Implement the UnityRemoteSystem class.
Method signatures and docstrings:
- def create(cls, cli, management_address, local_username=None, local_password=None, remote_username=None, remote_password=None, connection_type=None): Configures... | ccfccba0bceda34c0d5dc8105c95731036f4e955 | <|skeleton|>
class UnityRemoteSystem:
def create(cls, cli, management_address, local_username=None, local_password=None, remote_username=None, remote_password=None, connection_type=None):
"""Configures a remote system for remote replication. :param cls: this class. :param cli: the rest client. :param manag... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UnityRemoteSystem:
def create(cls, cli, management_address, local_username=None, local_password=None, remote_username=None, remote_password=None, connection_type=None):
"""Configures a remote system for remote replication. :param cls: this class. :param cli: the rest client. :param management_address:... | the_stack_v2_python_sparse | storops/unity/resource/remote_system.py | emc-openstack/storops | train | 61 | |
fe53e72e2534172902a43fff0267224a34d836d6 | [
"char_dict = {}\nstart = -1\nlongest = 0\nfor c in s:\n if c not in char_dict:\n char_dict[c] = -1\nfor i in range(len(s)):\n start = max(start, char_dict[s[i]])\n longest = max(longest, i - start)\n char_dict[s[i]] = i\nreturn longest",
"refer = {}\nlongest = 0\nstart = -1\nfor i in range(len(... | <|body_start_0|>
char_dict = {}
start = -1
longest = 0
for c in s:
if c not in char_dict:
char_dict[c] = -1
for i in range(len(s)):
start = max(start, char_dict[s[i]])
longest = max(longest, i - start)
char_dict[s[i]... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
char_dict = {}
start = -1
... | stack_v2_sparse_classes_75kplus_train_067827 | 1,330 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring2",
"signature": "def lengthOfLongestSubstring2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_049998 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def lengthOf... | ff9118b8a0ce9a3db89c2bf6f2f79def7ae4f17f | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
char_dict = {}
start = -1
longest = 0
for c in s:
if c not in char_dict:
char_dict[c] = -1
for i in range(len(s)):
start = max(start, char_dic... | the_stack_v2_python_sparse | problem0003/solution.py | JianghaoPi/LeetCode | train | 0 | |
ad364278abc6a62383be2dd49474fffcd9956206 | [
"self.console, self.debug = (console, debug)\nif self.debug:\n print('init')\nself.endian = sys.byteorder",
"if self.debug:\n print(device)\nself.serial = serial.Serial(device, baudrate=9600)\nif self.debug:\n print('conn ok')",
"if self.debug:\n print('check_keyword')\nwhile True:\n token = self... | <|body_start_0|>
self.console, self.debug = (console, debug)
if self.debug:
print('init')
self.endian = sys.byteorder
<|end_body_0|>
<|body_start_1|>
if self.debug:
print(device)
self.serial = serial.Serial(device, baudrate=9600)
if self.debug:
... | Particles | [
"NTP-0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Particles:
def __init__(self, console='/dev/ttyS0', debug=False):
"""Initialize the sensor."""
<|body_0|>
def conn_serial_port(self, device):
"""Connect to a serial device."""
<|body_1|>
def check_keyword(self):
"""Validate sensor functionality."... | stack_v2_sparse_classes_75kplus_train_067828 | 15,072 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, console='/dev/ttyS0', debug=False)"
},
{
"docstring": "Connect to a serial device.",
"name": "conn_serial_port",
"signature": "def conn_serial_port(self, device)"
},
{
"docstring": "Vali... | 6 | stack_v2_sparse_classes_30k_train_038655 | Implement the Python class `Particles` described below.
Class description:
Implement the Particles class.
Method signatures and docstrings:
- def __init__(self, console='/dev/ttyS0', debug=False): Initialize the sensor.
- def conn_serial_port(self, device): Connect to a serial device.
- def check_keyword(self): Valid... | Implement the Python class `Particles` described below.
Class description:
Implement the Particles class.
Method signatures and docstrings:
- def __init__(self, console='/dev/ttyS0', debug=False): Initialize the sensor.
- def conn_serial_port(self, device): Connect to a serial device.
- def check_keyword(self): Valid... | 6161925f73e9a82cdeca989d6682aaa757cc622b | <|skeleton|>
class Particles:
def __init__(self, console='/dev/ttyS0', debug=False):
"""Initialize the sensor."""
<|body_0|>
def conn_serial_port(self, device):
"""Connect to a serial device."""
<|body_1|>
def check_keyword(self):
"""Validate sensor functionality."... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Particles:
def __init__(self, console='/dev/ttyS0', debug=False):
"""Initialize the sensor."""
self.console, self.debug = (console, debug)
if self.debug:
print('init')
self.endian = sys.byteorder
def conn_serial_port(self, device):
"""Connect to a seria... | the_stack_v2_python_sparse | main/sensors.py | Mohamed-Dhouioui/AGIM | train | 0 | |
cb00cb63025a73572505bce255b6a3b6865086ba | [
"super(VectorNet, self).__init__()\nlayersNumber = 3\nself.subGraphs = SubGraph(layersNumber=layersNumber, feature_length=feature_length)\nself.pLen = feature_length * 2 ** layersNumber\nself.globalGraph = Attention(C=self.pLen)\nself.device = device",
"nCar = 10\nosm_subGraph_list = []\nfor i in range(len(osm_in... | <|body_start_0|>
super(VectorNet, self).__init__()
layersNumber = 3
self.subGraphs = SubGraph(layersNumber=layersNumber, feature_length=feature_length)
self.pLen = feature_length * 2 ** layersNumber
self.globalGraph = Attention(C=self.pLen)
self.device = device
<|end_body... | Vector network. | VectorNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VectorNet:
"""Vector network."""
def __init__(self, feature_length, device='cuda:0'):
"""Construct a VectorNet. :param feature_length: length of each vector v ([ds,de,a,j])."""
<|body_0|>
def forward(self, data, osm, osm_interval):
""":param data: the input data ... | stack_v2_sparse_classes_75kplus_train_067829 | 9,585 | no_license | [
{
"docstring": "Construct a VectorNet. :param feature_length: length of each vector v ([ds,de,a,j]).",
"name": "__init__",
"signature": "def __init__(self, feature_length, device='cuda:0')"
},
{
"docstring": ":param data: the input data of network. Each coordinate of key position is centered by ... | 2 | stack_v2_sparse_classes_30k_train_006842 | Implement the Python class `VectorNet` described below.
Class description:
Vector network.
Method signatures and docstrings:
- def __init__(self, feature_length, device='cuda:0'): Construct a VectorNet. :param feature_length: length of each vector v ([ds,de,a,j]).
- def forward(self, data, osm, osm_interval): :param ... | Implement the Python class `VectorNet` described below.
Class description:
Vector network.
Method signatures and docstrings:
- def __init__(self, feature_length, device='cuda:0'): Construct a VectorNet. :param feature_length: length of each vector v ([ds,de,a,j]).
- def forward(self, data, osm, osm_interval): :param ... | 0a314f7bdfc6db0247c92bc2c5c3806fdd18b885 | <|skeleton|>
class VectorNet:
"""Vector network."""
def __init__(self, feature_length, device='cuda:0'):
"""Construct a VectorNet. :param feature_length: length of each vector v ([ds,de,a,j])."""
<|body_0|>
def forward(self, data, osm, osm_interval):
""":param data: the input data ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VectorNet:
"""Vector network."""
def __init__(self, feature_length, device='cuda:0'):
"""Construct a VectorNet. :param feature_length: length of each vector v ([ds,de,a,j])."""
super(VectorNet, self).__init__()
layersNumber = 3
self.subGraphs = SubGraph(layersNumber=layers... | the_stack_v2_python_sparse | code/vector_net/vector_net.py | JieFeng-cse/dynamic_driving | train | 1 |
d7f35d17e468006a7867e470e4bb93f166f44b6c | [
"if len(s) == 1:\n return 1\nelif s == '':\n return 0\nlength = 0\nsub = []\nfor c in s:\n if c in sub:\n sub = sub[sub.index(c) + 1:]\n sub.append(c)\n length = max(length, len(sub))\nreturn length",
"dicts = {}\nlength = start = 0\nfor i, c in enumerate(s):\n if c in dicts:\n sum... | <|body_start_0|>
if len(s) == 1:
return 1
elif s == '':
return 0
length = 0
sub = []
for c in s:
if c in sub:
sub = sub[sub.index(c) + 1:]
sub.append(c)
length = max(length, len(sub))
return lengt... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(s) == 1:
return 1
... | stack_v2_sparse_classes_75kplus_train_067830 | 989 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring1",
"signature": "def lengthOfLongestSubstring1(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007312 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring1(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def lengthOf... | 3ac66a1bf85a344234c746ebf3de30e643838e5f | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring1(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
if len(s) == 1:
return 1
elif s == '':
return 0
length = 0
sub = []
for c in s:
if c in sub:
sub = sub[sub.index(c) + 1:]
... | the_stack_v2_python_sparse | 3. Longest Substring Without Repeating Characters/3.py | JohnHuiWB/leetcode | train | 0 | |
41176375dd1708078131fa94c2441a1dd3701664 | [
"self.platform = 'timesketch'\nself.analyzer_identifier = analyzer_identifier\nself.analyzer_name = analyzer_name\nself.result_status = ''\nself.result_priority = 'NOTE'\nself.result_summary = ''\nself.result_markdown = ''\nself.references = []\nself.result_attributes = {}\nself.platform_meta_data = {'timesketch_in... | <|body_start_0|>
self.platform = 'timesketch'
self.analyzer_identifier = analyzer_identifier
self.analyzer_name = analyzer_name
self.result_status = ''
self.result_priority = 'NOTE'
self.result_summary = ''
self.result_markdown = ''
self.references = []
... | A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status (str): [Required] Analyzer result status. Valid values are success or error. resu... | AnalyzerOutput | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnalyzerOutput:
"""A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status (str): [Required] Analyzer result statu... | stack_v2_sparse_classes_75kplus_train_067831 | 47,958 | permissive | [
{
"docstring": "Initialize analyzer output.",
"name": "__init__",
"signature": "def __init__(self, analyzer_identifier, analyzer_name, timesketch_instance, sketch_id, timeline_id)"
},
{
"docstring": "Validates the analyzer output and raises exception.",
"name": "validate",
"signature": "... | 4 | stack_v2_sparse_classes_30k_train_013346 | Implement the Python class `AnalyzerOutput` described below.
Class description:
A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status ... | Implement the Python class `AnalyzerOutput` described below.
Class description:
A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status ... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class AnalyzerOutput:
"""A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status (str): [Required] Analyzer result statu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnalyzerOutput:
"""A class to record timesketch analyzer output. Attributes: platform (str): [Required] Analyzer platform. analyzer_identifier (str): [Required] Unique analyzer identifier. analyzer_name (str): [Required] Analyzer display name. result_status (str): [Required] Analyzer result status. Valid valu... | the_stack_v2_python_sparse | timesketch/lib/analyzers/interface.py | google/timesketch | train | 2,263 |
e678e2c1090852934042150a7a703bb5560af344 | [
"this_sample_vector, these_sample_indices = bootstrapping.draw_sample(INPUT_VECTOR, NUM_EXAMPLES_SMALL)\nself.assertTrue(len(this_sample_vector) == NUM_EXAMPLES_SMALL)\nself.assertTrue(len(these_sample_indices) == NUM_EXAMPLES_SMALL)\nerror_checking.assert_is_integer_numpy_array(these_sample_indices)",
"this_samp... | <|body_start_0|>
this_sample_vector, these_sample_indices = bootstrapping.draw_sample(INPUT_VECTOR, NUM_EXAMPLES_SMALL)
self.assertTrue(len(this_sample_vector) == NUM_EXAMPLES_SMALL)
self.assertTrue(len(these_sample_indices) == NUM_EXAMPLES_SMALL)
error_checking.assert_is_integer_numpy_a... | Each method is a unit test for bootstrapping.py. | BootstrappingTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BootstrappingTests:
"""Each method is a unit test for bootstrapping.py."""
def test_draw_sample_small(self):
"""Ensures correct output from draw_sample. In this case, number of examples to draw < number of original examples."""
<|body_0|>
def test_draw_sample_large(self)... | stack_v2_sparse_classes_75kplus_train_067832 | 2,195 | permissive | [
{
"docstring": "Ensures correct output from draw_sample. In this case, number of examples to draw < number of original examples.",
"name": "test_draw_sample_small",
"signature": "def test_draw_sample_small(self)"
},
{
"docstring": "Ensures correct output from draw_sample. In this case, number of... | 3 | stack_v2_sparse_classes_30k_train_008623 | Implement the Python class `BootstrappingTests` described below.
Class description:
Each method is a unit test for bootstrapping.py.
Method signatures and docstrings:
- def test_draw_sample_small(self): Ensures correct output from draw_sample. In this case, number of examples to draw < number of original examples.
- ... | Implement the Python class `BootstrappingTests` described below.
Class description:
Each method is a unit test for bootstrapping.py.
Method signatures and docstrings:
- def test_draw_sample_small(self): Ensures correct output from draw_sample. In this case, number of examples to draw < number of original examples.
- ... | 1835a71ababb7ad7e47bfa19e62948d466559d56 | <|skeleton|>
class BootstrappingTests:
"""Each method is a unit test for bootstrapping.py."""
def test_draw_sample_small(self):
"""Ensures correct output from draw_sample. In this case, number of examples to draw < number of original examples."""
<|body_0|>
def test_draw_sample_large(self)... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BootstrappingTests:
"""Each method is a unit test for bootstrapping.py."""
def test_draw_sample_small(self):
"""Ensures correct output from draw_sample. In this case, number of examples to draw < number of original examples."""
this_sample_vector, these_sample_indices = bootstrapping.draw... | the_stack_v2_python_sparse | gewittergefahr/gg_utils/bootstrapping_test.py | thunderhoser/GewitterGefahr | train | 29 |
ffb3cf02866e62a4049bf20ebb9ce694f9be6adb | [
"deprecation('`PlayPlot` is marked as deprecated and will be removed in the near future.')\nself.data_callback = callback\nself.horizon_timesteps = horizon_timesteps\nself.plot_names = plot_names\nif plt is None:\n raise DependencyNotInstalled('matplotlib is not installed, run `pip install gym[other]`')\nnum_plo... | <|body_start_0|>
deprecation('`PlayPlot` is marked as deprecated and will be removed in the near future.')
self.data_callback = callback
self.horizon_timesteps = horizon_timesteps
self.plot_names = plot_names
if plt is None:
raise DependencyNotInstalled('matplotlib is... | Provides a callback to create live plots of arbitrary metrics when using :func:`play`. This class is instantiated with a function that accepts information about a single environment transition: - obs_t: observation before performing action - obs_tp1: observation after performing action - action: action that was execute... | PlayPlot | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlayPlot:
"""Provides a callback to create live plots of arbitrary metrics when using :func:`play`. This class is instantiated with a function that accepts information about a single environment transition: - obs_t: observation before performing action - obs_tp1: observation after performing acti... | stack_v2_sparse_classes_75kplus_train_067833 | 15,289 | permissive | [
{
"docstring": "Constructor of :class:`PlayPlot`. The function ``callback`` that is passed to this constructor should return a list of metrics that is of length ``len(plot_names)``. Args: callback: Function that computes metrics from environment transitions horizon_timesteps: The time horizon used for the live ... | 2 | stack_v2_sparse_classes_30k_val_001838 | Implement the Python class `PlayPlot` described below.
Class description:
Provides a callback to create live plots of arbitrary metrics when using :func:`play`. This class is instantiated with a function that accepts information about a single environment transition: - obs_t: observation before performing action - obs... | Implement the Python class `PlayPlot` described below.
Class description:
Provides a callback to create live plots of arbitrary metrics when using :func:`play`. This class is instantiated with a function that accepts information about a single environment transition: - obs_t: observation before performing action - obs... | 53d784eafed28d31ec41c36ebd9eee14b0dc6d41 | <|skeleton|>
class PlayPlot:
"""Provides a callback to create live plots of arbitrary metrics when using :func:`play`. This class is instantiated with a function that accepts information about a single environment transition: - obs_t: observation before performing action - obs_tp1: observation after performing acti... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PlayPlot:
"""Provides a callback to create live plots of arbitrary metrics when using :func:`play`. This class is instantiated with a function that accepts information about a single environment transition: - obs_t: observation before performing action - obs_tp1: observation after performing action - action: ... | the_stack_v2_python_sparse | gym/utils/play.py | thomascherickal/gym | train | 2 |
e0a5856f0d0d8b8de9fc2901f0bb13aeae2a6d4b | [
"super(DecoderRNNCellJointCopy, self).__init__()\nself._word_emb_dim = word_emb_dim\nself._word_vocab_size = word_vocab_size\nself._embedding = tf.keras.layers.Embedding(word_vocab_size, word_emb_dim)\nself._rnn_1 = tf.keras.layers.LSTMCell(decoder_rnn_dim, recurrent_initializer='glorot_uniform', dropout=dropout_ra... | <|body_start_0|>
super(DecoderRNNCellJointCopy, self).__init__()
self._word_emb_dim = word_emb_dim
self._word_vocab_size = word_vocab_size
self._embedding = tf.keras.layers.Embedding(word_vocab_size, word_emb_dim)
self._rnn_1 = tf.keras.layers.LSTMCell(decoder_rnn_dim, recurrent_... | The DecoderRNNCellJointCopy should be used as the Decoder part of the EncoderDecoderBasic model and EncoderDecoderContentSelection model This is the Joint-Copy decoder as explained in section 4.3 | DecoderRNNCellJointCopy | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DecoderRNNCellJointCopy:
"""The DecoderRNNCellJointCopy should be used as the Decoder part of the EncoderDecoderBasic model and EncoderDecoderContentSelection model This is the Joint-Copy decoder as explained in section 4.3"""
def __init__(self, word_vocab_size, word_emb_dim, decoder_rnn_dim... | stack_v2_sparse_classes_75kplus_train_067834 | 20,690 | no_license | [
{
"docstring": "Initialize the DecoderRNNCellJointCopy Args: word_vocab_size (int): size of the vocabulary of words in the summaries word_emb_dim (int): embedding dimensionality to which project the word from the summary decoder_rnn_dim (int): the hidden dimensionality to which the inputs are transformed batch_... | 2 | stack_v2_sparse_classes_30k_train_039514 | Implement the Python class `DecoderRNNCellJointCopy` described below.
Class description:
The DecoderRNNCellJointCopy should be used as the Decoder part of the EncoderDecoderBasic model and EncoderDecoderContentSelection model This is the Joint-Copy decoder as explained in section 4.3
Method signatures and docstrings:... | Implement the Python class `DecoderRNNCellJointCopy` described below.
Class description:
The DecoderRNNCellJointCopy should be used as the Decoder part of the EncoderDecoderBasic model and EncoderDecoderContentSelection model This is the Joint-Copy decoder as explained in section 4.3
Method signatures and docstrings:... | bba791d9337a30fdadef28645525dc75bf926132 | <|skeleton|>
class DecoderRNNCellJointCopy:
"""The DecoderRNNCellJointCopy should be used as the Decoder part of the EncoderDecoderBasic model and EncoderDecoderContentSelection model This is the Joint-Copy decoder as explained in section 4.3"""
def __init__(self, word_vocab_size, word_emb_dim, decoder_rnn_dim... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DecoderRNNCellJointCopy:
"""The DecoderRNNCellJointCopy should be used as the Decoder part of the EncoderDecoderBasic model and EncoderDecoderContentSelection model This is the Joint-Copy decoder as explained in section 4.3"""
def __init__(self, word_vocab_size, word_emb_dim, decoder_rnn_dim, batch_size,... | the_stack_v2_python_sparse | rotowire/neural_nets/layers.py | gortibaldik/TTTGen | train | 4 |
fb6a4803b435aa60f879840400060d107c129cf5 | [
"self.storage.append(longUrl)\nn = len(self.storage)\nn <<= 1\ns = ''\nwhile n:\n n, i = divmod(n, len(self.allowed_chars))\n s += self.allowed_chars[i]\nreturn self.prefix + s",
"shortUrl = shortUrl[len(self.prefix):]\nn = 0\nbase = 1\nfor c in shortUrl:\n i = self.allowed_chars.index(c)\n n += base ... | <|body_start_0|>
self.storage.append(longUrl)
n = len(self.storage)
n <<= 1
s = ''
while n:
n, i = divmod(n, len(self.allowed_chars))
s += self.allowed_chars[i]
return self.prefix + s
<|end_body_0|>
<|body_start_1|>
shortUrl = shortUrl[len... | 06/02/2020 23:01 | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
"""06/02/2020 23:01"""
def encode(self, longUrl: str) -> str:
"""Encodes a URL to a shortened URL."""
<|body_0|>
def decode(self, shortUrl: str) -> str:
"""Decodes a shortened URL to its original URL."""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_75kplus_train_067835 | 3,269 | no_license | [
{
"docstring": "Encodes a URL to a shortened URL.",
"name": "encode",
"signature": "def encode(self, longUrl: str) -> str"
},
{
"docstring": "Decodes a shortened URL to its original URL.",
"name": "decode",
"signature": "def decode(self, shortUrl: str) -> str"
}
] | 2 | stack_v2_sparse_classes_30k_train_007181 | Implement the Python class `Codec` described below.
Class description:
06/02/2020 23:01
Method signatures and docstrings:
- def encode(self, longUrl: str) -> str: Encodes a URL to a shortened URL.
- def decode(self, shortUrl: str) -> str: Decodes a shortened URL to its original URL. | Implement the Python class `Codec` described below.
Class description:
06/02/2020 23:01
Method signatures and docstrings:
- def encode(self, longUrl: str) -> str: Encodes a URL to a shortened URL.
- def decode(self, shortUrl: str) -> str: Decodes a shortened URL to its original URL.
<|skeleton|>
class Codec:
"""... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Codec:
"""06/02/2020 23:01"""
def encode(self, longUrl: str) -> str:
"""Encodes a URL to a shortened URL."""
<|body_0|>
def decode(self, shortUrl: str) -> str:
"""Decodes a shortened URL to its original URL."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
"""06/02/2020 23:01"""
def encode(self, longUrl: str) -> str:
"""Encodes a URL to a shortened URL."""
self.storage.append(longUrl)
n = len(self.storage)
n <<= 1
s = ''
while n:
n, i = divmod(n, len(self.allowed_chars))
s += se... | the_stack_v2_python_sparse | leetcode/solved/535_Encode_and_Decode_TinyURL/solution.py | sungminoh/algorithms | train | 0 |
8c427bb2076e8aeade30aa179a4338e208a62544 | [
"if self.current_user is None:\n return\ntry:\n user_id = int(user_id)\nexcept ValueError:\n self.set_status(400, 'Parameter must be an integer')\nif user_id == self.current_user.id:\n ret = {'user': self.current_user.serialize()}\nelse:\n try:\n user = self.api_endpoint.user_by_id(self.curren... | <|body_start_0|>
if self.current_user is None:
return
try:
user_id = int(user_id)
except ValueError:
self.set_status(400, 'Parameter must be an integer')
if user_id == self.current_user.id:
ret = {'user': self.current_user.serialize()}
... | The User API endpoint. Ops on a single user. | UserAPI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserAPI:
"""The User API endpoint. Ops on a single user."""
def get(self, user_id):
"""HTTP GET method."""
<|body_0|>
def post(self, user_id):
"""HTTP POST method, to edit a user."""
<|body_1|>
def delete(self, user_id: int):
"""HTTP DELETE m... | stack_v2_sparse_classes_75kplus_train_067836 | 7,558 | permissive | [
{
"docstring": "HTTP GET method.",
"name": "get",
"signature": "def get(self, user_id)"
},
{
"docstring": "HTTP POST method, to edit a user.",
"name": "post",
"signature": "def post(self, user_id)"
},
{
"docstring": "HTTP DELETE method.",
"name": "delete",
"signature": "d... | 3 | stack_v2_sparse_classes_30k_test_000117 | Implement the Python class `UserAPI` described below.
Class description:
The User API endpoint. Ops on a single user.
Method signatures and docstrings:
- def get(self, user_id): HTTP GET method.
- def post(self, user_id): HTTP POST method, to edit a user.
- def delete(self, user_id: int): HTTP DELETE method. | Implement the Python class `UserAPI` described below.
Class description:
The User API endpoint. Ops on a single user.
Method signatures and docstrings:
- def get(self, user_id): HTTP GET method.
- def post(self, user_id): HTTP POST method, to edit a user.
- def delete(self, user_id: int): HTTP DELETE method.
<|skele... | c8e0c908af1954a8b41d0f6de23d08589564f0ab | <|skeleton|>
class UserAPI:
"""The User API endpoint. Ops on a single user."""
def get(self, user_id):
"""HTTP GET method."""
<|body_0|>
def post(self, user_id):
"""HTTP POST method, to edit a user."""
<|body_1|>
def delete(self, user_id: int):
"""HTTP DELETE m... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserAPI:
"""The User API endpoint. Ops on a single user."""
def get(self, user_id):
"""HTTP GET method."""
if self.current_user is None:
return
try:
user_id = int(user_id)
except ValueError:
self.set_status(400, 'Parameter must be an int... | the_stack_v2_python_sparse | zoe_api/rest_api/user.py | DistributedSystemsGroup/zoe | train | 60 |
271497ab86586c5743b4b8a6bfeb9ebf81d828ed | [
"def before_hook(req, resp, params=None):\n return self.process_request(req, resp)\ntry:\n return before_hook\nexcept AttributeError as ex:\n message_template = 'Failed to get before hook from middleware {0} - {1}'\n message = message_template.format(self.__name__, ex.message)\n LOG.error(message)\n ... | <|body_start_0|>
def before_hook(req, resp, params=None):
return self.process_request(req, resp)
try:
return before_hook
except AttributeError as ex:
message_template = 'Failed to get before hook from middleware {0} - {1}'
message = message_templat... | Provides methods to extract before and after hooks from WSGI Middleware Prior to falcon 0.2.0b1, it's necessary to provide falcon with middleware as "hook" functions that are either invoked before (to process requests) or after (to process responses) the API endpoint code runs. This mixin allows the process_request and... | HookableMiddlewareMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HookableMiddlewareMixin:
"""Provides methods to extract before and after hooks from WSGI Middleware Prior to falcon 0.2.0b1, it's necessary to provide falcon with middleware as "hook" functions that are either invoked before (to process requests) or after (to process responses) the API endpoint c... | stack_v2_sparse_classes_75kplus_train_067837 | 9,114 | permissive | [
{
"docstring": "Extract process_request method as \"before\" hook :return: before hook function",
"name": "as_before_hook",
"signature": "def as_before_hook(self)"
},
{
"docstring": "Extract process_response method as \"after\" hook :return: after hook function",
"name": "as_after_hook",
... | 2 | stack_v2_sparse_classes_30k_train_008126 | Implement the Python class `HookableMiddlewareMixin` described below.
Class description:
Provides methods to extract before and after hooks from WSGI Middleware Prior to falcon 0.2.0b1, it's necessary to provide falcon with middleware as "hook" functions that are either invoked before (to process requests) or after (t... | Implement the Python class `HookableMiddlewareMixin` described below.
Class description:
Provides methods to extract before and after hooks from WSGI Middleware Prior to falcon 0.2.0b1, it's necessary to provide falcon with middleware as "hook" functions that are either invoked before (to process requests) or after (t... | 70aa35a396d5f76753616f5289228f9c2b0e7ec7 | <|skeleton|>
class HookableMiddlewareMixin:
"""Provides methods to extract before and after hooks from WSGI Middleware Prior to falcon 0.2.0b1, it's necessary to provide falcon with middleware as "hook" functions that are either invoked before (to process requests) or after (to process responses) the API endpoint c... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HookableMiddlewareMixin:
"""Provides methods to extract before and after hooks from WSGI Middleware Prior to falcon 0.2.0b1, it's necessary to provide falcon with middleware as "hook" functions that are either invoked before (to process requests) or after (to process responses) the API endpoint code runs. Thi... | the_stack_v2_python_sparse | deckhand/control/middleware.py | airshipit/deckhand | train | 3 |
4fbb8ede5259207f05f432811cdaf1913b950b21 | [
"fp = _get_file_context(file)\nwith fp:\n fp.write(self.buffer)\nreturn self",
"fp = _get_file_context(file)\nwith fp:\n buffer = _uri_to_buffer(self.uri)\n fp.write(buffer)\nreturn self"
] | <|body_start_0|>
fp = _get_file_context(file)
with fp:
fp.write(self.buffer)
return self
<|end_body_0|>
<|body_start_1|>
fp = _get_file_context(file)
with fp:
buffer = _uri_to_buffer(self.uri)
fp.write(buffer)
return self
<|end_body_1|... | Provide helper functions for :class:`Document` to dump content to a file. | DumpFileMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DumpFileMixin:
"""Provide helper functions for :class:`Document` to dump content to a file."""
def dump_buffer_to_file(self: T, file: Union[str, BinaryIO]) -> T:
"""Save :attr:`.buffer` into a file :param file: File or filename to which the data is saved. :return: itself after proces... | stack_v2_sparse_classes_75kplus_train_067838 | 945 | permissive | [
{
"docstring": "Save :attr:`.buffer` into a file :param file: File or filename to which the data is saved. :return: itself after processed",
"name": "dump_buffer_to_file",
"signature": "def dump_buffer_to_file(self: T, file: Union[str, BinaryIO]) -> T"
},
{
"docstring": "Save :attr:`.uri` into a... | 2 | stack_v2_sparse_classes_30k_train_016716 | Implement the Python class `DumpFileMixin` described below.
Class description:
Provide helper functions for :class:`Document` to dump content to a file.
Method signatures and docstrings:
- def dump_buffer_to_file(self: T, file: Union[str, BinaryIO]) -> T: Save :attr:`.buffer` into a file :param file: File or filename... | Implement the Python class `DumpFileMixin` described below.
Class description:
Provide helper functions for :class:`Document` to dump content to a file.
Method signatures and docstrings:
- def dump_buffer_to_file(self: T, file: Union[str, BinaryIO]) -> T: Save :attr:`.buffer` into a file :param file: File or filename... | 34c34acfb0115ad2ec4cc8e2e9a86c521855612f | <|skeleton|>
class DumpFileMixin:
"""Provide helper functions for :class:`Document` to dump content to a file."""
def dump_buffer_to_file(self: T, file: Union[str, BinaryIO]) -> T:
"""Save :attr:`.buffer` into a file :param file: File or filename to which the data is saved. :return: itself after proces... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DumpFileMixin:
"""Provide helper functions for :class:`Document` to dump content to a file."""
def dump_buffer_to_file(self: T, file: Union[str, BinaryIO]) -> T:
"""Save :attr:`.buffer` into a file :param file: File or filename to which the data is saved. :return: itself after processed"""
... | the_stack_v2_python_sparse | jina/types/document/mixins/dump.py | amitesh1as/jina | train | 0 |
f53bb2124ce5b4d5d7c7dcdd43be118a412e5ba0 | [
"for line in matrix:\n if target in line:\n return True\nreturn False",
"h = len(matrix)\nif h == 0:\n return False\nw = len(matrix[0])\nif w == 0:\n return False\nleft = 0\nright = h * w - 1\nwhile left <= right:\n mid = (left + right) // 2\n i = mid // w\n j = mid % w\n if matrix[i][... | <|body_start_0|>
for line in matrix:
if target in line:
return True
return False
<|end_body_0|>
<|body_start_1|>
h = len(matrix)
if h == 0:
return False
w = len(matrix[0])
if w == 0:
return False
left = 0
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
"""可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool"""
<|body_0|>
def searchMatrix1(self, matrix: List[List[int]], target: int) -> bool:
"""利用二分法查... | stack_v2_sparse_classes_75kplus_train_067839 | 2,816 | no_license | [
{
"docstring": "可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool",
"name": "searchMatrix",
"signature": "def searchMatrix(self, matrix: List[List[int]], target: int) -> bool"
},
{
"docstring": "利用二分法查找,其时间复杂度为O(mn) 注意: h = len(matrix) if h == 0: return Fa... | 3 | stack_v2_sparse_classes_30k_train_008523 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: 可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool
- def searchMatrix... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix: List[List[int]], target: int) -> bool: 可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool
- def searchMatrix... | 51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a | <|skeleton|>
class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
"""可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool"""
<|body_0|>
def searchMatrix1(self, matrix: List[List[int]], target: int) -> bool:
"""利用二分法查... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
"""可以直接搜索,也就是暴力搜索法,但是这种效率太低 注意题目说的是高效的算法 :param matrix:list :param target: int :return: bool"""
for line in matrix:
if target in line:
return True
return False
def searchMat... | the_stack_v2_python_sparse | LeetCode_practice/0074_SearchMatrix.py | LeBron-Jian/BasicAlgorithmPractice | train | 13 | |
3c620b699ecff95c27f0ba5ee4a73f770fb45089 | [
"check_cluster_name(cluster_name, application_name)\nvalidate_fields(instance_schema, {'application': application_name, 'cluster': cluster_name, 'key': key})\nim = InstanceManagement(huskar_client, application_name, SERVICE_SUBDOMAIN)\ninstance, _ = im.get_instance(cluster_name, key, resolve=False)\nif instance.sta... | <|body_start_0|>
check_cluster_name(cluster_name, application_name)
validate_fields(instance_schema, {'application': application_name, 'cluster': cluster_name, 'key': key})
im = InstanceManagement(huskar_client, application_name, SERVICE_SUBDOMAIN)
instance, _ = im.get_instance(cluster_n... | ServiceInstanceWeightView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServiceInstanceWeightView:
def get(self, application_name, cluster_name, key):
"""Gets the weight of specified service instance. :param application_name: The name of application. :param cluster_name: The name of cluster. :param key: The key of service instance. :<header Authorization: Hu... | stack_v2_sparse_classes_75kplus_train_067840 | 17,926 | permissive | [
{
"docstring": "Gets the weight of specified service instance. :param application_name: The name of application. :param cluster_name: The name of cluster. :param key: The key of service instance. :<header Authorization: Huskar Token (See :ref:`token`) :status 404: The instance is not found. :status 200: The res... | 2 | stack_v2_sparse_classes_30k_train_041062 | Implement the Python class `ServiceInstanceWeightView` described below.
Class description:
Implement the ServiceInstanceWeightView class.
Method signatures and docstrings:
- def get(self, application_name, cluster_name, key): Gets the weight of specified service instance. :param application_name: The name of applicat... | Implement the Python class `ServiceInstanceWeightView` described below.
Class description:
Implement the ServiceInstanceWeightView class.
Method signatures and docstrings:
- def get(self, application_name, cluster_name, key): Gets the weight of specified service instance. :param application_name: The name of applicat... | 395775c59c7da97c46efe9756365cad028b7c95a | <|skeleton|>
class ServiceInstanceWeightView:
def get(self, application_name, cluster_name, key):
"""Gets the weight of specified service instance. :param application_name: The name of application. :param cluster_name: The name of cluster. :param key: The key of service instance. :<header Authorization: Hu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ServiceInstanceWeightView:
def get(self, application_name, cluster_name, key):
"""Gets the weight of specified service instance. :param application_name: The name of application. :param cluster_name: The name of cluster. :param key: The key of service instance. :<header Authorization: Huskar Token (Se... | the_stack_v2_python_sparse | huskar_api/api/service_instance.py | Zheaoli/huskar | train | 0 | |
cac5bc80ce50617e784e8a2b96a40115440b6f16 | [
"super(DarknetConv2D_BN_Mish, self).__init__()\nno_bias_kwargs = {'use_bias': False}\nno_bias_kwargs.update(kwargs)\nself.conv1 = DarknetConv2D(*args, **no_bias_kwargs)\nself.bn1 = tf.keras.layers.BatchNormalization()\nself.mish1 = Mish()",
"x = self.conv1(x)\nx = self.bn1(x, training=training)\nx = self.mish1(x)... | <|body_start_0|>
super(DarknetConv2D_BN_Mish, self).__init__()
no_bias_kwargs = {'use_bias': False}
no_bias_kwargs.update(kwargs)
self.conv1 = DarknetConv2D(*args, **no_bias_kwargs)
self.bn1 = tf.keras.layers.BatchNormalization()
self.mish1 = Mish()
<|end_body_0|>
<|body... | DarknetConv2D_BN_Mish | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DarknetConv2D_BN_Mish:
def __init__(self, *args, **kwargs):
"""初始化网络"""
<|body_0|>
def call(self, x, training):
"""运算部分"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(DarknetConv2D_BN_Mish, self).__init__()
no_bias_kwargs = {'use_bias... | stack_v2_sparse_classes_75kplus_train_067841 | 16,727 | no_license | [
{
"docstring": "初始化网络",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "运算部分",
"name": "call",
"signature": "def call(self, x, training)"
}
] | 2 | stack_v2_sparse_classes_30k_train_049465 | Implement the Python class `DarknetConv2D_BN_Mish` described below.
Class description:
Implement the DarknetConv2D_BN_Mish class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): 初始化网络
- def call(self, x, training): 运算部分 | Implement the Python class `DarknetConv2D_BN_Mish` described below.
Class description:
Implement the DarknetConv2D_BN_Mish class.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): 初始化网络
- def call(self, x, training): 运算部分
<|skeleton|>
class DarknetConv2D_BN_Mish:
def __init__(self, *args,... | b7549701b0b1a7e4cc2c8275df2bc6c7a3253d24 | <|skeleton|>
class DarknetConv2D_BN_Mish:
def __init__(self, *args, **kwargs):
"""初始化网络"""
<|body_0|>
def call(self, x, training):
"""运算部分"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DarknetConv2D_BN_Mish:
def __init__(self, *args, **kwargs):
"""初始化网络"""
super(DarknetConv2D_BN_Mish, self).__init__()
no_bias_kwargs = {'use_bias': False}
no_bias_kwargs.update(kwargs)
self.conv1 = DarknetConv2D(*args, **no_bias_kwargs)
self.bn1 = tf.keras.layer... | the_stack_v2_python_sparse | AIServer/ai_api/ai_models/utils/tf_yolo_utils.py | tfwcn/tensorflow2-machine-vision | train | 1 | |
9e0e45d46a3d8009059101e433f45d7038fedd31 | [
"modules_data = data[src]\nif modules_data.shape[1] == self._module_shape[1]:\n return np.transpose(modules_data, (3, 0, 2, 1))\nreturn modules_data",
"modules_data = stack_detector_data(data[src], src.split(' ')[1], real_array=False)\ndtype = modules_data.dtype\nif dtype == _IMAGE_DTYPE:\n return modules_d... | <|body_start_0|>
modules_data = data[src]
if modules_data.shape[1] == self._module_shape[1]:
return np.transpose(modules_data, (3, 0, 2, 1))
return modules_data
<|end_body_0|>
<|body_start_1|>
modules_data = stack_detector_data(data[src], src.split(' ')[1], real_array=False)... | AgipdImageAssembler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AgipdImageAssembler:
def _get_modules_bridge(self, data, src, modules):
"""Override. Should work for both raw and calibrated data, according to DSSC. - calibrated, "image.data", (modules, x, y, memory cells) - raw, "image.data", (modules, x, y, memory cells) -> (memory cells, modules, y,... | stack_v2_sparse_classes_75kplus_train_067842 | 23,340 | permissive | [
{
"docstring": "Override. Should work for both raw and calibrated data, according to DSSC. - calibrated, \"image.data\", (modules, x, y, memory cells) - raw, \"image.data\", (modules, x, y, memory cells) -> (memory cells, modules, y, x)",
"name": "_get_modules_bridge",
"signature": "def _get_modules_bri... | 2 | stack_v2_sparse_classes_30k_train_004370 | Implement the Python class `AgipdImageAssembler` described below.
Class description:
Implement the AgipdImageAssembler class.
Method signatures and docstrings:
- def _get_modules_bridge(self, data, src, modules): Override. Should work for both raw and calibrated data, according to DSSC. - calibrated, "image.data", (m... | Implement the Python class `AgipdImageAssembler` described below.
Class description:
Implement the AgipdImageAssembler class.
Method signatures and docstrings:
- def _get_modules_bridge(self, data, src, modules): Override. Should work for both raw and calibrated data, according to DSSC. - calibrated, "image.data", (m... | a6ee28040b15ae8d110570bd9f3c37e5a3e70fc0 | <|skeleton|>
class AgipdImageAssembler:
def _get_modules_bridge(self, data, src, modules):
"""Override. Should work for both raw and calibrated data, according to DSSC. - calibrated, "image.data", (modules, x, y, memory cells) - raw, "image.data", (modules, x, y, memory cells) -> (memory cells, modules, y,... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AgipdImageAssembler:
def _get_modules_bridge(self, data, src, modules):
"""Override. Should work for both raw and calibrated data, according to DSSC. - calibrated, "image.data", (modules, x, y, memory cells) - raw, "image.data", (modules, x, y, memory cells) -> (memory cells, modules, y, x)"""
... | the_stack_v2_python_sparse | extra_foam/pipeline/processors/image_assembler.py | European-XFEL/EXtra-foam | train | 8 | |
d75706f2d2e02af4e32ce16521ada1dc488f89d2 | [
"query = self.session.query(LogQueryModel)\nquery = query.filter(LogQueryModel.user_id == user_id)\nreturn query.all()",
"logquery_id = kwargs.get('id', None)\nlogquery = LogQueryModel.from_dict(kwargs)\nif logquery_id is None:\n self.session.add(logquery)\n self.session.commit()\nelse:\n query = self.se... | <|body_start_0|>
query = self.session.query(LogQueryModel)
query = query.filter(LogQueryModel.user_id == user_id)
return query.all()
<|end_body_0|>
<|body_start_1|>
logquery_id = kwargs.get('id', None)
logquery = LogQueryModel.from_dict(kwargs)
if logquery_id is None:
... | LogQueryDao | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogQueryDao:
def get_user_logquerys(self, user_id):
"""根据用户id来查询日志查询列表 :param user_id: :return:"""
<|body_0|>
def update_logquery(self, **kwargs):
"""如果参数中不包含id,则新增日志查询,包含id,则修改日志查询"""
<|body_1|>
def update_logquery_file(self, logquery_id, page=None, tot... | stack_v2_sparse_classes_75kplus_train_067843 | 2,361 | permissive | [
{
"docstring": "根据用户id来查询日志查询列表 :param user_id: :return:",
"name": "get_user_logquerys",
"signature": "def get_user_logquerys(self, user_id)"
},
{
"docstring": "如果参数中不包含id,则新增日志查询,包含id,则修改日志查询",
"name": "update_logquery",
"signature": "def update_logquery(self, **kwargs)"
},
{
"d... | 4 | stack_v2_sparse_classes_30k_train_007954 | Implement the Python class `LogQueryDao` described below.
Class description:
Implement the LogQueryDao class.
Method signatures and docstrings:
- def get_user_logquerys(self, user_id): 根据用户id来查询日志查询列表 :param user_id: :return:
- def update_logquery(self, **kwargs): 如果参数中不包含id,则新增日志查询,包含id,则修改日志查询
- def update_logquery... | Implement the Python class `LogQueryDao` described below.
Class description:
Implement the LogQueryDao class.
Method signatures and docstrings:
- def get_user_logquerys(self, user_id): 根据用户id来查询日志查询列表 :param user_id: :return:
- def update_logquery(self, **kwargs): 如果参数中不包含id,则新增日志查询,包含id,则修改日志查询
- def update_logquery... | 2e32e6e7b225e0bd87ee8c847c22862f12c51bb1 | <|skeleton|>
class LogQueryDao:
def get_user_logquerys(self, user_id):
"""根据用户id来查询日志查询列表 :param user_id: :return:"""
<|body_0|>
def update_logquery(self, **kwargs):
"""如果参数中不包含id,则新增日志查询,包含id,则修改日志查询"""
<|body_1|>
def update_logquery_file(self, logquery_id, page=None, tot... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LogQueryDao:
def get_user_logquerys(self, user_id):
"""根据用户id来查询日志查询列表 :param user_id: :return:"""
query = self.session.query(LogQueryModel)
query = query.filter(LogQueryModel.user_id == user_id)
return query.all()
def update_logquery(self, **kwargs):
"""如果参数中不包含id... | the_stack_v2_python_sparse | nebula/dao/logquery_dao.py | threathunterX/nebula_web | train | 2 | |
3de583f2f00f4914d1aa86d9d991dd8cc02811f0 | [
"if not nums:\n return 0\nif len(nums) == 1:\n return nums[0]\nmax_sum = -2 ** 23\nsums = []\nfor i in range(len(nums)):\n sums.append(nums[i])\n if nums[i] > max_sum:\n max_sum = nums[i]\n for j in range(len(nums)):\n k = i + j + 1\n if k >= len(nums):\n break\n ... | <|body_start_0|>
if not nums:
return 0
if len(nums) == 1:
return nums[0]
max_sum = -2 ** 23
sums = []
for i in range(len(nums)):
sums.append(nums[i])
if nums[i] > max_sum:
max_sum = nums[i]
for j in range... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArray1(self, nums) -> int:
"""暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/"""
<|body_0|>
def maxSubArray2(self, nums) -> int:
"""时间复杂度 : O(n) 执行用时 : 64 ms, 在Maximum Subarray的Python3提交中击败了72.70% 的用户 内存消耗 : 13.4 MB, 在Maximum Sub... | stack_v2_sparse_classes_75kplus_train_067844 | 4,928 | no_license | [
{
"docstring": "暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/",
"name": "maxSubArray1",
"signature": "def maxSubArray1(self, nums) -> int"
},
{
"docstring": "时间复杂度 : O(n) 执行用时 : 64 ms, 在Maximum Subarray的Python3提交中击败了72.70% 的用户 内存消耗 : 13.4 MB, 在Maximum Subarray的Python3提交中击败了96... | 4 | stack_v2_sparse_classes_30k_train_011211 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray1(self, nums) -> int: 暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/
- def maxSubArray2(self, nums) -> int: 时间复杂度 : O(n) 执行用时 : 64 ms, 在Maximum ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray1(self, nums) -> int: 暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/
- def maxSubArray2(self, nums) -> int: 时间复杂度 : O(n) 执行用时 : 64 ms, 在Maximum ... | 7bca9dc8ec211be15c12f89bffbb680d639f87bf | <|skeleton|>
class Solution:
def maxSubArray1(self, nums) -> int:
"""暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/"""
<|body_0|>
def maxSubArray2(self, nums) -> int:
"""时间复杂度 : O(n) 执行用时 : 64 ms, 在Maximum Subarray的Python3提交中击败了72.70% 的用户 内存消耗 : 13.4 MB, 在Maximum Sub... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maxSubArray1(self, nums) -> int:
"""暴力解法,时间超限,详见 https://leetcode-cn.com/submissions/detail/18022319/"""
if not nums:
return 0
if len(nums) == 1:
return nums[0]
max_sum = -2 ** 23
sums = []
for i in range(len(nums)):
... | the_stack_v2_python_sparse | python/leetcode/53-maximum-subarray.py | wxnacy/study | train | 18 | |
6bc2317db19de77fb8027f00fa007d875238fc9d | [
"tables = Table.objects.all()\nserializer = TableSerializer(tables, many=True)\nreturn Response(serializer.data)",
"serializer = TableSerializer(data=request.data)\nif serializer.is_valid():\n serializer.save()\n return Response(serializer.data, status=status.HTTP_201_CREATED)\nreturn Response(serializer.er... | <|body_start_0|>
tables = Table.objects.all()
serializer = TableSerializer(tables, many=True)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
serializer = TableSerializer(data=request.data)
if serializer.is_valid():
serializer.save()
retu... | TableListCreateAPIView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TableListCreateAPIView:
def get(self, request: Request) -> Response:
"""GET method for the Table model. Args: request (Request): retrieval HttpRequest. Returns: Response: Http response with every table created."""
<|body_0|>
def post(self, request: Request) -> Response:
... | stack_v2_sparse_classes_75kplus_train_067845 | 9,678 | no_license | [
{
"docstring": "GET method for the Table model. Args: request (Request): retrieval HttpRequest. Returns: Response: Http response with every table created.",
"name": "get",
"signature": "def get(self, request: Request) -> Response"
},
{
"docstring": "POST method for the Table model. Args: request... | 2 | null | Implement the Python class `TableListCreateAPIView` described below.
Class description:
Implement the TableListCreateAPIView class.
Method signatures and docstrings:
- def get(self, request: Request) -> Response: GET method for the Table model. Args: request (Request): retrieval HttpRequest. Returns: Response: Http r... | Implement the Python class `TableListCreateAPIView` described below.
Class description:
Implement the TableListCreateAPIView class.
Method signatures and docstrings:
- def get(self, request: Request) -> Response: GET method for the Table model. Args: request (Request): retrieval HttpRequest. Returns: Response: Http r... | 4f8f90e3d56df134d8d94154c4ed81964ebde033 | <|skeleton|>
class TableListCreateAPIView:
def get(self, request: Request) -> Response:
"""GET method for the Table model. Args: request (Request): retrieval HttpRequest. Returns: Response: Http response with every table created."""
<|body_0|>
def post(self, request: Request) -> Response:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TableListCreateAPIView:
def get(self, request: Request) -> Response:
"""GET method for the Table model. Args: request (Request): retrieval HttpRequest. Returns: Response: Http response with every table created."""
tables = Table.objects.all()
serializer = TableSerializer(tables, many=T... | the_stack_v2_python_sparse | menu/api/views.py | jimenz91/xinchao | train | 0 | |
ff468a322f25c048f349d31af13bb2cd16e4654c | [
"return_type = ini['return_type']\nif not return_type in DynCallCalls:\n raise ValueError('Unknown return type \"{0}\"'.format(return_type))\nmodule = ini['module']\nmodule = module.replace('$gamename', GAME_NAME)\nmodule = ModuleData[module]\nif os_name == 'nt':\n sig = unhexlify(ini['sig'].replace(' ', ''))... | <|body_start_0|>
return_type = ini['return_type']
if not return_type in DynCallCalls:
raise ValueError('Unknown return type "{0}"'.format(return_type))
module = ini['module']
module = module.replace('$gamename', GAME_NAME)
module = ModuleData[module]
if os_nam... | Class used to call a dynamic function | Signature | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Signature:
"""Class used to call a dynamic function"""
def __init__(self, ini):
"""Called when the instance is initializes"""
<|body_0|>
def call_function(self, *args):
"""Calls the function with the given arguments"""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_75kplus_train_067846 | 3,508 | no_license | [
{
"docstring": "Called when the instance is initializes",
"name": "__init__",
"signature": "def __init__(self, ini)"
},
{
"docstring": "Calls the function with the given arguments",
"name": "call_function",
"signature": "def call_function(self, *args)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000711 | Implement the Python class `Signature` described below.
Class description:
Class used to call a dynamic function
Method signatures and docstrings:
- def __init__(self, ini): Called when the instance is initializes
- def call_function(self, *args): Calls the function with the given arguments | Implement the Python class `Signature` described below.
Class description:
Class used to call a dynamic function
Method signatures and docstrings:
- def __init__(self, ini): Called when the instance is initializes
- def call_function(self, *args): Calls the function with the given arguments
<|skeleton|>
class Signat... | b84df87f67ecb0fb2487e68e8b4b6bee3944f506 | <|skeleton|>
class Signature:
"""Class used to call a dynamic function"""
def __init__(self, ini):
"""Called when the instance is initializes"""
<|body_0|>
def call_function(self, *args):
"""Calls the function with the given arguments"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Signature:
"""Class used to call a dynamic function"""
def __init__(self, ini):
"""Called when the instance is initializes"""
return_type = ini['return_type']
if not return_type in DynCallCalls:
raise ValueError('Unknown return type "{0}"'.format(return_type))
... | the_stack_v2_python_sparse | addons/source-python/packages/source-python/dyncall/signature.py | aurorapar/Source.Python | train | 0 |
0c2a099823d5ccba1ae9c71384818ac57ce242a9 | [
"super().__init__(model=model, posterior_transform=posterior_transform)\nself.maximize = maximize\nif not torch.is_tensor(best_f):\n best_f = torch.tensor(best_f)\nself.register_buffer('best_f', best_f)",
"self.best_f = self.best_f.to(X)\nposterior = self.model.posterior(X=X, posterior_transform=self.posterior... | <|body_start_0|>
super().__init__(model=model, posterior_transform=posterior_transform)
self.maximize = maximize
if not torch.is_tensor(best_f):
best_f = torch.tensor(best_f)
self.register_buffer('best_f', best_f)
<|end_body_0|>
<|body_start_1|>
self.best_f = self.be... | Approximate, single-outcome batch Probability of Improvement using MVNXPB. This implementation uses MVNXPB, a bivariate conditioning algorithm for approximating P(a <= Y <= b) for multivariate normal Y. See [Trinh2015bivariate]_. This (analytic) approximate q-PI is given by `approx-qPI(X) = P(max Y >= best_f) = 1 - P(Y... | qAnalyticProbabilityOfImprovement | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class qAnalyticProbabilityOfImprovement:
"""Approximate, single-outcome batch Probability of Improvement using MVNXPB. This implementation uses MVNXPB, a bivariate conditioning algorithm for approximating P(a <= Y <= b) for multivariate normal Y. See [Trinh2015bivariate]_. This (analytic) approximate q... | stack_v2_sparse_classes_75kplus_train_067847 | 46,601 | permissive | [
{
"docstring": "qPI using an analytic approximation. Args: model: A fitted single-outcome model. best_f: Either a scalar or a `b`-dim Tensor (batch mode) representing the best function value observed so far (assumed noiseless). posterior_transform: A PosteriorTransform. If using a multi-output model, a Posterio... | 2 | stack_v2_sparse_classes_30k_train_012539 | Implement the Python class `qAnalyticProbabilityOfImprovement` described below.
Class description:
Approximate, single-outcome batch Probability of Improvement using MVNXPB. This implementation uses MVNXPB, a bivariate conditioning algorithm for approximating P(a <= Y <= b) for multivariate normal Y. See [Trinh2015biv... | Implement the Python class `qAnalyticProbabilityOfImprovement` described below.
Class description:
Approximate, single-outcome batch Probability of Improvement using MVNXPB. This implementation uses MVNXPB, a bivariate conditioning algorithm for approximating P(a <= Y <= b) for multivariate normal Y. See [Trinh2015biv... | 4cc5ed59b2e8a9c780f786830c548e05cc74d53c | <|skeleton|>
class qAnalyticProbabilityOfImprovement:
"""Approximate, single-outcome batch Probability of Improvement using MVNXPB. This implementation uses MVNXPB, a bivariate conditioning algorithm for approximating P(a <= Y <= b) for multivariate normal Y. See [Trinh2015bivariate]_. This (analytic) approximate q... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class qAnalyticProbabilityOfImprovement:
"""Approximate, single-outcome batch Probability of Improvement using MVNXPB. This implementation uses MVNXPB, a bivariate conditioning algorithm for approximating P(a <= Y <= b) for multivariate normal Y. See [Trinh2015bivariate]_. This (analytic) approximate q-PI is given ... | the_stack_v2_python_sparse | botorch/acquisition/analytic.py | pytorch/botorch | train | 2,891 |
f143ab870b4a94aaaca38a8ba58c508148bdc5ea | [
"t = np.arange(0, 5, 0.5)\nP = np.array([0, 0.33, 0.5, 0.9, 2, 4, 15, 16, 16.1, 16.2])\nOH = np.array([0, 0.33, 0.5, 0.9, 2, 4, 15, 16, 7, 2])\nCO = OH * 0.9\nt_ign = find_ignition_delay(t, P)\nself.assertEqual(t_ign, 2.75)\nt_ign = find_ignition_delay(t, OH, 'maxHalfConcentration')\nself.assertEqual(t_ign, 3)\nt_i... | <|body_start_0|>
t = np.arange(0, 5, 0.5)
P = np.array([0, 0.33, 0.5, 0.9, 2, 4, 15, 16, 16.1, 16.2])
OH = np.array([0, 0.33, 0.5, 0.9, 2, 4, 15, 16, 7, 2])
CO = OH * 0.9
t_ign = find_ignition_delay(t, P)
self.assertEqual(t_ign, 2.75)
t_ign = find_ignition_delay(t... | CanteraTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CanteraTest:
def test_ignition_delay(self):
"""Test that find_ignition_delay() works."""
<|body_0|>
def test_repr(self):
"""Test that the repr function for a CanteraCondition object can reconstitute the same object"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_067848 | 5,853 | permissive | [
{
"docstring": "Test that find_ignition_delay() works.",
"name": "test_ignition_delay",
"signature": "def test_ignition_delay(self)"
},
{
"docstring": "Test that the repr function for a CanteraCondition object can reconstitute the same object",
"name": "test_repr",
"signature": "def test... | 2 | stack_v2_sparse_classes_30k_val_002714 | Implement the Python class `CanteraTest` described below.
Class description:
Implement the CanteraTest class.
Method signatures and docstrings:
- def test_ignition_delay(self): Test that find_ignition_delay() works.
- def test_repr(self): Test that the repr function for a CanteraCondition object can reconstitute the ... | Implement the Python class `CanteraTest` described below.
Class description:
Implement the CanteraTest class.
Method signatures and docstrings:
- def test_ignition_delay(self): Test that find_ignition_delay() works.
- def test_repr(self): Test that the repr function for a CanteraCondition object can reconstitute the ... | 349a4af759cf8877197772cd7eaca1e51d46eff5 | <|skeleton|>
class CanteraTest:
def test_ignition_delay(self):
"""Test that find_ignition_delay() works."""
<|body_0|>
def test_repr(self):
"""Test that the repr function for a CanteraCondition object can reconstitute the same object"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CanteraTest:
def test_ignition_delay(self):
"""Test that find_ignition_delay() works."""
t = np.arange(0, 5, 0.5)
P = np.array([0, 0.33, 0.5, 0.9, 2, 4, 15, 16, 16.1, 16.2])
OH = np.array([0, 0.33, 0.5, 0.9, 2, 4, 15, 16, 7, 2])
CO = OH * 0.9
t_ign = find_igniti... | the_stack_v2_python_sparse | rmgpy/tools/canteramodelTest.py | CanePan-cc/CanePanWorkshop | train | 2 | |
62da1c75cfc3b08a5c306e4bee070e1e3de30cf2 | [
"self.foodIndex = 0\nself.snake = collections.deque()\nself.snake.append((0, 0))\nself.body = {(0, 0)}\nself.foods = food\nself.width = width\nself.height = height\nself.moves = {'U': (0, -1), 'L': (-1, 0), 'R': (1, 0), 'D': (0, 1)}",
"tail = self.snake.popleft()\nself.body.remove(tail)\nif not self.snake:\n h... | <|body_start_0|>
self.foodIndex = 0
self.snake = collections.deque()
self.snake.append((0, 0))
self.body = {(0, 0)}
self.foods = food
self.width = width
self.height = height
self.moves = {'U': (0, -1), 'L': (-1, 0), 'R': (1, 0), 'D': (0, 1)}
<|end_body_0|>... | SnakeGame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnakeGame:
def __init__(self, width, height, food):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ... | stack_v2_sparse_classes_75kplus_train_067849 | 15,245 | no_license | [
{
"docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :type height: int :type food: List[List[int]]",
... | 2 | stack_v2_sparse_classes_30k_train_009556 | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E... | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width, height, food): Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E... | 035ef08434fa1ca781a6fb2f9eed3538b7d20c02 | <|skeleton|>
class SnakeGame:
def __init__(self, width, height, food):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :typ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SnakeGame:
def __init__(self, width, height, food):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0]. :type width: int :... | the_stack_v2_python_sparse | leetcode_python/Design/design-snake-game.py | yennanliu/CS_basics | train | 64 | |
6b1f89e00cb4a6d86f0f5ce6ed1c4dadac62e9a5 | [
"x_headers = 'x-ms-date:' + date\nstring_to_hash = method + '\\n' + str(content_length) + '\\n' + content_type + '\\n' + x_headers + '\\n' + resource\nbytes_to_hash = bytes(string_to_hash, encoding='utf-8')\ndecoded_key = base64.b64decode(shared_key)\nencoded_hash = base64.b64encode(hmac.new(decoded_key, bytes_to_h... | <|body_start_0|>
x_headers = 'x-ms-date:' + date
string_to_hash = method + '\n' + str(content_length) + '\n' + content_type + '\n' + x_headers + '\n' + resource
bytes_to_hash = bytes(string_to_hash, encoding='utf-8')
decoded_key = base64.b64decode(shared_key)
encoded_hash = base6... | AzureSentinel is Used to post data to log analytics. | AzureSentinel | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AzureSentinel:
"""AzureSentinel is Used to post data to log analytics."""
def build_signature(self, date, content_length, method, content_type, resource):
"""To build the signature."""
<|body_0|>
def post_data(self, customer_id, body, log_type):
"""Build and send... | stack_v2_sparse_classes_75kplus_train_067850 | 8,404 | permissive | [
{
"docstring": "To build the signature.",
"name": "build_signature",
"signature": "def build_signature(self, date, content_length, method, content_type, resource)"
},
{
"docstring": "Build and send a request to the POST API.",
"name": "post_data",
"signature": "def post_data(self, custom... | 2 | stack_v2_sparse_classes_30k_train_031030 | Implement the Python class `AzureSentinel` described below.
Class description:
AzureSentinel is Used to post data to log analytics.
Method signatures and docstrings:
- def build_signature(self, date, content_length, method, content_type, resource): To build the signature.
- def post_data(self, customer_id, body, log_... | Implement the Python class `AzureSentinel` described below.
Class description:
AzureSentinel is Used to post data to log analytics.
Method signatures and docstrings:
- def build_signature(self, date, content_length, method, content_type, resource): To build the signature.
- def post_data(self, customer_id, body, log_... | 4536a3f6b9bdef902312b3d96f9c2e66b8bf52c1 | <|skeleton|>
class AzureSentinel:
"""AzureSentinel is Used to post data to log analytics."""
def build_signature(self, date, content_length, method, content_type, resource):
"""To build the signature."""
<|body_0|>
def post_data(self, customer_id, body, log_type):
"""Build and send... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AzureSentinel:
"""AzureSentinel is Used to post data to log analytics."""
def build_signature(self, date, content_length, method, content_type, resource):
"""To build the signature."""
x_headers = 'x-ms-date:' + date
string_to_hash = method + '\n' + str(content_length) + '\n' + co... | the_stack_v2_python_sparse | Solutions/SecurityScorecard Cybersecurity Ratings/Data Connectors/SecurityScorecardFactor/SecurityScorecardFactorSentinelConnector/writers.py | Azure/Azure-Sentinel | train | 3,697 |
8c0f2322a4b7798620bfdeb094c0914dbe3c4455 | [
"errors = {}\nhost = DEFAULT_HOST\nif user_input is not None:\n host = user_input[CONF_HOST].strip()\n try:\n info = await validate_host(host)\n if info.server_only:\n raise UnsupportedError\n except ConnectionError:\n errors['base'] = ERROR_CANNOT_CONNECT\n except Unsupp... | <|body_start_0|>
errors = {}
host = DEFAULT_HOST
if user_input is not None:
host = user_input[CONF_HOST].strip()
try:
info = await validate_host(host)
if info.server_only:
raise UnsupportedError
except Connec... | Config flow for Kaleidescape integration. | KaleidescapeConfigFlow | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KaleidescapeConfigFlow:
"""Config flow for Kaleidescape integration."""
async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult:
"""Handle user initiated device additions."""
<|body_0|>
async def async_step_ssdp(self, discovery_info: ssdp.Ss... | stack_v2_sparse_classes_75kplus_train_067851 | 3,713 | permissive | [
{
"docstring": "Handle user initiated device additions.",
"name": "async_step_user",
"signature": "async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult"
},
{
"docstring": "Handle discovered device.",
"name": "async_step_ssdp",
"signature": "async def asyn... | 3 | stack_v2_sparse_classes_30k_train_043724 | Implement the Python class `KaleidescapeConfigFlow` described below.
Class description:
Config flow for Kaleidescape integration.
Method signatures and docstrings:
- async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle user initiated device additions.
- async def async_step_ss... | Implement the Python class `KaleidescapeConfigFlow` described below.
Class description:
Config flow for Kaleidescape integration.
Method signatures and docstrings:
- async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle user initiated device additions.
- async def async_step_ss... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class KaleidescapeConfigFlow:
"""Config flow for Kaleidescape integration."""
async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult:
"""Handle user initiated device additions."""
<|body_0|>
async def async_step_ssdp(self, discovery_info: ssdp.Ss... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KaleidescapeConfigFlow:
"""Config flow for Kaleidescape integration."""
async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult:
"""Handle user initiated device additions."""
errors = {}
host = DEFAULT_HOST
if user_input is not None:
... | the_stack_v2_python_sparse | homeassistant/components/kaleidescape/config_flow.py | home-assistant/core | train | 35,501 |
872456fdaf9aec2fccae4fba10d62ef84a223ec5 | [
"super().setUp()\nc = self.c\ng.app.idleTimeManager = leoApp.IdleTimeManager()\ng.app.idleTimeManager.start()\ng.app.externalFilesController = leoExternalFiles.ExternalFilesController(c=c)",
"efc = g.app.externalFilesController\nfor i in range(100):\n efc.on_idle()"
] | <|body_start_0|>
super().setUp()
c = self.c
g.app.idleTimeManager = leoApp.IdleTimeManager()
g.app.idleTimeManager.start()
g.app.externalFilesController = leoExternalFiles.ExternalFilesController(c=c)
<|end_body_0|>
<|body_start_1|>
efc = g.app.externalFilesController
... | TestExternalFiles | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestExternalFiles:
def setUp(self):
"""setUp for TestFind class"""
<|body_0|>
def test_on_idle(self):
"""A minimal test of the on_idle and all its helpers. More detail tests would be difficult."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super()... | stack_v2_sparse_classes_75kplus_train_067852 | 1,137 | permissive | [
{
"docstring": "setUp for TestFind class",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "A minimal test of the on_idle and all its helpers. More detail tests would be difficult.",
"name": "test_on_idle",
"signature": "def test_on_idle(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007134 | Implement the Python class `TestExternalFiles` described below.
Class description:
Implement the TestExternalFiles class.
Method signatures and docstrings:
- def setUp(self): setUp for TestFind class
- def test_on_idle(self): A minimal test of the on_idle and all its helpers. More detail tests would be difficult. | Implement the Python class `TestExternalFiles` described below.
Class description:
Implement the TestExternalFiles class.
Method signatures and docstrings:
- def setUp(self): setUp for TestFind class
- def test_on_idle(self): A minimal test of the on_idle and all its helpers. More detail tests would be difficult.
<|... | a3f6c3ebda805dc40cd93123948f153a26eccee5 | <|skeleton|>
class TestExternalFiles:
def setUp(self):
"""setUp for TestFind class"""
<|body_0|>
def test_on_idle(self):
"""A minimal test of the on_idle and all its helpers. More detail tests would be difficult."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestExternalFiles:
def setUp(self):
"""setUp for TestFind class"""
super().setUp()
c = self.c
g.app.idleTimeManager = leoApp.IdleTimeManager()
g.app.idleTimeManager.start()
g.app.externalFilesController = leoExternalFiles.ExternalFilesController(c=c)
def te... | the_stack_v2_python_sparse | leo/unittests/core/test_leoExternalFiles.py | leo-editor/leo-editor | train | 1,671 | |
47ca071d4aa7a0f7e1e52765acc5f58be89da92d | [
"if not root:\n return True\nleft = self.maxDepth(root.left)\nright = self.maxDepth(root.right)\nif abs(left - right) > 1:\n return False\nreturn self.isBalanced(root.left) and self.isBalanced(root.right)",
"if not root:\n return 0\nif not root.left and (not root.right):\n return 1\nreturn 1 + max(sel... | <|body_start_0|>
if not root:
return True
left = self.maxDepth(root.left)
right = self.maxDepth(root.right)
if abs(left - right) > 1:
return False
return self.isBalanced(root.left) and self.isBalanced(root.right)
<|end_body_0|>
<|body_start_1|>
if... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isBalanced(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root:
return True
left ... | stack_v2_sparse_classes_75kplus_train_067853 | 715 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isBalanced",
"signature": "def isBalanced(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "maxDepth",
"signature": "def maxDepth(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_044669 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBalanced(self, root): :type root: TreeNode :rtype: bool
- def maxDepth(self, root): :type root: TreeNode :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isBalanced(self, root): :type root: TreeNode :rtype: bool
- def maxDepth(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def isBalanced(self,... | 5ab258f04771db37a3beb3cb0c490a06183f7b51 | <|skeleton|>
class Solution:
def isBalanced(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def maxDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isBalanced(self, root):
""":type root: TreeNode :rtype: bool"""
if not root:
return True
left = self.maxDepth(root.left)
right = self.maxDepth(root.right)
if abs(left - right) > 1:
return False
return self.isBalanced(root.le... | the_stack_v2_python_sparse | py_solution/p110_tree_balance.py | dengshilong/leetcode | train | 0 | |
ae70c7ecca3cafd5d6bdce7dae3694e56b4b5cd6 | [
"import sys\nresult = [0] * len(nums)\nfor i in range(len(nums) - 2, -1, -1):\n if nums[i] == 0:\n result[i] = sys.maxint\n else:\n result[i] = min(result[i + 1:nums[i] + i + 1]) + 1\nreturn result[0]",
"n, start, end, step = (len(nums), 0, 0, 0)\nwhile end < n - 1:\n step += 1\n maxend ... | <|body_start_0|>
import sys
result = [0] * len(nums)
for i in range(len(nums) - 2, -1, -1):
if nums[i] == 0:
result[i] = sys.maxint
else:
result[i] = min(result[i + 1:nums[i] + i + 1]) + 1
return result[0]
<|end_body_0|>
<|body_sta... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def jump(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def jump2(self, nums):
"""https://discuss.leetcode.com/topic/18815/10-lines-c-16ms-python-bfs-solutions-with-explanations/2 This problem has a nice BFS structure. Let’s illustrate it u... | stack_v2_sparse_classes_75kplus_train_067854 | 2,401 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "jump",
"signature": "def jump(self, nums)"
},
{
"docstring": "https://discuss.leetcode.com/topic/18815/10-lines-c-16ms-python-bfs-solutions-with-explanations/2 This problem has a nice BFS structure. Let’s illustrate it using the exampl... | 2 | stack_v2_sparse_classes_30k_train_031242 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump(self, nums): :type nums: List[int] :rtype: int
- def jump2(self, nums): https://discuss.leetcode.com/topic/18815/10-lines-c-16ms-python-bfs-solutions-with-explanations/2... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump(self, nums): :type nums: List[int] :rtype: int
- def jump2(self, nums): https://discuss.leetcode.com/topic/18815/10-lines-c-16ms-python-bfs-solutions-with-explanations/2... | 2526f8c0dec7101123123740e146ee4081e979ee | <|skeleton|>
class Solution:
def jump(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def jump2(self, nums):
"""https://discuss.leetcode.com/topic/18815/10-lines-c-16ms-python-bfs-solutions-with-explanations/2 This problem has a nice BFS structure. Let’s illustrate it u... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def jump(self, nums):
""":type nums: List[int] :rtype: int"""
import sys
result = [0] * len(nums)
for i in range(len(nums) - 2, -1, -1):
if nums[i] == 0:
result[i] = sys.maxint
else:
result[i] = min(result[i + 1:... | the_stack_v2_python_sparse | 045. Jump Game II.py | zhangpengGenedock/leetcode_python | train | 1 | |
7f0038ea67360daf23714834a6c277a2dfa31b71 | [
"losses_dict = dict()\nlosses_dict['loss_disc_fake'] = F.mse_loss(disc_pred_fake, 0.0 * torch.ones_like(disc_pred_fake))\nlosses_dict['loss_disc_real'] = F.mse_loss(disc_pred_real, 1.0 * torch.ones_like(disc_pred_real))\nloss, log_var = self.parse_losses(losses_dict)\nreturn (loss, log_var)",
"losses_dict = dict(... | <|body_start_0|>
losses_dict = dict()
losses_dict['loss_disc_fake'] = F.mse_loss(disc_pred_fake, 0.0 * torch.ones_like(disc_pred_fake))
losses_dict['loss_disc_real'] = F.mse_loss(disc_pred_real, 1.0 * torch.ones_like(disc_pred_real))
loss, log_var = self.parse_losses(losses_dict)
... | Implementation of `Least Squares Generative Adversarial Networks`. Paper link: https://arxiv.org/pdf/1611.04076.pdf Detailed architecture can be found in :class:`~mmagic.models.editors.lsgan.LSGANGenerator` and :class:`~mmagic.models.editors.lsgan.LSGANDiscriminator` | LSGAN | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LSGAN:
"""Implementation of `Least Squares Generative Adversarial Networks`. Paper link: https://arxiv.org/pdf/1611.04076.pdf Detailed architecture can be found in :class:`~mmagic.models.editors.lsgan.LSGANGenerator` and :class:`~mmagic.models.editors.lsgan.LSGANDiscriminator`"""
def disc_lo... | stack_v2_sparse_classes_75kplus_train_067855 | 4,372 | permissive | [
{
"docstring": "Get disc loss. LSGAN use the least squares loss to train the discriminator. .. math:: L_{D}=\\\\left(D\\\\left(X_{\\\\text {data }}\\\\right)-1\\\\right)^{2} +(D(G(z)))^{2} Args: disc_pred_fake (Tensor): Discriminator's prediction of the fake images. disc_pred_real (Tensor): Discriminator's pred... | 4 | null | Implement the Python class `LSGAN` described below.
Class description:
Implementation of `Least Squares Generative Adversarial Networks`. Paper link: https://arxiv.org/pdf/1611.04076.pdf Detailed architecture can be found in :class:`~mmagic.models.editors.lsgan.LSGANGenerator` and :class:`~mmagic.models.editors.lsgan.... | Implement the Python class `LSGAN` described below.
Class description:
Implementation of `Least Squares Generative Adversarial Networks`. Paper link: https://arxiv.org/pdf/1611.04076.pdf Detailed architecture can be found in :class:`~mmagic.models.editors.lsgan.LSGANGenerator` and :class:`~mmagic.models.editors.lsgan.... | a382f143c0fd20d227e1e5524831ba26a568190d | <|skeleton|>
class LSGAN:
"""Implementation of `Least Squares Generative Adversarial Networks`. Paper link: https://arxiv.org/pdf/1611.04076.pdf Detailed architecture can be found in :class:`~mmagic.models.editors.lsgan.LSGANGenerator` and :class:`~mmagic.models.editors.lsgan.LSGANDiscriminator`"""
def disc_lo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LSGAN:
"""Implementation of `Least Squares Generative Adversarial Networks`. Paper link: https://arxiv.org/pdf/1611.04076.pdf Detailed architecture can be found in :class:`~mmagic.models.editors.lsgan.LSGANGenerator` and :class:`~mmagic.models.editors.lsgan.LSGANDiscriminator`"""
def disc_loss(self, disc... | the_stack_v2_python_sparse | mmagic/models/editors/lsgan/lsgan.py | open-mmlab/mmagic | train | 1,370 |
d668fc8065a5ebf6ccac063a9b7e0e6058946935 | [
"reader = csv.reader(data)\nnext(reader)\ninfo = dict()\nfor item in reader:\n cmmd = item[0].strip('+')\n feat = item[1] or None\n desc = re.sub('{.*}', '', item[2]).strip() or None\n kind = tuple((KIND.get(s) for s in item[3].split('/'))) or None\n conf = CONF.get(item[4].split()[0])\n temp = li... | <|body_start_0|>
reader = csv.reader(data)
next(reader)
info = dict()
for item in reader:
cmmd = item[0].strip('+')
feat = item[1] or None
desc = re.sub('{.*}', '', item[2]).strip() or None
kind = tuple((KIND.get(s) for s in item[3].split('... | FTP Command | Command | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Command:
"""FTP Command"""
def process(self, data):
"""Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields."""
<|body_0|>
def context(self, data):
"""Generate constant context. Args: data (List[str... | stack_v2_sparse_classes_75kplus_train_067856 | 3,619 | permissive | [
{
"docstring": "Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields.",
"name": "process",
"signature": "def process(self, data)"
},
{
"docstring": "Generate constant context. Args: data (List[str]): CSV data. Returns: str: Constan... | 2 | stack_v2_sparse_classes_30k_train_014134 | Implement the Python class `Command` described below.
Class description:
FTP Command
Method signatures and docstrings:
- def process(self, data): Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields.
- def context(self, data): Generate constant context.... | Implement the Python class `Command` described below.
Class description:
FTP Command
Method signatures and docstrings:
- def process(self, data): Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields.
- def context(self, data): Generate constant context.... | 90cd07d67df28d5c5ab0585bc60f467a78d9db33 | <|skeleton|>
class Command:
"""FTP Command"""
def process(self, data):
"""Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields."""
<|body_0|>
def context(self, data):
"""Generate constant context. Args: data (List[str... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Command:
"""FTP Command"""
def process(self, data):
"""Process CSV data. Args: data (List[str]): CSV data. Returns: List[str]: Enumeration fields. List[str]: Missing fields."""
reader = csv.reader(data)
next(reader)
info = dict()
for item in reader:
cmm... | the_stack_v2_python_sparse | pcapkit/vendor/ftp/command.py | stjordanis/PyPCAPKit | train | 0 |
1be3801de92c17cbf492fd4980ff330d1a6a139b | [
"self.metric = metric\nself.has_custom_metric = False if self.metric is None else True\nself.gram = None\nself.min_size = 2",
"s_ = signal.reshape(-1, 1) if signal.ndim == 1 else signal\nif self.has_custom_metric is False:\n covar = np.cov(s_.T)\n self.metric = inv(covar.reshape(1, 1) if covar.size == 1 els... | <|body_start_0|>
self.metric = metric
self.has_custom_metric = False if self.metric is None else True
self.gram = None
self.min_size = 2
<|end_body_0|>
<|body_start_1|>
s_ = signal.reshape(-1, 1) if signal.ndim == 1 else signal
if self.has_custom_metric is False:
... | Mahalanobis-type cost function. | CostMl | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CostMl:
"""Mahalanobis-type cost function."""
def __init__(self, metric=None):
"""Create a new instance. Args: metric (ndarray, optional): PSD matrix that defines a Mahalanobis-type pseudo distance. If None, defaults to the Mahalanobis matrix. Shape (n_features, n_features)."""
... | stack_v2_sparse_classes_75kplus_train_067857 | 2,025 | permissive | [
{
"docstring": "Create a new instance. Args: metric (ndarray, optional): PSD matrix that defines a Mahalanobis-type pseudo distance. If None, defaults to the Mahalanobis matrix. Shape (n_features, n_features).",
"name": "__init__",
"signature": "def __init__(self, metric=None)"
},
{
"docstring":... | 3 | stack_v2_sparse_classes_30k_train_032394 | Implement the Python class `CostMl` described below.
Class description:
Mahalanobis-type cost function.
Method signatures and docstrings:
- def __init__(self, metric=None): Create a new instance. Args: metric (ndarray, optional): PSD matrix that defines a Mahalanobis-type pseudo distance. If None, defaults to the Mah... | Implement the Python class `CostMl` described below.
Class description:
Mahalanobis-type cost function.
Method signatures and docstrings:
- def __init__(self, metric=None): Create a new instance. Args: metric (ndarray, optional): PSD matrix that defines a Mahalanobis-type pseudo distance. If None, defaults to the Mah... | 0eb34388df2096d22fb1afd6e33ec511fb64cfa6 | <|skeleton|>
class CostMl:
"""Mahalanobis-type cost function."""
def __init__(self, metric=None):
"""Create a new instance. Args: metric (ndarray, optional): PSD matrix that defines a Mahalanobis-type pseudo distance. If None, defaults to the Mahalanobis matrix. Shape (n_features, n_features)."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CostMl:
"""Mahalanobis-type cost function."""
def __init__(self, metric=None):
"""Create a new instance. Args: metric (ndarray, optional): PSD matrix that defines a Mahalanobis-type pseudo distance. If None, defaults to the Mahalanobis matrix. Shape (n_features, n_features)."""
self.metri... | the_stack_v2_python_sparse | src/ruptures/costs/costml.py | deepcharles/ruptures | train | 1,299 |
f91303e1f94f71d428f45a6890e056be06b41f6f | [
"args = get_checkin_parser.parse_args()\nlimit = min(args['limit'], 10)\nres = Checkins.get_all(g.user.id, limit)\nreturn (res, 200)",
"args = post_checkin_parser.parse_args()\nok = Checkins.add(g.user.id, args['slot_id'])\nif not ok:\n api.abort(404, 'No slot existing with this id')\nres = Checkins.get(g.user... | <|body_start_0|>
args = get_checkin_parser.parse_args()
limit = min(args['limit'], 10)
res = Checkins.get_all(g.user.id, limit)
return (res, 200)
<|end_body_0|>
<|body_start_1|>
args = post_checkin_parser.parse_args()
ok = Checkins.add(g.user.id, args['slot_id'])
... | Checkin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Checkin:
def get(self):
"""Get the list of last checkins. List has a max length of 10 checkins."""
<|body_0|>
def post(self):
"""Add a new checkin"""
<|body_1|>
def delete(self):
"""Deactivate an existing checkin"""
<|body_2|>
<|end_skel... | stack_v2_sparse_classes_75kplus_train_067858 | 11,519 | permissive | [
{
"docstring": "Get the list of last checkins. List has a max length of 10 checkins.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "Add a new checkin",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Deactivate an existing checkin",
"name": ... | 3 | stack_v2_sparse_classes_30k_train_032821 | Implement the Python class `Checkin` described below.
Class description:
Implement the Checkin class.
Method signatures and docstrings:
- def get(self): Get the list of last checkins. List has a max length of 10 checkins.
- def post(self): Add a new checkin
- def delete(self): Deactivate an existing checkin | Implement the Python class `Checkin` described below.
Class description:
Implement the Checkin class.
Method signatures and docstrings:
- def get(self): Get the list of last checkins. List has a max length of 10 checkins.
- def post(self): Add a new checkin
- def delete(self): Deactivate an existing checkin
<|skelet... | aa8110de839233dd9b0905f010ca9994c6f3ffb7 | <|skeleton|>
class Checkin:
def get(self):
"""Get the list of last checkins. List has a max length of 10 checkins."""
<|body_0|>
def post(self):
"""Add a new checkin"""
<|body_1|>
def delete(self):
"""Deactivate an existing checkin"""
<|body_2|>
<|end_skel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Checkin:
def get(self):
"""Get the list of last checkins. List has a max length of 10 checkins."""
args = get_checkin_parser.parse_args()
limit = min(args['limit'], 10)
res = Checkins.get_all(g.user.id, limit)
return (res, 200)
def post(self):
"""Add a new ... | the_stack_v2_python_sparse | prkng/api/public/v0.py | OmniaProbitate/api | train | 0 | |
e13d57d4f621c33d911f0c6188ebcffdc4e7d1d5 | [
"handle = self._handle\nhandle.seek(pos)\nsentinel = b'Query:'\nwhile True:\n line = handle.readline().strip()\n if line.startswith(sentinel):\n break\n if not line:\n raise StopIteration\nqid, desc = _parse_hit_or_query_line(line.decode())\nreturn qid",
"handle = self._handle\nhandle.seek(... | <|body_start_0|>
handle = self._handle
handle.seek(pos)
sentinel = b'Query:'
while True:
line = handle.readline().strip()
if line.startswith(sentinel):
break
if not line:
raise StopIteration
qid, desc = _parse_hi... | Indexer class for Exonerate plain text. | ExonerateTextIndexer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExonerateTextIndexer:
"""Indexer class for Exonerate plain text."""
def get_qresult_id(self, pos):
"""Return the query ID from the nearest "Query:" line."""
<|body_0|>
def get_raw(self, offset):
"""Return the raw string of a QueryResult object from the given offs... | stack_v2_sparse_classes_75kplus_train_067859 | 20,436 | permissive | [
{
"docstring": "Return the query ID from the nearest \"Query:\" line.",
"name": "get_qresult_id",
"signature": "def get_qresult_id(self, pos)"
},
{
"docstring": "Return the raw string of a QueryResult object from the given offset.",
"name": "get_raw",
"signature": "def get_raw(self, offs... | 2 | stack_v2_sparse_classes_30k_train_043817 | Implement the Python class `ExonerateTextIndexer` described below.
Class description:
Indexer class for Exonerate plain text.
Method signatures and docstrings:
- def get_qresult_id(self, pos): Return the query ID from the nearest "Query:" line.
- def get_raw(self, offset): Return the raw string of a QueryResult objec... | Implement the Python class `ExonerateTextIndexer` described below.
Class description:
Indexer class for Exonerate plain text.
Method signatures and docstrings:
- def get_qresult_id(self, pos): Return the query ID from the nearest "Query:" line.
- def get_raw(self, offset): Return the raw string of a QueryResult objec... | 595c5c46794ae08a1f19716636eac7430cededa1 | <|skeleton|>
class ExonerateTextIndexer:
"""Indexer class for Exonerate plain text."""
def get_qresult_id(self, pos):
"""Return the query ID from the nearest "Query:" line."""
<|body_0|>
def get_raw(self, offset):
"""Return the raw string of a QueryResult object from the given offs... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExonerateTextIndexer:
"""Indexer class for Exonerate plain text."""
def get_qresult_id(self, pos):
"""Return the query ID from the nearest "Query:" line."""
handle = self._handle
handle.seek(pos)
sentinel = b'Query:'
while True:
line = handle.readline()... | the_stack_v2_python_sparse | .venv/Lib/site-packages/Bio/SearchIO/ExonerateIO/exonerate_text.py | abner-lucas/tp-cruzi-db | train | 2 |
8f8e8778f0506345fc1883890f8bde7010d874f1 | [
"if sum(part_res) > t:\n return\nelif sum(part_res) < t:\n for i, e in list(enumerate(options)):\n self.helper(total_res, part_res + [e], options[i:], t)\nelse:\n total_res.append(part_res)",
"res = []\nself.helper(res, [], candidates, target)\nreturn res"
] | <|body_start_0|>
if sum(part_res) > t:
return
elif sum(part_res) < t:
for i, e in list(enumerate(options)):
self.helper(total_res, part_res + [e], options[i:], t)
else:
total_res.append(part_res)
<|end_body_0|>
<|body_start_1|>
res = [... | Solution description | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Solution description"""
def helper(self, total_res, part_res, options, t):
"""solution helper"""
<|body_0|>
def func(self, candidates, target):
"""Solution function description"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if sum(... | stack_v2_sparse_classes_75kplus_train_067860 | 822 | permissive | [
{
"docstring": "solution helper",
"name": "helper",
"signature": "def helper(self, total_res, part_res, options, t)"
},
{
"docstring": "Solution function description",
"name": "func",
"signature": "def func(self, candidates, target)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003148 | Implement the Python class `Solution` described below.
Class description:
Solution description
Method signatures and docstrings:
- def helper(self, total_res, part_res, options, t): solution helper
- def func(self, candidates, target): Solution function description | Implement the Python class `Solution` described below.
Class description:
Solution description
Method signatures and docstrings:
- def helper(self, total_res, part_res, options, t): solution helper
- def func(self, candidates, target): Solution function description
<|skeleton|>
class Solution:
"""Solution descri... | 869ee24c50c08403b170e8f7868699185e9dfdd1 | <|skeleton|>
class Solution:
"""Solution description"""
def helper(self, total_res, part_res, options, t):
"""solution helper"""
<|body_0|>
def func(self, candidates, target):
"""Solution function description"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""Solution description"""
def helper(self, total_res, part_res, options, t):
"""solution helper"""
if sum(part_res) > t:
return
elif sum(part_res) < t:
for i, e in list(enumerate(options)):
self.helper(total_res, part_res + [e], o... | the_stack_v2_python_sparse | 39.Combination.Sum/1.py | cerebrumaize/leetcode | train | 0 |
93b6472d9d14f8ac790068abc486022a9e3a3d25 | [
"try:\n LOG.info('Loading in-cluster Kubernetes configuration.')\n kubernetes.config.load_incluster_config()\nexcept kubernetes.config.config_exception.ConfigException:\n LOG.debug('Failed to load in-cluster configuration')\n try:\n LOG.info('Loading out-of-cluster Kubernetes configuration.')\n ... | <|body_start_0|>
try:
LOG.info('Loading in-cluster Kubernetes configuration.')
kubernetes.config.load_incluster_config()
except kubernetes.config.config_exception.ConfigException:
LOG.debug('Failed to load in-cluster configuration')
try:
LO... | Class for Kubernetes APIs client | KubeClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KubeClient:
"""Class for Kubernetes APIs client"""
def __init__(self):
"""Set Kubernetes APIs connection"""
<|body_0|>
def update_node_labels(self, node_name, input_labels):
"""Updating node labels Args: node_name(str): node for which updating labels input_labels... | stack_v2_sparse_classes_75kplus_train_067861 | 4,712 | permissive | [
{
"docstring": "Set Kubernetes APIs connection",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Updating node labels Args: node_name(str): node for which updating labels input_labels(dict): input labels dict Returns: SuccessMessage(dict): API success response",
"nam... | 3 | stack_v2_sparse_classes_30k_val_001852 | Implement the Python class `KubeClient` described below.
Class description:
Class for Kubernetes APIs client
Method signatures and docstrings:
- def __init__(self): Set Kubernetes APIs connection
- def update_node_labels(self, node_name, input_labels): Updating node labels Args: node_name(str): node for which updatin... | Implement the Python class `KubeClient` described below.
Class description:
Class for Kubernetes APIs client
Method signatures and docstrings:
- def __init__(self): Set Kubernetes APIs connection
- def update_node_labels(self, node_name, input_labels): Updating node labels Args: node_name(str): node for which updatin... | 558acaf3bf354dfb2bb56fe1ef5cacd42ac92ec4 | <|skeleton|>
class KubeClient:
"""Class for Kubernetes APIs client"""
def __init__(self):
"""Set Kubernetes APIs connection"""
<|body_0|>
def update_node_labels(self, node_name, input_labels):
"""Updating node labels Args: node_name(str): node for which updating labels input_labels... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class KubeClient:
"""Class for Kubernetes APIs client"""
def __init__(self):
"""Set Kubernetes APIs connection"""
try:
LOG.info('Loading in-cluster Kubernetes configuration.')
kubernetes.config.load_incluster_config()
except kubernetes.config.config_exception.Con... | the_stack_v2_python_sparse | promenade/kubeclient.py | airshipit/promenade | train | 12 |
23e21881b1c5cb05f56f238d7c9c546041cba3d6 | [
"together = list(set(list1) & set(list2))\nmin_index = float('inf')\ndata = {}\nfor to in together:\n index = list1.index(to) + list2.index(to)\n data[to] = index\nmin_index = min(data.values())\nreturn [key for key, value in data.items() if value == min_index]",
"res = []\nindex = float('inf')\nd1 = dict(z... | <|body_start_0|>
together = list(set(list1) & set(list2))
min_index = float('inf')
data = {}
for to in together:
index = list1.index(to) + list2.index(to)
data[to] = index
min_index = min(data.values())
return [key for key, value in data.items() if... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _findRestaurant(self, list1, list2):
""":type list1: List[str] :type list2: List[str] :rtype: List[str]"""
<|body_0|>
def findRestaurant(self, list1, list2):
""":type list1: List[str] :type list2: List[str] :rtype: List[str]"""
<|body_1|>
<|end... | stack_v2_sparse_classes_75kplus_train_067862 | 3,040 | permissive | [
{
"docstring": ":type list1: List[str] :type list2: List[str] :rtype: List[str]",
"name": "_findRestaurant",
"signature": "def _findRestaurant(self, list1, list2)"
},
{
"docstring": ":type list1: List[str] :type list2: List[str] :rtype: List[str]",
"name": "findRestaurant",
"signature": ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _findRestaurant(self, list1, list2): :type list1: List[str] :type list2: List[str] :rtype: List[str]
- def findRestaurant(self, list1, list2): :type list1: List[str] :type li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _findRestaurant(self, list1, list2): :type list1: List[str] :type list2: List[str] :rtype: List[str]
- def findRestaurant(self, list1, list2): :type list1: List[str] :type li... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _findRestaurant(self, list1, list2):
""":type list1: List[str] :type list2: List[str] :rtype: List[str]"""
<|body_0|>
def findRestaurant(self, list1, list2):
""":type list1: List[str] :type list2: List[str] :rtype: List[str]"""
<|body_1|>
<|end... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def _findRestaurant(self, list1, list2):
""":type list1: List[str] :type list2: List[str] :rtype: List[str]"""
together = list(set(list1) & set(list2))
min_index = float('inf')
data = {}
for to in together:
index = list1.index(to) + list2.index(to)... | the_stack_v2_python_sparse | 599.minimum-index-sum-of-two-lists.py | windard/leeeeee | train | 0 | |
cfdf1f111c7aa717d99d0e984b681120e97c18c4 | [
"response = requests.get(url)\nif response.ok:\n json_data = response.json()\n data = json_data.get('results', [])\nreturn data",
"response = requests.get(url)\ndata = json.loads(response.text)\nreturn data"
] | <|body_start_0|>
response = requests.get(url)
if response.ok:
json_data = response.json()
data = json_data.get('results', [])
return data
<|end_body_0|>
<|body_start_1|>
response = requests.get(url)
data = json.loads(response.text)
return data
<|e... | Class for getting data from API. | Data | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Data:
"""Class for getting data from API."""
def get_all_pokemons_data(url):
"""Make request to API. :param endpoint: Address where to make the GET request. :return: Response data."""
<|body_0|>
def get_additional_data(url):
"""Make request to API to get addition... | stack_v2_sparse_classes_75kplus_train_067863 | 7,513 | no_license | [
{
"docstring": "Make request to API. :param endpoint: Address where to make the GET request. :return: Response data.",
"name": "get_all_pokemons_data",
"signature": "def get_all_pokemons_data(url)"
},
{
"docstring": "Make request to API to get additional data for each Pokemon. :param endpoint: A... | 2 | stack_v2_sparse_classes_30k_train_003653 | Implement the Python class `Data` described below.
Class description:
Class for getting data from API.
Method signatures and docstrings:
- def get_all_pokemons_data(url): Make request to API. :param endpoint: Address where to make the GET request. :return: Response data.
- def get_additional_data(url): Make request t... | Implement the Python class `Data` described below.
Class description:
Class for getting data from API.
Method signatures and docstrings:
- def get_all_pokemons_data(url): Make request to API. :param endpoint: Address where to make the GET request. :return: Response data.
- def get_additional_data(url): Make request t... | 68c72c2a9ba7a631718f159d4f714aed988a3f5a | <|skeleton|>
class Data:
"""Class for getting data from API."""
def get_all_pokemons_data(url):
"""Make request to API. :param endpoint: Address where to make the GET request. :return: Response data."""
<|body_0|>
def get_additional_data(url):
"""Make request to API to get addition... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Data:
"""Class for getting data from API."""
def get_all_pokemons_data(url):
"""Make request to API. :param endpoint: Address where to make the GET request. :return: Response data."""
response = requests.get(url)
if response.ok:
json_data = response.json()
... | the_stack_v2_python_sparse | ex14_pokemon/pokemon.py | JelenaKiblik/School-python | train | 0 |
889ad2019fd55a5a32e9e22ae9c078073ad8b362 | [
"self.dark_image_picture = data\nself.aperture = aperture\nself.create_plot()",
"if self.dark_image_picture is not None:\n if os.path.isfile(self.dark_image_picture):\n view = read_png(self.dark_image_picture)\n ydim, xdim = view.shape\n dim = max(xdim, ydim)\n self.plot = figure(x_... | <|body_start_0|>
self.dark_image_picture = data
self.aperture = aperture
self.create_plot()
<|end_body_0|>
<|body_start_1|>
if self.dark_image_picture is not None:
if os.path.isfile(self.dark_image_picture):
view = read_png(self.dark_image_picture)
... | Creates a figure that displays a mean dark current image held in a png file Attributes ---------- aperture : str Name of aperture (e.g. NRCA1_FULL) dark_image_picture : str Name of png file containing the mean dark current image figure created by the dark monitor plot : bokeh.figure Figure containing the dark current i... | DarkImagePlot | [
"Python-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DarkImagePlot:
"""Creates a figure that displays a mean dark current image held in a png file Attributes ---------- aperture : str Name of aperture (e.g. NRCA1_FULL) dark_image_picture : str Name of png file containing the mean dark current image figure created by the dark monitor plot : bokeh.fi... | stack_v2_sparse_classes_75kplus_train_067864 | 32,336 | permissive | [
{
"docstring": "Create the figure",
"name": "__init__",
"signature": "def __init__(self, data, aperture)"
},
{
"docstring": "Takes the input filename, reads it in, and places it in a figure. If the given filename doesn't exist, or if no filename is given, it produces an empty figure that can be ... | 2 | stack_v2_sparse_classes_30k_train_012678 | Implement the Python class `DarkImagePlot` described below.
Class description:
Creates a figure that displays a mean dark current image held in a png file Attributes ---------- aperture : str Name of aperture (e.g. NRCA1_FULL) dark_image_picture : str Name of png file containing the mean dark current image figure crea... | Implement the Python class `DarkImagePlot` described below.
Class description:
Creates a figure that displays a mean dark current image held in a png file Attributes ---------- aperture : str Name of aperture (e.g. NRCA1_FULL) dark_image_picture : str Name of png file containing the mean dark current image figure crea... | d5a6dbe1a1772a1d0d77af88d4e7deb2374e55c4 | <|skeleton|>
class DarkImagePlot:
"""Creates a figure that displays a mean dark current image held in a png file Attributes ---------- aperture : str Name of aperture (e.g. NRCA1_FULL) dark_image_picture : str Name of png file containing the mean dark current image figure created by the dark monitor plot : bokeh.fi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DarkImagePlot:
"""Creates a figure that displays a mean dark current image held in a png file Attributes ---------- aperture : str Name of aperture (e.g. NRCA1_FULL) dark_image_picture : str Name of png file containing the mean dark current image figure created by the dark monitor plot : bokeh.figure Figure c... | the_stack_v2_python_sparse | jwql/website/apps/jwql/monitor_pages/monitor_dark_bokeh.py | spacetelescope/jwql | train | 70 |
5de3e3ea85c73763009d93d7ae87e2afffd7f710 | [
"Iter.__init__(self, itemType)\nself.clazz = list\nself.isPrimitive = self.itemType.isPrimitive",
"if isinstance(obj, (tuple, list)):\n return all(map(self.itemType.isValid, obj))\nreturn False"
] | <|body_start_0|>
Iter.__init__(self, itemType)
self.clazz = list
self.isPrimitive = self.itemType.isPrimitive
<|end_body_0|>
<|body_start_1|>
if isinstance(obj, (tuple, list)):
return all(map(self.itemType.isValid, obj))
return False
<|end_body_1|>
| Maps lists of values. You need also to specify in the constructor what elements this list will contain. Unlike the iterator type the list type also validates the contained elements. | List | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class List:
"""Maps lists of values. You need also to specify in the constructor what elements this list will contain. Unlike the iterator type the list type also validates the contained elements."""
def __init__(self, itemType):
"""Constructs the list type for the provided type. @see: Ite... | stack_v2_sparse_classes_75kplus_train_067865 | 14,877 | no_license | [
{
"docstring": "Constructs the list type for the provided type. @see: Iter.__init__",
"name": "__init__",
"signature": "def __init__(self, itemType)"
},
{
"docstring": "@see: Type.isValid",
"name": "isValid",
"signature": "def isValid(self, obj)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008237 | Implement the Python class `List` described below.
Class description:
Maps lists of values. You need also to specify in the constructor what elements this list will contain. Unlike the iterator type the list type also validates the contained elements.
Method signatures and docstrings:
- def __init__(self, itemType): ... | Implement the Python class `List` described below.
Class description:
Maps lists of values. You need also to specify in the constructor what elements this list will contain. Unlike the iterator type the list type also validates the contained elements.
Method signatures and docstrings:
- def __init__(self, itemType): ... | a10cb774c8cbc5010950eed9342413846734fea7 | <|skeleton|>
class List:
"""Maps lists of values. You need also to specify in the constructor what elements this list will contain. Unlike the iterator type the list type also validates the contained elements."""
def __init__(self, itemType):
"""Constructs the list type for the provided type. @see: Ite... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class List:
"""Maps lists of values. You need also to specify in the constructor what elements this list will contain. Unlike the iterator type the list type also validates the contained elements."""
def __init__(self, itemType):
"""Constructs the list type for the provided type. @see: Iter.__init__"""... | the_stack_v2_python_sparse | components/ally-api/ally/api/type.py | bonomali/Ally-Py | train | 0 |
94d1c9f1138a5873687ca0a0b276646308a98f27 | [
"super().__init__()\nself.name = name\nself.sketch = sketch\nself.user = user\nself.description = description\nself.searchtemplate = searchtemplate\nself.query_string = query_string\nself.query_filter = query_filter\nself.query_dsl = query_dsl\nself.searchtemplate_json = searchtemplate_json",
"DEFAULT_FROM = 0\nD... | <|body_start_0|>
super().__init__()
self.name = name
self.sketch = sketch
self.user = user
self.description = description
self.searchtemplate = searchtemplate
self.query_string = query_string
self.query_filter = query_filter
self.query_dsl = query_... | Implements the View model. | View | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class View:
"""Implements the View model."""
def __init__(self, name, sketch, user, description=None, searchtemplate=None, query_string=None, query_filter=None, query_dsl=None, searchtemplate_json=None):
"""Initialize the View object. Args: name: The name of the timeline sketch: A sketch (... | stack_v2_sparse_classes_75kplus_train_067866 | 48,378 | permissive | [
{
"docstring": "Initialize the View object. Args: name: The name of the timeline sketch: A sketch (instance of timesketch.models.sketch.Sketch) user: A user (instance of timesketch.models.user.User) description (str): Description of the view searchtemplate: Instance of timesketch.models.sketch.SearchTemplate qu... | 2 | stack_v2_sparse_classes_30k_train_040737 | Implement the Python class `View` described below.
Class description:
Implements the View model.
Method signatures and docstrings:
- def __init__(self, name, sketch, user, description=None, searchtemplate=None, query_string=None, query_filter=None, query_dsl=None, searchtemplate_json=None): Initialize the View object... | Implement the Python class `View` described below.
Class description:
Implements the View model.
Method signatures and docstrings:
- def __init__(self, name, sketch, user, description=None, searchtemplate=None, query_string=None, query_filter=None, query_dsl=None, searchtemplate_json=None): Initialize the View object... | 24f471b58ca4a87cb053961b5f05c07a544ca7b8 | <|skeleton|>
class View:
"""Implements the View model."""
def __init__(self, name, sketch, user, description=None, searchtemplate=None, query_string=None, query_filter=None, query_dsl=None, searchtemplate_json=None):
"""Initialize the View object. Args: name: The name of the timeline sketch: A sketch (... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class View:
"""Implements the View model."""
def __init__(self, name, sketch, user, description=None, searchtemplate=None, query_string=None, query_filter=None, query_dsl=None, searchtemplate_json=None):
"""Initialize the View object. Args: name: The name of the timeline sketch: A sketch (instance of t... | the_stack_v2_python_sparse | timesketch/models/sketch.py | google/timesketch | train | 2,263 |
0a75bc9799d53fe7635b5c822c6dffc8e3624a03 | [
"loc = Operation().readXml('foreignkeyselection', 'normal').format(name=fild_name)\nself.clickElement(loc)\nloc1 = Operation().readXml('foreignkeyselection', 'input').format(name=fild_name)\nself.sendKeys(loc1, value)\nloc2 = Operation().readXml('foreignkeyselection', 'option').format(option=value)\nself.clickEleme... | <|body_start_0|>
loc = Operation().readXml('foreignkeyselection', 'normal').format(name=fild_name)
self.clickElement(loc)
loc1 = Operation().readXml('foreignkeyselection', 'input').format(name=fild_name)
self.sendKeys(loc1, value)
loc2 = Operation().readXml('foreignkeyselection',... | 关联组件-外键选择 | ForergnKeySelection | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForergnKeySelection:
"""关联组件-外键选择"""
def normal(self, fild_name, value):
"""非必填类型输入内容 :param fild_name: 字段名字 :param value: 写入值 :return:"""
<|body_0|>
def required(self, fild_name, value):
"""必填类型外键选择输入内容 :param fild_name: 字段名 :param value: 输入值 :return:"""
... | stack_v2_sparse_classes_75kplus_train_067867 | 1,383 | no_license | [
{
"docstring": "非必填类型输入内容 :param fild_name: 字段名字 :param value: 写入值 :return:",
"name": "normal",
"signature": "def normal(self, fild_name, value)"
},
{
"docstring": "必填类型外键选择输入内容 :param fild_name: 字段名 :param value: 输入值 :return:",
"name": "required",
"signature": "def required(self, fild_n... | 2 | stack_v2_sparse_classes_30k_train_043152 | Implement the Python class `ForergnKeySelection` described below.
Class description:
关联组件-外键选择
Method signatures and docstrings:
- def normal(self, fild_name, value): 非必填类型输入内容 :param fild_name: 字段名字 :param value: 写入值 :return:
- def required(self, fild_name, value): 必填类型外键选择输入内容 :param fild_name: 字段名 :param value: 输入... | Implement the Python class `ForergnKeySelection` described below.
Class description:
关联组件-外键选择
Method signatures and docstrings:
- def normal(self, fild_name, value): 非必填类型输入内容 :param fild_name: 字段名字 :param value: 写入值 :return:
- def required(self, fild_name, value): 必填类型外键选择输入内容 :param fild_name: 字段名 :param value: 输入... | f307ca71cfae22d419a6d96c27dfbf6c04683e82 | <|skeleton|>
class ForergnKeySelection:
"""关联组件-外键选择"""
def normal(self, fild_name, value):
"""非必填类型输入内容 :param fild_name: 字段名字 :param value: 写入值 :return:"""
<|body_0|>
def required(self, fild_name, value):
"""必填类型外键选择输入内容 :param fild_name: 字段名 :param value: 输入值 :return:"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ForergnKeySelection:
"""关联组件-外键选择"""
def normal(self, fild_name, value):
"""非必填类型输入内容 :param fild_name: 字段名字 :param value: 写入值 :return:"""
loc = Operation().readXml('foreignkeyselection', 'normal').format(name=fild_name)
self.clickElement(loc)
loc1 = Operation().readXml('f... | the_stack_v2_python_sparse | ui/qiqiao/relation_components/foreign_key_selection.py | Donny2019/QiqiaoPlusAutoTest | train | 0 |
41893e1f044a550b76de4ea6ca5cf7ef24441cda | [
"super(Predictor, self).__init__()\nself.hidden_size = hidden_size\nself.embedding = embedding\nself._rule_embed_inv = EmbeddingInverse(self.embedding.previous_actions_embed.rule_embed.num_embeddings)\nself._token_embed_inv = EmbeddingInverse(self.embedding.previous_actions_embed.token_embed.num_embeddings)\nself._... | <|body_start_0|>
super(Predictor, self).__init__()
self.hidden_size = hidden_size
self.embedding = embedding
self._rule_embed_inv = EmbeddingInverse(self.embedding.previous_actions_embed.rule_embed.num_embeddings)
self._token_embed_inv = EmbeddingInverse(self.embedding.previous_a... | Predictor | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Predictor:
def __init__(self, embedding: ActionsEmbedding, embedding_size: int, query_size: int, hidden_size: int, att_hidden_size: int):
"""Constructor Parameters ---------- embedding: embedding_size: int Size of each embedding vector query_size: int Size of each query vector hidden_siz... | stack_v2_sparse_classes_75kplus_train_067868 | 5,255 | permissive | [
{
"docstring": "Constructor Parameters ---------- embedding: embedding_size: int Size of each embedding vector query_size: int Size of each query vector hidden_size: int Size of each hidden state att_hidden_size: int The number of features in the hidden state for attention",
"name": "__init__",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_021558 | Implement the Python class `Predictor` described below.
Class description:
Implement the Predictor class.
Method signatures and docstrings:
- def __init__(self, embedding: ActionsEmbedding, embedding_size: int, query_size: int, hidden_size: int, att_hidden_size: int): Constructor Parameters ---------- embedding: embe... | Implement the Python class `Predictor` described below.
Class description:
Implement the Predictor class.
Method signatures and docstrings:
- def __init__(self, embedding: ActionsEmbedding, embedding_size: int, query_size: int, hidden_size: int, att_hidden_size: int): Constructor Parameters ---------- embedding: embe... | 573e94c567064705fa65267dd83946bf183197de | <|skeleton|>
class Predictor:
def __init__(self, embedding: ActionsEmbedding, embedding_size: int, query_size: int, hidden_size: int, att_hidden_size: int):
"""Constructor Parameters ---------- embedding: embedding_size: int Size of each embedding vector query_size: int Size of each query vector hidden_siz... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Predictor:
def __init__(self, embedding: ActionsEmbedding, embedding_size: int, query_size: int, hidden_size: int, att_hidden_size: int):
"""Constructor Parameters ---------- embedding: embedding_size: int Size of each embedding vector query_size: int Size of each query vector hidden_size: int Size of... | the_stack_v2_python_sparse | mlprogram/nn/nl2code/predictor.py | brando90/mlprogram | train | 0 | |
a10bcaeec6ab1d0db5624810b75b64b16fa5857e | [
"order = get_object_or_404(Order, id=order_id)\nform = TaskForm()\nreturn render(request, 'task/add-task.html', {'form': form, 'func': 'Add', 'order': order})",
"form = TaskForm(request.POST)\norder = get_object_or_404(Order, id=order_id)\nif form.is_valid():\n new_task = form.save(commit=False)\n new_task.... | <|body_start_0|>
order = get_object_or_404(Order, id=order_id)
form = TaskForm()
return render(request, 'task/add-task.html', {'form': form, 'func': 'Add', 'order': order})
<|end_body_0|>
<|body_start_1|>
form = TaskForm(request.POST)
order = get_object_or_404(Order, id=order_id... | Class based view for adding new task. | TaskAddView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskAddView:
"""Class based view for adding new task."""
def get(self, request, order_id):
"""Return add new task form."""
<|body_0|>
def post(self, request, order_id):
"""Save task and redirect to task list."""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_75kplus_train_067869 | 3,296 | no_license | [
{
"docstring": "Return add new task form.",
"name": "get",
"signature": "def get(self, request, order_id)"
},
{
"docstring": "Save task and redirect to task list.",
"name": "post",
"signature": "def post(self, request, order_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_025805 | Implement the Python class `TaskAddView` described below.
Class description:
Class based view for adding new task.
Method signatures and docstrings:
- def get(self, request, order_id): Return add new task form.
- def post(self, request, order_id): Save task and redirect to task list. | Implement the Python class `TaskAddView` described below.
Class description:
Class based view for adding new task.
Method signatures and docstrings:
- def get(self, request, order_id): Return add new task form.
- def post(self, request, order_id): Save task and redirect to task list.
<|skeleton|>
class TaskAddView:
... | 93c3106ab90fb9aed85658f93f51686ba4734091 | <|skeleton|>
class TaskAddView:
"""Class based view for adding new task."""
def get(self, request, order_id):
"""Return add new task form."""
<|body_0|>
def post(self, request, order_id):
"""Save task and redirect to task list."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TaskAddView:
"""Class based view for adding new task."""
def get(self, request, order_id):
"""Return add new task form."""
order = get_object_or_404(Order, id=order_id)
form = TaskForm()
return render(request, 'task/add-task.html', {'form': form, 'func': 'Add', 'order': or... | the_stack_v2_python_sparse | order/views/task_views.py | saadali5997/tms | train | 0 |
461a3e101962bf0a72ae45eb440c488237e1b07e | [
"if not matrix:\n self.matrix = []\n return\nn = len(matrix)\nm = len(matrix[0])\nfor i in range(n):\n for j in range(m):\n if i == 0 and j == 0:\n continue\n elif i == 0:\n matrix[i][j] += matrix[i][j - 1]\n elif j == 0:\n matrix[i][j] += matrix[i - 1]... | <|body_start_0|>
if not matrix:
self.matrix = []
return
n = len(matrix)
m = len(matrix[0])
for i in range(n):
for j in range(m):
if i == 0 and j == 0:
continue
elif i == 0:
matrix[... | NumMatrix | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
"""sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty... | stack_v2_sparse_classes_75kplus_train_067870 | 1,688 | no_license | [
{
"docstring": "initialize your data structure here. :type matrix: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, matrix)"
},
{
"docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtyp... | 2 | stack_v2_sparse_classes_30k_train_032765 | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)... | Implement the Python class `NumMatrix` described below.
Class description:
Implement the NumMatrix class.
Method signatures and docstrings:
- def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]]
- def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)... | b6328e726c8d986d6b85e2d41c7e678e29dc1153 | <|skeleton|>
class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
<|body_0|>
def sumRegion(self, row1, col1, row2, col2):
"""sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NumMatrix:
def __init__(self, matrix):
"""initialize your data structure here. :type matrix: List[List[int]]"""
if not matrix:
self.matrix = []
return
n = len(matrix)
m = len(matrix[0])
for i in range(n):
for j in range(m):
... | the_stack_v2_python_sparse | Range Sum Query 2D - Immutable.py | dragonlee8/leetcode | train | 0 | |
cbc797eda527a1572a1e1df4f16a1de3b4372077 | [
"try:\n found_item = ItemModel.find_item_by_name(name)\nexcept:\n return ({'message': SERVER_ERROR}, 500)\nif found_item:\n return (item_schema.dump(found_item), 200)\nreturn ({'message': NOT_FOUND_ERROR.format(name)}, 404)",
"received_json = item_schema.load(request.get_json())\nreceived_json['name'] = ... | <|body_start_0|>
try:
found_item = ItemModel.find_item_by_name(name)
except:
return ({'message': SERVER_ERROR}, 500)
if found_item:
return (item_schema.dump(found_item), 200)
return ({'message': NOT_FOUND_ERROR.format(name)}, 404)
<|end_body_0|>
<|bod... | Resource for one particular item. | Item | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Item:
"""Resource for one particular item."""
def get(cls, name: str):
"""endpoint for getting one item by name"""
<|body_0|>
def post(cls, name: str):
"""endpoint for creating an item, it does not accept full json, but parses it and uses only {price: <float>}"""... | stack_v2_sparse_classes_75kplus_train_067871 | 2,925 | no_license | [
{
"docstring": "endpoint for getting one item by name",
"name": "get",
"signature": "def get(cls, name: str)"
},
{
"docstring": "endpoint for creating an item, it does not accept full json, but parses it and uses only {price: <float>}",
"name": "post",
"signature": "def post(cls, name: s... | 4 | stack_v2_sparse_classes_30k_train_009757 | Implement the Python class `Item` described below.
Class description:
Resource for one particular item.
Method signatures and docstrings:
- def get(cls, name: str): endpoint for getting one item by name
- def post(cls, name: str): endpoint for creating an item, it does not accept full json, but parses it and uses onl... | Implement the Python class `Item` described below.
Class description:
Resource for one particular item.
Method signatures and docstrings:
- def get(cls, name: str): endpoint for getting one item by name
- def post(cls, name: str): endpoint for creating an item, it does not accept full json, but parses it and uses onl... | 6f8dfbff5f06bead56b2c56122a533d1bd148c2b | <|skeleton|>
class Item:
"""Resource for one particular item."""
def get(cls, name: str):
"""endpoint for getting one item by name"""
<|body_0|>
def post(cls, name: str):
"""endpoint for creating an item, it does not accept full json, but parses it and uses only {price: <float>}"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Item:
"""Resource for one particular item."""
def get(cls, name: str):
"""endpoint for getting one item by name"""
try:
found_item = ItemModel.find_item_by_name(name)
except:
return ({'message': SERVER_ERROR}, 500)
if found_item:
return ... | the_stack_v2_python_sparse | section13/resources/item.py | ExperimentalHypothesis/flask-restful-web-api | train | 0 |
c5fab645acf8c223325cedb0c04c57478913731d | [
"self.callback_url = callback_url\nself.content = content\nself.destination_number = destination_number\nself.delivery_report = delivery_report\nself.format = format\nself.message_expiry_timestamp = APIHelper.RFC3339DateTime(message_expiry_timestamp) if message_expiry_timestamp else None\nself.metadata = metadata\n... | <|body_start_0|>
self.callback_url = callback_url
self.content = content
self.destination_number = destination_number
self.delivery_report = delivery_report
self.format = format
self.message_expiry_timestamp = APIHelper.RFC3339DateTime(message_expiry_timestamp) if message... | Implementation of the 'Get message status response' model. TODO: type model description here. Attributes: callback_url (string): URL replies and delivery reports to this message will be pushed to content (string): Content of the message destination_number (string): Destination number of the message delivery_report (boo... | GetMessageStatusResponse | [
"Apache-2.0",
"curl",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetMessageStatusResponse:
"""Implementation of the 'Get message status response' model. TODO: type model description here. Attributes: callback_url (string): URL replies and delivery reports to this message will be pushed to content (string): Content of the message destination_number (string): De... | stack_v2_sparse_classes_75kplus_train_067872 | 5,236 | permissive | [
{
"docstring": "Constructor for the GetMessageStatusResponse class",
"name": "__init__",
"signature": "def __init__(self, callback_url=None, content=None, destination_number=None, delivery_report=False, format=None, message_expiry_timestamp=None, metadata=None, scheduled=None, source_number=None, source... | 2 | stack_v2_sparse_classes_30k_val_000786 | Implement the Python class `GetMessageStatusResponse` described below.
Class description:
Implementation of the 'Get message status response' model. TODO: type model description here. Attributes: callback_url (string): URL replies and delivery reports to this message will be pushed to content (string): Content of the ... | Implement the Python class `GetMessageStatusResponse` described below.
Class description:
Implementation of the 'Get message status response' model. TODO: type model description here. Attributes: callback_url (string): URL replies and delivery reports to this message will be pushed to content (string): Content of the ... | 7963f5725c5feff7cbc74cc62fe889575f3a83f9 | <|skeleton|>
class GetMessageStatusResponse:
"""Implementation of the 'Get message status response' model. TODO: type model description here. Attributes: callback_url (string): URL replies and delivery reports to this message will be pushed to content (string): Content of the message destination_number (string): De... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GetMessageStatusResponse:
"""Implementation of the 'Get message status response' model. TODO: type model description here. Attributes: callback_url (string): URL replies and delivery reports to this message will be pushed to content (string): Content of the message destination_number (string): Destination num... | the_stack_v2_python_sparse | message_media_messages/models/get_message_status_response.py | messagemedia/messages-python-sdk | train | 6 |
114a26f379a54a0ca74551d5906e6c0040134bfb | [
"super().__init__()\nself.in_chans = in_chans\nself.out_chans = out_chans\nself.chans = chans\nself.num_pool_layers = num_pool_layers\nself.drop_prob = drop_prob\nself.reduction = reduction\nself.down_sample_layers = nn.ModuleList([ConvBlock(in_chans, chans, drop_prob, attention=False, attention_type=attention_type... | <|body_start_0|>
super().__init__()
self.in_chans = in_chans
self.out_chans = out_chans
self.chans = chans
self.num_pool_layers = num_pool_layers
self.drop_prob = drop_prob
self.reduction = reduction
self.down_sample_layers = nn.ModuleList([ConvBlock(in_ch... | PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015. | CSEUnetModelTakeLatentDecoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CSEUnetModelTakeLatentDecoder:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted interventi... | stack_v2_sparse_classes_75kplus_train_067873 | 10,589 | no_license | [
{
"docstring": "Args: in_chans (int): Number of channels in the input to the U-Net model. out_chans (int): Number of channels in the output to the U-Net model. chans (int): Number of output channels of the first convolution layer. num_pool_layers (int): Number of down-sampling and up-sampling layers. drop_prob ... | 2 | stack_v2_sparse_classes_30k_train_029573 | Implement the Python class `CSEUnetModelTakeLatentDecoder` described below.
Class description:
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image com... | Implement the Python class `CSEUnetModelTakeLatentDecoder` described below.
Class description:
PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image com... | 219652c8a08c4f2f682acd9f95a4e1b3fd36b70b | <|skeleton|>
class CSEUnetModelTakeLatentDecoder:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted interventi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CSEUnetModelTakeLatentDecoder:
"""PyTorch implementation of a U-Net model. This is based on: Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234... | the_stack_v2_python_sparse | lemawarersn_unet_conv_redundancy_removed_relu/chattn.py | Bala93/Holistic-MRI-Reconstruction | train | 1 |
3680180c2f9d28eebc97adff1839225e53860b88 | [
"self.backup_all_existing_snapshot = backup_all_existing_snapshot\nself.blacklisted_ip_addrs = blacklisted_ip_addrs\nself.continue_on_error = continue_on_error\nself.encryption_enabled = encryption_enabled\nself.filtering_policy = filtering_policy\nself.fld_config = fld_config\nself.full_backup_snapshot_label = ful... | <|body_start_0|>
self.backup_all_existing_snapshot = backup_all_existing_snapshot
self.blacklisted_ip_addrs = blacklisted_ip_addrs
self.continue_on_error = continue_on_error
self.encryption_enabled = encryption_enabled
self.filtering_policy = filtering_policy
self.fld_con... | Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_label and incremental_backup_snapshot_label. Wh... | NasBackupParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NasBackupParams:
"""Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_labe... | stack_v2_sparse_classes_75kplus_train_067874 | 10,003 | permissive | [
{
"docstring": "Constructor for the NasBackupParams class",
"name": "__init__",
"signature": "def __init__(self, backup_all_existing_snapshot=None, blacklisted_ip_addrs=None, continue_on_error=None, encryption_enabled=None, filtering_policy=None, fld_config=None, full_backup_snapshot_label=None, increme... | 2 | stack_v2_sparse_classes_30k_train_003325 | Implement the Python class `NasBackupParams` described below.
Class description:
Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn... | Implement the Python class `NasBackupParams` described below.
Class description:
Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class NasBackupParams:
"""Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_labe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NasBackupParams:
"""Implementation of the 'NasBackupParams' model. Message to capture any additional backup params for a NAS environment. Attributes: backup_all_existing_snapshot (bool): This bool parameter will be set only for DP volumes when customer doesn't select the full_backup_snapshot_label and increme... | the_stack_v2_python_sparse | cohesity_management_sdk/models/nas_backup_params.py | cohesity/management-sdk-python | train | 24 |
2f680f92a24e61b51da3e8c26f3aaecb94ef5c3e | [
"self.chrom = str(chrom)\nself.this_id = str(this_id)\ntry:\n self.pos = int(pos)\nexcept ValueError:\n print(pos + ' was input as position of SNP with ID ' + this_id + \". Position '0' will be set and _ValueError appended to the ID.\")\n self.pos = 0\n self.this_id = self.this_id + '_ValueError'\nself.... | <|body_start_0|>
self.chrom = str(chrom)
self.this_id = str(this_id)
try:
self.pos = int(pos)
except ValueError:
print(pos + ' was input as position of SNP with ID ' + this_id + ". Position '0' will be set and _ValueError appended to the ID.")
self.pos... | Class for handling SNPs. | SNP | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SNP:
"""Class for handling SNPs."""
def __init__(self, chrom, pos, this_id, ref, alt):
"""Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be converted to integer describing the position of the SNP. if n... | stack_v2_sparse_classes_75kplus_train_067875 | 5,097 | no_license | [
{
"docstring": "Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be converted to integer describing the position of the SNP. if not, the position is set to int(0) and '_ValueError' appended to self.ID. this_id : something that can ... | 2 | stack_v2_sparse_classes_30k_train_010722 | Implement the Python class `SNP` described below.
Class description:
Class for handling SNPs.
Method signatures and docstrings:
- def __init__(self, chrom, pos, this_id, ref, alt): Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be conv... | Implement the Python class `SNP` described below.
Class description:
Class for handling SNPs.
Method signatures and docstrings:
- def __init__(self, chrom, pos, this_id, ref, alt): Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be conv... | dda36515c41cf435a1732a3e9dc6c35a0daedb8a | <|skeleton|>
class SNP:
"""Class for handling SNPs."""
def __init__(self, chrom, pos, this_id, ref, alt):
"""Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be converted to integer describing the position of the SNP. if n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SNP:
"""Class for handling SNPs."""
def __init__(self, chrom, pos, this_id, ref, alt):
"""Parameters ---------- chrom : something that can be converted to str describing the chromosome position. pos : something that can be converted to integer describing the position of the SNP. if not, the posit... | the_stack_v2_python_sparse | analytic-modules/common_libs/filters/vcf_to_bed.py | korcsmarosgroup/iSNP | train | 2 |
1588552fa02a8a4b361b2c9f4dad030de95e5ea9 | [
"self.cost = cost\nself.parent = parent\nself.pos = pos\nself.chi = chi\nself.end_node = end_node",
"node_x = self.pos[0]\nnode_y = self.pos[1]\ndist = sqrt((node_x - x) ** 2 + (node_y - y) ** 2)\nang = atan2(y - node_y, x - node_x)\nreturn (dist, ang)"
] | <|body_start_0|>
self.cost = cost
self.parent = parent
self.pos = pos
self.chi = chi
self.end_node = end_node
<|end_body_0|>
<|body_start_1|>
node_x = self.pos[0]
node_y = self.pos[1]
dist = sqrt((node_x - x) ** 2 + (node_y - y) ** 2)
ang = atan2(... | Class to hold the nodes for the RRT path planning algorythm | rrtNode | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class rrtNode:
"""Class to hold the nodes for the RRT path planning algorythm"""
def __init__(self, cost, parent, pos, chi, end_node=False):
""":param cost: path distance to get to the node :param parent: previous node in the path chain :param orientation: (x, y, h, angle) the location/cou... | stack_v2_sparse_classes_75kplus_train_067876 | 9,828 | no_license | [
{
"docstring": ":param cost: path distance to get to the node :param parent: previous node in the path chain :param orientation: (x, y, h, angle) the location/course angle of node",
"name": "__init__",
"signature": "def __init__(self, cost, parent, pos, chi, end_node=False)"
},
{
"docstring": "C... | 2 | stack_v2_sparse_classes_30k_train_043870 | Implement the Python class `rrtNode` described below.
Class description:
Class to hold the nodes for the RRT path planning algorythm
Method signatures and docstrings:
- def __init__(self, cost, parent, pos, chi, end_node=False): :param cost: path distance to get to the node :param parent: previous node in the path ch... | Implement the Python class `rrtNode` described below.
Class description:
Class to hold the nodes for the RRT path planning algorythm
Method signatures and docstrings:
- def __init__(self, cost, parent, pos, chi, end_node=False): :param cost: path distance to get to the node :param parent: previous node in the path ch... | 8f85f67edec127fc5b759f7a0b91ea423118e12c | <|skeleton|>
class rrtNode:
"""Class to hold the nodes for the RRT path planning algorythm"""
def __init__(self, cost, parent, pos, chi, end_node=False):
""":param cost: path distance to get to the node :param parent: previous node in the path chain :param orientation: (x, y, h, angle) the location/cou... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class rrtNode:
"""Class to hold the nodes for the RRT path planning algorythm"""
def __init__(self, cost, parent, pos, chi, end_node=False):
""":param cost: path distance to get to the node :param parent: previous node in the path chain :param orientation: (x, y, h, angle) the location/course angle of ... | the_stack_v2_python_sparse | CH12/RRT.py | skyler237/FlightDynamics | train | 0 |
7ac1f61cc5da06e0a138292f693c05e36b60b3bc | [
"if p.val > q.val:\n p, q = (q, p)\nwhile root:\n if root.val < p.val:\n root = root.right\n elif root.val > q.val:\n root = root.left\n else:\n break\nreturn root",
"if root.val < p.val and root.val < q.val:\n return self.lowestCommonAncestor_2(root.right, p, q)\nif root.val >... | <|body_start_0|>
if p.val > q.val:
p, q = (q, p)
while root:
if root.val < p.val:
root = root.right
elif root.val > q.val:
root = root.left
else:
break
return root
<|end_body_0|>
<|body_start_1|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O(1): 使用常数大小的额外空间。 :param root: :param p: :param q: :return:"""
<|body_0|>
def lowest... | stack_v2_sparse_classes_75kplus_train_067877 | 2,864 | no_license | [
{
"docstring": "时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O(1): 使用常数大小的额外空间。 :param root: :param p: :param q: :return:",
"name": "lowestCommonAncestor_1",
"signature": "def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode'"
... | 2 | stack_v2_sparse_classes_30k_train_025507 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': 时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': 时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O... | 62419b49000e79962bcdc99cd98afd2fb82ea345 | <|skeleton|>
class Solution:
def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O(1): 使用常数大小的额外空间。 :param root: :param p: :param q: :return:"""
<|body_0|>
def lowest... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def lowestCommonAncestor_1(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""时间复杂度 O(N): 其中 N 为二叉树节点数;每循环一轮排除一层,二叉搜索树的层数最小为 logN (满二叉树), 最大为 N (退化为链表)。 空间复杂度 O(1): 使用常数大小的额外空间。 :param root: :param p: :param q: :return:"""
if p.val > q.val:
p, q = (q,... | the_stack_v2_python_sparse | 剑指 Offer(第 2 版)/lowestCommonAncestor_I.py | MaoningGuan/LeetCode | train | 3 | |
1eb7238384a6d9e1615d96255c0c2d9e00bdd6b5 | [
"if not coins:\n return -1\nlength = len(coins)\nif length == 0:\n return -1\ndp = [[float('inf')] * (length + 1) for _ in range(amount + 1)]\nfor j in range(length + 1):\n dp[0][j] = 0\nfor value in range(1, amount + 1):\n for j in range(1, length + 1):\n if coins[j - 1] <= value:\n m... | <|body_start_0|>
if not coins:
return -1
length = len(coins)
if length == 0:
return -1
dp = [[float('inf')] * (length + 1) for _ in range(amount + 1)]
for j in range(length + 1):
dp[0][j] = 0
for value in range(1, amount + 1):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def coinChange(self, coins, amount):
""":type coins: List[int] :type amount: int :rtype: int"""
<|body_0|>
def coinChange2(self, coins, amount):
""":type coins: List[int] :type amount: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_75kplus_train_067878 | 2,492 | no_license | [
{
"docstring": ":type coins: List[int] :type amount: int :rtype: int",
"name": "coinChange",
"signature": "def coinChange(self, coins, amount)"
},
{
"docstring": ":type coins: List[int] :type amount: int :rtype: int",
"name": "coinChange2",
"signature": "def coinChange2(self, coins, amou... | 2 | stack_v2_sparse_classes_30k_train_051361 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int
- def coinChange2(self, coins, amount): :type coins: List[int] :type amount: int :rtype:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def coinChange(self, coins, amount): :type coins: List[int] :type amount: int :rtype: int
- def coinChange2(self, coins, amount): :type coins: List[int] :type amount: int :rtype:... | 8d9eb98fa5e897602eae9c37b47fd8abae72b1dc | <|skeleton|>
class Solution:
def coinChange(self, coins, amount):
""":type coins: List[int] :type amount: int :rtype: int"""
<|body_0|>
def coinChange2(self, coins, amount):
""":type coins: List[int] :type amount: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def coinChange(self, coins, amount):
""":type coins: List[int] :type amount: int :rtype: int"""
if not coins:
return -1
length = len(coins)
if length == 0:
return -1
dp = [[float('inf')] * (length + 1) for _ in range(amount + 1)]
... | the_stack_v2_python_sparse | misc/322_coin_change.py | wanlipu/coding-python | train | 0 | |
a02e12be1e34aadb27b7f9856bdf117e5e5c5ba4 | [
"logging.getLogger('tensorflow').setLevel(logging.ERROR)\nlogging.getLogger('batchglm').setLevel(logging.WARNING)\nlogging.getLogger('diffxpy').setLevel(logging.WARNING)\nnp.random.seed(1)\nreturn self._test_model_fit(n_cells=n_cells, n_genes=n_genes, noise_model='nb')",
"logging.getLogger('tensorflow').setLevel(... | <|body_start_0|>
logging.getLogger('tensorflow').setLevel(logging.ERROR)
logging.getLogger('batchglm').setLevel(logging.WARNING)
logging.getLogger('diffxpy').setLevel(logging.WARNING)
np.random.seed(1)
return self._test_model_fit(n_cells=n_cells, n_genes=n_genes, noise_model='nb'... | Negative binomial noise model unit tests that tests whether model fit relay works. | TestFitNb | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFitNb:
"""Negative binomial noise model unit tests that tests whether model fit relay works."""
def test_model_fit(self, n_cells: int=2000, n_genes: int=2):
"""Test if model for "nb" noise model works. :param n_cells: Number of cells to simulate (number of observations per test).... | stack_v2_sparse_classes_75kplus_train_067879 | 9,911 | permissive | [
{
"docstring": "Test if model for \"nb\" noise model works. :param n_cells: Number of cells to simulate (number of observations per test). :param n_genes: Number of genes to simulate (number of tests).",
"name": "test_model_fit",
"signature": "def test_model_fit(self, n_cells: int=2000, n_genes: int=2)"... | 3 | stack_v2_sparse_classes_30k_train_000676 | Implement the Python class `TestFitNb` described below.
Class description:
Negative binomial noise model unit tests that tests whether model fit relay works.
Method signatures and docstrings:
- def test_model_fit(self, n_cells: int=2000, n_genes: int=2): Test if model for "nb" noise model works. :param n_cells: Numbe... | Implement the Python class `TestFitNb` described below.
Class description:
Negative binomial noise model unit tests that tests whether model fit relay works.
Method signatures and docstrings:
- def test_model_fit(self, n_cells: int=2000, n_genes: int=2): Test if model for "nb" noise model works. :param n_cells: Numbe... | 7609ea935936e3739fc4c71b75c8ee8ca57f51ea | <|skeleton|>
class TestFitNb:
"""Negative binomial noise model unit tests that tests whether model fit relay works."""
def test_model_fit(self, n_cells: int=2000, n_genes: int=2):
"""Test if model for "nb" noise model works. :param n_cells: Number of cells to simulate (number of observations per test).... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestFitNb:
"""Negative binomial noise model unit tests that tests whether model fit relay works."""
def test_model_fit(self, n_cells: int=2000, n_genes: int=2):
"""Test if model for "nb" noise model works. :param n_cells: Number of cells to simulate (number of observations per test). :param n_gen... | the_stack_v2_python_sparse | diffxpy/unit_test/test_fit.py | theislab/diffxpy | train | 163 |
2623e01b133e2afcce17d60a49ee127907cea704 | [
"test_pharmaceutical = Pharmaceutical(drug='Test Drug', dose='1 mg/kg', mode='Oral', recurrance='Daily', vendor=Vendor.objects.get(pk=1))\ntest_pharmaceutical.save()\nself.assertEqual(test_pharmaceutical.pk, 1)",
"test_pharmaceutical = Pharmaceutical(drug='Test Drug', dose='1 mg/kg', mode='Oral', recurrance='Dail... | <|body_start_0|>
test_pharmaceutical = Pharmaceutical(drug='Test Drug', dose='1 mg/kg', mode='Oral', recurrance='Daily', vendor=Vendor.objects.get(pk=1))
test_pharmaceutical.save()
self.assertEqual(test_pharmaceutical.pk, 1)
<|end_body_0|>
<|body_start_1|>
test_pharmaceutical = Pharmace... | These tests test the functionality of :class:`~mousedb.data.models.Pharmaceutical` objects. | PharmaceuticalModelTests | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PharmaceuticalModelTests:
"""These tests test the functionality of :class:`~mousedb.data.models.Pharmaceutical` objects."""
def test_create_pharmaceutical_minimum(self):
"""This test creates a :class:`~mousedb.data.models.Pharmaceutical` with the required information only."""
... | stack_v2_sparse_classes_75kplus_train_067880 | 29,846 | permissive | [
{
"docstring": "This test creates a :class:`~mousedb.data.models.Pharmaceutical` with the required information only.",
"name": "test_create_pharmaceutical_minimum",
"signature": "def test_create_pharmaceutical_minimum(self)"
},
{
"docstring": "This test creates a :class:`~mousedb.data.models.Pha... | 4 | stack_v2_sparse_classes_30k_train_041450 | Implement the Python class `PharmaceuticalModelTests` described below.
Class description:
These tests test the functionality of :class:`~mousedb.data.models.Pharmaceutical` objects.
Method signatures and docstrings:
- def test_create_pharmaceutical_minimum(self): This test creates a :class:`~mousedb.data.models.Pharm... | Implement the Python class `PharmaceuticalModelTests` described below.
Class description:
These tests test the functionality of :class:`~mousedb.data.models.Pharmaceutical` objects.
Method signatures and docstrings:
- def test_create_pharmaceutical_minimum(self): This test creates a :class:`~mousedb.data.models.Pharm... | 7e423991f72c89468010c99865e3c70c22044df3 | <|skeleton|>
class PharmaceuticalModelTests:
"""These tests test the functionality of :class:`~mousedb.data.models.Pharmaceutical` objects."""
def test_create_pharmaceutical_minimum(self):
"""This test creates a :class:`~mousedb.data.models.Pharmaceutical` with the required information only."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PharmaceuticalModelTests:
"""These tests test the functionality of :class:`~mousedb.data.models.Pharmaceutical` objects."""
def test_create_pharmaceutical_minimum(self):
"""This test creates a :class:`~mousedb.data.models.Pharmaceutical` with the required information only."""
test_pharmac... | the_stack_v2_python_sparse | mousedb/data/tests.py | BridgesLab/mousedb | train | 0 |
5125724af01874cdd1bb09bc025a2db7a43bd10a | [
"if request.user.is_authenticated:\n return redirect('research:index')\nus_form = UserForm()\ncontext = {'us_form': us_form}\nreturn render(request, 'user/connection.html', context)",
"us_form = UserForm(request.POST)\nif us_form.is_valid():\n username = us_form.cleaned_data['username']\n password = us_f... | <|body_start_0|>
if request.user.is_authenticated:
return redirect('research:index')
us_form = UserForm()
context = {'us_form': us_form}
return render(request, 'user/connection.html', context)
<|end_body_0|>
<|body_start_1|>
us_form = UserForm(request.POST)
i... | This class deals with login get > loads a connection page post > analyses datas in order to try to authenticate | ConnectionView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConnectionView:
"""This class deals with login get > loads a connection page post > analyses datas in order to try to authenticate"""
def get(self, request):
"""manage the get request concerning the connection page"""
<|body_0|>
def post(self, request):
"""manage... | stack_v2_sparse_classes_75kplus_train_067881 | 6,872 | no_license | [
{
"docstring": "manage the get request concerning the connection page",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "manages the post request for connection page, use given datas in order to try to authenticate",
"name": "post",
"signature": "def post(self, req... | 2 | stack_v2_sparse_classes_30k_test_001027 | Implement the Python class `ConnectionView` described below.
Class description:
This class deals with login get > loads a connection page post > analyses datas in order to try to authenticate
Method signatures and docstrings:
- def get(self, request): manage the get request concerning the connection page
- def post(s... | Implement the Python class `ConnectionView` described below.
Class description:
This class deals with login get > loads a connection page post > analyses datas in order to try to authenticate
Method signatures and docstrings:
- def get(self, request): manage the get request concerning the connection page
- def post(s... | 378244474186a2fe25f91377f3628a1479329f99 | <|skeleton|>
class ConnectionView:
"""This class deals with login get > loads a connection page post > analyses datas in order to try to authenticate"""
def get(self, request):
"""manage the get request concerning the connection page"""
<|body_0|>
def post(self, request):
"""manage... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConnectionView:
"""This class deals with login get > loads a connection page post > analyses datas in order to try to authenticate"""
def get(self, request):
"""manage the get request concerning the connection page"""
if request.user.is_authenticated:
return redirect('research... | the_stack_v2_python_sparse | user/views.py | blingstand/projet8 | train | 0 |
fac5d7f5c4698f79e94d9abaa3e5e6dfd71d5d0e | [
"self.name = name\nself.card_number = card_number\nself.apr_percent = apr_percent\nself.limit = limit\nself.balance = 0\nself.fees = 0",
"if purchase_price + self.balance + self.fees > self.limit:\n return False\nelse:\n self.balance += purchase_price\n return True",
"if payment_amount > 0 and payment_... | <|body_start_0|>
self.name = name
self.card_number = card_number
self.apr_percent = apr_percent
self.limit = limit
self.balance = 0
self.fees = 0
<|end_body_0|>
<|body_start_1|>
if purchase_price + self.balance + self.fees > self.limit:
return False
... | This class provides a template for a personal credit card. It has already been completely filled out for you. | CreditCard | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreditCard:
"""This class provides a template for a personal credit card. It has already been completely filled out for you."""
def __init__(self, name, card_number, apr_percent, limit):
"""Initialize an instance of the class. Arguments: name: The name of the account holder card_numb... | stack_v2_sparse_classes_75kplus_train_067882 | 6,139 | no_license | [
{
"docstring": "Initialize an instance of the class. Arguments: name: The name of the account holder card_number: The credit card number apr_percent: The APR, as a percentage (i.e. 20 instead of 0.2 for a 20 percent APR). limit: The limit on the card. Returns: None Sets the following class attributes: name = na... | 4 | stack_v2_sparse_classes_30k_val_000294 | Implement the Python class `CreditCard` described below.
Class description:
This class provides a template for a personal credit card. It has already been completely filled out for you.
Method signatures and docstrings:
- def __init__(self, name, card_number, apr_percent, limit): Initialize an instance of the class. ... | Implement the Python class `CreditCard` described below.
Class description:
This class provides a template for a personal credit card. It has already been completely filled out for you.
Method signatures and docstrings:
- def __init__(self, name, card_number, apr_percent, limit): Initialize an instance of the class. ... | 9f55c92f599166c9ccf9c8ed2c94e337a2423c60 | <|skeleton|>
class CreditCard:
"""This class provides a template for a personal credit card. It has already been completely filled out for you."""
def __init__(self, name, card_number, apr_percent, limit):
"""Initialize an instance of the class. Arguments: name: The name of the account holder card_numb... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreditCard:
"""This class provides a template for a personal credit card. It has already been completely filled out for you."""
def __init__(self, name, card_number, apr_percent, limit):
"""Initialize an instance of the class. Arguments: name: The name of the account holder card_number: The credi... | the_stack_v2_python_sparse | Copies/PythFound2/classes_2.py | MFahey0706/LocalMisc | train | 0 |
665a0235561e11c4dfe95037ec16295576c8511e | [
"self.agent_id = agent_id\nself.widget = widget\nself.config = config\nself.version = version",
"command = context.command\nrepresentation = context.representation\noutput = None\nerror = None\nif command:\n if command == 'config':\n if representation == 'popup':\n output = self.configure(das... | <|body_start_0|>
self.agent_id = agent_id
self.widget = widget
self.config = config
self.version = version
<|end_body_0|>
<|body_start_1|>
command = context.command
representation = context.representation
output = None
error = None
if command:
... | Object serving a dashboard widget - renders the widget according to the active configuration - dispatches Ajax requests to widget methods - manages the widget configuration | S3DashboardAgent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class S3DashboardAgent:
"""Object serving a dashboard widget - renders the widget according to the active configuration - dispatches Ajax requests to widget methods - manages the widget configuration"""
def __init__(self, agent_id, widget=None, config=None, version=None):
"""Args: agent_id... | stack_v2_sparse_classes_75kplus_train_067883 | 49,741 | permissive | [
{
"docstring": "Args: agent_id: the agent ID (string), a unique XML identifier for the widget configuration widget: the widget (S3DashboardWidget instance) config: the widget configuration (dict) version: the config version",
"name": "__init__",
"signature": "def __init__(self, agent_id, widget=None, co... | 5 | stack_v2_sparse_classes_30k_train_036429 | Implement the Python class `S3DashboardAgent` described below.
Class description:
Object serving a dashboard widget - renders the widget according to the active configuration - dispatches Ajax requests to widget methods - manages the widget configuration
Method signatures and docstrings:
- def __init__(self, agent_id... | Implement the Python class `S3DashboardAgent` described below.
Class description:
Object serving a dashboard widget - renders the widget according to the active configuration - dispatches Ajax requests to widget methods - manages the widget configuration
Method signatures and docstrings:
- def __init__(self, agent_id... | 7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6 | <|skeleton|>
class S3DashboardAgent:
"""Object serving a dashboard widget - renders the widget according to the active configuration - dispatches Ajax requests to widget methods - manages the widget configuration"""
def __init__(self, agent_id, widget=None, config=None, version=None):
"""Args: agent_id... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class S3DashboardAgent:
"""Object serving a dashboard widget - renders the widget according to the active configuration - dispatches Ajax requests to widget methods - manages the widget configuration"""
def __init__(self, agent_id, widget=None, config=None, version=None):
"""Args: agent_id: the agent I... | the_stack_v2_python_sparse | modules/core/ui/dashboard.py | nursix/drkcm | train | 3 |
f9a06a9bdc9abbaca4bf160c174011bef5b8dda9 | [
"if not isinstance(data, np.ndarray) or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nif data.shape[1] < 2:\n raise ValueError('data must contain multiple data points')\nd = data.shape[0]\nn = data.shape[1]\nself.d = d\nmean = np.mean(data.T, axis=0).reshape(1, d)\nself.mean = me... | <|body_start_0|>
if not isinstance(data, np.ndarray) or len(data.shape) != 2:
raise TypeError('data must be a 2D numpy.ndarray')
if data.shape[1] < 2:
raise ValueError('data must contain multiple data points')
d = data.shape[0]
n = data.shape[1]
self.d = d... | Create the class MultiNormal | MultiNormal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiNormal:
"""Create the class MultiNormal"""
def __init__(self, data):
"""data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point Set the public instance variables: mean: numpy.ndarray of shap... | stack_v2_sparse_classes_75kplus_train_067884 | 1,922 | no_license | [
{
"docstring": "data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point Set the public instance variables: mean: numpy.ndarray of shape (d, 1) with the mean of data cov: numpy.ndarray of shape (d, d) with the covariance mat... | 2 | stack_v2_sparse_classes_30k_train_006155 | Implement the Python class `MultiNormal` described below.
Class description:
Create the class MultiNormal
Method signatures and docstrings:
- def __init__(self, data): data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point Set t... | Implement the Python class `MultiNormal` described below.
Class description:
Create the class MultiNormal
Method signatures and docstrings:
- def __init__(self, data): data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point Set t... | 4a7a8ff0c4f785656a395d0abf4f182ce1fef5bc | <|skeleton|>
class MultiNormal:
"""Create the class MultiNormal"""
def __init__(self, data):
"""data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point Set the public instance variables: mean: numpy.ndarray of shap... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiNormal:
"""Create the class MultiNormal"""
def __init__(self, data):
"""data is a numpy.ndarray of shape (d, n) containing the data set: n is the number of data points d is the number of dimensions in each data point Set the public instance variables: mean: numpy.ndarray of shape (d, 1) with... | the_stack_v2_python_sparse | math/0x06-multivariate_prob/multinormal.py | xica369/holbertonschool-machine_learning | train | 0 |
6d254cd959bb9b5fa458d862289f585bc6f063a2 | [
"L = list(map(int, str(N + 1)))\nres, n = (0, len(L))\n\ndef A(m, n):\n return 1 if n == 0 else A(m, n - 1) * (m - n + 1)\nfor i in range(1, n):\n res += 9 * A(9, i - 1)\ns = set()\nfor i, x in enumerate(L):\n for y in range(0 if i else 1, x):\n if y not in s:\n res += A(9 - i, n - i - 1)... | <|body_start_0|>
L = list(map(int, str(N + 1)))
res, n = (0, len(L))
def A(m, n):
return 1 if n == 0 else A(m, n - 1) * (m - n + 1)
for i in range(1, n):
res += 9 * A(9, i - 1)
s = set()
for i, x in enumerate(L):
for y in range(0 if i ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numDupDigitsAtMostN(self, N):
""":param N: :return:"""
<|body_0|>
def numDupDigitsAtMostN2(self, N):
"""超时 :param N: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
L = list(map(int, str(N + 1)))
res, n = (0, len(L))
... | stack_v2_sparse_classes_75kplus_train_067885 | 2,023 | no_license | [
{
"docstring": ":param N: :return:",
"name": "numDupDigitsAtMostN",
"signature": "def numDupDigitsAtMostN(self, N)"
},
{
"docstring": "超时 :param N: :return:",
"name": "numDupDigitsAtMostN2",
"signature": "def numDupDigitsAtMostN2(self, N)"
}
] | 2 | stack_v2_sparse_classes_30k_train_029431 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numDupDigitsAtMostN(self, N): :param N: :return:
- def numDupDigitsAtMostN2(self, N): 超时 :param N: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numDupDigitsAtMostN(self, N): :param N: :return:
- def numDupDigitsAtMostN2(self, N): 超时 :param N: :return:
<|skeleton|>
class Solution:
def numDupDigitsAtMostN(self, N... | 5d3574ccd282d0146c83c286ae28d8baaabd4910 | <|skeleton|>
class Solution:
def numDupDigitsAtMostN(self, N):
""":param N: :return:"""
<|body_0|>
def numDupDigitsAtMostN2(self, N):
"""超时 :param N: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def numDupDigitsAtMostN(self, N):
""":param N: :return:"""
L = list(map(int, str(N + 1)))
res, n = (0, len(L))
def A(m, n):
return 1 if n == 0 else A(m, n - 1) * (m - n + 1)
for i in range(1, n):
res += 9 * A(9, i - 1)
s = set(... | the_stack_v2_python_sparse | 1012_至少有 1 位重复的数字.py | lovehhf/LeetCode | train | 0 | |
a4f6933d8a31c561a887a4a696b1f3a3c72d1fe6 | [
"result = []\nfor config in pipeline_config:\n if isinstance(config, str):\n config = {config: {}}\n assert isinstance(config, dict)\n assert len(config) == 1\n annotator_type, config = next(iter(config.items()))\n if not isinstance(config, dict):\n assert isinstance(config, str)\n ... | <|body_start_0|>
result = []
for config in pipeline_config:
if isinstance(config, str):
config = {config: {}}
assert isinstance(config, dict)
assert len(config) == 1
annotator_type, config = next(iter(config.items()))
if not isi... | Parser for annotation configuration. | AnnotationConfigParser | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnnotationConfigParser:
"""Parser for annotation configuration."""
def normalize(pipeline_config: List[Any]) -> List[Dict]:
"""Return a normalized annotation pipeline configuration."""
<|body_0|>
def parse_raw(pipeline_raw_config: Optional[list[dict[str, Any]]]) -> list[... | stack_v2_sparse_classes_75kplus_train_067886 | 14,846 | permissive | [
{
"docstring": "Return a normalized annotation pipeline configuration.",
"name": "normalize",
"signature": "def normalize(pipeline_config: List[Any]) -> List[Dict]"
},
{
"docstring": "Parse raw dictionary annotation pipeline configuration.",
"name": "parse_raw",
"signature": "def parse_r... | 6 | stack_v2_sparse_classes_30k_train_005697 | Implement the Python class `AnnotationConfigParser` described below.
Class description:
Parser for annotation configuration.
Method signatures and docstrings:
- def normalize(pipeline_config: List[Any]) -> List[Dict]: Return a normalized annotation pipeline configuration.
- def parse_raw(pipeline_raw_config: Optional... | Implement the Python class `AnnotationConfigParser` described below.
Class description:
Parser for annotation configuration.
Method signatures and docstrings:
- def normalize(pipeline_config: List[Any]) -> List[Dict]: Return a normalized annotation pipeline configuration.
- def parse_raw(pipeline_raw_config: Optional... | 21c8d4d32f632431704556f8bcb158f9bb686239 | <|skeleton|>
class AnnotationConfigParser:
"""Parser for annotation configuration."""
def normalize(pipeline_config: List[Any]) -> List[Dict]:
"""Return a normalized annotation pipeline configuration."""
<|body_0|>
def parse_raw(pipeline_raw_config: Optional[list[dict[str, Any]]]) -> list[... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnnotationConfigParser:
"""Parser for annotation configuration."""
def normalize(pipeline_config: List[Any]) -> List[Dict]:
"""Return a normalized annotation pipeline configuration."""
result = []
for config in pipeline_config:
if isinstance(config, str):
... | the_stack_v2_python_sparse | dae/dae/annotation/annotation_factory.py | iossifovlab/gpf | train | 5 |
b27241427231eeae2be1cb687a6069a1306c2d37 | [
"catalog = plone.api.portal.get_tool('portal_catalog')\nresult = list()\nfor brain in catalog(portal_type='Provider'):\n provider = brain.getObject()\n for brain2 in catalog(portal_type='RegisteredServiceComponent', path='/'.join(provider.getPhysicalPath())):\n rsc = brain2.getObject()\n version... | <|body_start_0|>
catalog = plone.api.portal.get_tool('portal_catalog')
result = list()
for brain in catalog(portal_type='Provider'):
provider = brain.getObject()
for brain2 in catalog(portal_type='RegisteredServiceComponent', path='/'.join(provider.getPhysicalPath())):
... | RegisteredServiceComponents | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegisteredServiceComponents:
def items(self):
"""Accumulatated view over all RegisteredServiceComponents"""
<|body_0|>
def notify_outdated(self):
"""Notify providers by email about outdated implementations"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_067887 | 3,159 | no_license | [
{
"docstring": "Accumulatated view over all RegisteredServiceComponents",
"name": "items",
"signature": "def items(self)"
},
{
"docstring": "Notify providers by email about outdated implementations",
"name": "notify_outdated",
"signature": "def notify_outdated(self)"
}
] | 2 | null | Implement the Python class `RegisteredServiceComponents` described below.
Class description:
Implement the RegisteredServiceComponents class.
Method signatures and docstrings:
- def items(self): Accumulatated view over all RegisteredServiceComponents
- def notify_outdated(self): Notify providers by email about outdat... | Implement the Python class `RegisteredServiceComponents` described below.
Class description:
Implement the RegisteredServiceComponents class.
Method signatures and docstrings:
- def items(self): Accumulatated view over all RegisteredServiceComponents
- def notify_outdated(self): Notify providers by email about outdat... | 6d7656dfd1687df055f7f8cedb2e7fad92468988 | <|skeleton|>
class RegisteredServiceComponents:
def items(self):
"""Accumulatated view over all RegisteredServiceComponents"""
<|body_0|>
def notify_outdated(self):
"""Notify providers by email about outdated implementations"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RegisteredServiceComponents:
def items(self):
"""Accumulatated view over all RegisteredServiceComponents"""
catalog = plone.api.portal.get_tool('portal_catalog')
result = list()
for brain in catalog(portal_type='Provider'):
provider = brain.getObject()
f... | the_stack_v2_python_sparse | src/pcp/contenttypes/browser/provider.py | EUDAT-DPMT/pcp.contenttypes | train | 1 | |
19568443677c3027c374d0c301402dbc65662e91 | [
"session = db.session()\nrepo = self._exists(session, reponame)\nif not repo:\n yield ('A repository by the name of %s was not found.' % reponame)\n return\nif not self.check_perms(session, repo):\n yield \"%(LR)Error:%(RST)s You don't have the required permissions.\"\n return\nlog.debug(repo)\nyield '%... | <|body_start_0|>
session = db.session()
repo = self._exists(session, reponame)
if not repo:
yield ('A repository by the name of %s was not found.' % reponame)
return
if not self.check_perms(session, repo):
yield "%(LR)Error:%(RST)s You don't have the r... | Repository managers commands. | RepositoryManagersCommands | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RepositoryManagersCommands:
"""Repository managers commands."""
def do_list(self, reponame):
"""List repository users."""
<|body_0|>
def do_add(self, reponame, username):
"""Add username as a manager of the repository."""
<|body_1|>
def do_delete(sel... | stack_v2_sparse_classes_75kplus_train_067888 | 6,649 | no_license | [
{
"docstring": "List repository users.",
"name": "do_list",
"signature": "def do_list(self, reponame)"
},
{
"docstring": "Add username as a manager of the repository.",
"name": "do_add",
"signature": "def do_add(self, reponame, username)"
},
{
"docstring": "Add username as a mana... | 3 | stack_v2_sparse_classes_30k_train_047378 | Implement the Python class `RepositoryManagersCommands` described below.
Class description:
Repository managers commands.
Method signatures and docstrings:
- def do_list(self, reponame): List repository users.
- def do_add(self, reponame, username): Add username as a manager of the repository.
- def do_delete(self, r... | Implement the Python class `RepositoryManagersCommands` described below.
Class description:
Repository managers commands.
Method signatures and docstrings:
- def do_list(self, reponame): List repository users.
- def do_add(self, reponame, username): Add username as a manager of the repository.
- def do_delete(self, r... | 75f0c76f67ad4d98f83645a1ae05980dd5aa28e6 | <|skeleton|>
class RepositoryManagersCommands:
"""Repository managers commands."""
def do_list(self, reponame):
"""List repository users."""
<|body_0|>
def do_add(self, reponame, username):
"""Add username as a manager of the repository."""
<|body_1|>
def do_delete(sel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RepositoryManagersCommands:
"""Repository managers commands."""
def do_list(self, reponame):
"""List repository users."""
session = db.session()
repo = self._exists(session, reponame)
if not repo:
yield ('A repository by the name of %s was not found.' % reponam... | the_stack_v2_python_sparse | sshg/terminal/commands/repositories.py | UfSoft/SSHg | train | 0 |
4487df2cdfa6328e6d73fe0fcc4f7885ada2e7dc | [
"self.n = len(nums)\nself.tree = [0] * self.n + nums\nfor i in range(self.n - 1, 0, -1):\n self.tree[i] = self.tree[i << 1] + self.tree[i << 1 | 1]",
"pos += self.n\nself.tree[pos] = val\nwhile pos > 1:\n self.tree[pos >> 1] = self.tree[pos] + self.tree[pos ^ 1]\n pos >>= 1",
"left += self.n\nright += ... | <|body_start_0|>
self.n = len(nums)
self.tree = [0] * self.n + nums
for i in range(self.n - 1, 0, -1):
self.tree[i] = self.tree[i << 1] + self.tree[i << 1 | 1]
<|end_body_0|>
<|body_start_1|>
pos += self.n
self.tree[pos] = val
while pos > 1:
self.... | SegmentTree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SegmentTree:
def __init__(self, nums):
"""Builds segment tree using nums. Segment tree has 2N - 1 elements, N leaf elements are same as array elements and N - 1 elements are internal nodes which hold sum (or any other operation result like min, max, xor, etc.) of it's child elements. So ... | stack_v2_sparse_classes_75kplus_train_067889 | 4,379 | no_license | [
{
"docstring": "Builds segment tree using nums. Segment tree has 2N - 1 elements, N leaf elements are same as array elements and N - 1 elements are internal nodes which hold sum (or any other operation result like min, max, xor, etc.) of it's child elements. So in segment tree left child is at index 2i and righ... | 3 | null | Implement the Python class `SegmentTree` described below.
Class description:
Implement the SegmentTree class.
Method signatures and docstrings:
- def __init__(self, nums): Builds segment tree using nums. Segment tree has 2N - 1 elements, N leaf elements are same as array elements and N - 1 elements are internal nodes... | Implement the Python class `SegmentTree` described below.
Class description:
Implement the SegmentTree class.
Method signatures and docstrings:
- def __init__(self, nums): Builds segment tree using nums. Segment tree has 2N - 1 elements, N leaf elements are same as array elements and N - 1 elements are internal nodes... | 062c628f5364414b257b7ba67c97999726128237 | <|skeleton|>
class SegmentTree:
def __init__(self, nums):
"""Builds segment tree using nums. Segment tree has 2N - 1 elements, N leaf elements are same as array elements and N - 1 elements are internal nodes which hold sum (or any other operation result like min, max, xor, etc.) of it's child elements. So ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SegmentTree:
def __init__(self, nums):
"""Builds segment tree using nums. Segment tree has 2N - 1 elements, N leaf elements are same as array elements and N - 1 elements are internal nodes which hold sum (or any other operation result like min, max, xor, etc.) of it's child elements. So in segment tre... | the_stack_v2_python_sparse | Level-3/segment-tree.py | hansrajdas/algorithms | train | 80 | |
1d4f4e0d1b0628efd798fbf9ec32745d38c75d1c | [
"l = 0\nn = len(nums)\nr = n - 1\nwhile l <= r:\n mid = l + (r - l) // 2\n if nums[mid] < target:\n l = mid + 1\n elif nums[mid] > target:\n r = mid - 1\n else:\n left = mid\n while left >= l:\n if nums[left] != target:\n break\n left -= 1... | <|body_start_0|>
l = 0
n = len(nums)
r = n - 1
while l <= r:
mid = l + (r - l) // 2
if nums[mid] < target:
l = mid + 1
elif nums[mid] > target:
r = mid - 1
else:
left = mid
whi... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchRange1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] O(n) worst case"""
<|body_0|>
def searchRange2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] O(logn) worst and average cas... | stack_v2_sparse_classes_75kplus_train_067890 | 2,309 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int] O(n) worst case",
"name": "searchRange1",
"signature": "def searchRange1(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int] O(logn) worst and average case",
"name": "searc... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchRange1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] O(n) worst case
- def searchRange2(self, nums, target): :type nums: List[int] :typ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchRange1(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int] O(n) worst case
- def searchRange2(self, nums, target): :type nums: List[int] :typ... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def searchRange1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] O(n) worst case"""
<|body_0|>
def searchRange2(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] O(logn) worst and average cas... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def searchRange1(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int] O(n) worst case"""
l = 0
n = len(nums)
r = n - 1
while l <= r:
mid = l + (r - l) // 2
if nums[mid] < target:
l = mid + 1
... | the_stack_v2_python_sparse | S/SearchForARange.py | bssrdf/pyleet | train | 2 | |
c5a33049dbadecbe7038f6ad4e9d102e76117904 | [
"request = kwargs['request']\nif request_from_master(request):\n config.master_contacted()\ntry:\n current_assignments = config['current_assignments'].itervalues\nexcept AttributeError:\n current_assignments = config['current_assignments'].values\ntasks = []\nfor assignment in current_assignments():\n t... | <|body_start_0|>
request = kwargs['request']
if request_from_master(request):
config.master_contacted()
try:
current_assignments = config['current_assignments'].itervalues
except AttributeError:
current_assignments = config['current_assignments'].value... | Tasks | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tasks:
def get(self, **kwargs):
"""Returns all tasks which are currently being processed locally by the agent. .. http:get:: /api/v1/tasks/ HTTP/1.1 **Request** .. sourcecode:: http GET /api/v1/tasks/ HTTP/1.1 **Response** .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/js... | stack_v2_sparse_classes_75kplus_train_067891 | 5,070 | permissive | [
{
"docstring": "Returns all tasks which are currently being processed locally by the agent. .. http:get:: /api/v1/tasks/ HTTP/1.1 **Request** .. sourcecode:: http GET /api/v1/tasks/ HTTP/1.1 **Response** .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json [{ \"id\": \"732c1ef0-9488-4914-adef-c29... | 2 | stack_v2_sparse_classes_30k_train_015953 | Implement the Python class `Tasks` described below.
Class description:
Implement the Tasks class.
Method signatures and docstrings:
- def get(self, **kwargs): Returns all tasks which are currently being processed locally by the agent. .. http:get:: /api/v1/tasks/ HTTP/1.1 **Request** .. sourcecode:: http GET /api/v1/... | Implement the Python class `Tasks` described below.
Class description:
Implement the Tasks class.
Method signatures and docstrings:
- def get(self, **kwargs): Returns all tasks which are currently being processed locally by the agent. .. http:get:: /api/v1/tasks/ HTTP/1.1 **Request** .. sourcecode:: http GET /api/v1/... | aa87504ab8679db0ed8da4818729b8e5fc1c0ecb | <|skeleton|>
class Tasks:
def get(self, **kwargs):
"""Returns all tasks which are currently being processed locally by the agent. .. http:get:: /api/v1/tasks/ HTTP/1.1 **Request** .. sourcecode:: http GET /api/v1/tasks/ HTTP/1.1 **Response** .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/js... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Tasks:
def get(self, **kwargs):
"""Returns all tasks which are currently being processed locally by the agent. .. http:get:: /api/v1/tasks/ HTTP/1.1 **Request** .. sourcecode:: http GET /api/v1/tasks/ HTTP/1.1 **Response** .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json [{ "id": "7... | the_stack_v2_python_sparse | pyfarm/agent/http/api/tasks.py | pyfarm/pyfarm-agent | train | 1 | |
4b56fd666917e5765c9429524d6f3aa8eb3bc180 | [
"super(ThresholdDetector, self).__init__()\nself.threshold = int(threshold)\nself.fade_bias = fade_bias\nself.min_percent = min_percent\nself.min_shot_len = min_shot_len\nself.last_frame_avg = None\nself.last_shot_cut = None\nself.add_final_shot = add_final_shot\nself.last_fade = {'frame': 0, 'type': None}\nself.bl... | <|body_start_0|>
super(ThresholdDetector, self).__init__()
self.threshold = int(threshold)
self.fade_bias = fade_bias
self.min_percent = min_percent
self.min_shot_len = min_shot_len
self.last_frame_avg = None
self.last_shot_cut = None
self.add_final_shot =... | Detects fast cuts/slow fades in from and out to a given threshold level. Detects both fast cuts and slow fades so long as an appropriate threshold is chosen (especially taking into account the minimum grey/black level). Attributes: threshold: 8-bit intensity value that each pixel value (R, G, and B) must be <= to in or... | ThresholdDetector | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThresholdDetector:
"""Detects fast cuts/slow fades in from and out to a given threshold level. Detects both fast cuts and slow fades so long as an appropriate threshold is chosen (especially taking into account the minimum grey/black level). Attributes: threshold: 8-bit intensity value that each ... | stack_v2_sparse_classes_75kplus_train_067892 | 9,710 | permissive | [
{
"docstring": "Initializes threshold-based shot detector object.",
"name": "__init__",
"signature": "def __init__(self, threshold=12, min_percent=0.95, min_shot_len=15, fade_bias=0.0, add_final_shot=False, block_size=8)"
},
{
"docstring": "Check if the frame is below (true) or above (false) the... | 4 | null | Implement the Python class `ThresholdDetector` described below.
Class description:
Detects fast cuts/slow fades in from and out to a given threshold level. Detects both fast cuts and slow fades so long as an appropriate threshold is chosen (especially taking into account the minimum grey/black level). Attributes: thre... | Implement the Python class `ThresholdDetector` described below.
Class description:
Detects fast cuts/slow fades in from and out to a given threshold level. Detects both fast cuts and slow fades so long as an appropriate threshold is chosen (especially taking into account the minimum grey/black level). Attributes: thre... | 87adf90160a1f490e5c49732227c500d38a7d933 | <|skeleton|>
class ThresholdDetector:
"""Detects fast cuts/slow fades in from and out to a given threshold level. Detects both fast cuts and slow fades so long as an appropriate threshold is chosen (especially taking into account the minimum grey/black level). Attributes: threshold: 8-bit intensity value that each ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ThresholdDetector:
"""Detects fast cuts/slow fades in from and out to a given threshold level. Detects both fast cuts and slow fades so long as an appropriate threshold is chosen (especially taking into account the minimum grey/black level). Attributes: threshold: 8-bit intensity value that each pixel value (... | the_stack_v2_python_sparse | pre/ShotDetection/shotdetect/detectors/threshold_detector.py | AnyiRao/SceneSeg | train | 210 |
90c7db22428a08c218ca90a408ed99828138981a | [
"applicant_user = Client.objects.get(id=id_a)\nif CV.objects.filter(client_cv=applicant_user):\n accepted_vacancies = applicant_user.cv_set.all()[0].vacancies_accept.all()\n for resume in applicant_user.cv_set.all()[1:]:\n accepted_vacancies |= resume.vacancies_accept.all()\nelse:\n accepted_vacanci... | <|body_start_0|>
applicant_user = Client.objects.get(id=id_a)
if CV.objects.filter(client_cv=applicant_user):
accepted_vacancies = applicant_user.cv_set.all()[0].vacancies_accept.all()
for resume in applicant_user.cv_set.all()[1:]:
accepted_vacancies |= resume.vac... | CreateJobInterview | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateJobInterview:
def get(self, request, id_a):
"""Вывод на экран подтвержденных вакансий"""
<|body_0|>
def post(self, request, id_a):
"""Создание собеседования для клиента"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
applicant_user = Client.ob... | stack_v2_sparse_classes_75kplus_train_067893 | 34,934 | no_license | [
{
"docstring": "Вывод на экран подтвержденных вакансий",
"name": "get",
"signature": "def get(self, request, id_a)"
},
{
"docstring": "Создание собеседования для клиента",
"name": "post",
"signature": "def post(self, request, id_a)"
}
] | 2 | stack_v2_sparse_classes_30k_train_053330 | Implement the Python class `CreateJobInterview` described below.
Class description:
Implement the CreateJobInterview class.
Method signatures and docstrings:
- def get(self, request, id_a): Вывод на экран подтвержденных вакансий
- def post(self, request, id_a): Создание собеседования для клиента | Implement the Python class `CreateJobInterview` described below.
Class description:
Implement the CreateJobInterview class.
Method signatures and docstrings:
- def get(self, request, id_a): Вывод на экран подтвержденных вакансий
- def post(self, request, id_a): Создание собеседования для клиента
<|skeleton|>
class C... | ca0fd60217b946f16a64e24fa091c0f155c452bc | <|skeleton|>
class CreateJobInterview:
def get(self, request, id_a):
"""Вывод на экран подтвержденных вакансий"""
<|body_0|>
def post(self, request, id_a):
"""Создание собеседования для клиента"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CreateJobInterview:
def get(self, request, id_a):
"""Вывод на экран подтвержденных вакансий"""
applicant_user = Client.objects.get(id=id_a)
if CV.objects.filter(client_cv=applicant_user):
accepted_vacancies = applicant_user.cv_set.all()[0].vacancies_accept.all()
... | the_stack_v2_python_sparse | recruit/views.py | Sanello2010/BelHardCMS | train | 1 | |
fcf48dc02688cb559e4924fd123426eff43e8e45 | [
"logger.info('%s initialization' % obj.name)\nsuper(self.__class__, self).__init__(obj, parent)\nself.local_data['near_robots'] = {}\ntry:\n self._range = self.blender_obj['Range']\nexcept KeyError:\n self._range = 100\nlogger.info('Component initialized')",
"self.local_data['near_robots'] = {}\nparent = se... | <|body_start_0|>
logger.info('%s initialization' % obj.name)
super(self.__class__, self).__init__(obj, parent)
self.local_data['near_robots'] = {}
try:
self._range = self.blender_obj['Range']
except KeyError:
self._range = 100
logger.info('Componen... | Distance sensor to detect nearby robots | ProximitySensorClass | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProximitySensorClass:
"""Distance sensor to detect nearby robots"""
def __init__(self, obj, parent=None):
"""Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent."""
<|body_0|>
def default_action... | stack_v2_sparse_classes_75kplus_train_067894 | 1,799 | permissive | [
{
"docstring": "Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent.",
"name": "__init__",
"signature": "def __init__(self, obj, parent=None)"
},
{
"docstring": "Create a list of robots within a certain radius of the se... | 3 | stack_v2_sparse_classes_30k_val_001930 | Implement the Python class `ProximitySensorClass` described below.
Class description:
Distance sensor to detect nearby robots
Method signatures and docstrings:
- def __init__(self, obj, parent=None): Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the objec... | Implement the Python class `ProximitySensorClass` described below.
Class description:
Distance sensor to detect nearby robots
Method signatures and docstrings:
- def __init__(self, obj, parent=None): Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the objec... | 25b8e1532e8fa21793c3b2973fc1fc3ac7a04ebd | <|skeleton|>
class ProximitySensorClass:
"""Distance sensor to detect nearby robots"""
def __init__(self, obj, parent=None):
"""Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent."""
<|body_0|>
def default_action... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProximitySensorClass:
"""Distance sensor to detect nearby robots"""
def __init__(self, obj, parent=None):
"""Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent."""
logger.info('%s initialization' % obj.name)
... | the_stack_v2_python_sparse | src/morse/sensors/proximity.py | peterroelants/morse | train | 1 |
865522c4fbc8a9b0cc486b75c0b8347c18ea0a34 | [
"self.base_url = 'http://weatherstation.wunderground.com/' + 'weatherstation/updateweatherstation.php'\nself.url_items = {}\nself.valid_keys = ('action', 'ID', 'PASSWORD', 'dateutc', 'winddir', 'windspeedmph', 'windgustmph', 'windgustdir', 'windspdmph_avg2m', 'winddir_avg2m', 'windgustmph_10m', 'windgustdir_10m', '... | <|body_start_0|>
self.base_url = 'http://weatherstation.wunderground.com/' + 'weatherstation/updateweatherstation.php'
self.url_items = {}
self.valid_keys = ('action', 'ID', 'PASSWORD', 'dateutc', 'winddir', 'windspeedmph', 'windgustmph', 'windgustdir', 'windspdmph_avg2m', 'winddir_avg2m', 'wind... | this class represents a weather under ground upload url | WUURL | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WUURL:
"""this class represents a weather under ground upload url"""
def __init__(self):
"""initialize a url"""
<|body_0|>
def __str__(self):
"""converst url to string"""
<|body_1|>
def add_item(self, key, value):
"""adds an item to url argum... | stack_v2_sparse_classes_75kplus_train_067895 | 7,715 | no_license | [
{
"docstring": "initialize a url",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "converst url to string",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "adds an item to url arguments: key: (string) value: (string)",
"name": "... | 4 | stack_v2_sparse_classes_30k_train_042336 | Implement the Python class `WUURL` described below.
Class description:
this class represents a weather under ground upload url
Method signatures and docstrings:
- def __init__(self): initialize a url
- def __str__(self): converst url to string
- def add_item(self, key, value): adds an item to url arguments: key: (str... | Implement the Python class `WUURL` described below.
Class description:
this class represents a weather under ground upload url
Method signatures and docstrings:
- def __init__(self): initialize a url
- def __str__(self): converst url to string
- def add_item(self, key, value): adds an item to url arguments: key: (str... | 95d0c102d649c5b028d262f5254106f997a7c77a | <|skeleton|>
class WUURL:
"""this class represents a weather under ground upload url"""
def __init__(self):
"""initialize a url"""
<|body_0|>
def __str__(self):
"""converst url to string"""
<|body_1|>
def add_item(self, key, value):
"""adds an item to url argum... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WUURL:
"""this class represents a weather under ground upload url"""
def __init__(self):
"""initialize a url"""
self.base_url = 'http://weatherstation.wunderground.com/' + 'weatherstation/updateweatherstation.php'
self.url_items = {}
self.valid_keys = ('action', 'ID', 'PAS... | the_stack_v2_python_sparse | wunder_formatter.py | rwspicer/csv_utilities | train | 1 |
bd40a36ae16d83390848cbf056848278368b9c52 | [
"super().__init__(loss_names_to_functions={'semantic_loss': classification_losses.classification_loss}, loss_names_to_weights={'semantic_loss': 1.0}, train_dir=train_dir, summary_log_freq=summary_log_freq)\ntask_names_to_num_output_channels = {standard_fields.DetectionResultFields.object_semantic_voxels: num_classe... | <|body_start_0|>
super().__init__(loss_names_to_functions={'semantic_loss': classification_losses.classification_loss}, loss_names_to_weights={'semantic_loss': 1.0}, train_dir=train_dir, summary_log_freq=summary_log_freq)
task_names_to_num_output_channels = {standard_fields.DetectionResultFields.object_... | 3D UNet sparse voxel network for semantic segmentation. Please refer to the following paper for more details: M. Najibi, G. Lai, A. Kundu, Z. Lu, V. Rathod, T. Funkhouser, C. Pantofaru, D. Ross, L. S. Davis, A. Fathi, 'DOPS: Learning to Detect 3D Objects and Predict Their 3D Shapes', CVPR 2020. | SemanticSegmentationModel | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SemanticSegmentationModel:
"""3D UNet sparse voxel network for semantic segmentation. Please refer to the following paper for more details: M. Najibi, G. Lai, A. Kundu, Z. Lu, V. Rathod, T. Funkhouser, C. Pantofaru, D. Ross, L. S. Davis, A. Fathi, 'DOPS: Learning to Detect 3D Objects and Predict ... | stack_v2_sparse_classes_75kplus_train_067896 | 4,669 | permissive | [
{
"docstring": "A semantic segmentation model based on 3D UNet sparse voxel network. Args: num_classes: A int indicating the number of semantic classes to predict logits. train_dir: A directory path to write tensorboard summary for losses. summary_log_freq: A int of the frequency (as batches) to log summary. Re... | 2 | stack_v2_sparse_classes_30k_train_006797 | Implement the Python class `SemanticSegmentationModel` described below.
Class description:
3D UNet sparse voxel network for semantic segmentation. Please refer to the following paper for more details: M. Najibi, G. Lai, A. Kundu, Z. Lu, V. Rathod, T. Funkhouser, C. Pantofaru, D. Ross, L. S. Davis, A. Fathi, 'DOPS: Lea... | Implement the Python class `SemanticSegmentationModel` described below.
Class description:
3D UNet sparse voxel network for semantic segmentation. Please refer to the following paper for more details: M. Najibi, G. Lai, A. Kundu, Z. Lu, V. Rathod, T. Funkhouser, C. Pantofaru, D. Ross, L. S. Davis, A. Fathi, 'DOPS: Lea... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class SemanticSegmentationModel:
"""3D UNet sparse voxel network for semantic segmentation. Please refer to the following paper for more details: M. Najibi, G. Lai, A. Kundu, Z. Lu, V. Rathod, T. Funkhouser, C. Pantofaru, D. Ross, L. S. Davis, A. Fathi, 'DOPS: Learning to Detect 3D Objects and Predict ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SemanticSegmentationModel:
"""3D UNet sparse voxel network for semantic segmentation. Please refer to the following paper for more details: M. Najibi, G. Lai, A. Kundu, Z. Lu, V. Rathod, T. Funkhouser, C. Pantofaru, D. Ross, L. S. Davis, A. Fathi, 'DOPS: Learning to Detect 3D Objects and Predict Their 3D Shap... | the_stack_v2_python_sparse | tf3d/semantic_segmentation/model.py | Jimmy-INL/google-research | train | 1 |
fe781ea7a63d26a3d6356887276aa603adefca92 | [
"self._domain = None\nself._model = None\nself._integer_label_to_operation_phase = None\nif domain:\n self._load_model(domain=domain)",
"self._domain = domain\npath_to_model_directory = './models/{domain}'.format(domain=domain)\nmodel_metadata = json.loads(open('{model_dir}/metadata.json'.format(model_dir=path... | <|body_start_0|>
self._domain = None
self._model = None
self._integer_label_to_operation_phase = None
if domain:
self._load_model(domain=domain)
<|end_body_0|>
<|body_start_1|>
self._domain = domain
path_to_model_directory = './models/{domain}'.format(domain=... | A class for interacting with Bert models | Predictor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Predictor:
"""A class for interacting with Bert models"""
def __init__(self, domain=None):
"""Initialize a Bert object."""
<|body_0|>
def _load_model(self, domain):
"""Load the Bert model fine-tuned to the given domain."""
<|body_1|>
def predict(self... | stack_v2_sparse_classes_75kplus_train_067897 | 2,086 | no_license | [
{
"docstring": "Initialize a Bert object.",
"name": "__init__",
"signature": "def __init__(self, domain=None)"
},
{
"docstring": "Load the Bert model fine-tuned to the given domain.",
"name": "_load_model",
"signature": "def _load_model(self, domain)"
},
{
"docstring": "Predict t... | 3 | stack_v2_sparse_classes_30k_val_001218 | Implement the Python class `Predictor` described below.
Class description:
A class for interacting with Bert models
Method signatures and docstrings:
- def __init__(self, domain=None): Initialize a Bert object.
- def _load_model(self, domain): Load the Bert model fine-tuned to the given domain.
- def predict(self, do... | Implement the Python class `Predictor` described below.
Class description:
A class for interacting with Bert models
Method signatures and docstrings:
- def __init__(self, domain=None): Initialize a Bert object.
- def _load_model(self, domain): Load the Bert model fine-tuned to the given domain.
- def predict(self, do... | 17f24bd4e2e888978be99c57f2c5697b9c495b40 | <|skeleton|>
class Predictor:
"""A class for interacting with Bert models"""
def __init__(self, domain=None):
"""Initialize a Bert object."""
<|body_0|>
def _load_model(self, domain):
"""Load the Bert model fine-tuned to the given domain."""
<|body_1|>
def predict(self... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Predictor:
"""A class for interacting with Bert models"""
def __init__(self, domain=None):
"""Initialize a Bert object."""
self._domain = None
self._model = None
self._integer_label_to_operation_phase = None
if domain:
self._load_model(domain=domain)
... | the_stack_v2_python_sparse | utilitiesService/service/state_prediction/state_prediction.py | alexmontesdeoca-raytheon/xaitk.bbn.equas | train | 0 |
0f4b95dd166cba8d26a0c8ef4de77027aeda53ea | [
"if isinstance(obj, Argument):\n return {'pointer': '*' * obj.is_ptr, 'name': obj.name, 'ctype': obj.ctype}\nelif isinstance(obj, Function):\n return {'pointer': '*' * obj.returns.is_ptr, 'returns': obj.returns.ctype, 'name': obj.name, 'func_arg': self.func(obj, 'func_arg')}",
"if fmt == 'func_arg':\n ar... | <|body_start_0|>
if isinstance(obj, Argument):
return {'pointer': '*' * obj.is_ptr, 'name': obj.name, 'ctype': obj.ctype}
elif isinstance(obj, Function):
return {'pointer': '*' * obj.returns.is_ptr, 'returns': obj.returns.ctype, 'name': obj.name, 'func_arg': self.func(obj, 'func_... | Formatter for the C language | CFormat | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CFormat:
"""Formatter for the C language"""
def prop(self, obj):
"""Return the c properties of an argument"""
<|body_0|>
def func(self, fcn, fmt):
"""Format a function with the specific format"""
<|body_1|>
def arg(self, arg, fmt):
"""Format ... | stack_v2_sparse_classes_75kplus_train_067898 | 11,904 | permissive | [
{
"docstring": "Return the c properties of an argument",
"name": "prop",
"signature": "def prop(self, obj)"
},
{
"docstring": "Format a function with the specific format",
"name": "func",
"signature": "def func(self, fcn, fmt)"
},
{
"docstring": "Format an argument with the speci... | 3 | stack_v2_sparse_classes_30k_train_000256 | Implement the Python class `CFormat` described below.
Class description:
Formatter for the C language
Method signatures and docstrings:
- def prop(self, obj): Return the c properties of an argument
- def func(self, fcn, fmt): Format a function with the specific format
- def arg(self, arg, fmt): Format an argument wit... | Implement the Python class `CFormat` described below.
Class description:
Formatter for the C language
Method signatures and docstrings:
- def prop(self, obj): Return the c properties of an argument
- def func(self, fcn, fmt): Format a function with the specific format
- def arg(self, arg, fmt): Format an argument wit... | d5aba8648163e492ce0ce5354b5886f994667b9a | <|skeleton|>
class CFormat:
"""Formatter for the C language"""
def prop(self, obj):
"""Return the c properties of an argument"""
<|body_0|>
def func(self, fcn, fmt):
"""Format a function with the specific format"""
<|body_1|>
def arg(self, arg, fmt):
"""Format ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CFormat:
"""Formatter for the C language"""
def prop(self, obj):
"""Return the c properties of an argument"""
if isinstance(obj, Argument):
return {'pointer': '*' * obj.is_ptr, 'name': obj.name, 'ctype': obj.ctype}
elif isinstance(obj, Function):
return {'p... | the_stack_v2_python_sparse | tools/bindgen/bindgen.py | SINTEF/dlite | train | 21 |
884007d2bb2edf7b3683053dd508f9c70ebbe306 | [
"arguments.AddBackupResourceArg(parser, 'to list backups for')\nparser.display_info.AddFormat('\\n table(\\n name.basename():sort=1:label=NAME,\\n cluster():label=CLUSTER,\\n sourceTable.basename():label=TABLE,\\n expireTime:label=EXPIRE_TIME,\\n state... | <|body_start_0|>
arguments.AddBackupResourceArg(parser, 'to list backups for')
parser.display_info.AddFormat('\n table(\n name.basename():sort=1:label=NAME,\n cluster():label=CLUSTER,\n sourceTable.basename():label=TABLE,\n expireTime:label=EXPIRE_TIM... | List existing Bigtable backups. | ListBackups | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListBackups:
"""List existing Bigtable backups."""
def Args(parser):
"""Register flags for this command."""
<|body_0|>
def Run(self, args):
"""This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were... | stack_v2_sparse_classes_75kplus_train_067899 | 3,739 | permissive | [
{
"docstring": "Register flags for this command.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstring": "This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were provided to this command invocation. Yields: Some value t... | 2 | stack_v2_sparse_classes_30k_test_001691 | Implement the Python class `ListBackups` described below.
Class description:
List existing Bigtable backups.
Method signatures and docstrings:
- def Args(parser): Register flags for this command.
- def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namespace. All th... | Implement the Python class `ListBackups` described below.
Class description:
List existing Bigtable backups.
Method signatures and docstrings:
- def Args(parser): Register flags for this command.
- def Run(self, args): This is what gets called when the user runs this command. Args: args: an argparse namespace. All th... | 85bb264e273568b5a0408f733b403c56373e2508 | <|skeleton|>
class ListBackups:
"""List existing Bigtable backups."""
def Args(parser):
"""Register flags for this command."""
<|body_0|>
def Run(self, args):
"""This is what gets called when the user runs this command. Args: args: an argparse namespace. All the arguments that were... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ListBackups:
"""List existing Bigtable backups."""
def Args(parser):
"""Register flags for this command."""
arguments.AddBackupResourceArg(parser, 'to list backups for')
parser.display_info.AddFormat('\n table(\n name.basename():sort=1:label=NAME,\n ... | the_stack_v2_python_sparse | google-cloud-sdk/lib/surface/bigtable/backups/list.py | bopopescu/socialliteapp | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.