blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
89809b9c09d352b4a8f6a26e8957bc8be3ed79bc | [
"super().__init__(cost_fpath=cost_fpath, features_fpath=features_fpath, resolution=resolution, xmission_config=xmission_config, min_line_length=min_line_length)\nself._ba = gpd.read_file(balancing_areas_fpath).to_crs(self.features.crs)\nself.allow_connections_within_states = allow_connections_within_states",
"log... | <|body_start_0|>
super().__init__(cost_fpath=cost_fpath, features_fpath=features_fpath, resolution=resolution, xmission_config=xmission_config, min_line_length=min_line_length)
self._ba = gpd.read_file(balancing_areas_fpath).to_crs(self.features.crs)
self.allow_connections_within_states = allow_... | Compute Least Cost tie-line paths and full transmission cap cost for all supply curve points to all possible connections (substations within the SC balancing area). | ReinforcedXmission | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReinforcedXmission:
"""Compute Least Cost tie-line paths and full transmission cap cost for all supply curve points to all possible connections (substations within the SC balancing area)."""
def __init__(self, cost_fpath, features_fpath, balancing_areas_fpath, resolution=128, xmission_config... | stack_v2_sparse_classes_36k_train_023300 | 44,281 | permissive | [
{
"docstring": "Parameters ---------- cost_fpath : str Path to h5 file with cost rasters and other required layers. features_fpath : str Path to GeoPackage with transmission features. All features except substations will be dropped. This table must have a \"ba_str\" column which matches one of the \"ba_str\" ID... | 4 | stack_v2_sparse_classes_30k_train_018875 | Implement the Python class `ReinforcedXmission` described below.
Class description:
Compute Least Cost tie-line paths and full transmission cap cost for all supply curve points to all possible connections (substations within the SC balancing area).
Method signatures and docstrings:
- def __init__(self, cost_fpath, fe... | Implement the Python class `ReinforcedXmission` described below.
Class description:
Compute Least Cost tie-line paths and full transmission cap cost for all supply curve points to all possible connections (substations within the SC balancing area).
Method signatures and docstrings:
- def __init__(self, cost_fpath, fe... | 2dd05402c9c05ca0bf7f0e5bc2849ede0d0bc3cb | <|skeleton|>
class ReinforcedXmission:
"""Compute Least Cost tie-line paths and full transmission cap cost for all supply curve points to all possible connections (substations within the SC balancing area)."""
def __init__(self, cost_fpath, features_fpath, balancing_areas_fpath, resolution=128, xmission_config... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReinforcedXmission:
"""Compute Least Cost tie-line paths and full transmission cap cost for all supply curve points to all possible connections (substations within the SC balancing area)."""
def __init__(self, cost_fpath, features_fpath, balancing_areas_fpath, resolution=128, xmission_config=None, min_li... | the_stack_v2_python_sparse | reVX/least_cost_xmission/least_cost_xmission.py | NREL/reVX | train | 10 |
77c6bde752fcf4a823aad3f239d7145a0ae5cd33 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ConditionalAccessPolicy()",
"from .conditional_access_condition_set import ConditionalAccessConditionSet\nfrom .conditional_access_grant_controls import ConditionalAccessGrantControls\nfrom .conditional_access_policy_state import Condi... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ConditionalAccessPolicy()
<|end_body_0|>
<|body_start_1|>
from .conditional_access_condition_set import ConditionalAccessConditionSet
from .conditional_access_grant_controls import Condi... | ConditionalAccessPolicy | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConditionalAccessPolicy:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessPolicy:
"""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 creat... | stack_v2_sparse_classes_36k_train_023301 | 5,349 | 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: ConditionalAccessPolicy",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrimin... | 3 | null | Implement the Python class `ConditionalAccessPolicy` described below.
Class description:
Implement the ConditionalAccessPolicy class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessPolicy: Creates a new instance of the appropriate clas... | Implement the Python class `ConditionalAccessPolicy` described below.
Class description:
Implement the ConditionalAccessPolicy class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessPolicy: Creates a new instance of the appropriate clas... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ConditionalAccessPolicy:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessPolicy:
"""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 creat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConditionalAccessPolicy:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConditionalAccessPolicy:
"""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 R... | the_stack_v2_python_sparse | msgraph/generated/models/conditional_access_policy.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
c607a0e32bbb36b144c8bccaad43e404a000c16e | [
"visited = [0 for i in xrange(len(M))]\ncount = 0\nfor i in xrange(len(M)):\n if not visited[i]:\n visited[i] = 1\n self.dfs(M, i, visited)\n count += 1\nreturn count",
"for j in xrange(len(M)):\n if M[i][j] == 1:\n if not visited[j]:\n visited[j] = 1\n self... | <|body_start_0|>
visited = [0 for i in xrange(len(M))]
count = 0
for i in xrange(len(M)):
if not visited[i]:
visited[i] = 1
self.dfs(M, i, visited)
count += 1
return count
<|end_body_0|>
<|body_start_1|>
for j in xrange... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findCircleNum(self, M):
""":type M: List[List[int]] :rtype: int"""
<|body_0|>
def dfs(self, M, i, visited):
"""check each node j in M for i"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
visited = [0 for i in xrange(len(M))]
c... | stack_v2_sparse_classes_36k_train_023302 | 730 | no_license | [
{
"docstring": ":type M: List[List[int]] :rtype: int",
"name": "findCircleNum",
"signature": "def findCircleNum(self, M)"
},
{
"docstring": "check each node j in M for i",
"name": "dfs",
"signature": "def dfs(self, M, i, visited)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findCircleNum(self, M): :type M: List[List[int]] :rtype: int
- def dfs(self, M, i, visited): check each node j in M for i | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findCircleNum(self, M): :type M: List[List[int]] :rtype: int
- def dfs(self, M, i, visited): check each node j in M for i
<|skeleton|>
class Solution:
def findCircleNum... | 6582b0f138a19f9d4a005eda298ecb1488eb0d2e | <|skeleton|>
class Solution:
def findCircleNum(self, M):
""":type M: List[List[int]] :rtype: int"""
<|body_0|>
def dfs(self, M, i, visited):
"""check each node j in M for i"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findCircleNum(self, M):
""":type M: List[List[int]] :rtype: int"""
visited = [0 for i in xrange(len(M))]
count = 0
for i in xrange(len(M)):
if not visited[i]:
visited[i] = 1
self.dfs(M, i, visited)
count ... | the_stack_v2_python_sparse | Backtracking/547.py | ShangruZhong/leetcode | train | 0 | |
a298cdaffedef5e2fa576ec5fda2d03d7d517cf5 | [
"self.args = args\nself.logger = getlogger(__name__, args.log_level)\nif args.delete_existing_checkpoints and os.path.exists(args.save_dir):\n self.logger.warning('Deleting checkpoints under %s with %s extension.', args.save_dir, args.file_ext)\n for f in os.listdir(args.save_dir):\n if f.endswith(args... | <|body_start_0|>
self.args = args
self.logger = getlogger(__name__, args.log_level)
if args.delete_existing_checkpoints and os.path.exists(args.save_dir):
self.logger.warning('Deleting checkpoints under %s with %s extension.', args.save_dir, args.file_ext)
for f in os.lis... | Default checkpointer implementation, implements AbstractCheckpointer and contains a few helper functions for managing checkpointed files. Must be initialized with DefaultCheckpointerArguments. | DefaultCheckpointer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefaultCheckpointer:
"""Default checkpointer implementation, implements AbstractCheckpointer and contains a few helper functions for managing checkpointed files. Must be initialized with DefaultCheckpointerArguments."""
def __init__(self, args: DefaultCheckpointerArguments):
"""Initi... | stack_v2_sparse_classes_36k_train_023303 | 12,528 | permissive | [
{
"docstring": "Initialize checkpointer and delete existing checkpointed files under save_dir if delete_existing_checkpoints is set to True.",
"name": "__init__",
"signature": "def __init__(self, args: DefaultCheckpointerArguments)"
},
{
"docstring": "Creates a checkpoint by saving a Checkpoint ... | 6 | null | Implement the Python class `DefaultCheckpointer` described below.
Class description:
Default checkpointer implementation, implements AbstractCheckpointer and contains a few helper functions for managing checkpointed files. Must be initialized with DefaultCheckpointerArguments.
Method signatures and docstrings:
- def ... | Implement the Python class `DefaultCheckpointer` described below.
Class description:
Default checkpointer implementation, implements AbstractCheckpointer and contains a few helper functions for managing checkpointed files. Must be initialized with DefaultCheckpointerArguments.
Method signatures and docstrings:
- def ... | bb8a58804ef957ff4f142812d78bda806d1e299c | <|skeleton|>
class DefaultCheckpointer:
"""Default checkpointer implementation, implements AbstractCheckpointer and contains a few helper functions for managing checkpointed files. Must be initialized with DefaultCheckpointerArguments."""
def __init__(self, args: DefaultCheckpointerArguments):
"""Initi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DefaultCheckpointer:
"""Default checkpointer implementation, implements AbstractCheckpointer and contains a few helper functions for managing checkpointed files. Must be initialized with DefaultCheckpointerArguments."""
def __init__(self, args: DefaultCheckpointerArguments):
"""Initialize checkpo... | the_stack_v2_python_sparse | pymarlin/utils/checkpointer/checkpoint_utils.py | DankGroundhog/PyMarlin | train | 0 |
5cc5eac319f75440514be1f352dcc2ca7af962de | [
"if self.staging_tests:\n test_email = 'superlists_tests@163.com'\nelse:\n test_email = 'abc@163.com'\nself.browser.get(self.live_server_url)\ninput_email = self.browser.find_element_by_name('email')\ninput_email.send_keys(test_email)\ninput_email.send_keys(Keys.ENTER)\nself.wait_for(lambda: self.assertIn('邮件... | <|body_start_0|>
if self.staging_tests:
test_email = 'superlists_tests@163.com'
else:
test_email = 'abc@163.com'
self.browser.get(self.live_server_url)
input_email = self.browser.find_element_by_name('email')
input_email.send_keys(test_email)
input... | 登录测试 | LoginTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoginTest:
"""登录测试"""
def test_001(self):
"""输入邮箱地址发送邮件,然后取得登录验证的链接并成功登录"""
<|body_0|>
def test_002(self):
"""使用错误的链接无法完成登录,并得到登录失败的提示"""
<|body_1|>
def test_003(self):
"""对同一邮箱地址发送了两次登录验证的邮件 那么,第一次得到的登录验证邮件中的链接无法完成登录 第二次得到的则可以"""
<|b... | stack_v2_sparse_classes_36k_train_023304 | 4,463 | no_license | [
{
"docstring": "输入邮箱地址发送邮件,然后取得登录验证的链接并成功登录",
"name": "test_001",
"signature": "def test_001(self)"
},
{
"docstring": "使用错误的链接无法完成登录,并得到登录失败的提示",
"name": "test_002",
"signature": "def test_002(self)"
},
{
"docstring": "对同一邮箱地址发送了两次登录验证的邮件 那么,第一次得到的登录验证邮件中的链接无法完成登录 第二次得到的则可以",
... | 3 | stack_v2_sparse_classes_30k_train_015458 | Implement the Python class `LoginTest` described below.
Class description:
登录测试
Method signatures and docstrings:
- def test_001(self): 输入邮箱地址发送邮件,然后取得登录验证的链接并成功登录
- def test_002(self): 使用错误的链接无法完成登录,并得到登录失败的提示
- def test_003(self): 对同一邮箱地址发送了两次登录验证的邮件 那么,第一次得到的登录验证邮件中的链接无法完成登录 第二次得到的则可以 | Implement the Python class `LoginTest` described below.
Class description:
登录测试
Method signatures and docstrings:
- def test_001(self): 输入邮箱地址发送邮件,然后取得登录验证的链接并成功登录
- def test_002(self): 使用错误的链接无法完成登录,并得到登录失败的提示
- def test_003(self): 对同一邮箱地址发送了两次登录验证的邮件 那么,第一次得到的登录验证邮件中的链接无法完成登录 第二次得到的则可以
<|skeleton|>
class LoginTest... | 973b3afb239db5f55cb52897e7a8a241a459349f | <|skeleton|>
class LoginTest:
"""登录测试"""
def test_001(self):
"""输入邮箱地址发送邮件,然后取得登录验证的链接并成功登录"""
<|body_0|>
def test_002(self):
"""使用错误的链接无法完成登录,并得到登录失败的提示"""
<|body_1|>
def test_003(self):
"""对同一邮箱地址发送了两次登录验证的邮件 那么,第一次得到的登录验证邮件中的链接无法完成登录 第二次得到的则可以"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoginTest:
"""登录测试"""
def test_001(self):
"""输入邮箱地址发送邮件,然后取得登录验证的链接并成功登录"""
if self.staging_tests:
test_email = 'superlists_tests@163.com'
else:
test_email = 'abc@163.com'
self.browser.get(self.live_server_url)
input_email = self.browser.fin... | the_stack_v2_python_sparse | functional_tests/test_accounts/test_login.py | aaluo001/superlists | train | 0 |
73d689da53e3f97dc537cce3b6cc4366cafa6eab | [
"self.map = hpmap\nmv = self.map.map[:]\nself.map.redistribute('freq')\nself.log.info('Smoothing input Healpix map.')\nfor lfi, _ in mv.enumerate(axis=0):\n for pi in range(mv.shape[1]):\n mv[lfi, pi] = healpy.smoothing(mv[lfi, pi], fwhm=np.radians(self.fwhm), verbose=False)",
"if 'position' not in cata... | <|body_start_0|>
self.map = hpmap
mv = self.map.map[:]
self.map.redistribute('freq')
self.log.info('Smoothing input Healpix map.')
for lfi, _ in mv.enumerate(axis=0):
for pi in range(mv.shape[1]):
mv[lfi, pi] = healpy.smoothing(mv[lfi, pi], fwhm=np.rad... | Beamform by extracting the pixel containing each source form a Healpix map. Unless it has an explicit `epoch` attribute, the Healpix map is assumed to be in the same coordinate epoch as the catalog. If it does, the input catalog is assumed to be in ICRS and then is precessed to the CIRS coordinates in the epoch of the ... | HealpixBeamForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HealpixBeamForm:
"""Beamform by extracting the pixel containing each source form a Healpix map. Unless it has an explicit `epoch` attribute, the Healpix map is assumed to be in the same coordinate epoch as the catalog. If it does, the input catalog is assumed to be in ICRS and then is precessed t... | stack_v2_sparse_classes_36k_train_023305 | 49,733 | permissive | [
{
"docstring": "Set the map to extract beams from at each catalog location. Parameters ---------- hpmap The Healpix map to extract the sources from.",
"name": "setup",
"signature": "def setup(self, hpmap: containers.Map)"
},
{
"docstring": "Extract sources from a ringmap. Parameters ---------- c... | 2 | stack_v2_sparse_classes_30k_train_012337 | Implement the Python class `HealpixBeamForm` described below.
Class description:
Beamform by extracting the pixel containing each source form a Healpix map. Unless it has an explicit `epoch` attribute, the Healpix map is assumed to be in the same coordinate epoch as the catalog. If it does, the input catalog is assume... | Implement the Python class `HealpixBeamForm` described below.
Class description:
Beamform by extracting the pixel containing each source form a Healpix map. Unless it has an explicit `epoch` attribute, the Healpix map is assumed to be in the same coordinate epoch as the catalog. If it does, the input catalog is assume... | 544e485c03c125d260eb22ef467ae4d2e4dfed09 | <|skeleton|>
class HealpixBeamForm:
"""Beamform by extracting the pixel containing each source form a Healpix map. Unless it has an explicit `epoch` attribute, the Healpix map is assumed to be in the same coordinate epoch as the catalog. If it does, the input catalog is assumed to be in ICRS and then is precessed t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HealpixBeamForm:
"""Beamform by extracting the pixel containing each source form a Healpix map. Unless it has an explicit `epoch` attribute, the Healpix map is assumed to be in the same coordinate epoch as the catalog. If it does, the input catalog is assumed to be in ICRS and then is precessed to the CIRS co... | the_stack_v2_python_sparse | draco/analysis/beamform.py | radiocosmology/draco | train | 8 |
beaa94511a3bb5f771290e123bde892849d49983 | [
"super().__init__(publishers, dev_cfg)\nself.devices = get_dict_of_sequential_param__output(dev_cfg, 'Address', 'Destination')\nverify_connections_layout(self.comm, self.log, self.name, list(self.devices.values()))\nself.states = dict.fromkeys(list(self.devices.keys()), None)\nself.log.info('Configuring BTLE sensor... | <|body_start_0|>
super().__init__(publishers, dev_cfg)
self.devices = get_dict_of_sequential_param__output(dev_cfg, 'Address', 'Destination')
verify_connections_layout(self.comm, self.log, self.name, list(self.devices.values()))
self.states = dict.fromkeys(list(self.devices.keys()), None... | Uses BluePy to scan for BTLE braodcasts from a device with a given MAC address and publishes whehter or not it is present. | BtleSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BtleSensor:
"""Uses BluePy to scan for BTLE braodcasts from a device with a given MAC address and publishes whehter or not it is present."""
def __init__(self, publishers, dev_cfg):
"""Initializes the BTLE scanner. dev_cfg: - Poll: must be > 0 and > Timeout - AddressX: sequential lis... | stack_v2_sparse_classes_36k_train_023306 | 5,150 | permissive | [
{
"docstring": "Initializes the BTLE scanner. dev_cfg: - Poll: must be > 0 and > Timeout - AddressX: sequential list of MAC addresses to look for - Timeout: Maximum amount of time to wait for BTLE packets - Values: optional, if present should have two values separated by a comma, the first value being the prese... | 3 | stack_v2_sparse_classes_30k_train_015851 | Implement the Python class `BtleSensor` described below.
Class description:
Uses BluePy to scan for BTLE braodcasts from a device with a given MAC address and publishes whehter or not it is present.
Method signatures and docstrings:
- def __init__(self, publishers, dev_cfg): Initializes the BTLE scanner. dev_cfg: - P... | Implement the Python class `BtleSensor` described below.
Class description:
Uses BluePy to scan for BTLE braodcasts from a device with a given MAC address and publishes whehter or not it is present.
Method signatures and docstrings:
- def __init__(self, publishers, dev_cfg): Initializes the BTLE scanner. dev_cfg: - P... | 6f8888ddef413fb8d58ef0ebc8fe89144c914a22 | <|skeleton|>
class BtleSensor:
"""Uses BluePy to scan for BTLE braodcasts from a device with a given MAC address and publishes whehter or not it is present."""
def __init__(self, publishers, dev_cfg):
"""Initializes the BTLE scanner. dev_cfg: - Poll: must be > 0 and > Timeout - AddressX: sequential lis... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BtleSensor:
"""Uses BluePy to scan for BTLE braodcasts from a device with a given MAC address and publishes whehter or not it is present."""
def __init__(self, publishers, dev_cfg):
"""Initializes the BTLE scanner. dev_cfg: - Poll: must be > 0 and > Timeout - AddressX: sequential list of MAC addr... | the_stack_v2_python_sparse | bt/btle_sensor.py | rkoshak/sensorReporter | train | 104 |
98a6bef69d12c641aaf8d6b1a0a37a0219ed3044 | [
"if not root:\n return 'null'\noutput = []\nmy_queue = []\nmy_queue.append(root)\nwhile my_queue:\n l = len(my_queue)\n all_none = True\n for i in range(l):\n curr_node = my_queue.pop(0)\n if not curr_node:\n output.append(None)\n my_queue.append(None)\n my... | <|body_start_0|>
if not root:
return 'null'
output = []
my_queue = []
my_queue.append(root)
while my_queue:
l = len(my_queue)
all_none = True
for i in range(l):
curr_node = my_queue.pop(0)
if not curr... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_023307 | 2,333 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 3f5ad6164c147e7b51b7850dcd279150fa8a7600 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return 'null'
output = []
my_queue = []
my_queue.append(root)
while my_queue:
l = len(my_queue)
all_none ... | the_stack_v2_python_sparse | Round_1/297. Serialize and Deserialize Binary Tree/solution_1.py | buptwxd2/leetcode | train | 0 | |
00c92b367105d84e1ac7d15f6596637488fbc603 | [
"super().__init__(**kwargs)\nself.predict_fn = predict_fn\nself.num_samples = num_samples\nself.false_acceptance_rate = false_acceptance_rate\nself.entropy_threshold: Optional[float] = None\nself.validation_data: Optional[np.ndarray] = None",
"raw_predictions = self.predict_fn(x)\nif self.entropy_threshold is Non... | <|body_start_0|>
super().__init__(**kwargs)
self.predict_fn = predict_fn
self.num_samples = num_samples
self.false_acceptance_rate = false_acceptance_rate
self.entropy_threshold: Optional[float] = None
self.validation_data: Optional[np.ndarray] = None
<|end_body_0|>
<|bo... | Implementation of STRIP: A Defence Against Trojan Attacks on Deep Neural Networks (Gao et. al. 2020) | Paper link: https://arxiv.org/abs/1902.06531 | STRIPMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class STRIPMixin:
"""Implementation of STRIP: A Defence Against Trojan Attacks on Deep Neural Networks (Gao et. al. 2020) | Paper link: https://arxiv.org/abs/1902.06531"""
def __init__(self, predict_fn: Callable[[np.ndarray], np.ndarray], num_samples: int=20, false_acceptance_rate: float=0.01, **k... | stack_v2_sparse_classes_36k_train_023308 | 5,592 | permissive | [
{
"docstring": "Create a STRIP defense :param predict_fn: The predict function of the original classifier :param num_samples: The number of samples to use to test entropy at inference time :param false_acceptance_rate: The percentage of acceptable false acceptance",
"name": "__init__",
"signature": "def... | 3 | null | Implement the Python class `STRIPMixin` described below.
Class description:
Implementation of STRIP: A Defence Against Trojan Attacks on Deep Neural Networks (Gao et. al. 2020) | Paper link: https://arxiv.org/abs/1902.06531
Method signatures and docstrings:
- def __init__(self, predict_fn: Callable[[np.ndarray], np.n... | Implement the Python class `STRIPMixin` described below.
Class description:
Implementation of STRIP: A Defence Against Trojan Attacks on Deep Neural Networks (Gao et. al. 2020) | Paper link: https://arxiv.org/abs/1902.06531
Method signatures and docstrings:
- def __init__(self, predict_fn: Callable[[np.ndarray], np.n... | 4b9383d2e383ae49a0cd6c94e3c9cf7c3a584581 | <|skeleton|>
class STRIPMixin:
"""Implementation of STRIP: A Defence Against Trojan Attacks on Deep Neural Networks (Gao et. al. 2020) | Paper link: https://arxiv.org/abs/1902.06531"""
def __init__(self, predict_fn: Callable[[np.ndarray], np.ndarray], num_samples: int=20, false_acceptance_rate: float=0.01, **k... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class STRIPMixin:
"""Implementation of STRIP: A Defence Against Trojan Attacks on Deep Neural Networks (Gao et. al. 2020) | Paper link: https://arxiv.org/abs/1902.06531"""
def __init__(self, predict_fn: Callable[[np.ndarray], np.ndarray], num_samples: int=20, false_acceptance_rate: float=0.01, **kwargs) -> Non... | the_stack_v2_python_sparse | art/estimators/poison_mitigation/strip/strip.py | william881218/adversarial-robustness-toolbox | train | 1 |
2ccc503f8a9efd4aa08f95ef77e3b4988adb1420 | [
"comments = CommentsNews.query.order_by(asc(CommentsNews.NewsID), asc(CommentsNews.Created)).all()\ncontents = jsonify({'comments': [{'commentID': comment.CommentID, 'newsID': comment.NewsID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comment, 'createdAt': get_iso_format(comm... | <|body_start_0|>
comments = CommentsNews.query.order_by(asc(CommentsNews.NewsID), asc(CommentsNews.Created)).all()
contents = jsonify({'comments': [{'commentID': comment.CommentID, 'newsID': comment.NewsID, 'userID': comment.UserID, 'name': get_username(comment.UserID), 'comment': comment.Comment, 'crea... | NewsCommentsView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewsCommentsView:
def index(self):
"""Return all comments for all news."""
<|body_0|>
def get(self, news_id):
"""Return the comments for a specific news."""
<|body_1|>
def post(self):
"""Add a comment to a news specified in the payload."""
... | stack_v2_sparse_classes_36k_train_023309 | 26,847 | permissive | [
{
"docstring": "Return all comments for all news.",
"name": "index",
"signature": "def index(self)"
},
{
"docstring": "Return the comments for a specific news.",
"name": "get",
"signature": "def get(self, news_id)"
},
{
"docstring": "Add a comment to a news specified in the paylo... | 5 | stack_v2_sparse_classes_30k_train_012908 | Implement the Python class `NewsCommentsView` described below.
Class description:
Implement the NewsCommentsView class.
Method signatures and docstrings:
- def index(self): Return all comments for all news.
- def get(self, news_id): Return the comments for a specific news.
- def post(self): Add a comment to a news sp... | Implement the Python class `NewsCommentsView` described below.
Class description:
Implement the NewsCommentsView class.
Method signatures and docstrings:
- def index(self): Return all comments for all news.
- def get(self, news_id): Return the comments for a specific news.
- def post(self): Add a comment to a news sp... | 62f8e8e904e379541193f0cbb91a8434b47f538f | <|skeleton|>
class NewsCommentsView:
def index(self):
"""Return all comments for all news."""
<|body_0|>
def get(self, news_id):
"""Return the comments for a specific news."""
<|body_1|>
def post(self):
"""Add a comment to a news specified in the payload."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NewsCommentsView:
def index(self):
"""Return all comments for all news."""
comments = CommentsNews.query.order_by(asc(CommentsNews.NewsID), asc(CommentsNews.Created)).all()
contents = jsonify({'comments': [{'commentID': comment.CommentID, 'newsID': comment.NewsID, 'userID': comment.Use... | the_stack_v2_python_sparse | apps/comments/views.py | Torniojaws/vortech-backend | train | 0 | |
e97c0985eff40aed56aa6282e14e6a8888be9ff7 | [
"connection = None\ntry:\n data = request.json\n if 'first_name' not in data:\n raise ApiException(400, INVALID_INPUT_FIRST_NAME)\n if 'last_name' not in data:\n raise ApiException(400, INVALID_INPUT_LAST_NAME)\n if 'password' not in data:\n raise ApiException(400, INVALID_INPUT_PAS... | <|body_start_0|>
connection = None
try:
data = request.json
if 'first_name' not in data:
raise ApiException(400, INVALID_INPUT_FIRST_NAME)
if 'last_name' not in data:
raise ApiException(400, INVALID_INPUT_LAST_NAME)
if 'pass... | UserView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserView:
def sign_up_user():
"""User view Author: Binho Song Returns: result: {"message": "USER_CREATED"}"""
<|body_0|>
def login_user():
"""User login view Author: Binho Song Returns: result: user_login"""
<|body_1|>
def user_mypage_view(mypage_status)... | stack_v2_sparse_classes_36k_train_023310 | 3,789 | no_license | [
{
"docstring": "User view Author: Binho Song Returns: result: {\"message\": \"USER_CREATED\"}",
"name": "sign_up_user",
"signature": "def sign_up_user()"
},
{
"docstring": "User login view Author: Binho Song Returns: result: user_login",
"name": "login_user",
"signature": "def login_user... | 3 | stack_v2_sparse_classes_30k_train_009926 | Implement the Python class `UserView` described below.
Class description:
Implement the UserView class.
Method signatures and docstrings:
- def sign_up_user(): User view Author: Binho Song Returns: result: {"message": "USER_CREATED"}
- def login_user(): User login view Author: Binho Song Returns: result: user_login
-... | Implement the Python class `UserView` described below.
Class description:
Implement the UserView class.
Method signatures and docstrings:
- def sign_up_user(): User view Author: Binho Song Returns: result: {"message": "USER_CREATED"}
- def login_user(): User login view Author: Binho Song Returns: result: user_login
-... | 6b86672796974d187dca19c555f4848d21e3a9be | <|skeleton|>
class UserView:
def sign_up_user():
"""User view Author: Binho Song Returns: result: {"message": "USER_CREATED"}"""
<|body_0|>
def login_user():
"""User login view Author: Binho Song Returns: result: user_login"""
<|body_1|>
def user_mypage_view(mypage_status)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserView:
def sign_up_user():
"""User view Author: Binho Song Returns: result: {"message": "USER_CREATED"}"""
connection = None
try:
data = request.json
if 'first_name' not in data:
raise ApiException(400, INVALID_INPUT_FIRST_NAME)
if... | the_stack_v2_python_sparse | view/user_view.py | binogood/webnb | train | 0 | |
ceace6b7eefb5c13951a05d8b49a5731e61add3d | [
"if any((item is not None for item in (account_id, offset, min_id, max_id))):\n if not self.verify_minimum_version('2.8.0', cached=True):\n raise MastodonVersionError('Advanced search parameters require Mastodon 2.8.0+')",
"if self.verify_minimum_version('2.4.1', cached=True):\n return self.search_v2... | <|body_start_0|>
if any((item is not None for item in (account_id, offset, min_id, max_id))):
if not self.verify_minimum_version('2.8.0', cached=True):
raise MastodonVersionError('Advanced search parameters require Mastodon 2.8.0+')
<|end_body_0|>
<|body_start_1|>
if self.ve... | Mastodon | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mastodon:
def __ensure_search_params_acceptable(self, account_id, offset, min_id, max_id):
"""Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search that are available only starting with 2.8.0 are specified."""
<|body_0|>
def search(sel... | stack_v2_sparse_classes_36k_train_023311 | 4,774 | permissive | [
{
"docstring": "Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search that are available only starting with 2.8.0 are specified.",
"name": "__ensure_search_params_acceptable",
"signature": "def __ensure_search_params_acceptable(self, account_id, offset, min_id, ma... | 4 | stack_v2_sparse_classes_30k_train_021575 | Implement the Python class `Mastodon` described below.
Class description:
Implement the Mastodon class.
Method signatures and docstrings:
- def __ensure_search_params_acceptable(self, account_id, offset, min_id, max_id): Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search tha... | Implement the Python class `Mastodon` described below.
Class description:
Implement the Mastodon class.
Method signatures and docstrings:
- def __ensure_search_params_acceptable(self, account_id, offset, min_id, max_id): Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search tha... | cd86887d88bbc07de462d1e00a8fbc3d956c0151 | <|skeleton|>
class Mastodon:
def __ensure_search_params_acceptable(self, account_id, offset, min_id, max_id):
"""Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search that are available only starting with 2.8.0 are specified."""
<|body_0|>
def search(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mastodon:
def __ensure_search_params_acceptable(self, account_id, offset, min_id, max_id):
"""Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters for search that are available only starting with 2.8.0 are specified."""
if any((item is not None for item in (accoun... | the_stack_v2_python_sparse | mastodon/search.py | halcy/Mastodon.py | train | 880 | |
d1892a9c3e34c6e1557fb2d8e310262b03e3468b | [
"super(MainWindow, self).__init__()\nself.w = 0\nself.h = 0\nself.init_ui(name, title)",
"self.w = 140\nself.h = 100\nself.setObjectName(name)\nself.setWindowTitle(title)\nself.resize(self.w, self.h)\nself.custom_edit = CustomEdit(self, size=(10, 10, 120, 24), name='custom_edit', search=False)\nself.custom_edit.s... | <|body_start_0|>
super(MainWindow, self).__init__()
self.w = 0
self.h = 0
self.init_ui(name, title)
<|end_body_0|>
<|body_start_1|>
self.w = 140
self.h = 100
self.setObjectName(name)
self.setWindowTitle(title)
self.resize(self.w, self.h)
s... | 主窗口,继承了QMainWindow类 | MainWindow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MainWindow:
"""主窗口,继承了QMainWindow类"""
def __init__(self, name, title):
"""初始化类的成员变量"""
<|body_0|>
def init_ui(self, name, title):
"""初始化UI界面"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(MainWindow, self).__init__()
self.w = 0
... | stack_v2_sparse_classes_36k_train_023312 | 3,141 | no_license | [
{
"docstring": "初始化类的成员变量",
"name": "__init__",
"signature": "def __init__(self, name, title)"
},
{
"docstring": "初始化UI界面",
"name": "init_ui",
"signature": "def init_ui(self, name, title)"
}
] | 2 | stack_v2_sparse_classes_30k_train_009120 | Implement the Python class `MainWindow` described below.
Class description:
主窗口,继承了QMainWindow类
Method signatures and docstrings:
- def __init__(self, name, title): 初始化类的成员变量
- def init_ui(self, name, title): 初始化UI界面 | Implement the Python class `MainWindow` described below.
Class description:
主窗口,继承了QMainWindow类
Method signatures and docstrings:
- def __init__(self, name, title): 初始化类的成员变量
- def init_ui(self, name, title): 初始化UI界面
<|skeleton|>
class MainWindow:
"""主窗口,继承了QMainWindow类"""
def __init__(self, name, title):
... | b86a49e4b8c7c8c3d8546ce1b49f8f3bb6332307 | <|skeleton|>
class MainWindow:
"""主窗口,继承了QMainWindow类"""
def __init__(self, name, title):
"""初始化类的成员变量"""
<|body_0|>
def init_ui(self, name, title):
"""初始化UI界面"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MainWindow:
"""主窗口,继承了QMainWindow类"""
def __init__(self, name, title):
"""初始化类的成员变量"""
super(MainWindow, self).__init__()
self.w = 0
self.h = 0
self.init_ui(name, title)
def init_ui(self, name, title):
"""初始化UI界面"""
self.w = 140
self.h ... | the_stack_v2_python_sparse | assembly/search_completer/search_11.py | masknugget/mypyqt | train | 0 |
029e5f6f34691e3d3f7ad351588495e13dd5834c | [
"session.query(DbFunction).filter_by(kb=db_kb).delete()\nfor func in func_manager.values():\n db_func = DbFunction(kb=db_kb, addr=func.addr, blob=func.serialize())\n session.add(db_func)",
"funcs = FunctionManager(kb)\ndb_funcs = session.query(DbFunction).filter_by(kb=db_kb)\nall_func_addrs = set(map(lambda... | <|body_start_0|>
session.query(DbFunction).filter_by(kb=db_kb).delete()
for func in func_manager.values():
db_func = DbFunction(kb=db_kb, addr=func.addr, blob=func.serialize())
session.add(db_func)
<|end_body_0|>
<|body_start_1|>
funcs = FunctionManager(kb)
db_fu... | Serialize/unserialize a function manager and its functions. | FunctionManagerSerializer | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FunctionManagerSerializer:
"""Serialize/unserialize a function manager and its functions."""
def dump(session, db_kb: 'DbKnowledgeBase', func_manager: FunctionManager):
""":param session: :param DbKnowledgeBase db_kb: :param FunctionManager func_manager: :return:"""
<|body_0|... | stack_v2_sparse_classes_36k_train_023313 | 1,696 | permissive | [
{
"docstring": ":param session: :param DbKnowledgeBase db_kb: :param FunctionManager func_manager: :return:",
"name": "dump",
"signature": "def dump(session, db_kb: 'DbKnowledgeBase', func_manager: FunctionManager)"
},
{
"docstring": ":param session: :param DbKnowledgeBase db_kb: :param Knowledg... | 2 | stack_v2_sparse_classes_30k_train_004588 | Implement the Python class `FunctionManagerSerializer` described below.
Class description:
Serialize/unserialize a function manager and its functions.
Method signatures and docstrings:
- def dump(session, db_kb: 'DbKnowledgeBase', func_manager: FunctionManager): :param session: :param DbKnowledgeBase db_kb: :param Fu... | Implement the Python class `FunctionManagerSerializer` described below.
Class description:
Serialize/unserialize a function manager and its functions.
Method signatures and docstrings:
- def dump(session, db_kb: 'DbKnowledgeBase', func_manager: FunctionManager): :param session: :param DbKnowledgeBase db_kb: :param Fu... | 37e8ca1c3308ec601ad1d7c6bc8081ff38a7cffd | <|skeleton|>
class FunctionManagerSerializer:
"""Serialize/unserialize a function manager and its functions."""
def dump(session, db_kb: 'DbKnowledgeBase', func_manager: FunctionManager):
""":param session: :param DbKnowledgeBase db_kb: :param FunctionManager func_manager: :return:"""
<|body_0|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FunctionManagerSerializer:
"""Serialize/unserialize a function manager and its functions."""
def dump(session, db_kb: 'DbKnowledgeBase', func_manager: FunctionManager):
""":param session: :param DbKnowledgeBase db_kb: :param FunctionManager func_manager: :return:"""
session.query(DbFuncti... | the_stack_v2_python_sparse | angr/angrdb/serializers/funcs.py | angr/angr | train | 7,184 |
dfe5b57c1f7747701557b2fd3e3d936fbce6c806 | [
"image_filenames, image_filename_ids = self.get_image_filenames()\nself.save_field_to_hdf5(set_name=self.set_name, field='image_filenames', data=str2ascii(image_filenames), dtype=np.uint8, fillvalue=0)\nreturn image_filename_ids",
"image_filenames = []\nimage_filenames_ids = []\nimage_fnames = self.get_image_file... | <|body_start_0|>
image_filenames, image_filename_ids = self.get_image_filenames()
self.save_field_to_hdf5(set_name=self.set_name, field='image_filenames', data=str2ascii(image_filenames), dtype=np.uint8, fillvalue=0)
return image_filename_ids
<|end_body_0|>
<|body_start_1|>
image_filena... | Image filenames' field metadata process/save class. | ImageFilenamesField | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageFilenamesField:
"""Image filenames' field metadata process/save class."""
def process(self):
"""Processes and saves the image filenames metadata to hdf5."""
<|body_0|>
def get_image_filenames(self):
"""Returns a list of image filenames and ids."""
<|... | stack_v2_sparse_classes_36k_train_023314 | 40,392 | permissive | [
{
"docstring": "Processes and saves the image filenames metadata to hdf5.",
"name": "process",
"signature": "def process(self)"
},
{
"docstring": "Returns a list of image filenames and ids.",
"name": "get_image_filenames",
"signature": "def get_image_filenames(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015056 | Implement the Python class `ImageFilenamesField` described below.
Class description:
Image filenames' field metadata process/save class.
Method signatures and docstrings:
- def process(self): Processes and saves the image filenames metadata to hdf5.
- def get_image_filenames(self): Returns a list of image filenames a... | Implement the Python class `ImageFilenamesField` described below.
Class description:
Image filenames' field metadata process/save class.
Method signatures and docstrings:
- def process(self): Processes and saves the image filenames metadata to hdf5.
- def get_image_filenames(self): Returns a list of image filenames a... | e0be95d941b50a5b2e27ffa1c5be20dc6aa2d6a1 | <|skeleton|>
class ImageFilenamesField:
"""Image filenames' field metadata process/save class."""
def process(self):
"""Processes and saves the image filenames metadata to hdf5."""
<|body_0|>
def get_image_filenames(self):
"""Returns a list of image filenames and ids."""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImageFilenamesField:
"""Image filenames' field metadata process/save class."""
def process(self):
"""Processes and saves the image filenames metadata to hdf5."""
image_filenames, image_filename_ids = self.get_image_filenames()
self.save_field_to_hdf5(set_name=self.set_name, field=... | the_stack_v2_python_sparse | dbcollection/datasets/mpii_pose/keypoints.py | dbcollection/dbcollection | train | 25 |
42c78aae211d122e6efaa4897def9d44b16f5d96 | [
"extra_context = cache_memoize('admin-widget-repos-data', lambda: self._get_repositories_data(request))\nextra_context['add_repo_docs_url'] = '%sadmin/configuration/repositories/' % get_manual_url()\nreturn extra_context",
"queryset = Repository.objects.accessible(request.user)\ntotal_repositories = queryset.coun... | <|body_start_0|>
extra_context = cache_memoize('admin-widget-repos-data', lambda: self._get_repositories_data(request))
extra_context['add_repo_docs_url'] = '%sadmin/configuration/repositories/' % get_manual_url()
return extra_context
<|end_body_0|>
<|body_start_1|>
queryset = Repositor... | A widget displaying the most recent repositories. This widget displays a grid of the most recent repositories and their services/types. | RepositoriesWidget | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RepositoriesWidget:
"""A widget displaying the most recent repositories. This widget displays a grid of the most recent repositories and their services/types."""
def get_extra_context(self, request):
"""Return extra context for the template. Args: request (django.http.HttpRequest): T... | stack_v2_sparse_classes_36k_train_023315 | 19,615 | permissive | [
{
"docstring": "Return extra context for the template. Args: request (django.http.HttpRequest): The HTTP request from the client. Returns: dict: Extra context to pass to the template.",
"name": "get_extra_context",
"signature": "def get_extra_context(self, request)"
},
{
"docstring": "Return dat... | 2 | null | Implement the Python class `RepositoriesWidget` described below.
Class description:
A widget displaying the most recent repositories. This widget displays a grid of the most recent repositories and their services/types.
Method signatures and docstrings:
- def get_extra_context(self, request): Return extra context for... | Implement the Python class `RepositoriesWidget` described below.
Class description:
A widget displaying the most recent repositories. This widget displays a grid of the most recent repositories and their services/types.
Method signatures and docstrings:
- def get_extra_context(self, request): Return extra context for... | c3a991f1e9d7682239a1ab0e8661cee6da01d537 | <|skeleton|>
class RepositoriesWidget:
"""A widget displaying the most recent repositories. This widget displays a grid of the most recent repositories and their services/types."""
def get_extra_context(self, request):
"""Return extra context for the template. Args: request (django.http.HttpRequest): T... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RepositoriesWidget:
"""A widget displaying the most recent repositories. This widget displays a grid of the most recent repositories and their services/types."""
def get_extra_context(self, request):
"""Return extra context for the template. Args: request (django.http.HttpRequest): The HTTP reque... | the_stack_v2_python_sparse | reviewboard/admin/widgets.py | reviewboard/reviewboard | train | 1,141 |
1e2c0ccb234740dcb6f8589a4985b7c09501374f | [
"super(GitProjectParser, self).__init__(target)\nself._ignore = ['worktree', 'path', 'clone_url', 'default_branch', 'review_url', 'qiproject_xml']\nself._required = ['src']",
"remote = qisrc.git_config.Remote()\nparser = qisrc.git_config.RemoteParser(remote)\nparser.parse(elem)\nself.target.remotes.append(remote)... | <|body_start_0|>
super(GitProjectParser, self).__init__(target)
self._ignore = ['worktree', 'path', 'clone_url', 'default_branch', 'review_url', 'qiproject_xml']
self._required = ['src']
<|end_body_0|>
<|body_start_1|>
remote = qisrc.git_config.Remote()
parser = qisrc.git_config... | GitProjectParser Class | GitProjectParser | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GitProjectParser:
"""GitProjectParser Class"""
def __init__(self, target):
"""GitProjectParser Init"""
<|body_0|>
def _parse_remote(self, elem):
"""Parse Remote"""
<|body_1|>
def _parse_branch(self, elem):
"""Parse Branch"""
<|body_2|... | stack_v2_sparse_classes_36k_train_023316 | 13,895 | permissive | [
{
"docstring": "GitProjectParser Init",
"name": "__init__",
"signature": "def __init__(self, target)"
},
{
"docstring": "Parse Remote",
"name": "_parse_remote",
"signature": "def _parse_remote(self, elem)"
},
{
"docstring": "Parse Branch",
"name": "_parse_branch",
"signat... | 5 | null | Implement the Python class `GitProjectParser` described below.
Class description:
GitProjectParser Class
Method signatures and docstrings:
- def __init__(self, target): GitProjectParser Init
- def _parse_remote(self, elem): Parse Remote
- def _parse_branch(self, elem): Parse Branch
- def _write_branches(self, elem): ... | Implement the Python class `GitProjectParser` described below.
Class description:
GitProjectParser Class
Method signatures and docstrings:
- def __init__(self, target): GitProjectParser Init
- def _parse_remote(self, elem): Parse Remote
- def _parse_branch(self, elem): Parse Branch
- def _write_branches(self, elem): ... | efea6fa3744664348717fe5e8df708a3cf392072 | <|skeleton|>
class GitProjectParser:
"""GitProjectParser Class"""
def __init__(self, target):
"""GitProjectParser Init"""
<|body_0|>
def _parse_remote(self, elem):
"""Parse Remote"""
<|body_1|>
def _parse_branch(self, elem):
"""Parse Branch"""
<|body_2|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GitProjectParser:
"""GitProjectParser Class"""
def __init__(self, target):
"""GitProjectParser Init"""
super(GitProjectParser, self).__init__(target)
self._ignore = ['worktree', 'path', 'clone_url', 'default_branch', 'review_url', 'qiproject_xml']
self._required = ['src']
... | the_stack_v2_python_sparse | python/qisrc/project.py | aldebaran/qibuild | train | 60 |
892cbc07a1524f47caaf9eddeb1e1485bb79c915 | [
"data = form.cleaned_data\nself.success_url = reverse('add_question', kwargs={'course': data['course'].id, 'total': int(data['total'])})\nreturn super().form_valid(form)",
"context = super().get_context_data(**kwargs)\ncontext['title_text'] = 'Choose Where To Add Question'\ncontext['detail_text'] = 'Please select... | <|body_start_0|>
data = form.cleaned_data
self.success_url = reverse('add_question', kwargs={'course': data['course'].id, 'total': int(data['total'])})
return super().form_valid(form)
<|end_body_0|>
<|body_start_1|>
context = super().get_context_data(**kwargs)
context['title_tex... | View for choosing which course to add questions to. | NewQuestionView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewQuestionView:
"""View for choosing which course to add questions to."""
def form_valid(self, form):
"""Compute the success URL and call super.form_valid()"""
<|body_0|>
def get_context_data(self, **kwargs):
"""Return the data used in the templates rendering.""... | stack_v2_sparse_classes_36k_train_023317 | 29,759 | no_license | [
{
"docstring": "Compute the success URL and call super.form_valid()",
"name": "form_valid",
"signature": "def form_valid(self, form)"
},
{
"docstring": "Return the data used in the templates rendering.",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
}
... | 2 | stack_v2_sparse_classes_30k_test_000426 | Implement the Python class `NewQuestionView` described below.
Class description:
View for choosing which course to add questions to.
Method signatures and docstrings:
- def form_valid(self, form): Compute the success URL and call super.form_valid()
- def get_context_data(self, **kwargs): Return the data used in the t... | Implement the Python class `NewQuestionView` described below.
Class description:
View for choosing which course to add questions to.
Method signatures and docstrings:
- def form_valid(self, form): Compute the success URL and call super.form_valid()
- def get_context_data(self, **kwargs): Return the data used in the t... | 06bc577d01d3dbf6c425e03dcb903977a38e377c | <|skeleton|>
class NewQuestionView:
"""View for choosing which course to add questions to."""
def form_valid(self, form):
"""Compute the success URL and call super.form_valid()"""
<|body_0|>
def get_context_data(self, **kwargs):
"""Return the data used in the templates rendering.""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NewQuestionView:
"""View for choosing which course to add questions to."""
def form_valid(self, form):
"""Compute the success URL and call super.form_valid()"""
data = form.cleaned_data
self.success_url = reverse('add_question', kwargs={'course': data['course'].id, 'total': int(da... | the_stack_v2_python_sparse | cbt/views.py | Festusali/CBTest | train | 6 |
4813cdbfac261330e4bff25a658124f1be870ff0 | [
"if sns_topic_arn is None:\n sns_topic_arn = config.etl.get('SNS_TOPIC_ARN_WARNING', None)\nif script_arguments is None:\n script_arguments = list()\nscript_arguments.append('--test_name=%s' % (pipeline_name + '.' + id))\nif sns_topic_arn:\n script_arguments.append('--sns_topic_arn=%s' % sns_topic_arn)\nsu... | <|body_start_0|>
if sns_topic_arn is None:
sns_topic_arn = config.etl.get('SNS_TOPIC_ARN_WARNING', None)
if script_arguments is None:
script_arguments = list()
script_arguments.append('--test_name=%s' % (pipeline_name + '.' + id))
if sns_topic_arn:
scr... | QATransform Step class that helps run scripts on resouces for QA checks | QATransformStep | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QATransformStep:
"""QATransform Step class that helps run scripts on resouces for QA checks"""
def __init__(self, id, pipeline_name, script_arguments=None, sns_topic_arn=None, **kwargs):
"""Constructor for the QATransformStep class Args: sns_arn(str): sns topic arn for QA steps scrip... | stack_v2_sparse_classes_36k_train_023318 | 1,780 | permissive | [
{
"docstring": "Constructor for the QATransformStep class Args: sns_arn(str): sns topic arn for QA steps script_arguments(list of str): list of arguments to the script **kwargs(optional): Keyword arguments directly passed to base class",
"name": "__init__",
"signature": "def __init__(self, id, pipeline_... | 2 | null | Implement the Python class `QATransformStep` described below.
Class description:
QATransform Step class that helps run scripts on resouces for QA checks
Method signatures and docstrings:
- def __init__(self, id, pipeline_name, script_arguments=None, sns_topic_arn=None, **kwargs): Constructor for the QATransformStep c... | Implement the Python class `QATransformStep` described below.
Class description:
QATransform Step class that helps run scripts on resouces for QA checks
Method signatures and docstrings:
- def __init__(self, id, pipeline_name, script_arguments=None, sns_topic_arn=None, **kwargs): Constructor for the QATransformStep c... | 797cb719e6c2abeda0751ada3339c72bfb19c8f2 | <|skeleton|>
class QATransformStep:
"""QATransform Step class that helps run scripts on resouces for QA checks"""
def __init__(self, id, pipeline_name, script_arguments=None, sns_topic_arn=None, **kwargs):
"""Constructor for the QATransformStep class Args: sns_arn(str): sns topic arn for QA steps scrip... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QATransformStep:
"""QATransform Step class that helps run scripts on resouces for QA checks"""
def __init__(self, id, pipeline_name, script_arguments=None, sns_topic_arn=None, **kwargs):
"""Constructor for the QATransformStep class Args: sns_arn(str): sns topic arn for QA steps script_arguments(l... | the_stack_v2_python_sparse | dataduct/steps/qa_transform.py | EverFi/dataduct | train | 3 |
7d0dfbc2159b6c3a2f577fb4f9ac147f10c05f39 | [
"self._set('cache-no-expire', no_expire, cast=bool)\nself._set('cache-report-freed-items', report_freed, cast=bool)\nself._set('cache-expire-freq', expire_scan_interval)\nreturn self._section",
"cache_name = cache_name or ''\nvalue = f'{cache_name} {key}={value}'\nself._set('add-cache-item', value.strip(), multi=... | <|body_start_0|>
self._set('cache-no-expire', no_expire, cast=bool)
self._set('cache-report-freed-items', report_freed, cast=bool)
self._set('cache-expire-freq', expire_scan_interval)
return self._section
<|end_body_0|>
<|body_start_1|>
cache_name = cache_name or ''
valu... | Caching. uWSGI includes a very fast, all-in-memory, zero-IPC, SMP-safe, constantly-optimizing, highly-tunable, key-value store simply called "the caching framework". A single uWSGI instance can create an unlimited number of "caches" each one with different setup and purpose. * http://uwsgi-docs.readthedocs.io/en/latest... | Caching | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Caching:
"""Caching. uWSGI includes a very fast, all-in-memory, zero-IPC, SMP-safe, constantly-optimizing, highly-tunable, key-value store simply called "the caching framework". A single uWSGI instance can create an unlimited number of "caches" each one with different setup and purpose. * http://... | stack_v2_sparse_classes_36k_train_023319 | 8,597 | permissive | [
{
"docstring": ":param no_expire: Disable auto sweep of expired items. Since uWSGI 1.2, cache item expiration is managed by a thread in the master process, to reduce the risk of deadlock. This thread can be disabled (making item expiry a no-op) with the this option. :param expire_scan_interval: Set the frequenc... | 4 | stack_v2_sparse_classes_30k_train_004961 | Implement the Python class `Caching` described below.
Class description:
Caching. uWSGI includes a very fast, all-in-memory, zero-IPC, SMP-safe, constantly-optimizing, highly-tunable, key-value store simply called "the caching framework". A single uWSGI instance can create an unlimited number of "caches" each one with... | Implement the Python class `Caching` described below.
Class description:
Caching. uWSGI includes a very fast, all-in-memory, zero-IPC, SMP-safe, constantly-optimizing, highly-tunable, key-value store simply called "the caching framework". A single uWSGI instance can create an unlimited number of "caches" each one with... | 1060d6c9e15695b65f1875df66128fb4ff1a5c0d | <|skeleton|>
class Caching:
"""Caching. uWSGI includes a very fast, all-in-memory, zero-IPC, SMP-safe, constantly-optimizing, highly-tunable, key-value store simply called "the caching framework". A single uWSGI instance can create an unlimited number of "caches" each one with different setup and purpose. * http://... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Caching:
"""Caching. uWSGI includes a very fast, all-in-memory, zero-IPC, SMP-safe, constantly-optimizing, highly-tunable, key-value store simply called "the caching framework". A single uWSGI instance can create an unlimited number of "caches" each one with different setup and purpose. * http://uwsgi-docs.re... | the_stack_v2_python_sparse | uwsgiconf/options/caching.py | idlesign/uwsgiconf | train | 79 |
9f617bdbb01cb79f5218632d75c858a4626b2b4a | [
"for op in self.operations:\n if op.name == op_name:\n return op\nraise KeyError('Operation with name %s was not found in dataClay class %s' % (op_name, self.name))",
"if not hasattr(self, '_implementation_id_to_operation_cache'):\n setattr(self, '_implementation_id_to_operation_cache', LRU(50))\ntry... | <|body_start_0|>
for op in self.operations:
if op.name == op_name:
return op
raise KeyError('Operation with name %s was not found in dataClay class %s' % (op_name, self.name))
<|end_body_0|>
<|body_start_1|>
if not hasattr(self, '_implementation_id_to_operation_cache... | MetaClass | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MetaClass:
def get_operation_from_name(self, op_name):
"""Return the operation from its name."""
<|body_0|>
def get_operation(self, implementation_id):
"""Return an Operation (management object) from an ImplementationID :param uuid.UUID implementation_id: The request... | stack_v2_sparse_classes_36k_train_023320 | 5,420 | permissive | [
{
"docstring": "Return the operation from its name.",
"name": "get_operation_from_name",
"signature": "def get_operation_from_name(self, op_name)"
},
{
"docstring": "Return an Operation (management object) from an ImplementationID :param uuid.UUID implementation_id: The requested ImplementationI... | 3 | null | Implement the Python class `MetaClass` described below.
Class description:
Implement the MetaClass class.
Method signatures and docstrings:
- def get_operation_from_name(self, op_name): Return the operation from its name.
- def get_operation(self, implementation_id): Return an Operation (management object) from an Im... | Implement the Python class `MetaClass` described below.
Class description:
Implement the MetaClass class.
Method signatures and docstrings:
- def get_operation_from_name(self, op_name): Return the operation from its name.
- def get_operation(self, implementation_id): Return an Operation (management object) from an Im... | 33df8fa9fff5c42bad6c2c772c8ee60a3d07dcbb | <|skeleton|>
class MetaClass:
def get_operation_from_name(self, op_name):
"""Return the operation from its name."""
<|body_0|>
def get_operation(self, implementation_id):
"""Return an Operation (management object) from an ImplementationID :param uuid.UUID implementation_id: The request... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MetaClass:
def get_operation_from_name(self, op_name):
"""Return the operation from its name."""
for op in self.operations:
if op.name == op_name:
return op
raise KeyError('Operation with name %s was not found in dataClay class %s' % (op_name, self.name))
... | the_stack_v2_python_sparse | src/dataclay/util/management/classmgr/MetaClass.py | bsc-dom/pyclay | train | 3 | |
7267b27743d110c38e8357011a8955919bf4eb38 | [
"if context['section']:\n data = page_data.get(context['section'])\nelse:\n data = page_data.get(context['page'])\nif data is None:\n return context\ndocuments = data.get('documents')\ncollections = data.get('collections')\nif documents:\n for item in documents:\n context[item['name']] = get_docu... | <|body_start_0|>
if context['section']:
data = page_data.get(context['section'])
else:
data = page_data.get(context['page'])
if data is None:
return context
documents = data.get('documents')
collections = data.get('collections')
if docu... | Generic view for most pages. | GeneralView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneralView:
"""Generic view for most pages."""
def get_data(self, context):
"""Get all data for a page from Firestore."""
<|body_0|>
def get_docs(self, context):
"""Get the text documents for a given page."""
<|body_1|>
def get_context_data(self, **... | stack_v2_sparse_classes_36k_train_023321 | 4,592 | permissive | [
{
"docstring": "Get all data for a page from Firestore.",
"name": "get_data",
"signature": "def get_data(self, context)"
},
{
"docstring": "Get the text documents for a given page.",
"name": "get_docs",
"signature": "def get_docs(self, context)"
},
{
"docstring": "Get the context... | 3 | stack_v2_sparse_classes_30k_train_005717 | Implement the Python class `GeneralView` described below.
Class description:
Generic view for most pages.
Method signatures and docstrings:
- def get_data(self, context): Get all data for a page from Firestore.
- def get_docs(self, context): Get the text documents for a given page.
- def get_context_data(self, **kwar... | Implement the Python class `GeneralView` described below.
Class description:
Generic view for most pages.
Method signatures and docstrings:
- def get_data(self, context): Get all data for a page from Firestore.
- def get_docs(self, context): Get the text documents for a given page.
- def get_context_data(self, **kwar... | d84d069d074db3d6c89d0ec87df934316b5d5f83 | <|skeleton|>
class GeneralView:
"""Generic view for most pages."""
def get_data(self, context):
"""Get all data for a page from Firestore."""
<|body_0|>
def get_docs(self, context):
"""Get the text documents for a given page."""
<|body_1|>
def get_context_data(self, **... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GeneralView:
"""Generic view for most pages."""
def get_data(self, context):
"""Get all data for a page from Firestore."""
if context['section']:
data = page_data.get(context['section'])
else:
data = page_data.get(context['page'])
if data is None:
... | the_stack_v2_python_sparse | website/views.py | keeganskeate/cannlytics | train | 2 |
d2abf2917cd8a309a4efa97f6ad5f567c85647cb | [
"self.fqdn = fqdn\nself.guid = guid\nself.id = id\nself.name = name\nself.owner_id = owner_id\nself.status = status\nself.total_size_bytes = total_size_bytes",
"if dictionary is None:\n return None\nfqdn = dictionary.get('fqdn')\nguid = dictionary.get('guid')\nid = dictionary.get('id')\nname = dictionary.get('... | <|body_start_0|>
self.fqdn = fqdn
self.guid = guid
self.id = id
self.name = name
self.owner_id = owner_id
self.status = status
self.total_size_bytes = total_size_bytes
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
... | Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain name of the Exchange Server. guid (string): Specifies the Guid of the Exchange Application S... | DagApplicationServerInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DagApplicationServerInfo:
"""Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain name of the Exchange Server. guid (strin... | stack_v2_sparse_classes_36k_train_023322 | 3,773 | permissive | [
{
"docstring": "Constructor for the DagApplicationServerInfo class",
"name": "__init__",
"signature": "def __init__(self, fqdn=None, guid=None, id=None, name=None, owner_id=None, status=None, total_size_bytes=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dic... | 2 | stack_v2_sparse_classes_30k_train_002056 | Implement the Python class `DagApplicationServerInfo` described below.
Class description:
Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain n... | Implement the Python class `DagApplicationServerInfo` described below.
Class description:
Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain n... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class DagApplicationServerInfo:
"""Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain name of the Exchange Server. guid (strin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DagApplicationServerInfo:
"""Implementation of the 'DagApplicationServerInfo' model. Specifies the information about the status of the Exchange Application Server which is a member of the DAG. Attributes: fqdn (string): Specifies the fully qualified domain name of the Exchange Server. guid (string): Specifies... | the_stack_v2_python_sparse | cohesity_management_sdk/models/dag_application_server_info.py | cohesity/management-sdk-python | train | 24 |
93cc5b0bea185453dfe6b0eb4d22455884e07111 | [
"my_employee = Employee('justin', 'williams', 80000)\nmy_employee.format_name_salary()\nself.assertEqual(my_employee.format_name_salary(), 'Justin Williams 80000')",
"my_employee = Employee('justin', 'williams', 80000)\nmy_employee.give_raise()\nself.assertEqual(my_employee.salary, 85000)",
"my_employee = Emplo... | <|body_start_0|>
my_employee = Employee('justin', 'williams', 80000)
my_employee.format_name_salary()
self.assertEqual(my_employee.format_name_salary(), 'Justin Williams 80000')
<|end_body_0|>
<|body_start_1|>
my_employee = Employee('justin', 'williams', 80000)
my_employee.give_... | Tests for the class Employee | TestEmployee | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestEmployee:
"""Tests for the class Employee"""
def test_format_name_salary(self):
"""Tests if name and salary are formatted corrctly"""
<|body_0|>
def test_give_default_raise(self):
"""Tests if default raise works"""
<|body_1|>
def test_give_custom... | stack_v2_sparse_classes_36k_train_023323 | 1,428 | no_license | [
{
"docstring": "Tests if name and salary are formatted corrctly",
"name": "test_format_name_salary",
"signature": "def test_format_name_salary(self)"
},
{
"docstring": "Tests if default raise works",
"name": "test_give_default_raise",
"signature": "def test_give_default_raise(self)"
},... | 3 | stack_v2_sparse_classes_30k_train_016811 | Implement the Python class `TestEmployee` described below.
Class description:
Tests for the class Employee
Method signatures and docstrings:
- def test_format_name_salary(self): Tests if name and salary are formatted corrctly
- def test_give_default_raise(self): Tests if default raise works
- def test_give_custom_rai... | Implement the Python class `TestEmployee` described below.
Class description:
Tests for the class Employee
Method signatures and docstrings:
- def test_format_name_salary(self): Tests if name and salary are formatted corrctly
- def test_give_default_raise(self): Tests if default raise works
- def test_give_custom_rai... | 77ecd59829324807279bb0abd06f55c322dbf328 | <|skeleton|>
class TestEmployee:
"""Tests for the class Employee"""
def test_format_name_salary(self):
"""Tests if name and salary are formatted corrctly"""
<|body_0|>
def test_give_default_raise(self):
"""Tests if default raise works"""
<|body_1|>
def test_give_custom... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestEmployee:
"""Tests for the class Employee"""
def test_format_name_salary(self):
"""Tests if name and salary are formatted corrctly"""
my_employee = Employee('justin', 'williams', 80000)
my_employee.format_name_salary()
self.assertEqual(my_employee.format_name_salary(),... | the_stack_v2_python_sparse | chp11/test_employee.py | justinm0rgan/python_work | train | 0 |
09b051846948da02cd6d332344dfcd34881da7e0 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn RemoteItem()",
"from .file import File\nfrom .file_system_info import FileSystemInfo\nfrom .folder import Folder\nfrom .identity_set import IdentitySet\nfrom .image import Image\nfrom .item_reference import ItemReference\nfrom .package... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return RemoteItem()
<|end_body_0|>
<|body_start_1|>
from .file import File
from .file_system_info import FileSystemInfo
from .folder import Folder
from .identity_set import Iden... | RemoteItem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemoteItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RemoteItem:
"""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: Remo... | stack_v2_sparse_classes_36k_train_023324 | 8,777 | 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: RemoteItem",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(pa... | 3 | null | Implement the Python class `RemoteItem` described below.
Class description:
Implement the RemoteItem class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RemoteItem: Creates a new instance of the appropriate class based on discriminator value Args: pa... | Implement the Python class `RemoteItem` described below.
Class description:
Implement the RemoteItem class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RemoteItem: Creates a new instance of the appropriate class based on discriminator value Args: pa... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class RemoteItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RemoteItem:
"""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: Remo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RemoteItem:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RemoteItem:
"""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: RemoteItem"""
... | the_stack_v2_python_sparse | msgraph/generated/models/remote_item.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
f5eea5ea63e09180b243bd7bd60404b2795e6ef1 | [
"self.start_all_services(client=False)\ndeproxy_cl = self.get_client('deproxy3')\ndeproxy_cl.start()\ndeproxy_cl2 = self.get_client('deproxy4')\ndeproxy_cl2.start()\ndeproxy_cl.make_requests(self.requests * 10)\ndeproxy_cl.wait_for_response(timeout=4)\ndeproxy_cl2.make_requests(self.requests2 * 10)\ndeproxy_cl2.wai... | <|body_start_0|>
self.start_all_services(client=False)
deproxy_cl = self.get_client('deproxy3')
deproxy_cl.start()
deproxy_cl2 = self.get_client('deproxy4')
deproxy_cl2.start()
deproxy_cl.make_requests(self.requests * 10)
deproxy_cl.wait_for_response(timeout=4)
... | Blocks an attacker's IP address if a protected web application return 5 error responses with codes 404 or 405 within 2 seconds. This is 2,5 per second. | HttpRespCodeBlock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HttpRespCodeBlock:
"""Blocks an attacker's IP address if a protected web application return 5 error responses with codes 404 or 405 within 2 seconds. This is 2,5 per second."""
def test_two_clients_one_ip(self):
"""Two clients to be blocked by ip for a total of 404 requests"""
... | stack_v2_sparse_classes_36k_train_023325 | 9,324 | no_license | [
{
"docstring": "Two clients to be blocked by ip for a total of 404 requests",
"name": "test_two_clients_one_ip",
"signature": "def test_two_clients_one_ip(self)"
},
{
"docstring": "Two clients. One client sends 12 requests by 6 per second during 2 seconds. Of these, 6 requests by 3 per second gi... | 2 | null | Implement the Python class `HttpRespCodeBlock` described below.
Class description:
Blocks an attacker's IP address if a protected web application return 5 error responses with codes 404 or 405 within 2 seconds. This is 2,5 per second.
Method signatures and docstrings:
- def test_two_clients_one_ip(self): Two clients ... | Implement the Python class `HttpRespCodeBlock` described below.
Class description:
Blocks an attacker's IP address if a protected web application return 5 error responses with codes 404 or 405 within 2 seconds. This is 2,5 per second.
Method signatures and docstrings:
- def test_two_clients_one_ip(self): Two clients ... | d56358ea653dbb367624937197ce5e489abf0b00 | <|skeleton|>
class HttpRespCodeBlock:
"""Blocks an attacker's IP address if a protected web application return 5 error responses with codes 404 or 405 within 2 seconds. This is 2,5 per second."""
def test_two_clients_one_ip(self):
"""Two clients to be blocked by ip for a total of 404 requests"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HttpRespCodeBlock:
"""Blocks an attacker's IP address if a protected web application return 5 error responses with codes 404 or 405 within 2 seconds. This is 2,5 per second."""
def test_two_clients_one_ip(self):
"""Two clients to be blocked by ip for a total of 404 requests"""
self.start_... | the_stack_v2_python_sparse | t_frang/test_http_resp_code_block.py | tempesta-tech/tempesta-test | train | 13 |
0231692cc20d662f02f1c475ae7d6f398306d9ae | [
"super().__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(input_dim=target_vocab, output_dim=dm)\nself.positional_encoding = positional_encoding(max_seq_len, self.dm)\nblocks = []\nfor i in range(N):\n blocks.append(DecoderBlock(dm, h, hidden, drop_rate))\nself.blocks = blocks\nse... | <|body_start_0|>
super().__init__()
self.N = N
self.dm = dm
self.embedding = tf.keras.layers.Embedding(input_dim=target_vocab, output_dim=dm)
self.positional_encoding = positional_encoding(max_seq_len, self.dm)
blocks = []
for i in range(N):
blocks.app... | DecoderBlock class | Decoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""DecoderBlock class"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units in the fully connected layer. drop... | stack_v2_sparse_classes_36k_train_023326 | 13,062 | no_license | [
{
"docstring": "Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units in the fully connected layer. drop_rate: (float) the dropout rate.",
"name": "__init__",
"signature": "def __init__(self, N, dm, h, hidden, target_vocab, m... | 2 | null | Implement the Python class `Decoder` described below.
Class description:
DecoderBlock class
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the ... | Implement the Python class `Decoder` described below.
Class description:
DecoderBlock class
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the ... | 75274394adb52d740f6cd4000cc00bbde44b9b72 | <|skeleton|>
class Decoder:
"""DecoderBlock class"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units in the fully connected layer. drop... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Decoder:
"""DecoderBlock class"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""Initializer. Args: dm: (int) the dimensionality of the model. h: (int) the number of heads. hidden: (int) the number of hidden units in the fully connected layer. drop_rate: (float... | the_stack_v2_python_sparse | supervised_learning/0x12-transformer_apps/5-transformer.py | jdarangop/holbertonschool-machine_learning | train | 2 |
a07a493b00d19b40dd838aecb7b49c426c19158a | [
"if self.state_model.op_state in [DevState.FAULT, DevState.UNKNOWN, DevState.DISABLE]:\n tango.Except.throw_exception(f'Abort() is not allowed in current state {self.state_model.op_state}', 'Failed to invoke Abort command on MccsSubarrayLeafNode.', 'Mccssubarrayleafnode.Abort()', tango.ErrSeverity.ERR)\nself.thi... | <|body_start_0|>
if self.state_model.op_state in [DevState.FAULT, DevState.UNKNOWN, DevState.DISABLE]:
tango.Except.throw_exception(f'Abort() is not allowed in current state {self.state_model.op_state}', 'Failed to invoke Abort command on MccsSubarrayLeafNode.', 'Mccssubarrayleafnode.Abort()', tango... | A class for MccsSubarrayLeafNode's Abort() command. Command to abort the current operation being done on the MCCS Subarray. | Abort | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Abort:
"""A class for MccsSubarrayLeafNode's Abort() command. Command to abort the current operation being done on the MCCS Subarray."""
def check_allowed(self):
"""Checks whether the command is allowed to be executed in the current state :return: True if this command is allowed to b... | stack_v2_sparse_classes_36k_train_023327 | 4,458 | permissive | [
{
"docstring": "Checks whether the command is allowed to be executed in the current state :return: True if this command is allowed to be run in current device state :rtype: boolean :raises: DevFailed if this command is not allowed to be run in current device state",
"name": "check_allowed",
"signature":... | 3 | null | Implement the Python class `Abort` described below.
Class description:
A class for MccsSubarrayLeafNode's Abort() command. Command to abort the current operation being done on the MCCS Subarray.
Method signatures and docstrings:
- def check_allowed(self): Checks whether the command is allowed to be executed in the cu... | Implement the Python class `Abort` described below.
Class description:
A class for MccsSubarrayLeafNode's Abort() command. Command to abort the current operation being done on the MCCS Subarray.
Method signatures and docstrings:
- def check_allowed(self): Checks whether the command is allowed to be executed in the cu... | 7ee65a9c8dada9b28893144b372a398bd0646195 | <|skeleton|>
class Abort:
"""A class for MccsSubarrayLeafNode's Abort() command. Command to abort the current operation being done on the MCCS Subarray."""
def check_allowed(self):
"""Checks whether the command is allowed to be executed in the current state :return: True if this command is allowed to b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Abort:
"""A class for MccsSubarrayLeafNode's Abort() command. Command to abort the current operation being done on the MCCS Subarray."""
def check_allowed(self):
"""Checks whether the command is allowed to be executed in the current state :return: True if this command is allowed to be run in curr... | the_stack_v2_python_sparse | temp_src/ska_tmc_mccssubarrayleafnode_low/abort_command.py | ska-telescope/tmc-prototype | train | 4 |
8f906088dbb9fb250f450bc423e747e08c581dbf | [
"self.thetas_degs = thetas_degs\nassert pa_nd.size == 2, 'pa_nd of qubit rot does not have size 2'\nassert pa_nd.state_names == ['0', '1'], 'parent node state names are not 0,1'\nBayesNode.__init__(self, id_num, name, size=2)\nself.add_parent(pa_nd)\nself.state_names = ['0', '1']\npot = DiscreteCondPot(True, [pa_nd... | <|body_start_0|>
self.thetas_degs = thetas_degs
assert pa_nd.size == 2, 'pa_nd of qubit rot does not have size 2'
assert pa_nd.state_names == ['0', '1'], 'parent node state names are not 0,1'
BayesNode.__init__(self, id_num, name, size=2)
self.add_parent(pa_nd)
self.state... | The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a qubit rotation. The following is expected: * the focus node has exactly one parent node, * the parent node has 2 states named 0 and 1, in that order. Quantum Fog gives names 0 and 1 to the states of the Qbit Rotator. The Con... | QubitRot | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QubitRot:
"""The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a qubit rotation. The following is expected: * the focus node has exactly one parent node, * the parent node has 2 states named 0 and 1, in that order. Quantum Fog gives names 0 and 1 to the... | stack_v2_sparse_classes_36k_train_023328 | 3,662 | permissive | [
{
"docstring": "Constructor Parameters ---------- id_num : int id number of self (focus node) name : str name of self (focus node) pa_nd : BayesNode parent node thetas_degs : list[float] Returns -------",
"name": "__init__",
"signature": "def __init__(self, id_num, name, pa_nd, thetas_degs)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_006906 | Implement the Python class `QubitRot` described below.
Class description:
The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a qubit rotation. The following is expected: * the focus node has exactly one parent node, * the parent node has 2 states named 0 and 1, in that order.... | Implement the Python class `QubitRot` described below.
Class description:
The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a qubit rotation. The following is expected: * the focus node has exactly one parent node, * the parent node has 2 states named 0 and 1, in that order.... | 5b4a3055ea14c2ee9c80c339f759fe2b9c8c51e2 | <|skeleton|>
class QubitRot:
"""The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a qubit rotation. The following is expected: * the focus node has exactly one parent node, * the parent node has 2 states named 0 and 1, in that order. Quantum Fog gives names 0 and 1 to the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QubitRot:
"""The Constructor of this class builds a BayesNode that has a transition matrix appropriate for a qubit rotation. The following is expected: * the focus node has exactly one parent node, * the parent node has 2 states named 0 and 1, in that order. Quantum Fog gives names 0 and 1 to the states of th... | the_stack_v2_python_sparse | prefabricated_nodes/QubitRot.py | artiste-qb-net/quantum-fog | train | 95 |
8de64c95db800ed7145e82a92d23e70ecca37c98 | [
"if aggregator == 'logsumexp':\n return tf.reduce_logsumexp(scores)\nelif aggregator == 'max':\n return tf.reduce_max(scores)\nelif aggregator == 'average':\n return tf.reduce_mean(scores)\nelif aggregator == 'topk':\n return tf.reduce_mean(tf.nn.top_k(scores, k=k)[0])",
"if ent_seq is not None:\n ... | <|body_start_0|>
if aggregator == 'logsumexp':
return tf.reduce_logsumexp(scores)
elif aggregator == 'max':
return tf.reduce_max(scores)
elif aggregator == 'average':
return tf.reduce_mean(scores)
elif aggregator == 'topk':
return tf.reduce... | PathRnn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PathRnn:
def aggregate_scores(self, scores, aggregator='logsumexp', k=1):
""":param scores: 1D tensor with scores to aggregate :return: a scalar - the agg score"""
<|body_0|>
def encode_path(self, rel_seq, seq_len, encoder_params, ent_seq=None, is_eval=True):
""":par... | stack_v2_sparse_classes_36k_train_023329 | 3,447 | no_license | [
{
"docstring": ":param scores: 1D tensor with scores to aggregate :return: a scalar - the agg score",
"name": "aggregate_scores",
"signature": "def aggregate_scores(self, scores, aggregator='logsumexp', k=1)"
},
{
"docstring": ":param rel_seq: [batch_size, max_path_length, rel_repr_dim] :param s... | 3 | stack_v2_sparse_classes_30k_train_016489 | Implement the Python class `PathRnn` described below.
Class description:
Implement the PathRnn class.
Method signatures and docstrings:
- def aggregate_scores(self, scores, aggregator='logsumexp', k=1): :param scores: 1D tensor with scores to aggregate :return: a scalar - the agg score
- def encode_path(self, rel_seq... | Implement the Python class `PathRnn` described below.
Class description:
Implement the PathRnn class.
Method signatures and docstrings:
- def aggregate_scores(self, scores, aggregator='logsumexp', k=1): :param scores: 1D tensor with scores to aggregate :return: a scalar - the agg score
- def encode_path(self, rel_seq... | 6bc147711caa0154296d2e6804a6636f6c633bfe | <|skeleton|>
class PathRnn:
def aggregate_scores(self, scores, aggregator='logsumexp', k=1):
""":param scores: 1D tensor with scores to aggregate :return: a scalar - the agg score"""
<|body_0|>
def encode_path(self, rel_seq, seq_len, encoder_params, ent_seq=None, is_eval=True):
""":par... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PathRnn:
def aggregate_scores(self, scores, aggregator='logsumexp', k=1):
""":param scores: 1D tensor with scores to aggregate :return: a scalar - the agg score"""
if aggregator == 'logsumexp':
return tf.reduce_logsumexp(scores)
elif aggregator == 'max':
return ... | the_stack_v2_python_sparse | path_rnn_v2/nn/path_rnn.py | silvianacmp/msc-project | train | 0 | |
6fd2a747aff5bea601aa420320f372fecc8a1175 | [
"self.maxlag = maxlag\nself.test = test\nself.significance_level = significance_level\nself.cv = cv",
"n, dim = data.shape\nassert dim == 2, 'Data have more than two dimensions'\np_value_matrix = np.zeros((dim, dim * self.maxlag))\nfor c in range(dim):\n for r in range(dim):\n if r != c:\n te... | <|body_start_0|>
self.maxlag = maxlag
self.test = test
self.significance_level = significance_level
self.cv = cv
<|end_body_0|>
<|body_start_1|>
n, dim = data.shape
assert dim == 2, 'Data have more than two dimensions'
p_value_matrix = np.zeros((dim, dim * self.m... | Python implementation of granger causality, including 1) regression+hypothesis test and 2) lasso regression | Granger | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Granger:
"""Python implementation of granger causality, including 1) regression+hypothesis test and 2) lasso regression"""
def __init__(self, maxlag=2, test='ssr_ftest', significance_level=0.01, cv=5):
"""Construct the Granger model. Parameters ---------- maxlag: maximum time lag tes... | stack_v2_sparse_classes_36k_train_023330 | 2,995 | permissive | [
{
"docstring": "Construct the Granger model. Parameters ---------- maxlag: maximum time lag test: statistical test (details can be found in https://www.statsmodels.org/dev/generated/statsmodels.tsa.stattools.grangercausalitytests.html) cv: number of cross validation folds for lasso regression",
"name": "__i... | 3 | null | Implement the Python class `Granger` described below.
Class description:
Python implementation of granger causality, including 1) regression+hypothesis test and 2) lasso regression
Method signatures and docstrings:
- def __init__(self, maxlag=2, test='ssr_ftest', significance_level=0.01, cv=5): Construct the Granger ... | Implement the Python class `Granger` described below.
Class description:
Python implementation of granger causality, including 1) regression+hypothesis test and 2) lasso regression
Method signatures and docstrings:
- def __init__(self, maxlag=2, test='ssr_ftest', significance_level=0.01, cv=5): Construct the Granger ... | 4f50f9ff15429b0ac6ad0a99fbe4cfdd17e360fc | <|skeleton|>
class Granger:
"""Python implementation of granger causality, including 1) regression+hypothesis test and 2) lasso regression"""
def __init__(self, maxlag=2, test='ssr_ftest', significance_level=0.01, cv=5):
"""Construct the Granger model. Parameters ---------- maxlag: maximum time lag tes... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Granger:
"""Python implementation of granger causality, including 1) regression+hypothesis test and 2) lasso regression"""
def __init__(self, maxlag=2, test='ssr_ftest', significance_level=0.01, cv=5):
"""Construct the Granger model. Parameters ---------- maxlag: maximum time lag test: statistica... | the_stack_v2_python_sparse | causallearn/search/Granger/Granger.py | softsys4ai/unicorn | train | 44 |
6499ec2fb177c4f05a2906aa7d5c76ec32933c74 | [
"address_ = queryset.count()\ntry:\n default_address = True if address_ == 0 else False\n address = self.Meta.model.address_.create(user=instance, default_address=default_address, recipients=validated_data['recipients'], region=validated_data['region'], address_tags=validated_data['address_tags'], phone=valid... | <|body_start_0|>
address_ = queryset.count()
try:
default_address = True if address_ == 0 else False
address = self.Meta.model.address_.create(user=instance, default_address=default_address, recipients=validated_data['recipients'], region=validated_data['region'], address_tags=va... | AddressSerializers | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddressSerializers:
def add_or_edit_address(self, queryset, instance, validated_data):
"""创建新的地址 如果第一次创建地址,则将第一个地址设置为默认地址"""
<|body_0|>
def update_default_address(queryset, pk):
"""修改默认地址"""
<|body_1|>
def update_address(self, queryset, validated_data, p... | stack_v2_sparse_classes_36k_train_023331 | 2,870 | permissive | [
{
"docstring": "创建新的地址 如果第一次创建地址,则将第一个地址设置为默认地址",
"name": "add_or_edit_address",
"signature": "def add_or_edit_address(self, queryset, instance, validated_data)"
},
{
"docstring": "修改默认地址",
"name": "update_default_address",
"signature": "def update_default_address(queryset, pk)"
},
{... | 4 | null | Implement the Python class `AddressSerializers` described below.
Class description:
Implement the AddressSerializers class.
Method signatures and docstrings:
- def add_or_edit_address(self, queryset, instance, validated_data): 创建新的地址 如果第一次创建地址,则将第一个地址设置为默认地址
- def update_default_address(queryset, pk): 修改默认地址
- def up... | Implement the Python class `AddressSerializers` described below.
Class description:
Implement the AddressSerializers class.
Method signatures and docstrings:
- def add_or_edit_address(self, queryset, instance, validated_data): 创建新的地址 如果第一次创建地址,则将第一个地址设置为默认地址
- def update_default_address(queryset, pk): 修改默认地址
- def up... | 13cb59130d15e782f78bc5148409bef0f1c516e0 | <|skeleton|>
class AddressSerializers:
def add_or_edit_address(self, queryset, instance, validated_data):
"""创建新的地址 如果第一次创建地址,则将第一个地址设置为默认地址"""
<|body_0|>
def update_default_address(queryset, pk):
"""修改默认地址"""
<|body_1|>
def update_address(self, queryset, validated_data, p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AddressSerializers:
def add_or_edit_address(self, queryset, instance, validated_data):
"""创建新的地址 如果第一次创建地址,则将第一个地址设置为默认地址"""
address_ = queryset.count()
try:
default_address = True if address_ == 0 else False
address = self.Meta.model.address_.create(user=instan... | the_stack_v2_python_sparse | user_app/serializers/address_serializers.py | lmyfzx/Django-Mall | train | 0 | |
5c34c03d9c7799f25d0266f603218f87ec677b3e | [
"super().__init__()\nself.layer_norm_att = normalization_class(size, **normalization_args)\nself.layer_norm_ffn = normalization_class(size, **normalization_args)\nself.att = SelfAttention(size, attention_size, context_size, block_id, num_blocks)\nself.dropout_att = torch.nn.Dropout(p=att_dropout_rate)\nself.ffn = F... | <|body_start_0|>
super().__init__()
self.layer_norm_att = normalization_class(size, **normalization_args)
self.layer_norm_ffn = normalization_class(size, **normalization_args)
self.att = SelfAttention(size, attention_size, context_size, block_id, num_blocks)
self.dropout_att = to... | RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. normalization_class: Normalization layer class. normalization_args: Norma... | RWKV | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RWKV:
"""RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. normalization_class: Normalization layer ... | stack_v2_sparse_classes_36k_train_023332 | 2,602 | permissive | [
{
"docstring": "Construct a RWKV object.",
"name": "__init__",
"signature": "def __init__(self, size: int, linear_size: int, attention_size: int, context_size: int, block_id: int, num_blocks: int, normalization_class: torch.nn.Module=torch.nn.LayerNorm, normalization_args: Dict={}, att_dropout_rate: flo... | 2 | stack_v2_sparse_classes_30k_train_005187 | Implement the Python class `RWKV` described below.
Class description:
RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. no... | Implement the Python class `RWKV` described below.
Class description:
RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. no... | bcd20948db7846ee523443ef9fd78c7a1248c95e | <|skeleton|>
class RWKV:
"""RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. normalization_class: Normalization layer ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RWKV:
"""RWKV module. Args: size: Input/Output size. linear_size: Feed-forward hidden size. attention_size: SelfAttention hidden size. context_size: Context size for WKV computation. block_id: Block index. num_blocks: Number of blocks in the architecture. normalization_class: Normalization layer class. normal... | the_stack_v2_python_sparse | espnet2/asr_transducer/decoder/blocks/rwkv.py | espnet/espnet | train | 7,242 |
325281d06c085bf0b3762cc427510df15d3966c4 | [
"flags.AddNamePositionalArg(parser)\nresource_printer.RegisterFormatter(integration_printer.INTEGRATION_PRINTER_FORMAT, integration_printer.IntegrationPrinter, hidden=True)\nparser.display_info.AddFormat(integration_printer.INTEGRATION_PRINTER_FORMAT)",
"release_track = self.ReleaseTrack()\nname = args.name\nconn... | <|body_start_0|>
flags.AddNamePositionalArg(parser)
resource_printer.RegisterFormatter(integration_printer.INTEGRATION_PRINTER_FORMAT, integration_printer.IntegrationPrinter, hidden=True)
parser.display_info.AddFormat(integration_printer.INTEGRATION_PRINTER_FORMAT)
<|end_body_0|>
<|body_start_1... | Describe a Cloud Run Integration. | Describe | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Describe:
"""Describe a Cloud Run Integration."""
def Args(cls, parser):
"""Set up arguments for this command. Args: parser: An argparse.ArgumentParser."""
<|body_0|>
def Run(self, args):
"""Describe an integration type."""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_023333 | 2,991 | permissive | [
{
"docstring": "Set up arguments for this command. Args: parser: An argparse.ArgumentParser.",
"name": "Args",
"signature": "def Args(cls, parser)"
},
{
"docstring": "Describe an integration type.",
"name": "Run",
"signature": "def Run(self, args)"
}
] | 2 | stack_v2_sparse_classes_30k_train_000298 | Implement the Python class `Describe` described below.
Class description:
Describe a Cloud Run Integration.
Method signatures and docstrings:
- def Args(cls, parser): Set up arguments for this command. Args: parser: An argparse.ArgumentParser.
- def Run(self, args): Describe an integration type. | Implement the Python class `Describe` described below.
Class description:
Describe a Cloud Run Integration.
Method signatures and docstrings:
- def Args(cls, parser): Set up arguments for this command. Args: parser: An argparse.ArgumentParser.
- def Run(self, args): Describe an integration type.
<|skeleton|>
class D... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class Describe:
"""Describe a Cloud Run Integration."""
def Args(cls, parser):
"""Set up arguments for this command. Args: parser: An argparse.ArgumentParser."""
<|body_0|>
def Run(self, args):
"""Describe an integration type."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Describe:
"""Describe a Cloud Run Integration."""
def Args(cls, parser):
"""Set up arguments for this command. Args: parser: An argparse.ArgumentParser."""
flags.AddNamePositionalArg(parser)
resource_printer.RegisterFormatter(integration_printer.INTEGRATION_PRINTER_FORMAT, integra... | the_stack_v2_python_sparse | lib/surface/run/integrations/describe.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
6d1d85bbbb581cdd3736cf342f2a9f9659f9c72e | [
"x, x_shape = self._prepare_x(x)\ny = self._evaluate_derivatives(x, der)\ny = y.reshape((y.shape[0],) + x_shape + self._y_extra_shape)\nif self._y_axis != 0 and x_shape != ():\n nx = len(x_shape)\n ny = len(self._y_extra_shape)\n s = [0] + list(range(nx + 1, nx + self._y_axis + 1)) + list(range(1, nx + 1))... | <|body_start_0|>
x, x_shape = self._prepare_x(x)
y = self._evaluate_derivatives(x, der)
y = y.reshape((y.shape[0],) + x_shape + self._y_extra_shape)
if self._y_axis != 0 and x_shape != ():
nx = len(x_shape)
ny = len(self._y_extra_shape)
s = [0] + list(... | _Interpolator1DWithDerivatives | [
"Python-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Qhull",
"BSD-3-Clause",
"Apache-2.0",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _Interpolator1DWithDerivatives:
def derivatives(self, x, der=None):
"""Evaluate many derivatives of the polynomial at the point x Produce an array of all derivative values at the point x. Parameters ---------- x : array_like Point or points at which to evaluate the derivatives der : int ... | stack_v2_sparse_classes_36k_train_023334 | 22,677 | permissive | [
{
"docstring": "Evaluate many derivatives of the polynomial at the point x Produce an array of all derivative values at the point x. Parameters ---------- x : array_like Point or points at which to evaluate the derivatives der : int or None, optional How many derivatives to extract; None for all potentially non... | 2 | stack_v2_sparse_classes_30k_train_009073 | Implement the Python class `_Interpolator1DWithDerivatives` described below.
Class description:
Implement the _Interpolator1DWithDerivatives class.
Method signatures and docstrings:
- def derivatives(self, x, der=None): Evaluate many derivatives of the polynomial at the point x Produce an array of all derivative valu... | Implement the Python class `_Interpolator1DWithDerivatives` described below.
Class description:
Implement the _Interpolator1DWithDerivatives class.
Method signatures and docstrings:
- def derivatives(self, x, der=None): Evaluate many derivatives of the polynomial at the point x Produce an array of all derivative valu... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class _Interpolator1DWithDerivatives:
def derivatives(self, x, der=None):
"""Evaluate many derivatives of the polynomial at the point x Produce an array of all derivative values at the point x. Parameters ---------- x : array_like Point or points at which to evaluate the derivatives der : int ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _Interpolator1DWithDerivatives:
def derivatives(self, x, der=None):
"""Evaluate many derivatives of the polynomial at the point x Produce an array of all derivative values at the point x. Parameters ---------- x : array_like Point or points at which to evaluate the derivatives der : int or None, optio... | the_stack_v2_python_sparse | contrib/python/scipy/py2/scipy/interpolate/polyint.py | catboost/catboost | train | 8,012 | |
67fe85d02e97208383f592b609d5a00b88caebd2 | [
"if not default_fields:\n default_fields = cls.default + cls.base_fields\nif excldu:\n fields = [i for i in default_fields if i not in excldu]\n return fields\nelif fields:\n return fields\nelse:\n return default_fields",
"if not fields:\n fields = []\nif not excldu:\n excldu = []\n__default_... | <|body_start_0|>
if not default_fields:
default_fields = cls.default + cls.base_fields
if excldu:
fields = [i for i in default_fields if i not in excldu]
return fields
elif fields:
return fields
else:
return default_fields
<|end... | BaseModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseModel:
def __ser_fields(cls, fields=None, excldu=None, default_fields=None):
"""此方法处理需要序列的字段,fields为需要序列化的,excldu为不需要的,同时输入 以excldu为准,都不输入为default"""
<|body_0|>
def serialize_data(cls, fields=None, excldu=None):
""":param fields: 包括字段 :param excldu: 排除字段 此方法通过调用_... | stack_v2_sparse_classes_36k_train_023335 | 5,668 | no_license | [
{
"docstring": "此方法处理需要序列的字段,fields为需要序列化的,excldu为不需要的,同时输入 以excldu为准,都不输入为default",
"name": "__ser_fields",
"signature": "def __ser_fields(cls, fields=None, excldu=None, default_fields=None)"
},
{
"docstring": ":param fields: 包括字段 :param excldu: 排除字段 此方法通过调用__ser_fields方法设置需要序列化的字段",
"name"... | 3 | null | Implement the Python class `BaseModel` described below.
Class description:
Implement the BaseModel class.
Method signatures and docstrings:
- def __ser_fields(cls, fields=None, excldu=None, default_fields=None): 此方法处理需要序列的字段,fields为需要序列化的,excldu为不需要的,同时输入 以excldu为准,都不输入为default
- def serialize_data(cls, fields=None, ... | Implement the Python class `BaseModel` described below.
Class description:
Implement the BaseModel class.
Method signatures and docstrings:
- def __ser_fields(cls, fields=None, excldu=None, default_fields=None): 此方法处理需要序列的字段,fields为需要序列化的,excldu为不需要的,同时输入 以excldu为准,都不输入为default
- def serialize_data(cls, fields=None, ... | bc6995fade050974bc1a872f5c961ccc6c18b205 | <|skeleton|>
class BaseModel:
def __ser_fields(cls, fields=None, excldu=None, default_fields=None):
"""此方法处理需要序列的字段,fields为需要序列化的,excldu为不需要的,同时输入 以excldu为准,都不输入为default"""
<|body_0|>
def serialize_data(cls, fields=None, excldu=None):
""":param fields: 包括字段 :param excldu: 排除字段 此方法通过调用_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseModel:
def __ser_fields(cls, fields=None, excldu=None, default_fields=None):
"""此方法处理需要序列的字段,fields为需要序列化的,excldu为不需要的,同时输入 以excldu为准,都不输入为default"""
if not default_fields:
default_fields = cls.default + cls.base_fields
if excldu:
fields = [i for i in defaul... | the_stack_v2_python_sparse | models.py | soondh/server-slave | train | 0 | |
33b6c6f27bcc2cea48c3537844e64223486a258d | [
"opens = '([{'\ncloses = ')]}'\nparstack = Stack()\nbalance = True\nfor each in s:\n if each in '([{':\n parstack.push(each)\n elif parstack.isEmpty():\n balance = False\n else:\n top = parstack.pop()\n if opens.index(top) != closes.index(each):\n balance = False\nif ... | <|body_start_0|>
opens = '([{'
closes = ')]}'
parstack = Stack()
balance = True
for each in s:
if each in '([{':
parstack.push(each)
elif parstack.isEmpty():
balance = False
else:
top = parstack.p... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isValid_stack(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
def isValid_similar(self, s):
"""time O(n) space O(n) :param s: :return:"""
<|body_2|>
<|en... | stack_v2_sparse_classes_36k_train_023336 | 1,928 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid_stack",
"signature": "def isValid_stack(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid",
"signature": "def isValid(self, s)"
},
{
"docstring": "time O(n) space O(n) :param s: :return:",
"n... | 3 | stack_v2_sparse_classes_30k_train_015332 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid_stack(self, s): :type s: str :rtype: bool
- def isValid(self, s): :type s: str :rtype: bool
- def isValid_similar(self, s): time O(n) space O(n) :param s: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid_stack(self, s): :type s: str :rtype: bool
- def isValid(self, s): :type s: str :rtype: bool
- def isValid_similar(self, s): time O(n) space O(n) :param s: :return:
<... | 85f71621c54f6b0029f3a2746f022f89dd7419d9 | <|skeleton|>
class Solution:
def isValid_stack(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
def isValid_similar(self, s):
"""time O(n) space O(n) :param s: :return:"""
<|body_2|>
<|en... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isValid_stack(self, s):
""":type s: str :rtype: bool"""
opens = '([{'
closes = ')]}'
parstack = Stack()
balance = True
for each in s:
if each in '([{':
parstack.push(each)
elif parstack.isEmpty():
... | the_stack_v2_python_sparse | LeetCode/Stack/20_Stack_valid_parentheses.py | XyK0907/for_work | train | 0 | |
8e73fe7b8dd0aceaaa4c0739085c488d2649a286 | [
"new_spec = Specification(key=validated_data.get('key'), value=validated_data.get('value'), category=validated_data.get('category'), car=validated_data.get('car'))\nnew_spec.save()\nreturn new_spec",
"instance.key = validated_data.get('key', instance.key)\ninstance.value = validated_data.get('value', instance.val... | <|body_start_0|>
new_spec = Specification(key=validated_data.get('key'), value=validated_data.get('value'), category=validated_data.get('category'), car=validated_data.get('car'))
new_spec.save()
return new_spec
<|end_body_0|>
<|body_start_1|>
instance.key = validated_data.get('key', in... | SpecificationSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpecificationSerializer:
def create(self, validated_data):
"""create and return new 'Specification' instance"""
<|body_0|>
def update(self, instance, validated_data):
"""Update and return an existing `Specification` instance"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_023337 | 6,342 | no_license | [
{
"docstring": "create and return new 'Specification' instance",
"name": "create",
"signature": "def create(self, validated_data)"
},
{
"docstring": "Update and return an existing `Specification` instance",
"name": "update",
"signature": "def update(self, instance, validated_data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004564 | Implement the Python class `SpecificationSerializer` described below.
Class description:
Implement the SpecificationSerializer class.
Method signatures and docstrings:
- def create(self, validated_data): create and return new 'Specification' instance
- def update(self, instance, validated_data): Update and return an ... | Implement the Python class `SpecificationSerializer` described below.
Class description:
Implement the SpecificationSerializer class.
Method signatures and docstrings:
- def create(self, validated_data): create and return new 'Specification' instance
- def update(self, instance, validated_data): Update and return an ... | dba8d1fdb96889e41328e792816a4968cbeb1ed4 | <|skeleton|>
class SpecificationSerializer:
def create(self, validated_data):
"""create and return new 'Specification' instance"""
<|body_0|>
def update(self, instance, validated_data):
"""Update and return an existing `Specification` instance"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpecificationSerializer:
def create(self, validated_data):
"""create and return new 'Specification' instance"""
new_spec = Specification(key=validated_data.get('key'), value=validated_data.get('value'), category=validated_data.get('category'), car=validated_data.get('car'))
new_spec.sa... | the_stack_v2_python_sparse | cars_web/cars_app/serializers.py | Ignisor/cars_scrapper | train | 0 | |
405a13e4ad05b1b056f040b468fc2c955e395d52 | [
"super(OidcPassword, self).__init__(auth_url=auth_url, identity_provider=identity_provider, protocol=protocol, client_id=client_id, client_secret=client_secret, access_token_endpoint=access_token_endpoint, grant_type=grant_type, access_token_type=access_token_type)\nself.username = username\nself.password = passwor... | <|body_start_0|>
super(OidcPassword, self).__init__(auth_url=auth_url, identity_provider=identity_provider, protocol=protocol, client_id=client_id, client_secret=client_secret, access_token_endpoint=access_token_endpoint, grant_type=grant_type, access_token_type=access_token_type)
self.username = userna... | Implementation for OpenID Connect Resource Owner Password Credential. | OidcPassword | [
"Apache-2.0",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OidcPassword:
"""Implementation for OpenID Connect Resource Owner Password Credential."""
def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret, access_token_endpoint, grant_type='password', access_token_type='access_token', username=None, password=None, scope='p... | stack_v2_sparse_classes_36k_train_023338 | 11,519 | permissive | [
{
"docstring": "The OpenID Password plugin expects the following. :param username: Username used to authenticate :type username: string :param password: Password used to authenticate :type password: string :param scope: OpenID Connect scope that is requested from OP, defaults to \"profile\", for example: \"prof... | 2 | stack_v2_sparse_classes_30k_train_011623 | Implement the Python class `OidcPassword` described below.
Class description:
Implementation for OpenID Connect Resource Owner Password Credential.
Method signatures and docstrings:
- def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret, access_token_endpoint, grant_type='password', acce... | Implement the Python class `OidcPassword` described below.
Class description:
Implementation for OpenID Connect Resource Owner Password Credential.
Method signatures and docstrings:
- def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret, access_token_endpoint, grant_type='password', acce... | 37b99242ac9810a01ab969d3d3874fa07b8fcee3 | <|skeleton|>
class OidcPassword:
"""Implementation for OpenID Connect Resource Owner Password Credential."""
def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret, access_token_endpoint, grant_type='password', access_token_type='access_token', username=None, password=None, scope='p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OidcPassword:
"""Implementation for OpenID Connect Resource Owner Password Credential."""
def __init__(self, auth_url, identity_provider, protocol, client_id, client_secret, access_token_endpoint, grant_type='password', access_token_type='access_token', username=None, password=None, scope='profile'):
... | the_stack_v2_python_sparse | python_scripts/lib/keystoneauth1-2.7.0/build/lib/keystoneauth1/identity/v3/oidc.py | rkaggrawal/PythonScripts | train | 0 |
41fa99d6de5ae139cacd40bb2788d0d5a93a4391 | [
"self.root = TreeNode(1)\ninorderL = [3, 2, 5, 4]\npreorderL = [2, 3, 4, 5]\nleft_subtree = Tree.from_inorder_preorder(inorderL, preorderL)\ninorderR = [4, 5, 2, 3]\npreorderR = [2, 4, 5, 3]\nright_subtree = Tree.from_inorder_preorder(inorderR, preorderR)\nself.root.left = left_subtree.root\nself.root.right = right... | <|body_start_0|>
self.root = TreeNode(1)
inorderL = [3, 2, 5, 4]
preorderL = [2, 3, 4, 5]
left_subtree = Tree.from_inorder_preorder(inorderL, preorderL)
inorderR = [4, 5, 2, 3]
preorderR = [2, 4, 5, 3]
right_subtree = Tree.from_inorder_preorder(inorderR, preorderR... | Tests for Leetcode problem 101: Symmetric Tree. | ProblemTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProblemTest:
"""Tests for Leetcode problem 101: Symmetric Tree."""
def setUp(self):
"""Setup a test tree, using inorder-preorder."""
<|body_0|>
def test(self):
"""Modify the test tree and run tests accordingly."""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_36k_train_023339 | 3,129 | no_license | [
{
"docstring": "Setup a test tree, using inorder-preorder.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Modify the test tree and run tests accordingly.",
"name": "test",
"signature": "def test(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001396 | Implement the Python class `ProblemTest` described below.
Class description:
Tests for Leetcode problem 101: Symmetric Tree.
Method signatures and docstrings:
- def setUp(self): Setup a test tree, using inorder-preorder.
- def test(self): Modify the test tree and run tests accordingly. | Implement the Python class `ProblemTest` described below.
Class description:
Tests for Leetcode problem 101: Symmetric Tree.
Method signatures and docstrings:
- def setUp(self): Setup a test tree, using inorder-preorder.
- def test(self): Modify the test tree and run tests accordingly.
<|skeleton|>
class ProblemTest... | e11bfc454789e716055b80873af0817ec8588aea | <|skeleton|>
class ProblemTest:
"""Tests for Leetcode problem 101: Symmetric Tree."""
def setUp(self):
"""Setup a test tree, using inorder-preorder."""
<|body_0|>
def test(self):
"""Modify the test tree and run tests accordingly."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProblemTest:
"""Tests for Leetcode problem 101: Symmetric Tree."""
def setUp(self):
"""Setup a test tree, using inorder-preorder."""
self.root = TreeNode(1)
inorderL = [3, 2, 5, 4]
preorderL = [2, 3, 4, 5]
left_subtree = Tree.from_inorder_preorder(inorderL, preorde... | the_stack_v2_python_sparse | p101/problem101.py | stanl3y/leetcode | train | 0 |
2b848f1c20f09e3c18299a5bb4653835ca46b44d | [
"super(TableView, self).__init__()\nself._header = header\nself._number_of_values = 0\nself._rows = []",
"if self._number_of_values == 0:\n self._number_of_values = len(values)\nelif self._number_of_values != len(values):\n raise ValueError('Mismatch in number of values.')\nself._rows.append(values)",
"if... | <|body_start_0|>
super(TableView, self).__init__()
self._header = header
self._number_of_values = 0
self._rows = []
<|end_body_0|>
<|body_start_1|>
if self._number_of_values == 0:
self._number_of_values = len(values)
elif self._number_of_values != len(values)... | Table view. | TableView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TableView:
"""Table view."""
def __init__(self, header=None):
"""Initializes a table view. Args: header (Optional[str]): table header."""
<|body_0|>
def AddRow(self, values):
"""Adds a row. Args: values (list[str]): values of the row. Raises: ValueError: if the n... | stack_v2_sparse_classes_36k_train_023340 | 9,900 | permissive | [
{
"docstring": "Initializes a table view. Args: header (Optional[str]): table header.",
"name": "__init__",
"signature": "def __init__(self, header=None)"
},
{
"docstring": "Adds a row. Args: values (list[str]): values of the row. Raises: ValueError: if the number of values does not match with p... | 3 | stack_v2_sparse_classes_30k_train_014564 | Implement the Python class `TableView` described below.
Class description:
Table view.
Method signatures and docstrings:
- def __init__(self, header=None): Initializes a table view. Args: header (Optional[str]): table header.
- def AddRow(self, values): Adds a row. Args: values (list[str]): values of the row. Raises:... | Implement the Python class `TableView` described below.
Class description:
Table view.
Method signatures and docstrings:
- def __init__(self, header=None): Initializes a table view. Args: header (Optional[str]): table header.
- def AddRow(self, values): Adds a row. Args: values (list[str]): values of the row. Raises:... | 55007dcac48efff42c497e739208ebfb88e4048d | <|skeleton|>
class TableView:
"""Table view."""
def __init__(self, header=None):
"""Initializes a table view. Args: header (Optional[str]): table header."""
<|body_0|>
def AddRow(self, values):
"""Adds a row. Args: values (list[str]): values of the row. Raises: ValueError: if the n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TableView:
"""Table view."""
def __init__(self, header=None):
"""Initializes a table view. Args: header (Optional[str]): table header."""
super(TableView, self).__init__()
self._header = header
self._number_of_values = 0
self._rows = []
def AddRow(self, values... | the_stack_v2_python_sparse | scripts/spotlight_storedb.py | libyal/dtformats | train | 109 |
876d1d26635d85f2f94a706ea78757ce80e3824d | [
"if 'even' == 'odd':\n arrayextension = 5\nelse:\n arrayextension = 0\narraylength = 96 + arrayextension\nMaxVal = 255\nMinVal = 0\nself.gentest = bytearray([MaxVal // 2] * arraylength)",
"with self.assertRaises(TypeError):\n result = bytesfunc.bmin(1)\nwith self.assertRaises(TypeError):\n result = mi... | <|body_start_0|>
if 'even' == 'odd':
arrayextension = 5
else:
arrayextension = 0
arraylength = 96 + arrayextension
MaxVal = 255
MinVal = 0
self.gentest = bytearray([MaxVal // 2] * arraylength)
<|end_body_0|>
<|body_start_1|>
with self.asse... | Test bmin for basic parameter tests. op_template_params | bmin_parameter_even_arraysize_with_simd_bytearray | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class bmin_parameter_even_arraysize_with_simd_bytearray:
"""Test bmin for basic parameter tests. op_template_params"""
def setUp(self):
"""Initialise."""
<|body_0|>
def test_bmin_param_function_01(self):
"""Test bmin - Sequence type bytearray. Test invalid parameter ty... | stack_v2_sparse_classes_36k_train_023341 | 49,998 | permissive | [
{
"docstring": "Initialise.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test bmin - Sequence type bytearray. Test invalid parameter type even length array with SIMD.",
"name": "test_bmin_param_function_01",
"signature": "def test_bmin_param_function_01(self)"
}... | 5 | stack_v2_sparse_classes_30k_train_020312 | Implement the Python class `bmin_parameter_even_arraysize_with_simd_bytearray` described below.
Class description:
Test bmin for basic parameter tests. op_template_params
Method signatures and docstrings:
- def setUp(self): Initialise.
- def test_bmin_param_function_01(self): Test bmin - Sequence type bytearray. Test... | Implement the Python class `bmin_parameter_even_arraysize_with_simd_bytearray` described below.
Class description:
Test bmin for basic parameter tests. op_template_params
Method signatures and docstrings:
- def setUp(self): Initialise.
- def test_bmin_param_function_01(self): Test bmin - Sequence type bytearray. Test... | 28fe0705fc59b0646a4d44e539c919173e8e8b99 | <|skeleton|>
class bmin_parameter_even_arraysize_with_simd_bytearray:
"""Test bmin for basic parameter tests. op_template_params"""
def setUp(self):
"""Initialise."""
<|body_0|>
def test_bmin_param_function_01(self):
"""Test bmin - Sequence type bytearray. Test invalid parameter ty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class bmin_parameter_even_arraysize_with_simd_bytearray:
"""Test bmin for basic parameter tests. op_template_params"""
def setUp(self):
"""Initialise."""
if 'even' == 'odd':
arrayextension = 5
else:
arrayextension = 0
arraylength = 96 + arrayextension
... | the_stack_v2_python_sparse | unittest/test_bmin.py | m1griffin/bytesfunc | train | 2 |
a38edfb4d11a8be7b8b782cd0d8b2d74dcbd878a | [
"book_list = BookInfo.objects.all()\n\"\\n {'code':***,'errmsg':***,'***_list':[{},{},...]}\\n\\n [\\n {},\\n {},\\n ...\\n ]\\n pep8\\n \"\nbook_serializer = Book2Serializer(book_list, many=True)\nbook_dict_list = book_serializer.data\nreturn Json... | <|body_start_0|>
book_list = BookInfo.objects.all()
"\n {'code':***,'errmsg':***,'***_list':[{},{},...]}\n\n [\n {},\n {},\n ...\n ]\n pep8\n "
book_serializer = Book2Serializer(book_list, many=True)
book_dict_list = boo... | BooksView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BooksView:
def get(self, request):
"""查询所有"""
<|body_0|>
def post(self, request):
"""增加"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
book_list = BookInfo.objects.all()
"\n {'code':***,'errmsg':***,'***_list':[{},{},...]}\n\n ... | stack_v2_sparse_classes_36k_train_023342 | 3,452 | permissive | [
{
"docstring": "查询所有",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "增加",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_021534 | Implement the Python class `BooksView` described below.
Class description:
Implement the BooksView class.
Method signatures and docstrings:
- def get(self, request): 查询所有
- def post(self, request): 增加 | Implement the Python class `BooksView` described below.
Class description:
Implement the BooksView class.
Method signatures and docstrings:
- def get(self, request): 查询所有
- def post(self, request): 增加
<|skeleton|>
class BooksView:
def get(self, request):
"""查询所有"""
<|body_0|>
def post(self,... | 63ae6891d3be243c5c46329e65fcf47133c5890f | <|skeleton|>
class BooksView:
def get(self, request):
"""查询所有"""
<|body_0|>
def post(self, request):
"""增加"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BooksView:
def get(self, request):
"""查询所有"""
book_list = BookInfo.objects.all()
"\n {'code':***,'errmsg':***,'***_list':[{},{},...]}\n\n [\n {},\n {},\n ...\n ]\n pep8\n "
book_serializer = Book2Serializer(boo... | the_stack_v2_python_sparse | pro_drf/demo1/booktest/views.py | yongfang117/pro_useful_code | train | 0 | |
46c0720e72cbbf17e7ea125624a4616f7652227e | [
"self.osutils = osutils\nif npm_exe is None:\n if osutils.is_windows():\n npm_exe = 'npm.cmd'\n else:\n npm_exe = 'npm'\nself.npm_exe = npm_exe",
"if not isinstance(args, list):\n raise ValueError('args must be a list')\nif not args:\n raise ValueError('requires at least one arg')\ninvok... | <|body_start_0|>
self.osutils = osutils
if npm_exe is None:
if osutils.is_windows():
npm_exe = 'npm.cmd'
else:
npm_exe = 'npm'
self.npm_exe = npm_exe
<|end_body_0|>
<|body_start_1|>
if not isinstance(args, list):
raise ... | Wrapper around the NPM command line utility, making it easy to consume execution results. | SubprocessNpm | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubprocessNpm:
"""Wrapper around the NPM command line utility, making it easy to consume execution results."""
def __init__(self, osutils, npm_exe=None):
""":type osutils: aws_lambda_builders.workflows.nodejs_npm.utils.OSUtils :param osutils: An instance of OS Utilities for file mani... | stack_v2_sparse_classes_36k_train_023343 | 2,383 | permissive | [
{
"docstring": ":type osutils: aws_lambda_builders.workflows.nodejs_npm.utils.OSUtils :param osutils: An instance of OS Utilities for file manipulation :type npm_exe: str :param npm_exe: Path to the NPM binary. If not set, the default executable path npm will be used",
"name": "__init__",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_021313 | Implement the Python class `SubprocessNpm` described below.
Class description:
Wrapper around the NPM command line utility, making it easy to consume execution results.
Method signatures and docstrings:
- def __init__(self, osutils, npm_exe=None): :type osutils: aws_lambda_builders.workflows.nodejs_npm.utils.OSUtils ... | Implement the Python class `SubprocessNpm` described below.
Class description:
Wrapper around the NPM command line utility, making it easy to consume execution results.
Method signatures and docstrings:
- def __init__(self, osutils, npm_exe=None): :type osutils: aws_lambda_builders.workflows.nodejs_npm.utils.OSUtils ... | c90c9bc8953aa684a23a3b438c7a71cc41cce809 | <|skeleton|>
class SubprocessNpm:
"""Wrapper around the NPM command line utility, making it easy to consume execution results."""
def __init__(self, osutils, npm_exe=None):
""":type osutils: aws_lambda_builders.workflows.nodejs_npm.utils.OSUtils :param osutils: An instance of OS Utilities for file mani... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SubprocessNpm:
"""Wrapper around the NPM command line utility, making it easy to consume execution results."""
def __init__(self, osutils, npm_exe=None):
""":type osutils: aws_lambda_builders.workflows.nodejs_npm.utils.OSUtils :param osutils: An instance of OS Utilities for file manipulation :typ... | the_stack_v2_python_sparse | aws_lambda_builders/workflows/nodejs_npm/npm.py | aws/aws-lambda-builders | train | 144 |
f835465c02dad2cf94788a261dec8b0d33bec39b | [
"super(Dynamics2x2Axes, self).cla()\nself.set_aspect('equal')\nself.set_xlim(0, 1)\nself.set_ylim(0, 1)",
"x, y, u, v = _eval_dynamics_2x2_grid(dynamics, num_points)\nif normalize:\n norm = np.sqrt(u ** 2 + v ** 2)\n u = np.divide(u, norm, out=np.zeros_like(u), where=norm != 0)\n v = np.divide(v, norm, o... | <|body_start_0|>
super(Dynamics2x2Axes, self).cla()
self.set_aspect('equal')
self.set_xlim(0, 1)
self.set_ylim(0, 1)
<|end_body_0|>
<|body_start_1|>
x, y, u, v = _eval_dynamics_2x2_grid(dynamics, num_points)
if normalize:
norm = np.sqrt(u ** 2 + v ** 2)
... | Axes for 2x2 game dynamics. This class provides plotting functions for dynamics in two-player 2x2 games. Attributes: name: Used for projection keyword when creating a new axes. | Dynamics2x2Axes | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dynamics2x2Axes:
"""Axes for 2x2 game dynamics. This class provides plotting functions for dynamics in two-player 2x2 games. Attributes: name: Used for projection keyword when creating a new axes."""
def cla(self):
"""Clear the current axes."""
<|body_0|>
def quiver(self... | stack_v2_sparse_classes_36k_train_023344 | 20,041 | permissive | [
{
"docstring": "Clear the current axes.",
"name": "cla",
"signature": "def cla(self)"
},
{
"docstring": "Visualizes the dynamics as a directional field plot. Args: dynamics: Population dynamics of type `dynamics.MultiPopulationDynamics`. num_points: Number of points along each dimension of the p... | 3 | null | Implement the Python class `Dynamics2x2Axes` described below.
Class description:
Axes for 2x2 game dynamics. This class provides plotting functions for dynamics in two-player 2x2 games. Attributes: name: Used for projection keyword when creating a new axes.
Method signatures and docstrings:
- def cla(self): Clear the... | Implement the Python class `Dynamics2x2Axes` described below.
Class description:
Axes for 2x2 game dynamics. This class provides plotting functions for dynamics in two-player 2x2 games. Attributes: name: Used for projection keyword when creating a new axes.
Method signatures and docstrings:
- def cla(self): Clear the... | 6f3551fd990053cf2287b380fb9ad0b2a2607c18 | <|skeleton|>
class Dynamics2x2Axes:
"""Axes for 2x2 game dynamics. This class provides plotting functions for dynamics in two-player 2x2 games. Attributes: name: Used for projection keyword when creating a new axes."""
def cla(self):
"""Clear the current axes."""
<|body_0|>
def quiver(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dynamics2x2Axes:
"""Axes for 2x2 game dynamics. This class provides plotting functions for dynamics in two-player 2x2 games. Attributes: name: Used for projection keyword when creating a new axes."""
def cla(self):
"""Clear the current axes."""
super(Dynamics2x2Axes, self).cla()
s... | the_stack_v2_python_sparse | open_spiel/python/egt/visualization.py | sarahperrin/open_spiel | train | 3 |
f0e00689b0b336d446f081adff6fe29f2df2d1e3 | [
"self.state.hist_count = 0\nself.state.history_paths = []\nif self.args.history_path:\n self.state.history_paths.append(self.args.history_path)\nif not self.state.history_paths:\n self.state.history_paths = self.GuessHistoryPaths(self.args.username)\nif not self.state.history_paths:\n raise flow_base.FlowE... | <|body_start_0|>
self.state.hist_count = 0
self.state.history_paths = []
if self.args.history_path:
self.state.history_paths.append(self.args.history_path)
if not self.state.history_paths:
self.state.history_paths = self.GuessHistoryPaths(self.args.username)
... | Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Application Data\\\\ Google\\\\Chrome\\\\User Data\\\\Default Windows 7 or Vista c:\\\\... | ChromeHistory | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChromeHistory:
"""Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Application Data\\\\ Google\\\\Chrome\\\\User ... | stack_v2_sparse_classes_36k_train_023345 | 15,367 | permissive | [
{
"docstring": "Determine the Chrome directory.",
"name": "Start",
"signature": "def Start(self)"
},
{
"docstring": "Take each file we retrieved and get the history from it.",
"name": "ParseFiles",
"signature": "def ParseFiles(self, responses)"
},
{
"docstring": "Take a user and ... | 3 | stack_v2_sparse_classes_30k_train_001116 | Implement the Python class `ChromeHistory` described below.
Class description:
Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Applica... | Implement the Python class `ChromeHistory` described below.
Class description:
Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Applica... | 44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6 | <|skeleton|>
class ChromeHistory:
"""Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Application Data\\\\ Google\\\\Chrome\\\\User ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChromeHistory:
"""Retrieve and analyze the chrome history for a machine. Default directories as per: http://www.chromium.org/user-experience/user-data-directory Windows XP Google Chrome: c:\\\\Documents and Settings\\\\<username>\\\\Local Settings\\\\Application Data\\\\ Google\\\\Chrome\\\\User Data\\\\Defau... | the_stack_v2_python_sparse | grr/server/grr_response_server/flows/general/webhistory.py | google/grr | train | 4,683 |
cfe8803fb0d0878cc21ec74d87d8fab115e7ecf7 | [
"mock_data = [load_test_data('longurl.in', mock_files_prefix + f'_{i}') for i in range(mock_files_count)]\nmock_data.append(mock_data[-1])\n\ndef redirect_side_effect() -> dict:\n for d in mock_data:\n yield d\nmocker.patch.object(BaseClient, '_http_request', side_effect=redirect_side_effect())\nresult = ... | <|body_start_0|>
mock_data = [load_test_data('longurl.in', mock_files_prefix + f'_{i}') for i in range(mock_files_count)]
mock_data.append(mock_data[-1])
def redirect_side_effect() -> dict:
for d in mock_data:
yield d
mocker.patch.object(BaseClient, '_http_re... | TestLongurlInService | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestLongurlInService:
def test_nested_shortened_url(self, mocker, args: dict, mock_files_prefix: str, mock_files_count: int, expected_output: dict):
"""Given: Parameters for unshortening a URL that redirects to another shortened URL using longurl.in. When: Calling the `unshorten_url` fun... | stack_v2_sparse_classes_36k_train_023346 | 12,600 | permissive | [
{
"docstring": "Given: Parameters for unshortening a URL that redirects to another shortened URL using longurl.in. When: Calling the `unshorten_url` function. Then: Ensure the context output is returned as expected, and that redirect_limit is working as expected.",
"name": "test_nested_shortened_url",
"... | 2 | null | Implement the Python class `TestLongurlInService` described below.
Class description:
Implement the TestLongurlInService class.
Method signatures and docstrings:
- def test_nested_shortened_url(self, mocker, args: dict, mock_files_prefix: str, mock_files_count: int, expected_output: dict): Given: Parameters for unsho... | Implement the Python class `TestLongurlInService` described below.
Class description:
Implement the TestLongurlInService class.
Method signatures and docstrings:
- def test_nested_shortened_url(self, mocker, args: dict, mock_files_prefix: str, mock_files_count: int, expected_output: dict): Given: Parameters for unsho... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class TestLongurlInService:
def test_nested_shortened_url(self, mocker, args: dict, mock_files_prefix: str, mock_files_count: int, expected_output: dict):
"""Given: Parameters for unshortening a URL that redirects to another shortened URL using longurl.in. When: Calling the `unshorten_url` fun... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestLongurlInService:
def test_nested_shortened_url(self, mocker, args: dict, mock_files_prefix: str, mock_files_count: int, expected_output: dict):
"""Given: Parameters for unshortening a URL that redirects to another shortened URL using longurl.in. When: Calling the `unshorten_url` function. Then: E... | the_stack_v2_python_sparse | Packs/CommonScripts/Scripts/ResolveShortenedURL/ResolveShortenedURL_test.py | demisto/content | train | 1,023 | |
39e6e64596c1823b3457bfab50e9fd2fa7bc6a46 | [
"def sumasic(s1, s2):\n if s1 == s2:\n return 0\n sum = 0\n if len(s1) == 1 and len(s2) == 1:\n return ord(s1[0]) + ord(s2[0])\n if len(s1) == 0:\n for i in s2:\n sum += ord(i)\n return sum\n elif len(s2) == 0:\n for i in s1:\n sum += ord(i)\n ... | <|body_start_0|>
def sumasic(s1, s2):
if s1 == s2:
return 0
sum = 0
if len(s1) == 1 and len(s2) == 1:
return ord(s1[0]) + ord(s2[0])
if len(s1) == 0:
for i in s2:
sum += ord(i)
ret... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minimumDeleteSum_NG(self, s1, s2):
""":type s1: str :type s2: str :rtype: int"""
<|body_0|>
def minimumDeleteSum(self, s1, s2):
""":type s1: str :type s2: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def sumasic(s1, ... | stack_v2_sparse_classes_36k_train_023347 | 2,924 | no_license | [
{
"docstring": ":type s1: str :type s2: str :rtype: int",
"name": "minimumDeleteSum_NG",
"signature": "def minimumDeleteSum_NG(self, s1, s2)"
},
{
"docstring": ":type s1: str :type s2: str :rtype: int",
"name": "minimumDeleteSum",
"signature": "def minimumDeleteSum(self, s1, s2)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019023 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumDeleteSum_NG(self, s1, s2): :type s1: str :type s2: str :rtype: int
- def minimumDeleteSum(self, s1, s2): :type s1: str :type s2: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumDeleteSum_NG(self, s1, s2): :type s1: str :type s2: str :rtype: int
- def minimumDeleteSum(self, s1, s2): :type s1: str :type s2: str :rtype: int
<|skeleton|>
class S... | 0fdc1d60cfb3f4c26698a493da4986bfc873e02a | <|skeleton|>
class Solution:
def minimumDeleteSum_NG(self, s1, s2):
""":type s1: str :type s2: str :rtype: int"""
<|body_0|>
def minimumDeleteSum(self, s1, s2):
""":type s1: str :type s2: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minimumDeleteSum_NG(self, s1, s2):
""":type s1: str :type s2: str :rtype: int"""
def sumasic(s1, s2):
if s1 == s2:
return 0
sum = 0
if len(s1) == 1 and len(s2) == 1:
return ord(s1[0]) + ord(s2[0])
if ... | the_stack_v2_python_sparse | 712_MinimumASCIIDeleteSumforTwoStrings/712_MinimumASCIIDeleteSumforTwoStrings.py | ranson/leetcode | train | 0 | |
f65215ac41463ac956f793799d915bdf0df2d903 | [
"self.T_max = T_max\nself.T_mul = T_mul\nself.eta_min = eta_min\nself.cumulative_time = 0\nself.amplitude_mult = amplitude_reduction\nself.restarted_at = 0\nself.base_lr_mult = 1\nself.frequency_mult = 1\nself.time_offset = 0\nself.last_step = 0\nsuper(AlternatingCosineLR, self).__init__(optimizer, last_epoch)",
... | <|body_start_0|>
self.T_max = T_max
self.T_mul = T_mul
self.eta_min = eta_min
self.cumulative_time = 0
self.amplitude_mult = amplitude_reduction
self.restarted_at = 0
self.base_lr_mult = 1
self.frequency_mult = 1
self.time_offset = 0
self.l... | AlternatingCosineLR | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AlternatingCosineLR:
def __init__(self, optimizer, T_max, T_mul=1, amplitude_reduction=0.9, eta_min=0, last_epoch=-1):
"""Here last_epoch actually means last_step since the learning rate is decayed after each batch step."""
<|body_0|>
def get_lr(self):
"""Override th... | stack_v2_sparse_classes_36k_train_023348 | 14,014 | permissive | [
{
"docstring": "Here last_epoch actually means last_step since the learning rate is decayed after each batch step.",
"name": "__init__",
"signature": "def __init__(self, optimizer, T_max, T_mul=1, amplitude_reduction=0.9, eta_min=0, last_epoch=-1)"
},
{
"docstring": "Override this method to the ... | 2 | null | Implement the Python class `AlternatingCosineLR` described below.
Class description:
Implement the AlternatingCosineLR class.
Method signatures and docstrings:
- def __init__(self, optimizer, T_max, T_mul=1, amplitude_reduction=0.9, eta_min=0, last_epoch=-1): Here last_epoch actually means last_step since the learnin... | Implement the Python class `AlternatingCosineLR` described below.
Class description:
Implement the AlternatingCosineLR class.
Method signatures and docstrings:
- def __init__(self, optimizer, T_max, T_mul=1, amplitude_reduction=0.9, eta_min=0, last_epoch=-1): Here last_epoch actually means last_step since the learnin... | 6e72d5ba088981b89371f29773d243a211a4d068 | <|skeleton|>
class AlternatingCosineLR:
def __init__(self, optimizer, T_max, T_mul=1, amplitude_reduction=0.9, eta_min=0, last_epoch=-1):
"""Here last_epoch actually means last_step since the learning rate is decayed after each batch step."""
<|body_0|>
def get_lr(self):
"""Override th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AlternatingCosineLR:
def __init__(self, optimizer, T_max, T_mul=1, amplitude_reduction=0.9, eta_min=0, last_epoch=-1):
"""Here last_epoch actually means last_step since the learning rate is decayed after each batch step."""
self.T_max = T_max
self.T_mul = T_mul
self.eta_min = e... | the_stack_v2_python_sparse | autoPyTorch/components/lr_scheduler/lr_schedulers.py | ArlindKadra/Auto-PyTorch | train | 1 | |
319ba623a75442533f11ce437511fa7cd34a1f32 | [
"response = self.testapp.get('/')\nself.assertEqual(response.status_int, 302)\nself.assertIn('gallery', response.headers['location'])\nresponse.follow().mustcontain('Your personal tutor', 'Oppia - Gallery', 'About', 'Sign in', no=['Logout'])",
"response = self.testapp.get('/notifications_dashboard')\nself.assertE... | <|body_start_0|>
response = self.testapp.get('/')
self.assertEqual(response.status_int, 302)
self.assertIn('gallery', response.headers['location'])
response.follow().mustcontain('Your personal tutor', 'Oppia - Gallery', 'About', 'Sign in', no=['Logout'])
<|end_body_0|>
<|body_start_1|>
... | HomePageTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HomePageTest:
def test_logged_out_homepage(self):
"""Test the logged-out version of the home page."""
<|body_0|>
def test_notifications_dashboard_redirects_for_logged_out_users(self):
"""Test the logged-out view of the notifications dashboard."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_023349 | 10,835 | permissive | [
{
"docstring": "Test the logged-out version of the home page.",
"name": "test_logged_out_homepage",
"signature": "def test_logged_out_homepage(self)"
},
{
"docstring": "Test the logged-out view of the notifications dashboard.",
"name": "test_notifications_dashboard_redirects_for_logged_out_u... | 3 | stack_v2_sparse_classes_30k_train_012760 | Implement the Python class `HomePageTest` described below.
Class description:
Implement the HomePageTest class.
Method signatures and docstrings:
- def test_logged_out_homepage(self): Test the logged-out version of the home page.
- def test_notifications_dashboard_redirects_for_logged_out_users(self): Test the logged... | Implement the Python class `HomePageTest` described below.
Class description:
Implement the HomePageTest class.
Method signatures and docstrings:
- def test_logged_out_homepage(self): Test the logged-out version of the home page.
- def test_notifications_dashboard_redirects_for_logged_out_users(self): Test the logged... | 262c39b44e03ce4a98e3ab011200c8c6ee2a646a | <|skeleton|>
class HomePageTest:
def test_logged_out_homepage(self):
"""Test the logged-out version of the home page."""
<|body_0|>
def test_notifications_dashboard_redirects_for_logged_out_users(self):
"""Test the logged-out view of the notifications dashboard."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HomePageTest:
def test_logged_out_homepage(self):
"""Test the logged-out version of the home page."""
response = self.testapp.get('/')
self.assertEqual(response.status_int, 302)
self.assertIn('gallery', response.headers['location'])
response.follow().mustcontain('Your p... | the_stack_v2_python_sparse | core/controllers/home_test.py | ansarimofid/oppia | train | 2 | |
f6eabc8a08b00ca08ec6eae6491452c2401db6a2 | [
"self.id = id\nself.neighs = neighs\nif variance == 'false':\n self.data = data\nelse:\n n = old_div(np.sqrt(9 + 8 * (len(data) - 1)) - 3, 2)\n self.var = np.matrix(np.identity(n))\n index = n + 1\n for i in range(int(n)):\n for j in range(i + 1):\n self.var[i, j] = data[int(index)]... | <|body_start_0|>
self.id = id
self.neighs = neighs
if variance == 'false':
self.data = data
else:
n = old_div(np.sqrt(9 + 8 * (len(data) - 1)) - 3, 2)
self.var = np.matrix(np.identity(n))
index = n + 1
for i in range(int(n)):
... | Area Class for Regional Clustering. | AreaCl | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AreaCl:
"""Area Class for Regional Clustering."""
def __init__(self, id, neighs, data, variance='false'):
"""@type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: list. @param data: Data releated to the area. @type variance... | stack_v2_sparse_classes_36k_train_023350 | 2,124 | permissive | [
{
"docstring": "@type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: list. @param data: Data releated to the area. @type variance: boolean @keyword variance: Boolean indicating if the data have variance matrix",
"name": "__init__",
"signature... | 2 | stack_v2_sparse_classes_30k_train_018488 | Implement the Python class `AreaCl` described below.
Class description:
Area Class for Regional Clustering.
Method signatures and docstrings:
- def __init__(self, id, neighs, data, variance='false'): @type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: lis... | Implement the Python class `AreaCl` described below.
Class description:
Area Class for Regional Clustering.
Method signatures and docstrings:
- def __init__(self, id, neighs, data, variance='false'): @type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: lis... | 5c2600b048836e54495dc5997a250af72f72f6e7 | <|skeleton|>
class AreaCl:
"""Area Class for Regional Clustering."""
def __init__(self, id, neighs, data, variance='false'):
"""@type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: list. @param data: Data releated to the area. @type variance... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AreaCl:
"""Area Class for Regional Clustering."""
def __init__(self, id, neighs, data, variance='false'):
"""@type id: integer @param id: Id of the polygon/area @type neighs: list @param neighs: Neighborhood ids @type data: list. @param data: Data releated to the area. @type variance: boolean @ke... | the_stack_v2_python_sparse | clusterpy/core/toolboxes/cluster/componentsAlg/areacl.py | CentroGeo/clusterpy | train | 4 |
54b7e8e44014323b74024b48a00592d00bffc4e8 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction jobs. | JobServiceServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JobServiceServicer:
"""Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction jobs."""
def CreateJob(self, request,... | stack_v2_sparse_classes_36k_train_023351 | 4,689 | no_license | [
{
"docstring": "Creates a training or a batch prediction job.",
"name": "CreateJob",
"signature": "def CreateJob(self, request, context)"
},
{
"docstring": "Lists the jobs in the project.",
"name": "ListJobs",
"signature": "def ListJobs(self, request, context)"
},
{
"docstring": ... | 4 | stack_v2_sparse_classes_30k_train_003936 | Implement the Python class `JobServiceServicer` described below.
Class description:
Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction job... | Implement the Python class `JobServiceServicer` described below.
Class description:
Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction job... | d7424d21aa0dc121acc4d64b427ba365a3581a20 | <|skeleton|>
class JobServiceServicer:
"""Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction jobs."""
def CreateJob(self, request,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JobServiceServicer:
"""Copyright 2017 Google Inc. All Rights Reserved. Proto file for the Google Cloud Machine Learning Engine. Describes the 'job service' to manage training and prediction jobs. Service to create and manage training and batch prediction jobs."""
def CreateJob(self, request, context):
... | the_stack_v2_python_sparse | google/cloud/ml/v1/job_service_pb2_grpc.py | msachtler/bazel-event-protocol-parser | train | 1 |
b9eba7d515cd54628c5ef0b7208c2f9e8a1c01fb | [
"if head is None:\n return None\nresult_head = head\nodd_cur = head\neven_head = even_cur = head.next\nwhile even_cur is not None and even_cur.next is not None:\n tmp = odd_cur.next\n odd_cur.next = odd_cur.next.next\n if odd_cur.next is not None:\n odd_cur = odd_cur.next\n even_cur = tmp\n ... | <|body_start_0|>
if head is None:
return None
result_head = head
odd_cur = head
even_head = even_cur = head.next
while even_cur is not None and even_cur.next is not None:
tmp = odd_cur.next
odd_cur.next = odd_cur.next.next
if odd_cu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def oddEvenList2(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def oddEvenList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if head is None:
return ... | stack_v2_sparse_classes_36k_train_023352 | 1,764 | no_license | [
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "oddEvenList2",
"signature": "def oddEvenList2(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: ListNode",
"name": "oddEvenList",
"signature": "def oddEvenList(self, head)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014977 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def oddEvenList2(self, head): :type head: ListNode :rtype: ListNode
- def oddEvenList(self, head): :type head: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def oddEvenList2(self, head): :type head: ListNode :rtype: ListNode
- def oddEvenList(self, head): :type head: ListNode :rtype: ListNode
<|skeleton|>
class Solution:
def od... | 852fad258f5070c7b93c35252f7404e85e709ea6 | <|skeleton|>
class Solution:
def oddEvenList2(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_0|>
def oddEvenList(self, head):
""":type head: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def oddEvenList2(self, head):
""":type head: ListNode :rtype: ListNode"""
if head is None:
return None
result_head = head
odd_cur = head
even_head = even_cur = head.next
while even_cur is not None and even_cur.next is not None:
... | the_stack_v2_python_sparse | 301-400/328. Odd Even Linked List.py | SunnyMarkLiu/LeetCode | train | 1 | |
bd8d7b3c2d56e660a2091c3640acda404d5aa642 | [
"self._with_bkg_par = bool(with_bkg_par)\nself._t_start = float(t_start)\nself._exposure = float(exposure)\nself._seed = int(seed)\nself._simput = simput\nself._data_dir = data_dir\nself._tile_id = tile_id",
"try:\n os.makedirs(self._data_dir)\nexcept OSError as e:\n if e.errno != errno.EEXIST:\n rai... | <|body_start_0|>
self._with_bkg_par = bool(with_bkg_par)
self._t_start = float(t_start)
self._exposure = float(exposure)
self._seed = int(seed)
self._simput = simput
self._data_dir = data_dir
self._tile_id = tile_id
<|end_body_0|>
<|body_start_1|>
try:
... | SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up. | Simulator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Simulator:
"""SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up."""
def __init__(self, with_bkg_par, t_start, exposure, seed, simput, data_dir, tile_id):
""":param with_bkg_par: Simu... | stack_v2_sparse_classes_36k_train_023353 | 6,421 | no_license | [
{
"docstring": ":param with_bkg_par: Simulate with particle background. :param t_start: Start time of simulation. Input units of [s] :param exposure: Length of time to simulate for after t_start :param seed: Seed for random number generator. :param simput: Simput file (ie. the sky model)",
"name": "__init__... | 5 | stack_v2_sparse_classes_30k_train_009287 | Implement the Python class `Simulator` described below.
Class description:
SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up.
Method signatures and docstrings:
- def __init__(self, with_bkg_par, t_start, exposure, se... | Implement the Python class `Simulator` described below.
Class description:
SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up.
Method signatures and docstrings:
- def __init__(self, with_bkg_par, t_start, exposure, se... | 2b8ac686b1d445a39fcd28dbe07ef467c0b14c7e | <|skeleton|>
class Simulator:
"""SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up."""
def __init__(self, with_bkg_par, t_start, exposure, seed, simput, data_dir, tile_id):
""":param with_bkg_par: Simu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Simulator:
"""SIXTE simulator for eROSITA observations. 1. Compute GTI file for given simput 2. Simulate eROSITA observations of simput, using GTI to speed things up."""
def __init__(self, with_bkg_par, t_start, exposure, seed, simput, data_dir, tile_id):
""":param with_bkg_par: Simulate with par... | the_stack_v2_python_sparse | python/sixte/simulate_background_only.py | HuiboZhou/mocks_high_fidelity | train | 0 |
6af4fc4a84a3068c9e5130affe5e852a31ad774a | [
"uidhandler = getToolByName(self.parent, 'portal_uidhandler', None)\nif uidhandler is None:\n return\nuid = uidhandler.queryUid(self.old, default=None)\nif uid is not None:\n uidhandler.setUid(self.new, uid, check_uniqueness=False)",
"if not IReferenceable.providedBy(self.old):\n return\nuid = self.old.U... | <|body_start_0|>
uidhandler = getToolByName(self.parent, 'portal_uidhandler', None)
if uidhandler is None:
return
uid = uidhandler.queryUid(self.old, default=None)
if uid is not None:
uidhandler.setUid(self.new, uid, check_uniqueness=False)
<|end_body_0|>
<|body_... | Migrator class for migration CMF and AT uids | UIDMigrator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UIDMigrator:
"""Migrator class for migration CMF and AT uids"""
def migrate_cmf_uid(self):
"""Migrate CMF uids"""
<|body_0|>
def migrate_at_uuid(self):
"""Migrate AT universal uid"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
uidhandler = getT... | stack_v2_sparse_classes_36k_train_023354 | 21,547 | no_license | [
{
"docstring": "Migrate CMF uids",
"name": "migrate_cmf_uid",
"signature": "def migrate_cmf_uid(self)"
},
{
"docstring": "Migrate AT universal uid",
"name": "migrate_at_uuid",
"signature": "def migrate_at_uuid(self)"
}
] | 2 | null | Implement the Python class `UIDMigrator` described below.
Class description:
Migrator class for migration CMF and AT uids
Method signatures and docstrings:
- def migrate_cmf_uid(self): Migrate CMF uids
- def migrate_at_uuid(self): Migrate AT universal uid | Implement the Python class `UIDMigrator` described below.
Class description:
Migrator class for migration CMF and AT uids
Method signatures and docstrings:
- def migrate_cmf_uid(self): Migrate CMF uids
- def migrate_at_uuid(self): Migrate AT universal uid
<|skeleton|>
class UIDMigrator:
"""Migrator class for mig... | e137eb6225cc5e724bee74a892567796166134ac | <|skeleton|>
class UIDMigrator:
"""Migrator class for migration CMF and AT uids"""
def migrate_cmf_uid(self):
"""Migrate CMF uids"""
<|body_0|>
def migrate_at_uuid(self):
"""Migrate AT universal uid"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UIDMigrator:
"""Migrator class for migration CMF and AT uids"""
def migrate_cmf_uid(self):
"""Migrate CMF uids"""
uidhandler = getToolByName(self.parent, 'portal_uidhandler', None)
if uidhandler is None:
return
uid = uidhandler.queryUid(self.old, default=None)
... | the_stack_v2_python_sparse | eggs/Products.contentmigration-2.0.1-py2.7.egg/Products/contentmigration/basemigrator/migrator.py | nacho22martin/tesis | train | 0 |
8df795153cf949e4df8364b8356b2de635fb0c4e | [
"md = gl.get_value('md')\nalpha = round(md.T_Slider.value() / 100, 2)\nmd.label_TNOW.setText(str(alpha))",
"md = gl.get_value('md')\nR = round(md.R_Slider.value() / 100 * (26 - 18) + 18, 2)\nmd.label_RNOW.setText(str(R))",
"md = gl.get_value('md')\nK = round(md.K_Slider.value() / 100 + 1, 2)\nmd.label_KNOW.setT... | <|body_start_0|>
md = gl.get_value('md')
alpha = round(md.T_Slider.value() / 100, 2)
md.label_TNOW.setText(str(alpha))
<|end_body_0|>
<|body_start_1|>
md = gl.get_value('md')
R = round(md.R_Slider.value() / 100 * (26 - 18) + 18, 2)
md.label_RNOW.setText(str(R))
<|end_bod... | Label的工具类 用于更新整个页面的所有的label | LabelUtils | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LabelUtils:
"""Label的工具类 用于更新整个页面的所有的label"""
def update_label_TNOW():
"""根据透明度滑条, 更新透明度的label显示值 :return:"""
<|body_0|>
def update_label_RNOW():
"""根据消融半径滑条, 更新消融半径的label显示值 :return:"""
<|body_1|>
def update_label_KNOW():
"""根据长短轴比滑条, 更新长短轴比... | stack_v2_sparse_classes_36k_train_023355 | 2,156 | no_license | [
{
"docstring": "根据透明度滑条, 更新透明度的label显示值 :return:",
"name": "update_label_TNOW",
"signature": "def update_label_TNOW()"
},
{
"docstring": "根据消融半径滑条, 更新消融半径的label显示值 :return:",
"name": "update_label_RNOW",
"signature": "def update_label_RNOW()"
},
{
"docstring": "根据长短轴比滑条, 更新长短轴比的l... | 4 | null | Implement the Python class `LabelUtils` described below.
Class description:
Label的工具类 用于更新整个页面的所有的label
Method signatures and docstrings:
- def update_label_TNOW(): 根据透明度滑条, 更新透明度的label显示值 :return:
- def update_label_RNOW(): 根据消融半径滑条, 更新消融半径的label显示值 :return:
- def update_label_KNOW(): 根据长短轴比滑条, 更新长短轴比的label显示值 :retu... | Implement the Python class `LabelUtils` described below.
Class description:
Label的工具类 用于更新整个页面的所有的label
Method signatures and docstrings:
- def update_label_TNOW(): 根据透明度滑条, 更新透明度的label显示值 :return:
- def update_label_RNOW(): 根据消融半径滑条, 更新消融半径的label显示值 :return:
- def update_label_KNOW(): 根据长短轴比滑条, 更新长短轴比的label显示值 :retu... | 1b8e324dc99f932e4648e0a4bb8bdce0317f8542 | <|skeleton|>
class LabelUtils:
"""Label的工具类 用于更新整个页面的所有的label"""
def update_label_TNOW():
"""根据透明度滑条, 更新透明度的label显示值 :return:"""
<|body_0|>
def update_label_RNOW():
"""根据消融半径滑条, 更新消融半径的label显示值 :return:"""
<|body_1|>
def update_label_KNOW():
"""根据长短轴比滑条, 更新长短轴比... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LabelUtils:
"""Label的工具类 用于更新整个页面的所有的label"""
def update_label_TNOW():
"""根据透明度滑条, 更新透明度的label显示值 :return:"""
md = gl.get_value('md')
alpha = round(md.T_Slider.value() / 100, 2)
md.label_TNOW.setText(str(alpha))
def update_label_RNOW():
"""根据消融半径滑条, 更新消融半径的lab... | the_stack_v2_python_sparse | ablation-software/xyq_class/widgetutils/LabelUtils.py | USTLZh/student-projects | train | 0 |
aff56f0f8b72a7355a7a0ea667cd9f70a06d50b6 | [
"self.hdfs_entity_id = hdfs_entity_id\nself.kerberos_principal = kerberos_principal\nself.root_data_directory = root_data_directory\nself.zookeeper_quorum = zookeeper_quorum",
"if dictionary is None:\n return None\nhdfs_entity_id = dictionary.get('hdfsEntityId')\nkerberos_principal = dictionary.get('kerberosPr... | <|body_start_0|>
self.hdfs_entity_id = hdfs_entity_id
self.kerberos_principal = kerberos_principal
self.root_data_directory = root_data_directory
self.zookeeper_quorum = zookeeper_quorum
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
hdfs_... | Implementation of the 'HBaseConnectParams' model. Specifies an Object containing information about a registered HBase source. Attributes: hdfs_entity_id (long|int): The entity id of the HDFS source for this HBase kerberos_principal (string): Specifies the kerberos principal. root_data_directory (string): Specifies the ... | HBaseConnectParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HBaseConnectParams:
"""Implementation of the 'HBaseConnectParams' model. Specifies an Object containing information about a registered HBase source. Attributes: hdfs_entity_id (long|int): The entity id of the HDFS source for this HBase kerberos_principal (string): Specifies the kerberos principal... | stack_v2_sparse_classes_36k_train_023356 | 2,394 | permissive | [
{
"docstring": "Constructor for the HBaseConnectParams class",
"name": "__init__",
"signature": "def __init__(self, hdfs_entity_id=None, kerberos_principal=None, root_data_directory=None, zookeeper_quorum=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: diction... | 2 | null | Implement the Python class `HBaseConnectParams` described below.
Class description:
Implementation of the 'HBaseConnectParams' model. Specifies an Object containing information about a registered HBase source. Attributes: hdfs_entity_id (long|int): The entity id of the HDFS source for this HBase kerberos_principal (st... | Implement the Python class `HBaseConnectParams` described below.
Class description:
Implementation of the 'HBaseConnectParams' model. Specifies an Object containing information about a registered HBase source. Attributes: hdfs_entity_id (long|int): The entity id of the HDFS source for this HBase kerberos_principal (st... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class HBaseConnectParams:
"""Implementation of the 'HBaseConnectParams' model. Specifies an Object containing information about a registered HBase source. Attributes: hdfs_entity_id (long|int): The entity id of the HDFS source for this HBase kerberos_principal (string): Specifies the kerberos principal... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HBaseConnectParams:
"""Implementation of the 'HBaseConnectParams' model. Specifies an Object containing information about a registered HBase source. Attributes: hdfs_entity_id (long|int): The entity id of the HDFS source for this HBase kerberos_principal (string): Specifies the kerberos principal. root_data_d... | the_stack_v2_python_sparse | cohesity_management_sdk/models/hbase_connect_params.py | cohesity/management-sdk-python | train | 24 |
beee6414b6ded32cbaf6c999accc250ad5be4d5e | [
"numpy_functions = _delayed_numpy_functions()\nif func not in numpy_functions.HANDLED_FUNCTIONS:\n raise NotImplementedError('Using `{0}` with a Workflows {1} is not supported. If you want to use this function, you will first need to call `.compute` on your Workflows {1}.'.format(func.__name__, type(self).__name... | <|body_start_0|>
numpy_functions = _delayed_numpy_functions()
if func not in numpy_functions.HANDLED_FUNCTIONS:
raise NotImplementedError('Using `{0}` with a Workflows {1} is not supported. If you want to use this function, you will first need to call `.compute` on your Workflows {1}.'.forma... | NumPyMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumPyMixin:
def __array_function__(self, func, types, args, kwargs):
"""Override the behavior of a subset of NumPy functionality. Parameters ---------- func: The NumPy function object that was called types: Collection of unique argument types from the original NumPy function call that im... | stack_v2_sparse_classes_36k_train_023357 | 3,310 | permissive | [
{
"docstring": "Override the behavior of a subset of NumPy functionality. Parameters ---------- func: The NumPy function object that was called types: Collection of unique argument types from the original NumPy function call that implement `__array_function__` args: arguments directly passed from the original c... | 2 | stack_v2_sparse_classes_30k_train_013660 | Implement the Python class `NumPyMixin` described below.
Class description:
Implement the NumPyMixin class.
Method signatures and docstrings:
- def __array_function__(self, func, types, args, kwargs): Override the behavior of a subset of NumPy functionality. Parameters ---------- func: The NumPy function object that ... | Implement the Python class `NumPyMixin` described below.
Class description:
Implement the NumPyMixin class.
Method signatures and docstrings:
- def __array_function__(self, func, types, args, kwargs): Override the behavior of a subset of NumPy functionality. Parameters ---------- func: The NumPy function object that ... | 757b480efb8d58474a3bf07f1dbd90652b46ed64 | <|skeleton|>
class NumPyMixin:
def __array_function__(self, func, types, args, kwargs):
"""Override the behavior of a subset of NumPy functionality. Parameters ---------- func: The NumPy function object that was called types: Collection of unique argument types from the original NumPy function call that im... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumPyMixin:
def __array_function__(self, func, types, args, kwargs):
"""Override the behavior of a subset of NumPy functionality. Parameters ---------- func: The NumPy function object that was called types: Collection of unique argument types from the original NumPy function call that implement `__arr... | the_stack_v2_python_sparse | descarteslabs/workflows/types/mixins/numpy_mixin.py | carderne/descarteslabs-python | train | 0 | |
cecee4dd391786e0707cf6e0629d9aad46e9f7ba | [
"if type == 'city':\n return self.db.query(City.Fid, City.Fcity_name).filter(City.Ffather == father_id, City.Fdeleted == 0)\nif type == 'area':\n return self.db.query(Area.Fid, Area.Farea_name).filter(Area.Ffather == father_id, Area.Fdeleted == 0)\nif type == 'province':\n return self.db.query(Province.Fid... | <|body_start_0|>
if type == 'city':
return self.db.query(City.Fid, City.Fcity_name).filter(City.Ffather == father_id, City.Fdeleted == 0)
if type == 'area':
return self.db.query(Area.Fid, Area.Farea_name).filter(Area.Ffather == father_id, Area.Fdeleted == 0)
if type == 'p... | LocationServices | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocationServices:
def get_location_name_list(self, type, father_id=0):
""":param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称"""
<|body_0|>
def get_city_area_list(self, province_id=0, city_id=0):
""":param type: 查询的地区登记 province,city,area :para... | stack_v2_sparse_classes_36k_train_023358 | 4,110 | no_license | [
{
"docstring": ":param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称",
"name": "get_location_name_list",
"signature": "def get_location_name_list(self, type, father_id=0)"
},
{
"docstring": ":param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称",
"n... | 3 | stack_v2_sparse_classes_30k_train_015203 | Implement the Python class `LocationServices` described below.
Class description:
Implement the LocationServices class.
Method signatures and docstrings:
- def get_location_name_list(self, type, father_id=0): :param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称
- def get_city_area_list(self, pro... | Implement the Python class `LocationServices` described below.
Class description:
Implement the LocationServices class.
Method signatures and docstrings:
- def get_location_name_list(self, type, father_id=0): :param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称
- def get_city_area_list(self, pro... | 0596bcb429674b75243d343c73e0f022b6d86820 | <|skeleton|>
class LocationServices:
def get_location_name_list(self, type, father_id=0):
""":param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称"""
<|body_0|>
def get_city_area_list(self, province_id=0, city_id=0):
""":param type: 查询的地区登记 province,city,area :para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocationServices:
def get_location_name_list(self, type, father_id=0):
""":param type: 查询的地区登记 province,city,area :param father_id: :return: 地址id和名称"""
if type == 'city':
return self.db.query(City.Fid, City.Fcity_name).filter(City.Ffather == father_id, City.Fdeleted == 0)
i... | the_stack_v2_python_sparse | source/services/company/location_service.py | cash2one/gongzhuhao | train | 0 | |
799b63724fedd8494a4dc90f39c1e4f80c7ebc05 | [
"super(OneNet, self).__init__()\nself.conv = nn.Sequential(nn.Conv2d(n_channels, 64, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), nn.Conv2d(128, 2... | <|body_start_0|>
super(OneNet, self).__init__()
self.conv = nn.Sequential(nn.Conv2d(n_channels, 64, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2, padding=1), nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2, p... | This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward. | OneNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OneNet:
"""This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward."""
def __init__(self, n_channels, n_inputs, number_classes):
"""Initializes MLP object. Args: n_input... | stack_v2_sparse_classes_36k_train_023359 | 5,099 | no_license | [
{
"docstring": "Initializes MLP object. Args: n_inputs: number of inputs. n_hidden: list of ints, specifies the number of units in each linear layer. If the list is empty, the MLP will not have any linear layers, and the model will simply perform a multinomial logistic regression. n_classes: number of classes o... | 2 | null | Implement the Python class `OneNet` described below.
Class description:
This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward.
Method signatures and docstrings:
- def __init__(self, n_channels, n_input... | Implement the Python class `OneNet` described below.
Class description:
This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward.
Method signatures and docstrings:
- def __init__(self, n_channels, n_input... | b060caa315f0c066410da9580e64d6db0222f2a8 | <|skeleton|>
class OneNet:
"""This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward."""
def __init__(self, n_channels, n_inputs, number_classes):
"""Initializes MLP object. Args: n_input... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OneNet:
"""This class implements a Multi-layer Perceptron in PyTorch. It handles the different layers and parameters of the model. Once initialized an MLP object can perform forward."""
def __init__(self, n_channels, n_inputs, number_classes):
"""Initializes MLP object. Args: n_inputs: number of ... | the_stack_v2_python_sparse | STL-10/one_net/one_net_model.py | VCharatsidis/Unsupervised-Clustering | train | 1 |
6ac7ddbe33c3dc6c46306d2dae1c664e644ad1ac | [
"super(Agent_DQN, self).__init__(env)\nself.hparams = tf.contrib.training.HParams(n_actions=self.env.action_space.n, total_episode=100000, init_step=10000, exploration_step=1000000, epsilon_init=1.0, epsilon_min=0.025, n_obs=list(self.env.env.observation_space.shape), gamma=0.99, learning_rate=0.0001, use_dueling=F... | <|body_start_0|>
super(Agent_DQN, self).__init__(env)
self.hparams = tf.contrib.training.HParams(n_actions=self.env.action_space.n, total_episode=100000, init_step=10000, exploration_step=1000000, epsilon_init=1.0, epsilon_min=0.025, n_obs=list(self.env.env.observation_space.shape), gamma=0.99, learning... | Agent_DQN | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Agent_DQN:
def __init__(self, env, args):
"""Initialize every things you need here. For example: building your model"""
<|body_0|>
def init_game_setting(self):
"""Testing function will call this function at the begining of new game Put anything you want to initialize... | stack_v2_sparse_classes_36k_train_023360 | 13,991 | no_license | [
{
"docstring": "Initialize every things you need here. For example: building your model",
"name": "__init__",
"signature": "def __init__(self, env, args)"
},
{
"docstring": "Testing function will call this function at the begining of new game Put anything you want to initialize if necessary",
... | 4 | stack_v2_sparse_classes_30k_val_001171 | Implement the Python class `Agent_DQN` described below.
Class description:
Implement the Agent_DQN class.
Method signatures and docstrings:
- def __init__(self, env, args): Initialize every things you need here. For example: building your model
- def init_game_setting(self): Testing function will call this function a... | Implement the Python class `Agent_DQN` described below.
Class description:
Implement the Agent_DQN class.
Method signatures and docstrings:
- def __init__(self, env, args): Initialize every things you need here. For example: building your model
- def init_game_setting(self): Testing function will call this function a... | 5a3069ab61b6f35b1e890a38b91b99691a023b44 | <|skeleton|>
class Agent_DQN:
def __init__(self, env, args):
"""Initialize every things you need here. For example: building your model"""
<|body_0|>
def init_game_setting(self):
"""Testing function will call this function at the begining of new game Put anything you want to initialize... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Agent_DQN:
def __init__(self, env, args):
"""Initialize every things you need here. For example: building your model"""
super(Agent_DQN, self).__init__(env)
self.hparams = tf.contrib.training.HParams(n_actions=self.env.action_space.n, total_episode=100000, init_step=10000, exploration_... | the_stack_v2_python_sparse | rl/AtariGames/agent_dir/agent_dqn.py | TVect/VectorLab | train | 0 | |
9bd64b346155e8414bb6208b33ba7e20c6f1e48a | [
"self.lr = lr\nself.n_iterations = n_iterations\nself.w = None\nself.b = None",
"temp = []\nfor inx in X:\n if inx >= 0:\n temp.append(1.0 / (1 + np.exp(-inx)))\n else:\n temp.append(np.exp(inx) / (1 + np.exp(inx)))\nreturn np.array(temp)",
"limit = np.sqrt(1 / n_features)\nw = np.random.uni... | <|body_start_0|>
self.lr = lr
self.n_iterations = n_iterations
self.w = None
self.b = None
<|end_body_0|>
<|body_start_1|>
temp = []
for inx in X:
if inx >= 0:
temp.append(1.0 / (1 + np.exp(-inx)))
else:
temp.append... | 逻辑斯蒂回归模型 | LogisticRegression | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LogisticRegression:
"""逻辑斯蒂回归模型"""
def __init__(self, lr=0.1, n_iterations=4000):
"""lr是梯度下降的学习率,n_iteration是梯度下降的轮数"""
<|body_0|>
def _sigmoid(self, X):
"""sigmoid的函数"""
<|body_1|>
def initialize_weights(self, n_features):
"""参数初始化"""
... | stack_v2_sparse_classes_36k_train_023361 | 4,299 | no_license | [
{
"docstring": "lr是梯度下降的学习率,n_iteration是梯度下降的轮数",
"name": "__init__",
"signature": "def __init__(self, lr=0.1, n_iterations=4000)"
},
{
"docstring": "sigmoid的函数",
"name": "_sigmoid",
"signature": "def _sigmoid(self, X)"
},
{
"docstring": "参数初始化",
"name": "initialize_weights",... | 5 | stack_v2_sparse_classes_30k_train_012642 | Implement the Python class `LogisticRegression` described below.
Class description:
逻辑斯蒂回归模型
Method signatures and docstrings:
- def __init__(self, lr=0.1, n_iterations=4000): lr是梯度下降的学习率,n_iteration是梯度下降的轮数
- def _sigmoid(self, X): sigmoid的函数
- def initialize_weights(self, n_features): 参数初始化
- def fit(self, X, Y): 训... | Implement the Python class `LogisticRegression` described below.
Class description:
逻辑斯蒂回归模型
Method signatures and docstrings:
- def __init__(self, lr=0.1, n_iterations=4000): lr是梯度下降的学习率,n_iteration是梯度下降的轮数
- def _sigmoid(self, X): sigmoid的函数
- def initialize_weights(self, n_features): 参数初始化
- def fit(self, X, Y): 训... | ca0d43c9ba8ff7d1353606ba893291e3bf10f9e7 | <|skeleton|>
class LogisticRegression:
"""逻辑斯蒂回归模型"""
def __init__(self, lr=0.1, n_iterations=4000):
"""lr是梯度下降的学习率,n_iteration是梯度下降的轮数"""
<|body_0|>
def _sigmoid(self, X):
"""sigmoid的函数"""
<|body_1|>
def initialize_weights(self, n_features):
"""参数初始化"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LogisticRegression:
"""逻辑斯蒂回归模型"""
def __init__(self, lr=0.1, n_iterations=4000):
"""lr是梯度下降的学习率,n_iteration是梯度下降的轮数"""
self.lr = lr
self.n_iterations = n_iterations
self.w = None
self.b = None
def _sigmoid(self, X):
"""sigmoid的函数"""
temp = []
... | the_stack_v2_python_sparse | LR/src/LogisticRegression.py | damo894127201/MachineLearning | train | 4 |
465f8b897f052ec87ff76eaa6c5d2d945a2929ad | [
"Inventory.__init__(self, product_code, description, market_price, rental_price)\nself.brand = brand\nself.voltage = voltage",
"output_dict = {}\noutput_dict['product_code'] = self.product_code\noutput_dict['description'] = self.description\noutput_dict['market_price'] = self.market_price\noutput_dict['rental_pri... | <|body_start_0|>
Inventory.__init__(self, product_code, description, market_price, rental_price)
self.brand = brand
self.voltage = voltage
<|end_body_0|>
<|body_start_1|>
output_dict = {}
output_dict['product_code'] = self.product_code
output_dict['description'] = self.d... | Contains all information about electronic appliances | ElectricAppliances | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElectricAppliances:
"""Contains all information about electronic appliances"""
def __init__(self, product_code, description, market_price, rental_price, brand, voltage):
"""Initializes class"""
<|body_0|>
def return_as_dictionary(self):
"""Returns dict with Elect... | stack_v2_sparse_classes_36k_train_023362 | 2,040 | no_license | [
{
"docstring": "Initializes class",
"name": "__init__",
"signature": "def __init__(self, product_code, description, market_price, rental_price, brand, voltage)"
},
{
"docstring": "Returns dict with Electric App information",
"name": "return_as_dictionary",
"signature": "def return_as_dic... | 2 | stack_v2_sparse_classes_30k_train_012818 | Implement the Python class `ElectricAppliances` described below.
Class description:
Contains all information about electronic appliances
Method signatures and docstrings:
- def __init__(self, product_code, description, market_price, rental_price, brand, voltage): Initializes class
- def return_as_dictionary(self): Re... | Implement the Python class `ElectricAppliances` described below.
Class description:
Contains all information about electronic appliances
Method signatures and docstrings:
- def __init__(self, product_code, description, market_price, rental_price, brand, voltage): Initializes class
- def return_as_dictionary(self): Re... | 99271cd60485bd2e54f8d133c9057a2ccd6c91c2 | <|skeleton|>
class ElectricAppliances:
"""Contains all information about electronic appliances"""
def __init__(self, product_code, description, market_price, rental_price, brand, voltage):
"""Initializes class"""
<|body_0|>
def return_as_dictionary(self):
"""Returns dict with Elect... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ElectricAppliances:
"""Contains all information about electronic appliances"""
def __init__(self, product_code, description, market_price, rental_price, brand, voltage):
"""Initializes class"""
Inventory.__init__(self, product_code, description, market_price, rental_price)
self.br... | the_stack_v2_python_sparse | students/Zach Cooper/lesson01/inventory_management/electricAppliancesClass.py | zconn/PythonCert220Assign | train | 2 |
900f1ade5ca7d4173ffcd286665905fd7d2cf5f4 | [
"self.domid = domid\nself.mbid = domid\nself.atwd = [None, None, None, None]\nif buf is not None:\n self.decode(buf)",
"io = StringIO(buf)\ndecotup = struct.unpack('>2H6B6s', io.read(16))\nself.domclk = struct.unpack('>q', '\\x00\\x00' + decotup[8])[0]\nself.atwd_chip = decotup[2] & 1\nself.evt_trig_flag = dec... | <|body_start_0|>
self.domid = domid
self.mbid = domid
self.atwd = [None, None, None, None]
if buf is not None:
self.decode(buf)
<|end_body_0|>
<|body_start_1|>
io = StringIO(buf)
decotup = struct.unpack('>2H6B6s', io.read(16))
self.domclk = struct.unp... | DOM hit data structure - data members domhit.domid domhit.domclk domhit.atwd[i][j] - jth sample of atwd channel i (0..3) domhit.atwd_chip - 0 if atwd-a, 1 if atwd-b domhit.fadc[i] - ith FADC sample | domhit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class domhit:
"""DOM hit data structure - data members domhit.domid domhit.domclk domhit.atwd[i][j] - jth sample of atwd channel i (0..3) domhit.atwd_chip - 0 if atwd-a, 1 if atwd-b domhit.fadc[i] - ith FADC sample"""
def __init__(self, domid, buf=None):
"""Init the d/s - fill in fields /w... | stack_v2_sparse_classes_36k_train_023363 | 2,212 | no_license | [
{
"docstring": "Init the d/s - fill in fields /w/ blanks.",
"name": "__init__",
"signature": "def __init__(self, domid, buf=None)"
},
{
"docstring": "Decode the domhit data structure from engineering record.",
"name": "decode",
"signature": "def decode(self, buf)"
}
] | 2 | null | Implement the Python class `domhit` described below.
Class description:
DOM hit data structure - data members domhit.domid domhit.domclk domhit.atwd[i][j] - jth sample of atwd channel i (0..3) domhit.atwd_chip - 0 if atwd-a, 1 if atwd-b domhit.fadc[i] - ith FADC sample
Method signatures and docstrings:
- def __init__... | Implement the Python class `domhit` described below.
Class description:
DOM hit data structure - data members domhit.domid domhit.domclk domhit.atwd[i][j] - jth sample of atwd channel i (0..3) domhit.atwd_chip - 0 if atwd-a, 1 if atwd-b domhit.fadc[i] - ith FADC sample
Method signatures and docstrings:
- def __init__... | 13cb63ba2390bbd49facb2d9093da528ae52cd91 | <|skeleton|>
class domhit:
"""DOM hit data structure - data members domhit.domid domhit.domclk domhit.atwd[i][j] - jth sample of atwd channel i (0..3) domhit.atwd_chip - 0 if atwd-a, 1 if atwd-b domhit.fadc[i] - ith FADC sample"""
def __init__(self, domid, buf=None):
"""Init the d/s - fill in fields /w... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class domhit:
"""DOM hit data structure - data members domhit.domid domhit.domclk domhit.atwd[i][j] - jth sample of atwd channel i (0..3) domhit.atwd_chip - 0 if atwd-a, 1 if atwd-b domhit.fadc[i] - ith FADC sample"""
def __init__(self, domid, buf=None):
"""Init the d/s - fill in fields /w/ blanks."""
... | the_stack_v2_python_sparse | icecube/daq/hits.py | dglo/PyDOM | train | 0 |
e5c29bae50d7d74e28ecdf98fd623de321ccfafe | [
"parser.add_argument('--batch_size', nargs='?', type=int, default=64, help='batch_size for experiment')\nparser.add_argument('--epochs', type=int, nargs='?', default=100, help='Number of epochs to train for')\nparser.add_argument('--logs_path', type=str, nargs='?', default='classification_logs/', help='Experiment l... | <|body_start_0|>
parser.add_argument('--batch_size', nargs='?', type=int, default=64, help='batch_size for experiment')
parser.add_argument('--epochs', type=int, nargs='?', default=100, help='Number of epochs to train for')
parser.add_argument('--logs_path', type=str, nargs='?', default='classif... | ParserClass | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ParserClass:
def __init__(self, parser):
"""Parses arguments and saves them in the Parser Class :param parser: A parser to get input from"""
<|body_0|>
def get_argument_variables(self):
"""Processes the parsed arguments and produces variables of specific types needed... | stack_v2_sparse_classes_36k_train_023364 | 5,172 | permissive | [
{
"docstring": "Parses arguments and saves them in the Parser Class :param parser: A parser to get input from",
"name": "__init__",
"signature": "def __init__(self, parser)"
},
{
"docstring": "Processes the parsed arguments and produces variables of specific types needed for the experiments :ret... | 2 | null | Implement the Python class `ParserClass` described below.
Class description:
Implement the ParserClass class.
Method signatures and docstrings:
- def __init__(self, parser): Parses arguments and saves them in the Parser Class :param parser: A parser to get input from
- def get_argument_variables(self): Processes the ... | Implement the Python class `ParserClass` described below.
Class description:
Implement the ParserClass class.
Method signatures and docstrings:
- def __init__(self, parser): Parses arguments and saves them in the Parser Class :param parser: A parser to get input from
- def get_argument_variables(self): Processes the ... | 2831df3ef210cb3e259bbc43dd39159533f4a33e | <|skeleton|>
class ParserClass:
def __init__(self, parser):
"""Parses arguments and saves them in the Parser Class :param parser: A parser to get input from"""
<|body_0|>
def get_argument_variables(self):
"""Processes the parsed arguments and produces variables of specific types needed... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ParserClass:
def __init__(self, parser):
"""Parses arguments and saves them in the Parser Class :param parser: A parser to get input from"""
parser.add_argument('--batch_size', nargs='?', type=int, default=64, help='batch_size for experiment')
parser.add_argument('--epochs', type=int, ... | the_stack_v2_python_sparse | utils/parser_utils.py | comRamona/ACL-2018-Multimodal-Sentiment-Analysis-Multicomp | train | 0 | |
77b4715e2be851d7a64fa61dbac030c6c0a2d4f0 | [
"if isinstance(key, int):\n return ReturnCode(key)\nif key not in ReturnCode._member_map_:\n extend_enum(ReturnCode, key, default)\nreturn ReturnCode[key]",
"if not (isinstance(value, int) and 100 <= value <= 659):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\ncode = str(value)\nkin... | <|body_start_0|>
if isinstance(key, int):
return ReturnCode(key)
if key not in ReturnCode._member_map_:
extend_enum(ReturnCode, key, default)
return ReturnCode[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 100 <= value <= 659):
... | [ReturnCode] FTP Server Return Code | ReturnCode | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReturnCode:
"""[ReturnCode] FTP Server Return Code"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_skeleton|>
<|body_start... | stack_v2_sparse_classes_36k_train_023365 | 5,538 | permissive | [
{
"docstring": "Backport support for original codes.",
"name": "get",
"signature": "def get(key, default=-1)"
},
{
"docstring": "Lookup function used when value is not found.",
"name": "_missing_",
"signature": "def _missing_(cls, value)"
}
] | 2 | null | Implement the Python class `ReturnCode` described below.
Class description:
[ReturnCode] FTP Server Return Code
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found. | Implement the Python class `ReturnCode` described below.
Class description:
[ReturnCode] FTP Server Return Code
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found.
<|skeleton|>
class ReturnCode:
... | 90cd07d67df28d5c5ab0585bc60f467a78d9db33 | <|skeleton|>
class ReturnCode:
"""[ReturnCode] FTP Server Return Code"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReturnCode:
"""[ReturnCode] FTP Server Return Code"""
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return ReturnCode(key)
if key not in ReturnCode._member_map_:
extend_enum(ReturnCode, key, default)
r... | the_stack_v2_python_sparse | pcapkit/const/ftp/return_code.py | stjordanis/PyPCAPKit | train | 0 |
db93b36af6879d2435dd4b7f33801a5cb5b39192 | [
"self.score = 0\nself.food = food[::-1]\nself.height = height\nself.width = width\nself.ocup = {(0, 0): True}\nself.snake = deque([(0, 0)])",
"directions = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)}\ncuri, curj = self.snake[-1]\ndi, dj = directions[direction]\nnewi, newj = (curi + di, curj + dj)\nif n... | <|body_start_0|>
self.score = 0
self.food = food[::-1]
self.height = height
self.width = width
self.ocup = {(0, 0): True}
self.snake = deque([(0, 0)])
<|end_body_0|>
<|body_start_1|>
directions = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)}
curi... | SnakeGame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_36k_train_023366 | 1,929 | no_license | [
{
"docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].",
"name": "__init__",
"signature": "def __init__(self, widt... | 2 | null | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | 90fd00246707b23d60a5d13b5a89d5b5f64ad008 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a... | the_stack_v2_python_sparse | python_solution/0353.py | Dongzi-dq394/leetcode | train | 0 | |
b7bbeaae4b6a0ba882a463695a6064b1e4755a57 | [
"if not self.formset:\n raise ImproperlyConfigured(\"You must specify formset in '{class_name}' to configure '{mixin_name}'\".format(class_name=self.__class__, mixin_name=__class__.__name__))\ncontext_data = super().get_context_data(*args, **kwargs)\nqueryset = self.formset.model.objects.filter(**{self.formset.f... | <|body_start_0|>
if not self.formset:
raise ImproperlyConfigured("You must specify formset in '{class_name}' to configure '{mixin_name}'".format(class_name=self.__class__, mixin_name=__class__.__name__))
context_data = super().get_context_data(*args, **kwargs)
queryset = self.formset... | Добавляет formset в контекст формы. | SingleFormSetMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SingleFormSetMixin:
"""Добавляет formset в контекст формы."""
def get_context_data(self, *args, **kwargs):
"""Добавляет formset в контекст."""
<|body_0|>
def form_valid(self, form):
"""Сохраняет formset."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_023367 | 8,263 | permissive | [
{
"docstring": "Добавляет formset в контекст.",
"name": "get_context_data",
"signature": "def get_context_data(self, *args, **kwargs)"
},
{
"docstring": "Сохраняет formset.",
"name": "form_valid",
"signature": "def form_valid(self, form)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019292 | Implement the Python class `SingleFormSetMixin` described below.
Class description:
Добавляет formset в контекст формы.
Method signatures and docstrings:
- def get_context_data(self, *args, **kwargs): Добавляет formset в контекст.
- def form_valid(self, form): Сохраняет formset. | Implement the Python class `SingleFormSetMixin` described below.
Class description:
Добавляет formset в контекст формы.
Method signatures and docstrings:
- def get_context_data(self, *args, **kwargs): Добавляет formset в контекст.
- def form_valid(self, form): Сохраняет formset.
<|skeleton|>
class SingleFormSetMixin... | 7246b4f524d138d48aadf4866e0b218bb924f69c | <|skeleton|>
class SingleFormSetMixin:
"""Добавляет formset в контекст формы."""
def get_context_data(self, *args, **kwargs):
"""Добавляет formset в контекст."""
<|body_0|>
def form_valid(self, form):
"""Сохраняет formset."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SingleFormSetMixin:
"""Добавляет formset в контекст формы."""
def get_context_data(self, *args, **kwargs):
"""Добавляет formset в контекст."""
if not self.formset:
raise ImproperlyConfigured("You must specify formset in '{class_name}' to configure '{mixin_name}'".format(class_... | the_stack_v2_python_sparse | locker/core/views.py | crowmurk/locker | train | 0 |
347c49c263a75290ac4e2e3b5e45637224617001 | [
"if bn.get_user(test_user.email):\n bn.delete_user(test_user.email)\nself.open(base_url + '/logout')\nself.open(base_url + '/register')\nself.type('#email', test_user.email)\nself.type('#name', test_user.name)\nself.type('#password', test_user.password)\nself.type('#password2', test_user.password)\nself.click('i... | <|body_start_0|>
if bn.get_user(test_user.email):
bn.delete_user(test_user.email)
self.open(base_url + '/logout')
self.open(base_url + '/register')
self.type('#email', test_user.email)
self.type('#name', test_user.name)
self.type('#password', test_user.passwor... | integrationTestSignupPost | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class integrationTestSignupPost:
def test_register(self):
"""This tests that the user register as a new user"""
<|body_0|>
def test_login(self):
"""This tests that the user can log in"""
<|body_1|>
def test_integration(self):
"""This tests that the use... | stack_v2_sparse_classes_36k_train_023368 | 3,723 | permissive | [
{
"docstring": "This tests that the user register as a new user",
"name": "test_register",
"signature": "def test_register(self)"
},
{
"docstring": "This tests that the user can log in",
"name": "test_login",
"signature": "def test_login(self)"
},
{
"docstring": "This tests that ... | 3 | stack_v2_sparse_classes_30k_train_003277 | Implement the Python class `integrationTestSignupPost` described below.
Class description:
Implement the integrationTestSignupPost class.
Method signatures and docstrings:
- def test_register(self): This tests that the user register as a new user
- def test_login(self): This tests that the user can log in
- def test_... | Implement the Python class `integrationTestSignupPost` described below.
Class description:
Implement the integrationTestSignupPost class.
Method signatures and docstrings:
- def test_register(self): This tests that the user register as a new user
- def test_login(self): This tests that the user can log in
- def test_... | 582e00a4c16016e545fedcbb14a745d125db94e0 | <|skeleton|>
class integrationTestSignupPost:
def test_register(self):
"""This tests that the user register as a new user"""
<|body_0|>
def test_login(self):
"""This tests that the user can log in"""
<|body_1|>
def test_integration(self):
"""This tests that the use... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class integrationTestSignupPost:
def test_register(self):
"""This tests that the user register as a new user"""
if bn.get_user(test_user.email):
bn.delete_user(test_user.email)
self.open(base_url + '/logout')
self.open(base_url + '/register')
self.type('#email', t... | the_stack_v2_python_sparse | qa327_test/integration/test_signup_post.py | GraemeBadley/QA-Project | train | 0 | |
5b559883102438a230447a3b8a2ba732529dba47 | [
"try:\n if not isinstance(data['caseProject_id'], int):\n return JsonResponse(code='999996', msg='参数有误!')\nexcept KeyError:\n return JsonResponse(code='999996', msg='参数有误!')",
"data = JSONParser().parse(request)\nresult = self.parameter_check(data)\nif result:\n return result\ntry:\n pro_data =... | <|body_start_0|>
try:
if not isinstance(data['caseProject_id'], int):
return JsonResponse(code='999996', msg='参数有误!')
except KeyError:
return JsonResponse(code='999996', msg='参数有误!')
<|end_body_0|>
<|body_start_1|>
data = JSONParser().parse(request)
... | DelEmail | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DelEmail:
def parameter_check(self, data):
"""校验参数 :param data: :return:"""
<|body_0|>
def post(self, request):
"""删除邮箱配置 :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
if not isinstance(data['caseProject_i... | stack_v2_sparse_classes_36k_train_023369 | 7,584 | no_license | [
{
"docstring": "校验参数 :param data: :return:",
"name": "parameter_check",
"signature": "def parameter_check(self, data)"
},
{
"docstring": "删除邮箱配置 :param request: :return:",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000184 | Implement the Python class `DelEmail` described below.
Class description:
Implement the DelEmail class.
Method signatures and docstrings:
- def parameter_check(self, data): 校验参数 :param data: :return:
- def post(self, request): 删除邮箱配置 :param request: :return: | Implement the Python class `DelEmail` described below.
Class description:
Implement the DelEmail class.
Method signatures and docstrings:
- def parameter_check(self, data): 校验参数 :param data: :return:
- def post(self, request): 删除邮箱配置 :param request: :return:
<|skeleton|>
class DelEmail:
def parameter_check(self... | d65297b71ac9f759d508985ee15564162c285e11 | <|skeleton|>
class DelEmail:
def parameter_check(self, data):
"""校验参数 :param data: :return:"""
<|body_0|>
def post(self, request):
"""删除邮箱配置 :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DelEmail:
def parameter_check(self, data):
"""校验参数 :param data: :return:"""
try:
if not isinstance(data['caseProject_id'], int):
return JsonResponse(code='999996', msg='参数有误!')
except KeyError:
return JsonResponse(code='999996', msg='参数有误!')
... | the_stack_v2_python_sparse | automation-test_new/api_test/case/caseProjectMember.py | beitou/django_api_test | train | 0 | |
2f6ba4cc20176528312b371586d926ac57a78300 | [
"iter1 = iter(tt)\niter2 = iter(tt)\nself.assertEquals(lines[0], iter1.next())\nself.assertEquals(lines[0], iter2.next())\nself.assertEquals(lines[1], iter2.next())\nfor ix, line in enumerate(tt):\n self.assertEquals(lines[ix], line)\nfor i in xrange(len(tt)):\n self.assertEquals(lines[i], tt.GetInputs(i))\ns... | <|body_start_0|>
iter1 = iter(tt)
iter2 = iter(tt)
self.assertEquals(lines[0], iter1.next())
self.assertEquals(lines[0], iter2.next())
self.assertEquals(lines[1], iter2.next())
for ix, line in enumerate(tt):
self.assertEquals(lines[ix], line)
for i in ... | Test TruthTable functionality. | TruthTableTest | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TruthTableTest:
"""Test TruthTable functionality."""
def _TestTableSanity(self, tt, lines):
"""Run the given truth table through basic sanity checks. Args: tt: A TruthTable object. lines: The expect input lines, in order (list of tuples)."""
<|body_0|>
def testTwoDimensi... | stack_v2_sparse_classes_36k_train_023370 | 9,390 | permissive | [
{
"docstring": "Run the given truth table through basic sanity checks. Args: tt: A TruthTable object. lines: The expect input lines, in order (list of tuples).",
"name": "_TestTableSanity",
"signature": "def _TestTableSanity(self, tt, lines)"
},
{
"docstring": "Test TruthTable behavior for two b... | 3 | stack_v2_sparse_classes_30k_train_009484 | Implement the Python class `TruthTableTest` described below.
Class description:
Test TruthTable functionality.
Method signatures and docstrings:
- def _TestTableSanity(self, tt, lines): Run the given truth table through basic sanity checks. Args: tt: A TruthTable object. lines: The expect input lines, in order (list ... | Implement the Python class `TruthTableTest` described below.
Class description:
Test TruthTable functionality.
Method signatures and docstrings:
- def _TestTableSanity(self, tt, lines): Run the given truth table through basic sanity checks. Args: tt: A TruthTable object. lines: The expect input lines, in order (list ... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class TruthTableTest:
"""Test TruthTable functionality."""
def _TestTableSanity(self, tt, lines):
"""Run the given truth table through basic sanity checks. Args: tt: A TruthTable object. lines: The expect input lines, in order (list of tuples)."""
<|body_0|>
def testTwoDimensi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TruthTableTest:
"""Test TruthTable functionality."""
def _TestTableSanity(self, tt, lines):
"""Run the given truth table through basic sanity checks. Args: tt: A TruthTable object. lines: The expect input lines, in order (list of tuples)."""
iter1 = iter(tt)
iter2 = iter(tt)
... | the_stack_v2_python_sparse | third_party/chromite/lib/cros_test_lib_unittest.py | metux/chromium-suckless | train | 5 |
359b15ff803de97b0aeb235956aee0ab54090d39 | [
"super().__init__(**kwargs)\nself.units = units\nself.num_steps = num_steps\nself.lstm = tf.keras.layers.LSTM(units=units, stateful=False, return_state=True)\nself.dense = tf.keras.layers.Dense(units=units)\nself.field = field",
"field = graph[getattr(Index, self.field.upper())]\nfield = self.dense(field)\nn_stru... | <|body_start_0|>
super().__init__(**kwargs)
self.units = units
self.num_steps = num_steps
self.lstm = tf.keras.layers.LSTM(units=units, stateful=False, return_state=True)
self.dense = tf.keras.layers.Dense(units=units)
self.field = field
<|end_body_0|>
<|body_start_1|>
... | The Set2Set readout function | Set2Set | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Set2Set:
"""The Set2Set readout function"""
def __init__(self, units: int, num_steps: int, field: str, **kwargs):
"""Args: units (int): number of neurons in the set2set layer num_steps (int): number of LSTM steps field (str): the field of MaterialGraph to perform the readout **kwargs... | stack_v2_sparse_classes_36k_train_023371 | 8,087 | permissive | [
{
"docstring": "Args: units (int): number of neurons in the set2set layer num_steps (int): number of LSTM steps field (str): the field of MaterialGraph to perform the readout **kwargs:",
"name": "__init__",
"signature": "def __init__(self, units: int, num_steps: int, field: str, **kwargs)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_009503 | Implement the Python class `Set2Set` described below.
Class description:
The Set2Set readout function
Method signatures and docstrings:
- def __init__(self, units: int, num_steps: int, field: str, **kwargs): Args: units (int): number of neurons in the set2set layer num_steps (int): number of LSTM steps field (str): t... | Implement the Python class `Set2Set` described below.
Class description:
The Set2Set readout function
Method signatures and docstrings:
- def __init__(self, units: int, num_steps: int, field: str, **kwargs): Args: units (int): number of neurons in the set2set layer num_steps (int): number of LSTM steps field (str): t... | 1f89ecb564b2691c810cd106c3476b15a8699bb7 | <|skeleton|>
class Set2Set:
"""The Set2Set readout function"""
def __init__(self, units: int, num_steps: int, field: str, **kwargs):
"""Args: units (int): number of neurons in the set2set layer num_steps (int): number of LSTM steps field (str): the field of MaterialGraph to perform the readout **kwargs... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Set2Set:
"""The Set2Set readout function"""
def __init__(self, units: int, num_steps: int, field: str, **kwargs):
"""Args: units (int): number of neurons in the set2set layer num_steps (int): number of LSTM steps field (str): the field of MaterialGraph to perform the readout **kwargs:"""
... | the_stack_v2_python_sparse | m3gnet/layers/_readout.py | materialsvirtuallab/m3gnet | train | 175 |
6e3d45fa4b81340a1eeea23533780054804ca0b7 | [
"if isinstance(data, str):\n data = json.loads(data)\ntry:\n customer = QueryCustomersModel.objects.get(id=data['id'])\n customer.update(name=data.get('name', customer.name), phone=data.get('phone', customer.phone), email=data.get('email', customer.email), full_name=data.get('full_name', customer.full_name... | <|body_start_0|>
if isinstance(data, str):
data = json.loads(data)
try:
customer = QueryCustomersModel.objects.get(id=data['id'])
customer.update(name=data.get('name', customer.name), phone=data.get('phone', customer.phone), email=data.get('email', customer.email), fu... | Query | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Query:
def normalize_db(self, data):
"""with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add the record to the query database"""
<|body_0|>
def list(self, num_page=1, limit=... | stack_v2_sparse_classes_36k_train_023372 | 12,821 | no_license | [
{
"docstring": "with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add the record to the query database",
"name": "normalize_db",
"signature": "def normalize_db(self, data)"
},
{
"docstring": "ret... | 3 | stack_v2_sparse_classes_30k_train_015743 | Implement the Python class `Query` described below.
Class description:
Implement the Query class.
Method signatures and docstrings:
- def normalize_db(self, data): with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add... | Implement the Python class `Query` described below.
Class description:
Implement the Query class.
Method signatures and docstrings:
- def normalize_db(self, data): with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add... | 3f4c93c631e5d5b52acd2ce11e220ff3fbec07b6 | <|skeleton|>
class Query:
def normalize_db(self, data):
"""with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add the record to the query database"""
<|body_0|>
def list(self, num_page=1, limit=... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Query:
def normalize_db(self, data):
"""with the incoming payload: check to see if the record already exists in the query database if so, updated it with the new replicated values, otherwise add the record to the query database"""
if isinstance(data, str):
data = json.loads(data)
... | the_stack_v2_python_sparse | customers/customers/service.py | bsmi021/eahub_shopco | train | 0 | |
105672e66eb8bee3a5cfb49e473e97e855b6ed28 | [
"is_manager(request)\ntask_qs = Task.objects.select_related('manager').prefetch_related('agent_list').filter(id=pk)\nif len(task_qs) < 1:\n return Response({'detail': 'Task not found!'}, status=400)\ntask = task_qs[0]\nself.check_object_permissions(request, task)\ntask_data = get_task_details(task)\nreturn Respo... | <|body_start_0|>
is_manager(request)
task_qs = Task.objects.select_related('manager').prefetch_related('agent_list').filter(id=pk)
if len(task_qs) < 1:
return Response({'detail': 'Task not found!'}, status=400)
task = task_qs[0]
self.check_object_permissions(request, ... | TaskViewSetManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskViewSetManager:
def retrieve(self, request, pk, format=None):
"""Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, 'start': datetime, 'deadline': datetime, "images": ['url1..', 'url2..'], 'task_type': 'Doctors visit', 'agen... | stack_v2_sparse_classes_36k_train_023373 | 22,163 | no_license | [
{
"docstring": "Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, 'start': datetime, 'deadline': datetime, \"images\": ['url1..', 'url2..'], 'task_type': 'Doctors visit', 'agent_list': [50, 51], 'manager': 'name', 'custom_fields': [], 'address': 'addr... | 4 | null | Implement the Python class `TaskViewSetManager` described below.
Class description:
Implement the TaskViewSetManager class.
Method signatures and docstrings:
- def retrieve(self, request, pk, format=None): Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, '... | Implement the Python class `TaskViewSetManager` described below.
Class description:
Implement the TaskViewSetManager class.
Method signatures and docstrings:
- def retrieve(self, request, pk, format=None): Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, '... | 11be165f85cda0ffe7a237d011de562d3dc64135 | <|skeleton|>
class TaskViewSetManager:
def retrieve(self, request, pk, format=None):
"""Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, 'start': datetime, 'deadline': datetime, "images": ['url1..', 'url2..'], 'task_type': 'Doctors visit', 'agen... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TaskViewSetManager:
def retrieve(self, request, pk, format=None):
"""Sample response: --- { 'id': 11, 'title': 'Title', 'point': {'lat': 23.780926, 'lng': 90.422858}, 'status': 0, 'start': datetime, 'deadline': datetime, "images": ['url1..', 'url2..'], 'task_type': 'Doctors visit', 'agent_list': [50, ... | the_stack_v2_python_sparse | apps/task/views.py | ash018/FFTracker | train | 0 | |
323203ee605eae5e5619cf67fdbb1fc079274de3 | [
"VapiInterface.__init__(self, config, _TrustedPeerCertificatesStub)\nself._VAPI_OPERATION_IDS = {}\nself._VAPI_OPERATION_IDS.update({'update_task': 'update$task'})\nself._VAPI_OPERATION_IDS.update({'get_task': 'get$task'})",
"task_id = self._invoke('update$task', {'cluster': cluster, 'provider': provider, 'spec':... | <|body_start_0|>
VapiInterface.__init__(self, config, _TrustedPeerCertificatesStub)
self._VAPI_OPERATION_IDS = {}
self._VAPI_OPERATION_IDS.update({'update_task': 'update$task'})
self._VAPI_OPERATION_IDS.update({'get_task': 'get$task'})
<|end_body_0|>
<|body_start_1|>
task_id = s... | Provides management operations for the TLS certificates trusted for communication with peer key servers. To obtain the currently used TLS certificates use the :class:`CurrentPeerCertificates` class. This class was added in vSphere API 7.0.0. | TrustedPeerCertificates | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TrustedPeerCertificates:
"""Provides management operations for the TLS certificates trusted for communication with peer key servers. To obtain the currently used TLS certificates use the :class:`CurrentPeerCertificates` class. This class was added in vSphere API 7.0.0."""
def __init__(self, ... | stack_v2_sparse_classes_36k_train_023374 | 43,803 | permissive | [
{
"docstring": ":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub.",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Update trusted server certificate(s). The client will use these cer... | 3 | null | Implement the Python class `TrustedPeerCertificates` described below.
Class description:
Provides management operations for the TLS certificates trusted for communication with peer key servers. To obtain the currently used TLS certificates use the :class:`CurrentPeerCertificates` class. This class was added in vSphere... | Implement the Python class `TrustedPeerCertificates` described below.
Class description:
Provides management operations for the TLS certificates trusted for communication with peer key servers. To obtain the currently used TLS certificates use the :class:`CurrentPeerCertificates` class. This class was added in vSphere... | c07e1be98615201139b26c28db3aa584c4254b66 | <|skeleton|>
class TrustedPeerCertificates:
"""Provides management operations for the TLS certificates trusted for communication with peer key servers. To obtain the currently used TLS certificates use the :class:`CurrentPeerCertificates` class. This class was added in vSphere API 7.0.0."""
def __init__(self, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TrustedPeerCertificates:
"""Provides management operations for the TLS certificates trusted for communication with peer key servers. To obtain the currently used TLS certificates use the :class:`CurrentPeerCertificates` class. This class was added in vSphere API 7.0.0."""
def __init__(self, config):
... | the_stack_v2_python_sparse | com/vmware/vcenter/trusted_infrastructure/trust_authority_clusters/kms/providers_client.py | adammillerio/vsphere-automation-sdk-python | train | 0 |
041bd17aeda479a57dbb5f20508827ec0decbff8 | [
"super(NonBlockingTopo, self).__init__()\nself.k = k\nself.node_gen = FatTreeNode\npods = range(0, k)\nedge_sw = range(0, k / 2)\nagg_sw = range(k / 2, k)\nhosts = range(2, k / 2 + 2)\ncore = self.node_gen(k, 1, 1)\ncore_opts = self.def_opts(core.name_str())\nself.addSwitch(core.name_str(), **core_opts)\nfor p in p... | <|body_start_0|>
super(NonBlockingTopo, self).__init__()
self.k = k
self.node_gen = FatTreeNode
pods = range(0, k)
edge_sw = range(0, k / 2)
agg_sw = range(k / 2, k)
hosts = range(2, k / 2 + 2)
core = self.node_gen(k, 1, 1)
core_opts = self.def_opt... | NonBlockingTopo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NonBlockingTopo:
def __init__(self, k=4):
"""Create a non-bloking switch"""
<|body_0|>
def layer(self, name):
"""Return the layer of a node"""
<|body_1|>
def def_opts(self, name):
"""return default dict for FatTree node"""
<|body_2|>
<|e... | stack_v2_sparse_classes_36k_train_023375 | 5,790 | no_license | [
{
"docstring": "Create a non-bloking switch",
"name": "__init__",
"signature": "def __init__(self, k=4)"
},
{
"docstring": "Return the layer of a node",
"name": "layer",
"signature": "def layer(self, name)"
},
{
"docstring": "return default dict for FatTree node",
"name": "de... | 3 | stack_v2_sparse_classes_30k_train_017913 | Implement the Python class `NonBlockingTopo` described below.
Class description:
Implement the NonBlockingTopo class.
Method signatures and docstrings:
- def __init__(self, k=4): Create a non-bloking switch
- def layer(self, name): Return the layer of a node
- def def_opts(self, name): return default dict for FatTree... | Implement the Python class `NonBlockingTopo` described below.
Class description:
Implement the NonBlockingTopo class.
Method signatures and docstrings:
- def __init__(self, k=4): Create a non-bloking switch
- def layer(self, name): Return the layer of a node
- def def_opts(self, name): return default dict for FatTree... | 3e6c87d6697fa4e3d9b3c5c87c1631253c01e6b1 | <|skeleton|>
class NonBlockingTopo:
def __init__(self, k=4):
"""Create a non-bloking switch"""
<|body_0|>
def layer(self, name):
"""Return the layer of a node"""
<|body_1|>
def def_opts(self, name):
"""return default dict for FatTree node"""
<|body_2|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NonBlockingTopo:
def __init__(self, k=4):
"""Create a non-bloking switch"""
super(NonBlockingTopo, self).__init__()
self.k = k
self.node_gen = FatTreeNode
pods = range(0, k)
edge_sw = range(0, k / 2)
agg_sw = range(k / 2, k)
hosts = range(2, k / ... | the_stack_v2_python_sparse | DCTopo.py | jasonlyc/ashman-POX | train | 1 | |
66e8e86f79ef5b260354fc79c83ffde8a0a8ee5d | [
"def inner_wrapper(wrapped_class: BaseMLMHead) -> Callable:\n for model_arch in model_arch_list:\n assert model_arch not in cls.registry\n cls.registry[model_arch] = wrapped_class\n return wrapped_class\nreturn inner_wrapper",
"mlm_head_class = self.registry[task.TASK_TYPE]\nmlm_head = mlm_hea... | <|body_start_0|>
def inner_wrapper(wrapped_class: BaseMLMHead) -> Callable:
for model_arch in model_arch_list:
assert model_arch not in cls.registry
cls.registry[model_arch] = wrapped_class
return wrapped_class
return inner_wrapper
<|end_body_0|>
... | This factory is used to create masked language modeling (MLM) task heads. This is required due to Transformers implementing different MLM heads for different encoders. Attributes: registry (dict): Dynamic registry mapping model architectures to MLM task heads | JiantMLMHeadFactory | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JiantMLMHeadFactory:
"""This factory is used to create masked language modeling (MLM) task heads. This is required due to Transformers implementing different MLM heads for different encoders. Attributes: registry (dict): Dynamic registry mapping model architectures to MLM task heads"""
def r... | stack_v2_sparse_classes_36k_train_023376 | 11,104 | permissive | [
{
"docstring": "Registers the ModelArchitectures in model_arch_list as keys mapping to a MLMHead Args: model_arch_list (List[ModelArchitectures]): List of ModelArchitectures mapping to an MLM task head. Returns: Callable: MLMHead class",
"name": "register",
"signature": "def register(cls, model_arch_lis... | 2 | null | Implement the Python class `JiantMLMHeadFactory` described below.
Class description:
This factory is used to create masked language modeling (MLM) task heads. This is required due to Transformers implementing different MLM heads for different encoders. Attributes: registry (dict): Dynamic registry mapping model archit... | Implement the Python class `JiantMLMHeadFactory` described below.
Class description:
This factory is used to create masked language modeling (MLM) task heads. This is required due to Transformers implementing different MLM heads for different encoders. Attributes: registry (dict): Dynamic registry mapping model archit... | daa5a258e3af5e7503288de8401429eaf3f58e13 | <|skeleton|>
class JiantMLMHeadFactory:
"""This factory is used to create masked language modeling (MLM) task heads. This is required due to Transformers implementing different MLM heads for different encoders. Attributes: registry (dict): Dynamic registry mapping model architectures to MLM task heads"""
def r... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class JiantMLMHeadFactory:
"""This factory is used to create masked language modeling (MLM) task heads. This is required due to Transformers implementing different MLM heads for different encoders. Attributes: registry (dict): Dynamic registry mapping model architectures to MLM task heads"""
def register(cls, ... | the_stack_v2_python_sparse | jiant/proj/main/modeling/heads.py | nyu-mll/jiant | train | 1,289 |
5816870a201e7830f4752728b303fc9eabcfd0d9 | [
"_wavelet = pywt.Wavelet(wavelet)\nlogger.debug('Calculating wavelet coefficients with {w} wavelet'.format(w=_wavelet.family_name))\n_wavedec = pywt.wavedec(data=x, wavelet=_wavelet, axis=1, level=level)\nreturn cls._subset_coefficients(x=_wavedec, gid_count=x.shape[0], indices=indices)",
"indices = indices or ra... | <|body_start_0|>
_wavelet = pywt.Wavelet(wavelet)
logger.debug('Calculating wavelet coefficients with {w} wavelet'.format(w=_wavelet.family_name))
_wavedec = pywt.wavedec(data=x, wavelet=_wavelet, axis=1, level=level)
return cls._subset_coefficients(x=_wavedec, gid_count=x.shape[0], indi... | Base class for RPM wavelets | RPMWavelets | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RPMWavelets:
"""Base class for RPM wavelets"""
def get_dwt_coefficients(cls, x, wavelet='Haar', level=None, indices=None):
"""Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Parameters ---------- x : ndarray time series values wavele... | stack_v2_sparse_classes_36k_train_023377 | 21,915 | permissive | [
{
"docstring": "Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Parameters ---------- x : ndarray time series values wavelet : string mother wavelet type level : int optional wavelet computation level indices : ndarray coefficient array levels to keep Returns -... | 2 | stack_v2_sparse_classes_30k_train_016761 | Implement the Python class `RPMWavelets` described below.
Class description:
Base class for RPM wavelets
Method signatures and docstrings:
- def get_dwt_coefficients(cls, x, wavelet='Haar', level=None, indices=None): Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Pa... | Implement the Python class `RPMWavelets` described below.
Class description:
Base class for RPM wavelets
Method signatures and docstrings:
- def get_dwt_coefficients(cls, x, wavelet='Haar', level=None, indices=None): Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Pa... | 2dd05402c9c05ca0bf7f0e5bc2849ede0d0bc3cb | <|skeleton|>
class RPMWavelets:
"""Base class for RPM wavelets"""
def get_dwt_coefficients(cls, x, wavelet='Haar', level=None, indices=None):
"""Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Parameters ---------- x : ndarray time series values wavele... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RPMWavelets:
"""Base class for RPM wavelets"""
def get_dwt_coefficients(cls, x, wavelet='Haar', level=None, indices=None):
"""Collect wavelet coefficients for time series <x> using mother wavelet <wavelet> at levels <level>. Parameters ---------- x : ndarray time series values wavelet : string mo... | the_stack_v2_python_sparse | reVX/rpm/rpm_clusters.py | NREL/reVX | train | 10 |
a43ff61f09114ad4776fa8030886e8b81267e668 | [
"row = super().export_resource(obj)\nillegal_start_vals = ['@', '=', '+', '-', '@', '\\t', '\\r', '\\n']\nfor idx, val in enumerate(row):\n if type(val) is str:\n val = val.strip()\n while len(val) > 0 and val[0] in illegal_start_vals:\n val = val[1:]\n row[idx] = val\nreturn row"... | <|body_start_0|>
row = super().export_resource(obj)
illegal_start_vals = ['@', '=', '+', '-', '@', '\t', '\r', '\n']
for idx, val in enumerate(row):
if type(val) is str:
val = val.strip()
while len(val) > 0 and val[0] in illegal_start_vals:
... | Custom subclass of the ModelResource class provided by django-import-export" Ensures that exported data are escaped to prevent malicious formula injection. Ref: https://owasp.org/www-community/attacks/CSV_Injection | InvenTreeResource | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InvenTreeResource:
"""Custom subclass of the ModelResource class provided by django-import-export" Ensures that exported data are escaped to prevent malicious formula injection. Ref: https://owasp.org/www-community/attacks/CSV_Injection"""
def export_resource(self, obj):
"""Custom fu... | stack_v2_sparse_classes_36k_train_023378 | 1,879 | permissive | [
{
"docstring": "Custom function to override default row export behaviour. Specifically, strip illegal leading characters to prevent formula injection",
"name": "export_resource",
"signature": "def export_resource(self, obj)"
},
{
"docstring": "Return fields, with some common exclusions",
"na... | 2 | null | Implement the Python class `InvenTreeResource` described below.
Class description:
Custom subclass of the ModelResource class provided by django-import-export" Ensures that exported data are escaped to prevent malicious formula injection. Ref: https://owasp.org/www-community/attacks/CSV_Injection
Method signatures an... | Implement the Python class `InvenTreeResource` described below.
Class description:
Custom subclass of the ModelResource class provided by django-import-export" Ensures that exported data are escaped to prevent malicious formula injection. Ref: https://owasp.org/www-community/attacks/CSV_Injection
Method signatures an... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class InvenTreeResource:
"""Custom subclass of the ModelResource class provided by django-import-export" Ensures that exported data are escaped to prevent malicious formula injection. Ref: https://owasp.org/www-community/attacks/CSV_Injection"""
def export_resource(self, obj):
"""Custom fu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InvenTreeResource:
"""Custom subclass of the ModelResource class provided by django-import-export" Ensures that exported data are escaped to prevent malicious formula injection. Ref: https://owasp.org/www-community/attacks/CSV_Injection"""
def export_resource(self, obj):
"""Custom function to ove... | the_stack_v2_python_sparse | InvenTree/InvenTree/admin.py | inventree/InvenTree | train | 3,077 |
b3982c3bd84d5ac12aee017be09a5378b5867719 | [
"\"\"\"\n In this problem, one should compare the left and right subtree of a root, but only got one root. use root.left and root.right will make the recursive process difficult, so we can compare root and root.\n \"\"\"\nif not root:\n return True\nreturn self.isMirror(root.left, root.right)",
... | <|body_start_0|>
"""
In this problem, one should compare the left and right subtree of a root, but only got one root. use root.left and root.right will make the recursive process difficult, so we can compare root and root.
"""
if not root:
return True
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isMirror(self, left, right):
""":type tN1, tN2: TreeNode : rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
"""
In this problem,... | stack_v2_sparse_classes_36k_train_023379 | 1,103 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root)"
},
{
"docstring": ":type tN1, tN2: TreeNode : rtype: bool",
"name": "isMirror",
"signature": "def isMirror(self, left, right)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007886 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool
- def isMirror(self, left, right): :type tN1, tN2: TreeNode : rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isSymmetric(self, root): :type root: TreeNode :rtype: bool
- def isMirror(self, left, right): :type tN1, tN2: TreeNode : rtype: bool
<|skeleton|>
class Solution:
def is... | f96a2273c6831a8035e1adacfa452f73c599ae16 | <|skeleton|>
class Solution:
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
<|body_0|>
def isMirror(self, left, right):
""":type tN1, tN2: TreeNode : rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def isSymmetric(self, root):
""":type root: TreeNode :rtype: bool"""
"""
In this problem, one should compare the left and right subtree of a root, but only got one root. use root.left and root.right will make the recursive process difficult, so we can compare root an... | the_stack_v2_python_sparse | Python/SymmetricTree.py | here0009/LeetCode | train | 1 | |
4461b2eba907b9afb6292ad0ef79f692485cc5db | [
"super(TransformerEncoderModel, self).__init__()\nself.padding_idx = padding_idx\nself.token_embedding = nn.Embedding(vocab_size, emb_dim, padding_idx=padding_idx)\nmax_pos_len = 3000\nself.pos_embedding = nn.Embedding(max_pos_len, emb_dim, padding_idx=padding_idx)\nself.dropout = nn.Dropout(p=dropout_rate)\nself.t... | <|body_start_0|>
super(TransformerEncoderModel, self).__init__()
self.padding_idx = padding_idx
self.token_embedding = nn.Embedding(vocab_size, emb_dim, padding_idx=padding_idx)
max_pos_len = 3000
self.pos_embedding = nn.Embedding(max_pos_len, emb_dim, padding_idx=padding_idx)
... | TransformerEncoderModel | TransformerEncoderModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransformerEncoderModel:
"""TransformerEncoderModel"""
def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1):
"""__init__"""
<|body_0|>
def forward(self, input, pos):
"""forward"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_023380 | 17,522 | permissive | [
{
"docstring": "__init__",
"name": "__init__",
"signature": "def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1)"
},
{
"docstring": "forward",
"name": "forward",
"signature": "def forward(self, input, pos)"
},
{
"do... | 3 | stack_v2_sparse_classes_30k_train_021543 | Implement the Python class `TransformerEncoderModel` described below.
Class description:
TransformerEncoderModel
Method signatures and docstrings:
- def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1): __init__
- def forward(self, input, pos): forward
-... | Implement the Python class `TransformerEncoderModel` described below.
Class description:
TransformerEncoderModel
Method signatures and docstrings:
- def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1): __init__
- def forward(self, input, pos): forward
-... | e6ab0261eb719c21806bbadfd94001ecfe27de45 | <|skeleton|>
class TransformerEncoderModel:
"""TransformerEncoderModel"""
def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1):
"""__init__"""
<|body_0|>
def forward(self, input, pos):
"""forward"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TransformerEncoderModel:
"""TransformerEncoderModel"""
def __init__(self, vocab_size, emb_dim=512, hidden_size=512, n_layers=8, n_heads=8, padding_idx=0, dropout_rate=0.1):
"""__init__"""
super(TransformerEncoderModel, self).__init__()
self.padding_idx = padding_idx
self.t... | the_stack_v2_python_sparse | pahelix/model_zoo/protein_sequence_model.py | PaddlePaddle/PaddleHelix | train | 771 |
186a58c26d9b638085c924b70b35ce458afe2091 | [
"ListNums = len(lists)\nif ListNums == 1:\n return lists[0]\n\ndef mergeList(head1: ListNode, head2: ListNode):\n if head1 == None:\n return head2\n if head2 == None:\n return head1\n if head1.val < head2.val:\n head1.next = mergeList(head1.next, head2)\n return head1\n el... | <|body_start_0|>
ListNums = len(lists)
if ListNums == 1:
return lists[0]
def mergeList(head1: ListNode, head2: ListNode):
if head1 == None:
return head2
if head2 == None:
return head1
if head1.val < head2.val:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists) -> ListNode:
"""每次只合并两个链表,超时了。 :param list[ListNode] lists: :return:"""
<|body_0|>
def mergeKLists2(self, lists) -> ListNode:
"""对上面进行分治,合并 :param list[ListNode] lists: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_023381 | 2,355 | no_license | [
{
"docstring": "每次只合并两个链表,超时了。 :param list[ListNode] lists: :return:",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists) -> ListNode"
},
{
"docstring": "对上面进行分治,合并 :param list[ListNode] lists: :return:",
"name": "mergeKLists2",
"signature": "def mergeKLists2(self, lists) ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists) -> ListNode: 每次只合并两个链表,超时了。 :param list[ListNode] lists: :return:
- def mergeKLists2(self, lists) -> ListNode: 对上面进行分治,合并 :param list[ListNode] lists... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists) -> ListNode: 每次只合并两个链表,超时了。 :param list[ListNode] lists: :return:
- def mergeKLists2(self, lists) -> ListNode: 对上面进行分治,合并 :param list[ListNode] lists... | 837957ea22aa07ce28a6c23ea0419bd2011e1f88 | <|skeleton|>
class Solution:
def mergeKLists(self, lists) -> ListNode:
"""每次只合并两个链表,超时了。 :param list[ListNode] lists: :return:"""
<|body_0|>
def mergeKLists2(self, lists) -> ListNode:
"""对上面进行分治,合并 :param list[ListNode] lists: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeKLists(self, lists) -> ListNode:
"""每次只合并两个链表,超时了。 :param list[ListNode] lists: :return:"""
ListNums = len(lists)
if ListNums == 1:
return lists[0]
def mergeList(head1: ListNode, head2: ListNode):
if head1 == None:
ret... | the_stack_v2_python_sparse | 华为题库/合并K个排序链表.py | 2226171237/Algorithmpractice | train | 0 | |
7ddde0e67f63e69770c45559b0eabc3989417b6a | [
"response = super(BkChVs, self).__init__()\nif len(bkchvs) == 9:\n idno = int(bkchvs[0:3])\n self.ch = int(bkchvs[3:6])\n self.vs = int(bkchvs[6:])\n self.book = Book.get_abbr(idno)\nreturn response",
"if self.book != other.book:\n return False\nif self.ch == other.ch:\n return self.vs == other.... | <|body_start_0|>
response = super(BkChVs, self).__init__()
if len(bkchvs) == 9:
idno = int(bkchvs[0:3])
self.ch = int(bkchvs[3:6])
self.vs = int(bkchvs[6:])
self.book = Book.get_abbr(idno)
return response
<|end_body_0|>
<|body_start_1|>
if... | Helper class to convert to/from bk/ch/vs | BkChVs | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BkChVs:
"""Helper class to convert to/from bk/ch/vs"""
def __init__(self, bkchvs):
"""Create an object"""
<|body_0|>
def is_next(self, other):
"""Check if [self] follows immediately upon [other]"""
<|body_1|>
def get_until(self, einde, idno, include_... | stack_v2_sparse_classes_36k_train_023382 | 33,755 | permissive | [
{
"docstring": "Create an object",
"name": "__init__",
"signature": "def __init__(self, bkchvs)"
},
{
"docstring": "Check if [self] follows immediately upon [other]",
"name": "is_next",
"signature": "def is_next(self, other)"
},
{
"docstring": "Show ch/vs-ch/vs",
"name": "get... | 3 | stack_v2_sparse_classes_30k_train_006055 | Implement the Python class `BkChVs` described below.
Class description:
Helper class to convert to/from bk/ch/vs
Method signatures and docstrings:
- def __init__(self, bkchvs): Create an object
- def is_next(self, other): Check if [self] follows immediately upon [other]
- def get_until(self, einde, idno, include_book... | Implement the Python class `BkChVs` described below.
Class description:
Helper class to convert to/from bk/ch/vs
Method signatures and docstrings:
- def __init__(self, bkchvs): Create an object
- def is_next(self, other): Check if [self] follows immediately upon [other]
- def get_until(self, einde, idno, include_book... | 921fb5ec3f5b40b169bd3f65417580878365ccab | <|skeleton|>
class BkChVs:
"""Helper class to convert to/from bk/ch/vs"""
def __init__(self, bkchvs):
"""Create an object"""
<|body_0|>
def is_next(self, other):
"""Check if [self] follows immediately upon [other]"""
<|body_1|>
def get_until(self, einde, idno, include_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BkChVs:
"""Helper class to convert to/from bk/ch/vs"""
def __init__(self, bkchvs):
"""Create an object"""
response = super(BkChVs, self).__init__()
if len(bkchvs) == 9:
idno = int(bkchvs[0:3])
self.ch = int(bkchvs[3:6])
self.vs = int(bkchvs[6:])... | the_stack_v2_python_sparse | passim/passim/bible/models.py | ErwinKomen/RU-passim | train | 0 |
9d776eab5f79495f387b4dac27bacf05b960f2b8 | [
"ExecutionElement.__init__(self, id_, errors)\nself.name = name\nself.actions = actions if actions else []\nself.branches = branches if branches else []\nself.conditions = conditions if conditions else []\nself.conditions = conditions if transforms else []\nself.triggers = triggers if triggers else []\nself.workflo... | <|body_start_0|>
ExecutionElement.__init__(self, id_, errors)
self.name = name
self.actions = actions if actions else []
self.branches = branches if branches else []
self.conditions = conditions if conditions else []
self.conditions = conditions if transforms else []
... | Workflow | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Workflow:
def __init__(self, name, start, id_=None, actions=None, branches=None, conditions=None, transforms=None, triggers=None, workflow_variables=None, is_valid=False, errors=None):
"""Initializes a Workflow object. A Workflow falls under a Playbook, and has many associated Actions wi... | stack_v2_sparse_classes_36k_train_023383 | 3,964 | no_license | [
{
"docstring": "Initializes a Workflow object. A Workflow falls under a Playbook, and has many associated Actions within it that get executed. Args: name (str): The name of the Workflow object. start (int): ID of the starting Action. id_ (str|UUID, optional): Optional UUID to pass into the Action. Must be UUID ... | 2 | stack_v2_sparse_classes_30k_train_000709 | Implement the Python class `Workflow` described below.
Class description:
Implement the Workflow class.
Method signatures and docstrings:
- def __init__(self, name, start, id_=None, actions=None, branches=None, conditions=None, transforms=None, triggers=None, workflow_variables=None, is_valid=False, errors=None): Ini... | Implement the Python class `Workflow` described below.
Class description:
Implement the Workflow class.
Method signatures and docstrings:
- def __init__(self, name, start, id_=None, actions=None, branches=None, conditions=None, transforms=None, triggers=None, workflow_variables=None, is_valid=False, errors=None): Ini... | 06caf8b82d4424db1bf007ca7ab8cf61b4185765 | <|skeleton|>
class Workflow:
def __init__(self, name, start, id_=None, actions=None, branches=None, conditions=None, transforms=None, triggers=None, workflow_variables=None, is_valid=False, errors=None):
"""Initializes a Workflow object. A Workflow falls under a Playbook, and has many associated Actions wi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Workflow:
def __init__(self, name, start, id_=None, actions=None, branches=None, conditions=None, transforms=None, triggers=None, workflow_variables=None, is_valid=False, errors=None):
"""Initializes a Workflow object. A Workflow falls under a Playbook, and has many associated Actions within it that g... | the_stack_v2_python_sparse | api_gateway/executiondb/workflow.py | krzim/triple-play | train | 0 | |
97e3622b2e691400511bf9f1eb870eda91ddf2f8 | [
"try:\n page = int(request.GET.get('page', '1'))\nexcept ValueError:\n page = 1\nif page < 0:\n page = 1\ntry:\n per_page = int(request.GET.get('per_page', '20'))\nexcept ValueError:\n per_page = 20\nif per_page < 1 or per_page > 100:\n per_page = 20\npaginator = Paginator(GroupMessage.objects.fil... | <|body_start_0|>
try:
page = int(request.GET.get('page', '1'))
except ValueError:
page = 1
if page < 0:
page = 1
try:
per_page = int(request.GET.get('per_page', '20'))
except ValueError:
per_page = 20
if per_page... | GroupDiscussions | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupDiscussions:
def get(self, request, group_id, format=None):
"""List all group discussions. Only group members can perform this op."""
<|body_0|>
def post(self, request, group_id, format=None):
"""Post a group discussion. Only group members can perform this op.""... | stack_v2_sparse_classes_36k_train_023384 | 4,511 | permissive | [
{
"docstring": "List all group discussions. Only group members can perform this op.",
"name": "get",
"signature": "def get(self, request, group_id, format=None)"
},
{
"docstring": "Post a group discussion. Only group members can perform this op.",
"name": "post",
"signature": "def post(s... | 2 | null | Implement the Python class `GroupDiscussions` described below.
Class description:
Implement the GroupDiscussions class.
Method signatures and docstrings:
- def get(self, request, group_id, format=None): List all group discussions. Only group members can perform this op.
- def post(self, request, group_id, format=None... | Implement the Python class `GroupDiscussions` described below.
Class description:
Implement the GroupDiscussions class.
Method signatures and docstrings:
- def get(self, request, group_id, format=None): List all group discussions. Only group members can perform this op.
- def post(self, request, group_id, format=None... | 13b3ed26a04248211ef91ca70dccc617be27a3c3 | <|skeleton|>
class GroupDiscussions:
def get(self, request, group_id, format=None):
"""List all group discussions. Only group members can perform this op."""
<|body_0|>
def post(self, request, group_id, format=None):
"""Post a group discussion. Only group members can perform this op.""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GroupDiscussions:
def get(self, request, group_id, format=None):
"""List all group discussions. Only group members can perform this op."""
try:
page = int(request.GET.get('page', '1'))
except ValueError:
page = 1
if page < 0:
page = 1
... | the_stack_v2_python_sparse | fhs/usr/share/python/syncwerk/restapi/restapi/api2/endpoints/group_discussions.py | syncwerk/syncwerk-server-restapi | train | 0 | |
e24ca978ba77f5deef96816ba32c09232f004e61 | [
"if isinstance(key, int):\n return RegistrationFailure(key)\nif key not in RegistrationFailure._member_map_:\n extend_enum(RegistrationFailure, key, default)\nreturn RegistrationFailure[key]",
"if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.... | <|body_start_0|>
if isinstance(key, int):
return RegistrationFailure(key)
if key not in RegistrationFailure._member_map_:
extend_enum(RegistrationFailure, key, default)
return RegistrationFailure[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int)... | [RegistrationFailure] Registration Failure Types | RegistrationFailure | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegistrationFailure:
"""[RegistrationFailure] Registration Failure Types"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k_train_023385 | 1,933 | permissive | [
{
"docstring": "Backport support for original codes.",
"name": "get",
"signature": "def get(key, default=-1)"
},
{
"docstring": "Lookup function used when value is not found.",
"name": "_missing_",
"signature": "def _missing_(cls, value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004792 | Implement the Python class `RegistrationFailure` described below.
Class description:
[RegistrationFailure] Registration Failure Types
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found. | Implement the Python class `RegistrationFailure` described below.
Class description:
[RegistrationFailure] Registration Failure Types
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found.
<|skeleto... | 90cd07d67df28d5c5ab0585bc60f467a78d9db33 | <|skeleton|>
class RegistrationFailure:
"""[RegistrationFailure] Registration Failure Types"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_sk... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RegistrationFailure:
"""[RegistrationFailure] Registration Failure Types"""
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return RegistrationFailure(key)
if key not in RegistrationFailure._member_map_:
extend_... | the_stack_v2_python_sparse | pcapkit/const/hip/registration_failure.py | stjordanis/PyPCAPKit | train | 0 |
a29929e3f679a1a26edf2cd40dbc3ca4d1f47931 | [
"if not nums:\n return None\nhead = 0\ntail = len(nums) - 1\nwhile head <= tail:\n mid = (head + tail) // 2\n if nums[mid] <= nums[mid - 1]:\n return nums[mid]\n elif nums[mid] > nums[mid - 1] and nums[mid] > nums[-1]:\n head = mid + 1\n else:\n tail = mid - 1",
"if not nums:\n... | <|body_start_0|>
if not nums:
return None
head = 0
tail = len(nums) - 1
while head <= tail:
mid = (head + tail) // 2
if nums[mid] <= nums[mid - 1]:
return nums[mid]
elif nums[mid] > nums[mid - 1] and nums[mid] > nums[-1]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMin1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findMin2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
return None
head =... | stack_v2_sparse_classes_36k_train_023386 | 914 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findMin1",
"signature": "def findMin1(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "findMin2",
"signature": "def findMin2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMin1(self, nums): :type nums: List[int] :rtype: int
- def findMin2(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMin1(self, nums): :type nums: List[int] :rtype: int
- def findMin2(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def findMin1(self, nu... | 8fb6c1d947046dabd58ff8482b2c0b41f39aa988 | <|skeleton|>
class Solution:
def findMin1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def findMin2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findMin1(self, nums):
""":type nums: List[int] :rtype: int"""
if not nums:
return None
head = 0
tail = len(nums) - 1
while head <= tail:
mid = (head + tail) // 2
if nums[mid] <= nums[mid - 1]:
return nums... | the_stack_v2_python_sparse | Python/LeetCode/153.py | czx94/Algorithms-Collection | train | 2 | |
65919b31591cc92f4cb40e4278215c76049742e9 | [
"BasicExperimentView.__init__(self)\nself.title = title\nself.descr = descr\nself.series = series\nself.separator = separator\nself.run_text = run_text\nself.link_text = link_text",
"file.write('defaultFinalTableView')\nfields = {}\nif not self.title is None:\n func = lambda file, indent: file.write(encode_str... | <|body_start_0|>
BasicExperimentView.__init__(self)
self.title = title
self.descr = descr
self.series = series
self.separator = separator
self.run_text = run_text
self.link_text = link_text
<|end_body_0|>
<|body_start_1|>
file.write('defaultFinalTableView... | It saves the simulation results in final time points for all runs in CSV file. | FinalTableView | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FinalTableView:
"""It saves the simulation results in final time points for all runs in CSV file."""
def __init__(self, title=None, descr=None, series=None, separator=None, run_text=None, link_text=None):
"""Initializes a new instance."""
<|body_0|>
def write(self, file,... | stack_v2_sparse_classes_36k_train_023387 | 2,137 | permissive | [
{
"docstring": "Initializes a new instance.",
"name": "__init__",
"signature": "def __init__(self, title=None, descr=None, series=None, separator=None, run_text=None, link_text=None)"
},
{
"docstring": "Write the view definition in the file.",
"name": "write",
"signature": "def write(sel... | 2 | stack_v2_sparse_classes_30k_train_004036 | Implement the Python class `FinalTableView` described below.
Class description:
It saves the simulation results in final time points for all runs in CSV file.
Method signatures and docstrings:
- def __init__(self, title=None, descr=None, series=None, separator=None, run_text=None, link_text=None): Initializes a new i... | Implement the Python class `FinalTableView` described below.
Class description:
It saves the simulation results in final time points for all runs in CSV file.
Method signatures and docstrings:
- def __init__(self, title=None, descr=None, series=None, separator=None, run_text=None, link_text=None): Initializes a new i... | 5c112015f9af6ba1974a3b208842da01e705f9ac | <|skeleton|>
class FinalTableView:
"""It saves the simulation results in final time points for all runs in CSV file."""
def __init__(self, title=None, descr=None, series=None, separator=None, run_text=None, link_text=None):
"""Initializes a new instance."""
<|body_0|>
def write(self, file,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FinalTableView:
"""It saves the simulation results in final time points for all runs in CSV file."""
def __init__(self, title=None, descr=None, series=None, separator=None, run_text=None, link_text=None):
"""Initializes a new instance."""
BasicExperimentView.__init__(self)
self.ti... | the_stack_v2_python_sparse | simulation/aivika/modeler/experiment/base/final_table.py | dsorokin/aivika-modeler | train | 0 |
595542f64e8dbcdc6f9d8cf293b84c27dda263de | [
"json_dict = json.loads(request.body.decode())\nreceiver = json_dict.get('receiver')\nprovince_id = json_dict.get('province_id')\ncity_id = json_dict.get('city_id')\ndistrict_id = json_dict.get('district_id')\nplace = json_dict.get('place')\nmobile = json_dict.get('mobile')\ntel = json_dict.get('tel')\nemail = json... | <|body_start_0|>
json_dict = json.loads(request.body.decode())
receiver = json_dict.get('receiver')
province_id = json_dict.get('province_id')
city_id = json_dict.get('city_id')
district_id = json_dict.get('district_id')
place = json_dict.get('place')
mobile = jso... | 更新地址 | UpdateDestoryAdressView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateDestoryAdressView:
"""更新地址"""
def put(self, request, address_id):
"""更新地址 :param request: :param address_id:修改删除 :return:"""
<|body_0|>
def delete(self, request, address_id):
"""删除地址"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
json_dic... | stack_v2_sparse_classes_36k_train_023388 | 22,758 | permissive | [
{
"docstring": "更新地址 :param request: :param address_id:修改删除 :return:",
"name": "put",
"signature": "def put(self, request, address_id)"
},
{
"docstring": "删除地址",
"name": "delete",
"signature": "def delete(self, request, address_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020223 | Implement the Python class `UpdateDestoryAdressView` described below.
Class description:
更新地址
Method signatures and docstrings:
- def put(self, request, address_id): 更新地址 :param request: :param address_id:修改删除 :return:
- def delete(self, request, address_id): 删除地址 | Implement the Python class `UpdateDestoryAdressView` described below.
Class description:
更新地址
Method signatures and docstrings:
- def put(self, request, address_id): 更新地址 :param request: :param address_id:修改删除 :return:
- def delete(self, request, address_id): 删除地址
<|skeleton|>
class UpdateDestoryAdressView:
"""更... | 2434231795b3319dfda60b19af18442ee5f6fa73 | <|skeleton|>
class UpdateDestoryAdressView:
"""更新地址"""
def put(self, request, address_id):
"""更新地址 :param request: :param address_id:修改删除 :return:"""
<|body_0|>
def delete(self, request, address_id):
"""删除地址"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateDestoryAdressView:
"""更新地址"""
def put(self, request, address_id):
"""更新地址 :param request: :param address_id:修改删除 :return:"""
json_dict = json.loads(request.body.decode())
receiver = json_dict.get('receiver')
province_id = json_dict.get('province_id')
city_id ... | the_stack_v2_python_sparse | meiduo_project/meiduo_mall/meiduo_mall/apps/users/views.py | xlztongxue/meiduoshangcheng | train | 0 |
5d1aadb7c69aab49f4a3ba6a4c20d9919aaa38fb | [
"iqCustomComboCtrl.__init__(self, *args, **kwargs)\nself.default = None\nself.data = None\nself.ext_edit_func = None",
"if self.ext_edit_func:\n result = self.ext_edit_func(self, self.data, self.default)\n if result is not None:\n self.SetValue(str(result))"
] | <|body_start_0|>
iqCustomComboCtrl.__init__(self, *args, **kwargs)
self.default = None
self.data = None
self.ext_edit_func = None
<|end_body_0|>
<|body_start_1|>
if self.ext_edit_func:
result = self.ext_edit_func(self, self.data, self.default)
if result i... | The control class of the extended editor of the function argument value. | iqArgExtendedEdit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class iqArgExtendedEdit:
"""The control class of the extended editor of the function argument value."""
def __init__(self, *args, **kwargs):
"""Constructor."""
<|body_0|>
def OnButtonClick(self):
"""The handler for clicking on the button for advanced selection from the... | stack_v2_sparse_classes_36k_train_023389 | 19,825 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "The handler for clicking on the button for advanced selection from the list.",
"name": "OnButtonClick",
"signature": "def OnButtonClick(self)"
}
] | 2 | null | Implement the Python class `iqArgExtendedEdit` described below.
Class description:
The control class of the extended editor of the function argument value.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Constructor.
- def OnButtonClick(self): The handler for clicking on the button for advanc... | Implement the Python class `iqArgExtendedEdit` described below.
Class description:
The control class of the extended editor of the function argument value.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Constructor.
- def OnButtonClick(self): The handler for clicking on the button for advanc... | 7550e242746cb2fb1219474463f8db21f8e3e114 | <|skeleton|>
class iqArgExtendedEdit:
"""The control class of the extended editor of the function argument value."""
def __init__(self, *args, **kwargs):
"""Constructor."""
<|body_0|>
def OnButtonClick(self):
"""The handler for clicking on the button for advanced selection from the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class iqArgExtendedEdit:
"""The control class of the extended editor of the function argument value."""
def __init__(self, *args, **kwargs):
"""Constructor."""
iqCustomComboCtrl.__init__(self, *args, **kwargs)
self.default = None
self.data = None
self.ext_edit_func = Non... | the_stack_v2_python_sparse | iq/components/wx_filterchoicectrl/filter_builder_ctrl.py | XHermitOne/iq_framework | train | 1 |
b062889125c59aeb797c8f6a81ac730c2188ee78 | [
"planeA = Plane(Vector3(0, 0, 0), Vector3(1, 0, 0), Vector3(0, 1, 0))\ncameraPositionA = Vector3(0, 0, 1)\ncameraPositionB = Vector3(0, 0, 0)\nplaneB = Plane(Vector3(0, 0, 0), Vector3(1, 0, 0), Vector3(0, -1, 0))\nself.assertTrue(planeA.isFacingCamera(cameraPositionA))\nself.assertFalse(planeA.isFacingCamera(-camer... | <|body_start_0|>
planeA = Plane(Vector3(0, 0, 0), Vector3(1, 0, 0), Vector3(0, 1, 0))
cameraPositionA = Vector3(0, 0, 1)
cameraPositionB = Vector3(0, 0, 0)
planeB = Plane(Vector3(0, 0, 0), Vector3(1, 0, 0), Vector3(0, -1, 0))
self.assertTrue(planeA.isFacingCamera(cameraPositionA)... | PlaneTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlaneTest:
def testPlaneFacingCamera(self):
"""Tests that it can be calculated if a plane is facing the camera."""
<|body_0|>
def testPlaneObstructingPoint(self):
"""Tests that it can be calculated if a bounded plane obstructs the line between two points."""
... | stack_v2_sparse_classes_36k_train_023390 | 9,667 | no_license | [
{
"docstring": "Tests that it can be calculated if a plane is facing the camera.",
"name": "testPlaneFacingCamera",
"signature": "def testPlaneFacingCamera(self)"
},
{
"docstring": "Tests that it can be calculated if a bounded plane obstructs the line between two points.",
"name": "testPlane... | 2 | stack_v2_sparse_classes_30k_train_014389 | Implement the Python class `PlaneTest` described below.
Class description:
Implement the PlaneTest class.
Method signatures and docstrings:
- def testPlaneFacingCamera(self): Tests that it can be calculated if a plane is facing the camera.
- def testPlaneObstructingPoint(self): Tests that it can be calculated if a bo... | Implement the Python class `PlaneTest` described below.
Class description:
Implement the PlaneTest class.
Method signatures and docstrings:
- def testPlaneFacingCamera(self): Tests that it can be calculated if a plane is facing the camera.
- def testPlaneObstructingPoint(self): Tests that it can be calculated if a bo... | 3920d2a2562a7fe0f58db1b5a1edafb5c30b5434 | <|skeleton|>
class PlaneTest:
def testPlaneFacingCamera(self):
"""Tests that it can be calculated if a plane is facing the camera."""
<|body_0|>
def testPlaneObstructingPoint(self):
"""Tests that it can be calculated if a bounded plane obstructs the line between two points."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PlaneTest:
def testPlaneFacingCamera(self):
"""Tests that it can be calculated if a plane is facing the camera."""
planeA = Plane(Vector3(0, 0, 0), Vector3(1, 0, 0), Vector3(0, 1, 0))
cameraPositionA = Vector3(0, 0, 1)
cameraPositionB = Vector3(0, 0, 0)
planeB = Plane(V... | the_stack_v2_python_sparse | code/vector3_test.py | systemetric/robot-simulator | train | 0 | |
c342702ca2c309a0f1e73a2535d812fee509db80 | [
"super().__init__()\nself._player = player\nself._level = level\nif pygame.font:\n self._font = pygame.font.SysFont('Bauhaus 93', 24)\nself.image = pygame.Surface((0, 0))\nself.rect = self.image.get_rect()",
"health: int = self._player.get_health()\nspheres: int = self._player.get_num_spheres()\nlevel: int = s... | <|body_start_0|>
super().__init__()
self._player = player
self._level = level
if pygame.font:
self._font = pygame.font.SysFont('Bauhaus 93', 24)
self.image = pygame.Surface((0, 0))
self.rect = self.image.get_rect()
<|end_body_0|>
<|body_start_1|>
heal... | Responsible for displaying an updated score. | Scorekeeper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Scorekeeper:
"""Responsible for displaying an updated score."""
def __init__(self, player: Player, level: Level) -> None:
"""Initialize from parameters."""
<|body_0|>
def update(self, screen: pygame.Surface) -> None:
"""Get information from player, level and rend... | stack_v2_sparse_classes_36k_train_023391 | 3,827 | no_license | [
{
"docstring": "Initialize from parameters.",
"name": "__init__",
"signature": "def __init__(self, player: Player, level: Level) -> None"
},
{
"docstring": "Get information from player, level and render.",
"name": "update",
"signature": "def update(self, screen: pygame.Surface) -> None"
... | 2 | null | Implement the Python class `Scorekeeper` described below.
Class description:
Responsible for displaying an updated score.
Method signatures and docstrings:
- def __init__(self, player: Player, level: Level) -> None: Initialize from parameters.
- def update(self, screen: pygame.Surface) -> None: Get information from p... | Implement the Python class `Scorekeeper` described below.
Class description:
Responsible for displaying an updated score.
Method signatures and docstrings:
- def __init__(self, player: Player, level: Level) -> None: Initialize from parameters.
- def update(self, screen: pygame.Surface) -> None: Get information from p... | 0fe17edf6ffcb35265032c6449d866b9434fda00 | <|skeleton|>
class Scorekeeper:
"""Responsible for displaying an updated score."""
def __init__(self, player: Player, level: Level) -> None:
"""Initialize from parameters."""
<|body_0|>
def update(self, screen: pygame.Surface) -> None:
"""Get information from player, level and rend... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Scorekeeper:
"""Responsible for displaying an updated score."""
def __init__(self, player: Player, level: Level) -> None:
"""Initialize from parameters."""
super().__init__()
self._player = player
self._level = level
if pygame.font:
self._font = pygame.... | the_stack_v2_python_sparse | Chapter11TextbookCode/Listing 11-2.py | ProfessorBurke/PythonObjectsGames | train | 3 |
6a519a604b1cb12ca62e8f3c50a323ac9ab7b519 | [
"if returnType is None:\n self._retsig = None\nelse:\n self._retsig = str(returnType)\nif paramsType is None:\n self._sig = None\nelif isinstance(paramsType, (list, tuple)):\n self._sig = '(%s)' % ''.join([str(x) for x in paramsType])\nelif isinstance(paramsType, AnyArguments) or (inspect.isclass(params... | <|body_start_0|>
if returnType is None:
self._retsig = None
else:
self._retsig = str(returnType)
if paramsType is None:
self._sig = None
elif isinstance(paramsType, (list, tuple)):
self._sig = '(%s)' % ''.join([str(x) for x in paramsType])
... | bind(returnType = None, paramsType = Node, methodName = None) This function decorator allows specifying types for bound methods. You can use methodName to rename the method. | bind | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class bind:
"""bind(returnType = None, paramsType = Node, methodName = None) This function decorator allows specifying types for bound methods. You can use methodName to rename the method."""
def __init__(self, returnType=None, paramsType=None, methodName=None):
"""bind constructor"""
... | stack_v2_sparse_classes_36k_train_023392 | 2,871 | no_license | [
{
"docstring": "bind constructor",
"name": "__init__",
"signature": "def __init__(self, returnType=None, paramsType=None, methodName=None)"
},
{
"docstring": "Function generator.",
"name": "__call__",
"signature": "def __call__(self, f)"
}
] | 2 | null | Implement the Python class `bind` described below.
Class description:
bind(returnType = None, paramsType = Node, methodName = None) This function decorator allows specifying types for bound methods. You can use methodName to rename the method.
Method signatures and docstrings:
- def __init__(self, returnType=None, pa... | Implement the Python class `bind` described below.
Class description:
bind(returnType = None, paramsType = Node, methodName = None) This function decorator allows specifying types for bound methods. You can use methodName to rename the method.
Method signatures and docstrings:
- def __init__(self, returnType=None, pa... | c10c172dc0f5b1c164ad2f32905a71424efec489 | <|skeleton|>
class bind:
"""bind(returnType = None, paramsType = Node, methodName = None) This function decorator allows specifying types for bound methods. You can use methodName to rename the method."""
def __init__(self, returnType=None, paramsType=None, methodName=None):
"""bind constructor"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class bind:
"""bind(returnType = None, paramsType = Node, methodName = None) This function decorator allows specifying types for bound methods. You can use methodName to rename the method."""
def __init__(self, returnType=None, paramsType=None, methodName=None):
"""bind constructor"""
if return... | the_stack_v2_python_sparse | src/main/python/pynaoqi-python2.7-2.1.4.13-linux64/qi/_binder.py | dnajd/FluentNao | train | 11 |
05627403e4cea1ed3beb3f06aff01e04f6591ae1 | [
"if root == None:\n return 0\nque = Queue.Queue()\nque.put(root)\nlevel = 1\nwhile not que.empty():\n level_num = que.qsize()\n for i in range(level_num):\n node = que.get()\n if node.left == None and node.right == None:\n return level\n if node.left:\n que.put(no... | <|body_start_0|>
if root == None:
return 0
que = Queue.Queue()
que.put(root)
level = 1
while not que.empty():
level_num = que.qsize()
for i in range(level_num):
node = que.get()
if node.left == None and node.righ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def minDepth_dfs(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root == None:
return 0
que... | stack_v2_sparse_classes_36k_train_023393 | 1,976 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "minDepth",
"signature": "def minDepth(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "minDepth_dfs",
"signature": "def minDepth_dfs(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008528 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minDepth(self, root): :type root: TreeNode :rtype: int
- def minDepth_dfs(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 minDepth(self, root): :type root: TreeNode :rtype: int
- def minDepth_dfs(self, root): :type root: TreeNode :rtype: int
<|skeleton|>
class Solution:
def minDepth(self, ... | 7f961d3a596ea57836b041bb08f5140e964a758c | <|skeleton|>
class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def minDepth_dfs(self, root):
""":type root: TreeNode :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minDepth(self, root):
""":type root: TreeNode :rtype: int"""
if root == None:
return 0
que = Queue.Queue()
que.put(root)
level = 1
while not que.empty():
level_num = que.qsize()
for i in range(level_num):
... | the_stack_v2_python_sparse | DFS/111-Minimum-Depth-of-Binary-Tree.py | coderguanmingyang/LeetCode-GMY | train | 1 | |
307d9e22169d8470c4c8a3b1724dcb4c53f4ad14 | [
"self.e = self.double(dos.e, -1.0)\nself.g = self.double(dos.g)\nself.gz = self.double(dos.gz)\nself.cutoffInd = dos.cutoffInd\nself.cutoff = dos.cutoff\nself.de = dos.de",
"res = (multi * array).tolist()\nres.reverse()\nreturn numpy.array(res + array[1:].tolist())"
] | <|body_start_0|>
self.e = self.double(dos.e, -1.0)
self.g = self.double(dos.g)
self.gz = self.double(dos.gz)
self.cutoffInd = dos.cutoffInd
self.cutoff = dos.cutoff
self.de = dos.de
<|end_body_0|>
<|body_start_1|>
res = (multi * array).tolist()
res.revers... | Simple class to hold a phonon density of states that has been reflected about E=0 to form an even function. Members defined here: e = numpy.array{ energies } de = energy increment g = numpy.array{ density of states, with noise after cutoff } gz = numpy.array{ density of states, with zeros after cutoff } cutoff = energy... | doubleDos | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class doubleDos:
"""Simple class to hold a phonon density of states that has been reflected about E=0 to form an even function. Members defined here: e = numpy.array{ energies } de = energy increment g = numpy.array{ density of states, with noise after cutoff } gz = numpy.array{ density of states, with... | stack_v2_sparse_classes_36k_train_023394 | 1,265 | no_license | [
{
"docstring": "Initinitializes from an instance of class densityOfStates",
"name": "__init__",
"signature": "def __init__(self, dos)"
},
{
"docstring": "Takes an array and returns that array reflected about array[0]. If multi = 1.0, even reflection, if multi = -1.0, odd.",
"name": "double",... | 2 | stack_v2_sparse_classes_30k_train_017914 | Implement the Python class `doubleDos` described below.
Class description:
Simple class to hold a phonon density of states that has been reflected about E=0 to form an even function. Members defined here: e = numpy.array{ energies } de = energy increment g = numpy.array{ density of states, with noise after cutoff } gz... | Implement the Python class `doubleDos` described below.
Class description:
Simple class to hold a phonon density of states that has been reflected about E=0 to form an even function. Members defined here: e = numpy.array{ energies } de = energy increment g = numpy.array{ density of states, with noise after cutoff } gz... | c35814533fa1ebc410f1f11b0664b7bb95a89ecb | <|skeleton|>
class doubleDos:
"""Simple class to hold a phonon density of states that has been reflected about E=0 to form an even function. Members defined here: e = numpy.array{ energies } de = energy increment g = numpy.array{ density of states, with noise after cutoff } gz = numpy.array{ density of states, with... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class doubleDos:
"""Simple class to hold a phonon density of states that has been reflected about E=0 to form an even function. Members defined here: e = numpy.array{ energies } de = energy increment g = numpy.array{ density of states, with noise after cutoff } gz = numpy.array{ density of states, with zeros after ... | the_stack_v2_python_sparse | src/multiphonon2/doubleDos.py | danse-inelastic/multiphonon | train | 1 |
9ca361b8819505e041fd68ec744cb7859f1811e6 | [
"try:\n account = get_current_user()\n thread_dtos = services.messages.threads(account.id)\n api_models = [ThreadApiModel.from_thread_dto(thd) for thd in thread_dtos]\n return ThreadApiModel.ProtoCollection()(items=api_models)\nexcept exp.ServiceExp as e:\n handle_exception(e)",
"thread_id = req.th... | <|body_start_0|>
try:
account = get_current_user()
thread_dtos = services.messages.threads(account.id)
api_models = [ThreadApiModel.from_thread_dto(thd) for thd in thread_dtos]
return ThreadApiModel.ProtoCollection()(items=api_models)
except exp.ServiceExp... | MessagesApi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MessagesApi:
def inbox(self, req):
"""Retrieve the account's inbox."""
<|body_0|>
def thread(self, req):
"""Retrieve messages in a thread. :param req.thread_id: (int) ID of the thread."""
<|body_1|>
def new_thread(self, req):
"""Create a new thre... | stack_v2_sparse_classes_36k_train_023395 | 4,589 | no_license | [
{
"docstring": "Retrieve the account's inbox.",
"name": "inbox",
"signature": "def inbox(self, req)"
},
{
"docstring": "Retrieve messages in a thread. :param req.thread_id: (int) ID of the thread.",
"name": "thread",
"signature": "def thread(self, req)"
},
{
"docstring": "Create ... | 6 | null | Implement the Python class `MessagesApi` described below.
Class description:
Implement the MessagesApi class.
Method signatures and docstrings:
- def inbox(self, req): Retrieve the account's inbox.
- def thread(self, req): Retrieve messages in a thread. :param req.thread_id: (int) ID of the thread.
- def new_thread(s... | Implement the Python class `MessagesApi` described below.
Class description:
Implement the MessagesApi class.
Method signatures and docstrings:
- def inbox(self, req): Retrieve the account's inbox.
- def thread(self, req): Retrieve messages in a thread. :param req.thread_id: (int) ID of the thread.
- def new_thread(s... | 1d6522069da3e5a6de41ce948b04872d0a994cca | <|skeleton|>
class MessagesApi:
def inbox(self, req):
"""Retrieve the account's inbox."""
<|body_0|>
def thread(self, req):
"""Retrieve messages in a thread. :param req.thread_id: (int) ID of the thread."""
<|body_1|>
def new_thread(self, req):
"""Create a new thre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MessagesApi:
def inbox(self, req):
"""Retrieve the account's inbox."""
try:
account = get_current_user()
thread_dtos = services.messages.threads(account.id)
api_models = [ThreadApiModel.from_thread_dto(thd) for thd in thread_dtos]
return ThreadAp... | the_stack_v2_python_sparse | controllers/api/messages.py | venvadlamani/HumanLink | train | 0 | |
9e2d0f0305cdf761828bfc3c49d6c1157376008e | [
"if profile_name:\n session = boto3.session.Session(profile_name=profile_name, region_name=region)\n self.ec2 = session.client('ec2', region_name=region)\nelse:\n self.ec2 = boto3.client('ec2', region_name=region)\nself.account_name = profile_name\nt = time.time()\nself.start_time = datetime.datetime.utcfr... | <|body_start_0|>
if profile_name:
session = boto3.session.Session(profile_name=profile_name, region_name=region)
self.ec2 = session.client('ec2', region_name=region)
else:
self.ec2 = boto3.client('ec2', region_name=region)
self.account_name = profile_name
... | Spot price data and methods | AWSSpotPriceForRegion | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AWSSpotPriceForRegion:
"""Spot price data and methods"""
def __init__(self, region=REGION, profile_name=None):
""":type region: :obj:`str` :arg region: AWS region name :type profile_name: :obj:`str` :arg profile_name: legal AWS profile name"""
<|body_0|>
def init_query(s... | stack_v2_sparse_classes_36k_train_023396 | 6,849 | permissive | [
{
"docstring": ":type region: :obj:`str` :arg region: AWS region name :type profile_name: :obj:`str` :arg profile_name: legal AWS profile name",
"name": "__init__",
"signature": "def __init__(self, region=REGION, profile_name=None)"
},
{
"docstring": "Init AWS spot price query :type spot_price_h... | 4 | stack_v2_sparse_classes_30k_train_006030 | Implement the Python class `AWSSpotPriceForRegion` described below.
Class description:
Spot price data and methods
Method signatures and docstrings:
- def __init__(self, region=REGION, profile_name=None): :type region: :obj:`str` :arg region: AWS region name :type profile_name: :obj:`str` :arg profile_name: legal AWS... | Implement the Python class `AWSSpotPriceForRegion` described below.
Class description:
Spot price data and methods
Method signatures and docstrings:
- def __init__(self, region=REGION, profile_name=None): :type region: :obj:`str` :arg region: AWS region name :type profile_name: :obj:`str` :arg profile_name: legal AWS... | 842fdc91a31879084906d71a7d0c317e5035a925 | <|skeleton|>
class AWSSpotPriceForRegion:
"""Spot price data and methods"""
def __init__(self, region=REGION, profile_name=None):
""":type region: :obj:`str` :arg region: AWS region name :type profile_name: :obj:`str` :arg profile_name: legal AWS profile name"""
<|body_0|>
def init_query(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AWSSpotPriceForRegion:
"""Spot price data and methods"""
def __init__(self, region=REGION, profile_name=None):
""":type region: :obj:`str` :arg region: AWS region name :type profile_name: :obj:`str` :arg profile_name: legal AWS profile name"""
if profile_name:
session = boto3.... | the_stack_v2_python_sparse | src/decisionengine_modules/AWS/transforms/AWSSpotPrice.py | HEPCloud/decisionengine_modules | train | 2 |
6c666b20ff63070b0c7fccb33beab8549357a0a0 | [
"def recursive(outputlist):\n ll = outputlist[-1]\n new_list = [1]\n for i in range(1, len(ll)):\n new_list.append(ll[i - 1] + ll[i])\n new_list.append(1)\n outputlist.append(new_list)\n return outputlist\nif not numRows:\n return []\nout = [[1]]\nfor j in range(1, numRows):\n out = r... | <|body_start_0|>
def recursive(outputlist):
ll = outputlist[-1]
new_list = [1]
for i in range(1, len(ll)):
new_list.append(ll[i - 1] + ll[i])
new_list.append(1)
outputlist.append(new_list)
return outputlist
if not nu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_0|>
def generate_cool(self, numRows):
"""explanation: Any row can be constructed using the offset sum of the previous row 1 3 3 1 0 + 0 1 3 3 1 = 1 4 6 4 1 :type numRows: i... | stack_v2_sparse_classes_36k_train_023397 | 1,836 | no_license | [
{
"docstring": ":type numRows: int :rtype: List[List[int]]",
"name": "generate",
"signature": "def generate(self, numRows)"
},
{
"docstring": "explanation: Any row can be constructed using the offset sum of the previous row 1 3 3 1 0 + 0 1 3 3 1 = 1 4 6 4 1 :type numRows: int :rtype: List[List[i... | 3 | stack_v2_sparse_classes_30k_train_015850 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
- def generate_cool(self, numRows): explanation: Any row can be constructed using the offset sum of the pr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def generate(self, numRows): :type numRows: int :rtype: List[List[int]]
- def generate_cool(self, numRows): explanation: Any row can be constructed using the offset sum of the pr... | 85f71621c54f6b0029f3a2746f022f89dd7419d9 | <|skeleton|>
class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
<|body_0|>
def generate_cool(self, numRows):
"""explanation: Any row can be constructed using the offset sum of the previous row 1 3 3 1 0 + 0 1 3 3 1 = 1 4 6 4 1 :type numRows: i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def generate(self, numRows):
""":type numRows: int :rtype: List[List[int]]"""
def recursive(outputlist):
ll = outputlist[-1]
new_list = [1]
for i in range(1, len(ll)):
new_list.append(ll[i - 1] + ll[i])
new_list.append(1... | the_stack_v2_python_sparse | LeetCode/Array/118_Pascal's_triangle.py | XyK0907/for_work | train | 0 | |
e2eb86c711615ffbd4725a062d3a5594e51e4a07 | [
"if models is None:\n models = self.MODELS\nroot_model = get_root_model(models)\nif issubclass(self.get_writer(path), obj_tables.io.WorkbookWriter):\n self.validate_implicit_relationships(root_model)\n self.validate_implicit_relationships_are_set(model, root_model)\nconfig = wc_lang.config.core.get_config(... | <|body_start_0|>
if models is None:
models = self.MODELS
root_model = get_root_model(models)
if issubclass(self.get_writer(path), obj_tables.io.WorkbookWriter):
self.validate_implicit_relationships(root_model)
self.validate_implicit_relationships_are_set(model... | Write model to file(s) | Writer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Writer:
"""Write model to file(s)"""
def run(self, path, model, models=None, get_related=True, include_all_attributes=False, validate=None, title=None, description=None, keywords=None, version=None, language=None, creator=None, write_schema=False, write_toc=True, extra_entries=0, data_repo_m... | stack_v2_sparse_classes_36k_train_023398 | 15,172 | permissive | [
{
"docstring": "Write a list of model classes to an Excel file, with one worksheet for each model, or to a set of .csv or .tsv files, with one file for each model. Args: path (:obj:`str`): path to write file(s) model (:obj:`type`): a `wc_lang` Model that's a subclass of `obj_tables.Model` models (:obj:`list` of... | 3 | stack_v2_sparse_classes_30k_test_000841 | Implement the Python class `Writer` described below.
Class description:
Write model to file(s)
Method signatures and docstrings:
- def run(self, path, model, models=None, get_related=True, include_all_attributes=False, validate=None, title=None, description=None, keywords=None, version=None, language=None, creator=No... | Implement the Python class `Writer` described below.
Class description:
Write model to file(s)
Method signatures and docstrings:
- def run(self, path, model, models=None, get_related=True, include_all_attributes=False, validate=None, title=None, description=None, keywords=None, version=None, language=None, creator=No... | 113a8b473576fa9c13688d2deb71b4b2ab400a03 | <|skeleton|>
class Writer:
"""Write model to file(s)"""
def run(self, path, model, models=None, get_related=True, include_all_attributes=False, validate=None, title=None, description=None, keywords=None, version=None, language=None, creator=None, write_schema=False, write_toc=True, extra_entries=0, data_repo_m... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Writer:
"""Write model to file(s)"""
def run(self, path, model, models=None, get_related=True, include_all_attributes=False, validate=None, title=None, description=None, keywords=None, version=None, language=None, creator=None, write_schema=False, write_toc=True, extra_entries=0, data_repo_metadata=False... | the_stack_v2_python_sparse | wc_lang/io.py | KarrLab/wc_lang | train | 8 |
d12d7dfc464c164ddc3933854fa9cc3617037162 | [
"if not nums:\n return\nself.sums = [nums[0]]\nfor i in range(len(nums) - 1):\n self.sums.append(self.sums[-1] + nums[i + 1])",
"if i != 0:\n return self.sums[j] - self.sums[i - 1]\nelse:\n return self.sums[j]"
] | <|body_start_0|>
if not nums:
return
self.sums = [nums[0]]
for i in range(len(nums) - 1):
self.sums.append(self.sums[-1] + nums[i + 1])
<|end_body_0|>
<|body_start_1|>
if i != 0:
return self.sums[j] - self.sums[i - 1]
else:
return ... | NumArray | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not nums:
return
self.sums = [nums[0... | stack_v2_sparse_classes_36k_train_023399 | 733 | no_license | [
{
"docstring": ":type nums: List[int]",
"name": "__init__",
"signature": "def __init__(self, nums)"
},
{
"docstring": ":type i: int :type j: int :rtype: int",
"name": "sumRange",
"signature": "def sumRange(self, i, j)"
}
] | 2 | null | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int | Implement the Python class `NumArray` described below.
Class description:
Implement the NumArray class.
Method signatures and docstrings:
- def __init__(self, nums): :type nums: List[int]
- def sumRange(self, i, j): :type i: int :type j: int :rtype: int
<|skeleton|>
class NumArray:
def __init__(self, nums):
... | 85415872711c7c4b646f71ba44b5ef9200c03f5e | <|skeleton|>
class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
<|body_0|>
def sumRange(self, i, j):
""":type i: int :type j: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumArray:
def __init__(self, nums):
""":type nums: List[int]"""
if not nums:
return
self.sums = [nums[0]]
for i in range(len(nums) - 1):
self.sums.append(self.sums[-1] + nums[i + 1])
def sumRange(self, i, j):
""":type i: int :type j: int :rt... | the_stack_v2_python_sparse | 303.py | ninini976/yf_leetcode_problems | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.