blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eb7780bb46c5c5f1464dc0958bfb33eb4229828e | [
"try:\n self.fetch_component_api_public_key()\n self.init_settings()\nexcept ProgrammingError as e:\n logger.info(f'init settings failed, err_msg -> {e}.')\nreturn True",
"if any([settings.BKPAAS_MAJOR_VERSION == env_constants.BkPaaSVersion.V3.value, settings.BK_BACKEND_CONFIG]):\n logger.info('[JWT] ... | <|body_start_0|>
try:
self.fetch_component_api_public_key()
self.init_settings()
except ProgrammingError as e:
logger.info(f'init settings failed, err_msg -> {e}.')
return True
<|end_body_0|>
<|body_start_1|>
if any([settings.BKPAAS_MAJOR_VERSION == e... | ApiConfig | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApiConfig:
def ready(self):
"""初始化部分配置,主要目的是为了SaaS和后台共用部分配置"""
<|body_0|>
def fetch_component_api_public_key(cls):
"""获取JWT公钥并存储到全局配置中"""
<|body_1|>
def init_settings(cls):
"""初始化配置,读取DB后写入settings内存中,避免多次查表"""
<|body_2|>
<|end_skeleton|... | stack_v2_sparse_classes_75kplus_train_004800 | 4,404 | permissive | [
{
"docstring": "初始化部分配置,主要目的是为了SaaS和后台共用部分配置",
"name": "ready",
"signature": "def ready(self)"
},
{
"docstring": "获取JWT公钥并存储到全局配置中",
"name": "fetch_component_api_public_key",
"signature": "def fetch_component_api_public_key(cls)"
},
{
"docstring": "初始化配置,读取DB后写入settings内存中,避免多次查表... | 3 | stack_v2_sparse_classes_30k_train_054751 | Implement the Python class `ApiConfig` described below.
Class description:
Implement the ApiConfig class.
Method signatures and docstrings:
- def ready(self): 初始化部分配置,主要目的是为了SaaS和后台共用部分配置
- def fetch_component_api_public_key(cls): 获取JWT公钥并存储到全局配置中
- def init_settings(cls): 初始化配置,读取DB后写入settings内存中,避免多次查表 | Implement the Python class `ApiConfig` described below.
Class description:
Implement the ApiConfig class.
Method signatures and docstrings:
- def ready(self): 初始化部分配置,主要目的是为了SaaS和后台共用部分配置
- def fetch_component_api_public_key(cls): 获取JWT公钥并存储到全局配置中
- def init_settings(cls): 初始化配置,读取DB后写入settings内存中,避免多次查表
<|skeleton|... | 72d2104783443bff26c752c5bd934a013b302b6d | <|skeleton|>
class ApiConfig:
def ready(self):
"""初始化部分配置,主要目的是为了SaaS和后台共用部分配置"""
<|body_0|>
def fetch_component_api_public_key(cls):
"""获取JWT公钥并存储到全局配置中"""
<|body_1|>
def init_settings(cls):
"""初始化配置,读取DB后写入settings内存中,避免多次查表"""
<|body_2|>
<|end_skeleton|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApiConfig:
def ready(self):
"""初始化部分配置,主要目的是为了SaaS和后台共用部分配置"""
try:
self.fetch_component_api_public_key()
self.init_settings()
except ProgrammingError as e:
logger.info(f'init settings failed, err_msg -> {e}.')
return True
def fetch_comp... | the_stack_v2_python_sparse | apps/node_man/apps.py | TencentBlueKing/bk-nodeman | train | 54 | |
a9dd176012c699ae9f017e84dfaee7f3972e3178 | [
"def getpol(poly):\n nonzero = numpy.flatnonzero(poly != 0.0)\n return (poly, len(poly), nonzero[-1] if len(nonzero) > 0 else -1)\n\ndef lengthen(poly, dl):\n if dl > 0:\n return numpy.concatenate((poly, numpy.zeros(dl)))\n else:\n return poly\npoly_a, len_a, ord_a = getpol(_array(kwargs.p... | <|body_start_0|>
def getpol(poly):
nonzero = numpy.flatnonzero(poly != 0.0)
return (poly, len(poly), nonzero[-1] if len(nonzero) > 0 else -1)
def lengthen(poly, dl):
if dl > 0:
return numpy.concatenate((poly, numpy.zeros(dl)))
else:
... | pyAT thin multipole element | ThinMultipole | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThinMultipole:
"""pyAT thin multipole element"""
def __init__(self, family_name, poly_a, poly_b, **kwargs):
"""ThinMultipole(FamName, PolynomA, PolynomB, **keywords) Available keywords: MaxOrder Number of desired multipoles. Default: highest index of non-zero polynomial coefficients"... | stack_v2_sparse_classes_75kplus_train_004801 | 20,952 | no_license | [
{
"docstring": "ThinMultipole(FamName, PolynomA, PolynomB, **keywords) Available keywords: MaxOrder Number of desired multipoles. Default: highest index of non-zero polynomial coefficients",
"name": "__init__",
"signature": "def __init__(self, family_name, poly_a, poly_b, **kwargs)"
},
{
"docstr... | 2 | stack_v2_sparse_classes_30k_train_035087 | Implement the Python class `ThinMultipole` described below.
Class description:
pyAT thin multipole element
Method signatures and docstrings:
- def __init__(self, family_name, poly_a, poly_b, **kwargs): ThinMultipole(FamName, PolynomA, PolynomB, **keywords) Available keywords: MaxOrder Number of desired multipoles. De... | Implement the Python class `ThinMultipole` described below.
Class description:
pyAT thin multipole element
Method signatures and docstrings:
- def __init__(self, family_name, poly_a, poly_b, **kwargs): ThinMultipole(FamName, PolynomA, PolynomB, **keywords) Available keywords: MaxOrder Number of desired multipoles. De... | f044067fc907a2c1eed72fd8ed21811a3e4fbe11 | <|skeleton|>
class ThinMultipole:
"""pyAT thin multipole element"""
def __init__(self, family_name, poly_a, poly_b, **kwargs):
"""ThinMultipole(FamName, PolynomA, PolynomB, **keywords) Available keywords: MaxOrder Number of desired multipoles. Default: highest index of non-zero polynomial coefficients"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ThinMultipole:
"""pyAT thin multipole element"""
def __init__(self, family_name, poly_a, poly_b, **kwargs):
"""ThinMultipole(FamName, PolynomA, PolynomB, **keywords) Available keywords: MaxOrder Number of desired multipoles. Default: highest index of non-zero polynomial coefficients"""
de... | the_stack_v2_python_sparse | pyat/at/lattice/elements.py | jianghongping/at | train | 1 |
f28575740c6d2f67dc4176c622b7a1d204fb10e5 | [
"super(WordVectorMatchExtractor, self).__init__(options)\nwith tf.gfile.GFile(options.label_file, 'r') as fid:\n self._classes = [line.strip('\\n') for line in fid.readlines()]\nself._num_classes = len(self._classes)\nwith tf.gfile.GFile(options.open_vocabulary_file, 'r') as fid:\n self._open_vocabulary_list ... | <|body_start_0|>
super(WordVectorMatchExtractor, self).__init__(options)
with tf.gfile.GFile(options.label_file, 'r') as fid:
self._classes = [line.strip('\n') for line in fid.readlines()]
self._num_classes = len(self._classes)
with tf.gfile.GFile(options.open_vocabulary_file... | WordVectorMatch extractor. Extracts labels from captions using WordVectorMatch. If ExactMatch failed, match the top-1 vector-space synonym. | WordVectorMatchExtractor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordVectorMatchExtractor:
"""WordVectorMatch extractor. Extracts labels from captions using WordVectorMatch. If ExactMatch failed, match the top-1 vector-space synonym."""
def __init__(self, options):
"""Initializes the label extractor."""
<|body_0|>
def _cosine_similari... | stack_v2_sparse_classes_75kplus_train_004802 | 17,053 | permissive | [
{
"docstring": "Initializes the label extractor.",
"name": "__init__",
"signature": "def __init__(self, options)"
},
{
"docstring": "Computes the cosine similarity between class and token embeddings. Args: class_embs: A [num_classes, embedding_dims] tensor. token_embs: A [batch, num_tokens, embe... | 3 | null | Implement the Python class `WordVectorMatchExtractor` described below.
Class description:
WordVectorMatch extractor. Extracts labels from captions using WordVectorMatch. If ExactMatch failed, match the top-1 vector-space synonym.
Method signatures and docstrings:
- def __init__(self, options): Initializes the label e... | Implement the Python class `WordVectorMatchExtractor` described below.
Class description:
WordVectorMatch extractor. Extracts labels from captions using WordVectorMatch. If ExactMatch failed, match the top-1 vector-space synonym.
Method signatures and docstrings:
- def __init__(self, options): Initializes the label e... | 727b3025f666e2053b3bbf94cf18f9ab56fb1599 | <|skeleton|>
class WordVectorMatchExtractor:
"""WordVectorMatch extractor. Extracts labels from captions using WordVectorMatch. If ExactMatch failed, match the top-1 vector-space synonym."""
def __init__(self, options):
"""Initializes the label extractor."""
<|body_0|>
def _cosine_similari... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WordVectorMatchExtractor:
"""WordVectorMatch extractor. Extracts labels from captions using WordVectorMatch. If ExactMatch failed, match the top-1 vector-space synonym."""
def __init__(self, options):
"""Initializes the label extractor."""
super(WordVectorMatchExtractor, self).__init__(op... | the_stack_v2_python_sparse | models/label_extractor.py | yekeren/Cap2Det | train | 34 |
e4aa19031cda0e419a773a12d03ad717e8a33f1a | [
"super(Set_arrivals, self).__init__(time, 'Set_arrivals')\nself.timestep = timestep\nself.nodes = nodes\nself.case = case",
"for n in self.nodes:\n for i in range(n.max_k):\n if bernoulli_arrival(self.case['arrivals'][i]):\n t = Task(self.time + self.timestep, task_type=self.case['task_type']... | <|body_start_0|>
super(Set_arrivals, self).__init__(time, 'Set_arrivals')
self.timestep = timestep
self.nodes = nodes
self.case = case
<|end_body_0|>
<|body_start_1|>
for n in self.nodes:
for i in range(n.max_k):
if bernoulli_arrival(self.case['arriva... | Set_arrivals calculates which nodes and slices are recieving a task this timestep. Attributes: (super) time: float - the current simulation time timestep: float - the timestep taken until the next arrival calculation nodes: List[Fog_nodes] - a list of fog nodes to which tasks will arrive at their buffers case: case_str... | Set_arrivals | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Set_arrivals:
"""Set_arrivals calculates which nodes and slices are recieving a task this timestep. Attributes: (super) time: float - the current simulation time timestep: float - the timestep taken until the next arrival calculation nodes: List[Fog_nodes] - a list of fog nodes to which tasks wil... | stack_v2_sparse_classes_75kplus_train_004803 | 2,500 | no_license | [
{
"docstring": "Parameters: time: float - the current simulation time timestep: float - the timestep taken until the next arrival calculation nodes: List[Fog_nodes] - a list of fog nodes to which tasks will arrive at their buffers case: case_struct - a structure defined in sim_env.configs settling slices charac... | 2 | stack_v2_sparse_classes_30k_train_042067 | Implement the Python class `Set_arrivals` described below.
Class description:
Set_arrivals calculates which nodes and slices are recieving a task this timestep. Attributes: (super) time: float - the current simulation time timestep: float - the timestep taken until the next arrival calculation nodes: List[Fog_nodes] -... | Implement the Python class `Set_arrivals` described below.
Class description:
Set_arrivals calculates which nodes and slices are recieving a task this timestep. Attributes: (super) time: float - the current simulation time timestep: float - the timestep taken until the next arrival calculation nodes: List[Fog_nodes] -... | a16291d34269a206f98a663fa7dacf48292e1aa8 | <|skeleton|>
class Set_arrivals:
"""Set_arrivals calculates which nodes and slices are recieving a task this timestep. Attributes: (super) time: float - the current simulation time timestep: float - the timestep taken until the next arrival calculation nodes: List[Fog_nodes] - a list of fog nodes to which tasks wil... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Set_arrivals:
"""Set_arrivals calculates which nodes and slices are recieving a task this timestep. Attributes: (super) time: float - the current simulation time timestep: float - the timestep taken until the next arrival calculation nodes: List[Fog_nodes] - a list of fog nodes to which tasks will arrive at t... | the_stack_v2_python_sparse | sim_env/events/set_arrivals.py | luisferreira32/fog-computing-orchestration | train | 1 |
77c7fe299f5c8558b8358cc1e7b7d66093d24967 | [
"if parent.param_type in [ParamTypes.INT_CAT, ParamTypes.FLOAT_CAT, ParamTypes.BOOL, ParamTypes.STRING]:\n if len(condition_range) < 1:\n raise ValueError('Invalid condition_range {}, InCondition for {} should at least have one condition value.'.format(condition_range, parent.param_type))\nelif len(condit... | <|body_start_0|>
if parent.param_type in [ParamTypes.INT_CAT, ParamTypes.FLOAT_CAT, ParamTypes.BOOL, ParamTypes.STRING]:
if len(condition_range) < 1:
raise ValueError('Invalid condition_range {}, InCondition for {} should at least have one condition value.'.format(condition_range, pa... | In Condition. :param HyperParameter child: a child hp. :param HyperParameter parent: a parent hp. :param ConditionTypes condition_type: ConditionTypes. :param list condition_range: list of value in parent. | InCondition | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InCondition:
"""In Condition. :param HyperParameter child: a child hp. :param HyperParameter parent: a parent hp. :param ConditionTypes condition_type: ConditionTypes. :param list condition_range: list of value in parent."""
def __init__(self, child, parent, condition_type, condition_range):... | stack_v2_sparse_classes_75kplus_train_004804 | 4,700 | permissive | [
{
"docstring": "Init InCondition.",
"name": "__init__",
"signature": "def __init__(self, child, parent, condition_type, condition_range)"
},
{
"docstring": "Evaluate this condition. :param value: input `value`. :return: result of evaluate. :rtype: bool.",
"name": "_evaluate",
"signature"... | 2 | null | Implement the Python class `InCondition` described below.
Class description:
In Condition. :param HyperParameter child: a child hp. :param HyperParameter parent: a parent hp. :param ConditionTypes condition_type: ConditionTypes. :param list condition_range: list of value in parent.
Method signatures and docstrings:
-... | Implement the Python class `InCondition` described below.
Class description:
In Condition. :param HyperParameter child: a child hp. :param HyperParameter parent: a parent hp. :param ConditionTypes condition_type: ConditionTypes. :param list condition_range: list of value in parent.
Method signatures and docstrings:
-... | df51ed9c1d6dbde1deef63f2a037a369f8554406 | <|skeleton|>
class InCondition:
"""In Condition. :param HyperParameter child: a child hp. :param HyperParameter parent: a parent hp. :param ConditionTypes condition_type: ConditionTypes. :param list condition_range: list of value in parent."""
def __init__(self, child, parent, condition_type, condition_range):... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InCondition:
"""In Condition. :param HyperParameter child: a child hp. :param HyperParameter parent: a parent hp. :param ConditionTypes condition_type: ConditionTypes. :param list condition_range: list of value in parent."""
def __init__(self, child, parent, condition_type, condition_range):
"""I... | the_stack_v2_python_sparse | built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/core/hyperparameter_space/common/ext_conditions.py | Huawei-Ascend/modelzoo | train | 1 |
29a0378b501a832790627a521435758cdf7b546a | [
"if dump_path is not None:\n if uses_with is not None:\n uses_with['dump_path'] = dump_path\n else:\n uses_with = {'dump_path': dump_path}\nasync with aiohttp.request(method='PUT', url=f'{self.store_api}/rolling_update/{daemonize(id, self._kind)}', json=uses_with, timeout=self.timeout) as respon... | <|body_start_0|>
if dump_path is not None:
if uses_with is not None:
uses_with['dump_path'] = dump_path
else:
uses_with = {'dump_path': dump_path}
async with aiohttp.request(method='PUT', url=f'{self.store_api}/rolling_update/{daemonize(id, self._k... | Async Client to create/update/delete Peods on remote JinaD | AsyncPodClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AsyncPodClient:
"""Async Client to create/update/delete Peods on remote JinaD"""
async def rolling_update(self, id: Union[str, 'DaemonID'], dump_path: Optional[str]=None, *, uses_with: Optional[Dict]=None) -> str:
"""Update a Flow on remote JinaD (only rolling_update supported) :para... | stack_v2_sparse_classes_75kplus_train_004805 | 2,570 | permissive | [
{
"docstring": "Update a Flow on remote JinaD (only rolling_update supported) :param id: Pod ID :param dump_path: path of dump from other flow :param uses_with: the uses_with to update the Executor :return: Pod ID",
"name": "rolling_update",
"signature": "async def rolling_update(self, id: Union[str, 'D... | 2 | stack_v2_sparse_classes_30k_val_002234 | Implement the Python class `AsyncPodClient` described below.
Class description:
Async Client to create/update/delete Peods on remote JinaD
Method signatures and docstrings:
- async def rolling_update(self, id: Union[str, 'DaemonID'], dump_path: Optional[str]=None, *, uses_with: Optional[Dict]=None) -> str: Update a F... | Implement the Python class `AsyncPodClient` described below.
Class description:
Async Client to create/update/delete Peods on remote JinaD
Method signatures and docstrings:
- async def rolling_update(self, id: Union[str, 'DaemonID'], dump_path: Optional[str]=None, *, uses_with: Optional[Dict]=None) -> str: Update a F... | 34c34acfb0115ad2ec4cc8e2e9a86c521855612f | <|skeleton|>
class AsyncPodClient:
"""Async Client to create/update/delete Peods on remote JinaD"""
async def rolling_update(self, id: Union[str, 'DaemonID'], dump_path: Optional[str]=None, *, uses_with: Optional[Dict]=None) -> str:
"""Update a Flow on remote JinaD (only rolling_update supported) :para... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AsyncPodClient:
"""Async Client to create/update/delete Peods on remote JinaD"""
async def rolling_update(self, id: Union[str, 'DaemonID'], dump_path: Optional[str]=None, *, uses_with: Optional[Dict]=None) -> str:
"""Update a Flow on remote JinaD (only rolling_update supported) :param id: Pod ID ... | the_stack_v2_python_sparse | daemon/clients/pods.py | amitesh1as/jina | train | 0 |
bcc44a2caa5cdf2bc494cc3a36a8f3a235a34e45 | [
"furniture = Furniture('1', '2', '3', '4', '5', '6')\nself.assertIsNotNone(furniture.product_code)\nself.assertIsNotNone(furniture.description)\nself.assertIsNotNone(furniture.market_price)\nself.assertIsNotNone(furniture.rental_price)\nself.assertIsNotNone(furniture.material)\nself.assertIsNotNone(furniture.size)"... | <|body_start_0|>
furniture = Furniture('1', '2', '3', '4', '5', '6')
self.assertIsNotNone(furniture.product_code)
self.assertIsNotNone(furniture.description)
self.assertIsNotNone(furniture.market_price)
self.assertIsNotNone(furniture.rental_price)
self.assertIsNotNone(fur... | Contains unit tests for Furniture.py Class | TestFurnitureClass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestFurnitureClass:
"""Contains unit tests for Furniture.py Class"""
def test_initializer(self):
"""Tests the initializer of the Inventory class. Verifies classes attributes are filled when class is instantiated. :return: None"""
<|body_0|>
def test_return_as_dictionary(... | stack_v2_sparse_classes_75kplus_train_004806 | 6,045 | no_license | [
{
"docstring": "Tests the initializer of the Inventory class. Verifies classes attributes are filled when class is instantiated. :return: None",
"name": "test_initializer",
"signature": "def test_initializer(self)"
},
{
"docstring": "Tests the return as dictionary method of the Furniture class. ... | 2 | null | Implement the Python class `TestFurnitureClass` described below.
Class description:
Contains unit tests for Furniture.py Class
Method signatures and docstrings:
- def test_initializer(self): Tests the initializer of the Inventory class. Verifies classes attributes are filled when class is instantiated. :return: None
... | Implement the Python class `TestFurnitureClass` described below.
Class description:
Contains unit tests for Furniture.py Class
Method signatures and docstrings:
- def test_initializer(self): Tests the initializer of the Inventory class. Verifies classes attributes are filled when class is instantiated. :return: None
... | 46d6282518f02029a556e94e607612a47daf675a | <|skeleton|>
class TestFurnitureClass:
"""Contains unit tests for Furniture.py Class"""
def test_initializer(self):
"""Tests the initializer of the Inventory class. Verifies classes attributes are filled when class is instantiated. :return: None"""
<|body_0|>
def test_return_as_dictionary(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestFurnitureClass:
"""Contains unit tests for Furniture.py Class"""
def test_initializer(self):
"""Tests the initializer of the Inventory class. Verifies classes attributes are filled when class is instantiated. :return: None"""
furniture = Furniture('1', '2', '3', '4', '5', '6')
... | the_stack_v2_python_sparse | students/KyleCreek/lesson01/assignment/test_unit.py | Washirican/Python220A_2019 | train | 2 |
236c5ec846244f1ba6ab5c75866341e1f2b1f424 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Win32LobAppRegistryRule()",
"from .win32_lob_app_registry_rule_operation_type import Win32LobAppRegistryRuleOperationType\nfrom .win32_lob_app_rule import Win32LobAppRule\nfrom .win32_lob_app_rule_operator import Win32LobAppRuleOperato... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Win32LobAppRegistryRule()
<|end_body_0|>
<|body_start_1|>
from .win32_lob_app_registry_rule_operation_type import Win32LobAppRegistryRuleOperationType
from .win32_lob_app_rule import Win... | A complex type to store registry rule data for a Win32 LOB app. | Win32LobAppRegistryRule | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Win32LobAppRegistryRule:
"""A complex type to store registry rule data for a Win32 LOB app."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppRegistryRule:
"""Creates a new instance of the appropriate class based on discriminator value Args: p... | stack_v2_sparse_classes_75kplus_train_004807 | 4,160 | 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: Win32LobAppRegistryRule",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrimin... | 3 | null | Implement the Python class `Win32LobAppRegistryRule` described below.
Class description:
A complex type to store registry rule data for a Win32 LOB app.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppRegistryRule: Creates a new instance of t... | Implement the Python class `Win32LobAppRegistryRule` described below.
Class description:
A complex type to store registry rule data for a Win32 LOB app.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppRegistryRule: Creates a new instance of t... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Win32LobAppRegistryRule:
"""A complex type to store registry rule data for a Win32 LOB app."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppRegistryRule:
"""Creates a new instance of the appropriate class based on discriminator value Args: p... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Win32LobAppRegistryRule:
"""A complex type to store registry rule data for a Win32 LOB app."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobAppRegistryRule:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: Th... | the_stack_v2_python_sparse | msgraph/generated/models/win32_lob_app_registry_rule.py | microsoftgraph/msgraph-sdk-python | train | 135 |
32cd70a184febc8e40a164aea7b6e6ba851c92bf | [
"if related_user and (not user.local or user == related_user):\n return\nnotification = cls.objects.filter(user=user, **kwargs).first()\nif not notification:\n notification = cls.objects.create(user=user, **kwargs)\nif related_user:\n notification.related_users.add(related_user)\nnotification.read = False\... | <|body_start_0|>
if related_user and (not user.local or user == related_user):
return
notification = cls.objects.filter(user=user, **kwargs).first()
if not notification:
notification = cls.objects.create(user=user, **kwargs)
if related_user:
notificati... | you've been tagged, liked, followed, etc | Notification | [
"LicenseRef-scancode-warranty-disclaimer"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Notification:
"""you've been tagged, liked, followed, etc"""
def notify(cls, user, related_user, **kwargs):
"""Create a notification"""
<|body_0|>
def notify_list_item(cls, user, list_item):
"""Group the notifications around the list items, not the user"""
... | stack_v2_sparse_classes_75kplus_train_004808 | 11,017 | no_license | [
{
"docstring": "Create a notification",
"name": "notify",
"signature": "def notify(cls, user, related_user, **kwargs)"
},
{
"docstring": "Group the notifications around the list items, not the user",
"name": "notify_list_item",
"signature": "def notify_list_item(cls, user, list_item)"
... | 3 | stack_v2_sparse_classes_30k_train_051310 | Implement the Python class `Notification` described below.
Class description:
you've been tagged, liked, followed, etc
Method signatures and docstrings:
- def notify(cls, user, related_user, **kwargs): Create a notification
- def notify_list_item(cls, user, list_item): Group the notifications around the list items, n... | Implement the Python class `Notification` described below.
Class description:
you've been tagged, liked, followed, etc
Method signatures and docstrings:
- def notify(cls, user, related_user, **kwargs): Create a notification
- def notify_list_item(cls, user, list_item): Group the notifications around the list items, n... | 0f8da5b738047f3c34d60d93f59bdedd8f797224 | <|skeleton|>
class Notification:
"""you've been tagged, liked, followed, etc"""
def notify(cls, user, related_user, **kwargs):
"""Create a notification"""
<|body_0|>
def notify_list_item(cls, user, list_item):
"""Group the notifications around the list items, not the user"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Notification:
"""you've been tagged, liked, followed, etc"""
def notify(cls, user, related_user, **kwargs):
"""Create a notification"""
if related_user and (not user.local or user == related_user):
return
notification = cls.objects.filter(user=user, **kwargs).first()
... | the_stack_v2_python_sparse | bookwyrm/models/notification.py | bookwyrm-social/bookwyrm | train | 1,398 |
27804157bd4866469b89c0294fee607aa4b4d174 | [
"polygons = [PolyGon(pts=[(50, 40), (152, 34), (103, 90), (40, 60)], cls_idx=1), PolyGon(pts=[(0, 0), (10, 5), (4, 8)], cls_idx=2)]\nfeat = Segmentation()\nencoded, parsed = encode_decode(feat=feat, poly_or_rle=polygons, mask_shape=(200, 200))\nassert encoded.keys() == feat.encoded_features.keys()\nparsed = parsed[... | <|body_start_0|>
polygons = [PolyGon(pts=[(50, 40), (152, 34), (103, 90), (40, 60)], cls_idx=1), PolyGon(pts=[(0, 0), (10, 5), (4, 8)], cls_idx=2)]
feat = Segmentation()
encoded, parsed = encode_decode(feat=feat, poly_or_rle=polygons, mask_shape=(200, 200))
assert encoded.keys() == feat.... | TestSegmentationFeature | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSegmentationFeature:
def test_encode_decode_polygon(self):
"""Test Segmentation feature in polygon format"""
<|body_0|>
def test_encode_decode_rle(self):
"""Test Segmentation feature in run-length-encode format"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_004809 | 8,391 | no_license | [
{
"docstring": "Test Segmentation feature in polygon format",
"name": "test_encode_decode_polygon",
"signature": "def test_encode_decode_polygon(self)"
},
{
"docstring": "Test Segmentation feature in run-length-encode format",
"name": "test_encode_decode_rle",
"signature": "def test_enco... | 2 | stack_v2_sparse_classes_30k_train_013301 | Implement the Python class `TestSegmentationFeature` described below.
Class description:
Implement the TestSegmentationFeature class.
Method signatures and docstrings:
- def test_encode_decode_polygon(self): Test Segmentation feature in polygon format
- def test_encode_decode_rle(self): Test Segmentation feature in r... | Implement the Python class `TestSegmentationFeature` described below.
Class description:
Implement the TestSegmentationFeature class.
Method signatures and docstrings:
- def test_encode_decode_polygon(self): Test Segmentation feature in polygon format
- def test_encode_decode_rle(self): Test Segmentation feature in r... | 5da5317cedd380c244f20a96213e883d6ef29de2 | <|skeleton|>
class TestSegmentationFeature:
def test_encode_decode_polygon(self):
"""Test Segmentation feature in polygon format"""
<|body_0|>
def test_encode_decode_rle(self):
"""Test Segmentation feature in run-length-encode format"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestSegmentationFeature:
def test_encode_decode_polygon(self):
"""Test Segmentation feature in polygon format"""
polygons = [PolyGon(pts=[(50, 40), (152, 34), (103, 90), (40, 60)], cls_idx=1), PolyGon(pts=[(0, 0), (10, 5), (4, 8)], cls_idx=2)]
feat = Segmentation()
encoded, par... | the_stack_v2_python_sparse | Database/_unittests/test_features.py | MingRuey/mlbox | train | 2 | |
8beeb73e99f0a1dfd05b1ea7c5b5402b21e91303 | [
"if root is not None:\n self.inOrder(root.left)\n print(root.val)\n self.inOrder(root.right)",
"if root is not None:\n print(root.val)\n self.preOrder(root.left)\n self.preOrder(root.right)",
"if root is not None:\n self.postOrder(root.left)\n self.postOrder(root.right)\n print(root.v... | <|body_start_0|>
if root is not None:
self.inOrder(root.left)
print(root.val)
self.inOrder(root.right)
<|end_body_0|>
<|body_start_1|>
if root is not None:
print(root.val)
self.preOrder(root.left)
self.preOrder(root.right)
<|end_bo... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def inOrder(self, root):
""":param root: :return:"""
<|body_0|>
def preOrder(self, root):
""":param root: :return:"""
<|body_1|>
def postOrder(self, root):
""":param root: :return:"""
<|body_2|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_75kplus_train_004810 | 1,407 | permissive | [
{
"docstring": ":param root: :return:",
"name": "inOrder",
"signature": "def inOrder(self, root)"
},
{
"docstring": ":param root: :return:",
"name": "preOrder",
"signature": "def preOrder(self, root)"
},
{
"docstring": ":param root: :return:",
"name": "postOrder",
"signat... | 3 | stack_v2_sparse_classes_30k_train_025720 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def inOrder(self, root): :param root: :return:
- def preOrder(self, root): :param root: :return:
- def postOrder(self, root): :param root: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def inOrder(self, root): :param root: :return:
- def preOrder(self, root): :param root: :return:
- def postOrder(self, root): :param root: :return:
<|skeleton|>
class Solution:
... | 980af3442afeef459468b381ec3a5505a4275a2e | <|skeleton|>
class Solution:
def inOrder(self, root):
""":param root: :return:"""
<|body_0|>
def preOrder(self, root):
""":param root: :return:"""
<|body_1|>
def postOrder(self, root):
""":param root: :return:"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def inOrder(self, root):
""":param root: :return:"""
if root is not None:
self.inOrder(root.left)
print(root.val)
self.inOrder(root.right)
def preOrder(self, root):
""":param root: :return:"""
if root is not None:
p... | the_stack_v2_python_sparse | TreeTraversals/TreeTraversal.py | anilpai/leetcode | train | 0 | |
42410afe32690036d5cf0124bf2b888b150031b9 | [
"auth = secrets.token_hex(64)\nself.server = ServerThread(source=source, auth=auth, bundlesize=bundlesize, bundlewait=bundlewait, in_memory=in_memory, no_confirm=no_confirm, max_retries=max_retries, eager=eager, address=bind, forever_mode=forever_mode, restart_mode=restart_mode, redirect_failures=redirect_failures)... | <|body_start_0|>
auth = secrets.token_hex(64)
self.server = ServerThread(source=source, auth=auth, bundlesize=bundlesize, bundlewait=bundlewait, in_memory=in_memory, no_confirm=no_confirm, max_retries=max_retries, eager=eager, address=bind, forever_mode=forever_mode, restart_mode=restart_mode, redirect_... | Run server with remote clients via external launcher (e.g., MPI). | RemoteCluster | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemoteCluster:
"""Run server with remote clients via external launcher (e.g., MPI)."""
def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, forever_mode: bool=Fa... | stack_v2_sparse_classes_75kplus_train_004811 | 18,159 | permissive | [
{
"docstring": "Initialize server and client threads with external launcher.",
"name": "__init__",
"signature": "def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, forever... | 3 | stack_v2_sparse_classes_30k_val_001995 | Implement the Python class `RemoteCluster` described below.
Class description:
Run server with remote clients via external launcher (e.g., MPI).
Method signatures and docstrings:
- def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_B... | Implement the Python class `RemoteCluster` described below.
Class description:
Run server with remote clients via external launcher (e.g., MPI).
Method signatures and docstrings:
- def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_B... | e142376249e0fe3de624790600f3c5e99022e047 | <|skeleton|>
class RemoteCluster:
"""Run server with remote clients via external launcher (e.g., MPI)."""
def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, forever_mode: bool=Fa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RemoteCluster:
"""Run server with remote clients via external launcher (e.g., MPI)."""
def __init__(self: RemoteCluster, source: Iterable[str]=None, num_tasks: int=1, template: str=DEFAULT_TEMPLATE, bundlesize: int=DEFAULT_BUNDLESIZE, bundlewait: int=DEFAULT_BUNDLEWAIT, forever_mode: bool=False, restart_... | the_stack_v2_python_sparse | src/hypershell/cluster/remote.py | glentner/hyper-shell | train | 20 |
d41b7e863e11ddf47080e7ff9005b8e059697699 | [
"pre_list = []\nin_list = []\npre_head = root\nin_head = root\n\ndef pre_order_traversal(node):\n if not node:\n return None\n pre_list.append(node.val)\n pre_order_traversal(node.left)\n pre_order_traversal(node.right)\npre_order_traversal(pre_head)\n\ndef in_order_traversal(node):\n if not n... | <|body_start_0|>
pre_list = []
in_list = []
pre_head = root
in_head = root
def pre_order_traversal(node):
if not node:
return None
pre_list.append(node.val)
pre_order_traversal(node.left)
pre_order_traversal(node.ri... | 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_75kplus_train_004812 | 2,646 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_052239 | 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:... | dba95b7c0eae74b00c95f281d4d57d2bc1a938ce | <|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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
pre_list = []
in_list = []
pre_head = root
in_head = root
def pre_order_traversal(node):
if not node:
return None
... | the_stack_v2_python_sparse | Binary Tree/3.Conclusion/Serialize and Deserialize Binary Tree.py | Zer0xPoint/LeetCode | train | 0 | |
70fcfc170900621aae47273e59227ce1c1de0024 | [
"import Queue\nif root is None:\n return True\nq = Queue.Queue()\nq.put(root.left)\nq.put(root.right)\nwhile not q.empty():\n t1 = q.get()\n t2 = q.get()\n if t1 is None and t2 is None:\n continue\n if t1 is None or t2 is None:\n return False\n if t1.val != t2.val:\n return Fa... | <|body_start_0|>
import Queue
if root is None:
return True
q = Queue.Queue()
q.put(root.left)
q.put(root.right)
while not q.empty():
t1 = q.get()
t2 = q.get()
if t1 is None and t2 is None:
continue
... | def isMirror(self, t1, t2): if t1 is None and t2 is None: return True if t1 is None or t2 is None: return False return (t1.val == t2.val) and self.isMirror(t1.left,t2.right) and self.isMirror(t1.right,t2.left) def isSymmetric(self, root): ''' :type root: TreeNode :rtype: bool ''' return self.isMirror(root,root) | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""def isMirror(self, t1, t2): if t1 is None and t2 is None: return True if t1 is None or t2 is None: return False return (t1.val == t2.val) and self.isMirror(t1.left,t2.right) and self.isMirror(t1.right,t2.left) def isSymmetric(self, root): ''' :type root: TreeNode :rtype: bool ''' ret... | stack_v2_sparse_classes_75kplus_train_004813 | 2,504 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: bool",
"name": "isSymmetric",
"signature": "def isSymmetric(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014113 | Implement the Python class `Solution` described below.
Class description:
def isMirror(self, t1, t2): if t1 is None and t2 is None: return True if t1 is None or t2 is None: return False return (t1.val == t2.val) and self.isMirror(t1.left,t2.right) and self.isMirror(t1.right,t2.left) def isSymmetric(self, root): ''' :t... | Implement the Python class `Solution` described below.
Class description:
def isMirror(self, t1, t2): if t1 is None and t2 is None: return True if t1 is None or t2 is None: return False return (t1.val == t2.val) and self.isMirror(t1.left,t2.right) and self.isMirror(t1.right,t2.left) def isSymmetric(self, root): ''' :t... | ba3eadd3953535dad76e4690fb2fb40305f254f0 | <|skeleton|>
class Solution:
"""def isMirror(self, t1, t2): if t1 is None and t2 is None: return True if t1 is None or t2 is None: return False return (t1.val == t2.val) and self.isMirror(t1.left,t2.right) and self.isMirror(t1.right,t2.left) def isSymmetric(self, root): ''' :type root: TreeNode :rtype: bool ''' ret... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""def isMirror(self, t1, t2): if t1 is None and t2 is None: return True if t1 is None or t2 is None: return False return (t1.val == t2.val) and self.isMirror(t1.left,t2.right) and self.isMirror(t1.right,t2.left) def isSymmetric(self, root): ''' :type root: TreeNode :rtype: bool ''' return self.isMi... | the_stack_v2_python_sparse | 101. Symmetric Tree.py | xhygh/hello-world | train | 2 |
435f48322403ca8e571f3bccfe8cc3a0a1677b7e | [
"super().__init__()\ncheck_boundaries(boundaries)\nself.boundaries = boundaries",
"self.randomize(None)\nself.magnitude = self.R.uniform(low=self.boundaries[0], high=self.boundaries[1])\nlength = signal.shape[-1]\nmask = torch.zeros(round(self.magnitude * length))\ntrange = torch.arange(length)\nloc = trange[torc... | <|body_start_0|>
super().__init__()
check_boundaries(boundaries)
self.boundaries = boundaries
<|end_body_0|>
<|body_start_1|>
self.randomize(None)
self.magnitude = self.R.uniform(low=self.boundaries[0], high=self.boundaries[1])
length = signal.shape[-1]
mask = to... | Randomly drop a portion of a signal | SignalRandDrop | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SignalRandDrop:
"""Randomly drop a portion of a signal"""
def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None:
"""Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper values need to be positive default : ``[0.0, 1.0]``"""
... | stack_v2_sparse_classes_75kplus_train_004814 | 16,322 | permissive | [
{
"docstring": "Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper values need to be positive default : ``[0.0, 1.0]``",
"name": "__init__",
"signature": "def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None"
},
{
"docstring": "Args: sig... | 2 | stack_v2_sparse_classes_30k_train_024737 | Implement the Python class `SignalRandDrop` described below.
Class description:
Randomly drop a portion of a signal
Method signatures and docstrings:
- def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None: Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper va... | Implement the Python class `SignalRandDrop` described below.
Class description:
Randomly drop a portion of a signal
Method signatures and docstrings:
- def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None: Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper va... | e48c3e2c741fa3fc705c4425d17ac4a5afac6c47 | <|skeleton|>
class SignalRandDrop:
"""Randomly drop a portion of a signal"""
def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None:
"""Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper values need to be positive default : ``[0.0, 1.0]``"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SignalRandDrop:
"""Randomly drop a portion of a signal"""
def __init__(self, boundaries: Sequence[float]=(0.0, 1.0)) -> None:
"""Args: boundaries: list defining lower and upper boundaries for the signal drop, lower and upper values need to be positive default : ``[0.0, 1.0]``"""
super()._... | the_stack_v2_python_sparse | monai/transforms/signal/array.py | Project-MONAI/MONAI | train | 4,805 |
415374d0cdf745a0774554af3f2a53b3363202a0 | [
"super(Generator, self).__init__()\nassert image_size % 16 == 0, 'image size must be a multiple of 16!'\nself.num_gpu = num_gpu\nself.layer = nn.Sequential()\nconv_depth = conv_dim // 2\nconv_size = 4\nwhile conv_size != image_size:\n conv_depth = conv_depth * 2\n conv_size *= 2\nself.layer.add_module('init.{... | <|body_start_0|>
super(Generator, self).__init__()
assert image_size % 16 == 0, 'image size must be a multiple of 16!'
self.num_gpu = num_gpu
self.layer = nn.Sequential()
conv_depth = conv_dim // 2
conv_size = 4
while conv_size != image_size:
conv_dept... | Model for Generator. | Generator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Generator:
"""Model for Generator."""
def __init__(self, num_channels, z_dim, conv_dim, image_size, num_gpu, num_extra_layers, use_BN):
"""Init for Generator model."""
<|body_0|>
def forward(self, input):
"""Forward step for Generator model."""
<|body_1|>... | stack_v2_sparse_classes_75kplus_train_004815 | 7,633 | permissive | [
{
"docstring": "Init for Generator model.",
"name": "__init__",
"signature": "def __init__(self, num_channels, z_dim, conv_dim, image_size, num_gpu, num_extra_layers, use_BN)"
},
{
"docstring": "Forward step for Generator model.",
"name": "forward",
"signature": "def forward(self, input)... | 2 | stack_v2_sparse_classes_30k_train_046699 | Implement the Python class `Generator` described below.
Class description:
Model for Generator.
Method signatures and docstrings:
- def __init__(self, num_channels, z_dim, conv_dim, image_size, num_gpu, num_extra_layers, use_BN): Init for Generator model.
- def forward(self, input): Forward step for Generator model. | Implement the Python class `Generator` described below.
Class description:
Model for Generator.
Method signatures and docstrings:
- def __init__(self, num_channels, z_dim, conv_dim, image_size, num_gpu, num_extra_layers, use_BN): Init for Generator model.
- def forward(self, input): Forward step for Generator model.
... | fd4498da35ace5a3d1696ff4fbec3568eddbe6a1 | <|skeleton|>
class Generator:
"""Model for Generator."""
def __init__(self, num_channels, z_dim, conv_dim, image_size, num_gpu, num_extra_layers, use_BN):
"""Init for Generator model."""
<|body_0|>
def forward(self, input):
"""Forward step for Generator model."""
<|body_1|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Generator:
"""Model for Generator."""
def __init__(self, num_channels, z_dim, conv_dim, image_size, num_gpu, num_extra_layers, use_BN):
"""Init for Generator model."""
super(Generator, self).__init__()
assert image_size % 16 == 0, 'image size must be a multiple of 16!'
sel... | the_stack_v2_python_sparse | WGAN-GP/models.py | corenel/GAN-Zoo | train | 10 |
fc879d9548df0a7e21dbea4e77f05d5b8276d4a9 | [
"assert isinstance(a, list)\nself.a = a\nself.s = s",
"df = f2 - f1\nalpha = np.zeros(f1.shape)\nfor i_a, a_ in enumerate(self.a):\n d = np.zeros(f1.shape)\n d[i_a + 1:] = f1[i_a + 1:] - 0.5 * (f1 + f2)[:-(i_a + 1)]\n alpha += a_(d)\nreturn phi(df / self.s - alpha)",
"assert isinstance(d, list)\nalpha ... | <|body_start_0|>
assert isinstance(a, list)
self.a = a
self.s = s
<|end_body_0|>
<|body_start_1|>
df = f2 - f1
alpha = np.zeros(f1.shape)
for i_a, a_ in enumerate(self.a):
d = np.zeros(f1.shape)
d[i_a + 1:] = f1[i_a + 1:] - 0.5 * (f1 + f2)[:-(i_a ... | A descriptive model of the bias Bias is deterministic, decision are noisy (probit model) p(y=1|df,d1,...,dtau) = phi( df/s - a(d1) - ... - a(dtau) ) - df = f2 - f1 - di = distance from f1 to mean of previous trial ( i behind ) | DescriptiveModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DescriptiveModel:
"""A descriptive model of the bias Bias is deterministic, decision are noisy (probit model) p(y=1|df,d1,...,dtau) = phi( df/s - a(d1) - ... - a(dtau) ) - df = f2 - f1 - di = distance from f1 to mean of previous trial ( i behind )"""
def __init__(self, a, s):
"""a: b... | stack_v2_sparse_classes_75kplus_train_004816 | 2,349 | no_license | [
{
"docstring": "a: bias function s: sensory std p(y=1|df,d1,...,dtau) = phi( df/s - a(d1) - ... - a(dtau) ) - df = f2 - f1 - di = distance from f1 to mean of previous trial ( i behind )",
"name": "__init__",
"signature": "def __init__(self, a, s)"
},
{
"docstring": "Response probability for a se... | 3 | null | Implement the Python class `DescriptiveModel` described below.
Class description:
A descriptive model of the bias Bias is deterministic, decision are noisy (probit model) p(y=1|df,d1,...,dtau) = phi( df/s - a(d1) - ... - a(dtau) ) - df = f2 - f1 - di = distance from f1 to mean of previous trial ( i behind )
Method si... | Implement the Python class `DescriptiveModel` described below.
Class description:
A descriptive model of the bias Bias is deterministic, decision are noisy (probit model) p(y=1|df,d1,...,dtau) = phi( df/s - a(d1) - ... - a(dtau) ) - df = f2 - f1 - di = distance from f1 to mean of previous trial ( i behind )
Method si... | 2a05aa98b501c8633e1fe2baf611d137740709de | <|skeleton|>
class DescriptiveModel:
"""A descriptive model of the bias Bias is deterministic, decision are noisy (probit model) p(y=1|df,d1,...,dtau) = phi( df/s - a(d1) - ... - a(dtau) ) - df = f2 - f1 - di = distance from f1 to mean of previous trial ( i behind )"""
def __init__(self, a, s):
"""a: b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DescriptiveModel:
"""A descriptive model of the bias Bias is deterministic, decision are noisy (probit model) p(y=1|df,d1,...,dtau) = phi( df/s - a(d1) - ... - a(dtau) ) - df = f2 - f1 - di = distance from f1 to mean of previous trial ( i behind )"""
def __init__(self, a, s):
"""a: bias function ... | the_stack_v2_python_sparse | model/descriptive_model.py | ItayLieder/GMM_simulations | train | 0 |
8ff0d16459494647e04ac06b010654e2d9e6a7cd | [
"sanitized_week_day_str = week_day_str.upper()\nif sanitized_week_day_str not in cls.__members__:\n raise AttributeError(f'Invalid Week Day passed: \"{week_day_str}\"')\nreturn cls[sanitized_week_day_str]",
"if isinstance(day, WeekDay):\n return day\nreturn cls.get_weekday_number(week_day_str=day)",
"if n... | <|body_start_0|>
sanitized_week_day_str = week_day_str.upper()
if sanitized_week_day_str not in cls.__members__:
raise AttributeError(f'Invalid Week Day passed: "{week_day_str}"')
return cls[sanitized_week_day_str]
<|end_body_0|>
<|body_start_1|>
if isinstance(day, WeekDay):... | Python Enum containing Days of the Week. | WeekDay | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeekDay:
"""Python Enum containing Days of the Week."""
def get_weekday_number(cls, week_day_str: str):
"""Return the ISO Week Day Number for a Week Day. :param week_day_str: Full Name of the Week Day. Example: "Sunday" :return: ISO Week Day Number corresponding to the provided Weekd... | stack_v2_sparse_classes_75kplus_train_004817 | 2,675 | permissive | [
{
"docstring": "Return the ISO Week Day Number for a Week Day. :param week_day_str: Full Name of the Week Day. Example: \"Sunday\" :return: ISO Week Day Number corresponding to the provided Weekday",
"name": "get_weekday_number",
"signature": "def get_weekday_number(cls, week_day_str: str)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_050894 | Implement the Python class `WeekDay` described below.
Class description:
Python Enum containing Days of the Week.
Method signatures and docstrings:
- def get_weekday_number(cls, week_day_str: str): Return the ISO Week Day Number for a Week Day. :param week_day_str: Full Name of the Week Day. Example: "Sunday" :return... | Implement the Python class `WeekDay` described below.
Class description:
Python Enum containing Days of the Week.
Method signatures and docstrings:
- def get_weekday_number(cls, week_day_str: str): Return the ISO Week Day Number for a Week Day. :param week_day_str: Full Name of the Week Day. Example: "Sunday" :return... | 1b122c15030e99cef9d4ff26d3781a7a9d6949bc | <|skeleton|>
class WeekDay:
"""Python Enum containing Days of the Week."""
def get_weekday_number(cls, week_day_str: str):
"""Return the ISO Week Day Number for a Week Day. :param week_day_str: Full Name of the Week Day. Example: "Sunday" :return: ISO Week Day Number corresponding to the provided Weekd... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WeekDay:
"""Python Enum containing Days of the Week."""
def get_weekday_number(cls, week_day_str: str):
"""Return the ISO Week Day Number for a Week Day. :param week_day_str: Full Name of the Week Day. Example: "Sunday" :return: ISO Week Day Number corresponding to the provided Weekday"""
... | the_stack_v2_python_sparse | airflow/utils/weekday.py | apache/airflow | train | 22,756 |
24cd457259d79a1d81d4a951c9c228a1402cf834 | [
"if isinstance(key, int):\n return RouterAlert(key)\nif key not in RouterAlert._member_map_:\n extend_enum(RouterAlert, key, default)\nreturn RouterAlert[key]",
"if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 66 <= value <= ... | <|body_start_0|>
if isinstance(key, int):
return RouterAlert(key)
if key not in RouterAlert._member_map_:
extend_enum(RouterAlert, key, default)
return RouterAlert[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <= 65535):
... | Enumeration class for RouterAlert. | RouterAlert | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RouterAlert:
"""Enumeration class for RouterAlert."""
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_75kplus_train_004818 | 7,255 | no_license | [
{
"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_005664 | Implement the Python class `RouterAlert` described below.
Class description:
Enumeration class for RouterAlert.
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 `RouterAlert` described below.
Class description:
Enumeration class for RouterAlert.
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 RouterAlert:... | fd43ccca1d032f8f230c4467dcb5df757669ef13 | <|skeleton|>
class RouterAlert:
"""Enumeration class for RouterAlert."""
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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RouterAlert:
"""Enumeration class for RouterAlert."""
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return RouterAlert(key)
if key not in RouterAlert._member_map_:
extend_enum(RouterAlert, key, default)
... | the_stack_v2_python_sparse | venv/lib/python3.6/site-packages/pcapkit/const/ipv4/router_alert.py | IvanLetteri/MLfeaturesExtractor | train | 0 |
b7a6264e14f9614ad5c5c272e7f574593d8532fd | [
"zeroList = []\nfor i in range(len(nums) - 2):\n for j in range(i + 1, len(nums) - 1):\n for k in range(j + 1, len(nums)):\n if nums[i] + nums[j] + nums[k] == 0:\n numList = (nums[i], nums[j], nums[k])\n if sorted(numList) not in zeroList:\n zero... | <|body_start_0|>
zeroList = []
for i in range(len(nums) - 2):
for j in range(i + 1, len(nums) - 1):
for k in range(j + 1, len(nums)):
if nums[i] + nums[j] + nums[k] == 0:
numList = (nums[i], nums[j], nums[k])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def threeSum_naive(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
zeroList = []
... | stack_v2_sparse_classes_75kplus_train_004819 | 1,788 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum_naive",
"signature": "def threeSum_naive(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum",
"signature": "def threeSum(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_043147 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum_naive(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum_naive(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class Soluti... | 786075e0f9f61cf062703bc0b41cc3191d77f033 | <|skeleton|>
class Solution:
def threeSum_naive(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def threeSum_naive(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
zeroList = []
for i in range(len(nums) - 2):
for j in range(i + 1, len(nums) - 1):
for k in range(j + 1, len(nums)):
if nums[i] + nums[j] + nums... | the_stack_v2_python_sparse | 15_threeSum.py | Anirban2404/LeetCodePractice | train | 1 | |
9ee4d1db58379165f03abebc0be7773a761e1afe | [
"if not l1:\n return l2\nif not l2:\n return l1\nif l1.val < l2.val:\n l1.next = self.mergeTwoLists(l1.next, l2)\n return l1\nelse:\n l2.next = self.mergeTwoLists(l1, l2.next)\n return l2",
"pre_node = dummy_node = ListNode(-1)\nwhile l1 and l2:\n if l1.val < l2.val:\n pre_node.next = ... | <|body_start_0|>
if not l1:
return l2
if not l2:
return l1
if l1.val < l2.val:
l1.next = self.mergeTwoLists(l1.next, l2)
return l1
else:
l2.next = self.mergeTwoLists(l1, l2.next)
return l2
<|end_body_0|>
<|body_star... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode:
"""递归"""
<|body_0|>
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""遍历链表"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not l1:
return l2... | stack_v2_sparse_classes_75kplus_train_004820 | 1,408 | no_license | [
{
"docstring": "递归",
"name": "mergeTwoLists2",
"signature": "def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode"
},
{
"docstring": "遍历链表",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode"
}
] | 2 | stack_v2_sparse_classes_30k_train_043345 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: 递归
- def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 遍历链表 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode: 递归
- def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 遍历链表
<|skeleton|>
class Solution:
de... | c0dd577481b46129d950354d567d332a4d091137 | <|skeleton|>
class Solution:
def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode:
"""递归"""
<|body_0|>
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""遍历链表"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mergeTwoLists2(self, l1: ListNode, l2: ListNode) -> ListNode:
"""递归"""
if not l1:
return l2
if not l2:
return l1
if l1.val < l2.val:
l1.next = self.mergeTwoLists(l1.next, l2)
return l1
else:
l2.ne... | the_stack_v2_python_sparse | leetcode/剑指offer/剑指 Offer 25. 合并两个排序的链表.py | tenqaz/crazy_arithmetic | train | 0 | |
c6a05b94f899cd1dcea921fbd855f008d037e123 | [
"self.learning_rate = learning_rate\nself.beta1 = beta1\nself.beta2 = beta2\nself.m = None\nself.v = None\nself.step = 0",
"epsilon = 1e-07\nif self.m is None:\n self.m = {}\n for key, value in params.items():\n self.m[key] = np.zeros_like(value)\nif self.v is None:\n self.v = {}\n for key, val... | <|body_start_0|>
self.learning_rate = learning_rate
self.beta1 = beta1
self.beta2 = beta2
self.m = None
self.v = None
self.step = 0
<|end_body_0|>
<|body_start_1|>
epsilon = 1e-07
if self.m is None:
self.m = {}
for key, value in pa... | Implementation of https://arxiv.org/abs/1412.6980v9 [Algorithm 1] | Adam | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Adam:
"""Implementation of https://arxiv.org/abs/1412.6980v9 [Algorithm 1]"""
def __init__(self, learning_rate=0.01, beta1=0.9, beta2=0.999):
"""initialize learning_rate: learning rate for iteration beta1: exponential decay rate for 1st order moment `m` beta2: exponential decay rate ... | stack_v2_sparse_classes_75kplus_train_004821 | 2,008 | permissive | [
{
"docstring": "initialize learning_rate: learning rate for iteration beta1: exponential decay rate for 1st order moment `m` beta2: exponential decay rate for 2nd order moment `v`",
"name": "__init__",
"signature": "def __init__(self, learning_rate=0.01, beta1=0.9, beta2=0.999)"
},
{
"docstring"... | 2 | stack_v2_sparse_classes_30k_train_041992 | Implement the Python class `Adam` described below.
Class description:
Implementation of https://arxiv.org/abs/1412.6980v9 [Algorithm 1]
Method signatures and docstrings:
- def __init__(self, learning_rate=0.01, beta1=0.9, beta2=0.999): initialize learning_rate: learning rate for iteration beta1: exponential decay rat... | Implement the Python class `Adam` described below.
Class description:
Implementation of https://arxiv.org/abs/1412.6980v9 [Algorithm 1]
Method signatures and docstrings:
- def __init__(self, learning_rate=0.01, beta1=0.9, beta2=0.999): initialize learning_rate: learning rate for iteration beta1: exponential decay rat... | 70ec531578f099136744d2c1ec11959b239c3854 | <|skeleton|>
class Adam:
"""Implementation of https://arxiv.org/abs/1412.6980v9 [Algorithm 1]"""
def __init__(self, learning_rate=0.01, beta1=0.9, beta2=0.999):
"""initialize learning_rate: learning rate for iteration beta1: exponential decay rate for 1st order moment `m` beta2: exponential decay rate ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Adam:
"""Implementation of https://arxiv.org/abs/1412.6980v9 [Algorithm 1]"""
def __init__(self, learning_rate=0.01, beta1=0.9, beta2=0.999):
"""initialize learning_rate: learning rate for iteration beta1: exponential decay rate for 1st order moment `m` beta2: exponential decay rate for 2nd order... | the_stack_v2_python_sparse | ch06/Adam.py | sankaku/deep-learning-from-scratch-py | train | 0 |
9f68c81b091c4a3a372cc5b4b3d73652f4161841 | [
"ans = [[]]\nnums.sort()\ncount, i = (0, 0)\nwhile i < len(nums):\n while i + count < len(nums) and nums[i] == nums[count + i]:\n count += 1\n for k in range(len(ans)):\n tmp = ans[k][:]\n for j in range(count):\n tmp.append(nums[i])\n ans.append(tmp[:])\n i += co... | <|body_start_0|>
ans = [[]]
nums.sort()
count, i = (0, 0)
while i < len(nums):
while i + count < len(nums) and nums[i] == nums[count + i]:
count += 1
for k in range(len(ans)):
tmp = ans[k][:]
for j in range(count):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def subsetsWithDup(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def subsetsWithDup(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ans = [[]]
... | stack_v2_sparse_classes_75kplus_train_004822 | 1,485 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "subsetsWithDup",
"signature": "def subsetsWithDup(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "subsetsWithDup",
"signature": "def subsetsWithDup(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002625 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def subsetsWithDup(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class ... | 22794e5e80f534c41ff81eb40072acaa1346a75c | <|skeleton|>
class Solution:
def subsetsWithDup(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def subsetsWithDup(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def subsetsWithDup(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
ans = [[]]
nums.sort()
count, i = (0, 0)
while i < len(nums):
while i + count < len(nums) and nums[i] == nums[count + i]:
count += 1
for... | the_stack_v2_python_sparse | 90.py | huosan0123/leetcode-py | train | 0 | |
18149781f8d34af5b23ef5321bee6c4bf434b1c3 | [
"if not hasattr(self, 'likes'):\n return 0\nreturn len(self.likes.all())",
"if not hasattr(self, 'likes'):\n return False\nfor like in self.likes.all():\n if like.user.pk == user.pk:\n return True\nreturn False"
] | <|body_start_0|>
if not hasattr(self, 'likes'):
return 0
return len(self.likes.all())
<|end_body_0|>
<|body_start_1|>
if not hasattr(self, 'likes'):
return False
for like in self.likes.all():
if like.user.pk == user.pk:
return True
... | Abstract class for models contain `likes` | LikeMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LikeMixin:
"""Abstract class for models contain `likes`"""
def number_of_like(self):
"""Computed property, return the number of like"""
<|body_0|>
def is_liked_by_user(self, user):
"""Check if a user is liked this media"""
<|body_1|>
<|end_skeleton|>
<|... | stack_v2_sparse_classes_75kplus_train_004823 | 1,902 | no_license | [
{
"docstring": "Computed property, return the number of like",
"name": "number_of_like",
"signature": "def number_of_like(self)"
},
{
"docstring": "Check if a user is liked this media",
"name": "is_liked_by_user",
"signature": "def is_liked_by_user(self, user)"
}
] | 2 | stack_v2_sparse_classes_30k_train_049023 | Implement the Python class `LikeMixin` described below.
Class description:
Abstract class for models contain `likes`
Method signatures and docstrings:
- def number_of_like(self): Computed property, return the number of like
- def is_liked_by_user(self, user): Check if a user is liked this media | Implement the Python class `LikeMixin` described below.
Class description:
Abstract class for models contain `likes`
Method signatures and docstrings:
- def number_of_like(self): Computed property, return the number of like
- def is_liked_by_user(self, user): Check if a user is liked this media
<|skeleton|>
class Li... | 2f50b3815474845dd8c08f2a6f0213d5da3a5413 | <|skeleton|>
class LikeMixin:
"""Abstract class for models contain `likes`"""
def number_of_like(self):
"""Computed property, return the number of like"""
<|body_0|>
def is_liked_by_user(self, user):
"""Check if a user is liked this media"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LikeMixin:
"""Abstract class for models contain `likes`"""
def number_of_like(self):
"""Computed property, return the number of like"""
if not hasattr(self, 'likes'):
return 0
return len(self.likes.all())
def is_liked_by_user(self, user):
"""Check if a use... | the_stack_v2_python_sparse | utils/models.py | raviteja2250/tabletop-backend-develop | train | 0 |
986c9ee24b0f0fa54c77baaf71d188c6f623bef1 | [
"for i in range(replays):\n lists = [states[:-1], states[1:], actions, rewards, list(range(len(actions)))]\n if update_order == 'forward':\n zipped = zip(*lists)\n elif update_order == 'reverse':\n zipped = zip(*[reversed(x) for x in lists])\n elif update_order == 'random':\n inds =... | <|body_start_0|>
for i in range(replays):
lists = [states[:-1], states[1:], actions, rewards, list(range(len(actions)))]
if update_order == 'forward':
zipped = zip(*lists)
elif update_order == 'reverse':
zipped = zip(*[reversed(x) for x in list... | QLearning | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QLearning:
def update(self, states, actions, rewards, replays=1, alpha=0.05, gamma=1, update_order='forward'):
"""update Q function based on trajectory of states, actions, and rewards"""
<|body_0|>
def step_update(self, epsilon=0, alpha=0.05, gamma=1):
"""take a step... | stack_v2_sparse_classes_75kplus_train_004824 | 7,134 | no_license | [
{
"docstring": "update Q function based on trajectory of states, actions, and rewards",
"name": "update",
"signature": "def update(self, states, actions, rewards, replays=1, alpha=0.05, gamma=1, update_order='forward')"
},
{
"docstring": "take a step while updating Q for online learning",
"n... | 3 | stack_v2_sparse_classes_30k_train_012917 | Implement the Python class `QLearning` described below.
Class description:
Implement the QLearning class.
Method signatures and docstrings:
- def update(self, states, actions, rewards, replays=1, alpha=0.05, gamma=1, update_order='forward'): update Q function based on trajectory of states, actions, and rewards
- def ... | Implement the Python class `QLearning` described below.
Class description:
Implement the QLearning class.
Method signatures and docstrings:
- def update(self, states, actions, rewards, replays=1, alpha=0.05, gamma=1, update_order='forward'): update Q function based on trajectory of states, actions, and rewards
- def ... | ab6216a00f30cb5c3ea896b7a0fda7f01845c206 | <|skeleton|>
class QLearning:
def update(self, states, actions, rewards, replays=1, alpha=0.05, gamma=1, update_order='forward'):
"""update Q function based on trajectory of states, actions, and rewards"""
<|body_0|>
def step_update(self, epsilon=0, alpha=0.05, gamma=1):
"""take a step... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QLearning:
def update(self, states, actions, rewards, replays=1, alpha=0.05, gamma=1, update_order='forward'):
"""update Q function based on trajectory of states, actions, and rewards"""
for i in range(replays):
lists = [states[:-1], states[1:], actions, rewards, list(range(len(act... | the_stack_v2_python_sparse | gridworld/rickgrid/Agents.py | richard-warren/rl_sandbox | train | 0 | |
a9c7b6306224f0070b2e33a6d789bba4dd822aa1 | [
"self.m = m\nself.plus = MapBtn('fa-solid fa-plus', attributes={'data-step': 1})\nself.minus = MapBtn('fa-solid fa-minus', attributes={'data-step': -1})\nself.plus.class_list.add('v-zoom-plus')\nself.minus.class_list.add('v-zoom-minus')\ncontent = sw.Layout(column=True, children=[self.plus, self.minus])\nkwargs.set... | <|body_start_0|>
self.m = m
self.plus = MapBtn('fa-solid fa-plus', attributes={'data-step': 1})
self.minus = MapBtn('fa-solid fa-minus', attributes={'data-step': -1})
self.plus.class_list.add('v-zoom-plus')
self.minus.class_list.add('v-zoom-minus')
content = sw.Layout(col... | ZoomControl | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZoomControl:
def __init__(self, m: Map, **kwargs) -> None:
"""Customized ``Control`` to zoom in and out on the map. Replace the built-in zoom control of ipyleaflet to match the theme of sepal-ui based applications. It is by default positioned in the top-right corner Args: m: the map to m... | stack_v2_sparse_classes_75kplus_train_004825 | 2,073 | permissive | [
{
"docstring": "Customized ``Control`` to zoom in and out on the map. Replace the built-in zoom control of ipyleaflet to match the theme of sepal-ui based applications. It is by default positioned in the top-right corner Args: m: the map to manipulate kwargs: any ``ipyleaflet.widgetControl`` arguments",
"na... | 2 | stack_v2_sparse_classes_30k_train_054220 | Implement the Python class `ZoomControl` described below.
Class description:
Implement the ZoomControl class.
Method signatures and docstrings:
- def __init__(self, m: Map, **kwargs) -> None: Customized ``Control`` to zoom in and out on the map. Replace the built-in zoom control of ipyleaflet to match the theme of se... | Implement the Python class `ZoomControl` described below.
Class description:
Implement the ZoomControl class.
Method signatures and docstrings:
- def __init__(self, m: Map, **kwargs) -> None: Customized ``Control`` to zoom in and out on the map. Replace the built-in zoom control of ipyleaflet to match the theme of se... | b26c7d698659d5c5a2029d02fc94dcd9daf0df98 | <|skeleton|>
class ZoomControl:
def __init__(self, m: Map, **kwargs) -> None:
"""Customized ``Control`` to zoom in and out on the map. Replace the built-in zoom control of ipyleaflet to match the theme of sepal-ui based applications. It is by default positioned in the top-right corner Args: m: the map to m... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZoomControl:
def __init__(self, m: Map, **kwargs) -> None:
"""Customized ``Control`` to zoom in and out on the map. Replace the built-in zoom control of ipyleaflet to match the theme of sepal-ui based applications. It is by default positioned in the top-right corner Args: m: the map to manipulate kwar... | the_stack_v2_python_sparse | sepal_ui/mapping/zoom_control.py | 12rambau/sepal_ui | train | 17 | |
1970eb16153e4e1b0087b6b1b8749fcdf6239f72 | [
"self.archivelog_keep_days = archivelog_keep_days\nself.archivelog_keep_hours = archivelog_keep_hours\nself.credentials = credentials\nself.db_unique_name = db_unique_name\nself.db_uuid = db_uuid\nself.enable_dg_primary_backup = enable_dg_primary_backup\nself.host_info_vec = host_info_vec\nself.max_num_host = max_n... | <|body_start_0|>
self.archivelog_keep_days = archivelog_keep_days
self.archivelog_keep_hours = archivelog_keep_hours
self.credentials = credentials
self.db_unique_name = db_unique_name
self.db_uuid = db_uuid
self.enable_dg_primary_backup = enable_dg_primary_backup
... | Implementation of the 'OracleDBChannelInfo' model. Note: The name of this proto message is out-dated. This proto can represent more than just the database channel information. It should be renamed in the future. Attributes: archivelog_keep_days (int): Archived log deletion policy for this unique Oracle database. 1: kee... | OracleDBChannelInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OracleDBChannelInfo:
"""Implementation of the 'OracleDBChannelInfo' model. Note: The name of this proto message is out-dated. This proto can represent more than just the database channel information. It should be renamed in the future. Attributes: archivelog_keep_days (int): Archived log deletion... | stack_v2_sparse_classes_75kplus_train_004826 | 6,311 | permissive | [
{
"docstring": "Constructor for the OracleDBChannelInfo class",
"name": "__init__",
"signature": "def __init__(self, archivelog_keep_days=None, archivelog_keep_hours=None, credentials=None, db_unique_name=None, db_uuid=None, enable_dg_primary_backup=None, host_info_vec=None, max_num_host=None, num_chann... | 2 | null | Implement the Python class `OracleDBChannelInfo` described below.
Class description:
Implementation of the 'OracleDBChannelInfo' model. Note: The name of this proto message is out-dated. This proto can represent more than just the database channel information. It should be renamed in the future. Attributes: archivelog... | Implement the Python class `OracleDBChannelInfo` described below.
Class description:
Implementation of the 'OracleDBChannelInfo' model. Note: The name of this proto message is out-dated. This proto can represent more than just the database channel information. It should be renamed in the future. Attributes: archivelog... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class OracleDBChannelInfo:
"""Implementation of the 'OracleDBChannelInfo' model. Note: The name of this proto message is out-dated. This proto can represent more than just the database channel information. It should be renamed in the future. Attributes: archivelog_keep_days (int): Archived log deletion... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OracleDBChannelInfo:
"""Implementation of the 'OracleDBChannelInfo' model. Note: The name of this proto message is out-dated. This proto can represent more than just the database channel information. It should be renamed in the future. Attributes: archivelog_keep_days (int): Archived log deletion policy for t... | the_stack_v2_python_sparse | cohesity_management_sdk/models/oracle_db_channel_info.py | cohesity/management-sdk-python | train | 24 |
a8a935143bcdc065a0695e5bd358af99cbd5d8cd | [
"if not exactly_one(destination_table_definition, destination_sql):\n raise ETLInputError('One of dest table or dest sql needed')\nif script_arguments is None:\n script_arguments = list()\nif sql_tail_for_source is None:\n sql_tail_for_source = ''\ndest_sql, primary_key_index = self.convert_destination_to_... | <|body_start_0|>
if not exactly_one(destination_table_definition, destination_sql):
raise ETLInputError('One of dest table or dest sql needed')
if script_arguments is None:
script_arguments = list()
if sql_tail_for_source is None:
sql_tail_for_source = ''
... | ColumnCheckStep class that checks if the rows of a table has been populated with the correct values | ColumnCheckStep | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ColumnCheckStep:
"""ColumnCheckStep class that checks if the rows of a table has been populated with the correct values"""
def __init__(self, id, source_sql, source_host, destination_table_definition=None, script=None, destination_sql=None, sql_tail_for_source=None, sample_size=100, toleranc... | stack_v2_sparse_classes_75kplus_train_004827 | 5,778 | permissive | [
{
"docstring": "Constructor for the ColumnCheckStep class Args: destination_table_definition(file): table definition for the destination table **kwargs(optional): Keyword arguments directly passed to base class",
"name": "__init__",
"signature": "def __init__(self, id, source_sql, source_host, destinati... | 3 | stack_v2_sparse_classes_30k_train_002176 | Implement the Python class `ColumnCheckStep` described below.
Class description:
ColumnCheckStep class that checks if the rows of a table has been populated with the correct values
Method signatures and docstrings:
- def __init__(self, id, source_sql, source_host, destination_table_definition=None, script=None, desti... | Implement the Python class `ColumnCheckStep` described below.
Class description:
ColumnCheckStep class that checks if the rows of a table has been populated with the correct values
Method signatures and docstrings:
- def __init__(self, id, source_sql, source_host, destination_table_definition=None, script=None, desti... | 797cb719e6c2abeda0751ada3339c72bfb19c8f2 | <|skeleton|>
class ColumnCheckStep:
"""ColumnCheckStep class that checks if the rows of a table has been populated with the correct values"""
def __init__(self, id, source_sql, source_host, destination_table_definition=None, script=None, destination_sql=None, sql_tail_for_source=None, sample_size=100, toleranc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ColumnCheckStep:
"""ColumnCheckStep class that checks if the rows of a table has been populated with the correct values"""
def __init__(self, id, source_sql, source_host, destination_table_definition=None, script=None, destination_sql=None, sql_tail_for_source=None, sample_size=100, tolerance=1.0, script... | the_stack_v2_python_sparse | dataduct/steps/column_check.py | EverFi/dataduct | train | 3 |
001556dc0613a70bb7af7de995cf9a37e75ec170 | [
"self.grid = ugrid\npts = self.grid.GetPoints()\nnumPoints = pts.GetNumberOfPoints()\ndata = vtk.vtkDoubleArray()\ndata.SetName(name)\ndata.SetNumberOfComponents(1)\ndata.SetNumberOfTuples(numPoints)\nfor i in range(numPoints):\n xyz = pts.GetPoint(i)\n f = nodalFunc(xyz)\n data.SetTuple(i, (f,))\nself.gri... | <|body_start_0|>
self.grid = ugrid
pts = self.grid.GetPoints()
numPoints = pts.GetNumberOfPoints()
data = vtk.vtkDoubleArray()
data.SetName(name)
data.SetNumberOfComponents(1)
data.SetNumberOfTuples(numPoints)
for i in range(numPoints):
xyz = p... | NodalFunctionWriter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NodalFunctionWriter:
def __init__(self, ugrid, nodalFunc, name='nodalFunction'):
"""Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc"""
<|body_0|>
def save(self, filename):
"""Save data in file @param filename file name"""
<|body_1|>
<|... | stack_v2_sparse_classes_75kplus_train_004828 | 962 | no_license | [
{
"docstring": "Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc",
"name": "__init__",
"signature": "def __init__(self, ugrid, nodalFunc, name='nodalFunction')"
},
{
"docstring": "Save data in file @param filename file name",
"name": "save",
"signature": "def save(s... | 2 | stack_v2_sparse_classes_30k_train_029966 | Implement the Python class `NodalFunctionWriter` described below.
Class description:
Implement the NodalFunctionWriter class.
Method signatures and docstrings:
- def __init__(self, ugrid, nodalFunc, name='nodalFunction'): Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc
- def save(self, filename... | Implement the Python class `NodalFunctionWriter` described below.
Class description:
Implement the NodalFunctionWriter class.
Method signatures and docstrings:
- def __init__(self, ugrid, nodalFunc, name='nodalFunction'): Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc
- def save(self, filename... | 383bfa5e8b450eda0cbc6bdebf092e81712034e4 | <|skeleton|>
class NodalFunctionWriter:
def __init__(self, ugrid, nodalFunc, name='nodalFunction'):
"""Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc"""
<|body_0|>
def save(self, filename):
"""Save data in file @param filename file name"""
<|body_1|>
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NodalFunctionWriter:
def __init__(self, ugrid, nodalFunc, name='nodalFunction'):
"""Constructor @param ugrid vtkUnstructuredGrid instance @param nodalFunc"""
self.grid = ugrid
pts = self.grid.GetPoints()
numPoints = pts.GetNumberOfPoints()
data = vtk.vtkDoubleArray()
... | the_stack_v2_python_sparse | py/igNodalFunctionWriter.py | pletzer/inugrid | train | 0 | |
1589d5646a09cfe8091a95331f4faeb138279e63 | [
"with open(os.path.join(C.HOME, 'etc/enarksh.xsd'), 'rb') as f:\n xsd = f.read()\netree.clear_error_log()\nschema_root = etree.XML(xsd)\nschema = etree.XMLSchema(schema_root)\nparser = etree.XMLParser(schema=schema, encoding='utf8')\ntry:\n root = etree.fromstring(bytes(xml, 'utf8'), parser)\n if root.tag ... | <|body_start_0|>
with open(os.path.join(C.HOME, 'etc/enarksh.xsd'), 'rb') as f:
xsd = f.read()
etree.clear_error_log()
schema_root = etree.XML(xsd)
schema = etree.XMLSchema(schema_root)
parser = etree.XMLParser(schema=schema, encoding='utf8')
try:
... | XmlReader | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XmlReader:
def parse_schedule(xml, filename):
"""Parses a schedule definition in XML. :param str xml: The XML with a schedule definition :param str filename: :rtype: enarksh.xml_reader.node.ScheduleNode"""
<|body_0|>
def parse_dynamic_worker(xml, parent):
"""Parses a... | stack_v2_sparse_classes_75kplus_train_004829 | 4,365 | permissive | [
{
"docstring": "Parses a schedule definition in XML. :param str xml: The XML with a schedule definition :param str filename: :rtype: enarksh.xml_reader.node.ScheduleNode",
"name": "parse_schedule",
"signature": "def parse_schedule(xml, filename)"
},
{
"docstring": "Parses a schedule definition i... | 3 | stack_v2_sparse_classes_30k_train_006831 | Implement the Python class `XmlReader` described below.
Class description:
Implement the XmlReader class.
Method signatures and docstrings:
- def parse_schedule(xml, filename): Parses a schedule definition in XML. :param str xml: The XML with a schedule definition :param str filename: :rtype: enarksh.xml_reader.node.... | Implement the Python class `XmlReader` described below.
Class description:
Implement the XmlReader class.
Method signatures and docstrings:
- def parse_schedule(xml, filename): Parses a schedule definition in XML. :param str xml: The XML with a schedule definition :param str filename: :rtype: enarksh.xml_reader.node.... | ec0c33cdae4a0afeea37928743abd744ef291a9f | <|skeleton|>
class XmlReader:
def parse_schedule(xml, filename):
"""Parses a schedule definition in XML. :param str xml: The XML with a schedule definition :param str filename: :rtype: enarksh.xml_reader.node.ScheduleNode"""
<|body_0|>
def parse_dynamic_worker(xml, parent):
"""Parses a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class XmlReader:
def parse_schedule(xml, filename):
"""Parses a schedule definition in XML. :param str xml: The XML with a schedule definition :param str filename: :rtype: enarksh.xml_reader.node.ScheduleNode"""
with open(os.path.join(C.HOME, 'etc/enarksh.xsd'), 'rb') as f:
xsd = f.read(... | the_stack_v2_python_sparse | enarksh/xml_reader/XmlReader.py | SetBased/py-enarksh | train | 3 | |
3ed2d6c4d2b2cb5fd0ebf01b6409917d55bba0c4 | [
"if authorization_header is None or type(authorization_header) != str:\n return None\nif authorization_header[0:6] != 'Basic ':\n return None\nreturn authorization_header[6:]",
"if base64_authorization_header is None or type(base64_authorization_header) != str:\n return None\ntry:\n return b64decode(b... | <|body_start_0|>
if authorization_header is None or type(authorization_header) != str:
return None
if authorization_header[0:6] != 'Basic ':
return None
return authorization_header[6:]
<|end_body_0|>
<|body_start_1|>
if base64_authorization_header is None or type... | inherits from auth | BasicAuth | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicAuth:
"""inherits from auth"""
def extract_base64_authorization_header(self, authorization_header: str) -> str:
"""returns the base64 part for authorization"""
<|body_0|>
def decode_base64_authorization_header(self, base64_authorization_header: str) -> str:
... | stack_v2_sparse_classes_75kplus_train_004830 | 2,917 | no_license | [
{
"docstring": "returns the base64 part for authorization",
"name": "extract_base64_authorization_header",
"signature": "def extract_base64_authorization_header(self, authorization_header: str) -> str"
},
{
"docstring": "decoded value of base64 str",
"name": "decode_base64_authorization_head... | 5 | stack_v2_sparse_classes_30k_train_033098 | Implement the Python class `BasicAuth` described below.
Class description:
inherits from auth
Method signatures and docstrings:
- def extract_base64_authorization_header(self, authorization_header: str) -> str: returns the base64 part for authorization
- def decode_base64_authorization_header(self, base64_authorizati... | Implement the Python class `BasicAuth` described below.
Class description:
inherits from auth
Method signatures and docstrings:
- def extract_base64_authorization_header(self, authorization_header: str) -> str: returns the base64 part for authorization
- def decode_base64_authorization_header(self, base64_authorizati... | c0182a227da7a47fd641b3d9e085243b36b626db | <|skeleton|>
class BasicAuth:
"""inherits from auth"""
def extract_base64_authorization_header(self, authorization_header: str) -> str:
"""returns the base64 part for authorization"""
<|body_0|>
def decode_base64_authorization_header(self, base64_authorization_header: str) -> str:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicAuth:
"""inherits from auth"""
def extract_base64_authorization_header(self, authorization_header: str) -> str:
"""returns the base64 part for authorization"""
if authorization_header is None or type(authorization_header) != str:
return None
if authorization_heade... | the_stack_v2_python_sparse | 0x07-Session_authentication/api/v1/auth/basic_auth.py | Jilroge7/holbertonschool-web_back_end | train | 0 |
cd304260a992fbef7915dfaddcd9d4274396174c | [
"classParams = parameters.params\nparnames = [x for x, y, z, v, c in classParams]\nif type(excludeparams) is not list:\n excludeparams = [excludeparams]\nfor par in excludeparams:\n if type(par) is not str:\n print('Parameters should be strings!')\n exit()\n if par in parnames:\n parna... | <|body_start_0|>
classParams = parameters.params
parnames = [x for x, y, z, v, c in classParams]
if type(excludeparams) is not list:
excludeparams = [excludeparams]
for par in excludeparams:
if type(par) is not str:
print('Parameters should be stri... | All the different parameters in the form: (name, unit, pname, remark, color) - Note some parameters are only available for certain tracks. - Color is for the Kiel diagram | parameters | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class parameters:
"""All the different parameters in the form: (name, unit, pname, remark, color) - Note some parameters are only available for certain tracks. - Color is for the Kiel diagram"""
def exclude_params(excludeparams):
"""Takes a list of input parameters (or a single parameter) ... | stack_v2_sparse_classes_75kplus_train_004831 | 31,341 | permissive | [
{
"docstring": "Takes a list of input parameters (or a single parameter) as strings and returns the entire params list, except for the params given as input.",
"name": "exclude_params",
"signature": "def exclude_params(excludeparams)"
},
{
"docstring": "Takes a list of input parameters (or a sin... | 2 | stack_v2_sparse_classes_30k_train_000937 | Implement the Python class `parameters` described below.
Class description:
All the different parameters in the form: (name, unit, pname, remark, color) - Note some parameters are only available for certain tracks. - Color is for the Kiel diagram
Method signatures and docstrings:
- def exclude_params(excludeparams): ... | Implement the Python class `parameters` described below.
Class description:
All the different parameters in the form: (name, unit, pname, remark, color) - Note some parameters are only available for certain tracks. - Color is for the Kiel diagram
Method signatures and docstrings:
- def exclude_params(excludeparams): ... | 6e084a1e283b39a1f18d3f022496f7ffe37cd095 | <|skeleton|>
class parameters:
"""All the different parameters in the form: (name, unit, pname, remark, color) - Note some parameters are only available for certain tracks. - Color is for the Kiel diagram"""
def exclude_params(excludeparams):
"""Takes a list of input parameters (or a single parameter) ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class parameters:
"""All the different parameters in the form: (name, unit, pname, remark, color) - Note some parameters are only available for certain tracks. - Color is for the Kiel diagram"""
def exclude_params(excludeparams):
"""Takes a list of input parameters (or a single parameter) as strings an... | the_stack_v2_python_sparse | basta/constants.py | yutaozhou/BASTA | train | 0 |
bcb46c53aac38385b28b49519bbf9f79d443b518 | [
"root_view_permission_classes = kwargs.pop('root_view_permission_classes', None)\nsuper(NonDefaultPermissionApiRootRouter, self).__init__(*args, **kwargs)\nself.root_view_permission_classes = root_view_permission_classes or api_settings.DEFAULT_PERMISSION_CLASSES",
"args = []\nif semver.parse_version_info(rest_fr... | <|body_start_0|>
root_view_permission_classes = kwargs.pop('root_view_permission_classes', None)
super(NonDefaultPermissionApiRootRouter, self).__init__(*args, **kwargs)
self.root_view_permission_classes = root_view_permission_classes or api_settings.DEFAULT_PERMISSION_CLASSES
<|end_body_0|>
<|... | Router with a permission different from the default for the root. | NonDefaultPermissionApiRootRouter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NonDefaultPermissionApiRootRouter:
"""Router with a permission different from the default for the root."""
def __init__(self, *args, **kwargs):
"""Initialize router."""
<|body_0|>
def get_api_root_view(self, api_urls=None):
"""Return the view for the API root."""... | stack_v2_sparse_classes_75kplus_train_004832 | 1,375 | permissive | [
{
"docstring": "Initialize router.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Return the view for the API root.",
"name": "get_api_root_view",
"signature": "def get_api_root_view(self, api_urls=None)"
}
] | 2 | null | Implement the Python class `NonDefaultPermissionApiRootRouter` described below.
Class description:
Router with a permission different from the default for the root.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize router.
- def get_api_root_view(self, api_urls=None): Return the view... | Implement the Python class `NonDefaultPermissionApiRootRouter` described below.
Class description:
Router with a permission different from the default for the root.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize router.
- def get_api_root_view(self, api_urls=None): Return the view... | 3ad5596d49ebdc9de591ad1a9768812cec17812f | <|skeleton|>
class NonDefaultPermissionApiRootRouter:
"""Router with a permission different from the default for the root."""
def __init__(self, *args, **kwargs):
"""Initialize router."""
<|body_0|>
def get_api_root_view(self, api_urls=None):
"""Return the view for the API root."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NonDefaultPermissionApiRootRouter:
"""Router with a permission different from the default for the root."""
def __init__(self, *args, **kwargs):
"""Initialize router."""
root_view_permission_classes = kwargs.pop('root_view_permission_classes', None)
super(NonDefaultPermissionApiRoo... | the_stack_v2_python_sparse | hammock/routers.py | Zbooni/hammock | train | 0 |
a948eb55485fea45858b883e7a7f6fa517b8d816 | [
"print('*****************', '***Attention***', 'This dataset is quite large (approx 5Gb and will need about 15 Gb for the extraction process', 'Cancel/interrupt the download if size and time constraints will not be met', '*****************', sep='\\n')\ndataset_kwargs = {'cache_dir': cache_dir, 'path': self.builder... | <|body_start_0|>
print('*****************', '***Attention***', 'This dataset is quite large (approx 5Gb and will need about 15 Gb for the extraction process', 'Cancel/interrupt the download if size and time constraints will not be met', '*****************', sep='\n')
dataset_kwargs = {'cache_dir': cache... | The Arxiv Dataset | ArxivDataset | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArxivDataset:
"""The Arxiv Dataset"""
def __init__(self, cache_dir: Optional[str]=None):
"""Create dataset information from the huggingface Dataset class :rtype: object :param cache_dir: Optional, a str specifying where to download/load the dataset to/from"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_004833 | 33,443 | permissive | [
{
"docstring": "Create dataset information from the huggingface Dataset class :rtype: object :param cache_dir: Optional, a str specifying where to download/load the dataset to/from",
"name": "__init__",
"signature": "def __init__(self, cache_dir: Optional[str]=None)"
},
{
"docstring": "Overrides... | 2 | null | Implement the Python class `ArxivDataset` described below.
Class description:
The Arxiv Dataset
Method signatures and docstrings:
- def __init__(self, cache_dir: Optional[str]=None): Create dataset information from the huggingface Dataset class :rtype: object :param cache_dir: Optional, a str specifying where to down... | Implement the Python class `ArxivDataset` described below.
Class description:
The Arxiv Dataset
Method signatures and docstrings:
- def __init__(self, cache_dir: Optional[str]=None): Create dataset information from the huggingface Dataset class :rtype: object :param cache_dir: Optional, a str specifying where to down... | 761676ddda5dce5cf776ab16ee38b6d995b631ac | <|skeleton|>
class ArxivDataset:
"""The Arxiv Dataset"""
def __init__(self, cache_dir: Optional[str]=None):
"""Create dataset information from the huggingface Dataset class :rtype: object :param cache_dir: Optional, a str specifying where to download/load the dataset to/from"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ArxivDataset:
"""The Arxiv Dataset"""
def __init__(self, cache_dir: Optional[str]=None):
"""Create dataset information from the huggingface Dataset class :rtype: object :param cache_dir: Optional, a str specifying where to download/load the dataset to/from"""
print('*****************', '*... | the_stack_v2_python_sparse | summertime/dataset/dataset_loaders.py | Yale-LILY/SummerTime | train | 232 |
f071908d6b373e03e4f1505fda56c51775cae8b4 | [
"if root is None:\n return None\nif root.left is None and root.right is None:\n return [[root.val]]\nlevel_order = []\nlevel_limit = 0\ntmp_stack = [root]\ntmp_level = []\ncur_node = root\nwhile tmp_stack:\n level_limit = len(tmp_stack)\n while level_limit != 0:\n cur_node = tmp_stack.pop(0)\n ... | <|body_start_0|>
if root is None:
return None
if root.left is None and root.right is None:
return [[root.val]]
level_order = []
level_limit = 0
tmp_stack = [root]
tmp_level = []
cur_node = root
while tmp_stack:
level_lim... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def levelOrder(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_0|>
def levelOrder1(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root is None:
... | stack_v2_sparse_classes_75kplus_train_004834 | 2,776 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[List[int]]",
"name": "levelOrder",
"signature": "def levelOrder(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[List[int]]",
"name": "levelOrder1",
"signature": "def levelOrder1(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_047164 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]]
- def levelOrder1(self, root): :type root: TreeNode :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]]
- def levelOrder1(self, root): :type root: TreeNode :rtype: List[List[int]]
<|skeleton|>
class Solution:... | 233d12deca34f51c3bb0406831cc07f3b72b50cf | <|skeleton|>
class Solution:
def levelOrder(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_0|>
def levelOrder1(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def levelOrder(self, root):
""":type root: TreeNode :rtype: List[List[int]]"""
if root is None:
return None
if root.left is None and root.right is None:
return [[root.val]]
level_order = []
level_limit = 0
tmp_stack = [root]
... | the_stack_v2_python_sparse | Python/Binary Tree Level Order Traversal/main.py | briansu2004/MyLeet | train | 1 | |
6a7f18cc07ca7e0724fc6d87bed510cdfc5778ad | [
"self.click_(self.loc_paihangbang)\nresult_1 = self.is_element_Exist(self.loc_dy_Day_1)\nresult_2 = self.is_element_Exist(self.loc_dy_Day_2)\nresult_3 = self.is_element_Exist(self.loc_dy_Day_3)\nif result_1 and result_2 and result_3:\n return True\nelse:\n return False",
"self.click_(self.loc_Week)\nself.cl... | <|body_start_0|>
self.click_(self.loc_paihangbang)
result_1 = self.is_element_Exist(self.loc_dy_Day_1)
result_2 = self.is_element_Exist(self.loc_dy_Day_2)
result_3 = self.is_element_Exist(self.loc_dy_Day_3)
if result_1 and result_2 and result_3:
return True
el... | 学习-学习排行榜 | Ranking_List | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ranking_List:
"""学习-学习排行榜"""
def day(self):
"""学习排行榜-Day"""
<|body_0|>
def week(self):
"""学习排行榜-Week"""
<|body_1|>
def month(self):
"""学习排行榜-Month"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.click_(self.loc_paihangb... | stack_v2_sparse_classes_75kplus_train_004835 | 3,460 | no_license | [
{
"docstring": "学习排行榜-Day",
"name": "day",
"signature": "def day(self)"
},
{
"docstring": "学习排行榜-Week",
"name": "week",
"signature": "def week(self)"
},
{
"docstring": "学习排行榜-Month",
"name": "month",
"signature": "def month(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_034020 | Implement the Python class `Ranking_List` described below.
Class description:
学习-学习排行榜
Method signatures and docstrings:
- def day(self): 学习排行榜-Day
- def week(self): 学习排行榜-Week
- def month(self): 学习排行榜-Month | Implement the Python class `Ranking_List` described below.
Class description:
学习-学习排行榜
Method signatures and docstrings:
- def day(self): 学习排行榜-Day
- def week(self): 学习排行榜-Week
- def month(self): 学习排行榜-Month
<|skeleton|>
class Ranking_List:
"""学习-学习排行榜"""
def day(self):
"""学习排行榜-Day"""
<|bod... | 9d8ad54fc982d3b2f8244e439705bcfee12ebd0c | <|skeleton|>
class Ranking_List:
"""学习-学习排行榜"""
def day(self):
"""学习排行榜-Day"""
<|body_0|>
def week(self):
"""学习排行榜-Week"""
<|body_1|>
def month(self):
"""学习排行榜-Month"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Ranking_List:
"""学习-学习排行榜"""
def day(self):
"""学习排行榜-Day"""
self.click_(self.loc_paihangbang)
result_1 = self.is_element_Exist(self.loc_dy_Day_1)
result_2 = self.is_element_Exist(self.loc_dy_Day_2)
result_3 = self.is_element_Exist(self.loc_dy_Day_3)
if resu... | the_stack_v2_python_sparse | wyt/page/ranking_list.py | mengmengxidi/wyt-APP-Automation-code | train | 0 |
4739562cfbe313b29f1971bf8f71f791f5258dbd | [
"path = self.request.get('path', None)\nif path is None:\n return []\nclassModule = findAPIDocumentationRoot(self.context)['Code']\nremoveSecurityProxy(classModule).setup()\nfound = [p for p in classRegistry if path in p]\nresults = []\nfor p in found:\n klass = traverse(classModule, p.replace('.', '/'))\n ... | <|body_start_0|>
path = self.request.get('path', None)
if path is None:
return []
classModule = findAPIDocumentationRoot(self.context)['Code']
removeSecurityProxy(classModule).setup()
found = [p for p in classRegistry if path in p]
results = []
for p i... | Menu for the Class Documentation Module. The menu allows for looking for classes by partial names. See `findClasses()` for the simple search implementation. | Menu | [
"ZPL-2.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Menu:
"""Menu for the Class Documentation Module. The menu allows for looking for classes by partial names. See `findClasses()` for the simple search implementation."""
def findClasses(self):
"""Find the classes that match a partial path. Examples:: Setup the view. >>> from zope.app.... | stack_v2_sparse_classes_75kplus_train_004836 | 4,537 | permissive | [
{
"docstring": "Find the classes that match a partial path. Examples:: Setup the view. >>> from zope.app.apidoc.codemodule.browser.menu import Menu >>> from zope.publisher.browser import TestRequest >>> menu = Menu() (In the following line flake8 sees a NameError, but the test passes.) >>> menu.context = apidoc... | 2 | stack_v2_sparse_classes_30k_train_001793 | Implement the Python class `Menu` described below.
Class description:
Menu for the Class Documentation Module. The menu allows for looking for classes by partial names. See `findClasses()` for the simple search implementation.
Method signatures and docstrings:
- def findClasses(self): Find the classes that match a pa... | Implement the Python class `Menu` described below.
Class description:
Menu for the Class Documentation Module. The menu allows for looking for classes by partial names. See `findClasses()` for the simple search implementation.
Method signatures and docstrings:
- def findClasses(self): Find the classes that match a pa... | ea7814831c279422b982c553866ceac6b442de68 | <|skeleton|>
class Menu:
"""Menu for the Class Documentation Module. The menu allows for looking for classes by partial names. See `findClasses()` for the simple search implementation."""
def findClasses(self):
"""Find the classes that match a partial path. Examples:: Setup the view. >>> from zope.app.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Menu:
"""Menu for the Class Documentation Module. The menu allows for looking for classes by partial names. See `findClasses()` for the simple search implementation."""
def findClasses(self):
"""Find the classes that match a partial path. Examples:: Setup the view. >>> from zope.app.apidoc.codemo... | the_stack_v2_python_sparse | src/zope/app/apidoc/codemodule/browser/menu.py | zopefoundation/zope.app.apidoc | train | 0 |
3a9311c2ce6c3cac78b4ed40715d2210129273dd | [
"self.workflow = kwargs.pop('workflow', None)\nsuper().__init__(data, *args, **kwargs)\nself.fields['name'].label = _('View name')\nself.fields['description_text'].label = _('View Description')\nself.fields['columns'].label = _('Columns to show')\nself.fields['formula'].required = False\nself.fields['formula'].widg... | <|body_start_0|>
self.workflow = kwargs.pop('workflow', None)
super().__init__(data, *args, **kwargs)
self.fields['name'].label = _('View name')
self.fields['description_text'].label = _('View Description')
self.fields['columns'].label = _('Columns to show')
self.fields['... | Form to add a view. | ViewAddForm | [
"MIT",
"LGPL-2.0-or-later",
"Python-2.0",
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViewAddForm:
"""Form to add a view."""
def __init__(self, data, *args, **kwargs):
"""Initialize the object, store the workflow and rename fields."""
<|body_0|>
def clean(self):
"""Check if three properties in the form. 1) Number of columns is not empty 2) There i... | stack_v2_sparse_classes_75kplus_train_004837 | 2,360 | permissive | [
{
"docstring": "Initialize the object, store the workflow and rename fields.",
"name": "__init__",
"signature": "def __init__(self, data, *args, **kwargs)"
},
{
"docstring": "Check if three properties in the form. 1) Number of columns is not empty 2) There is at least one key column 3) There is ... | 2 | stack_v2_sparse_classes_30k_val_002818 | Implement the Python class `ViewAddForm` described below.
Class description:
Form to add a view.
Method signatures and docstrings:
- def __init__(self, data, *args, **kwargs): Initialize the object, store the workflow and rename fields.
- def clean(self): Check if three properties in the form. 1) Number of columns is... | Implement the Python class `ViewAddForm` described below.
Class description:
Form to add a view.
Method signatures and docstrings:
- def __init__(self, data, *args, **kwargs): Initialize the object, store the workflow and rename fields.
- def clean(self): Check if three properties in the form. 1) Number of columns is... | 5473e9faa24c71a2a1102d47ebc2cbf27608e42a | <|skeleton|>
class ViewAddForm:
"""Form to add a view."""
def __init__(self, data, *args, **kwargs):
"""Initialize the object, store the workflow and rename fields."""
<|body_0|>
def clean(self):
"""Check if three properties in the form. 1) Number of columns is not empty 2) There i... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ViewAddForm:
"""Form to add a view."""
def __init__(self, data, *args, **kwargs):
"""Initialize the object, store the workflow and rename fields."""
self.workflow = kwargs.pop('workflow', None)
super().__init__(data, *args, **kwargs)
self.fields['name'].label = _('View nam... | the_stack_v2_python_sparse | ontask/table/forms.py | LucasFranciscoCorreia/ontask_b | train | 0 |
2bae919aed13c3a3ff43723f22cc50af189e77c6 | [
"self.solution_terminal.cFunc = deepcopy(ss.solution[0].cFunc)\nself.solution_terminal.vFunc = deepcopy(ss.solution[0].vFunc)\nself.solution_terminal.vPfunc = deepcopy(ss.solution[0].vPfunc)\nself.solution_terminal.vPPfunc = deepcopy(ss.solution[0].vPPfunc)",
"eigen, ergodic_distr = sp.linalg.eigs(ss.TranMatrix, ... | <|body_start_0|>
self.solution_terminal.cFunc = deepcopy(ss.solution[0].cFunc)
self.solution_terminal.vFunc = deepcopy(ss.solution[0].vFunc)
self.solution_terminal.vPfunc = deepcopy(ss.solution[0].vPfunc)
self.solution_terminal.vPPfunc = deepcopy(ss.solution[0].vPPfunc)
<|end_body_0|>
<... | FBSNK_JAC | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FBSNK_JAC:
def update_solution_terminal(self):
"""Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- none Returns ------- none"""
<|body_0|>
def CalcErgodicDist(self):
"""Calculat... | stack_v2_sparse_classes_75kplus_train_004838 | 31,749 | no_license | [
{
"docstring": "Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- none Returns ------- none",
"name": "update_solution_terminal",
"signature": "def update_solution_terminal(self)"
},
{
"docstring": "Calculat... | 2 | stack_v2_sparse_classes_30k_train_027060 | Implement the Python class `FBSNK_JAC` described below.
Class description:
Implement the FBSNK_JAC class.
Method signatures and docstrings:
- def update_solution_terminal(self): Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- n... | Implement the Python class `FBSNK_JAC` described below.
Class description:
Implement the FBSNK_JAC class.
Method signatures and docstrings:
- def update_solution_terminal(self): Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- n... | a7bc0bba0734ed6d16c0fe26f650118507e6c115 | <|skeleton|>
class FBSNK_JAC:
def update_solution_terminal(self):
"""Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- none Returns ------- none"""
<|body_0|>
def CalcErgodicDist(self):
"""Calculat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FBSNK_JAC:
def update_solution_terminal(self):
"""Update the terminal period solution. This method should be run when a new AgentType is created or when CRRA changes. Parameters ---------- none Returns ------- none"""
self.solution_terminal.cFunc = deepcopy(ss.solution[0].cFunc)
self.s... | the_stack_v2_python_sparse | TranJAC_efficient.py | wdu9/FBS-NK | train | 1 | |
8915de1bf386f4e4580b01ba60fdccc89699173b | [
"value_list = value.split(',')\nif len(value_list) == 1:\n value += ',0'\nself.argo.value = [int(x) for x in value.split(',')]",
"value_list = value.split(',')\nif len(value_list) > 2:\n return (False, 'Too many values for a Vector2D')\ntry:\n for x in value_list:\n int(x)\n return (True, '')\n... | <|body_start_0|>
value_list = value.split(',')
if len(value_list) == 1:
value += ',0'
self.argo.value = [int(x) for x in value.split(',')]
<|end_body_0|>
<|body_start_1|>
value_list = value.split(',')
if len(value_list) > 2:
return (False, 'Too many value... | Vector2D class is the class for 2D-vector arguments. | Vector2D | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vector2D:
"""Vector2D class is the class for 2D-vector arguments."""
def store(self, value, matched=False):
"""store method stores a value in the argument for the type. Args: value (object) : Value to store in the argument. matched (bool) : True is argument was already matched and fo... | stack_v2_sparse_classes_75kplus_train_004839 | 13,375 | no_license | [
{
"docstring": "store method stores a value in the argument for the type. Args: value (object) : Value to store in the argument. matched (bool) : True is argument was already matched and found in the command line entry. Returns: None",
"name": "store",
"signature": "def store(self, value, matched=False)... | 2 | null | Implement the Python class `Vector2D` described below.
Class description:
Vector2D class is the class for 2D-vector arguments.
Method signatures and docstrings:
- def store(self, value, matched=False): store method stores a value in the argument for the type. Args: value (object) : Value to store in the argument. mat... | Implement the Python class `Vector2D` described below.
Class description:
Vector2D class is the class for 2D-vector arguments.
Method signatures and docstrings:
- def store(self, value, matched=False): store method stores a value in the argument for the type. Args: value (object) : Value to store in the argument. mat... | c97615828880021b3965756aed939e39bac949b6 | <|skeleton|>
class Vector2D:
"""Vector2D class is the class for 2D-vector arguments."""
def store(self, value, matched=False):
"""store method stores a value in the argument for the type. Args: value (object) : Value to store in the argument. matched (bool) : True is argument was already matched and fo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Vector2D:
"""Vector2D class is the class for 2D-vector arguments."""
def store(self, value, matched=False):
"""store method stores a value in the argument for the type. Args: value (object) : Value to store in the argument. matched (bool) : True is argument was already matched and found in the co... | the_stack_v2_python_sparse | jc2cli/builtin/argos.py | jrecuero/jc2cli | train | 2 |
26926e529b1297ae5956b94e511fe68c73be0877 | [
"_class_type = type(self)\ndata = self._get_data_and_extend(**kwargs)\nret = self._requestor._request(endpoint=self.instance_endpoint_by_id(id=id), method='PATCH', data=data)\nif ret.status_code == 200:\n return _class_type(**ret.json)",
"id = self._get_id()\nobj = self.update(id=id, **kwargs)\nassert getattr(... | <|body_start_0|>
_class_type = type(self)
data = self._get_data_and_extend(**kwargs)
ret = self._requestor._request(endpoint=self.instance_endpoint_by_id(id=id), method='PATCH', data=data)
if ret.status_code == 200:
return _class_type(**ret.json)
<|end_body_0|>
<|body_start_... | Abstract class for API resources which can be updated (crUd). | UpdatableAPIResource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdatableAPIResource:
"""Abstract class for API resources which can be updated (crUd)."""
def update(self, id, **kwargs):
"""Update an API resource provided its `id` and fields to modify."""
<|body_0|>
def saveInstance(self, **kwargs):
"""Update the instance of t... | stack_v2_sparse_classes_75kplus_train_004840 | 5,217 | permissive | [
{
"docstring": "Update an API resource provided its `id` and fields to modify.",
"name": "update",
"signature": "def update(self, id, **kwargs)"
},
{
"docstring": "Update the instance of the API resource so as to save all recently modified fields.",
"name": "saveInstance",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_008988 | Implement the Python class `UpdatableAPIResource` described below.
Class description:
Abstract class for API resources which can be updated (crUd).
Method signatures and docstrings:
- def update(self, id, **kwargs): Update an API resource provided its `id` and fields to modify.
- def saveInstance(self, **kwargs): Upd... | Implement the Python class `UpdatableAPIResource` described below.
Class description:
Abstract class for API resources which can be updated (crUd).
Method signatures and docstrings:
- def update(self, id, **kwargs): Update an API resource provided its `id` and fields to modify.
- def saveInstance(self, **kwargs): Upd... | 501c3548332e21836ebe0d22ce438b4abf382146 | <|skeleton|>
class UpdatableAPIResource:
"""Abstract class for API resources which can be updated (crUd)."""
def update(self, id, **kwargs):
"""Update an API resource provided its `id` and fields to modify."""
<|body_0|>
def saveInstance(self, **kwargs):
"""Update the instance of t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UpdatableAPIResource:
"""Abstract class for API resources which can be updated (crUd)."""
def update(self, id, **kwargs):
"""Update an API resource provided its `id` and fields to modify."""
_class_type = type(self)
data = self._get_data_and_extend(**kwargs)
ret = self._re... | the_stack_v2_python_sparse | codepost/models/abstract/api_crud.py | jlumbroso/codePost-api-python | train | 0 |
f16f7048458d44e924d89154089be28124d566c6 | [
"if path_to_config is None:\n path_to_config = '%s/config.json' % Config.project_path\nwith open(path_to_config) as f:\n data = json.load(f)\nConfig.channel = data['channel']\nif data['interface'] is not None:\n Config.interface = data['interface']\nif data['excluded_domains'] is not None:\n Config.excl... | <|body_start_0|>
if path_to_config is None:
path_to_config = '%s/config.json' % Config.project_path
with open(path_to_config) as f:
data = json.load(f)
Config.channel = data['channel']
if data['interface'] is not None:
Config.interface = data['interfac... | Config | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Config:
def parse_config(path_to_config=None):
"""Loads the information from the config.json-file to this class"""
<|body_0|>
def chooseInterface():
"""Prints all available network-interfaces and asks the user to choose"""
<|body_1|>
def save():
... | stack_v2_sparse_classes_75kplus_train_004841 | 1,946 | permissive | [
{
"docstring": "Loads the information from the config.json-file to this class",
"name": "parse_config",
"signature": "def parse_config(path_to_config=None)"
},
{
"docstring": "Prints all available network-interfaces and asks the user to choose",
"name": "chooseInterface",
"signature": "d... | 3 | stack_v2_sparse_classes_30k_train_036237 | Implement the Python class `Config` described below.
Class description:
Implement the Config class.
Method signatures and docstrings:
- def parse_config(path_to_config=None): Loads the information from the config.json-file to this class
- def chooseInterface(): Prints all available network-interfaces and asks the use... | Implement the Python class `Config` described below.
Class description:
Implement the Config class.
Method signatures and docstrings:
- def parse_config(path_to_config=None): Loads the information from the config.json-file to this class
- def chooseInterface(): Prints all available network-interfaces and asks the use... | aa40dde0f1e4d10588bb94e117e2d5c4376970a2 | <|skeleton|>
class Config:
def parse_config(path_to_config=None):
"""Loads the information from the config.json-file to this class"""
<|body_0|>
def chooseInterface():
"""Prints all available network-interfaces and asks the user to choose"""
<|body_1|>
def save():
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Config:
def parse_config(path_to_config=None):
"""Loads the information from the config.json-file to this class"""
if path_to_config is None:
path_to_config = '%s/config.json' % Config.project_path
with open(path_to_config) as f:
data = json.load(f)
Conf... | the_stack_v2_python_sparse | config.py | MarvinCS/DNS_Sniffer | train | 6 | |
021d5509a8703a83aa14318f027d2bdd34693e37 | [
"assert 0 <= roughness, 'Pipe roughness must be greater or equal than 0 \\n'\nassert 0 < hydraulic_diameter, 'Pipe diameter has to be greater than 0 \\n'\nself.hydraulic_diameter = hydraulic_diameter\nself.roughness = roughness\nself.area = np.pi * self.hydraulic_diameter ** 2 / 4\nself.friction_estimate = friction... | <|body_start_0|>
assert 0 <= roughness, 'Pipe roughness must be greater or equal than 0 \n'
assert 0 < hydraulic_diameter, 'Pipe diameter has to be greater than 0 \n'
self.hydraulic_diameter = hydraulic_diameter
self.roughness = roughness
self.area = np.pi * self.hydraulic_diamet... | Reynolds class is in charge of providing a means to calculate the darcy friction factor for a given fluid. # Attributes: 1. roughness: relative roughness of the pipe 2. hydraulic_diameter: hydraulic diameter of the pipe 3. area: area of the pipe (to be considered circular pipe) | Reynolds | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Reynolds:
"""Reynolds class is in charge of providing a means to calculate the darcy friction factor for a given fluid. # Attributes: 1. roughness: relative roughness of the pipe 2. hydraulic_diameter: hydraulic diameter of the pipe 3. area: area of the pipe (to be considered circular pipe)"""
... | stack_v2_sparse_classes_75kplus_train_004842 | 5,303 | no_license | [
{
"docstring": "class initializer :param roughness: relative roughness of the pipe :param hydraulic_diameter: hydraulic diameter of the pipe",
"name": "__init__",
"signature": "def __init__(self, roughness, hydraulic_diameter, friction_estimate=0.0001)"
},
{
"docstring": "solve_for_friction fact... | 2 | stack_v2_sparse_classes_30k_train_053348 | Implement the Python class `Reynolds` described below.
Class description:
Reynolds class is in charge of providing a means to calculate the darcy friction factor for a given fluid. # Attributes: 1. roughness: relative roughness of the pipe 2. hydraulic_diameter: hydraulic diameter of the pipe 3. area: area of the pipe... | Implement the Python class `Reynolds` described below.
Class description:
Reynolds class is in charge of providing a means to calculate the darcy friction factor for a given fluid. # Attributes: 1. roughness: relative roughness of the pipe 2. hydraulic_diameter: hydraulic diameter of the pipe 3. area: area of the pipe... | b5e412e717cff1b8569e5fdbe69f5a13fc2f3aaa | <|skeleton|>
class Reynolds:
"""Reynolds class is in charge of providing a means to calculate the darcy friction factor for a given fluid. # Attributes: 1. roughness: relative roughness of the pipe 2. hydraulic_diameter: hydraulic diameter of the pipe 3. area: area of the pipe (to be considered circular pipe)"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Reynolds:
"""Reynolds class is in charge of providing a means to calculate the darcy friction factor for a given fluid. # Attributes: 1. roughness: relative roughness of the pipe 2. hydraulic_diameter: hydraulic diameter of the pipe 3. area: area of the pipe (to be considered circular pipe)"""
def __init... | the_stack_v2_python_sparse | Libraries/Reynolds.py | isae-supaero-griffon/GriffonSimulator | train | 2 |
a269773dd263730743b9c0532da7d34f7b06acaa | [
"self.debug = debug\nself.n = n\nself.x = x\nself.y = y\nself.board = np.zeros((BOARD_X, BOARD_Y), dtype=np.int8)\nif debug:\n print('x array : ', x)\n print('y array : ', y)\n print('board : ', self.board)\nsuper().__init__()",
"for i in range(self.n):\n for x in range(self.x[i], self.x[i] + COLOR_PA... | <|body_start_0|>
self.debug = debug
self.n = n
self.x = x
self.y = y
self.board = np.zeros((BOARD_X, BOARD_Y), dtype=np.int8)
if debug:
print('x array : ', x)
print('y array : ', y)
print('board : ', self.board)
super().__init__... | A class used to get the count of elements url : http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=712&sca=2060#n 가로, 세로의 크기가 각각 100인 정사각형 모양의 흰색 도화지가 있다. 이 도화지 위에 가로, 세로의 크기가 각각 10인 정사각형 모양의 검은색 색종이를 색종이의 변과 도화지의 변이 평행하도록 붙인다. 이러한 방식으로 색종이를 한 장 또는 여러 장 붙인 후 색종이가 붙은 검은 영역의 넓이를 구하는 프로그램을 작성하시오. cross : 2차원 배열 10... | AreaColorPaper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AreaColorPaper:
"""A class used to get the count of elements url : http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=712&sca=2060#n 가로, 세로의 크기가 각각 100인 정사각형 모양의 흰색 도화지가 있다. 이 도화지 위에 가로, 세로의 크기가 각각 10인 정사각형 모양의 검은색 색종이를 색종이의 변과 도화지의 변이 평행하도록 붙인다. 이러한 방식으로 색종이를 한 장 또는 여러 장 붙인 후 색종이가 붙은 검은 ... | stack_v2_sparse_classes_75kplus_train_004843 | 3,097 | no_license | [
{
"docstring": "get the count of elements to meet the rule. (2) :param n: max number :param a: ax+b :param b: ax+b :param debug: debug mode :return:",
"name": "__init__",
"signature": "def __init__(self, n, x, y, debug=0)"
},
{
"docstring": "fill the board with input x,y array if x=0 , y=0 => cr... | 3 | stack_v2_sparse_classes_30k_train_017339 | Implement the Python class `AreaColorPaper` described below.
Class description:
A class used to get the count of elements url : http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=712&sca=2060#n 가로, 세로의 크기가 각각 100인 정사각형 모양의 흰색 도화지가 있다. 이 도화지 위에 가로, 세로의 크기가 각각 10인 정사각형 모양의 검은색 색종이를 색종이의 변과 도화지의 변이 평행하도록 붙인다. 이러한... | Implement the Python class `AreaColorPaper` described below.
Class description:
A class used to get the count of elements url : http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=712&sca=2060#n 가로, 세로의 크기가 각각 100인 정사각형 모양의 흰색 도화지가 있다. 이 도화지 위에 가로, 세로의 크기가 각각 10인 정사각형 모양의 검은색 색종이를 색종이의 변과 도화지의 변이 평행하도록 붙인다. 이러한... | 2fb6246be3bf48eb8ad626217300a1a9328f541a | <|skeleton|>
class AreaColorPaper:
"""A class used to get the count of elements url : http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=712&sca=2060#n 가로, 세로의 크기가 각각 100인 정사각형 모양의 흰색 도화지가 있다. 이 도화지 위에 가로, 세로의 크기가 각각 10인 정사각형 모양의 검은색 색종이를 색종이의 변과 도화지의 변이 평행하도록 붙인다. 이러한 방식으로 색종이를 한 장 또는 여러 장 붙인 후 색종이가 붙은 검은 ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AreaColorPaper:
"""A class used to get the count of elements url : http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=712&sca=2060#n 가로, 세로의 크기가 각각 100인 정사각형 모양의 흰색 도화지가 있다. 이 도화지 위에 가로, 세로의 크기가 각각 10인 정사각형 모양의 검은색 색종이를 색종이의 변과 도화지의 변이 평행하도록 붙인다. 이러한 방식으로 색종이를 한 장 또는 여러 장 붙인 후 색종이가 붙은 검은 영역의 넓이를 구하는 프... | the_stack_v2_python_sparse | 2022/2.py | cheoljoo/problemSolving | train | 1 |
c1956712668b79cbb93841e0527c3210a2a2c1a2 | [
"self.backup_file_path = backup_file_path\nself.excluded_file_paths = excluded_file_paths\nself.skip_nested_volumes = skip_nested_volumes",
"if dictionary is None:\n return None\nbackup_file_path = dictionary.get('backupFilePath')\nexcluded_file_paths = dictionary.get('excludedFilePaths')\nskip_nested_volumes ... | <|body_start_0|>
self.backup_file_path = backup_file_path
self.excluded_file_paths = excluded_file_paths
self.skip_nested_volumes = skip_nested_volumes
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
backup_file_path = dictionary.get('backupFilePat... | Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be explicitly excluded. Attributes: backup_file_path (string): Specifies absolute path to a f... | FilePathParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FilePathParameters:
"""Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be explicitly excluded. Attributes: backup_file... | stack_v2_sparse_classes_75kplus_train_004844 | 2,594 | permissive | [
{
"docstring": "Constructor for the FilePathParameters class",
"name": "__init__",
"signature": "def __init__(self, backup_file_path=None, excluded_file_paths=None, skip_nested_volumes=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A ... | 2 | stack_v2_sparse_classes_30k_train_006116 | Implement the Python class `FilePathParameters` described below.
Class description:
Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be expli... | Implement the Python class `FilePathParameters` described below.
Class description:
Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be expli... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class FilePathParameters:
"""Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be explicitly excluded. Attributes: backup_file... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FilePathParameters:
"""Implementation of the 'FilePathParameters' model. Specifies a file or a directory to protect in a Physical Server. If a directory is specified, all of its descendants are also backed up. Optionally, files or subdirectories can be explicitly excluded. Attributes: backup_file_path (string... | the_stack_v2_python_sparse | cohesity_management_sdk/models/file_path_parameters.py | cohesity/management-sdk-python | train | 24 |
e2a6b447272f15197a8dc2ac11751ffa95a91990 | [
"if not isinstance(measure, BrownianMotion):\n raise ParameterError('EuropeanCall measure must be a BrownianMotion instance')\nself.measure = measure\nself.distribution = self.measure.distribution\nself.volatility = float(volatility)\nself.start_price = float(start_price)\nself.strike_price = float(strike_price)... | <|body_start_0|>
if not isinstance(measure, BrownianMotion):
raise ParameterError('EuropeanCall measure must be a BrownianMotion instance')
self.measure = measure
self.distribution = self.measure.distribution
self.volatility = float(volatility)
self.start_price = floa... | European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 interest_rate 0 >>> x = dd.gen_samples(2**12) >>> y = eo.f(x) >>> y.mean() 9.2... | EuropeanOption | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EuropeanOption:
"""European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 interest_rate 0 >>> x = dd.gen_samples(2**12... | stack_v2_sparse_classes_75kplus_train_004845 | 5,327 | permissive | [
{
"docstring": "Args: measure (TrueMeasure): A BrownianMotion TrueMeasure object volatility (float): sigma, the volatility of the asset start_price (float): S(0), the asset value at t=0 strike_price (float): strike_price, the call/put offer interest_rate (float): r, the annual interest rate call_put (str): 'cal... | 4 | stack_v2_sparse_classes_30k_train_025332 | Implement the Python class `EuropeanOption` described below.
Class description:
European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 inter... | Implement the Python class `EuropeanOption` described below.
Class description:
European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 inter... | 0ed9da2f10b9ac0004c993c01392b4c86002954c | <|skeleton|>
class EuropeanOption:
"""European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 interest_rate 0 >>> x = dd.gen_samples(2**12... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EuropeanOption:
"""European financial option. >>> dd = Sobol(4,seed=17) >>> m = BrownianMotion(dd,drift=-1) >>> eo = EuropeanOption(m,call_put='put') >>> eo EuropeanOption (Integrand Object) volatility 2^(-1) call_put put start_price 30 strike_price 35 interest_rate 0 >>> x = dd.gen_samples(2**12) >>> y = eo.... | the_stack_v2_python_sparse | qmcpy/integrand/european_option.py | kachiann/QMCSoftware | train | 1 |
b24a9e3899d0843ff91ebe093f3b5716ff5afd37 | [
"if self.path_project is None:\n raise RuntimeError('Missing keyword argument \"path_project\"')\nself._resolve_class_paths(self.path_project)\nself._verify_initialized_paths()",
"members = inspect.getmembers(self, predicate=partial(_member_filter, **kwargs))\nif prefix:\n members = [(name, member) for name... | <|body_start_0|>
if self.path_project is None:
raise RuntimeError('Missing keyword argument "path_project"')
self._resolve_class_paths(self.path_project)
self._verify_initialized_paths()
<|end_body_0|>
<|body_start_1|>
members = inspect.getmembers(self, predicate=partial(_me... | _PathAttrBase | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _PathAttrBase:
def __attrs_post_init__(self) -> None:
"""Initialize full paths with the package base directory if necessary. Raises: RuntimeError: if any paths are None"""
<|body_0|>
def _get_members(self, prefix: Optional[str], **kwargs: Any) -> List[Tuple[str, Callable[[An... | stack_v2_sparse_classes_75kplus_train_004846 | 17,612 | permissive | [
{
"docstring": "Initialize full paths with the package base directory if necessary. Raises: RuntimeError: if any paths are None",
"name": "__attrs_post_init__",
"signature": "def __attrs_post_init__(self) -> None"
},
{
"docstring": "Return the members that match the parameters. Example to return... | 4 | stack_v2_sparse_classes_30k_train_019479 | Implement the Python class `_PathAttrBase` described below.
Class description:
Implement the _PathAttrBase class.
Method signatures and docstrings:
- def __attrs_post_init__(self) -> None: Initialize full paths with the package base directory if necessary. Raises: RuntimeError: if any paths are None
- def _get_member... | Implement the Python class `_PathAttrBase` described below.
Class description:
Implement the _PathAttrBase class.
Method signatures and docstrings:
- def __attrs_post_init__(self) -> None: Initialize full paths with the package base directory if necessary. Raises: RuntimeError: if any paths are None
- def _get_member... | c10d78cce727b04b6d4f633859659cdcda832630 | <|skeleton|>
class _PathAttrBase:
def __attrs_post_init__(self) -> None:
"""Initialize full paths with the package base directory if necessary. Raises: RuntimeError: if any paths are None"""
<|body_0|>
def _get_members(self, prefix: Optional[str], **kwargs: Any) -> List[Tuple[str, Callable[[An... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _PathAttrBase:
def __attrs_post_init__(self) -> None:
"""Initialize full paths with the package base directory if necessary. Raises: RuntimeError: if any paths are None"""
if self.path_project is None:
raise RuntimeError('Missing keyword argument "path_project"')
self._reso... | the_stack_v2_python_sparse | calcipy/doit_tasks/doit_globals.py | amitkparekh/calcipy | train | 1 | |
efd1a62f10abb44a402ff322f02f8668a6d2ec08 | [
"body = eval(response_self.request.body)\nuser_id = str(body['userId'])\ncontent = str(body['content'])\nstart = str(body['start'])\nif judgeIfPermiss(user_id=user_id, mode=1, page='officeSuggestions') == False:\n return {'status': 0, 'errorInfo': '用户没有权限设置'}\nelse:\n return self.insertInMysql(user_id, conten... | <|body_start_0|>
body = eval(response_self.request.body)
user_id = str(body['userId'])
content = str(body['content'])
start = str(body['start'])
if judgeIfPermiss(user_id=user_id, mode=1, page='officeSuggestions') == False:
return {'status': 0, 'errorInfo': '用户没有权限设置'... | Suggestion | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Suggestion:
def entry(self, response_self):
"""response为tornado下get函数接收到前端数据后的self"""
<|body_0|>
def insertInMysql(self, user_id, content, start):
"""将data中用户组信息入库"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
body = eval(response_self.request.bod... | stack_v2_sparse_classes_75kplus_train_004847 | 1,339 | no_license | [
{
"docstring": "response为tornado下get函数接收到前端数据后的self",
"name": "entry",
"signature": "def entry(self, response_self)"
},
{
"docstring": "将data中用户组信息入库",
"name": "insertInMysql",
"signature": "def insertInMysql(self, user_id, content, start)"
}
] | 2 | stack_v2_sparse_classes_30k_train_026321 | Implement the Python class `Suggestion` described below.
Class description:
Implement the Suggestion class.
Method signatures and docstrings:
- def entry(self, response_self): response为tornado下get函数接收到前端数据后的self
- def insertInMysql(self, user_id, content, start): 将data中用户组信息入库 | Implement the Python class `Suggestion` described below.
Class description:
Implement the Suggestion class.
Method signatures and docstrings:
- def entry(self, response_self): response为tornado下get函数接收到前端数据后的self
- def insertInMysql(self, user_id, content, start): 将data中用户组信息入库
<|skeleton|>
class Suggestion:
def... | a31364869894c72349e3587944ecb4fda018e020 | <|skeleton|>
class Suggestion:
def entry(self, response_self):
"""response为tornado下get函数接收到前端数据后的self"""
<|body_0|>
def insertInMysql(self, user_id, content, start):
"""将data中用户组信息入库"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Suggestion:
def entry(self, response_self):
"""response为tornado下get函数接收到前端数据后的self"""
body = eval(response_self.request.body)
user_id = str(body['userId'])
content = str(body['content'])
start = str(body['start'])
if judgeIfPermiss(user_id=user_id, mode=1, page=... | the_stack_v2_python_sparse | tornado/office/suggestion.py | fxrc/care-system | train | 1 | |
ef23413a353046833efe9c50990efaeff476cbd8 | [
"kernel_size, stride, padding, dilation = (_pair(kernel_size), _pair(stride), _pair(padding), _pair(dilation))\nctx.kernel_size, ctx.stride, ctx.padding, ctx.dilation = (kernel_size, stride, padding, dilation)\nassert input1.dim() == 4 and input1.is_cuda\nbatch_size, input_channels, input_height, input_width = inpu... | <|body_start_0|>
kernel_size, stride, padding, dilation = (_pair(kernel_size), _pair(stride), _pair(padding), _pair(dilation))
ctx.kernel_size, ctx.stride, ctx.padding, ctx.dilation = (kernel_size, stride, padding, dilation)
assert input1.dim() == 4 and input1.is_cuda
batch_size, input_c... | Subtraction2Zeropad | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Subtraction2Zeropad:
def forward(ctx, input1, input2, kernel_size, stride, padding, dilation):
"""Args: ctx: input1: input2: kernel_size: stride: padding: dilation: Returns:"""
<|body_0|>
def backward(ctx, grad_output):
"""Args: ctx: grad_output: Returns:"""
... | stack_v2_sparse_classes_75kplus_train_004848 | 12,920 | permissive | [
{
"docstring": "Args: ctx: input1: input2: kernel_size: stride: padding: dilation: Returns:",
"name": "forward",
"signature": "def forward(ctx, input1, input2, kernel_size, stride, padding, dilation)"
},
{
"docstring": "Args: ctx: grad_output: Returns:",
"name": "backward",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_015187 | Implement the Python class `Subtraction2Zeropad` described below.
Class description:
Implement the Subtraction2Zeropad class.
Method signatures and docstrings:
- def forward(ctx, input1, input2, kernel_size, stride, padding, dilation): Args: ctx: input1: input2: kernel_size: stride: padding: dilation: Returns:
- def ... | Implement the Python class `Subtraction2Zeropad` described below.
Class description:
Implement the Subtraction2Zeropad class.
Method signatures and docstrings:
- def forward(ctx, input1, input2, kernel_size, stride, padding, dilation): Args: ctx: input1: input2: kernel_size: stride: padding: dilation: Returns:
- def ... | 06839b08d8e8f274c02a6bcd31bf1b32d3dc04e4 | <|skeleton|>
class Subtraction2Zeropad:
def forward(ctx, input1, input2, kernel_size, stride, padding, dilation):
"""Args: ctx: input1: input2: kernel_size: stride: padding: dilation: Returns:"""
<|body_0|>
def backward(ctx, grad_output):
"""Args: ctx: grad_output: Returns:"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Subtraction2Zeropad:
def forward(ctx, input1, input2, kernel_size, stride, padding, dilation):
"""Args: ctx: input1: input2: kernel_size: stride: padding: dilation: Returns:"""
kernel_size, stride, padding, dilation = (_pair(kernel_size), _pair(stride), _pair(padding), _pair(dilation))
... | the_stack_v2_python_sparse | neodroidvision/mixed/architectures/self_attention_network/self_attention_modules/functions/subtraction2_zeropad.py | aivclab/vision | train | 1 | |
e1a179c59baf4f9cd0a6c84c7ee280c01ed3861e | [
"super(Decoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(target_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]\nself.dropout = tf.keras.layers.Dropout(drop_rate)",
"... | <|body_start_0|>
super(Decoder, self).__init__()
self.N = N
self.dm = dm
self.embedding = tf.keras.layers.Embedding(target_vocab, dm)
self.positional_encoding = positional_encoding(max_seq_len, dm)
self.blocks = [DecoderBlock(dm, h, hidden, drop_rate) for _ in range(N)]
... | [summary] Args: tf ([type]): [description] | Decoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""[summary] Args: tf ([type]): [description]"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] target_vocab ([ty... | stack_v2_sparse_classes_75kplus_train_004849 | 2,152 | no_license | [
{
"docstring": "[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] target_vocab ([type]): [description] max_seq_len ([type]): [description] drop_rate (float, optional): [description]. Defaults to 0.1.",
"name": "__init__",
"signa... | 2 | stack_v2_sparse_classes_30k_train_027204 | Implement the Python class `Decoder` described below.
Class description:
[summary] Args: tf ([type]): [description]
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): [summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [desc... | Implement the Python class `Decoder` described below.
Class description:
[summary] Args: tf ([type]): [description]
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1): [summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [desc... | 5f86dee95f4d1c32014d0d74a368f342ff3ce6f7 | <|skeleton|>
class Decoder:
"""[summary] Args: tf ([type]): [description]"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] target_vocab ([ty... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Decoder:
"""[summary] Args: tf ([type]): [description]"""
def __init__(self, N, dm, h, hidden, target_vocab, max_seq_len, drop_rate=0.1):
"""[summary] Args: N ([type]): [description] dm ([type]): [description] h ([type]): [description] hidden ([type]): [description] target_vocab ([type]): [descri... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/10-transformer_decoder.py | d1sd41n/holbertonschool-machine_learning | train | 0 |
f5c53293c02704d0833ca050cafe24efe8e20a9f | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')"
] | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | LocationServiceServicer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocationServiceServicer:
"""Missing associated documentation comment in .proto file."""
def Get(self, request, context):
"""Returns the specified location."""
<|body_0|>
def List(self, request, context):
"""Returns the list of available locations."""
<|bo... | stack_v2_sparse_classes_75kplus_train_004850 | 4,641 | permissive | [
{
"docstring": "Returns the specified location.",
"name": "Get",
"signature": "def Get(self, request, context)"
},
{
"docstring": "Returns the list of available locations.",
"name": "List",
"signature": "def List(self, request, context)"
}
] | 2 | null | Implement the Python class `LocationServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def Get(self, request, context): Returns the specified location.
- def List(self, request, context): Returns the list of available locat... | Implement the Python class `LocationServiceServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def Get(self, request, context): Returns the specified location.
- def List(self, request, context): Returns the list of available locat... | b906a014dd893e2697864e1e48e814a8d9fbc48c | <|skeleton|>
class LocationServiceServicer:
"""Missing associated documentation comment in .proto file."""
def Get(self, request, context):
"""Returns the specified location."""
<|body_0|>
def List(self, request, context):
"""Returns the list of available locations."""
<|bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LocationServiceServicer:
"""Missing associated documentation comment in .proto file."""
def Get(self, request, context):
"""Returns the specified location."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplemente... | the_stack_v2_python_sparse | yandex/cloud/ydb/v1/location_service_pb2_grpc.py | yandex-cloud/python-sdk | train | 63 |
0142d798ccb8593a8b6980727b697260735aa77c | [
"st_struct = struct.WritableObjectProxy()\nst_struct['hi'] = True\nassert 'hi' in st_struct\nassert st_struct['hi'] is True",
"st_struct = struct.WritableObjectProxy()\nst_struct.hi = True\nassert 'hi' in st_struct\nassert st_struct.hi is True",
"st_struct = struct.WritableObjectProxy()\nst_struct['hi'] = True\... | <|body_start_0|>
st_struct = struct.WritableObjectProxy()
st_struct['hi'] = True
assert 'hi' in st_struct
assert st_struct['hi'] is True
<|end_body_0|>
<|body_start_1|>
st_struct = struct.WritableObjectProxy()
st_struct.hi = True
assert 'hi' in st_struct
... | Tests :py:class:`util.struct.WritableObjectProxy`, which is like :py:class:`util.struct.ObjectProxy` but allows writes at runtime. | WritableObjectProxyTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WritableObjectProxyTests:
"""Tests :py:class:`util.struct.WritableObjectProxy`, which is like :py:class:`util.struct.ObjectProxy` but allows writes at runtime."""
def test_setitem(self):
"""Test that `util.WritableObjectProxy` can be used with setitem syntax."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_004851 | 10,207 | permissive | [
{
"docstring": "Test that `util.WritableObjectProxy` can be used with setitem syntax.",
"name": "test_setitem",
"signature": "def test_setitem(self)"
},
{
"docstring": "Test that `util.WritableObjectProxy` can be used with setattr syntax.",
"name": "test_setattr",
"signature": "def test_... | 4 | null | Implement the Python class `WritableObjectProxyTests` described below.
Class description:
Tests :py:class:`util.struct.WritableObjectProxy`, which is like :py:class:`util.struct.ObjectProxy` but allows writes at runtime.
Method signatures and docstrings:
- def test_setitem(self): Test that `util.WritableObjectProxy` ... | Implement the Python class `WritableObjectProxyTests` described below.
Class description:
Tests :py:class:`util.struct.WritableObjectProxy`, which is like :py:class:`util.struct.ObjectProxy` but allows writes at runtime.
Method signatures and docstrings:
- def test_setitem(self): Test that `util.WritableObjectProxy` ... | cfc4ef00ec67df97e08b57222ca16aa9f2659a3e | <|skeleton|>
class WritableObjectProxyTests:
"""Tests :py:class:`util.struct.WritableObjectProxy`, which is like :py:class:`util.struct.ObjectProxy` but allows writes at runtime."""
def test_setitem(self):
"""Test that `util.WritableObjectProxy` can be used with setitem syntax."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WritableObjectProxyTests:
"""Tests :py:class:`util.struct.WritableObjectProxy`, which is like :py:class:`util.struct.ObjectProxy` but allows writes at runtime."""
def test_setitem(self):
"""Test that `util.WritableObjectProxy` can be used with setitem syntax."""
st_struct = struct.Writabl... | the_stack_v2_python_sparse | canteen_tests/test_util/test_struct.py | ianjw11/canteen | train | 0 |
7b5e374dde9bf5526b854f6cf27ff495af92c394 | [
"super(GANLoss, self).__init__()\nself.register_buffer('real_label', torch.tensor(target_real_label))\nself.register_buffer('fake_label', torch.tensor(target_fake_label))\nself.gan_mode = gan_mode\nif gan_mode == 'lsgan':\n self.loss = nn.MSELoss()\nelif gan_mode == 'vanilla':\n self.loss = nn.BCEWithLogitsLo... | <|body_start_0|>
super(GANLoss, self).__init__()
self.register_buffer('real_label', torch.tensor(target_real_label))
self.register_buffer('fake_label', torch.tensor(target_fake_label))
self.gan_mode = gan_mode
if gan_mode == 'lsgan':
self.loss = nn.MSELoss()
e... | Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input. | GANLoss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GANLoss:
"""Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input."""
def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0):
"""Initialize the GANLoss class. Parameters: ga... | stack_v2_sparse_classes_75kplus_train_004852 | 16,766 | no_license | [
{
"docstring": "Initialize the GANLoss class. Parameters: gan_mode (str) - - the type of GAN objective. It currently supports vanilla, lsgan, and wgangp. target_real_label (bool) - - label for a real image target_fake_label (bool) - - label of a fake image Note: Do not use sigmoid as the last layer of Discrimin... | 3 | stack_v2_sparse_classes_30k_train_028509 | Implement the Python class `GANLoss` described below.
Class description:
Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.
Method signatures and docstrings:
- def __init__(self, gan_mode, target_real_label=1.0, target_fake... | Implement the Python class `GANLoss` described below.
Class description:
Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input.
Method signatures and docstrings:
- def __init__(self, gan_mode, target_real_label=1.0, target_fake... | 1af2ea3a0787a3f38742dceb39afc39d0825f370 | <|skeleton|>
class GANLoss:
"""Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input."""
def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0):
"""Initialize the GANLoss class. Parameters: ga... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GANLoss:
"""Define different GAN objectives. The GANLoss class abstracts away the need to create the target label tensor that has the same size as the input."""
def __init__(self, gan_mode, target_real_label=1.0, target_fake_label=0.0):
"""Initialize the GANLoss class. Parameters: gan_mode (str) ... | the_stack_v2_python_sparse | hand_pose_estimators/CVPR2020_hpm3d/models/networks/blocks.py | Whiskysu/mm-hand | train | 0 |
75963a79185f002461b88bd1584cb879421113b8 | [
"dp = [sys.maxsize] * (n + 1)\ndp[0] = 0\ni = 1\nwhile i * i <= n:\n dp[i * i] = 1\n i += 1\nfor i in range(1, n + 1):\n j = 1\n while j * j <= i:\n dp[i] = min(dp[i], 1 + dp[i - j * j])\n j += 1\nreturn dp[n]",
"dp = [0] * (num + 1)\nfor i in range(1, num + 1):\n min_value = sys.maxs... | <|body_start_0|>
dp = [sys.maxsize] * (n + 1)
dp[0] = 0
i = 1
while i * i <= n:
dp[i * i] = 1
i += 1
for i in range(1, n + 1):
j = 1
while j * j <= i:
dp[i] = min(dp[i], 1 + dp[i - j * j])
j += 1
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def num_squares(self, n: int) -> int:
"""找出一个数是平方的和 Args: num: 数字 Returns: 数字和"""
<|body_0|>
def num_squares2(self, num: int) -> int:
"""找出一个数是平方的和 Args: num: 数字 Returns: 数字和"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = [sys.maxsiz... | stack_v2_sparse_classes_75kplus_train_004853 | 2,008 | permissive | [
{
"docstring": "找出一个数是平方的和 Args: num: 数字 Returns: 数字和",
"name": "num_squares",
"signature": "def num_squares(self, n: int) -> int"
},
{
"docstring": "找出一个数是平方的和 Args: num: 数字 Returns: 数字和",
"name": "num_squares2",
"signature": "def num_squares2(self, num: int) -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def num_squares(self, n: int) -> int: 找出一个数是平方的和 Args: num: 数字 Returns: 数字和
- def num_squares2(self, num: int) -> int: 找出一个数是平方的和 Args: num: 数字 Returns: 数字和 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def num_squares(self, n: int) -> int: 找出一个数是平方的和 Args: num: 数字 Returns: 数字和
- def num_squares2(self, num: int) -> int: 找出一个数是平方的和 Args: num: 数字 Returns: 数字和
<|skeleton|>
class S... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def num_squares(self, n: int) -> int:
"""找出一个数是平方的和 Args: num: 数字 Returns: 数字和"""
<|body_0|>
def num_squares2(self, num: int) -> int:
"""找出一个数是平方的和 Args: num: 数字 Returns: 数字和"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def num_squares(self, n: int) -> int:
"""找出一个数是平方的和 Args: num: 数字 Returns: 数字和"""
dp = [sys.maxsize] * (n + 1)
dp[0] = 0
i = 1
while i * i <= n:
dp[i * i] = 1
i += 1
for i in range(1, n + 1):
j = 1
while ... | the_stack_v2_python_sparse | src/leetcodepython/dp/perfect_squares_279.py | zhangyu345293721/leetcode | train | 101 | |
dd13f67a47f3d1dc6b626daff304c1f9279ab31e | [
"if not email:\n raise ValueError(_('The Email is must be set'))\nemail = self.normalize_email(email)\nuser = self.model(email=email, **extra_fields)\nuser.set_password(password)\nuser.save()\nreturn user",
"extra_fields.setdefault('is_staff', True)\nextra_fields.setdefault('is_superuser', True)\nextra_fields.... | <|body_start_0|>
if not email:
raise ValueError(_('The Email is must be set'))
email = self.normalize_email(email)
user = self.model(email=email, **extra_fields)
user.set_password(password)
user.save()
return user
<|end_body_0|>
<|body_start_1|>
extra... | custom user email where email is unique. We can also pass Full name , email and password here | CustomUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CustomUserManager:
"""custom user email where email is unique. We can also pass Full name , email and password here"""
def create_user(self, email, password, **extra_fields):
"""Create and save a User given email and password"""
<|body_0|>
def create_superuser(self, emai... | stack_v2_sparse_classes_75kplus_train_004854 | 4,092 | no_license | [
{
"docstring": "Create and save a User given email and password",
"name": "create_user",
"signature": "def create_user(self, email, password, **extra_fields)"
},
{
"docstring": "Create and save Super user with given email address",
"name": "create_superuser",
"signature": "def create_sup... | 2 | null | Implement the Python class `CustomUserManager` described below.
Class description:
custom user email where email is unique. We can also pass Full name , email and password here
Method signatures and docstrings:
- def create_user(self, email, password, **extra_fields): Create and save a User given email and password
-... | Implement the Python class `CustomUserManager` described below.
Class description:
custom user email where email is unique. We can also pass Full name , email and password here
Method signatures and docstrings:
- def create_user(self, email, password, **extra_fields): Create and save a User given email and password
-... | 848df862d917e828ee121c7519b0a642cc7ce49f | <|skeleton|>
class CustomUserManager:
"""custom user email where email is unique. We can also pass Full name , email and password here"""
def create_user(self, email, password, **extra_fields):
"""Create and save a User given email and password"""
<|body_0|>
def create_superuser(self, emai... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CustomUserManager:
"""custom user email where email is unique. We can also pass Full name , email and password here"""
def create_user(self, email, password, **extra_fields):
"""Create and save a User given email and password"""
if not email:
raise ValueError(_('The Email is m... | the_stack_v2_python_sparse | accounts/models.py | GenesisBlock3301/Job__portal__api | train | 1 |
211e74285c92d6c731fea774cb7f83a564920a4a | [
"try:\n request_line = (yield from parse_line(read_line))\nexcept EOFError as exc:\n raise EOFError('connection closed while reading HTTP request line') from exc\ntry:\n method, raw_path, version = request_line.split(b' ', 2)\nexcept ValueError:\n raise ValueError(f'invalid HTTP request line: {d(request... | <|body_start_0|>
try:
request_line = (yield from parse_line(read_line))
except EOFError as exc:
raise EOFError('connection closed while reading HTTP request line') from exc
try:
method, raw_path, version = request_line.split(b' ', 2)
except ValueError:... | WebSocket handshake request. :param path: path and optional query :param headers: | Request | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Request:
"""WebSocket handshake request. :param path: path and optional query :param headers:"""
def parse(cls, read_line: Callable[[], Generator[None, None, bytes]]) -> Generator[None, None, 'Request']:
"""Parse an HTTP/1.1 GET request and return ``(path, headers)``. ``path`` isn't ... | stack_v2_sparse_classes_75kplus_train_004855 | 10,688 | permissive | [
{
"docstring": "Parse an HTTP/1.1 GET request and return ``(path, headers)``. ``path`` isn't URL-decoded or validated in any way. ``path`` and ``headers`` are expected to contain only ASCII characters. Other characters are represented with surrogate escapes. :func:`parse_request` doesn't attempt to read the req... | 2 | stack_v2_sparse_classes_30k_train_009842 | Implement the Python class `Request` described below.
Class description:
WebSocket handshake request. :param path: path and optional query :param headers:
Method signatures and docstrings:
- def parse(cls, read_line: Callable[[], Generator[None, None, bytes]]) -> Generator[None, None, 'Request']: Parse an HTTP/1.1 GE... | Implement the Python class `Request` described below.
Class description:
WebSocket handshake request. :param path: path and optional query :param headers:
Method signatures and docstrings:
- def parse(cls, read_line: Callable[[], Generator[None, None, bytes]]) -> Generator[None, None, 'Request']: Parse an HTTP/1.1 GE... | 6b8d8cf9622eadef47bd10690c1bf1e7fd892bfd | <|skeleton|>
class Request:
"""WebSocket handshake request. :param path: path and optional query :param headers:"""
def parse(cls, read_line: Callable[[], Generator[None, None, bytes]]) -> Generator[None, None, 'Request']:
"""Parse an HTTP/1.1 GET request and return ``(path, headers)``. ``path`` isn't ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Request:
"""WebSocket handshake request. :param path: path and optional query :param headers:"""
def parse(cls, read_line: Callable[[], Generator[None, None, bytes]]) -> Generator[None, None, 'Request']:
"""Parse an HTTP/1.1 GET request and return ``(path, headers)``. ``path`` isn't URL-decoded o... | the_stack_v2_python_sparse | env/lib/python3.8/site-packages/websockets/http11.py | EtienneBrJ/Portfolio | train | 1 |
63ac2b328db81ba976fd0713a1d7ecc6d97f1ccb | [
"default_options = Options(**{constants().Name: 'FEM Composite', constants().Line: 0.0, constants().Column: 0.0, constants().Previous: None, constants().Domain: None})\nwhole_options = default_options << options\nsuper(IFEM, self).__init__(whole_options, **kw)",
"result = self.name + 'formed by: '\nfor iEquation ... | <|body_start_0|>
default_options = Options(**{constants().Name: 'FEM Composite', constants().Line: 0.0, constants().Column: 0.0, constants().Previous: None, constants().Domain: None})
whole_options = default_options << options
super(IFEM, self).__init__(whole_options, **kw)
<|end_body_0|>
<|bod... | A class to create a term based on the basic terms. This class can be used in runtime or for the developer to define a new term. | IFEM | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IFEM:
"""A class to create a term based on the basic terms. This class can be used in runtime or for the developer to define a new term."""
def __init__(self, options=Options(), **kw):
"""The initializer for the class receives a list of terms that the composed term is going to be bas... | stack_v2_sparse_classes_75kplus_train_004856 | 2,854 | no_license | [
{
"docstring": "The initializer for the class receives a list of terms that the composed term is going to be based in. It's used like: Composed_Term(diffusion = Galerking_Diffusion,...)",
"name": "__init__",
"signature": "def __init__(self, options=Options(), **kw)"
},
{
"docstring": "Handle the... | 4 | stack_v2_sparse_classes_30k_train_020716 | Implement the Python class `IFEM` described below.
Class description:
A class to create a term based on the basic terms. This class can be used in runtime or for the developer to define a new term.
Method signatures and docstrings:
- def __init__(self, options=Options(), **kw): The initializer for the class receives ... | Implement the Python class `IFEM` described below.
Class description:
A class to create a term based on the basic terms. This class can be used in runtime or for the developer to define a new term.
Method signatures and docstrings:
- def __init__(self, options=Options(), **kw): The initializer for the class receives ... | 66258b1669337f13cdb8d5bf48825e1f6dbfa294 | <|skeleton|>
class IFEM:
"""A class to create a term based on the basic terms. This class can be used in runtime or for the developer to define a new term."""
def __init__(self, options=Options(), **kw):
"""The initializer for the class receives a list of terms that the composed term is going to be bas... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IFEM:
"""A class to create a term based on the basic terms. This class can be used in runtime or for the developer to define a new term."""
def __init__(self, options=Options(), **kw):
"""The initializer for the class receives a list of terms that the composed term is going to be based in. It's u... | the_stack_v2_python_sparse | NeuroCore/Equations/Composite/FEM.py | dabrunhosa/PhD_Program | train | 0 |
45821cb7e4ee5b269074c876c419f1f40a8ae149 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.riskyServicePrincipalHistoryItem'.casefold(... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
try:
mapping_value = parse_node.get_child_node('@odata.type').get_str_value()
except AttributeError:
mapping_value = None
if mapping_value and mapping_value.casefold() ==... | RiskyServicePrincipal | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RiskyServicePrincipal:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RiskyServicePrincipal:
"""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 th... | stack_v2_sparse_classes_75kplus_train_004857 | 6,723 | 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: RiskyServicePrincipal",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminat... | 3 | stack_v2_sparse_classes_30k_train_008742 | Implement the Python class `RiskyServicePrincipal` described below.
Class description:
Implement the RiskyServicePrincipal class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RiskyServicePrincipal: Creates a new instance of the appropriate class base... | Implement the Python class `RiskyServicePrincipal` described below.
Class description:
Implement the RiskyServicePrincipal class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RiskyServicePrincipal: Creates a new instance of the appropriate class base... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class RiskyServicePrincipal:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RiskyServicePrincipal:
"""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 th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RiskyServicePrincipal:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> RiskyServicePrincipal:
"""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 Retur... | the_stack_v2_python_sparse | msgraph/generated/models/risky_service_principal.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
e9e6912ab858f05ead8b45850eb620de4bfb2fef | [
"if settings.DISABLE_TAG_MANIFEST_DELETE:\n return Response(status=405)\nname = kwargs.get('name')\nreference = kwargs.get('reference')\ntag = kwargs.get('tag')\nallow_continue, response, _ = is_authenticated(request, name, must_be_owner=True)\nif not allow_continue:\n return response\nimage = get_image_by_ta... | <|body_start_0|>
if settings.DISABLE_TAG_MANIFEST_DELETE:
return Response(status=405)
name = kwargs.get('name')
reference = kwargs.get('reference')
tag = kwargs.get('tag')
allow_continue, response, _ = is_authenticated(request, name, must_be_owner=True)
if not... | An Image Manifest holds the configuration and metadata about an image GET: is to retrieve an existing image manifest PUT: is to push a manifest HEAD: confirm that a manifest exists. | ImageManifest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageManifest:
"""An Image Manifest holds the configuration and metadata about an image GET: is to retrieve an existing image manifest PUT: is to push a manifest HEAD: confirm that a manifest exists."""
def delete(self, request, *args, **kwargs):
"""DELETE /v2/<name>/manifests/<tag>"... | stack_v2_sparse_classes_75kplus_train_004858 | 8,120 | permissive | [
{
"docstring": "DELETE /v2/<name>/manifests/<tag>",
"name": "delete",
"signature": "def delete(self, request, *args, **kwargs)"
},
{
"docstring": "PUT /v2/<name>/manifests/<reference> https://github.com/opencontainers/distribution-spec/blob/master/spec.md#pushing-manifests",
"name": "put",
... | 4 | stack_v2_sparse_classes_30k_train_030430 | Implement the Python class `ImageManifest` described below.
Class description:
An Image Manifest holds the configuration and metadata about an image GET: is to retrieve an existing image manifest PUT: is to push a manifest HEAD: confirm that a manifest exists.
Method signatures and docstrings:
- def delete(self, requ... | Implement the Python class `ImageManifest` described below.
Class description:
An Image Manifest holds the configuration and metadata about an image GET: is to retrieve an existing image manifest PUT: is to push a manifest HEAD: confirm that a manifest exists.
Method signatures and docstrings:
- def delete(self, requ... | e420c55eb0f4e811a466f4291245d3f449a8928e | <|skeleton|>
class ImageManifest:
"""An Image Manifest holds the configuration and metadata about an image GET: is to retrieve an existing image manifest PUT: is to push a manifest HEAD: confirm that a manifest exists."""
def delete(self, request, *args, **kwargs):
"""DELETE /v2/<name>/manifests/<tag>"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImageManifest:
"""An Image Manifest holds the configuration and metadata about an image GET: is to retrieve an existing image manifest PUT: is to push a manifest HEAD: confirm that a manifest exists."""
def delete(self, request, *args, **kwargs):
"""DELETE /v2/<name>/manifests/<tag>"""
if... | the_stack_v2_python_sparse | django_oci/views/image.py | vsoch/django-oci | train | 10 |
6ed44dc4d3c3b37bb2488920b69b15840b97e6f1 | [
"assert isinstance(emb_io, NpEmbeddingIO)\nassert isinstance(rows_provider, NetworkSampleRowProvider)\nassert isinstance(save_embedding, bool)\nsuper(NetworksInputSerializerPipelineItem, self).__init__(rows_provider=rows_provider, samples_io=samples_io, save_labels_func=save_labels_func, balance_func=balance_func, ... | <|body_start_0|>
assert isinstance(emb_io, NpEmbeddingIO)
assert isinstance(rows_provider, NetworkSampleRowProvider)
assert isinstance(save_embedding, bool)
super(NetworksInputSerializerPipelineItem, self).__init__(rows_provider=rows_provider, samples_io=samples_io, save_labels_func=save... | NetworksInputSerializerPipelineItem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetworksInputSerializerPipelineItem:
def __init__(self, save_labels_func, rows_provider, samples_io, emb_io, balance_func, storage, save_embedding=True):
"""This pipeline item allows to perform a data preparation for neural network models. considering a list of the whole data_types with ... | stack_v2_sparse_classes_75kplus_train_004859 | 2,832 | permissive | [
{
"docstring": "This pipeline item allows to perform a data preparation for neural network models. considering a list of the whole data_types with the related pipelines, which are supported and required in a handler. It is necessary to know data_types in advance as it allows to create a complete vocabulary of i... | 2 | stack_v2_sparse_classes_30k_train_040075 | Implement the Python class `NetworksInputSerializerPipelineItem` described below.
Class description:
Implement the NetworksInputSerializerPipelineItem class.
Method signatures and docstrings:
- def __init__(self, save_labels_func, rows_provider, samples_io, emb_io, balance_func, storage, save_embedding=True): This pi... | Implement the Python class `NetworksInputSerializerPipelineItem` described below.
Class description:
Implement the NetworksInputSerializerPipelineItem class.
Method signatures and docstrings:
- def __init__(self, save_labels_func, rows_provider, samples_io, emb_io, balance_func, storage, save_embedding=True): This pi... | 1e1d354654f4f0a72090504663cc6d218f6aaf4a | <|skeleton|>
class NetworksInputSerializerPipelineItem:
def __init__(self, save_labels_func, rows_provider, samples_io, emb_io, balance_func, storage, save_embedding=True):
"""This pipeline item allows to perform a data preparation for neural network models. considering a list of the whole data_types with ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NetworksInputSerializerPipelineItem:
def __init__(self, save_labels_func, rows_provider, samples_io, emb_io, balance_func, storage, save_embedding=True):
"""This pipeline item allows to perform a data preparation for neural network models. considering a list of the whole data_types with the related pi... | the_stack_v2_python_sparse | arekit/contrib/utils/pipelines/items/sampling/networks.py | nicolay-r/AREkit | train | 54 | |
4165010ee91b6cf19f820807fd65cee5cce908ce | [
"N = len(lists)\nif N == 0:\n return None\nif N == 1:\n return lists[0]\nreturn self.mergeTwoLists(self.mergeKLists(lists[:N / 2]), self.mergeKLists(lists[N / 2:]))",
"pq = []\nfor i in lists:\n if i is not None:\n heapq.heappush(pq, (i.val, i))\ndummy = ListNode(-1)\ntmp = dummy\nwhile len(pq) > ... | <|body_start_0|>
N = len(lists)
if N == 0:
return None
if N == 1:
return lists[0]
return self.mergeTwoLists(self.mergeKLists(lists[:N / 2]), self.mergeKLists(lists[N / 2:]))
<|end_body_0|>
<|body_start_1|>
pq = []
for i in lists:
if i ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeKListsMinQueue(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
def mergeTwoLists(self, l1, l2):
""":type l1... | stack_v2_sparse_classes_75kplus_train_004860 | 2,611 | no_license | [
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKLists",
"signature": "def mergeKLists(self, lists)"
},
{
"docstring": ":type lists: List[ListNode] :rtype: ListNode",
"name": "mergeKListsMinQueue",
"signature": "def mergeKListsMinQueue(self, lists)"
},
{
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeKListsMinQueue(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoList... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeKListsMinQueue(self, lists): :type lists: List[ListNode] :rtype: ListNode
- def mergeTwoList... | ba8014e6fa3b0dc4fdc33e1cf23c98076a105225 | <|skeleton|>
class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_0|>
def mergeKListsMinQueue(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
<|body_1|>
def mergeTwoLists(self, l1, l2):
""":type l1... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mergeKLists(self, lists):
""":type lists: List[ListNode] :rtype: ListNode"""
N = len(lists)
if N == 0:
return None
if N == 1:
return lists[0]
return self.mergeTwoLists(self.mergeKLists(lists[:N / 2]), self.mergeKLists(lists[N / 2:])... | the_stack_v2_python_sparse | 023_merge_k_sorted_lists.py | harrifeng/leet-in-python | train | 0 | |
6ce4ec5885ee27afa9da41a97790903d46c2d805 | [
"super(Report, self).__init__(url=url, gis=gis)\nself._con = gis\nself._url = url\nif initialize:\n self._init()",
"usagereport_dict = {'reportname': self._reportname, 'queries': self._queries, 'since': self._since, 'metadata': self._metadata, 'to': self._to, 'from': self._from, 'aggregationInterval': self._ag... | <|body_start_0|>
super(Report, self).__init__(url=url, gis=gis)
self._con = gis
self._url = url
if initialize:
self._init()
<|end_body_0|>
<|body_start_1|>
usagereport_dict = {'reportname': self._reportname, 'queries': self._queries, 'since': self._since, 'metadata':... | **(This class should not be created by a user)** A utility class representing a single usage report returned by ArcGIS Server. A Usage Report is used to obtain ArcGIS Server usage data for specified resources during a given time period. It specifies the parameters for obtaining server usage data, time range (parameters... | Report | [
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Report:
"""**(This class should not be created by a user)** A utility class representing a single usage report returned by ArcGIS Server. A Usage Report is used to obtain ArcGIS Server usage data for specified resources during a given time period. It specifies the parameters for obtaining server ... | stack_v2_sparse_classes_75kplus_train_004861 | 25,521 | permissive | [
{
"docstring": "Constructor ================== ==================================================================== **Argument** **Description** ------------------ -------------------------------------------------------------------- url Required string. The machine URL. ------------------ ----------------------... | 4 | null | Implement the Python class `Report` described below.
Class description:
**(This class should not be created by a user)** A utility class representing a single usage report returned by ArcGIS Server. A Usage Report is used to obtain ArcGIS Server usage data for specified resources during a given time period. It specifi... | Implement the Python class `Report` described below.
Class description:
**(This class should not be created by a user)** A utility class representing a single usage report returned by ArcGIS Server. A Usage Report is used to obtain ArcGIS Server usage data for specified resources during a given time period. It specifi... | a874fe7e5c95196e4de68db2da0e2a05eb70e5d8 | <|skeleton|>
class Report:
"""**(This class should not be created by a user)** A utility class representing a single usage report returned by ArcGIS Server. A Usage Report is used to obtain ArcGIS Server usage data for specified resources during a given time period. It specifies the parameters for obtaining server ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Report:
"""**(This class should not be created by a user)** A utility class representing a single usage report returned by ArcGIS Server. A Usage Report is used to obtain ArcGIS Server usage data for specified resources during a given time period. It specifies the parameters for obtaining server usage data, t... | the_stack_v2_python_sparse | arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/gis/server/admin/_usagereports.py | SherbazHashmi/HackathonServer | train | 3 |
002bc60ff72b0503076555db97af0dc6b9599a85 | [
"drive = input('drive name:')\npath = input('enter path:')\nos.system('sudo dd if={} conv=sync,noerror bs=64K | gzip -c > {}'.format(drive, path))",
"drive = input('drive name:')\npath = input('enter path:')\nos.system(' gunzip -c {} | dd of={}'.format(path, drive))"
] | <|body_start_0|>
drive = input('drive name:')
path = input('enter path:')
os.system('sudo dd if={} conv=sync,noerror bs=64K | gzip -c > {}'.format(drive, path))
<|end_body_0|>
<|body_start_1|>
drive = input('drive name:')
path = input('enter path:')
os.system(' gunzip -c... | Module `Partition_image` Use to create and restore partition image of the drive | Partition_image | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Partition_image:
"""Module `Partition_image` Use to create and restore partition image of the drive"""
def create_image(self):
"""To create partition image of th disk"""
<|body_0|>
def restore_image(self):
"""To restore partition image of th disk"""
<|bod... | stack_v2_sparse_classes_75kplus_train_004862 | 14,085 | no_license | [
{
"docstring": "To create partition image of th disk",
"name": "create_image",
"signature": "def create_image(self)"
},
{
"docstring": "To restore partition image of th disk",
"name": "restore_image",
"signature": "def restore_image(self)"
}
] | 2 | null | Implement the Python class `Partition_image` described below.
Class description:
Module `Partition_image` Use to create and restore partition image of the drive
Method signatures and docstrings:
- def create_image(self): To create partition image of th disk
- def restore_image(self): To restore partition image of th ... | Implement the Python class `Partition_image` described below.
Class description:
Module `Partition_image` Use to create and restore partition image of the drive
Method signatures and docstrings:
- def create_image(self): To create partition image of th disk
- def restore_image(self): To restore partition image of th ... | ec100281a08aa906972342b1982ed2b2ee3f29ea | <|skeleton|>
class Partition_image:
"""Module `Partition_image` Use to create and restore partition image of the drive"""
def create_image(self):
"""To create partition image of th disk"""
<|body_0|>
def restore_image(self):
"""To restore partition image of th disk"""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Partition_image:
"""Module `Partition_image` Use to create and restore partition image of the drive"""
def create_image(self):
"""To create partition image of th disk"""
drive = input('drive name:')
path = input('enter path:')
os.system('sudo dd if={} conv=sync,noerror bs=... | the_stack_v2_python_sparse | diskmanagerAPI.py | dhwanilTrojanpy/Linux-pi-APIs | train | 0 |
18c55b315909d9fdc3c61b66972d67fd8ec0e7b9 | [
"if estimator is None:\n estimator = linear_model.LinearRegression()\nif param_grid is None:\n param_grid = {}\nsuper().__init__(estimator, param_grid, **kwargs)",
"df = read_csv(xy_file)\nX = df['X'].values\ny = df['y'].values\nsuper().fit(X, y)\nyp = cross_validation.cross_val_predict(self.best_estimator_... | <|body_start_0|>
if estimator is None:
estimator = linear_model.LinearRegression()
if param_grid is None:
param_grid = {}
super().__init__(estimator, param_grid, **kwargs)
<|end_body_0|>
<|body_start_1|>
df = read_csv(xy_file)
X = df['X'].values
y... | GridSearchCV | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GridSearchCV:
def __init__(self, estimator=None, param_grid=None, **kwargs):
"""estimator and param_grid can be values defined in csv."""
<|body_0|>
def fit(self, xy_file, fname_out):
"""All grid results will be saved later, although only the best result is saved."""... | stack_v2_sparse_classes_75kplus_train_004863 | 2,058 | permissive | [
{
"docstring": "estimator and param_grid can be values defined in csv.",
"name": "__init__",
"signature": "def __init__(self, estimator=None, param_grid=None, **kwargs)"
},
{
"docstring": "All grid results will be saved later, although only the best result is saved.",
"name": "fit",
"sig... | 2 | stack_v2_sparse_classes_30k_val_000269 | Implement the Python class `GridSearchCV` described below.
Class description:
Implement the GridSearchCV class.
Method signatures and docstrings:
- def __init__(self, estimator=None, param_grid=None, **kwargs): estimator and param_grid can be values defined in csv.
- def fit(self, xy_file, fname_out): All grid result... | Implement the Python class `GridSearchCV` described below.
Class description:
Implement the GridSearchCV class.
Method signatures and docstrings:
- def __init__(self, estimator=None, param_grid=None, **kwargs): estimator and param_grid can be values defined in csv.
- def fit(self, xy_file, fname_out): All grid result... | b7e3c860280581e37c7b5254e18ff4b19c112ded | <|skeleton|>
class GridSearchCV:
def __init__(self, estimator=None, param_grid=None, **kwargs):
"""estimator and param_grid can be values defined in csv."""
<|body_0|>
def fit(self, xy_file, fname_out):
"""All grid results will be saved later, although only the best result is saved."""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GridSearchCV:
def __init__(self, estimator=None, param_grid=None, **kwargs):
"""estimator and param_grid can be values defined in csv."""
if estimator is None:
estimator = linear_model.LinearRegression()
if param_grid is None:
param_grid = {}
super().__i... | the_stack_v2_python_sparse | poodle/linear_model.py | jskDr/jamespy_py3 | train | 5 | |
2713c7fe674a209ade5ed49a86832860ffe54892 | [
"self.LOGS = settings.logger\nself.dataset = settings.dataset\nself.LOGS.info('DATASET: Instantiating Dataset object')\nmodule = self._load_module(settings, client)\nremote_check = core.get_date(module.url)\nif self.dataset in settings.modules.keys() and remote_check > settings.modules[self.dataset]:\n msg = 'Re... | <|body_start_0|>
self.LOGS = settings.logger
self.dataset = settings.dataset
self.LOGS.info('DATASET: Instantiating Dataset object')
module = self._load_module(settings, client)
remote_check = core.get_date(module.url)
if self.dataset in settings.modules.keys() and remote... | Class to retrieve the required DHTK extension (dataset) module | ExtensionLoader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtensionLoader:
"""Class to retrieve the required DHTK extension (dataset) module"""
def __init__(self, settings: object, client: object):
"""Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client:... | stack_v2_sparse_classes_75kplus_train_004864 | 3,777 | no_license | [
{
"docstring": "Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client: DHTK Client object Client to use Returns ------- Extension module selected by the user as the .module attribute",
"name": "__init__",
"signature":... | 2 | stack_v2_sparse_classes_30k_val_000488 | Implement the Python class `ExtensionLoader` described below.
Class description:
Class to retrieve the required DHTK extension (dataset) module
Method signatures and docstrings:
- def __init__(self, settings: object, client: object): Method to retrieve the required the DHTK extension module. Parameters ---------- set... | Implement the Python class `ExtensionLoader` described below.
Class description:
Class to retrieve the required DHTK extension (dataset) module
Method signatures and docstrings:
- def __init__(self, settings: object, client: object): Method to retrieve the required the DHTK extension module. Parameters ---------- set... | 54d9104c8b04af0fb368a499372d7ea0337be3d2 | <|skeleton|>
class ExtensionLoader:
"""Class to retrieve the required DHTK extension (dataset) module"""
def __init__(self, settings: object, client: object):
"""Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExtensionLoader:
"""Class to retrieve the required DHTK extension (dataset) module"""
def __init__(self, settings: object, client: object):
"""Method to retrieve the required the DHTK extension module. Parameters ---------- settings: DHTK Settings object Configurations to use client: DHTK Client ... | the_stack_v2_python_sparse | venv/Lib/site-packages/dhtk/core/loader.py | sorchawalsh/semanticweb | train | 0 |
96d690aaf2d62d6f27d69e2d118478031f267311 | [
"if freq >= 2412000000 and freq <= 2484000000:\n return IEEE80211_Channels.BAND_2400_MHz\nelif freq >= 3657500000 and freq <= 3690000000:\n return IEEE80211_Channels.BAND_3600_MHz\nelif freq >= 4915000000 and freq <= 5825000000:\n return IEEE80211_Channels.BAND_5000_MHz\nelse:\n return IEEE80211_Channel... | <|body_start_0|>
if freq >= 2412000000 and freq <= 2484000000:
return IEEE80211_Channels.BAND_2400_MHz
elif freq >= 3657500000 and freq <= 3690000000:
return IEEE80211_Channels.BAND_3600_MHz
elif freq >= 4915000000 and freq <= 5825000000:
return IEEE80211_Chan... | This class implements IEEE802.11 frequency <---> (channel, band) mapping. | IEEE80211_Channels | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IEEE80211_Channels:
"""This class implements IEEE802.11 frequency <---> (channel, band) mapping."""
def get_band_from_freq(freq):
"""Retrieves the band a frequency belongs to. @type freq: long @param freq: the frequency in Hz @rtype: string @return: the frequency band (see the class ... | stack_v2_sparse_classes_75kplus_train_004865 | 3,658 | no_license | [
{
"docstring": "Retrieves the band a frequency belongs to. @type freq: long @param freq: the frequency in Hz @rtype: string @return: the frequency band (see the class constants)",
"name": "get_band_from_freq",
"signature": "def get_band_from_freq(freq)"
},
{
"docstring": "Returns the channel num... | 3 | stack_v2_sparse_classes_30k_train_036205 | Implement the Python class `IEEE80211_Channels` described below.
Class description:
This class implements IEEE802.11 frequency <---> (channel, band) mapping.
Method signatures and docstrings:
- def get_band_from_freq(freq): Retrieves the band a frequency belongs to. @type freq: long @param freq: the frequency in Hz @... | Implement the Python class `IEEE80211_Channels` described below.
Class description:
This class implements IEEE802.11 frequency <---> (channel, band) mapping.
Method signatures and docstrings:
- def get_band_from_freq(freq): Retrieves the band a frequency belongs to. @type freq: long @param freq: the frequency in Hz @... | 2da7f077edd3e7919e5d835a80f6ac1b71af4a12 | <|skeleton|>
class IEEE80211_Channels:
"""This class implements IEEE802.11 frequency <---> (channel, band) mapping."""
def get_band_from_freq(freq):
"""Retrieves the band a frequency belongs to. @type freq: long @param freq: the frequency in Hz @rtype: string @return: the frequency band (see the class ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IEEE80211_Channels:
"""This class implements IEEE802.11 frequency <---> (channel, band) mapping."""
def get_band_from_freq(freq):
"""Retrieves the band a frequency belongs to. @type freq: long @param freq: the frequency in Hz @rtype: string @return: the frequency band (see the class constants)"""... | the_stack_v2_python_sparse | ieee80211_channels/src/ieee80211_channels/channels.py | PR2/linux_networking | train | 2 |
5edc4ecd534d0373e569f41d15086ad43d7a30b8 | [
"try:\n response = self.connection.describe_domain(name)\nexcept SWFResponseError as e:\n if e.error_code == 'UnknownResourceFault':\n raise DoesNotExistError('No such domain: %s' % name)\n elif e.error_code == 'UnrecognizedClientException':\n raise InvalidCredentialsError('Invalid aws creden... | <|body_start_0|>
try:
response = self.connection.describe_domain(name)
except SWFResponseError as e:
if e.error_code == 'UnknownResourceFault':
raise DoesNotExistError('No such domain: %s' % name)
elif e.error_code == 'UnrecognizedClientException':
... | Swf domain queryset object Allows the user to interact with amazon's swf domains through a django-queryset like interface | DomainQuerySet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DomainQuerySet:
"""Swf domain queryset object Allows the user to interact with amazon's swf domains through a django-queryset like interface"""
def get(self, name: str, *args, **kwargs) -> Domain:
"""Fetches the Domain with `name` :param name: name of the domain to fetch A typical Am... | stack_v2_sparse_classes_75kplus_train_004866 | 5,411 | permissive | [
{
"docstring": "Fetches the Domain with `name` :param name: name of the domain to fetch A typical Amazon response looks like: .. code-block:: json { \"configuration\": { \"workflowExecutionRetentionPeriodInDays\": \"7\", }, \"domainInfo\": { \"status\": \"REGISTERED\", \"name\": \"CrawlTest\", } }",
"name":... | 4 | null | Implement the Python class `DomainQuerySet` described below.
Class description:
Swf domain queryset object Allows the user to interact with amazon's swf domains through a django-queryset like interface
Method signatures and docstrings:
- def get(self, name: str, *args, **kwargs) -> Domain: Fetches the Domain with `na... | Implement the Python class `DomainQuerySet` described below.
Class description:
Swf domain queryset object Allows the user to interact with amazon's swf domains through a django-queryset like interface
Method signatures and docstrings:
- def get(self, name: str, *args, **kwargs) -> Domain: Fetches the Domain with `na... | 9e2b3186e109723862555fe0779394ae318d8380 | <|skeleton|>
class DomainQuerySet:
"""Swf domain queryset object Allows the user to interact with amazon's swf domains through a django-queryset like interface"""
def get(self, name: str, *args, **kwargs) -> Domain:
"""Fetches the Domain with `name` :param name: name of the domain to fetch A typical Am... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DomainQuerySet:
"""Swf domain queryset object Allows the user to interact with amazon's swf domains through a django-queryset like interface"""
def get(self, name: str, *args, **kwargs) -> Domain:
"""Fetches the Domain with `name` :param name: name of the domain to fetch A typical Amazon response... | the_stack_v2_python_sparse | swf/querysets/domain.py | botify-labs/simpleflow | train | 72 |
22573655e776318676b79cfd57cfed1b4f7e3653 | [
"super(SAGPoolH, self).__init__()\nself.act = nn.ReLU(inplace=True)\nself.readout = Readout()\nself.gcn1 = GraphConvolution(input_dim, hidden_dim, use_bias)\nself.sagpool1 = SelfAttentionPooling(hidden_dim, keep_ratio)\nself.gcn2 = GraphConvolution(hidden_dim, hidden_dim, use_bias)\nself.sagpool2 = SelfAttentionPoo... | <|body_start_0|>
super(SAGPoolH, self).__init__()
self.act = nn.ReLU(inplace=True)
self.readout = Readout()
self.gcn1 = GraphConvolution(input_dim, hidden_dim, use_bias)
self.sagpool1 = SelfAttentionPooling(hidden_dim, keep_ratio)
self.gcn2 = GraphConvolution(hidden_dim, ... | SAGPoolH结构 | SAGPoolH | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SAGPoolH:
"""SAGPoolH结构"""
def __init__(self, input_dim, hidden_dim, output_dim, keep_ratio, dropout, use_bias):
"""SAGPoolH结构 Inputs: ------- input_dim: int, 节点特征数量 hidden_dim: int, 图卷积层计算输出的特征数 output_dim: int, 输出类别数量 keep_ratio: float, 图池化过程中每张图保留的topk节点所占比例 dropout: float, 输出层使用的... | stack_v2_sparse_classes_75kplus_train_004867 | 5,459 | permissive | [
{
"docstring": "SAGPoolH结构 Inputs: ------- input_dim: int, 节点特征数量 hidden_dim: int, 图卷积层计算输出的特征数 output_dim: int, 输出类别数量 keep_ratio: float, 图池化过程中每张图保留的topk节点所占比例 dropout: float, 输出层使用的dopout比例 use_bias: boolean, 图卷积层是否使用偏置",
"name": "__init__",
"signature": "def __init__(self, input_dim, hidden_dim, out... | 2 | stack_v2_sparse_classes_30k_train_030838 | Implement the Python class `SAGPoolH` described below.
Class description:
SAGPoolH结构
Method signatures and docstrings:
- def __init__(self, input_dim, hidden_dim, output_dim, keep_ratio, dropout, use_bias): SAGPoolH结构 Inputs: ------- input_dim: int, 节点特征数量 hidden_dim: int, 图卷积层计算输出的特征数 output_dim: int, 输出类别数量 keep_ra... | Implement the Python class `SAGPoolH` described below.
Class description:
SAGPoolH结构
Method signatures and docstrings:
- def __init__(self, input_dim, hidden_dim, output_dim, keep_ratio, dropout, use_bias): SAGPoolH结构 Inputs: ------- input_dim: int, 节点特征数量 hidden_dim: int, 图卷积层计算输出的特征数 output_dim: int, 输出类别数量 keep_ra... | ee16c37fd065ba4c732138096f715f04c0ad6fcf | <|skeleton|>
class SAGPoolH:
"""SAGPoolH结构"""
def __init__(self, input_dim, hidden_dim, output_dim, keep_ratio, dropout, use_bias):
"""SAGPoolH结构 Inputs: ------- input_dim: int, 节点特征数量 hidden_dim: int, 图卷积层计算输出的特征数 output_dim: int, 输出类别数量 keep_ratio: float, 图池化过程中每张图保留的topk节点所占比例 dropout: float, 输出层使用的... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SAGPoolH:
"""SAGPoolH结构"""
def __init__(self, input_dim, hidden_dim, output_dim, keep_ratio, dropout, use_bias):
"""SAGPoolH结构 Inputs: ------- input_dim: int, 节点特征数量 hidden_dim: int, 图卷积层计算输出的特征数 output_dim: int, 输出类别数量 keep_ratio: float, 图池化过程中每张图保留的topk节点所占比例 dropout: float, 输出层使用的dopout比例 use_... | the_stack_v2_python_sparse | Graph/SAGPool/script/model.py | robbinc91/GNN-Pytorch | train | 0 |
c90fcecec2eff172d8b01235dddd8db5105b0e5b | [
"type_detector_list = ['военный', 'медицинский', 'транспортный']\nif object_type not in type_detector_list:\n raise ValueError('Мне передали некорректный тип вертолета, что дальше?')\nsuper().__init__(name, price, object_type, flight_altitude, producing_country, owner_country)\nself.people_count = people_count\n... | <|body_start_0|>
type_detector_list = ['военный', 'медицинский', 'транспортный']
if object_type not in type_detector_list:
raise ValueError('Мне передали некорректный тип вертолета, что дальше?')
super().__init__(name, price, object_type, flight_altitude, producing_country, owner_cou... | Дочерний класс вертолет | HelicopterClass | [
"WTFPL"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HelicopterClass:
"""Дочерний класс вертолет"""
def __init__(self, name, price, object_type, flight_altitude, producing_country, owner_country, people_count, carrying, current_location):
"""Общие поля с Aircraft: Название, цена, тип объекта, высота полета, страна производитель, страна... | stack_v2_sparse_classes_75kplus_train_004868 | 11,707 | permissive | [
{
"docstring": "Общие поля с Aircraft: Название, цена, тип объекта, высота полета, страна производитель, страна владелец Различные поля с Aicraft: Количество членов экипажа, грузоподъемность, место расположение объекта",
"name": "__init__",
"signature": "def __init__(self, name, price, object_type, flig... | 2 | stack_v2_sparse_classes_30k_train_049498 | Implement the Python class `HelicopterClass` described below.
Class description:
Дочерний класс вертолет
Method signatures and docstrings:
- def __init__(self, name, price, object_type, flight_altitude, producing_country, owner_country, people_count, carrying, current_location): Общие поля с Aircraft: Название, цена,... | Implement the Python class `HelicopterClass` described below.
Class description:
Дочерний класс вертолет
Method signatures and docstrings:
- def __init__(self, name, price, object_type, flight_altitude, producing_country, owner_country, people_count, carrying, current_location): Общие поля с Aircraft: Название, цена,... | 9575c43fa01c261ea1ed573df9b5686b5a6f4211 | <|skeleton|>
class HelicopterClass:
"""Дочерний класс вертолет"""
def __init__(self, name, price, object_type, flight_altitude, producing_country, owner_country, people_count, carrying, current_location):
"""Общие поля с Aircraft: Название, цена, тип объекта, высота полета, страна производитель, страна... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HelicopterClass:
"""Дочерний класс вертолет"""
def __init__(self, name, price, object_type, flight_altitude, producing_country, owner_country, people_count, carrying, current_location):
"""Общие поля с Aircraft: Название, цена, тип объекта, высота полета, страна производитель, страна владелец Раз... | the_stack_v2_python_sparse | Course_I/Алгоритмы Python/Part2/семинары/control1/airclass_module.py | GeorgiyDemo/FA | train | 46 |
1618db7a2c1c49a22ca485d3e9185b0edac0eccb | [
"if n == 0 or m == 0:\n return 0\ndp = [[1 for _ in range(n)] for _ in range(m)]\nfor i in range(1, m):\n for j in range(1, n):\n dp[i][j] = dp[i - 1][j] + dp[i][j - 1]\nreturn dp[-1][-1]",
"if m == 0 or n == 0:\n return 0\npre = [1 for _ in range(n)]\ncur = [1 for _ in range(n)]\nfor i in range(1... | <|body_start_0|>
if n == 0 or m == 0:
return 0
dp = [[1 for _ in range(n)] for _ in range(m)]
for i in range(1, m):
for j in range(1, n):
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
return dp[-1][-1]
<|end_body_0|>
<|body_start_1|>
if m == 0 or... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def uniquePaths(self, m, n):
"""动态规划: 动态转移方程:dp[i, j] = dp[i - 1, j] + dp[i, j - 1] 初始状态: dp[0, j] = 1 dp[i, 0] = 1 时间复杂度:nm,遍历整个二维数组 空间复杂度:mn,建立一个新的二维数组存储结果 :param m: :param n: :return:"""
<|body_0|>
def uniquePath2_v2(self, m, n):
"""为了优化空间复杂度,我们使用两个n长的数组... | stack_v2_sparse_classes_75kplus_train_004869 | 2,725 | no_license | [
{
"docstring": "动态规划: 动态转移方程:dp[i, j] = dp[i - 1, j] + dp[i, j - 1] 初始状态: dp[0, j] = 1 dp[i, 0] = 1 时间复杂度:nm,遍历整个二维数组 空间复杂度:mn,建立一个新的二维数组存储结果 :param m: :param n: :return:",
"name": "uniquePaths",
"signature": "def uniquePaths(self, m, n)"
},
{
"docstring": "为了优化空间复杂度,我们使用两个n长的数组分别表示上面一行pre,和本行cu... | 3 | stack_v2_sparse_classes_30k_train_025764 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths(self, m, n): 动态规划: 动态转移方程:dp[i, j] = dp[i - 1, j] + dp[i, j - 1] 初始状态: dp[0, j] = 1 dp[i, 0] = 1 时间复杂度:nm,遍历整个二维数组 空间复杂度:mn,建立一个新的二维数组存储结果 :param m: :param n: :re... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths(self, m, n): 动态规划: 动态转移方程:dp[i, j] = dp[i - 1, j] + dp[i, j - 1] 初始状态: dp[0, j] = 1 dp[i, 0] = 1 时间复杂度:nm,遍历整个二维数组 空间复杂度:mn,建立一个新的二维数组存储结果 :param m: :param n: :re... | f1bbd6b3197cd9ac4f0d35a37539c11b02272065 | <|skeleton|>
class Solution:
def uniquePaths(self, m, n):
"""动态规划: 动态转移方程:dp[i, j] = dp[i - 1, j] + dp[i, j - 1] 初始状态: dp[0, j] = 1 dp[i, 0] = 1 时间复杂度:nm,遍历整个二维数组 空间复杂度:mn,建立一个新的二维数组存储结果 :param m: :param n: :return:"""
<|body_0|>
def uniquePath2_v2(self, m, n):
"""为了优化空间复杂度,我们使用两个n长的数组... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def uniquePaths(self, m, n):
"""动态规划: 动态转移方程:dp[i, j] = dp[i - 1, j] + dp[i, j - 1] 初始状态: dp[0, j] = 1 dp[i, 0] = 1 时间复杂度:nm,遍历整个二维数组 空间复杂度:mn,建立一个新的二维数组存储结果 :param m: :param n: :return:"""
if n == 0 or m == 0:
return 0
dp = [[1 for _ in range(n)] for _ in range(m... | the_stack_v2_python_sparse | leetcode/动态规划/62. 不同路径/uniquePaths.py | guohaoyuan/algorithms-for-work | train | 2 | |
ba2bd529d3e4425256781d82a3c8411239bfcb69 | [
"self.screen_l = 1200\nself.screen_w = 800\nself.bg_color = (255, 255, 255)\nself.bullet_w = 3\nself.bullet_h = 14\nself.bullet_color = (30, 60, 30)\nself.bullets_max = 10\nself.drop_speed = 10\nself.max_lives = 2\nself.speed_increase = 1.1\nself.init_dynamic_settings()\nself.score_scale = 1.5",
"self.ship_speed ... | <|body_start_0|>
self.screen_l = 1200
self.screen_w = 800
self.bg_color = (255, 255, 255)
self.bullet_w = 3
self.bullet_h = 14
self.bullet_color = (30, 60, 30)
self.bullets_max = 10
self.drop_speed = 10
self.max_lives = 2
self.speed_increas... | Stores Alien Invasion settings | Settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""Stores Alien Invasion settings"""
def __init__(self):
"""Initializes game settings"""
<|body_0|>
def init_dynamic_settings(self):
"""Initializes dynamic settings"""
<|body_1|>
def increase_speed(self):
"""Increases speed of game ... | stack_v2_sparse_classes_75kplus_train_004870 | 975 | no_license | [
{
"docstring": "Initializes game settings",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Initializes dynamic settings",
"name": "init_dynamic_settings",
"signature": "def init_dynamic_settings(self)"
},
{
"docstring": "Increases speed of game per level... | 3 | stack_v2_sparse_classes_30k_train_048291 | Implement the Python class `Settings` described below.
Class description:
Stores Alien Invasion settings
Method signatures and docstrings:
- def __init__(self): Initializes game settings
- def init_dynamic_settings(self): Initializes dynamic settings
- def increase_speed(self): Increases speed of game per level | Implement the Python class `Settings` described below.
Class description:
Stores Alien Invasion settings
Method signatures and docstrings:
- def __init__(self): Initializes game settings
- def init_dynamic_settings(self): Initializes dynamic settings
- def increase_speed(self): Increases speed of game per level
<|sk... | e36fed32771509fd4ce1baec2f7fec9999fcfdf3 | <|skeleton|>
class Settings:
"""Stores Alien Invasion settings"""
def __init__(self):
"""Initializes game settings"""
<|body_0|>
def init_dynamic_settings(self):
"""Initializes dynamic settings"""
<|body_1|>
def increase_speed(self):
"""Increases speed of game ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Settings:
"""Stores Alien Invasion settings"""
def __init__(self):
"""Initializes game settings"""
self.screen_l = 1200
self.screen_w = 800
self.bg_color = (255, 255, 255)
self.bullet_w = 3
self.bullet_h = 14
self.bullet_color = (30, 60, 30)
... | the_stack_v2_python_sparse | settings.py | AlexLinGit/Space-Invaders | train | 0 |
f8c4b9837ddfda6bb4d7a2aa6c8d97b29260782b | [
"if site.home_page.contains_pattern('<!--\\\\sPageID\\\\s\\\\d{1,6}\\\\s-\\\\spublished by RedDot'):\n '\\n *Some* sites running version 7.x to 9.x of OpenText Web Site Management (formerly RedDot / RedDot Solutions) will contain this\\n '\n return 1\nelif site.home_page.contains_pattern... | <|body_start_0|>
if site.home_page.contains_pattern('<!--\\sPageID\\s\\d{1,6}\\s-\\spublished by RedDot'):
'\n *Some* sites running version 7.x to 9.x of OpenText Web Site Management (formerly RedDot / RedDot Solutions) will contain this\n '
return 1
elif si... | Signature | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Signature:
def test_has_identifying_publish_tag(self, site):
"""RedDot tends to inject comments that identify what version was used."""
<|body_0|>
def test_has_rde_tag(self, site):
"""RedDot components sometime embed special rde tags."""
<|body_1|>
def t... | stack_v2_sparse_classes_75kplus_train_004871 | 2,215 | permissive | [
{
"docstring": "RedDot tends to inject comments that identify what version was used.",
"name": "test_has_identifying_publish_tag",
"signature": "def test_has_identifying_publish_tag(self, site)"
},
{
"docstring": "RedDot components sometime embed special rde tags.",
"name": "test_has_rde_tag... | 3 | null | Implement the Python class `Signature` described below.
Class description:
Implement the Signature class.
Method signatures and docstrings:
- def test_has_identifying_publish_tag(self, site): RedDot tends to inject comments that identify what version was used.
- def test_has_rde_tag(self, site): RedDot components som... | Implement the Python class `Signature` described below.
Class description:
Implement the Signature class.
Method signatures and docstrings:
- def test_has_identifying_publish_tag(self, site): RedDot tends to inject comments that identify what version was used.
- def test_has_rde_tag(self, site): RedDot components som... | 850bac5a1f5de67025bfaed252fbcde0b6ea6846 | <|skeleton|>
class Signature:
def test_has_identifying_publish_tag(self, site):
"""RedDot tends to inject comments that identify what version was used."""
<|body_0|>
def test_has_rde_tag(self, site):
"""RedDot components sometime embed special rde tags."""
<|body_1|>
def t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Signature:
def test_has_identifying_publish_tag(self, site):
"""RedDot tends to inject comments that identify what version was used."""
if site.home_page.contains_pattern('<!--\\sPageID\\s\\d{1,6}\\s-\\spublished by RedDot'):
'\n *Some* sites running version 7.x to 9.x o... | the_stack_v2_python_sparse | cmfieldguide/cmsdetector/signatures/opentext.py | kartiktodi/cmfieldguide | train | 0 | |
8dc5e9bb5ba448a18a48ebd9823108b5c8aeaca4 | [
"this_module = sys.modules[__name__]\nresult = {}\nfor key in dir(this_module):\n if key.startswith('_'):\n continue\n o = getattr(this_module, key)\n if isinstance(o, type) and o is not cls and issubclass(o, cls):\n result[o.__name__] = o\nreturn result",
"if isinstance(blocker, cls):\n ... | <|body_start_0|>
this_module = sys.modules[__name__]
result = {}
for key in dir(this_module):
if key.startswith('_'):
continue
o = getattr(this_module, key)
if isinstance(o, type) and o is not cls and issubclass(o, cls):
result[... | Base class for all blockers REQUIRED THING! Any subclass' constructors must accept kwargs and after POPping the values required for the blocker's operation, ``self.__dict__["kwargs"] = kwargs`` must be done! Failing to do this will render some of the functionality disabled ;). | Blocker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Blocker:
"""Base class for all blockers REQUIRED THING! Any subclass' constructors must accept kwargs and after POPping the values required for the blocker's operation, ``self.__dict__["kwargs"] = kwargs`` must be done! Failing to do this will render some of the functionality disabled ;)."""
... | stack_v2_sparse_classes_75kplus_train_004872 | 6,471 | no_license | [
{
"docstring": "Return mapping of name:class of all the blocker engines in this module. Having this as a separate function will later enable to scatter the engines across modules in case of extraction into a separate library.",
"name": "all_blocker_engines",
"signature": "def all_blocker_engines(cls)"
... | 2 | stack_v2_sparse_classes_30k_train_021547 | Implement the Python class `Blocker` described below.
Class description:
Base class for all blockers REQUIRED THING! Any subclass' constructors must accept kwargs and after POPping the values required for the blocker's operation, ``self.__dict__["kwargs"] = kwargs`` must be done! Failing to do this will render some of... | Implement the Python class `Blocker` described below.
Class description:
Base class for all blockers REQUIRED THING! Any subclass' constructors must accept kwargs and after POPping the values required for the blocker's operation, ``self.__dict__["kwargs"] = kwargs`` must be done! Failing to do this will render some of... | 73b3e1b0717b5cb0449157dc5d85e89820b62c57 | <|skeleton|>
class Blocker:
"""Base class for all blockers REQUIRED THING! Any subclass' constructors must accept kwargs and after POPping the values required for the blocker's operation, ``self.__dict__["kwargs"] = kwargs`` must be done! Failing to do this will render some of the functionality disabled ;)."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Blocker:
"""Base class for all blockers REQUIRED THING! Any subclass' constructors must accept kwargs and after POPping the values required for the blocker's operation, ``self.__dict__["kwargs"] = kwargs`` must be done! Failing to do this will render some of the functionality disabled ;)."""
def all_bloc... | the_stack_v2_python_sparse | utils/blockers.py | richardfontana/cfme_tests | train | 0 |
e77388b8bc4ebf3dbbb758b20847000fb4399381 | [
"self.n_rows = n_rows\nself.n_cols = n_cols\nself.r_random = int(random.uniform(0, n_rows))\nself.c_random = int(random.uniform(0, n_cols))\nself.count = 0\nself.s = set()",
"rvalue = (self.r_random + self.count) % self.n_rows\ncvalue = (self.c_random + self.count) % self.n_cols\nif (rvalue, cvalue) in self.s:\n ... | <|body_start_0|>
self.n_rows = n_rows
self.n_cols = n_cols
self.r_random = int(random.uniform(0, n_rows))
self.c_random = int(random.uniform(0, n_cols))
self.count = 0
self.s = set()
<|end_body_0|>
<|body_start_1|>
rvalue = (self.r_random + self.count) % self.n_r... | Solution_1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution_1:
def __init__(self, n_rows, n_cols):
""":type n_rows: int :type n_cols: int"""
<|body_0|>
def flip(self):
""":rtype: List[int]"""
<|body_1|>
def reset(self):
""":rtype: void"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_004873 | 2,785 | no_license | [
{
"docstring": ":type n_rows: int :type n_cols: int",
"name": "__init__",
"signature": "def __init__(self, n_rows, n_cols)"
},
{
"docstring": ":rtype: List[int]",
"name": "flip",
"signature": "def flip(self)"
},
{
"docstring": ":rtype: void",
"name": "reset",
"signature":... | 3 | null | Implement the Python class `Solution_1` described below.
Class description:
Implement the Solution_1 class.
Method signatures and docstrings:
- def __init__(self, n_rows, n_cols): :type n_rows: int :type n_cols: int
- def flip(self): :rtype: List[int]
- def reset(self): :rtype: void | Implement the Python class `Solution_1` described below.
Class description:
Implement the Solution_1 class.
Method signatures and docstrings:
- def __init__(self, n_rows, n_cols): :type n_rows: int :type n_cols: int
- def flip(self): :rtype: List[int]
- def reset(self): :rtype: void
<|skeleton|>
class Solution_1:
... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution_1:
def __init__(self, n_rows, n_cols):
""":type n_rows: int :type n_cols: int"""
<|body_0|>
def flip(self):
""":rtype: List[int]"""
<|body_1|>
def reset(self):
""":rtype: void"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution_1:
def __init__(self, n_rows, n_cols):
""":type n_rows: int :type n_cols: int"""
self.n_rows = n_rows
self.n_cols = n_cols
self.r_random = int(random.uniform(0, n_rows))
self.c_random = int(random.uniform(0, n_cols))
self.count = 0
self.s = set(... | the_stack_v2_python_sparse | RandomFlipMatrix_MID_881.py | 953250587/leetcode-python | train | 2 | |
46848f3765cf026e7c289c263b3b11a48f0032b9 | [
"if not email:\n raise ValueError('Users must have a institutional email address')\nuser = self.model(first_name=first_name, middle_initial=middle_initial, last_name=last_name, email=self.normalize_email(email), contact=contact, role=role, college=college, program=program)\nuser.set_password(password)\nuser.save... | <|body_start_0|>
if not email:
raise ValueError('Users must have a institutional email address')
user = self.model(first_name=first_name, middle_initial=middle_initial, last_name=last_name, email=self.normalize_email(email), contact=contact, role=role, college=college, program=program)
... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None):
"""Creates and saves a User with the given email, favorite color and password."""
<|body_0|>
def create_superuser(self, first_name, middle_init... | stack_v2_sparse_classes_75kplus_train_004874 | 4,458 | no_license | [
{
"docstring": "Creates and saves a User with the given email, favorite color and password.",
"name": "create_user",
"signature": "def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None)"
},
{
"docstring": "Creates and saves a superuser... | 2 | stack_v2_sparse_classes_30k_train_030856 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None): Creates and saves a User with the given email, favo... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None): Creates and saves a User with the given email, favo... | 9b7a441d4a315b3da7cefb6c7a0daad18167341a | <|skeleton|>
class MyUserManager:
def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None):
"""Creates and saves a User with the given email, favorite color and password."""
<|body_0|>
def create_superuser(self, first_name, middle_init... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyUserManager:
def create_user(self, first_name, middle_initial, last_name, college, email, contact, role, program, password=None):
"""Creates and saves a User with the given email, favorite color and password."""
if not email:
raise ValueError('Users must have a institutional emai... | the_stack_v2_python_sparse | geo/members/models.py | RadySonabu/Accreditation-and-Content-Management-System-Applciation | train | 0 | |
e1ba2958caeff44b03096bf92a0ac07931a5a054 | [
"self.max_h = list()\nself.min_h = list()\nheapify(self.max_h)\nheapify(self.min_h)",
"heappush(self.min_h, num)\nheappush(self.max_h, -heappop(self.min_h))\nif len(self.max_h) > len(self.min_h):\n heappush(self.min_h, -heappop(self.max_h))",
"max_len = len(self.max_h)\nmin_len = len(self.min_h)\nif max_len ... | <|body_start_0|>
self.max_h = list()
self.min_h = list()
heapify(self.max_h)
heapify(self.min_h)
<|end_body_0|>
<|body_start_1|>
heappush(self.min_h, num)
heappush(self.max_h, -heappop(self.min_h))
if len(self.max_h) > len(self.min_h):
heappush(self.m... | MedianFinder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
<|body_0|>
def addNum(self, num):
""":type num: int :rtype: None 最为核心的加入堆时 的 堆调整工作。 每次每个数进来,先把它丢进小顶堆,然后把小顶堆的堆顶丢进大顶堆,调整两个堆,使得size 差最大为1。"""
<|body_1|>
def findMedian(self):
... | stack_v2_sparse_classes_75kplus_train_004875 | 6,481 | no_license | [
{
"docstring": "initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": ":type num: int :rtype: None 最为核心的加入堆时 的 堆调整工作。 每次每个数进来,先把它丢进小顶堆,然后把小顶堆的堆顶丢进大顶堆,调整两个堆,使得size 差最大为1。",
"name": "addNum",
"signature": "def addNum(self, num)"
},... | 3 | stack_v2_sparse_classes_30k_train_040110 | Implement the Python class `MedianFinder` described below.
Class description:
Implement the MedianFinder class.
Method signatures and docstrings:
- def __init__(self): initialize your data structure here.
- def addNum(self, num): :type num: int :rtype: None 最为核心的加入堆时 的 堆调整工作。 每次每个数进来,先把它丢进小顶堆,然后把小顶堆的堆顶丢进大顶堆,调整两个堆,使得s... | Implement the Python class `MedianFinder` described below.
Class description:
Implement the MedianFinder class.
Method signatures and docstrings:
- def __init__(self): initialize your data structure here.
- def addNum(self, num): :type num: int :rtype: None 最为核心的加入堆时 的 堆调整工作。 每次每个数进来,先把它丢进小顶堆,然后把小顶堆的堆顶丢进大顶堆,调整两个堆,使得s... | 16e0d8699b83b22f1f8d5810f3fcaf55387fad40 | <|skeleton|>
class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
<|body_0|>
def addNum(self, num):
""":type num: int :rtype: None 最为核心的加入堆时 的 堆调整工作。 每次每个数进来,先把它丢进小顶堆,然后把小顶堆的堆顶丢进大顶堆,调整两个堆,使得size 差最大为1。"""
<|body_1|>
def findMedian(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MedianFinder:
def __init__(self):
"""initialize your data structure here."""
self.max_h = list()
self.min_h = list()
heapify(self.max_h)
heapify(self.min_h)
def addNum(self, num):
""":type num: int :rtype: None 最为核心的加入堆时 的 堆调整工作。 每次每个数进来,先把它丢进小顶堆,然后把小顶堆的堆顶丢... | the_stack_v2_python_sparse | 数组/题目4.寻找两个有序数组的中位数.py | AllenZhuUCAS/leetcode_top125 | train | 0 | |
3f93dee11e7348859c4ee9f4ff1eb15af10b5a41 | [
"a = self._reshape(x)\nskew = scipy.stats.skew(a, nan_policy='omit')\nreturn skew",
"N = xr.zeros_like(output)\nM1 = xr.zeros_like(output)\nM2 = xr.zeros_like(output)\nM3 = xr.zeros_like(output)\ncheck_empty = True\nfor x in xs:\n Nx = np.isfinite(x).sum(dim=self._dims)\n M1x = x.mean(dim=self._dims)\n E... | <|body_start_0|>
a = self._reshape(x)
skew = scipy.stats.skew(a, nan_policy='omit')
return skew
<|end_body_0|>
<|body_start_1|>
N = xr.zeros_like(output)
M1 = xr.zeros_like(output)
M2 = xr.zeros_like(output)
M3 = xr.zeros_like(output)
check_empty = True
... | Computes the skew across dimension(s) TODO NaN behavior when there is NO data (currently different in reduce and reduce_chunked) | Skew | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Skew:
"""Computes the skew across dimension(s) TODO NaN behavior when there is NO data (currently different in reduce and reduce_chunked)"""
def reduce(self, x):
"""Computes the skew across dimension(s) Parameters ---------- x : UnitsDataArray Source data. Returns ------- UnitsDataAr... | stack_v2_sparse_classes_75kplus_train_004876 | 34,643 | permissive | [
{
"docstring": "Computes the skew across dimension(s) Parameters ---------- x : UnitsDataArray Source data. Returns ------- UnitsDataArray Skew of the source data over dims",
"name": "reduce",
"signature": "def reduce(self, x)"
},
{
"docstring": "Computes the skew across a chunk Parameters -----... | 2 | stack_v2_sparse_classes_30k_train_040059 | Implement the Python class `Skew` described below.
Class description:
Computes the skew across dimension(s) TODO NaN behavior when there is NO data (currently different in reduce and reduce_chunked)
Method signatures and docstrings:
- def reduce(self, x): Computes the skew across dimension(s) Parameters ---------- x ... | Implement the Python class `Skew` described below.
Class description:
Computes the skew across dimension(s) TODO NaN behavior when there is NO data (currently different in reduce and reduce_chunked)
Method signatures and docstrings:
- def reduce(self, x): Computes the skew across dimension(s) Parameters ---------- x ... | 66d8ec7a9086e39347e32922e15a3f59cb055415 | <|skeleton|>
class Skew:
"""Computes the skew across dimension(s) TODO NaN behavior when there is NO data (currently different in reduce and reduce_chunked)"""
def reduce(self, x):
"""Computes the skew across dimension(s) Parameters ---------- x : UnitsDataArray Source data. Returns ------- UnitsDataAr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Skew:
"""Computes the skew across dimension(s) TODO NaN behavior when there is NO data (currently different in reduce and reduce_chunked)"""
def reduce(self, x):
"""Computes the skew across dimension(s) Parameters ---------- x : UnitsDataArray Source data. Returns ------- UnitsDataArray Skew of t... | the_stack_v2_python_sparse | podpac/core/algorithm/stats.py | creare-com/podpac | train | 48 |
ad5f4c1d3892b2f80d5778aa0dc0a89af7d42e64 | [
"d = departmentmanage(self.driver)\nd.open_departmentmanage()\nself.assertEqual(d.verify(), True)\nd.deptstatus()\nd.delete()\nself.assertEqual(d.result(), '您确定要删除这条信息吗')\nd.confirm()\nself.assertEqual(d.result(), '删除成功')\nfunction.screenshot(self.driver, 'delete_department.jpg')",
"d = departmentmanage(self.driv... | <|body_start_0|>
d = departmentmanage(self.driver)
d.open_departmentmanage()
self.assertEqual(d.verify(), True)
d.deptstatus()
d.delete()
self.assertEqual(d.result(), '您确定要删除这条信息吗')
d.confirm()
self.assertEqual(d.result(), '删除成功')
function.screensh... | Test029_Department_Delete_P1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test029_Department_Delete_P1:
def test_department_delete(self):
"""删除部门"""
<|body_0|>
def test_department_cancle(self):
"""取消删除部门"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
d = departmentmanage(self.driver)
d.open_departmentmanage()
... | stack_v2_sparse_classes_75kplus_train_004877 | 1,179 | no_license | [
{
"docstring": "删除部门",
"name": "test_department_delete",
"signature": "def test_department_delete(self)"
},
{
"docstring": "取消删除部门",
"name": "test_department_cancle",
"signature": "def test_department_cancle(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_024416 | Implement the Python class `Test029_Department_Delete_P1` described below.
Class description:
Implement the Test029_Department_Delete_P1 class.
Method signatures and docstrings:
- def test_department_delete(self): 删除部门
- def test_department_cancle(self): 取消删除部门 | Implement the Python class `Test029_Department_Delete_P1` described below.
Class description:
Implement the Test029_Department_Delete_P1 class.
Method signatures and docstrings:
- def test_department_delete(self): 删除部门
- def test_department_cancle(self): 取消删除部门
<|skeleton|>
class Test029_Department_Delete_P1:
d... | 6f42c25249fc642cecc270578a180820988d45b5 | <|skeleton|>
class Test029_Department_Delete_P1:
def test_department_delete(self):
"""删除部门"""
<|body_0|>
def test_department_cancle(self):
"""取消删除部门"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test029_Department_Delete_P1:
def test_department_delete(self):
"""删除部门"""
d = departmentmanage(self.driver)
d.open_departmentmanage()
self.assertEqual(d.verify(), True)
d.deptstatus()
d.delete()
self.assertEqual(d.result(), '您确定要删除这条信息吗')
d.conf... | the_stack_v2_python_sparse | GlxssLive_web/TestCase/Manage_Department/Test029_department_delete_P1.py | rrmiracle/GlxssLive | train | 0 | |
7738339308a63fab90ae20f5ca9b2ee0717a5da2 | [
"self.before_and_after_data = []\nif source_rows and isinstance(source_rows, list):\n if result_rows and isinstance(result_rows, list):\n if len(source_rows) == len(result_rows):\n counter = 0\n for i in range(len(source_rows)):\n source_data_raw = source_rows[i]\n ... | <|body_start_0|>
self.before_and_after_data = []
if source_rows and isinstance(source_rows, list):
if result_rows and isinstance(result_rows, list):
if len(source_rows) == len(result_rows):
counter = 0
for i in range(len(source_rows)):
... | HouseHoldSorter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HouseHoldSorter:
def __init__(self, source_rows=[], result_rows=[]):
"""This is the extract part of the ETL process."""
<|body_0|>
def update_households(self):
"""return a list of strings of the partyLoad data"""
<|body_1|>
def transform(self):
"... | stack_v2_sparse_classes_75kplus_train_004878 | 2,982 | no_license | [
{
"docstring": "This is the extract part of the ETL process.",
"name": "__init__",
"signature": "def __init__(self, source_rows=[], result_rows=[])"
},
{
"docstring": "return a list of strings of the partyLoad data",
"name": "update_households",
"signature": "def update_households(self)"... | 4 | null | Implement the Python class `HouseHoldSorter` described below.
Class description:
Implement the HouseHoldSorter class.
Method signatures and docstrings:
- def __init__(self, source_rows=[], result_rows=[]): This is the extract part of the ETL process.
- def update_households(self): return a list of strings of the part... | Implement the Python class `HouseHoldSorter` described below.
Class description:
Implement the HouseHoldSorter class.
Method signatures and docstrings:
- def __init__(self, source_rows=[], result_rows=[]): This is the extract part of the ETL process.
- def update_households(self): return a list of strings of the part... | fa40f24fbabf268a59d2cc3a9dcaa1bd273e37b5 | <|skeleton|>
class HouseHoldSorter:
def __init__(self, source_rows=[], result_rows=[]):
"""This is the extract part of the ETL process."""
<|body_0|>
def update_households(self):
"""return a list of strings of the partyLoad data"""
<|body_1|>
def transform(self):
"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HouseHoldSorter:
def __init__(self, source_rows=[], result_rows=[]):
"""This is the extract part of the ETL process."""
self.before_and_after_data = []
if source_rows and isinstance(source_rows, list):
if result_rows and isinstance(result_rows, list):
if len... | the_stack_v2_python_sparse | plugins/HouseHoldSorter.py | c22shen/aac | train | 0 | |
b4ec57017ae83b2a6e36f965081115befbc706c7 | [
"self.assert_parse_received_correct_type(raw_value, str)\nif self.should_strip_input:\n return raw_value.strip()\nreturn raw_value",
"value = self.empty_value\nif raw_value is not UNSET:\n raw_value = self.parse_as_text(raw_value)\nif raw_value:\n value = raw_value\nreturn value"
] | <|body_start_0|>
self.assert_parse_received_correct_type(raw_value, str)
if self.should_strip_input:
return raw_value.strip()
return raw_value
<|end_body_0|>
<|body_start_1|>
value = self.empty_value
if raw_value is not UNSET:
raw_value = self.parse_as_te... | CharField | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CharField:
def parse_as_text(self, raw_value):
"""Responsible for raising an error if the raw extracted value is not a string instance. If it recognizes the input as a string, use Django's `force_text` as an additional safety check. Strip the input based on `.should_strip_input`"""
... | stack_v2_sparse_classes_75kplus_train_004879 | 16,303 | permissive | [
{
"docstring": "Responsible for raising an error if the raw extracted value is not a string instance. If it recognizes the input as a string, use Django's `force_text` as an additional safety check. Strip the input based on `.should_strip_input`",
"name": "parse_as_text",
"signature": "def parse_as_text... | 2 | stack_v2_sparse_classes_30k_train_015798 | Implement the Python class `CharField` described below.
Class description:
Implement the CharField class.
Method signatures and docstrings:
- def parse_as_text(self, raw_value): Responsible for raising an error if the raw extracted value is not a string instance. If it recognizes the input as a string, use Django's `... | Implement the Python class `CharField` described below.
Class description:
Implement the CharField class.
Method signatures and docstrings:
- def parse_as_text(self, raw_value): Responsible for raising an error if the raw extracted value is not a string instance. If it recognizes the input as a string, use Django's `... | 8755e64c13e2b6f9bef9bbee47011253f20e7e0d | <|skeleton|>
class CharField:
def parse_as_text(self, raw_value):
"""Responsible for raising an error if the raw extracted value is not a string instance. If it recognizes the input as a string, use Django's `force_text` as an additional safety check. Strip the input based on `.should_strip_input`"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CharField:
def parse_as_text(self, raw_value):
"""Responsible for raising an error if the raw extracted value is not a string instance. If it recognizes the input as a string, use Django's `force_text` as an additional safety check. Strip the input based on `.should_strip_input`"""
self.assert... | the_stack_v2_python_sparse | formation/field_types.py | codeforamerica/intake | train | 51 | |
6dabd83060fc31bb699d64cceae148e9be77708e | [
"super(Classifier, self).__init__()\nself.activation = activation\nself.activation_on_final_layer = activation_on_final_layer\nself.layers = []\nfor i, (n_in, n_out) in enumerate(zip(sizes[:-1], sizes[1:])):\n self.layers.append(Linear(n_in, n_out))\n self.add_module(f'layer{i}', self.layers[-1])",
"for lay... | <|body_start_0|>
super(Classifier, self).__init__()
self.activation = activation
self.activation_on_final_layer = activation_on_final_layer
self.layers = []
for i, (n_in, n_out) in enumerate(zip(sizes[:-1], sizes[1:])):
self.layers.append(Linear(n_in, n_out))
... | Classifier | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Classifier:
def __init__(self, sizes, activation=pt.relu, activation_on_final_layer=False):
"""simple feed-forward NN @param sizes: list of sizes of the layers of the network, first entry is the input size @param activation: activation function to use after intermediat FC layers @param a... | stack_v2_sparse_classes_75kplus_train_004880 | 5,298 | no_license | [
{
"docstring": "simple feed-forward NN @param sizes: list of sizes of the layers of the network, first entry is the input size @param activation: activation function to use after intermediat FC layers @param activation_on_final_layer: bool whether to apply activation at the output",
"name": "__init__",
... | 2 | null | Implement the Python class `Classifier` described below.
Class description:
Implement the Classifier class.
Method signatures and docstrings:
- def __init__(self, sizes, activation=pt.relu, activation_on_final_layer=False): simple feed-forward NN @param sizes: list of sizes of the layers of the network, first entry i... | Implement the Python class `Classifier` described below.
Class description:
Implement the Classifier class.
Method signatures and docstrings:
- def __init__(self, sizes, activation=pt.relu, activation_on_final_layer=False): simple feed-forward NN @param sizes: list of sizes of the layers of the network, first entry i... | c8093b0f6f34fbf68f655ce733ccbabdb0f26d71 | <|skeleton|>
class Classifier:
def __init__(self, sizes, activation=pt.relu, activation_on_final_layer=False):
"""simple feed-forward NN @param sizes: list of sizes of the layers of the network, first entry is the input size @param activation: activation function to use after intermediat FC layers @param a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Classifier:
def __init__(self, sizes, activation=pt.relu, activation_on_final_layer=False):
"""simple feed-forward NN @param sizes: list of sizes of the layers of the network, first entry is the input size @param activation: activation function to use after intermediat FC layers @param activation_on_f... | the_stack_v2_python_sparse | classifier.py | IljaManakov/WalkingTheTightrope | train | 3 | |
625bce635506d481adbb5c09ab311a120b7c0634 | [
"metadata_bytes = f.read(16)\ndimension, self.chunk_size, scaler_vector_length = _struct_unpack(endianness + 'LQL', metadata_bytes)\nif dimension != 1:\n raise ValueError('Data dimension is not 1')\nscaler_class = _scaler_classes[scaler_type]\nself.scalers = [scaler_class(f, endianness) for _ in range(scaler_vec... | <|body_start_0|>
metadata_bytes = f.read(16)
dimension, self.chunk_size, scaler_vector_length = _struct_unpack(endianness + 'LQL', metadata_bytes)
if dimension != 1:
raise ValueError('Data dimension is not 1')
scaler_class = _scaler_classes[scaler_type]
self.scalers =... | Describes DAQmx data for a single channel | DaqMxMetadata | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DaqMxMetadata:
"""Describes DAQmx data for a single channel"""
def __init__(self, f, endianness, scaler_type, channel_data_type):
"""Read the metadata for a DAQmx raw segment. This is the raw DAQmx-specific portion of the raw data index."""
<|body_0|>
def __repr__(self):... | stack_v2_sparse_classes_75kplus_train_004881 | 12,402 | permissive | [
{
"docstring": "Read the metadata for a DAQmx raw segment. This is the raw DAQmx-specific portion of the raw data index.",
"name": "__init__",
"signature": "def __init__(self, f, endianness, scaler_type, channel_data_type)"
},
{
"docstring": "Return string representation of DAQmx metadata",
... | 2 | stack_v2_sparse_classes_30k_train_032552 | Implement the Python class `DaqMxMetadata` described below.
Class description:
Describes DAQmx data for a single channel
Method signatures and docstrings:
- def __init__(self, f, endianness, scaler_type, channel_data_type): Read the metadata for a DAQmx raw segment. This is the raw DAQmx-specific portion of the raw d... | Implement the Python class `DaqMxMetadata` described below.
Class description:
Describes DAQmx data for a single channel
Method signatures and docstrings:
- def __init__(self, f, endianness, scaler_type, channel_data_type): Read the metadata for a DAQmx raw segment. This is the raw DAQmx-specific portion of the raw d... | 66827d3bf32a715ba4b3521d091c43a3f50a1f1f | <|skeleton|>
class DaqMxMetadata:
"""Describes DAQmx data for a single channel"""
def __init__(self, f, endianness, scaler_type, channel_data_type):
"""Read the metadata for a DAQmx raw segment. This is the raw DAQmx-specific portion of the raw data index."""
<|body_0|>
def __repr__(self):... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DaqMxMetadata:
"""Describes DAQmx data for a single channel"""
def __init__(self, f, endianness, scaler_type, channel_data_type):
"""Read the metadata for a DAQmx raw segment. This is the raw DAQmx-specific portion of the raw data index."""
metadata_bytes = f.read(16)
dimension, s... | the_stack_v2_python_sparse | nptdms_mod/daqmx.py | fusion-flap/flap_w7x_abes | train | 0 |
0c8e418d0dcbcd8a68827bfc0b7ed2dedd385c47 | [
"super(OFCLearner, self).__init__(batch_size, *args, **kwargs)\nself.B = B\nself.F_dict = F_dict\nself.A = A",
"try:\n current_state = np.mat(current_state).reshape(-1, 1)\n target_state = np.mat(target_state).reshape(-1, 1)\n F = self.F_dict[task_state]\n A = self.A\n B = self.B\n return A * cu... | <|body_start_0|>
super(OFCLearner, self).__init__(batch_size, *args, **kwargs)
self.B = B
self.F_dict = F_dict
self.A = A
<|end_body_0|>
<|body_start_1|>
try:
current_state = np.mat(current_state).reshape(-1, 1)
target_state = np.mat(target_state).reshape... | An intention estimator where the subject is assumed to operate like a muiti-modal LQR controller | OFCLearner | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OFCLearner:
"""An intention estimator where the subject is assumed to operate like a muiti-modal LQR controller"""
def __init__(self, batch_size, A, B, F_dict, *args, **kwargs):
"""Constructor for OFCLearner Parameters ---------- batch_size : int size of batch of samples to pass to t... | stack_v2_sparse_classes_75kplus_train_004882 | 43,699 | permissive | [
{
"docstring": "Constructor for OFCLearner Parameters ---------- batch_size : int size of batch of samples to pass to the Updater to estimate new decoder parameters A : np.mat State transition matrix of the modeled discrete-time system B : np.mat Control input matrix of the modeled discrete-time system F_dict :... | 2 | stack_v2_sparse_classes_30k_train_049493 | Implement the Python class `OFCLearner` described below.
Class description:
An intention estimator where the subject is assumed to operate like a muiti-modal LQR controller
Method signatures and docstrings:
- def __init__(self, batch_size, A, B, F_dict, *args, **kwargs): Constructor for OFCLearner Parameters --------... | Implement the Python class `OFCLearner` described below.
Class description:
An intention estimator where the subject is assumed to operate like a muiti-modal LQR controller
Method signatures and docstrings:
- def __init__(self, batch_size, A, B, F_dict, *args, **kwargs): Constructor for OFCLearner Parameters --------... | a0e296aa663b49e767c9ebb274defb54b301eb12 | <|skeleton|>
class OFCLearner:
"""An intention estimator where the subject is assumed to operate like a muiti-modal LQR controller"""
def __init__(self, batch_size, A, B, F_dict, *args, **kwargs):
"""Constructor for OFCLearner Parameters ---------- batch_size : int size of batch of samples to pass to t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OFCLearner:
"""An intention estimator where the subject is assumed to operate like a muiti-modal LQR controller"""
def __init__(self, batch_size, A, B, F_dict, *args, **kwargs):
"""Constructor for OFCLearner Parameters ---------- batch_size : int size of batch of samples to pass to the Updater to... | the_stack_v2_python_sparse | riglib/bmi/clda.py | carmenalab/brain-python-interface | train | 9 |
dc0607cb87903b2f0498ee573c06bf62556ce175 | [
"L = []\nfor c in s:\n if c != ')' and c != '(':\n continue\n if len(L) and c == ')' and (L[-1] == '('):\n L.pop()\n else:\n L.append(c)\nif len(L):\n return False\nelse:\n return True",
"q = Queue()\nq.put((s, 0))\nmdepth, ans, dic = (None, [], {})\nwhile not q.empty():\n f... | <|body_start_0|>
L = []
for c in s:
if c != ')' and c != '(':
continue
if len(L) and c == ')' and (L[-1] == '('):
L.pop()
else:
L.append(c)
if len(L):
return False
else:
return Tru... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
L = []
for c in s:
if c != ')' an... | stack_v2_sparse_classes_75kplus_train_004883 | 1,181 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "isValid",
"signature": "def isValid(self, s)"
},
{
"docstring": ":type s: str :rtype: List[str]",
"name": "removeInvalidParentheses",
"signature": "def removeInvalidParentheses(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_051095 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def removeInvalidParentheses(self, s): :type s: str :rtype: List[str] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isValid(self, s): :type s: str :rtype: bool
- def removeInvalidParentheses(self, s): :type s: str :rtype: List[str]
<|skeleton|>
class Solution:
def isValid(self, s):
... | ed0837ce14a22660657ffd15ff99d7cb1804e8c1 | <|skeleton|>
class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def removeInvalidParentheses(self, s):
""":type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isValid(self, s):
""":type s: str :rtype: bool"""
L = []
for c in s:
if c != ')' and c != '(':
continue
if len(L) and c == ')' and (L[-1] == '('):
L.pop()
else:
L.append(c)
if len(... | the_stack_v2_python_sparse | python/301-remove-invalid-parentheses.py | ByronHsu/leetcode | train | 5 | |
ace868e8295e3ede8c8128b9866f3ab9e17b90bc | [
"self.onnx_session = onnxruntime.InferenceSession(onnx_path)\nself.input_name = self.get_input_name(self.onnx_session)\nself.output_name = self.get_output_name(self.onnx_session)\nprint('input_name:{}'.format(self.input_name))\nprint('output_name:{}'.format(self.output_name))",
"output_name = []\nfor node in onnx... | <|body_start_0|>
self.onnx_session = onnxruntime.InferenceSession(onnx_path)
self.input_name = self.get_input_name(self.onnx_session)
self.output_name = self.get_output_name(self.onnx_session)
print('input_name:{}'.format(self.input_name))
print('output_name:{}'.format(self.outpu... | ONNXModel | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ONNXModel:
def __init__(self, onnx_path):
""":param onnx_path:"""
<|body_0|>
def get_output_name(self, onnx_session):
"""output_name = onnx_session.get_outputs()[0].name :param onnx_session: :return:"""
<|body_1|>
def get_input_name(self, onnx_session):
... | stack_v2_sparse_classes_75kplus_train_004884 | 6,720 | permissive | [
{
"docstring": ":param onnx_path:",
"name": "__init__",
"signature": "def __init__(self, onnx_path)"
},
{
"docstring": "output_name = onnx_session.get_outputs()[0].name :param onnx_session: :return:",
"name": "get_output_name",
"signature": "def get_output_name(self, onnx_session)"
},
... | 5 | stack_v2_sparse_classes_30k_train_041547 | Implement the Python class `ONNXModel` described below.
Class description:
Implement the ONNXModel class.
Method signatures and docstrings:
- def __init__(self, onnx_path): :param onnx_path:
- def get_output_name(self, onnx_session): output_name = onnx_session.get_outputs()[0].name :param onnx_session: :return:
- def... | Implement the Python class `ONNXModel` described below.
Class description:
Implement the ONNXModel class.
Method signatures and docstrings:
- def __init__(self, onnx_path): :param onnx_path:
- def get_output_name(self, onnx_session): output_name = onnx_session.get_outputs()[0].name :param onnx_session: :return:
- def... | 90d255e17158699fd7902f7746b35fa18975112e | <|skeleton|>
class ONNXModel:
def __init__(self, onnx_path):
""":param onnx_path:"""
<|body_0|>
def get_output_name(self, onnx_session):
"""output_name = onnx_session.get_outputs()[0].name :param onnx_session: :return:"""
<|body_1|>
def get_input_name(self, onnx_session):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ONNXModel:
def __init__(self, onnx_path):
""":param onnx_path:"""
self.onnx_session = onnxruntime.InferenceSession(onnx_path)
self.input_name = self.get_input_name(self.onnx_session)
self.output_name = self.get_output_name(self.onnx_session)
print('input_name:{}'.format... | the_stack_v2_python_sparse | Model Deployment/20210810_liu/imagenet_onnx_infer.py | ioyy900205/PyTorch_mess-around | train | 0 | |
13ecdc3abf138774ecd6ae0a21a5abc0bc3c11a0 | [
"try:\n uuid_value = getattr(model, 'uuid')\n return uuid_value[:8] + '_' + uuid_value[-12:]\nexcept:\n return 'no_model_uuid'",
"if username is None:\n return 'anonymous'\nelse:\n return username",
"if test is None:\n return 'raw simulation without running any CerebUnit test'\nelse:\n retu... | <|body_start_0|>
try:
uuid_value = getattr(model, 'uuid')
return uuid_value[:8] + '_' + uuid_value[-12:]
except:
return 'no_model_uuid'
<|end_body_0|>
<|body_start_1|>
if username is None:
return 'anonymous'
else:
return userna... | **Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +---------------------------------+----------------------------------+ | :py:meth:`.ge... | FileGenerator | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileGenerator:
"""**Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +---------------------------------+----------... | stack_v2_sparse_classes_75kplus_train_004885 | 7,147 | permissive | [
{
"docstring": "Try extracting the ``uuid`` attribute value of the model and return it or return ``\"no_model_uuid\"``. **Argument:** The instantiated model is passed into this function.",
"name": "get_modelID",
"signature": "def get_modelID(model)"
},
{
"docstring": "Returns the username (also ... | 6 | stack_v2_sparse_classes_30k_train_040530 | Implement the Python class `FileGenerator` described below.
Class description:
**Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +-----... | Implement the Python class `FileGenerator` described below.
Class description:
**Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +-----... | 316d69d7aed7a0292ce93c7fea20473e48cfce60 | <|skeleton|>
class FileGenerator:
"""**Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +---------------------------------+----------... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileGenerator:
"""**Available Methods:** +---------------------------------+----------------------------------+ | Method name | Method type | +=================================+==================================+ | :py:meth:`.forfile` | class method | +---------------------------------+-----------------------... | the_stack_v2_python_sparse | managers/operatorsTranscribe/metadata_filegenerator.py | cerebunit/cerebmodels | train | 0 |
98a0e702cc5df157fd32d387767acc8b2f588187 | [
"super(AttENC, self).__init__()\nself.cnn = CNN(n_in * 2, n_hid, n_hid, do_prob)\nself.n2e_i = MLP(n_hid, n_hid, n_hid, do_prob)\nself.e2n = MLP(n_hid, n_hid, n_hid, do_prob)\nself.n2e_o = MLP(n_hid * 3, n_hid, n_hid, do_prob)\nself.intra_att = SelfAtt(n_hid, n_hid)\nself.inter_att = SelfAtt(n_hid, n_hid)\nself.fc_... | <|body_start_0|>
super(AttENC, self).__init__()
self.cnn = CNN(n_in * 2, n_hid, n_hid, do_prob)
self.n2e_i = MLP(n_hid, n_hid, n_hid, do_prob)
self.e2n = MLP(n_hid, n_hid, n_hid, do_prob)
self.n2e_o = MLP(n_hid * 3, n_hid, n_hid, do_prob)
self.intra_att = SelfAtt(n_hid, n... | Encoder using the relation interaction mechanism implemented by self-attention. | AttENC | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttENC:
"""Encoder using the relation interaction mechanism implemented by self-attention."""
def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0):
"""Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dim... | stack_v2_sparse_classes_75kplus_train_004886 | 12,491 | permissive | [
{
"docstring": "Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dimension, i.e., number of edge types. do_prob : float, optional rate of dropout. The default is 0.. factor : bool, optional using a factor graph or not. The default is True. reducer : st... | 5 | stack_v2_sparse_classes_30k_train_023754 | Implement the Python class `AttENC` described below.
Class description:
Encoder using the relation interaction mechanism implemented by self-attention.
Method signatures and docstrings:
- def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0): Parameters ---------- n_in : int input dimension. n_hid... | Implement the Python class `AttENC` described below.
Class description:
Encoder using the relation interaction mechanism implemented by self-attention.
Method signatures and docstrings:
- def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0): Parameters ---------- n_in : int input dimension. n_hid... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class AttENC:
"""Encoder using the relation interaction mechanism implemented by self-attention."""
def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0):
"""Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dim... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AttENC:
"""Encoder using the relation interaction mechanism implemented by self-attention."""
def __init__(self, n_in: int, n_hid: int, n_out: int, do_prob: float=0.0):
"""Parameters ---------- n_in : int input dimension. n_hid : int dimension of hidden layers. n_out : int output dimension, i.e.,... | the_stack_v2_python_sparse | research/gnn/nri-mpm/models/nri.py | mindspore-ai/models | train | 301 |
9d5ba70c1a70117b15e7164acb3bb4a24d744664 | [
"task_states = []\nstatement = 'SELECT * FROM task_states WHERE experiment_id = %s AND tick = %s'\nresults = database.fetchall(statement, (experiment_id, tick))\nfor row in results:\n task_states.append(cls(id=row[0], task_id=row[1], experiment_id=row[2], tick=row[3], flops_left=row[4]))\nreturn task_states",
... | <|body_start_0|>
task_states = []
statement = 'SELECT * FROM task_states WHERE experiment_id = %s AND tick = %s'
results = database.fetchall(statement, (experiment_id, tick))
for row in results:
task_states.append(cls(id=row[0], task_id=row[1], experiment_id=row[2], tick=row[... | TaskState | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TaskState:
def from_experiment_id_and_tick(cls, experiment_id, tick):
"""Query Task States by their Experiment id and tick."""
<|body_0|>
def google_id_has_at_least(self, google_id, authorization_level):
"""Return True if the User has at least the given auth level ov... | stack_v2_sparse_classes_75kplus_train_004887 | 1,436 | permissive | [
{
"docstring": "Query Task States by their Experiment id and tick.",
"name": "from_experiment_id_and_tick",
"signature": "def from_experiment_id_and_tick(cls, experiment_id, tick)"
},
{
"docstring": "Return True if the User has at least the given auth level over this TaskState.",
"name": "go... | 2 | stack_v2_sparse_classes_30k_train_040438 | Implement the Python class `TaskState` described below.
Class description:
Implement the TaskState class.
Method signatures and docstrings:
- def from_experiment_id_and_tick(cls, experiment_id, tick): Query Task States by their Experiment id and tick.
- def google_id_has_at_least(self, google_id, authorization_level)... | Implement the Python class `TaskState` described below.
Class description:
Implement the TaskState class.
Method signatures and docstrings:
- def from_experiment_id_and_tick(cls, experiment_id, tick): Query Task States by their Experiment id and tick.
- def google_id_has_at_least(self, google_id, authorization_level)... | 71aa937a9b7db7289d69ac85587387070d2af851 | <|skeleton|>
class TaskState:
def from_experiment_id_and_tick(cls, experiment_id, tick):
"""Query Task States by their Experiment id and tick."""
<|body_0|>
def google_id_has_at_least(self, google_id, authorization_level):
"""Return True if the User has at least the given auth level ov... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TaskState:
def from_experiment_id_and_tick(cls, experiment_id, tick):
"""Query Task States by their Experiment id and tick."""
task_states = []
statement = 'SELECT * FROM task_states WHERE experiment_id = %s AND tick = %s'
results = database.fetchall(statement, (experiment_id, ... | the_stack_v2_python_sparse | opendc/models/task_state.py | atlarge-research/opendc-web-server | train | 2 | |
ee310356b759caa9cd866ebc52212b8533a0dc33 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Reminder()",
"from .date_time_time_zone import DateTimeTimeZone\nfrom .location import Location\nfrom .date_time_time_zone import DateTimeTimeZone\nfrom .location import Location\nfields: Dict[str, Callable[[Any], None]] = {'changeKey'... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Reminder()
<|end_body_0|>
<|body_start_1|>
from .date_time_time_zone import DateTimeTimeZone
from .location import Location
from .date_time_time_zone import DateTimeTimeZone
... | Reminder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Reminder:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder:
"""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: Reminder... | stack_v2_sparse_classes_75kplus_train_004888 | 4,994 | 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: Reminder",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(pars... | 3 | stack_v2_sparse_classes_30k_train_015301 | Implement the Python class `Reminder` described below.
Class description:
Implement the Reminder class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: Creates a new instance of the appropriate class based on discriminator value Args: parse_no... | Implement the Python class `Reminder` described below.
Class description:
Implement the Reminder class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: Creates a new instance of the appropriate class based on discriminator value Args: parse_no... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Reminder:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder:
"""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: Reminder... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Reminder:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder:
"""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: Reminder"""
if... | the_stack_v2_python_sparse | msgraph/generated/models/reminder.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
80a78379f029f5c9b321a37559c7cf8169ba0538 | [
"super().__init__()\nself.n_guesses = n_guesses\nself.queues = queues\nself.logger = logging.getLogger(self.__class__.__name__)",
"self.queues.send_inputs(uniform(0, 10))\nself.logger.info('Submitted initial random guess')\ntrain_X = []\ntrain_y = []\ngpr = GaussianProcessRegressor(normalize_y=True, kernel=kernel... | <|body_start_0|>
super().__init__()
self.n_guesses = n_guesses
self.queues = queues
self.logger = logging.getLogger(self.__class__.__name__)
<|end_body_0|>
<|body_start_1|>
self.queues.send_inputs(uniform(0, 10))
self.logger.info('Submitted initial random guess')
... | Tool that monitors results of simulations and calls for new ones, as appropriate | Thinker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Thinker:
"""Tool that monitors results of simulations and calls for new ones, as appropriate"""
def __init__(self, queues: ClientQueues, n_guesses: int=10):
"""Args: n_guesses (int): Number of guesses the Thinker can make queues (ClientQueues): Queues for communicating with method se... | stack_v2_sparse_classes_75kplus_train_004889 | 5,039 | no_license | [
{
"docstring": "Args: n_guesses (int): Number of guesses the Thinker can make queues (ClientQueues): Queues for communicating with method server",
"name": "__init__",
"signature": "def __init__(self, queues: ClientQueues, n_guesses: int=10)"
},
{
"docstring": "Connects to the Redis queue with th... | 2 | stack_v2_sparse_classes_30k_train_022187 | Implement the Python class `Thinker` described below.
Class description:
Tool that monitors results of simulations and calls for new ones, as appropriate
Method signatures and docstrings:
- def __init__(self, queues: ClientQueues, n_guesses: int=10): Args: n_guesses (int): Number of guesses the Thinker can make queue... | Implement the Python class `Thinker` described below.
Class description:
Tool that monitors results of simulations and calls for new ones, as appropriate
Method signatures and docstrings:
- def __init__(self, queues: ClientQueues, n_guesses: int=10): Args: n_guesses (int): Number of guesses the Thinker can make queue... | 042ce37e5acc8a240845b8cce11effe832c1c913 | <|skeleton|>
class Thinker:
"""Tool that monitors results of simulations and calls for new ones, as appropriate"""
def __init__(self, queues: ClientQueues, n_guesses: int=10):
"""Args: n_guesses (int): Number of guesses the Thinker can make queues (ClientQueues): Queues for communicating with method se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Thinker:
"""Tool that monitors results of simulations and calls for new ones, as appropriate"""
def __init__(self, queues: ClientQueues, n_guesses: int=10):
"""Args: n_guesses (int): Number of guesses the Thinker can make queues (ClientQueues): Queues for communicating with method server"""
... | the_stack_v2_python_sparse | demo_apps/gpr_local/gpr_local.py | tskluzac/colmena | train | 0 |
f6ddcf6192e7b1ef93ef7c5d2d6b2664a243eb78 | [
"max_num = max(nums)\nnum_bit = 0 if max_num == 0 else int(math.log(max_num, 2)) + 1\nresult = 0\nmax_val = 0\nfor i in range(num_bit)[::-1]:\n max_val <<= 1\n cur_val = max_val | 1\n prefixs = {num >> i for num in nums}\n max_val |= any((prefix ^ cur_val in prefixs for prefix in prefixs))\nreturn max_v... | <|body_start_0|>
max_num = max(nums)
num_bit = 0 if max_num == 0 else int(math.log(max_num, 2)) + 1
result = 0
max_val = 0
for i in range(num_bit)[::-1]:
max_val <<= 1
cur_val = max_val | 1
prefixs = {num >> i for num in nums}
max_v... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findMaximumXOR(self, nums: List[int]) -> int:
"""LC 421 Maximum XOR of Two Numbers in an Array Method 1 Time complexity: O(N) space: O(N)"""
<|body_0|>
def findMaximumXOR(self, nums: List[int]) -> int:
"""LC 421 Maximum XOR of Two Numbers in an Array Me... | stack_v2_sparse_classes_75kplus_train_004890 | 2,344 | no_license | [
{
"docstring": "LC 421 Maximum XOR of Two Numbers in an Array Method 1 Time complexity: O(N) space: O(N)",
"name": "findMaximumXOR",
"signature": "def findMaximumXOR(self, nums: List[int]) -> int"
},
{
"docstring": "LC 421 Maximum XOR of Two Numbers in an Array Method 2 Time complexity: O(N) spa... | 2 | stack_v2_sparse_classes_30k_train_003621 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMaximumXOR(self, nums: List[int]) -> int: LC 421 Maximum XOR of Two Numbers in an Array Method 1 Time complexity: O(N) space: O(N)
- def findMaximumXOR(self, nums: List[i... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findMaximumXOR(self, nums: List[int]) -> int: LC 421 Maximum XOR of Two Numbers in an Array Method 1 Time complexity: O(N) space: O(N)
- def findMaximumXOR(self, nums: List[i... | 89b6c180bb772978b6646131f9734b122e745f9c | <|skeleton|>
class Solution:
def findMaximumXOR(self, nums: List[int]) -> int:
"""LC 421 Maximum XOR of Two Numbers in an Array Method 1 Time complexity: O(N) space: O(N)"""
<|body_0|>
def findMaximumXOR(self, nums: List[int]) -> int:
"""LC 421 Maximum XOR of Two Numbers in an Array Me... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findMaximumXOR(self, nums: List[int]) -> int:
"""LC 421 Maximum XOR of Two Numbers in an Array Method 1 Time complexity: O(N) space: O(N)"""
max_num = max(nums)
num_bit = 0 if max_num == 0 else int(math.log(max_num, 2)) + 1
result = 0
max_val = 0
f... | the_stack_v2_python_sparse | trie/python/maximum-xor-of-two-numbers-in-an-array.py | dyf102/LC-daily | train | 2 | |
aa5c17d04a1d0ee26f937c73f2304e37feff252e | [
"super().__init__(coordinator, _id, spc, DEVICE_CLASS_PRESENCE)\nself._surepy_entity: SurePet\nself._attr_entity_picture = self._surepy_entity.photo_url",
"pet: SurePet\nattrs: dict[str, Any] = {}\nif (pet := self._coordinator.data[self._id]):\n attrs = {'since': pet.location.since, 'where': pet.location.where... | <|body_start_0|>
super().__init__(coordinator, _id, spc, DEVICE_CLASS_PRESENCE)
self._surepy_entity: SurePet
self._attr_entity_picture = self._surepy_entity.photo_url
<|end_body_0|>
<|body_start_1|>
pet: SurePet
attrs: dict[str, Any] = {}
if (pet := self._coordinator.dat... | Sure Petcare Pet. | Pet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Pet:
"""Sure Petcare Pet."""
def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None:
"""Initialize a Sure Petcare Pet."""
<|body_0|>
def extra_state_attributes(self) -> dict[str, Any]:
"""Return the additional attrs."""
<|body_1|>
def... | stack_v2_sparse_classes_75kplus_train_004891 | 8,000 | permissive | [
{
"docstring": "Initialize a Sure Petcare Pet.",
"name": "__init__",
"signature": "def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None"
},
{
"docstring": "Return the additional attrs.",
"name": "extra_state_attributes",
"signature": "def extra_state_attributes(self) ->... | 3 | stack_v2_sparse_classes_30k_train_015654 | Implement the Python class `Pet` described below.
Class description:
Sure Petcare Pet.
Method signatures and docstrings:
- def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None: Initialize a Sure Petcare Pet.
- def extra_state_attributes(self) -> dict[str, Any]: Return the additional attrs.
- def is_... | Implement the Python class `Pet` described below.
Class description:
Sure Petcare Pet.
Method signatures and docstrings:
- def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None: Initialize a Sure Petcare Pet.
- def extra_state_attributes(self) -> dict[str, Any]: Return the additional attrs.
- def is_... | 77ff2da40a4fb55ad99eea1f60d39694584cc490 | <|skeleton|>
class Pet:
"""Sure Petcare Pet."""
def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None:
"""Initialize a Sure Petcare Pet."""
<|body_0|>
def extra_state_attributes(self) -> dict[str, Any]:
"""Return the additional attrs."""
<|body_1|>
def... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Pet:
"""Sure Petcare Pet."""
def __init__(self, coordinator, _id: int, spc: SurePetcareAPI) -> None:
"""Initialize a Sure Petcare Pet."""
super().__init__(coordinator, _id, spc, DEVICE_CLASS_PRESENCE)
self._surepy_entity: SurePet
self._attr_entity_picture = self._surepy_en... | the_stack_v2_python_sparse | binary_sensor.py | benleb/sureha | train | 12 |
cd37682d84026b9c67bf02042a7d2681ea793d78 | [
"self.client.force_login(self.team1_admin)\nresponse = self.client.get(self.list_url)\nself.assertContains(response, self.team1.name, status_code=200)\nself.assertNotContains(response, self.team2.name)",
"self.client.force_login(self.team1_member)\nresponse = self.client.get(self.list_url)\nself.assertContains(re... | <|body_start_0|>
self.client.force_login(self.team1_admin)
response = self.client.get(self.list_url)
self.assertContains(response, self.team1.name, status_code=200)
self.assertNotContains(response, self.team2.name)
<|end_body_0|>
<|body_start_1|>
self.client.force_login(self.tea... | Test TeamListView | TeamListViewTest | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TeamListViewTest:
"""Test TeamListView"""
def test_team_list_admin(self):
"""Assert that the team is listed for the admin"""
<|body_0|>
def test_team_list_member(self):
"""Assert that the team is listed for the member"""
<|body_1|>
def test_team_list... | stack_v2_sparse_classes_75kplus_train_004892 | 10,931 | permissive | [
{
"docstring": "Assert that the team is listed for the admin",
"name": "test_team_list_admin",
"signature": "def test_team_list_admin(self)"
},
{
"docstring": "Assert that the team is listed for the member",
"name": "test_team_list_member",
"signature": "def test_team_list_member(self)"
... | 3 | stack_v2_sparse_classes_30k_train_024968 | Implement the Python class `TeamListViewTest` described below.
Class description:
Test TeamListView
Method signatures and docstrings:
- def test_team_list_admin(self): Assert that the team is listed for the admin
- def test_team_list_member(self): Assert that the team is listed for the member
- def test_team_list_not... | Implement the Python class `TeamListViewTest` described below.
Class description:
Test TeamListView
Method signatures and docstrings:
- def test_team_list_admin(self): Assert that the team is listed for the admin
- def test_team_list_member(self): Assert that the team is listed for the member
- def test_team_list_not... | b3a61462d46d33de25fb96c029b2bd822001b669 | <|skeleton|>
class TeamListViewTest:
"""Test TeamListView"""
def test_team_list_admin(self):
"""Assert that the team is listed for the admin"""
<|body_0|>
def test_team_list_member(self):
"""Assert that the team is listed for the member"""
<|body_1|>
def test_team_list... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TeamListViewTest:
"""Test TeamListView"""
def test_team_list_admin(self):
"""Assert that the team is listed for the admin"""
self.client.force_login(self.team1_admin)
response = self.client.get(self.list_url)
self.assertContains(response, self.team1.name, status_code=200)
... | the_stack_v2_python_sparse | src/team/tests.py | tykling/socialrating | train | 3 |
9d98bef6556da0c0ef934ad3d7a2cc47a0cbbbf4 | [
"workflow_id = kwargs.get('workflow_id')\napp_name = request.META.get('HTTP_APPNAME')\nusername = request.user.username\nflag, msg = workflow_permission_service_ins.manage_workflow_permission_check(workflow_id, username, app_name)\nif flag is False:\n return api_response(-1, msg, {})\nflag, workflow_result = wor... | <|body_start_0|>
workflow_id = kwargs.get('workflow_id')
app_name = request.META.get('HTTP_APPNAME')
username = request.user.username
flag, msg = workflow_permission_service_ins.manage_workflow_permission_check(workflow_id, username, app_name)
if flag is False:
return... | WorkflowDetailView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WorkflowDetailView:
def get(self, request, *args, **kwargs):
"""获取工作流详情 :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def patch(self, request, *args, **kwargs):
"""修改工作流 :param request: :param args: :param kwargs: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_004893 | 48,278 | permissive | [
{
"docstring": "获取工作流详情 :param request: :param args: :param kwargs: :return:",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "修改工作流 :param request: :param args: :param kwargs: :return:",
"name": "patch",
"signature": "def patch(self, request, *ar... | 3 | null | Implement the Python class `WorkflowDetailView` described below.
Class description:
Implement the WorkflowDetailView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): 获取工作流详情 :param request: :param args: :param kwargs: :return:
- def patch(self, request, *args, **kwargs): 修改工作流 :para... | Implement the Python class `WorkflowDetailView` described below.
Class description:
Implement the WorkflowDetailView class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): 获取工作流详情 :param request: :param args: :param kwargs: :return:
- def patch(self, request, *args, **kwargs): 修改工作流 :para... | b0e236b314286c5f6cc6959622c9c8505e776443 | <|skeleton|>
class WorkflowDetailView:
def get(self, request, *args, **kwargs):
"""获取工作流详情 :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def patch(self, request, *args, **kwargs):
"""修改工作流 :param request: :param args: :param kwargs: :return:"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WorkflowDetailView:
def get(self, request, *args, **kwargs):
"""获取工作流详情 :param request: :param args: :param kwargs: :return:"""
workflow_id = kwargs.get('workflow_id')
app_name = request.META.get('HTTP_APPNAME')
username = request.user.username
flag, msg = workflow_perm... | the_stack_v2_python_sparse | apps/workflow/views.py | blackholll/loonflow | train | 1,864 | |
42d179357d2d1cc4c199068dbf7bfb0066d2c9bf | [
"super(Player, self).__init__()\nself.image = pygame.Surface([100, 20], 5)\nself.image.fill(WHITE)\nself.rect = self.image.get_rect()\nself.rect.x = x\nself.rect.y = y\nself.x_speed = 0\nself.chosen = 'l'\nself.left_threshold = 0.5\nself.right_threshold = 0.5",
"if self.rect.x > 0 and self.x_speed < 0:\n self.... | <|body_start_0|>
super(Player, self).__init__()
self.image = pygame.Surface([100, 20], 5)
self.image.fill(WHITE)
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
self.x_speed = 0
self.chosen = 'l'
self.left_threshold = 0.5
... | The paddle controlled by each player | Player | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Player:
"""The paddle controlled by each player"""
def __init__(self, x, y):
"""Creates the paddle at the specified positions and sets initial control threshold levels to .5 :param x: Starting x position :param y: Starting y position"""
<|body_0|>
def update(self):
... | stack_v2_sparse_classes_75kplus_train_004894 | 10,881 | no_license | [
{
"docstring": "Creates the paddle at the specified positions and sets initial control threshold levels to .5 :param x: Starting x position :param y: Starting y position",
"name": "__init__",
"signature": "def __init__(self, x, y)"
},
{
"docstring": "Updates position of paddle based on current s... | 4 | null | Implement the Python class `Player` described below.
Class description:
The paddle controlled by each player
Method signatures and docstrings:
- def __init__(self, x, y): Creates the paddle at the specified positions and sets initial control threshold levels to .5 :param x: Starting x position :param y: Starting y po... | Implement the Python class `Player` described below.
Class description:
The paddle controlled by each player
Method signatures and docstrings:
- def __init__(self, x, y): Creates the paddle at the specified positions and sets initial control threshold levels to .5 :param x: Starting x position :param y: Starting y po... | cc9f342cebe53fa4badb0eafefc6fc333138048c | <|skeleton|>
class Player:
"""The paddle controlled by each player"""
def __init__(self, x, y):
"""Creates the paddle at the specified positions and sets initial control threshold levels to .5 :param x: Starting x position :param y: Starting y position"""
<|body_0|>
def update(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Player:
"""The paddle controlled by each player"""
def __init__(self, x, y):
"""Creates the paddle at the specified positions and sets initial control threshold levels to .5 :param x: Starting x position :param y: Starting y position"""
super(Player, self).__init__()
self.image = ... | the_stack_v2_python_sparse | openvibe_scenarios/motor-imagery-CSP/python_scripts/ping_pong.py | aubele/bci | train | 0 |
2cca5aae1c912250fb67a1aa25c138f1b1b50441 | [
"identifier_to_associated_identifier = {}\nmissing_identifiers = []\nfor identifier, associated_id in identifier_to_associated_id.items():\n found = associated_id in associated_id_to_identifier\n if found:\n identifier_to_associated_identifier[identifier] = associated_id_to_identifier[associated_id]\n ... | <|body_start_0|>
identifier_to_associated_identifier = {}
missing_identifiers = []
for identifier, associated_id in identifier_to_associated_id.items():
found = associated_id in associated_id_to_identifier
if found:
identifier_to_associated_identifier[iden... | IdentifiersQuerySet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IdentifiersQuerySet:
def _associate_identifiers(self, identifier_to_associated_id: dict, associated_id_to_identifier: dict) -> tuple[dict, list]:
"""Creates a dict of identifier to associated identifier given some intermediary dicts. Args: identifier_to_associated_id (dict): dict of iden... | stack_v2_sparse_classes_75kplus_train_004895 | 37,104 | permissive | [
{
"docstring": "Creates a dict of identifier to associated identifier given some intermediary dicts. Args: identifier_to_associated_id (dict): dict of identifier to associated id (ie PubMed/DOI string) associated_id_to_identifier (dict): dict of associated ids from first argument to matching identifiers Returns... | 3 | stack_v2_sparse_classes_30k_train_002373 | Implement the Python class `IdentifiersQuerySet` described below.
Class description:
Implement the IdentifiersQuerySet class.
Method signatures and docstrings:
- def _associate_identifiers(self, identifier_to_associated_id: dict, associated_id_to_identifier: dict) -> tuple[dict, list]: Creates a dict of identifier to... | Implement the Python class `IdentifiersQuerySet` described below.
Class description:
Implement the IdentifiersQuerySet class.
Method signatures and docstrings:
- def _associate_identifiers(self, identifier_to_associated_id: dict, associated_id_to_identifier: dict) -> tuple[dict, list]: Creates a dict of identifier to... | 51177c6fb9354cd028f7099fc10d83b1051fd50d | <|skeleton|>
class IdentifiersQuerySet:
def _associate_identifiers(self, identifier_to_associated_id: dict, associated_id_to_identifier: dict) -> tuple[dict, list]:
"""Creates a dict of identifier to associated identifier given some intermediary dicts. Args: identifier_to_associated_id (dict): dict of iden... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IdentifiersQuerySet:
def _associate_identifiers(self, identifier_to_associated_id: dict, associated_id_to_identifier: dict) -> tuple[dict, list]:
"""Creates a dict of identifier to associated identifier given some intermediary dicts. Args: identifier_to_associated_id (dict): dict of identifier to asso... | the_stack_v2_python_sparse | hawc/apps/lit/managers.py | shapiromatron/hawc | train | 25 | |
45da954dc536c1850bf94b989c475679d214e3f6 | [
"ComponentWrapper.__init__(self, tag, xmldoc, tarsqi_instance)\nself.component_name = BLINKER\nself.CREATION_EXTENSION = 'bli.i'\nself.RETRIEVAL_EXTENSION = 'bli.o'",
"for fragment in self.fragments:\n base = fragment[0]\n infile = '%s%s%s.%s' % (self.DIR_DATA, os.sep, base, self.CREATION_EXTENSION)\n ou... | <|body_start_0|>
ComponentWrapper.__init__(self, tag, xmldoc, tarsqi_instance)
self.component_name = BLINKER
self.CREATION_EXTENSION = 'bli.i'
self.RETRIEVAL_EXTENSION = 'bli.o'
<|end_body_0|>
<|body_start_1|>
for fragment in self.fragments:
base = fragment[0]
... | Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables. | BlinkerWrapper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BlinkerWrapper:
"""Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables."""
def __init__(self, tag, xmldoc, tarsqi_instance):
"""Calls __init__ of the base class and sets component_name, CREATION_EXTENSION and RETRIEV... | stack_v2_sparse_classes_75kplus_train_004896 | 1,286 | no_license | [
{
"docstring": "Calls __init__ of the base class and sets component_name, CREATION_EXTENSION and RETRIEVAL_EXTENSION.",
"name": "__init__",
"signature": "def __init__(self, tag, xmldoc, tarsqi_instance)"
},
{
"docstring": "Apply the Blinker parser to each fragment. No arguments and no return val... | 2 | stack_v2_sparse_classes_30k_train_003741 | Implement the Python class `BlinkerWrapper` described below.
Class description:
Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables.
Method signatures and docstrings:
- def __init__(self, tag, xmldoc, tarsqi_instance): Calls __init__ of the base clas... | Implement the Python class `BlinkerWrapper` described below.
Class description:
Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables.
Method signatures and docstrings:
- def __init__(self, tag, xmldoc, tarsqi_instance): Calls __init__ of the base clas... | efb55fa054e2313fd710939330a4fbda5634cb41 | <|skeleton|>
class BlinkerWrapper:
"""Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables."""
def __init__(self, tag, xmldoc, tarsqi_instance):
"""Calls __init__ of the base class and sets component_name, CREATION_EXTENSION and RETRIEV... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BlinkerWrapper:
"""Wrapper for Blinker. See ComponentWrapper for more details on how component wrappers work and on the instance variables."""
def __init__(self, tag, xmldoc, tarsqi_instance):
"""Calls __init__ of the base class and sets component_name, CREATION_EXTENSION and RETRIEVAL_EXTENSION.... | the_stack_v2_python_sparse | code/components/blinker/wrapper.py | tankle/TARSQI | train | 1 |
4f0e263f12891306c0446f541585fd7089bc61d3 | [
"gene = v.get_gene()\nif gene == u.members[0]:\n return (u.members[1].safe_label, edge_data[RELATION], v.safe_label)\nelse:\n return (u.members[0].safe_label, edge_data[RELATION], v.safe_label)",
"if not isinstance(u, ComplexAbundance) or len(u.members) != 2:\n return False\nif isinstance(u.members[0], G... | <|body_start_0|>
gene = v.get_gene()
if gene == u.members[0]:
return (u.members[1].safe_label, edge_data[RELATION], v.safe_label)
else:
return (u.members[0].safe_label, edge_data[RELATION], v.safe_label)
<|end_body_0|>
<|body_start_1|>
if not isinstance(u, Comple... | Converts ``complex(g(A), p(B)) directlyIncreases r(A)```. | TranscriptionFactorForConverter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TranscriptionFactorForConverter:
"""Converts ``complex(g(A), p(B)) directlyIncreases r(A)```."""
def convert(cls, u: BaseEntity, v: BaseEntity, key: str, edge_data: EdgeData) -> Tuple[str, str, str]:
"""Convert a transcription factor for edge."""
<|body_0|>
def predicate... | stack_v2_sparse_classes_75kplus_train_004897 | 18,695 | permissive | [
{
"docstring": "Convert a transcription factor for edge.",
"name": "convert",
"signature": "def convert(cls, u: BaseEntity, v: BaseEntity, key: str, edge_data: EdgeData) -> Tuple[str, str, str]"
},
{
"docstring": "Test a BEL edge.",
"name": "predicate",
"signature": "def predicate(cls, u... | 2 | null | Implement the Python class `TranscriptionFactorForConverter` described below.
Class description:
Converts ``complex(g(A), p(B)) directlyIncreases r(A)```.
Method signatures and docstrings:
- def convert(cls, u: BaseEntity, v: BaseEntity, key: str, edge_data: EdgeData) -> Tuple[str, str, str]: Convert a transcription ... | Implement the Python class `TranscriptionFactorForConverter` described below.
Class description:
Converts ``complex(g(A), p(B)) directlyIncreases r(A)```.
Method signatures and docstrings:
- def convert(cls, u: BaseEntity, v: BaseEntity, key: str, edge_data: EdgeData) -> Tuple[str, str, str]: Convert a transcription ... | ed66f013a77f9cbc513892b0dad1025b8f68bb46 | <|skeleton|>
class TranscriptionFactorForConverter:
"""Converts ``complex(g(A), p(B)) directlyIncreases r(A)```."""
def convert(cls, u: BaseEntity, v: BaseEntity, key: str, edge_data: EdgeData) -> Tuple[str, str, str]:
"""Convert a transcription factor for edge."""
<|body_0|>
def predicate... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TranscriptionFactorForConverter:
"""Converts ``complex(g(A), p(B)) directlyIncreases r(A)```."""
def convert(cls, u: BaseEntity, v: BaseEntity, key: str, edge_data: EdgeData) -> Tuple[str, str, str]:
"""Convert a transcription factor for edge."""
gene = v.get_gene()
if gene == u.m... | the_stack_v2_python_sparse | src/pybel/io/triples/converters.py | pybel/pybel | train | 133 |
6f32b61133bca0cae2093845161675471fa5cb56 | [
"ans = []\n\ndef preorder(root):\n if not root:\n ans.append('#')\n while root:\n ans.append(str(root.val))\n preorder(root.left)\n preorder(root.right)\npreorder(root)\nreturn ' '.join(ans)",
"vals = collections.deque((val for val in data.split()))\n\ndef build():\n if vals:\... | <|body_start_0|>
ans = []
def preorder(root):
if not root:
ans.append('#')
while root:
ans.append(str(root.val))
preorder(root.left)
preorder(root.right)
preorder(root)
return ' '.join(ans)
<|end_bod... | 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_75kplus_train_004898 | 1,873 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_014559 | 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:... | 9fcd1ec0686db45d24e2c52a7987d58c6ef545a0 | <|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_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
ans = []
def preorder(root):
if not root:
ans.append('#')
while root:
ans.append(str(root.val))
preorder(... | the_stack_v2_python_sparse | Design/297-SerializeandDeserializeBinaryTree.py | szhmery/leetcode | train | 0 | |
81457f9d9eace78b49fe01afe0e92d30cbd77e93 | [
"clean_texts = [['this', 'is', 'an', 'example', 'of', 'test', 'text', 'it', 'contains', 'two', 'sentences'], ['das', 'ist', 'ein', 'testtext', 'es', 'ist', 'auf', 'deutsch', 'geschrieben']]\ntf_instance = TfIdfCalculator(clean_texts)\nself.assertEqual(tf_instance.corpus, clean_texts)\nself.assertEqual(tf_instance.t... | <|body_start_0|>
clean_texts = [['this', 'is', 'an', 'example', 'of', 'test', 'text', 'it', 'contains', 'two', 'sentences'], ['das', 'ist', 'ein', 'testtext', 'es', 'ist', 'auf', 'deutsch', 'geschrieben']]
tf_instance = TfIdfCalculator(clean_texts)
self.assertEqual(tf_instance.corpus, clean_text... | Checks calculating tf of given texts | CalculateTfTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CalculateTfTest:
"""Checks calculating tf of given texts"""
def test_check_initialization(self):
"""check instance of TfIdfCalculator initialization"""
<|body_0|>
def test_check_calculate_tf_ideal(self):
"""check tf calculation ideal case"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus_train_004899 | 4,642 | no_license | [
{
"docstring": "check instance of TfIdfCalculator initialization",
"name": "test_check_initialization",
"signature": "def test_check_initialization(self)"
},
{
"docstring": "check tf calculation ideal case",
"name": "test_check_calculate_tf_ideal",
"signature": "def test_check_calculate_... | 6 | stack_v2_sparse_classes_30k_train_030379 | Implement the Python class `CalculateTfTest` described below.
Class description:
Checks calculating tf of given texts
Method signatures and docstrings:
- def test_check_initialization(self): check instance of TfIdfCalculator initialization
- def test_check_calculate_tf_ideal(self): check tf calculation ideal case
- d... | Implement the Python class `CalculateTfTest` described below.
Class description:
Checks calculating tf of given texts
Method signatures and docstrings:
- def test_check_initialization(self): check instance of TfIdfCalculator initialization
- def test_check_calculate_tf_ideal(self): check tf calculation ideal case
- d... | b50968194c38b0b9884c134c30c60f01e3b927da | <|skeleton|>
class CalculateTfTest:
"""Checks calculating tf of given texts"""
def test_check_initialization(self):
"""check instance of TfIdfCalculator initialization"""
<|body_0|>
def test_check_calculate_tf_ideal(self):
"""check tf calculation ideal case"""
<|body_1|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CalculateTfTest:
"""Checks calculating tf of given texts"""
def test_check_initialization(self):
"""check instance of TfIdfCalculator initialization"""
clean_texts = [['this', 'is', 'an', 'example', 'of', 'test', 'text', 'it', 'contains', 'two', 'sentences'], ['das', 'ist', 'ein', 'testte... | the_stack_v2_python_sparse | lab_4/calculate_tf_test.py | KMalika/2018-2-level-labs | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.