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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e12425b5d7f16f3a610af654e32c44981a88b9ee | [
"candidates = sorted(candidates)\nrst = []\n\ndef dfs(remain, ele, idx_can):\n if remain == 0:\n rst.append(ele)\n return\n for i in range(idx_can, len(candidates)):\n can = candidates[i]\n if i > idx_can and can == candidates[i - 1]:\n continue\n if remain >= can... | <|body_start_0|>
candidates = sorted(candidates)
rst = []
def dfs(remain, ele, idx_can):
if remain == 0:
rst.append(ele)
return
for i in range(idx_can, len(candidates)):
can = candidates[i]
if i > idx_can an... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def combinationSum2(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
<|body_0|>
def combinationSum2_mysecond(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[... | stack_v2_sparse_classes_75kplus_train_071100 | 2,586 | no_license | [
{
"docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]]",
"name": "combinationSum2",
"signature": "def combinationSum2(self, candidates, target)"
},
{
"docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]]",
"name": "combinationSum2_... | 3 | stack_v2_sparse_classes_30k_train_045107 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum2(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]]
- def combinationSum2_mysecond(self, candidates, target): :ty... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum2(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]]
- def combinationSum2_mysecond(self, candidates, target): :ty... | f0d9070fa292ca36971a465a805faddb12025482 | <|skeleton|>
class Solution:
def combinationSum2(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
<|body_0|>
def combinationSum2_mysecond(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def combinationSum2(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]]"""
candidates = sorted(candidates)
rst = []
def dfs(remain, ele, idx_can):
if remain == 0:
rst.append(ele)
... | the_stack_v2_python_sparse | 40.CombinationSumii.py | JerryRoc/leetcode | train | 0 | |
519127431cccfbb2ff502a3520b9ee554721da20 | [
"super(HiveNamedPartitionSensor, self).__init__(host, port, **kwargs)\nself._table_name = table_name\nself._partition_names = partition_names",
"with self._hive_metastore_client as client:\n try:\n for partition_name in self._partition_names:\n client.get_partition_by_name(self._schema, self.... | <|body_start_0|>
super(HiveNamedPartitionSensor, self).__init__(host, port, **kwargs)
self._table_name = table_name
self._partition_names = partition_names
<|end_body_0|>
<|body_start_1|>
with self._hive_metastore_client as client:
try:
for partition_name in ... | HiveNamedPartitionSensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HiveNamedPartitionSensor:
def __init__(self, table_name, partition_names, host, port, **kwargs):
"""This class allows sensing for a specific named Hive Partition. This is the preferred partition sensing operator because it is more efficient than evaluating a filter expression. :param Tex... | stack_v2_sparse_classes_75kplus_train_071101 | 4,900 | permissive | [
{
"docstring": "This class allows sensing for a specific named Hive Partition. This is the preferred partition sensing operator because it is more efficient than evaluating a filter expression. :param Text table_name: The name of the table :param Text partition_name: The name of the partition to listen for (exa... | 2 | stack_v2_sparse_classes_30k_train_033779 | Implement the Python class `HiveNamedPartitionSensor` described below.
Class description:
Implement the HiveNamedPartitionSensor class.
Method signatures and docstrings:
- def __init__(self, table_name, partition_names, host, port, **kwargs): This class allows sensing for a specific named Hive Partition. This is the ... | Implement the Python class `HiveNamedPartitionSensor` described below.
Class description:
Implement the HiveNamedPartitionSensor class.
Method signatures and docstrings:
- def __init__(self, table_name, partition_names, host, port, **kwargs): This class allows sensing for a specific named Hive Partition. This is the ... | 2eb9ce7aacaab6e49c1fc901c14c7b0d6b479523 | <|skeleton|>
class HiveNamedPartitionSensor:
def __init__(self, table_name, partition_names, host, port, **kwargs):
"""This class allows sensing for a specific named Hive Partition. This is the preferred partition sensing operator because it is more efficient than evaluating a filter expression. :param Tex... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HiveNamedPartitionSensor:
def __init__(self, table_name, partition_names, host, port, **kwargs):
"""This class allows sensing for a specific named Hive Partition. This is the preferred partition sensing operator because it is more efficient than evaluating a filter expression. :param Text table_name: ... | the_stack_v2_python_sparse | flytekit/contrib/sensors/impl.py | jbrambleDC/flytekit | train | 1 | |
efe82e6ff061ce457c7c90ab9c9ba71ba05dc52f | [
"if file_path:\n value = cls.file_to_base64(file_path)\nelif url:\n has_query = url.find('?') > 0\n url = url[:url.find('?')] if has_query else url\n value = cls.url_to_base64(url)\nelif byte_stream:\n value = cls.byte_stream_to_base64(byte_stream, mime_type)\npayload = cls.payload_for_create(type, v... | <|body_start_0|>
if file_path:
value = cls.file_to_base64(file_path)
elif url:
has_query = url.find('?') > 0
url = url[:url.find('?')] if has_query else url
value = cls.url_to_base64(url)
elif byte_stream:
value = cls.byte_stream_to_bas... | Object representation of a supporting physical document. Physical documents are images or pdfs that help verify the user's identity. https://docs.synapsepay.com/docs/user-resources#section-physical-document-types jpg and png are preferred. Base64 values should be padded like this: jpg - data:image/jpeg;base64,... png -... | PhysicalDocument | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhysicalDocument:
"""Object representation of a supporting physical document. Physical documents are images or pdfs that help verify the user's identity. https://docs.synapsepay.com/docs/user-resources#section-physical-document-types jpg and png are preferred. Base64 values should be padded like ... | stack_v2_sparse_classes_75kplus_train_071102 | 2,956 | permissive | [
{
"docstring": "Add a PhysicalDocument to the BaseDocument. Args: type (str): https://docs.synapsepay.com/docs/user-resources#section-physical-document-types value (str): (opt) padded Base64 encoded image string file_path (str): path to image file (instead of value) url (str): url to image file (instead of valu... | 4 | stack_v2_sparse_classes_30k_train_047226 | Implement the Python class `PhysicalDocument` described below.
Class description:
Object representation of a supporting physical document. Physical documents are images or pdfs that help verify the user's identity. https://docs.synapsepay.com/docs/user-resources#section-physical-document-types jpg and png are preferre... | Implement the Python class `PhysicalDocument` described below.
Class description:
Object representation of a supporting physical document. Physical documents are images or pdfs that help verify the user's identity. https://docs.synapsepay.com/docs/user-resources#section-physical-document-types jpg and png are preferre... | e7647191b386bdda84c0f2f1eb097569e36c27ae | <|skeleton|>
class PhysicalDocument:
"""Object representation of a supporting physical document. Physical documents are images or pdfs that help verify the user's identity. https://docs.synapsepay.com/docs/user-resources#section-physical-document-types jpg and png are preferred. Base64 values should be padded like ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PhysicalDocument:
"""Object representation of a supporting physical document. Physical documents are images or pdfs that help verify the user's identity. https://docs.synapsepay.com/docs/user-resources#section-physical-document-types jpg and png are preferred. Base64 values should be padded like this: jpg - d... | the_stack_v2_python_sparse | synapse_pay_rest/models/users/physical_document.py | SynapseFI/SynapseFI-Python | train | 4 |
d00355c451edba35b9798290b43d08f1cd5944e3 | [
"self._metadata_file = preproc_dir / 'metadata.yml'\nprev_metadata_file = prev_preproc_dir / 'metadata.yml'\nwith prev_metadata_file.open('rb') as file:\n prev_metadata = yaml.safe_load(file)\nproducts = set()\nfor prov_filename, attributes in prev_metadata.items():\n filename = str(prev_preproc_dir / Path(pr... | <|body_start_0|>
self._metadata_file = preproc_dir / 'metadata.yml'
prev_metadata_file = prev_preproc_dir / 'metadata.yml'
with prev_metadata_file.open('rb') as file:
prev_metadata = yaml.safe_load(file)
products = set()
for prov_filename, attributes in prev_metadata.... | Task for re-using preprocessor output files from a previous run. | ResumeTask | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResumeTask:
"""Task for re-using preprocessor output files from a previous run."""
def __init__(self, prev_preproc_dir, preproc_dir, name):
"""Create a resume task."""
<|body_0|>
def _run(self, _):
"""Return the result of a previous run."""
<|body_1|>
<|... | stack_v2_sparse_classes_75kplus_train_071103 | 29,602 | permissive | [
{
"docstring": "Create a resume task.",
"name": "__init__",
"signature": "def __init__(self, prev_preproc_dir, preproc_dir, name)"
},
{
"docstring": "Return the result of a previous run.",
"name": "_run",
"signature": "def _run(self, _)"
}
] | 2 | stack_v2_sparse_classes_30k_train_047312 | Implement the Python class `ResumeTask` described below.
Class description:
Task for re-using preprocessor output files from a previous run.
Method signatures and docstrings:
- def __init__(self, prev_preproc_dir, preproc_dir, name): Create a resume task.
- def _run(self, _): Return the result of a previous run. | Implement the Python class `ResumeTask` described below.
Class description:
Task for re-using preprocessor output files from a previous run.
Method signatures and docstrings:
- def __init__(self, prev_preproc_dir, preproc_dir, name): Create a resume task.
- def _run(self, _): Return the result of a previous run.
<|s... | d5187438fea2928644cb53ecb26c6adb1e4cc947 | <|skeleton|>
class ResumeTask:
"""Task for re-using preprocessor output files from a previous run."""
def __init__(self, prev_preproc_dir, preproc_dir, name):
"""Create a resume task."""
<|body_0|>
def _run(self, _):
"""Return the result of a previous run."""
<|body_1|>
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResumeTask:
"""Task for re-using preprocessor output files from a previous run."""
def __init__(self, prev_preproc_dir, preproc_dir, name):
"""Create a resume task."""
self._metadata_file = preproc_dir / 'metadata.yml'
prev_metadata_file = prev_preproc_dir / 'metadata.yml'
... | the_stack_v2_python_sparse | esmvalcore/_task.py | ESMValGroup/ESMValCore | train | 41 |
64a63298fd52d9042e6575c8bb9b3161a00d5004 | [
"self.network1 = ot.TemporalDiGraph('test_network', data=ot.CsvInput('../overtime/data/network.csv'))\ntfl_data = ot.CsvInput('../overtime/data/victoria_central_bakerloo_piccadilly-inbound_outbound.csv')\nself.network2 = ot.TemporalDiGraph('TflNetwork', data=tfl_data)\nself.network2.nodes.add_data('../overtime/data... | <|body_start_0|>
self.network1 = ot.TemporalDiGraph('test_network', data=ot.CsvInput('../overtime/data/network.csv'))
tfl_data = ot.CsvInput('../overtime/data/victoria_central_bakerloo_piccadilly-inbound_outbound.csv')
self.network2 = ot.TemporalDiGraph('TflNetwork', data=tfl_data)
self.... | This class is used to test the two main edge deletion method in edgeDeletion.py. | TestEdgeDeletion | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestEdgeDeletion:
"""This class is used to test the two main edge deletion method in edgeDeletion.py."""
def setUp(self) -> None:
"""Load two networks. The first one is a simple test network, and the second one is the London subway stations network(Victoria)."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_071104 | 3,715 | permissive | [
{
"docstring": "Load two networks. The first one is a simple test network, and the second one is the London subway stations network(Victoria).",
"name": "setUp",
"signature": "def setUp(self) -> None"
},
{
"docstring": "This function is used to test h_approximation algorithm. Firstly, it will sp... | 3 | stack_v2_sparse_classes_30k_train_034048 | Implement the Python class `TestEdgeDeletion` described below.
Class description:
This class is used to test the two main edge deletion method in edgeDeletion.py.
Method signatures and docstrings:
- def setUp(self) -> None: Load two networks. The first one is a simple test network, and the second one is the London su... | Implement the Python class `TestEdgeDeletion` described below.
Class description:
This class is used to test the two main edge deletion method in edgeDeletion.py.
Method signatures and docstrings:
- def setUp(self) -> None: Load two networks. The first one is a simple test network, and the second one is the London su... | ed3ae6877894f4d2c9f8473a885698e1622be3bd | <|skeleton|>
class TestEdgeDeletion:
"""This class is used to test the two main edge deletion method in edgeDeletion.py."""
def setUp(self) -> None:
"""Load two networks. The first one is a simple test network, and the second one is the London subway stations network(Victoria)."""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestEdgeDeletion:
"""This class is used to test the two main edge deletion method in edgeDeletion.py."""
def setUp(self) -> None:
"""Load two networks. The first one is a simple test network, and the second one is the London subway stations network(Victoria)."""
self.network1 = ot.Tempora... | the_stack_v2_python_sparse | unittest/test_edgeDeletion.py | overtime3/overtime | train | 13 |
51fa55c238da1de859cc57fdfd20d611b6250c5a | [
"SimpleRule.__init__(self, **kwargs)\nself.port_rule = PortRangeRule(**kwargs)\nsource_args = kwargs.copy()\nsource_ip = source_args.pop('src_ip', None)\nif source_ip:\n source_args['cidr_range'] = source_ip\n self.ip_src_rule = SourceIPRule(**source_args)\nelse:\n self.ip_src_rule = None\ndest_args = kwar... | <|body_start_0|>
SimpleRule.__init__(self, **kwargs)
self.port_rule = PortRangeRule(**kwargs)
source_args = kwargs.copy()
source_ip = source_args.pop('src_ip', None)
if source_ip:
source_args['cidr_range'] = source_ip
self.ip_src_rule = SourceIPRule(**sour... | IPPortRule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IPPortRule:
def __init__(self, **kwargs):
"""Creates a combination of rules."""
<|body_0|>
def filter_condition(self, packet):
"""Condition to filter on."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
SimpleRule.__init__(self, **kwargs)
sel... | stack_v2_sparse_classes_75kplus_train_071105 | 1,410 | no_license | [
{
"docstring": "Creates a combination of rules.",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Condition to filter on.",
"name": "filter_condition",
"signature": "def filter_condition(self, packet)"
}
] | 2 | stack_v2_sparse_classes_30k_train_043864 | Implement the Python class `IPPortRule` described below.
Class description:
Implement the IPPortRule class.
Method signatures and docstrings:
- def __init__(self, **kwargs): Creates a combination of rules.
- def filter_condition(self, packet): Condition to filter on. | Implement the Python class `IPPortRule` described below.
Class description:
Implement the IPPortRule class.
Method signatures and docstrings:
- def __init__(self, **kwargs): Creates a combination of rules.
- def filter_condition(self, packet): Condition to filter on.
<|skeleton|>
class IPPortRule:
def __init__(... | eae87795bb426f032c8434e5c1196950f46946f1 | <|skeleton|>
class IPPortRule:
def __init__(self, **kwargs):
"""Creates a combination of rules."""
<|body_0|>
def filter_condition(self, packet):
"""Condition to filter on."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IPPortRule:
def __init__(self, **kwargs):
"""Creates a combination of rules."""
SimpleRule.__init__(self, **kwargs)
self.port_rule = PortRangeRule(**kwargs)
source_args = kwargs.copy()
source_ip = source_args.pop('src_ip', None)
if source_ip:
source_... | the_stack_v2_python_sparse | linux/rules/port_ip_rule.py | venkata16sidhartha/firewall-linux | train | 1 | |
b34ba49e875f62091f4ee4ef49a98cad494e3d2f | [
"self.trade_days = trade_days\nself.trade_strategy = trade_strategy\nself.profit_array = []",
"for ind, day in enumerate(self.trade_days):\n '\\n 以时间驱动,完成交易回测\\n '\n if self.trade_strategy.keep_stock_day > 0:\n self.profit_array.append(day.change)\n if hasattr(self.trade_... | <|body_start_0|>
self.trade_days = trade_days
self.trade_strategy = trade_strategy
self.profit_array = []
<|end_body_0|>
<|body_start_1|>
for ind, day in enumerate(self.trade_days):
'\n 以时间驱动,完成交易回测\n '
if self.trade_strategy.keep_stock_day ... | 交易回测系统 | TradeLoopBack | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TradeLoopBack:
"""交易回测系统"""
def __init__(self, trade_days, trade_strategy):
"""使用前面封装的 StockTradDays类和交易策略类 TradeStrategyBase 类初始化交易系统 :param trade_days: StockTradDays类数据序列 :param trade_strategy: TradeStrategyBase交易策略"""
<|body_0|>
def execute_trade(self):
"""执行交... | stack_v2_sparse_classes_75kplus_train_071106 | 1,626 | no_license | [
{
"docstring": "使用前面封装的 StockTradDays类和交易策略类 TradeStrategyBase 类初始化交易系统 :param trade_days: StockTradDays类数据序列 :param trade_strategy: TradeStrategyBase交易策略",
"name": "__init__",
"signature": "def __init__(self, trade_days, trade_strategy)"
},
{
"docstring": "执行交易回测 :return:",
"name": "execute... | 2 | stack_v2_sparse_classes_30k_test_001157 | Implement the Python class `TradeLoopBack` described below.
Class description:
交易回测系统
Method signatures and docstrings:
- def __init__(self, trade_days, trade_strategy): 使用前面封装的 StockTradDays类和交易策略类 TradeStrategyBase 类初始化交易系统 :param trade_days: StockTradDays类数据序列 :param trade_strategy: TradeStrategyBase交易策略
- def exe... | Implement the Python class `TradeLoopBack` described below.
Class description:
交易回测系统
Method signatures and docstrings:
- def __init__(self, trade_days, trade_strategy): 使用前面封装的 StockTradDays类和交易策略类 TradeStrategyBase 类初始化交易系统 :param trade_days: StockTradDays类数据序列 :param trade_strategy: TradeStrategyBase交易策略
- def exe... | 61c00bb44eda06ac62a5e9eb9d9c946d59756113 | <|skeleton|>
class TradeLoopBack:
"""交易回测系统"""
def __init__(self, trade_days, trade_strategy):
"""使用前面封装的 StockTradDays类和交易策略类 TradeStrategyBase 类初始化交易系统 :param trade_days: StockTradDays类数据序列 :param trade_strategy: TradeStrategyBase交易策略"""
<|body_0|>
def execute_trade(self):
"""执行交... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TradeLoopBack:
"""交易回测系统"""
def __init__(self, trade_days, trade_strategy):
"""使用前面封装的 StockTradDays类和交易策略类 TradeStrategyBase 类初始化交易系统 :param trade_days: StockTradDays类数据序列 :param trade_strategy: TradeStrategyBase交易策略"""
self.trade_days = trade_days
self.trade_strategy = trade_str... | the_stack_v2_python_sparse | quantitativeInvestment/chapter2/TradeLoopBack.py | zeoyzhaogithub/python | train | 1 |
123b7cd14f7f46da16cce2e6439179db72c9f29c | [
"super().__init__(model_dir, workspace)\nself.dataset_wkspc = dataset_wkspc\nself.subjects = gb_input.get_subjects(self.dataset_wkspc)\nself.vocab = input_util.get_sorted_vocab(gb_input.get_vocabulary(self.dataset_wkspc))\nself.vocab = self.vocab[:FLAGS.vocab_count]",
"pretrained = None\nif FLAGS.use_pretrained_e... | <|body_start_0|>
super().__init__(model_dir, workspace)
self.dataset_wkspc = dataset_wkspc
self.subjects = gb_input.get_subjects(self.dataset_wkspc)
self.vocab = input_util.get_sorted_vocab(gb_input.get_vocabulary(self.dataset_wkspc))
self.vocab = self.vocab[:FLAGS.vocab_count]
<... | This is an AI Lit university for training MeanMLP on the Gutenberg Titles text dataset. | GbTitleAvgMlpUniversity | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GbTitleAvgMlpUniversity:
"""This is an AI Lit university for training MeanMLP on the Gutenberg Titles text dataset."""
def __init__(self, model_dir, workspace, dataset_wkspc):
"""Initialize the GB Titles Avg Mean university. :param model_dir: The directory where this model is stored.... | stack_v2_sparse_classes_75kplus_train_071107 | 5,059 | permissive | [
{
"docstring": "Initialize the GB Titles Avg Mean university. :param model_dir: The directory where this model is stored. :param workspace: The workspace directory of this university. :param dataset_wkspc: The GB input workspace where all inputs are stored.",
"name": "__init__",
"signature": "def __init... | 6 | null | Implement the Python class `GbTitleAvgMlpUniversity` described below.
Class description:
This is an AI Lit university for training MeanMLP on the Gutenberg Titles text dataset.
Method signatures and docstrings:
- def __init__(self, model_dir, workspace, dataset_wkspc): Initialize the GB Titles Avg Mean university. :p... | Implement the Python class `GbTitleAvgMlpUniversity` described below.
Class description:
This is an AI Lit university for training MeanMLP on the Gutenberg Titles text dataset.
Method signatures and docstrings:
- def __init__(self, model_dir, workspace, dataset_wkspc): Initialize the GB Titles Avg Mean university. :p... | adb9aec97372a360e9de5f822f3faefc65db5997 | <|skeleton|>
class GbTitleAvgMlpUniversity:
"""This is an AI Lit university for training MeanMLP on the Gutenberg Titles text dataset."""
def __init__(self, model_dir, workspace, dataset_wkspc):
"""Initialize the GB Titles Avg Mean university. :param model_dir: The directory where this model is stored.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GbTitleAvgMlpUniversity:
"""This is an AI Lit university for training MeanMLP on the Gutenberg Titles text dataset."""
def __init__(self, model_dir, workspace, dataset_wkspc):
"""Initialize the GB Titles Avg Mean university. :param model_dir: The directory where this model is stored. :param works... | the_stack_v2_python_sparse | ai_lit/university/gutenberg/gb_titles_avg_mlp.py | LincLabUCCS/Genre_Identification | train | 0 |
fe39b23fe57a0ce200f7365192112d29dbd21740 | [
"import heapq, collections\nleft_max = A[0]\nh = []\nfor a in A[1:]:\n heapq.heappush(h, a)\ntemp = collections.defaultdict(int)\nl = len(A)\nfor i in range(1, l):\n if left_max <= h[0]:\n return i\n else:\n left_max = max(A[i], left_max)\n temp[A[i]] += 1\n while h:\n ... | <|body_start_0|>
import heapq, collections
left_max = A[0]
h = []
for a in A[1:]:
heapq.heappush(h, a)
temp = collections.defaultdict(int)
l = len(A)
for i in range(1, l):
if left_max <= h[0]:
return i
else:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def partitionDisjoint(self, A):
""":type A: List[int] :rtype: int 288 ms nlgn"""
<|body_0|>
def partitionDisjoint_1(self, A):
""":type A: List[int] :rtype: int 32ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
import heapq, collections
... | stack_v2_sparse_classes_75kplus_train_071108 | 2,806 | no_license | [
{
"docstring": ":type A: List[int] :rtype: int 288 ms nlgn",
"name": "partitionDisjoint",
"signature": "def partitionDisjoint(self, A)"
},
{
"docstring": ":type A: List[int] :rtype: int 32ms",
"name": "partitionDisjoint_1",
"signature": "def partitionDisjoint_1(self, A)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partitionDisjoint(self, A): :type A: List[int] :rtype: int 288 ms nlgn
- def partitionDisjoint_1(self, A): :type A: List[int] :rtype: int 32ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partitionDisjoint(self, A): :type A: List[int] :rtype: int 288 ms nlgn
- def partitionDisjoint_1(self, A): :type A: List[int] :rtype: int 32ms
<|skeleton|>
class Solution:
... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def partitionDisjoint(self, A):
""":type A: List[int] :rtype: int 288 ms nlgn"""
<|body_0|>
def partitionDisjoint_1(self, A):
""":type A: List[int] :rtype: int 32ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def partitionDisjoint(self, A):
""":type A: List[int] :rtype: int 288 ms nlgn"""
import heapq, collections
left_max = A[0]
h = []
for a in A[1:]:
heapq.heappush(h, a)
temp = collections.defaultdict(int)
l = len(A)
for i in r... | the_stack_v2_python_sparse | PartitionArrayIntoDisjointIntervals_MID_915.py | 953250587/leetcode-python | train | 2 | |
a08cacbc0cec72acdb9f5346003fbc8dda11a26c | [
"self.direction = direction.lower()\nif self.direction not in ['z+', 'z-']:\n raise ValueError(f'{direction} is not a valid direction')\nsuper(ZLayout, self).__init__(cell_padding=cell_padding, cell_shape=cell_shape)",
"if self.direction == 'z-':\n actors = actors[::-1]\nif self.cell_shape == 'rect' or self... | <|body_start_0|>
self.direction = direction.lower()
if self.direction not in ['z+', 'z-']:
raise ValueError(f'{direction} is not a valid direction')
super(ZLayout, self).__init__(cell_padding=cell_padding, cell_shape=cell_shape)
<|end_body_0|>
<|body_start_1|>
if self.direct... | Provide functionalities for laying out actors along z-axis. | ZLayout | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZLayout:
"""Provide functionalities for laying out actors along z-axis."""
def __init__(self, direction='z+', cell_padding=0, cell_shape='rect'):
"""Parameters ---------- direction: str, optional The direction of layout. 'z+' means actors will be placed along positive z-axis. 'z-' me... | stack_v2_sparse_classes_75kplus_train_071109 | 18,098 | permissive | [
{
"docstring": "Parameters ---------- direction: str, optional The direction of layout. 'z+' means actors will be placed along positive z-axis. 'z-' means actors will be placed along negative z-axis. cell_padding : 2-tuple of float or float (optional) Each cell will be padded according to (pad_x, pad_y) i.e. ho... | 4 | null | Implement the Python class `ZLayout` described below.
Class description:
Provide functionalities for laying out actors along z-axis.
Method signatures and docstrings:
- def __init__(self, direction='z+', cell_padding=0, cell_shape='rect'): Parameters ---------- direction: str, optional The direction of layout. 'z+' m... | Implement the Python class `ZLayout` described below.
Class description:
Provide functionalities for laying out actors along z-axis.
Method signatures and docstrings:
- def __init__(self, direction='z+', cell_padding=0, cell_shape='rect'): Parameters ---------- direction: str, optional The direction of layout. 'z+' m... | e595bad0246899d58d24121dcc291eb050721f9f | <|skeleton|>
class ZLayout:
"""Provide functionalities for laying out actors along z-axis."""
def __init__(self, direction='z+', cell_padding=0, cell_shape='rect'):
"""Parameters ---------- direction: str, optional The direction of layout. 'z+' means actors will be placed along positive z-axis. 'z-' me... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ZLayout:
"""Provide functionalities for laying out actors along z-axis."""
def __init__(self, direction='z+', cell_padding=0, cell_shape='rect'):
"""Parameters ---------- direction: str, optional The direction of layout. 'z+' means actors will be placed along positive z-axis. 'z-' means actors wi... | the_stack_v2_python_sparse | fury/layout.py | fury-gl/fury | train | 209 |
1a74b672a83f0bafa47aeaac7f510e9a8aabb4b3 | [
"try:\n return self.PhdthesisSource()\nexcept AttributeError:\n publication_type = self.getPublication_type()\n school = self.getSchool()\n address = self.getAddress()\n isbn = self.getIsbn()\n if publication_type:\n source = publication_type\n else:\n source = 'PhD thesis'\n i... | <|body_start_0|>
try:
return self.PhdthesisSource()
except AttributeError:
publication_type = self.getPublication_type()
school = self.getSchool()
address = self.getAddress()
isbn = self.getIsbn()
if publication_type:
... | content type to make reference to a PhD thesis. | PhdthesisReference | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhdthesisReference:
"""content type to make reference to a PhD thesis."""
def Source(self):
"""the default source renderer"""
<|body_0|>
def getCoinsDict(self):
"""Select which values to display in the COinS tag for this item"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_75kplus_train_071110 | 3,659 | no_license | [
{
"docstring": "the default source renderer",
"name": "Source",
"signature": "def Source(self)"
},
{
"docstring": "Select which values to display in the COinS tag for this item",
"name": "getCoinsDict",
"signature": "def getCoinsDict(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_028241 | Implement the Python class `PhdthesisReference` described below.
Class description:
content type to make reference to a PhD thesis.
Method signatures and docstrings:
- def Source(self): the default source renderer
- def getCoinsDict(self): Select which values to display in the COinS tag for this item | Implement the Python class `PhdthesisReference` described below.
Class description:
content type to make reference to a PhD thesis.
Method signatures and docstrings:
- def Source(self): the default source renderer
- def getCoinsDict(self): Select which values to display in the COinS tag for this item
<|skeleton|>
cl... | f9e9f973765ae2bbfd02baee0bcfb2927b48b4f5 | <|skeleton|>
class PhdthesisReference:
"""content type to make reference to a PhD thesis."""
def Source(self):
"""the default source renderer"""
<|body_0|>
def getCoinsDict(self):
"""Select which values to display in the COinS tag for this item"""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PhdthesisReference:
"""content type to make reference to a PhD thesis."""
def Source(self):
"""the default source renderer"""
try:
return self.PhdthesisSource()
except AttributeError:
publication_type = self.getPublication_type()
school = self.g... | the_stack_v2_python_sparse | Products/CMFBibliographyAT/content/phdthesis.py | collective/Products.CMFBibliographyAT | train | 1 |
18d9407899c3a13db0b2936d10926bef712404e3 | [
"self.typology = 'ComplexFault'\nself.id = identifier\nself.name = name\nself.trt = trt\nself.geometry = geometry\nself.fault_edges = None\nself.mag_scale_rel = mag_scale_rel\nself.rupt_aspect_ratio = rupt_aspect_ratio\nself.mfd = mfd\nself.rake = rake\nself.upper_depth = None\nself.lower_depth = None\nself.catalog... | <|body_start_0|>
self.typology = 'ComplexFault'
self.id = identifier
self.name = name
self.trt = trt
self.geometry = geometry
self.fault_edges = None
self.mag_scale_rel = mag_scale_rel
self.rupt_aspect_ratio = rupt_aspect_ratio
self.mfd = mfd
... | New class to describe the mtk complex fault source object :param str identifier: ID code for the source :param str name: Source name :param str trt: Tectonic region type :param geometry: Instance of :class: nhlib.geo.surface.complex_fault.ComplexFaultSource :param str mag_scale_rel: Magnitude scaling relationsip :param... | mtkComplexFaultSource | [
"AGPL-3.0-only",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class mtkComplexFaultSource:
"""New class to describe the mtk complex fault source object :param str identifier: ID code for the source :param str name: Source name :param str trt: Tectonic region type :param geometry: Instance of :class: nhlib.geo.surface.complex_fault.ComplexFaultSource :param str ma... | stack_v2_sparse_classes_75kplus_train_071111 | 9,358 | permissive | [
{
"docstring": "Instantiate class with just the basic attributes: identifier and name",
"name": "__init__",
"signature": "def __init__(self, identifier, name, trt=None, geometry=None, mag_scale_rel=None, rupt_aspect_ratio=None, mfd=None, rake=None)"
},
{
"docstring": "If geometry is defined as a... | 5 | stack_v2_sparse_classes_30k_train_007869 | Implement the Python class `mtkComplexFaultSource` described below.
Class description:
New class to describe the mtk complex fault source object :param str identifier: ID code for the source :param str name: Source name :param str trt: Tectonic region type :param geometry: Instance of :class: nhlib.geo.surface.complex... | Implement the Python class `mtkComplexFaultSource` described below.
Class description:
New class to describe the mtk complex fault source object :param str identifier: ID code for the source :param str name: Source name :param str trt: Tectonic region type :param geometry: Instance of :class: nhlib.geo.surface.complex... | 0da9ba5a575360081715e8b90c71d4b16c6687c8 | <|skeleton|>
class mtkComplexFaultSource:
"""New class to describe the mtk complex fault source object :param str identifier: ID code for the source :param str name: Source name :param str trt: Tectonic region type :param geometry: Instance of :class: nhlib.geo.surface.complex_fault.ComplexFaultSource :param str ma... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class mtkComplexFaultSource:
"""New class to describe the mtk complex fault source object :param str identifier: ID code for the source :param str name: Source name :param str trt: Tectonic region type :param geometry: Instance of :class: nhlib.geo.surface.complex_fault.ComplexFaultSource :param str mag_scale_rel: ... | the_stack_v2_python_sparse | openquake/hmtk/sources/complex_fault_source.py | GFZ-Centre-for-Early-Warning/shakyground | train | 1 |
e471fee79dcd4ba6b8e8808f83326ddb69ece937 | [
"super(Embedding, self).__init__()\nself.emb_diag = nn.Embedding(vocab_size, emb_dim, padding_idx=0)\nself.emb_pos = nn.Embedding(max_visits, emb_dim)",
"pos = torch.arange(x.shape[-1], device=device)\npos = pos.repeat(x.shape[0], 1)\npos_emb = self.emb_pos(pos)\nemb = self.emb_diag(x)\nemb = emb.sum(axis=1)\nemb... | <|body_start_0|>
super(Embedding, self).__init__()
self.emb_diag = nn.Embedding(vocab_size, emb_dim, padding_idx=0)
self.emb_pos = nn.Embedding(max_visits, emb_dim)
<|end_body_0|>
<|body_start_1|>
pos = torch.arange(x.shape[-1], device=device)
pos = pos.repeat(x.shape[0], 1)
... | Embedding | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Embedding:
def __init__(self, vocab_size, max_visits, emb_dim):
"""vocab_size (int): Number of unique diagnoses max_visits (int): Maximum number of visits emb_dim (int): Embedding dimension"""
<|body_0|>
def forward(self, x):
"""Args: x = inputs shape (batch_size, ma... | stack_v2_sparse_classes_75kplus_train_071112 | 10,826 | no_license | [
{
"docstring": "vocab_size (int): Number of unique diagnoses max_visits (int): Maximum number of visits emb_dim (int): Embedding dimension",
"name": "__init__",
"signature": "def __init__(self, vocab_size, max_visits, emb_dim)"
},
{
"docstring": "Args: x = inputs shape (batch_size, max_diag, max... | 2 | stack_v2_sparse_classes_30k_train_021409 | Implement the Python class `Embedding` described below.
Class description:
Implement the Embedding class.
Method signatures and docstrings:
- def __init__(self, vocab_size, max_visits, emb_dim): vocab_size (int): Number of unique diagnoses max_visits (int): Maximum number of visits emb_dim (int): Embedding dimension
... | Implement the Python class `Embedding` described below.
Class description:
Implement the Embedding class.
Method signatures and docstrings:
- def __init__(self, vocab_size, max_visits, emb_dim): vocab_size (int): Number of unique diagnoses max_visits (int): Maximum number of visits emb_dim (int): Embedding dimension
... | 3a4b05b4745917b60fadfe69911f1815180eee2c | <|skeleton|>
class Embedding:
def __init__(self, vocab_size, max_visits, emb_dim):
"""vocab_size (int): Number of unique diagnoses max_visits (int): Maximum number of visits emb_dim (int): Embedding dimension"""
<|body_0|>
def forward(self, x):
"""Args: x = inputs shape (batch_size, ma... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Embedding:
def __init__(self, vocab_size, max_visits, emb_dim):
"""vocab_size (int): Number of unique diagnoses max_visits (int): Maximum number of visits emb_dim (int): Embedding dimension"""
super(Embedding, self).__init__()
self.emb_diag = nn.Embedding(vocab_size, emb_dim, padding_i... | the_stack_v2_python_sparse | master/Transformer/model.py | dsgelab/MHR_Prediction | train | 0 | |
9d6374e4c488a32e028140e07d915b8a69011dd8 | [
"if name in ('width', 'height') and name not in self.varNames():\n if hasOpenImageIO:\n imageInput = OpenImageIO.ImageInput.open(self.supportedString(self.pathHolder().path()))\n if imageInput is None:\n raise OiioCrawlerReadFileError(\"Can't read information from file:\\n{}\".format(sel... | <|body_start_0|>
if name in ('width', 'height') and name not in self.varNames():
if hasOpenImageIO:
imageInput = OpenImageIO.ImageInput.open(self.supportedString(self.pathHolder().path()))
if imageInput is None:
raise OiioCrawlerReadFileError("Can'... | Open image io crawler. | OiioCrawler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OiioCrawler:
"""Open image io crawler."""
def var(self, name):
"""Return var value using lazy loading implementation for width and height."""
<|body_0|>
def supportedString(cls, text):
"""Return a string supported type in OIIO."""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_75kplus_train_071113 | 1,884 | permissive | [
{
"docstring": "Return var value using lazy loading implementation for width and height.",
"name": "var",
"signature": "def var(self, name)"
},
{
"docstring": "Return a string supported type in OIIO.",
"name": "supportedString",
"signature": "def supportedString(cls, text)"
}
] | 2 | stack_v2_sparse_classes_30k_train_012972 | Implement the Python class `OiioCrawler` described below.
Class description:
Open image io crawler.
Method signatures and docstrings:
- def var(self, name): Return var value using lazy loading implementation for width and height.
- def supportedString(cls, text): Return a string supported type in OIIO. | Implement the Python class `OiioCrawler` described below.
Class description:
Open image io crawler.
Method signatures and docstrings:
- def var(self, name): Return var value using lazy loading implementation for width and height.
- def supportedString(cls, text): Return a string supported type in OIIO.
<|skeleton|>
... | 046dbb0c1b4ff20ea5f2e1679f8d89f3089b6aa4 | <|skeleton|>
class OiioCrawler:
"""Open image io crawler."""
def var(self, name):
"""Return var value using lazy loading implementation for width and height."""
<|body_0|>
def supportedString(cls, text):
"""Return a string supported type in OIIO."""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OiioCrawler:
"""Open image io crawler."""
def var(self, name):
"""Return var value using lazy loading implementation for width and height."""
if name in ('width', 'height') and name not in self.varNames():
if hasOpenImageIO:
imageInput = OpenImageIO.ImageInput.... | the_stack_v2_python_sparse | src/lib/kombi/Crawler/Fs/Image/OiioCrawler.py | kombiHQ/kombi | train | 2 |
0b3484f7d2692e39751cb995b88ee51339c4cb4d | [
"if opt is None:\n opt = {}\nadmm.ADMMTwoBlockCnstrnt.Options.__init__(self, opt)",
"admm.ADMMTwoBlockCnstrnt.Options.__setitem__(self, key, value)\nif key == 'AuxVarObj':\n if value is True:\n self['fEvalX'] = False\n self['gEvalY'] = True\n else:\n self['fEvalX'] = True\n se... | <|body_start_0|>
if opt is None:
opt = {}
admm.ADMMTwoBlockCnstrnt.Options.__init__(self, opt)
<|end_body_0|>
<|body_start_1|>
admm.ADMMTwoBlockCnstrnt.Options.__setitem__(self, key, value)
if key == 'AuxVarObj':
if value is True:
self['fEvalX'] =... | ConvCnstrMODMaskDcplBase algorithm options Options include all of those defined in :class:`.ADMMTwoBlockCnstrnt.Options`, together with additional options: ``LinSolveCheck`` : Flag indicating whether to compute relative residual of X step solver. ``ZeroMean`` : Flag indicating whether the solution dictionary :math:`\\{... | Options | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Options:
"""ConvCnstrMODMaskDcplBase algorithm options Options include all of those defined in :class:`.ADMMTwoBlockCnstrnt.Options`, together with additional options: ``LinSolveCheck`` : Flag indicating whether to compute relative residual of X step solver. ``ZeroMean`` : Flag indicating whether... | stack_v2_sparse_classes_75kplus_train_071114 | 39,880 | permissive | [
{
"docstring": "Parameters ---------- opt : dict or None, optional (default None) ConvCnstrMODMaskDcpl algorithm options",
"name": "__init__",
"signature": "def __init__(self, opt=None)"
},
{
"docstring": "Set options 'fEvalX' and 'gEvalY' appropriately when option 'AuxVarObj' is set.",
"nam... | 2 | stack_v2_sparse_classes_30k_train_052219 | Implement the Python class `Options` described below.
Class description:
ConvCnstrMODMaskDcplBase algorithm options Options include all of those defined in :class:`.ADMMTwoBlockCnstrnt.Options`, together with additional options: ``LinSolveCheck`` : Flag indicating whether to compute relative residual of X step solver.... | Implement the Python class `Options` described below.
Class description:
ConvCnstrMODMaskDcplBase algorithm options Options include all of those defined in :class:`.ADMMTwoBlockCnstrnt.Options`, together with additional options: ``LinSolveCheck`` : Flag indicating whether to compute relative residual of X step solver.... | 5a64fbe456f3a117275c45ee1f10c60d6e133915 | <|skeleton|>
class Options:
"""ConvCnstrMODMaskDcplBase algorithm options Options include all of those defined in :class:`.ADMMTwoBlockCnstrnt.Options`, together with additional options: ``LinSolveCheck`` : Flag indicating whether to compute relative residual of X step solver. ``ZeroMean`` : Flag indicating whether... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Options:
"""ConvCnstrMODMaskDcplBase algorithm options Options include all of those defined in :class:`.ADMMTwoBlockCnstrnt.Options`, together with additional options: ``LinSolveCheck`` : Flag indicating whether to compute relative residual of X step solver. ``ZeroMean`` : Flag indicating whether the solution... | the_stack_v2_python_sparse | benchmarks/other/sporco/admm/ccmodmd.py | tomMoral/dicodile | train | 17 |
b2d143fcc8c5d2533c94911200d0c7f2453bc7ff | [
"self.name = name\nself.ra = ra\nself.dec = dec\nself.months = dates.split()",
"sep = angular_separation(self.ra * u.deg, self.dec * u.deg, ra * u.deg, dec * u.deg)\ninfield = sep < sepcut * u.deg\nreturn infield",
"month = None\nif isinstance(obstime, (int, float, np.floating)):\n month = Time(obstime, form... | <|body_start_0|>
self.name = name
self.ra = ra
self.dec = dec
self.months = dates.split()
<|end_body_0|>
<|body_start_1|>
sep = angular_separation(self.ra * u.deg, self.dec * u.deg, ra * u.deg, dec * u.deg)
infield = sep < sepcut * u.deg
return infield
<|end_body... | A simple class that stores the name, location, and observing dates of DESI calibration fields. See https://desi.lbl.gov/trac/wiki/SurveyOps/CalibrationFields. | DESICalibField | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DESICalibField:
"""A simple class that stores the name, location, and observing dates of DESI calibration fields. See https://desi.lbl.gov/trac/wiki/SurveyOps/CalibrationFields."""
def __init__(self, name, ra, dec, dates):
"""Initialize a calibration field. Parameters ---------- name... | stack_v2_sparse_classes_75kplus_train_071115 | 17,828 | permissive | [
{
"docstring": "Initialize a calibration field. Parameters ---------- name : str Name of the field. ra : float Field central RA. dec : float Field central declination. dates : str Months when the field is observed.",
"name": "__init__",
"signature": "def __init__(self, name, ra, dec, dates)"
},
{
... | 3 | stack_v2_sparse_classes_30k_train_006253 | Implement the Python class `DESICalibField` described below.
Class description:
A simple class that stores the name, location, and observing dates of DESI calibration fields. See https://desi.lbl.gov/trac/wiki/SurveyOps/CalibrationFields.
Method signatures and docstrings:
- def __init__(self, name, ra, dec, dates): I... | Implement the Python class `DESICalibField` described below.
Class description:
A simple class that stores the name, location, and observing dates of DESI calibration fields. See https://desi.lbl.gov/trac/wiki/SurveyOps/CalibrationFields.
Method signatures and docstrings:
- def __init__(self, name, ra, dec, dates): I... | 573054ffef43e20a742898723cdf140151531cbc | <|skeleton|>
class DESICalibField:
"""A simple class that stores the name, location, and observing dates of DESI calibration fields. See https://desi.lbl.gov/trac/wiki/SurveyOps/CalibrationFields."""
def __init__(self, name, ra, dec, dates):
"""Initialize a calibration field. Parameters ---------- name... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DESICalibField:
"""A simple class that stores the name, location, and observing dates of DESI calibration fields. See https://desi.lbl.gov/trac/wiki/SurveyOps/CalibrationFields."""
def __init__(self, name, ra, dec, dates):
"""Initialize a calibration field. Parameters ---------- name : str Name o... | the_stack_v2_python_sparse | too_ledgers/tooledger.py | desihub/timedomain | train | 5 |
545b23f62518fc5bc4ce459f43d1c278c5ddeb46 | [
"if config and 'connection' not in config:\n raise KeyManagerException('connection information is not provided.')\nif config and 'authority' not in config:\n raise KeyManagerException('authority information is not provided.')\nconnection_cls_ref = get_class_by_name(config['connection']['path'], config['connec... | <|body_start_0|>
if config and 'connection' not in config:
raise KeyManagerException('connection information is not provided.')
if config and 'authority' not in config:
raise KeyManagerException('authority information is not provided.')
connection_cls_ref = get_class_by_n... | AuthorityKeyManager | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AuthorityKeyManager:
def __init__(self, config):
"""Initialize a authority key manager that can request the key from an online authority key server"""
<|body_0|>
def initialize_keys(self, config):
"""Initialize needed keys for the crypto system according its roles.""... | stack_v2_sparse_classes_75kplus_train_071116 | 3,516 | permissive | [
{
"docstring": "Initialize a authority key manager that can request the key from an online authority key server",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Initialize needed keys for the crypto system according its roles.",
"name": "initialize_keys",
... | 3 | stack_v2_sparse_classes_30k_train_032895 | Implement the Python class `AuthorityKeyManager` described below.
Class description:
Implement the AuthorityKeyManager class.
Method signatures and docstrings:
- def __init__(self, config): Initialize a authority key manager that can request the key from an online authority key server
- def initialize_keys(self, conf... | Implement the Python class `AuthorityKeyManager` described below.
Class description:
Implement the AuthorityKeyManager class.
Method signatures and docstrings:
- def __init__(self, config): Initialize a authority key manager that can request the key from an online authority key server
- def initialize_keys(self, conf... | 64ffa2ee2e906b1bd6b3dd6aabcf6fc3de862608 | <|skeleton|>
class AuthorityKeyManager:
def __init__(self, config):
"""Initialize a authority key manager that can request the key from an online authority key server"""
<|body_0|>
def initialize_keys(self, config):
"""Initialize needed keys for the crypto system according its roles.""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AuthorityKeyManager:
def __init__(self, config):
"""Initialize a authority key manager that can request the key from an online authority key server"""
if config and 'connection' not in config:
raise KeyManagerException('connection information is not provided.')
if config an... | the_stack_v2_python_sparse | debugging-constructs/ibmfl/crypto/keys_mng/crypto_key_mng_auth.py | SEED-VT/FedDebug | train | 8 | |
5e0c41ac6ed1052513b543157fa96446b2942435 | [
"pickings = self.mapped('picking_ids').filtered(lambda picking: picking.state not in ('cancel', 'done'))\nfor picking in pickings:\n try:\n picking.button_validate()\n except Exception as e:\n raise UserError(_('Issue While validate the picking : %s, %s' % (picking.name, e)))\nreturn super(Stock... | <|body_start_0|>
pickings = self.mapped('picking_ids').filtered(lambda picking: picking.state not in ('cancel', 'done'))
for picking in pickings:
try:
picking.button_validate()
except Exception as e:
raise UserError(_('Issue While validate the pick... | StockPickingBatchEpt | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StockPickingBatchEpt:
def done(self):
"""Checked the some condition like button validate. @param: none @return: If issue in picking than raise the warning other wise working good. @author: Emipro Technologies - Jigar v vagadiya on date 12 sep 2018."""
<|body_0|>
def send_to_... | stack_v2_sparse_classes_75kplus_train_071117 | 7,533 | no_license | [
{
"docstring": "Checked the some condition like button validate. @param: none @return: If issue in picking than raise the warning other wise working good. @author: Emipro Technologies - Jigar v vagadiya on date 12 sep 2018.",
"name": "done",
"signature": "def done(self)"
},
{
"docstring": "Execu... | 4 | stack_v2_sparse_classes_30k_train_039326 | Implement the Python class `StockPickingBatchEpt` described below.
Class description:
Implement the StockPickingBatchEpt class.
Method signatures and docstrings:
- def done(self): Checked the some condition like button validate. @param: none @return: If issue in picking than raise the warning other wise working good.... | Implement the Python class `StockPickingBatchEpt` described below.
Class description:
Implement the StockPickingBatchEpt class.
Method signatures and docstrings:
- def done(self): Checked the some condition like button validate. @param: none @return: If issue in picking than raise the warning other wise working good.... | 148ab8c37d04c93d3d23c7d15ca808de4748d2f4 | <|skeleton|>
class StockPickingBatchEpt:
def done(self):
"""Checked the some condition like button validate. @param: none @return: If issue in picking than raise the warning other wise working good. @author: Emipro Technologies - Jigar v vagadiya on date 12 sep 2018."""
<|body_0|>
def send_to_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StockPickingBatchEpt:
def done(self):
"""Checked the some condition like button validate. @param: none @return: If issue in picking than raise the warning other wise working good. @author: Emipro Technologies - Jigar v vagadiya on date 12 sep 2018."""
pickings = self.mapped('picking_ids').filt... | the_stack_v2_python_sparse | odoo_apps/shipping_integration_ept/models/batch_picking_ept.py | jchancafe/demo12 | train | 0 | |
d561227f6c4815a969cfb06e11488ed2355b7e91 | [
"if not triangle:\n return\nres = [[0 for i in xrange(len(row))] for row in triangle]\nres[0][0] = triangle[0][0]\nfor i in xrange(1, len(triangle)):\n for j in xrange(len(triangle[i])):\n if j == 0:\n res[i][j] = res[i - 1][j] + triangle[i][j]\n elif j == len(triangle[i]) - 1:\n ... | <|body_start_0|>
if not triangle:
return
res = [[0 for i in xrange(len(row))] for row in triangle]
res[0][0] = triangle[0][0]
for i in xrange(1, len(triangle)):
for j in xrange(len(triangle[i])):
if j == 0:
res[i][j] = res[i - 1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int O(n*n/2) space, top-down beats 39.32%"""
<|body_0|>
def minimumTotal2(self, triangle):
""":param triangle: :return: Modify the original triangle, top-down"""
<|body_1|>... | stack_v2_sparse_classes_75kplus_train_071118 | 2,212 | no_license | [
{
"docstring": ":type triangle: List[List[int]] :rtype: int O(n*n/2) space, top-down beats 39.32%",
"name": "minimumTotal",
"signature": "def minimumTotal(self, triangle)"
},
{
"docstring": ":param triangle: :return: Modify the original triangle, top-down",
"name": "minimumTotal2",
"sign... | 4 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int O(n*n/2) space, top-down beats 39.32%
- def minimumTotal2(self, triangle): :param triangle: :return:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumTotal(self, triangle): :type triangle: List[List[int]] :rtype: int O(n*n/2) space, top-down beats 39.32%
- def minimumTotal2(self, triangle): :param triangle: :return:... | 7e0e917c15d3e35f49da3a00ef395bd5ff180d79 | <|skeleton|>
class Solution:
def minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int O(n*n/2) space, top-down beats 39.32%"""
<|body_0|>
def minimumTotal2(self, triangle):
""":param triangle: :return: Modify the original triangle, top-down"""
<|body_1|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def minimumTotal(self, triangle):
""":type triangle: List[List[int]] :rtype: int O(n*n/2) space, top-down beats 39.32%"""
if not triangle:
return
res = [[0 for i in xrange(len(row))] for row in triangle]
res[0][0] = triangle[0][0]
for i in xrange(1... | the_stack_v2_python_sparse | LeetCode/120_triangle.py | yao23/Machine_Learning_Playground | train | 12 | |
3d42ae1d7b1a40169a678266618765597ee58c4b | [
"email = self.cleaned_data.get('email')\nif User.objects.filter(email=email).exists():\n raise forms.ValidationError('Email already exists')\nreturn email",
"username = self.cleaned_data.get('username')\nif User.objects.filter(username=username).exists():\n raise forms.ValidationError('username already exis... | <|body_start_0|>
email = self.cleaned_data.get('email')
if User.objects.filter(email=email).exists():
raise forms.ValidationError('Email already exists')
return email
<|end_body_0|>
<|body_start_1|>
username = self.cleaned_data.get('username')
if User.objects.filter(... | ProfileForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProfileForm:
def clean_email(self):
"""check if email already exists :return: email if it's not exists else raise ValidationError"""
<|body_0|>
def clean_username(self):
"""check if username already exists :return: username if it's not exists else raise ValidationErr... | stack_v2_sparse_classes_75kplus_train_071119 | 1,614 | no_license | [
{
"docstring": "check if email already exists :return: email if it's not exists else raise ValidationError",
"name": "clean_email",
"signature": "def clean_email(self)"
},
{
"docstring": "check if username already exists :return: username if it's not exists else raise ValidationError",
"name... | 2 | null | Implement the Python class `ProfileForm` described below.
Class description:
Implement the ProfileForm class.
Method signatures and docstrings:
- def clean_email(self): check if email already exists :return: email if it's not exists else raise ValidationError
- def clean_username(self): check if username already exis... | Implement the Python class `ProfileForm` described below.
Class description:
Implement the ProfileForm class.
Method signatures and docstrings:
- def clean_email(self): check if email already exists :return: email if it's not exists else raise ValidationError
- def clean_username(self): check if username already exis... | de5e9e9887dee857e6169184aa9c7b74f31d32c4 | <|skeleton|>
class ProfileForm:
def clean_email(self):
"""check if email already exists :return: email if it's not exists else raise ValidationError"""
<|body_0|>
def clean_username(self):
"""check if username already exists :return: username if it's not exists else raise ValidationErr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProfileForm:
def clean_email(self):
"""check if email already exists :return: email if it's not exists else raise ValidationError"""
email = self.cleaned_data.get('email')
if User.objects.filter(email=email).exists():
raise forms.ValidationError('Email already exists')
... | the_stack_v2_python_sparse | todo/forms/profile.py | AmrAnwar/ToDoList | train | 0 | |
07c03aae5c784e83f498f40ccf1f8ba7b5cb266e | [
"n = len(citations)\ncount = [0] * (n + 1)\nfor i in citations:\n if i > n:\n count[n] += 1\n else:\n count[i] += 1\nsum = 0\ni = n\nwhile i >= 0:\n sum += count[i]\n if sum >= i:\n return i\n i -= 1\nreturn 0",
"if len(citations) == 0:\n return 0\nsorted_cit = sorted(citati... | <|body_start_0|>
n = len(citations)
count = [0] * (n + 1)
for i in citations:
if i > n:
count[n] += 1
else:
count[i] += 1
sum = 0
i = n
while i >= 0:
sum += count[i]
if sum >= i:
... | solution | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""solution"""
def hIndex(self, citations):
"""O(n) time and O(n) space solution :type citations: List[int] :rtype: int"""
<|body_0|>
def hIndex2(self, citations):
"""O(n lg n) solution for h-index :type citations: List[int] :rtype: int"""
<|bod... | stack_v2_sparse_classes_75kplus_train_071120 | 1,682 | no_license | [
{
"docstring": "O(n) time and O(n) space solution :type citations: List[int] :rtype: int",
"name": "hIndex",
"signature": "def hIndex(self, citations)"
},
{
"docstring": "O(n lg n) solution for h-index :type citations: List[int] :rtype: int",
"name": "hIndex2",
"signature": "def hIndex2(... | 2 | null | Implement the Python class `Solution` described below.
Class description:
solution
Method signatures and docstrings:
- def hIndex(self, citations): O(n) time and O(n) space solution :type citations: List[int] :rtype: int
- def hIndex2(self, citations): O(n lg n) solution for h-index :type citations: List[int] :rtype:... | Implement the Python class `Solution` described below.
Class description:
solution
Method signatures and docstrings:
- def hIndex(self, citations): O(n) time and O(n) space solution :type citations: List[int] :rtype: int
- def hIndex2(self, citations): O(n lg n) solution for h-index :type citations: List[int] :rtype:... | e319481834d0d0519d50bbf00e4f46374bbcf091 | <|skeleton|>
class Solution:
"""solution"""
def hIndex(self, citations):
"""O(n) time and O(n) space solution :type citations: List[int] :rtype: int"""
<|body_0|>
def hIndex2(self, citations):
"""O(n lg n) solution for h-index :type citations: List[int] :rtype: int"""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""solution"""
def hIndex(self, citations):
"""O(n) time and O(n) space solution :type citations: List[int] :rtype: int"""
n = len(citations)
count = [0] * (n + 1)
for i in citations:
if i > n:
count[n] += 1
else:
... | the_stack_v2_python_sparse | h-index274.py | raghavgr/Leetcode | train | 1 |
ce22e95cc1a2b289fc8a84fc830d0463502030b7 | [
"queryset = super(PostAdmin, self).get_queryset(request)\nif request.user.is_superuser:\n return queryset\nreturn queryset.filter(author_id=request.user.id)",
"if not obj.author:\n obj.author = request.user\nobj.save()"
] | <|body_start_0|>
queryset = super(PostAdmin, self).get_queryset(request)
if request.user.is_superuser:
return queryset
return queryset.filter(author_id=request.user.id)
<|end_body_0|>
<|body_start_1|>
if not obj.author:
obj.author = request.user
obj.save(... | PostAdmin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PostAdmin:
def get_queryset(self, request):
"""Show only posts created by user"""
<|body_0|>
def save_model(self, request, obj, form, change):
"""Save the user that create the post as author"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
queryset =... | stack_v2_sparse_classes_75kplus_train_071121 | 3,367 | no_license | [
{
"docstring": "Show only posts created by user",
"name": "get_queryset",
"signature": "def get_queryset(self, request)"
},
{
"docstring": "Save the user that create the post as author",
"name": "save_model",
"signature": "def save_model(self, request, obj, form, change)"
}
] | 2 | null | Implement the Python class `PostAdmin` described below.
Class description:
Implement the PostAdmin class.
Method signatures and docstrings:
- def get_queryset(self, request): Show only posts created by user
- def save_model(self, request, obj, form, change): Save the user that create the post as author | Implement the Python class `PostAdmin` described below.
Class description:
Implement the PostAdmin class.
Method signatures and docstrings:
- def get_queryset(self, request): Show only posts created by user
- def save_model(self, request, obj, form, change): Save the user that create the post as author
<|skeleton|>
... | 3df3984339780f0974aa3da34f955486dd785c88 | <|skeleton|>
class PostAdmin:
def get_queryset(self, request):
"""Show only posts created by user"""
<|body_0|>
def save_model(self, request, obj, form, change):
"""Save the user that create the post as author"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PostAdmin:
def get_queryset(self, request):
"""Show only posts created by user"""
queryset = super(PostAdmin, self).get_queryset(request)
if request.user.is_superuser:
return queryset
return queryset.filter(author_id=request.user.id)
def save_model(self, reques... | the_stack_v2_python_sparse | healthylife/blog/admin.py | AlbertoSanmartinMartinez/HealthyLife | train | 0 | |
36bda5d5fc290a7b62a1eb5ac80651ca5b5e2988 | [
"section = 'trajmods'\nself.con['DampCent'] = self.config.getfloat(section, 'DampCent')\nself.con['DampSlop'] = self.config.getfloat(section, 'DampSlop')\ntargHeigStr = self.config.get(section, 'TargHeig')\ntargHeigStr = targHeigStr.split(', ')\ntargHeig = list()\nfor nStr in targHeigStr:\n targHeig.append(float... | <|body_start_0|>
section = 'trajmods'
self.con['DampCent'] = self.config.getfloat(section, 'DampCent')
self.con['DampSlop'] = self.config.getfloat(section, 'DampSlop')
targHeigStr = self.config.get(section, 'TargHeig')
targHeigStr = targHeigStr.split(', ')
targHeig = list... | problemConfigurationSGRA | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class problemConfigurationSGRA:
def trajmods(self):
"""Trajectory modification parameters. This should not interfere with the itsme functioning at all."""
<|body_0|>
def accel(self):
"""Acceleration limitation parameters. This should not interfere with the itsme functionin... | stack_v2_sparse_classes_75kplus_train_071122 | 7,957 | no_license | [
{
"docstring": "Trajectory modification parameters. This should not interfere with the itsme functioning at all.",
"name": "trajmods",
"signature": "def trajmods(self)"
},
{
"docstring": "Acceleration limitation parameters. This should not interfere with the itsme functioning at all.",
"name... | 3 | stack_v2_sparse_classes_30k_train_017625 | Implement the Python class `problemConfigurationSGRA` described below.
Class description:
Implement the problemConfigurationSGRA class.
Method signatures and docstrings:
- def trajmods(self): Trajectory modification parameters. This should not interfere with the itsme functioning at all.
- def accel(self): Accelerati... | Implement the Python class `problemConfigurationSGRA` described below.
Class description:
Implement the problemConfigurationSGRA class.
Method signatures and docstrings:
- def trajmods(self): Trajectory modification parameters. This should not interfere with the itsme functioning at all.
- def accel(self): Accelerati... | 5556459e13177fac4f0f64eb629ae233f64a17a7 | <|skeleton|>
class problemConfigurationSGRA:
def trajmods(self):
"""Trajectory modification parameters. This should not interfere with the itsme functioning at all."""
<|body_0|>
def accel(self):
"""Acceleration limitation parameters. This should not interfere with the itsme functionin... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class problemConfigurationSGRA:
def trajmods(self):
"""Trajectory modification parameters. This should not interfere with the itsme functioning at all."""
section = 'trajmods'
self.con['DampCent'] = self.config.getfloat(section, 'DampCent')
self.con['DampSlop'] = self.config.getfloat... | the_stack_v2_python_sparse | itsme.py | ronaldochaves/SOAR | train | 0 | |
3440f7b19ec70b46e3d55aa887899c97ed624ccd | [
"super(Encoder, self).__init__()\nself.N = N\nself.dm = dm\nself.embedding = tf.keras.layers.Embedding(input_vocab, dm)\nself.positional_encoding = positional_encoding(max_seq_len, dm)\nself.blocks = []\nfor n in range(N):\n self.blocks.append(EncoderBlock(dm, h, hidden, drop_rate))\nself.dropout = tf.keras.laye... | <|body_start_0|>
super(Encoder, self).__init__()
self.N = N
self.dm = dm
self.embedding = tf.keras.layers.Embedding(input_vocab, dm)
self.positional_encoding = positional_encoding(max_seq_len, dm)
self.blocks = []
for n in range(N):
self.blocks.append(... | Class representation of an encoder for a transformer | Encoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Encoder:
"""Class representation of an encoder for a transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""N: Number of blocks in the encoder dm: Dimensionality of the model h: Number of heads hidden: Number of hidden units in the fully conn... | stack_v2_sparse_classes_75kplus_train_071123 | 2,030 | no_license | [
{
"docstring": "N: Number of blocks in the encoder dm: Dimensionality of the model h: Number of heads hidden: Number of hidden units in the fully connected layer input_vocab: Size of the input vocabulary max_seq_len: Maximum sequence length possible drop_rate: Dropout rate",
"name": "__init__",
"signatu... | 2 | null | Implement the Python class `Encoder` described below.
Class description:
Class representation of an encoder for a transformer
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): N: Number of blocks in the encoder dm: Dimensionality of the model h: Number ... | Implement the Python class `Encoder` described below.
Class description:
Class representation of an encoder for a transformer
Method signatures and docstrings:
- def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1): N: Number of blocks in the encoder dm: Dimensionality of the model h: Number ... | 2757c8526290197d45a4de33cda71e686ddcbf1c | <|skeleton|>
class Encoder:
"""Class representation of an encoder for a transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""N: Number of blocks in the encoder dm: Dimensionality of the model h: Number of heads hidden: Number of hidden units in the fully conn... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Encoder:
"""Class representation of an encoder for a transformer"""
def __init__(self, N, dm, h, hidden, input_vocab, max_seq_len, drop_rate=0.1):
"""N: Number of blocks in the encoder dm: Dimensionality of the model h: Number of heads hidden: Number of hidden units in the fully connected layer i... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/9-transformer_encoder.py | 95ktsmith/holbertonschool-machine_learning | train | 0 |
bded608e54c36767807bf51478e67e0133bfe5bd | [
"question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nmy_survey.store_reponse('English')\nself.assertIn('English', my_survey.responses)",
"question = 'What language did you first learn to speak?'\nmy_survey = AnonymousSurvey(question)\nresponses = ['English', 'Hindi', '... | <|body_start_0|>
question = 'What language did you first learn to speak?'
my_survey = AnonymousSurvey(question)
my_survey.store_reponse('English')
self.assertIn('English', my_survey.responses)
<|end_body_0|>
<|body_start_1|>
question = 'What language did you first learn to speak... | Test for the class AnonymousSurvey | TestAnonymousSurvey | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAnonymousSurvey:
"""Test for the class AnonymousSurvey"""
def test_store_single_response(self):
"""test that a single response is stored properly"""
<|body_0|>
def test_store_three_response(self):
"""test that a three response is stored properly"""
<|... | stack_v2_sparse_classes_75kplus_train_071124 | 927 | no_license | [
{
"docstring": "test that a single response is stored properly",
"name": "test_store_single_response",
"signature": "def test_store_single_response(self)"
},
{
"docstring": "test that a three response is stored properly",
"name": "test_store_three_response",
"signature": "def test_store_... | 2 | stack_v2_sparse_classes_30k_val_000485 | Implement the Python class `TestAnonymousSurvey` described below.
Class description:
Test for the class AnonymousSurvey
Method signatures and docstrings:
- def test_store_single_response(self): test that a single response is stored properly
- def test_store_three_response(self): test that a three response is stored p... | Implement the Python class `TestAnonymousSurvey` described below.
Class description:
Test for the class AnonymousSurvey
Method signatures and docstrings:
- def test_store_single_response(self): test that a single response is stored properly
- def test_store_three_response(self): test that a three response is stored p... | e85198ab8b95abbe43e9c9bde44661525bca8977 | <|skeleton|>
class TestAnonymousSurvey:
"""Test for the class AnonymousSurvey"""
def test_store_single_response(self):
"""test that a single response is stored properly"""
<|body_0|>
def test_store_three_response(self):
"""test that a three response is stored properly"""
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestAnonymousSurvey:
"""Test for the class AnonymousSurvey"""
def test_store_single_response(self):
"""test that a single response is stored properly"""
question = 'What language did you first learn to speak?'
my_survey = AnonymousSurvey(question)
my_survey.store_reponse('... | the_stack_v2_python_sparse | 11_testing_your_code/6_testing_anonymous_class.py | pratikv06/Python-Crash-Course | train | 2 |
39d0bcfcfe3e8c679bc15693bffff2f44a69bc8c | [
"self.dim = n_cells * time_window\na_tf = tf.Variable(np.array(np.random.rand(), dtype=np.float32))\nself.A_symm = a_tf * tf.eye(self.dim)\nself.anchor = tf.placeholder(dtype=tf.float32, shape=[None, n_cells, time_window], name='anchor')\nself.pos = tf.placeholder(dtype=tf.float32, shape=[None, n_cells, time_window... | <|body_start_0|>
self.dim = n_cells * time_window
a_tf = tf.Variable(np.array(np.random.rand(), dtype=np.float32))
self.A_symm = a_tf * tf.eye(self.dim)
self.anchor = tf.placeholder(dtype=tf.float32, shape=[None, n_cells, time_window], name='anchor')
self.pos = tf.placeholder(dty... | Score of form x'Ax, with A constrained to be scaled Identity. | QuadraticScorePSDscaledI | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QuadraticScorePSDscaledI:
"""Score of form x'Ax, with A constrained to be scaled Identity."""
def _build_graph(self, n_cells, time_window, lr, lam_l1):
"""Build tensorflow graph. Args : n_cells : number of cells (int) time_window : number of time bins in each response vector (int) lr... | stack_v2_sparse_classes_75kplus_train_071125 | 3,541 | permissive | [
{
"docstring": "Build tensorflow graph. Args : n_cells : number of cells (int) time_window : number of time bins in each response vector (int) lr : learning rate (float) lam_l1 : regularization on entires of A (float)",
"name": "_build_graph",
"signature": "def _build_graph(self, n_cells, time_window, l... | 2 | stack_v2_sparse_classes_30k_train_023148 | Implement the Python class `QuadraticScorePSDscaledI` described below.
Class description:
Score of form x'Ax, with A constrained to be scaled Identity.
Method signatures and docstrings:
- def _build_graph(self, n_cells, time_window, lr, lam_l1): Build tensorflow graph. Args : n_cells : number of cells (int) time_wind... | Implement the Python class `QuadraticScorePSDscaledI` described below.
Class description:
Score of form x'Ax, with A constrained to be scaled Identity.
Method signatures and docstrings:
- def _build_graph(self, n_cells, time_window, lr, lam_l1): Build tensorflow graph. Args : n_cells : number of cells (int) time_wind... | 0dea94bbd54f591d82d95169e33d40bb55b6be94 | <|skeleton|>
class QuadraticScorePSDscaledI:
"""Score of form x'Ax, with A constrained to be scaled Identity."""
def _build_graph(self, n_cells, time_window, lr, lam_l1):
"""Build tensorflow graph. Args : n_cells : number of cells (int) time_window : number of time bins in each response vector (int) lr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QuadraticScorePSDscaledI:
"""Score of form x'Ax, with A constrained to be scaled Identity."""
def _build_graph(self, n_cells, time_window, lr, lam_l1):
"""Build tensorflow graph. Args : n_cells : number of cells (int) time_window : number of time bins in each response vector (int) lr : learning r... | the_stack_v2_python_sparse | response_model/python/metric_learning/score_fcns/quadratic_score_psd_scaledI.py | googlearchive/rgc-models | train | 0 |
83ce00215af5995a1da6d017ab1e3acf7a8f23b1 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('ruipang_zhou482', 'ruipang_zhou482')\nurl = 'http://bostonopendata-boston.opendata.arcgis.com/datasets/0046426a3e4340a6b025ad52b41be70a_1.csv'\nresponse = urllib.request.urlopen(url)\ncr = csv.reader(io.... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('ruipang_zhou482', 'ruipang_zhou482')
url = 'http://bostonopendata-boston.opendata.arcgis.com/datasets/0046426a3e4340a6b025ad52b41be70a_1.csv'
resp... | PrivateSchool | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrivateSchool:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything... | stack_v2_sparse_classes_75kplus_train_071126 | 4,029 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | stack_v2_sparse_classes_30k_train_001276 | Implement the Python class `PrivateSchool` described below.
Class description:
Implement the PrivateSchool class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None, e... | Implement the Python class `PrivateSchool` described below.
Class description:
Implement the PrivateSchool class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None, e... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class PrivateSchool:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PrivateSchool:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('ruipang_zhou482', 'ruipang_zhou482')
... | the_stack_v2_python_sparse | ruipang_zhou482/PrivateSchool.py | maximega/course-2019-spr-proj | train | 2 | |
91502bed9454e217598a79a1c5cd6f6f05b3c047 | [
"super(_ConstantPadNd, self).__init__()\nif isinstance(padding, int):\n if name == 'ConstantPad1d':\n padding = (padding, padding)\n elif name in ['ConstantPad2d', 'ZeroPad2d']:\n padding = (padding, padding, padding, padding)\n elif name == 'ConstantPad3d':\n padding = (padding, paddi... | <|body_start_0|>
super(_ConstantPadNd, self).__init__()
if isinstance(padding, int):
if name == 'ConstantPad1d':
padding = (padding, padding)
elif name in ['ConstantPad2d', 'ZeroPad2d']:
padding = (padding, padding, padding, padding)
el... | Using a given value to pads the last n dimensions of input tensor. Args: padding (union[list, tuple]): The padding size to pad the last n dimensions of input tensor. The padding sequence is starting from the last dimension and moving forward. The length of padding must be a multiple of 2. If padding is :math:`(padding_... | _ConstantPadNd | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"MPL-1.0",
"OpenSSL",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause-Open-MPI",
"MIT",
"MPL-2.0-no-copyleft-exception",
"NTP",
"BSD-3-Clause",
"GPL-1.0-or-later",
"0BSD",
"MPL-2.0",
"LicenseRef-scancode-f... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _ConstantPadNd:
"""Using a given value to pads the last n dimensions of input tensor. Args: padding (union[list, tuple]): The padding size to pad the last n dimensions of input tensor. The padding sequence is starting from the last dimension and moving forward. The length of padding must be a mul... | stack_v2_sparse_classes_75kplus_train_071127 | 35,433 | permissive | [
{
"docstring": "Initialize Pad.",
"name": "__init__",
"signature": "def __init__(self, padding, value, name='ConstantPadNd')"
},
{
"docstring": "Construct the pad net.",
"name": "construct",
"signature": "def construct(self, x)"
}
] | 2 | null | Implement the Python class `_ConstantPadNd` described below.
Class description:
Using a given value to pads the last n dimensions of input tensor. Args: padding (union[list, tuple]): The padding size to pad the last n dimensions of input tensor. The padding sequence is starting from the last dimension and moving forwa... | Implement the Python class `_ConstantPadNd` described below.
Class description:
Using a given value to pads the last n dimensions of input tensor. Args: padding (union[list, tuple]): The padding size to pad the last n dimensions of input tensor. The padding sequence is starting from the last dimension and moving forwa... | 54acb15d435533c815ee1bd9f6dc0b56b4d4cf83 | <|skeleton|>
class _ConstantPadNd:
"""Using a given value to pads the last n dimensions of input tensor. Args: padding (union[list, tuple]): The padding size to pad the last n dimensions of input tensor. The padding sequence is starting from the last dimension and moving forward. The length of padding must be a mul... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _ConstantPadNd:
"""Using a given value to pads the last n dimensions of input tensor. Args: padding (union[list, tuple]): The padding size to pad the last n dimensions of input tensor. The padding sequence is starting from the last dimension and moving forward. The length of padding must be a multiple of 2. I... | the_stack_v2_python_sparse | mindspore/python/mindspore/nn/layer/padding.py | mindspore-ai/mindspore | train | 4,178 |
cb8ae59057fa2b46671dfd823ee732b4aafe4b16 | [
"for attribute_name, attribute_value in attributes_in_caller.iteritems():\n if isinstance(attribute_value, types.FunctionType):\n if attribute_name == '__init__' or attribute_name == 'status' or attribute_name == 'check_attribute_error':\n continue\n attributes_in_caller[attribute_name] ... | <|body_start_0|>
for attribute_name, attribute_value in attributes_in_caller.iteritems():
if isinstance(attribute_value, types.FunctionType):
if attribute_name == '__init__' or attribute_name == 'status' or attribute_name == 'check_attribute_error':
continue
... | DatabaseExceptionHandlerMeta | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DatabaseExceptionHandlerMeta:
def __new__(mcs, caller_name, caller_base_name, attributes_in_caller):
""":param caller_name: :type caller_name: Class type :param caller_base_name: :type caller_base_name: Any base class of caller_name :param attributes_in_caller: :type attributes_in_caller... | stack_v2_sparse_classes_75kplus_train_071128 | 4,105 | permissive | [
{
"docstring": ":param caller_name: :type caller_name: Class type :param caller_base_name: :type caller_base_name: Any base class of caller_name :param attributes_in_caller: :type attributes_in_caller: functions and parameters of class :return:",
"name": "__new__",
"signature": "def __new__(mcs, caller_... | 3 | stack_v2_sparse_classes_30k_train_019601 | Implement the Python class `DatabaseExceptionHandlerMeta` described below.
Class description:
Implement the DatabaseExceptionHandlerMeta class.
Method signatures and docstrings:
- def __new__(mcs, caller_name, caller_base_name, attributes_in_caller): :param caller_name: :type caller_name: Class type :param caller_bas... | Implement the Python class `DatabaseExceptionHandlerMeta` described below.
Class description:
Implement the DatabaseExceptionHandlerMeta class.
Method signatures and docstrings:
- def __new__(mcs, caller_name, caller_base_name, attributes_in_caller): :param caller_name: :type caller_name: Class type :param caller_bas... | 0b7727b4be2a560e59fa6de8dd4896c214f450be | <|skeleton|>
class DatabaseExceptionHandlerMeta:
def __new__(mcs, caller_name, caller_base_name, attributes_in_caller):
""":param caller_name: :type caller_name: Class type :param caller_base_name: :type caller_base_name: Any base class of caller_name :param attributes_in_caller: :type attributes_in_caller... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DatabaseExceptionHandlerMeta:
def __new__(mcs, caller_name, caller_base_name, attributes_in_caller):
""":param caller_name: :type caller_name: Class type :param caller_base_name: :type caller_base_name: Any base class of caller_name :param attributes_in_caller: :type attributes_in_caller: functions an... | the_stack_v2_python_sparse | src/controller/db_exception_handler.py | pratap-akhand/couchbase-plugin | train | 0 | |
a5ede93dd30265c32154896e8ac3a08ee7105073 | [
"if not root:\n return 0\nvalues = self.dfs(root)\nreturn max(values[0], values[1])",
"if not node:\n return (0, 0)\nleft = self.dfs(node.left)\nright = self.dfs(node.right)\nrob_node = left[1] + right[1] + node.val\nnot_rob = max(left[0], left[1]) + max(right[0], right[1])\nreturn (rob_node, not_rob)"
] | <|body_start_0|>
if not root:
return 0
values = self.dfs(root)
return max(values[0], values[1])
<|end_body_0|>
<|body_start_1|>
if not node:
return (0, 0)
left = self.dfs(node.left)
right = self.dfs(node.right)
rob_node = left[1] + right[1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def rob(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def dfs(self, node):
"""return val: tuple(int, int) val[0]: How many value do I earn while roobing the node val[1]: Not rob node"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_75kplus_train_071129 | 876 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "rob",
"signature": "def rob(self, root)"
},
{
"docstring": "return val: tuple(int, int) val[0]: How many value do I earn while roobing the node val[1]: Not rob node",
"name": "dfs",
"signature": "def dfs(self, node)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019116 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob(self, root): :type root: TreeNode :rtype: int
- def dfs(self, node): return val: tuple(int, int) val[0]: How many value do I earn while roobing the node val[1]: Not rob n... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def rob(self, root): :type root: TreeNode :rtype: int
- def dfs(self, node): return val: tuple(int, int) val[0]: How many value do I earn while roobing the node val[1]: Not rob n... | 1a3c1f4d6e9d3444039f087763b93241f4ba7892 | <|skeleton|>
class Solution:
def rob(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def dfs(self, node):
"""return val: tuple(int, int) val[0]: How many value do I earn while roobing the node val[1]: Not rob node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def rob(self, root):
""":type root: TreeNode :rtype: int"""
if not root:
return 0
values = self.dfs(root)
return max(values[0], values[1])
def dfs(self, node):
"""return val: tuple(int, int) val[0]: How many value do I earn while roobing the n... | the_stack_v2_python_sparse | Algorithm/337_House_Rob_III.py | Gi1ia/TechNoteBook | train | 7 | |
df5d2e0541397e5c8c6863ced056aa9a5711873f | [
"query = self.session.query(VTradehistory.o_time, VTradehistory.o_deal, VTradehistory.login, VTradehistory.symbol, VTradehistory.o_action, VTradehistory.volume, VTradehistory.o_price, VTradehistory.o_commission, VTradehistory.positionid, VTradehistory.c_time, VTradehistory.c_deal, VTradehistory.volumeclosed, VTrade... | <|body_start_0|>
query = self.session.query(VTradehistory.o_time, VTradehistory.o_deal, VTradehistory.login, VTradehistory.symbol, VTradehistory.o_action, VTradehistory.volume, VTradehistory.o_price, VTradehistory.o_commission, VTradehistory.positionid, VTradehistory.c_time, VTradehistory.c_deal, VTradehistory.... | v_tradehistory视图操作 | VTradehistoryDao | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VTradehistoryDao:
"""v_tradehistory视图操作"""
def search_by_uid(self, uid, start, end, mtlogin, page=None):
"""已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset"""
<|body_0|>
def searchsum_by_uid(self, uid, start, end, mt... | stack_v2_sparse_classes_75kplus_train_071130 | 26,694 | permissive | [
{
"docstring": "已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset",
"name": "search_by_uid",
"signature": "def search_by_uid(self, uid, start, end, mtlogin, page=None)"
},
{
"docstring": "已知用户id,根据时间段,查询总和 :param uid: 用户id :param start: 开始时间 :... | 2 | stack_v2_sparse_classes_30k_train_025698 | Implement the Python class `VTradehistoryDao` described below.
Class description:
v_tradehistory视图操作
Method signatures and docstrings:
- def search_by_uid(self, uid, start, end, mtlogin, page=None): 已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset
- def searchsum_... | Implement the Python class `VTradehistoryDao` described below.
Class description:
v_tradehistory视图操作
Method signatures and docstrings:
- def search_by_uid(self, uid, start, end, mtlogin, page=None): 已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset
- def searchsum_... | 1fadeecf31f1d25e258dc5d70c47a785f7b33961 | <|skeleton|>
class VTradehistoryDao:
"""v_tradehistory视图操作"""
def search_by_uid(self, uid, start, end, mtlogin, page=None):
"""已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset"""
<|body_0|>
def searchsum_by_uid(self, uid, start, end, mt... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VTradehistoryDao:
"""v_tradehistory视图操作"""
def search_by_uid(self, uid, start, end, mtlogin, page=None):
"""已知用户id,根据时间段,查询交易订单 :param uid:用户id :param start:起始时间 :param end:结束时间 :param page:请求页 :return:queryset"""
query = self.session.query(VTradehistory.o_time, VTradehistory.o_deal, VTra... | the_stack_v2_python_sparse | xwcrm/model/views.py | MSUNorg/XWCRM | train | 0 |
b8dce2defc7db70347ed5698928f2adc8bd8e5c6 | [
"super().__init__(5, initial_x, initial_y, 1, game_width, game_height, None, None, debug)\nself.scale(100 * game_width // 600, 50 * game_height // 800)\nself.set_points(points)",
"self.move_right()\nif self.get_x() > self.game_width:\n self.kill()\n return\nreturn super().update(1)"
] | <|body_start_0|>
super().__init__(5, initial_x, initial_y, 1, game_width, game_height, None, None, debug)
self.scale(100 * game_width // 600, 50 * game_height // 800)
self.set_points(points)
<|end_body_0|>
<|body_start_1|>
self.move_right()
if self.get_x() > self.game_width:
... | MotherShip | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MotherShip:
def __init__(self, initial_x: int, initial_y: int, game_width: int, game_height: int, points: int, debug: bool=False):
"""Main constructor for the mothership"""
<|body_0|>
def update(self) -> None:
"""Update movement of the mothership"""
<|body_1|... | stack_v2_sparse_classes_75kplus_train_071131 | 1,030 | permissive | [
{
"docstring": "Main constructor for the mothership",
"name": "__init__",
"signature": "def __init__(self, initial_x: int, initial_y: int, game_width: int, game_height: int, points: int, debug: bool=False)"
},
{
"docstring": "Update movement of the mothership",
"name": "update",
"signatu... | 2 | stack_v2_sparse_classes_30k_train_049923 | Implement the Python class `MotherShip` described below.
Class description:
Implement the MotherShip class.
Method signatures and docstrings:
- def __init__(self, initial_x: int, initial_y: int, game_width: int, game_height: int, points: int, debug: bool=False): Main constructor for the mothership
- def update(self) ... | Implement the Python class `MotherShip` described below.
Class description:
Implement the MotherShip class.
Method signatures and docstrings:
- def __init__(self, initial_x: int, initial_y: int, game_width: int, game_height: int, points: int, debug: bool=False): Main constructor for the mothership
- def update(self) ... | 6f8f2da4fd26ef1d77c0c6183230c3a5e6bf0bb9 | <|skeleton|>
class MotherShip:
def __init__(self, initial_x: int, initial_y: int, game_width: int, game_height: int, points: int, debug: bool=False):
"""Main constructor for the mothership"""
<|body_0|>
def update(self) -> None:
"""Update movement of the mothership"""
<|body_1|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MotherShip:
def __init__(self, initial_x: int, initial_y: int, game_width: int, game_height: int, points: int, debug: bool=False):
"""Main constructor for the mothership"""
super().__init__(5, initial_x, initial_y, 1, game_width, game_height, None, None, debug)
self.scale(100 * game_wi... | the_stack_v2_python_sparse | Space_Invaders/classes/Game/Sprites/Mothership.py | Jh123x/Orbital | train | 4 | |
a8570e514bf71fc9e1774e0fc4ddf389422b0bd4 | [
"serializer = self.invite_new_user_serializer_class(data=request.data)\nif not serializer.is_valid():\n return self.json_failed_response(errors=serializer.errors)\ndata_from_request = serializer.data\nif not is_user_allowed_cascade_down(request.user, data_from_request[GROUP]):\n return self.json_forbidden_res... | <|body_start_0|>
serializer = self.invite_new_user_serializer_class(data=request.data)
if not serializer.is_valid():
return self.json_failed_response(errors=serializer.errors)
data_from_request = serializer.data
if not is_user_allowed_cascade_down(request.user, data_from_requ... | view for inviting new users permission_required: CAN_INVITE_NEW_USER_PERMISSION | InviteNewUserView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InviteNewUserView:
"""view for inviting new users permission_required: CAN_INVITE_NEW_USER_PERMISSION"""
def post(self, request: Request, *args, **kwargs) -> Response:
"""request params: - email - group (group name) :return json response http response codes: 200 - ok, invitation emai... | stack_v2_sparse_classes_75kplus_train_071132 | 4,750 | no_license | [
{
"docstring": "request params: - email - group (group name) :return json response http response codes: 200 - ok, invitation email sent 400 - failed, validation error, view errors key 403 - failed, permission denied keys: success - true if invitation email sent and false otherwise errors - json of errors if suc... | 4 | stack_v2_sparse_classes_30k_val_001887 | Implement the Python class `InviteNewUserView` described below.
Class description:
view for inviting new users permission_required: CAN_INVITE_NEW_USER_PERMISSION
Method signatures and docstrings:
- def post(self, request: Request, *args, **kwargs) -> Response: request params: - email - group (group name) :return jso... | Implement the Python class `InviteNewUserView` described below.
Class description:
view for inviting new users permission_required: CAN_INVITE_NEW_USER_PERMISSION
Method signatures and docstrings:
- def post(self, request: Request, *args, **kwargs) -> Response: request params: - email - group (group name) :return jso... | bab909324aa2e4c1c8fff72093d3fcf44aaf4963 | <|skeleton|>
class InviteNewUserView:
"""view for inviting new users permission_required: CAN_INVITE_NEW_USER_PERMISSION"""
def post(self, request: Request, *args, **kwargs) -> Response:
"""request params: - email - group (group name) :return json response http response codes: 200 - ok, invitation emai... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class InviteNewUserView:
"""view for inviting new users permission_required: CAN_INVITE_NEW_USER_PERMISSION"""
def post(self, request: Request, *args, **kwargs) -> Response:
"""request params: - email - group (group name) :return json response http response codes: 200 - ok, invitation email sent 400 - ... | the_stack_v2_python_sparse | crm/views/invite_new_user/invite_new_user_view.py | vovapasko/crm | train | 0 |
76b60f2c79a94b620291b807dcd00037685e83e3 | [
"logger.info('New remote photo: title={}, id={} tags={}'.format(title, photo_id, tags))\nself.flickrwrapper = flickrwrapper\nself.title = title\nself.photo_id = photo_id\nself.tags = tags",
"if not isinstance(other, RemotePhoto):\n return NotImplemented\nreturn self.title == other.title and self.photo_id == ot... | <|body_start_0|>
logger.info('New remote photo: title={}, id={} tags={}'.format(title, photo_id, tags))
self.flickrwrapper = flickrwrapper
self.title = title
self.photo_id = photo_id
self.tags = tags
<|end_body_0|>
<|body_start_1|>
if not isinstance(other, RemotePhoto):
... | A Photo in a Flickr album. | RemotePhoto | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RemotePhoto:
"""A Photo in a Flickr album."""
def __init__(self, flickrwrapper, title, photo_id, tags):
"""Create a wrapper object for a flickr photo. Args: flickrwrapper - FlickrWrapper API object. title - title of the photo photo_id - the Flickr ID of the photo tags - formatted pyt... | stack_v2_sparse_classes_75kplus_train_071133 | 11,368 | permissive | [
{
"docstring": "Create a wrapper object for a flickr photo. Args: flickrwrapper - FlickrWrapper API object. title - title of the photo photo_id - the Flickr ID of the photo tags - formatted python list (not the Flickr format of space-delimited string).",
"name": "__init__",
"signature": "def __init__(se... | 6 | stack_v2_sparse_classes_30k_train_030907 | Implement the Python class `RemotePhoto` described below.
Class description:
A Photo in a Flickr album.
Method signatures and docstrings:
- def __init__(self, flickrwrapper, title, photo_id, tags): Create a wrapper object for a flickr photo. Args: flickrwrapper - FlickrWrapper API object. title - title of the photo p... | Implement the Python class `RemotePhoto` described below.
Class description:
A Photo in a Flickr album.
Method signatures and docstrings:
- def __init__(self, flickrwrapper, title, photo_id, tags): Create a wrapper object for a flickr photo. Args: flickrwrapper - FlickrWrapper API object. title - title of the photo p... | cd8aa0d5344cf95ab66711532a5cf4cb683eb92f | <|skeleton|>
class RemotePhoto:
"""A Photo in a Flickr album."""
def __init__(self, flickrwrapper, title, photo_id, tags):
"""Create a wrapper object for a flickr photo. Args: flickrwrapper - FlickrWrapper API object. title - title of the photo photo_id - the Flickr ID of the photo tags - formatted pyt... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RemotePhoto:
"""A Photo in a Flickr album."""
def __init__(self, flickrwrapper, title, photo_id, tags):
"""Create a wrapper object for a flickr photo. Args: flickrwrapper - FlickrWrapper API object. title - title of the photo photo_id - the Flickr ID of the photo tags - formatted python list (not... | the_stack_v2_python_sparse | flickrsyncr/syncer.py | B-Con/flickrsyncr | train | 1 |
ad49efecc981b7065aba0d71d1a435ade5168b11 | [
"self._t = x.shape[0]\nself._V = np.zeros(self._t + self.populate_days)\nself._U = np.zeros(self._t + self.populate_days)\nself._V[:self._t], self._U[:self._t] = self.data_preprocessing(x)\ngammas = self.evaluate_gammas(self._V, self._U)\nself._V, self._U = gamma2_populate_V_U(self._V, self._U, gammas, self._t - se... | <|body_start_0|>
self._t = x.shape[0]
self._V = np.zeros(self._t + self.populate_days)
self._U = np.zeros(self._t + self.populate_days)
self._V[:self._t], self._U[:self._t] = self.data_preprocessing(x)
gammas = self.evaluate_gammas(self._V, self._U)
self._V, self._U = gam... | GAMMA_2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GAMMA_2:
def fit(self, x):
"""Fit model parameters using data. Args: x (np.array): (ntimes, 3) data"""
<|body_0|>
def evaluate_gammas(self, V, U):
"""Get gammas for the period of interest. I.e., we take the last period of num_past_days for which we know both U and V.... | stack_v2_sparse_classes_75kplus_train_071134 | 1,816 | no_license | [
{
"docstring": "Fit model parameters using data. Args: x (np.array): (ntimes, 3) data",
"name": "fit",
"signature": "def fit(self, x)"
},
{
"docstring": "Get gammas for the period of interest. I.e., we take the last period of num_past_days for which we know both U and V. We use them to get the g... | 2 | null | Implement the Python class `GAMMA_2` described below.
Class description:
Implement the GAMMA_2 class.
Method signatures and docstrings:
- def fit(self, x): Fit model parameters using data. Args: x (np.array): (ntimes, 3) data
- def evaluate_gammas(self, V, U): Get gammas for the period of interest. I.e., we take the ... | Implement the Python class `GAMMA_2` described below.
Class description:
Implement the GAMMA_2 class.
Method signatures and docstrings:
- def fit(self, x): Fit model parameters using data. Args: x (np.array): (ntimes, 3) data
- def evaluate_gammas(self, V, U): Get gammas for the period of interest. I.e., we take the ... | 7c0eca21195c37027b1eb59f5082a702b41f0729 | <|skeleton|>
class GAMMA_2:
def fit(self, x):
"""Fit model parameters using data. Args: x (np.array): (ntimes, 3) data"""
<|body_0|>
def evaluate_gammas(self, V, U):
"""Get gammas for the period of interest. I.e., we take the last period of num_past_days for which we know both U and V.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GAMMA_2:
def fit(self, x):
"""Fit model parameters using data. Args: x (np.array): (ntimes, 3) data"""
self._t = x.shape[0]
self._V = np.zeros(self._t + self.populate_days)
self._U = np.zeros(self._t + self.populate_days)
self._V[:self._t], self._U[:self._t] = self.data... | the_stack_v2_python_sparse | src/models/gamma_params2.py | jamgochiana/CovidModeling | train | 0 | |
3c81595b2388cde33c8b97271b8bfaaf153718d3 | [
"self._init_attrs()\nself.data = data\nself.delimiter = delimiter\nself.indent = indent\nself.sep = sep",
"data = self.data.strip()\nsections = data.split(self.sep)\nret_dict = {}\nfor section in sections:\n section_data = self._parse_as_dict(section)\n ret_dict.update(section_data)\nreturn ret_dict",
"da... | <|body_start_0|>
self._init_attrs()
self.data = data
self.delimiter = delimiter
self.indent = indent
self.sep = sep
<|end_body_0|>
<|body_start_1|>
data = self.data.strip()
sections = data.split(self.sep)
ret_dict = {}
for section in sections:
... | Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces | CmdSoup | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CmdSoup:
"""Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces"""
def __init__(self, data, delimiter=':', indent=' ', sep='\n\n'):
"""Initialises self."""
<|body_0|>
def as_dict(self):
"""Parses... | stack_v2_sparse_classes_75kplus_train_071135 | 2,802 | no_license | [
{
"docstring": "Initialises self.",
"name": "__init__",
"signature": "def __init__(self, data, delimiter=':', indent=' ', sep='\\n\\n')"
},
{
"docstring": "Parses self.data, returning a dictionary of its contents",
"name": "as_dict",
"signature": "def as_dict(self)"
},
{
"docs... | 5 | stack_v2_sparse_classes_30k_train_013090 | Implement the Python class `CmdSoup` described below.
Class description:
Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces
Method signatures and docstrings:
- def __init__(self, data, delimiter=':', indent=' ', sep='\n\n'): Initialises self.
- def ... | Implement the Python class `CmdSoup` described below.
Class description:
Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces
Method signatures and docstrings:
- def __init__(self, data, delimiter=':', indent=' ', sep='\n\n'): Initialises self.
- def ... | 7d370342f34e26e6e66718ae397eb1d81253cd8a | <|skeleton|>
class CmdSoup:
"""Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces"""
def __init__(self, data, delimiter=':', indent=' ', sep='\n\n'):
"""Initialises self."""
<|body_0|>
def as_dict(self):
"""Parses... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CmdSoup:
"""Class to parse cmd output Tailored to 'netsh {interface} show networks mode=bssid' Also works for showing interfaces"""
def __init__(self, data, delimiter=':', indent=' ', sep='\n\n'):
"""Initialises self."""
self._init_attrs()
self.data = data
self.delimite... | the_stack_v2_python_sparse | yatwin/onekeywifi/network/netsh/cmdsoup/CmdSoup.py | andre95d/python-yatwin | train | 0 |
d477469b173f4b1f99c1d178e55da7875f391428 | [
"self.padre_id = padre_id\nself.hijo_id = hijo_id\nself.versionHijo = versionHijo",
"self.padre_id = padre_id\nself.hijo_id = hijo_id\nself.versionHijo = versionHijo"
] | <|body_start_0|>
self.padre_id = padre_id
self.hijo_id = hijo_id
self.versionHijo = versionHijo
<|end_body_0|>
<|body_start_1|>
self.padre_id = padre_id
self.hijo_id = hijo_id
self.versionHijo = versionHijo
<|end_body_1|>
| Esta clase se utiliza para mapear a sus instancias con la tabla de Historial_relacion Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla. | HistorialRelacion | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HistorialRelacion:
"""Esta clase se utiliza para mapear a sus instancias con la tabla de Historial_relacion Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla."""
def setValues(self, padre_id, hijo_id, versionHijo):
"""Metodo para e... | stack_v2_sparse_classes_75kplus_train_071136 | 10,087 | no_license | [
{
"docstring": "Metodo para establecer valores de atributos de la clase. @type padre_id : number @param padre_id : nombre de la fase @type hijo_id : number @param hijo_id : descripcion de la fase @type versionHijo : number @param versionHijo : estado actual de la fase",
"name": "setValues",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_029958 | Implement the Python class `HistorialRelacion` described below.
Class description:
Esta clase se utiliza para mapear a sus instancias con la tabla de Historial_relacion Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla.
Method signatures and docstrings:
- def setVa... | Implement the Python class `HistorialRelacion` described below.
Class description:
Esta clase se utiliza para mapear a sus instancias con la tabla de Historial_relacion Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla.
Method signatures and docstrings:
- def setVa... | 9262320d4ff52bd3592365cd232f8dedff4f64da | <|skeleton|>
class HistorialRelacion:
"""Esta clase se utiliza para mapear a sus instancias con la tabla de Historial_relacion Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla."""
def setValues(self, padre_id, hijo_id, versionHijo):
"""Metodo para e... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HistorialRelacion:
"""Esta clase se utiliza para mapear a sus instancias con la tabla de Historial_relacion Hereda de la clase Base. La clase Base debe ser heredada por todas las clases que mapearan a una tabla."""
def setValues(self, padre_id, hijo_id, versionHijo):
"""Metodo para establecer val... | the_stack_v2_python_sparse | models/historialModelo.py | jemaromaster/WAPM | train | 0 |
5098c311094ae9a6dcb7d2d8e6c5a8c440038b99 | [
"value = []\nif 'part_id' in form:\n for part_id in form['part_id'][0].keys():\n value.append({'part_id': part_id, 'preservation_uid': form['preservation_uid'][0][part_id], 'container_uid': form['container_uid'][0][part_id]})\nif value:\n return (value, {})",
"fieldvalue = getattr(field, field.access... | <|body_start_0|>
value = []
if 'part_id' in form:
for part_id in form['part_id'][0].keys():
value.append({'part_id': part_id, 'preservation_uid': form['preservation_uid'][0][part_id], 'container_uid': form['container_uid'][0][part_id]})
if value:
return (v... | ARTemplatePartitionsWidget | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ARTemplatePartitionsWidget:
def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False):
"""Return a list of dictionaries fit for ARTemplate/Partitions field consumption."""
<|body_0|>
def Partitions(self, field, allow_edit=False):
"""P... | stack_v2_sparse_classes_75kplus_train_071137 | 5,417 | no_license | [
{
"docstring": "Return a list of dictionaries fit for ARTemplate/Partitions field consumption.",
"name": "process_form",
"signature": "def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False)"
},
{
"docstring": "Print partitions table",
"name": "Partitions",... | 2 | stack_v2_sparse_classes_30k_train_017188 | Implement the Python class `ARTemplatePartitionsWidget` described below.
Class description:
Implement the ARTemplatePartitionsWidget class.
Method signatures and docstrings:
- def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False): Return a list of dictionaries fit for ARTemplate/P... | Implement the Python class `ARTemplatePartitionsWidget` described below.
Class description:
Implement the ARTemplatePartitionsWidget class.
Method signatures and docstrings:
- def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False): Return a list of dictionaries fit for ARTemplate/P... | 40065e245de002c8b81200292dfe4e3f2a4cb274 | <|skeleton|>
class ARTemplatePartitionsWidget:
def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False):
"""Return a list of dictionaries fit for ARTemplate/Partitions field consumption."""
<|body_0|>
def Partitions(self, field, allow_edit=False):
"""P... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ARTemplatePartitionsWidget:
def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False):
"""Return a list of dictionaries fit for ARTemplate/Partitions field consumption."""
value = []
if 'part_id' in form:
for part_id in form['part_id'][0].ke... | the_stack_v2_python_sparse | bika/lims/browser/widgets/artemplatepartitionswidget.py | davidromani/Bika-LIMS | train | 0 | |
319011fcbd04c9782598975fa961c043364282d9 | [
"ans = []\ni = 0\nfor j in range(len(S)):\n if j == len(S) - 1 or S[j] != S[j + 1]:\n if j - i + 1 >= 3:\n ans.append([i, j])\n i = j + 1\nreturn ans",
"i, j, n, res = (0, 0, len(S), [])\nwhile j < n:\n while j < n and S[i] == S[j]:\n j += 1\n if j - i >= 3:\n res.a... | <|body_start_0|>
ans = []
i = 0
for j in range(len(S)):
if j == len(S) - 1 or S[j] != S[j + 1]:
if j - i + 1 >= 3:
ans.append([i, j])
i = j + 1
return ans
<|end_body_0|>
<|body_start_1|>
i, j, n, res = (0, 0, len(S)... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def largeGroupPositions(self, S):
""":type S: str :rtype: List[List[int]]"""
<|body_0|>
def largeGroupPositions(self, S):
""":type S: str :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
ans = []
i = 0
... | stack_v2_sparse_classes_75kplus_train_071138 | 821 | no_license | [
{
"docstring": ":type S: str :rtype: List[List[int]]",
"name": "largeGroupPositions",
"signature": "def largeGroupPositions(self, S)"
},
{
"docstring": ":type S: str :rtype: List[List[int]]",
"name": "largeGroupPositions",
"signature": "def largeGroupPositions(self, S)"
}
] | 2 | stack_v2_sparse_classes_30k_train_023578 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largeGroupPositions(self, S): :type S: str :rtype: List[List[int]]
- def largeGroupPositions(self, S): :type S: str :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def largeGroupPositions(self, S): :type S: str :rtype: List[List[int]]
- def largeGroupPositions(self, S): :type S: str :rtype: List[List[int]]
<|skeleton|>
class Solution:
... | c92a5ddcc56e3f69be1e6fb25e9c8ed277e57ee0 | <|skeleton|>
class Solution:
def largeGroupPositions(self, S):
""":type S: str :rtype: List[List[int]]"""
<|body_0|>
def largeGroupPositions(self, S):
""":type S: str :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def largeGroupPositions(self, S):
""":type S: str :rtype: List[List[int]]"""
ans = []
i = 0
for j in range(len(S)):
if j == len(S) - 1 or S[j] != S[j + 1]:
if j - i + 1 >= 3:
ans.append([i, j])
i = j + 1
... | the_stack_v2_python_sparse | code/830#Positions of Large Groups.py | EachenKuang/LeetCode | train | 28 | |
74d316a81db98c9f5dd6e04d4c4001fea727adc6 | [
"from collections import defaultdict\nstore = defaultdict(dict)\nreturn self.uniqueP(m, n, 1, 1, store)",
"if x == m and y == n:\n return 1\nif x >= m:\n return self.uniqueP(m, n, x, y + 1, store)\nif y >= n:\n return self.uniqueP(m, n, x + 1, y, store)\nif y not in store[x]:\n store[x][y] = self.uniq... | <|body_start_0|>
from collections import defaultdict
store = defaultdict(dict)
return self.uniqueP(m, n, 1, 1, store)
<|end_body_0|>
<|body_start_1|>
if x == m and y == n:
return 1
if x >= m:
return self.uniqueP(m, n, x, y + 1, store)
if y >= n:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def uniquePaths(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_0|>
def uniqueP(self, m, n, x, y, store):
"""x, y represent robot position"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from collections import defaultdict
... | stack_v2_sparse_classes_75kplus_train_071139 | 1,313 | no_license | [
{
"docstring": ":type m: int :type n: int :rtype: int",
"name": "uniquePaths",
"signature": "def uniquePaths(self, m, n)"
},
{
"docstring": "x, y represent robot position",
"name": "uniqueP",
"signature": "def uniqueP(self, m, n, x, y, store)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001271 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int
- def uniqueP(self, m, n, x, y, store): x, y represent robot position | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def uniquePaths(self, m, n): :type m: int :type n: int :rtype: int
- def uniqueP(self, m, n, x, y, store): x, y represent robot position
<|skeleton|>
class Solution:
def un... | c170b8eb6c71533c78663ec1e3e9f47cff811419 | <|skeleton|>
class Solution:
def uniquePaths(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_0|>
def uniqueP(self, m, n, x, y, store):
"""x, y represent robot position"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def uniquePaths(self, m, n):
""":type m: int :type n: int :rtype: int"""
from collections import defaultdict
store = defaultdict(dict)
return self.uniqueP(m, n, 1, 1, store)
def uniqueP(self, m, n, x, y, store):
"""x, y represent robot position"""
... | the_stack_v2_python_sparse | leetcode/062_unique_paths/python/unique_paths.py | philips-ni/ecfs | train | 1 | |
70876f5d65de9f40a5c5b1e4c0e1f410fe5211ca | [
"with patch('builtins.input', return_value='1'):\n assert input() == '1'\nwith patch('builtins.input', return_value='2'):\n assert input() == '2'\nwith patch('builtins.input', return_value='3'):\n assert input() == '3'",
"test_gp = mm.getprice('test1')\ninput_gp = mm.getprice('test2')\nself.assertEqual(t... | <|body_start_0|>
with patch('builtins.input', return_value='1'):
assert input() == '1'
with patch('builtins.input', return_value='2'):
assert input() == '2'
with patch('builtins.input', return_value='3'):
assert input() == '3'
<|end_body_0|>
<|body_start_1|>
... | class docstring | MainmenuTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MainmenuTest:
"""class docstring"""
def test_mainmenu(self):
"""method doc string"""
<|body_0|>
def test_getprice(self):
"""method doc string"""
<|body_1|>
def test_iteminfo(self):
"""method doc string"""
<|body_2|>
def test_exit... | stack_v2_sparse_classes_75kplus_train_071140 | 3,874 | no_license | [
{
"docstring": "method doc string",
"name": "test_mainmenu",
"signature": "def test_mainmenu(self)"
},
{
"docstring": "method doc string",
"name": "test_getprice",
"signature": "def test_getprice(self)"
},
{
"docstring": "method doc string",
"name": "test_iteminfo",
"sign... | 4 | stack_v2_sparse_classes_30k_train_036651 | Implement the Python class `MainmenuTest` described below.
Class description:
class docstring
Method signatures and docstrings:
- def test_mainmenu(self): method doc string
- def test_getprice(self): method doc string
- def test_iteminfo(self): method doc string
- def test_exit(self): method docstring | Implement the Python class `MainmenuTest` described below.
Class description:
class docstring
Method signatures and docstrings:
- def test_mainmenu(self): method doc string
- def test_getprice(self): method doc string
- def test_iteminfo(self): method doc string
- def test_exit(self): method docstring
<|skeleton|>
c... | ac12beeae8aa57135bbcd03ac7a4f977fa3bdb56 | <|skeleton|>
class MainmenuTest:
"""class docstring"""
def test_mainmenu(self):
"""method doc string"""
<|body_0|>
def test_getprice(self):
"""method doc string"""
<|body_1|>
def test_iteminfo(self):
"""method doc string"""
<|body_2|>
def test_exit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MainmenuTest:
"""class docstring"""
def test_mainmenu(self):
"""method doc string"""
with patch('builtins.input', return_value='1'):
assert input() == '1'
with patch('builtins.input', return_value='2'):
assert input() == '2'
with patch('builtins.inp... | the_stack_v2_python_sparse | students/Daniel_Carrasco/lesson01/assignment/test_unit.py | UWPCE-PythonCert-ClassRepos/py220-online-201904-V2 | train | 1 |
99eabc2a346b13259eee8db6a5688e981f34e93e | [
"self.id = id\nself.provider_id = provider_id\nself.server_time = server_time\nself.stop_name = stop_name\nself.address = address\nself.comment = comment\nself.location = location\nself.entry_area = entry_area",
"if dictionary is None:\n return None\nid = dictionary.get('id')\nprovider_id = dictionary.get('pro... | <|body_start_0|>
self.id = id
self.provider_id = provider_id
self.server_time = server_time
self.stop_name = stop_name
self.address = address
self.comment = comment
self.location = location
self.entry_area = entry_area
<|end_body_0|>
<|body_start_1|>
... | Implementation of the 'Stop Geographic Details' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of the TSP. server_time (string): Date and time when this object was received at the TSP s... | StopGeographicDetails | [
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StopGeographicDetails:
"""Implementation of the 'Stop Geographic Details' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of the TSP. server_time (string): Date an... | stack_v2_sparse_classes_75kplus_train_071141 | 3,141 | permissive | [
{
"docstring": "Constructor for the StopGeographicDetails class",
"name": "__init__",
"signature": "def __init__(self, id=None, provider_id=None, server_time=None, stop_name=None, location=None, address=None, comment=None, entry_area=None)"
},
{
"docstring": "Creates an instance of this model fr... | 2 | stack_v2_sparse_classes_30k_train_052506 | Implement the Python class `StopGeographicDetails` described below.
Class description:
Implementation of the 'Stop Geographic Details' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of... | Implement the Python class `StopGeographicDetails` described below.
Class description:
Implementation of the 'Stop Geographic Details' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of... | 729e9391879e273545a4818558677b2e47261f08 | <|skeleton|>
class StopGeographicDetails:
"""Implementation of the 'Stop Geographic Details' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of the TSP. server_time (string): Date an... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StopGeographicDetails:
"""Implementation of the 'Stop Geographic Details' model. TODO: type model description here. Attributes: id (string): The unique identifier for the specific Entity object in the system. provider_id (string): The unique 'Provider ID' of the TSP. server_time (string): Date and time when t... | the_stack_v2_python_sparse | sdk/python/v0.1-rc.4/opentelematicsapi/models/stop_geographic_details.py | nmfta-repo/nmfta-opentelematics-prototype | train | 2 |
38f3a4f431116540174ad959300bfcbb07efd330 | [
"self._source = source\nself._time_provider = time_provider\nself._storage_engine = storage_engine",
"if slack_task.archived:\n return\nasync with self._storage_engine.get_unit_of_work() as uow:\n slack_task_collection = await uow.slack_task_collection_repository.load_by_id(slack_task.slack_task_collection_... | <|body_start_0|>
self._source = source
self._time_provider = time_provider
self._storage_engine = storage_engine
<|end_body_0|>
<|body_start_1|>
if slack_task.archived:
return
async with self._storage_engine.get_unit_of_work() as uow:
slack_task_collectio... | Shared service for archiving a slack task. | SlackTaskArchiveService | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SlackTaskArchiveService:
"""Shared service for archiving a slack task."""
def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None:
"""Constructor."""
<|body_0|>
async def do_it(self, progress_reporter: ProgressRep... | stack_v2_sparse_classes_75kplus_train_071142 | 2,869 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None"
},
{
"docstring": "Execute the service's action.",
"name": "do_it",
"signature": "async def do_it(self, prog... | 2 | stack_v2_sparse_classes_30k_train_047851 | Implement the Python class `SlackTaskArchiveService` described below.
Class description:
Shared service for archiving a slack task.
Method signatures and docstrings:
- def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: Constructor.
- async def do_it(self... | Implement the Python class `SlackTaskArchiveService` described below.
Class description:
Shared service for archiving a slack task.
Method signatures and docstrings:
- def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None: Constructor.
- async def do_it(self... | 911ecd560142a9b4e57498f2b090f9469a0718a1 | <|skeleton|>
class SlackTaskArchiveService:
"""Shared service for archiving a slack task."""
def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None:
"""Constructor."""
<|body_0|>
async def do_it(self, progress_reporter: ProgressRep... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SlackTaskArchiveService:
"""Shared service for archiving a slack task."""
def __init__(self, source: EventSource, time_provider: TimeProvider, storage_engine: DomainStorageEngine) -> None:
"""Constructor."""
self._source = source
self._time_provider = time_provider
self._s... | the_stack_v2_python_sparse | src/core/jupiter/core/domain/push_integrations/slack/service/archive_service.py | horia141/jupiter | train | 16 |
ac3406a3f310aa7b6b23bc100254bf586e6f2fdd | [
"self.__logger = State().getLogger('Preprocessing_Component_Logger')\nself.__logger.info('Starting __init__()', 'AdaptiveThresholdBinarizationPreprocessor:__init__')\nself.__maxValue = maxValue\nself.__adaptiveMethode = adaptiveMethode\nself.__thresholdType = thresholdType\nself.__blockSize = blockSize\nself.__C = ... | <|body_start_0|>
self.__logger = State().getLogger('Preprocessing_Component_Logger')
self.__logger.info('Starting __init__()', 'AdaptiveThresholdBinarizationPreprocessor:__init__')
self.__maxValue = maxValue
self.__adaptiveMethode = adaptiveMethode
self.__thresholdType = threshol... | AdaptiveThresholdBinarizationPreprocessor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AdaptiveThresholdBinarizationPreprocessor:
def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False):
"""To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!"""
<|body_0|>
def preProcess(self, mat):
"""Führt die adaptive thre... | stack_v2_sparse_classes_75kplus_train_071143 | 2,935 | no_license | [
{
"docstring": "To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!",
"name": "__init__",
"signature": "def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False)"
},
{
"docstring": "Führt die adaptive threshold binarization auf eine Bildmatrix aus. Para... | 2 | stack_v2_sparse_classes_30k_train_048799 | Implement the Python class `AdaptiveThresholdBinarizationPreprocessor` described below.
Class description:
Implement the AdaptiveThresholdBinarizationPreprocessor class.
Method signatures and docstrings:
- def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False): To-Do: Bit... | Implement the Python class `AdaptiveThresholdBinarizationPreprocessor` described below.
Class description:
Implement the AdaptiveThresholdBinarizationPreprocessor class.
Method signatures and docstrings:
- def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False): To-Do: Bit... | 3daaa72b193ebfb55894b47b6a752cdc2192bb6b | <|skeleton|>
class AdaptiveThresholdBinarizationPreprocessor:
def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False):
"""To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!"""
<|body_0|>
def preProcess(self, mat):
"""Führt die adaptive thre... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AdaptiveThresholdBinarizationPreprocessor:
def __init__(self, maxValue, adaptiveMethode, thresholdType, blockSize, C, showImagesInWindow=False):
"""To-Do: Bitte Kommentar bzw. Dokumentaion erstellen!"""
self.__logger = State().getLogger('Preprocessing_Component_Logger')
self.__logger.i... | the_stack_v2_python_sparse | SheetMusicScanner/Preprocessing_Component/PreprocessingUnit/AdaptiveThresholdBinarizationPreProcessor.py | jadeskon/score-scan | train | 0 | |
36b68c257b4d38157969f6d03d86c77f2e4a3548 | [
"self.arpoja = arpoja\nself.tilasiirtymat = [[30, 20, 20, 15, 15], [10, 40, 25, 15, 10], [0, 0, 20, 80, 0], [0, 0, 10, 80, 10], [0, 0, 0, 80, 20]]\nself.selitteet = {0: 'kokonuotti', 1: 'puolinuotti', 2: 'neljäsosanuotti', 3: 'kahdeksasosanuotti', 4: 'kuudestoistaosanuotti'}",
"arvottu = self.arpoja.randint(1, 10... | <|body_start_0|>
self.arpoja = arpoja
self.tilasiirtymat = [[30, 20, 20, 15, 15], [10, 40, 25, 15, 10], [0, 0, 20, 80, 0], [0, 0, 10, 80, 10], [0, 0, 0, 80, 20]]
self.selitteet = {0: 'kokonuotti', 1: 'puolinuotti', 2: 'neljäsosanuotti', 3: 'kahdeksasosanuotti', 4: 'kuudestoistaosanuotti'}
<|end_... | Olio, joka (ensimmäisen asteen) Markovin ketjua käyttäen arpoo sävelen pituuden arpoja: Arpoja-olio (Random-kirjastosta) tilasiirtymat: taulukko, jonka perusteella siirrytään eri tilojen välillä x-akseli kuvaa tietystä tilasta siirtymisen todennäköisyyksiä selitteet: tilasiirtymien indeksien selitteet | Pituusarpoja | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Pituusarpoja:
"""Olio, joka (ensimmäisen asteen) Markovin ketjua käyttäen arpoo sävelen pituuden arpoja: Arpoja-olio (Random-kirjastosta) tilasiirtymat: taulukko, jonka perusteella siirrytään eri tilojen välillä x-akseli kuvaa tietystä tilasta siirtymisen todennäköisyyksiä selitteet: tilasiirtymi... | stack_v2_sparse_classes_75kplus_train_071144 | 1,947 | no_license | [
{
"docstring": "Args: arpoja: Arpoja-olio (Random-kirjastosta)",
"name": "__init__",
"signature": "def __init__(self, arpoja)"
},
{
"docstring": "Etsii seuraavan tilan. Tyhjälle tilalle etsitään arvo neljäsosanuotin arvojen perusteella Varmistaa, ettei arvota tahdin ylittäviä pituuksia Args: ede... | 2 | stack_v2_sparse_classes_30k_val_000167 | Implement the Python class `Pituusarpoja` described below.
Class description:
Olio, joka (ensimmäisen asteen) Markovin ketjua käyttäen arpoo sävelen pituuden arpoja: Arpoja-olio (Random-kirjastosta) tilasiirtymat: taulukko, jonka perusteella siirrytään eri tilojen välillä x-akseli kuvaa tietystä tilasta siirtymisen to... | Implement the Python class `Pituusarpoja` described below.
Class description:
Olio, joka (ensimmäisen asteen) Markovin ketjua käyttäen arpoo sävelen pituuden arpoja: Arpoja-olio (Random-kirjastosta) tilasiirtymat: taulukko, jonka perusteella siirrytään eri tilojen välillä x-akseli kuvaa tietystä tilasta siirtymisen to... | 09f09e60c89bdfb29fb63d9749a8b9c1b31cd6dd | <|skeleton|>
class Pituusarpoja:
"""Olio, joka (ensimmäisen asteen) Markovin ketjua käyttäen arpoo sävelen pituuden arpoja: Arpoja-olio (Random-kirjastosta) tilasiirtymat: taulukko, jonka perusteella siirrytään eri tilojen välillä x-akseli kuvaa tietystä tilasta siirtymisen todennäköisyyksiä selitteet: tilasiirtymi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Pituusarpoja:
"""Olio, joka (ensimmäisen asteen) Markovin ketjua käyttäen arpoo sävelen pituuden arpoja: Arpoja-olio (Random-kirjastosta) tilasiirtymat: taulukko, jonka perusteella siirrytään eri tilojen välillä x-akseli kuvaa tietystä tilasta siirtymisen todennäköisyyksiä selitteet: tilasiirtymien indeksien ... | the_stack_v2_python_sparse | src/markovin_ketjut/pituusarpoja.py | Aikamoine/markovin-ketju-saveltaja | train | 0 |
dc9ec16578db695061ce791db760ee937d43a5ec | [
"super().__init__()\nself.height = height\nself.width = width\ncheck_pos_int(height, 'height')\ncheck_pos_int(width, 'width')\nself.coords = torch.stack(torch.meshgrid(torch.arange(height, dtype=torch.float32), torch.arange(width, dtype=torch.float32)), -1)\nself.coords = torch.reshape(self.coords, [-1, 2])",
"sa... | <|body_start_0|>
super().__init__()
self.height = height
self.width = width
check_pos_int(height, 'height')
check_pos_int(width, 'width')
self.coords = torch.stack(torch.meshgrid(torch.arange(height, dtype=torch.float32), torch.arange(width, dtype=torch.float32)), -1)
... | The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelSampler(image_height, image_width) sampled_data = sampler(rays_directions=rays_d, r... | AllPixelSampler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllPixelSampler:
"""The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelSampler(image_height, image_width) sampl... | stack_v2_sparse_classes_75kplus_train_071145 | 2,482 | permissive | [
{
"docstring": "Args: height (int): The height of the 2D array to be sampled. Positive integer. width (int): The width of the 2D array to be sampled. Positive integer.",
"name": "__init__",
"signature": "def __init__(self, height, width)"
},
{
"docstring": "Args: image (torch.Tensor): (Optional)... | 2 | stack_v2_sparse_classes_30k_train_027594 | Implement the Python class `AllPixelSampler` described below.
Class description:
The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelS... | Implement the Python class `AllPixelSampler` described below.
Class description:
The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelS... | da3680cce7e8fc4c194f13a1528cddbad9a18ab0 | <|skeleton|>
class AllPixelSampler:
"""The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelSampler(image_height, image_width) sampl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AllPixelSampler:
"""The function that is used to sample all the elements of the given input 2D array. This function simply flattens a 2D array based on the [y, x] coordinates and returns each pixel as result. Usage: .. code-block:: python sampler = AllPixelSampler(image_height, image_width) sampled_data = sam... | the_stack_v2_python_sparse | pynif3d/sampling/pixel/all_pixel_sampler.py | pfnet/pynif3d | train | 72 |
133595a75db7a60634483bc79a8e3f50ccf6db09 | [
"super().__init__(hass, LOGGER, name=name, update_interval=update_interval, update_method=update_method)\nself._rebooting = False\nself._signal_handler_unsubs: list[Callable[..., None]] = []\nself.config_entry = entry\nself.signal_reboot_completed = SIGNAL_REBOOT_COMPLETED.format(self.config_entry.entry_id)\nself.s... | <|body_start_0|>
super().__init__(hass, LOGGER, name=name, update_interval=update_interval, update_method=update_method)
self._rebooting = False
self._signal_handler_unsubs: list[Callable[..., None]] = []
self.config_entry = entry
self.signal_reboot_completed = SIGNAL_REBOOT_COMP... | Define an extended DataUpdateCoordinator. | RainMachineDataUpdateCoordinator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RainMachineDataUpdateCoordinator:
"""Define an extended DataUpdateCoordinator."""
def __init__(self, hass: HomeAssistant, *, entry: ConfigEntry, name: str, api_category: str, update_interval: timedelta, update_method: Callable[..., Awaitable]) -> None:
"""Initialize."""
<|bod... | stack_v2_sparse_classes_75kplus_train_071146 | 3,913 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, *, entry: ConfigEntry, name: str, api_category: str, update_interval: timedelta, update_method: Callable[..., Awaitable]) -> None"
},
{
"docstring": "Initialize the coordinator.",
"name": ... | 2 | stack_v2_sparse_classes_30k_val_000803 | Implement the Python class `RainMachineDataUpdateCoordinator` described below.
Class description:
Define an extended DataUpdateCoordinator.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, *, entry: ConfigEntry, name: str, api_category: str, update_interval: timedelta, update_method: Callab... | Implement the Python class `RainMachineDataUpdateCoordinator` described below.
Class description:
Define an extended DataUpdateCoordinator.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, *, entry: ConfigEntry, name: str, api_category: str, update_interval: timedelta, update_method: Callab... | 564150169bfc69efdfeda25a99d803441f3a4b10 | <|skeleton|>
class RainMachineDataUpdateCoordinator:
"""Define an extended DataUpdateCoordinator."""
def __init__(self, hass: HomeAssistant, *, entry: ConfigEntry, name: str, api_category: str, update_interval: timedelta, update_method: Callable[..., Awaitable]) -> None:
"""Initialize."""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RainMachineDataUpdateCoordinator:
"""Define an extended DataUpdateCoordinator."""
def __init__(self, hass: HomeAssistant, *, entry: ConfigEntry, name: str, api_category: str, update_interval: timedelta, update_method: Callable[..., Awaitable]) -> None:
"""Initialize."""
super().__init__(h... | the_stack_v2_python_sparse | homeassistant/components/rainmachine/util.py | elupus/home-assistant | train | 2 |
cf9e3fee50921e1234c923d71abe4b37a6656d9a | [
"self.eq_constraints = [c['fun'] for c in constraints if c['type'] == 'eq']\nself.ineq_constraints = [c['fun'] for c in constraints if c['type'] == 'ineq']\nself.icb = icb\nself.eq_candidates = []\nself.ineq_candidates = []",
"x = x.copy()\neq_constraints = [float(c(x)) for c in self.eq_constraints]\nineq_constra... | <|body_start_0|>
self.eq_constraints = [c['fun'] for c in constraints if c['type'] == 'eq']
self.ineq_constraints = [c['fun'] for c in constraints if c['type'] == 'ineq']
self.icb = icb
self.eq_candidates = []
self.ineq_candidates = []
<|end_body_0|>
<|body_start_1|>
x =... | scipy's basinhopping return status often will return an optimization vector which does not satisfy the constraints if it has a lower objective value and ran in to some sort of error status rather than detecting that it is in a local minima. This object tracks the minima found for each basin hop, potentially keeping tra... | BasinHoppingCallBack | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasinHoppingCallBack:
"""scipy's basinhopping return status often will return an optimization vector which does not satisfy the constraints if it has a lower objective value and ran in to some sort of error status rather than detecting that it is in a local minima. This object tracks the minima f... | stack_v2_sparse_classes_75kplus_train_071147 | 6,763 | permissive | [
{
"docstring": "Parameters ---------- optimizer : MarkovVarOptimizer The optimizer to track the optimization of.",
"name": "__init__",
"signature": "def __init__(self, constraints, icb=None)"
},
{
"docstring": "Parameters ---------- x : ndarray Optimization vector. f : float Current value of the... | 3 | null | Implement the Python class `BasinHoppingCallBack` described below.
Class description:
scipy's basinhopping return status often will return an optimization vector which does not satisfy the constraints if it has a lower objective value and ran in to some sort of error status rather than detecting that it is in a local ... | Implement the Python class `BasinHoppingCallBack` described below.
Class description:
scipy's basinhopping return status often will return an optimization vector which does not satisfy the constraints if it has a lower objective value and ran in to some sort of error status rather than detecting that it is in a local ... | b13c5020a2b8524527a4a0db5a81d8549142228c | <|skeleton|>
class BasinHoppingCallBack:
"""scipy's basinhopping return status often will return an optimization vector which does not satisfy the constraints if it has a lower objective value and ran in to some sort of error status rather than detecting that it is in a local minima. This object tracks the minima f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasinHoppingCallBack:
"""scipy's basinhopping return status often will return an optimization vector which does not satisfy the constraints if it has a lower objective value and ran in to some sort of error status rather than detecting that it is in a local minima. This object tracks the minima found for each... | the_stack_v2_python_sparse | dit/utils/optimization.py | dit/dit | train | 468 |
edc58cecc83ea494cd5301bda66b0d51b03f6718 | [
"solution_cells = []\nwith self.gradebook as gb:\n num_submissions = len(gb.notebook_submissions(notebook_id, assignment_id))\n notebook_id = gb.find_notebook(notebook_id, assignment_id).id\n for cell_name in gb.db.query(BaseCell.name).filter(BaseCell.type == 'SolutionCell').filter(BaseCell.notebook_id == ... | <|body_start_0|>
solution_cells = []
with self.gradebook as gb:
num_submissions = len(gb.notebook_submissions(notebook_id, assignment_id))
notebook_id = gb.find_notebook(notebook_id, assignment_id).id
for cell_name in gb.db.query(BaseCell.name).filter(BaseCell.type ==... | E2xAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class E2xAPI:
def get_solution_cell_ids(self, assignment_id, notebook_id):
"""Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name of the assignment notebook_id: string The name of the notebook Returns ------- solution_cells:... | stack_v2_sparse_classes_75kplus_train_071148 | 6,177 | permissive | [
{
"docstring": "Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name of the assignment notebook_id: string The name of the notebook Returns ------- solution_cells: dict A dictionary containing information about the solution cells",
"name":... | 2 | stack_v2_sparse_classes_30k_train_024105 | Implement the Python class `E2xAPI` described below.
Class description:
Implement the E2xAPI class.
Method signatures and docstrings:
- def get_solution_cell_ids(self, assignment_id, notebook_id): Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name... | Implement the Python class `E2xAPI` described below.
Class description:
Implement the E2xAPI class.
Method signatures and docstrings:
- def get_solution_cell_ids(self, assignment_id, notebook_id): Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name... | 19eb4662e4eee5ddef673097517e4bd4fb469e62 | <|skeleton|>
class E2xAPI:
def get_solution_cell_ids(self, assignment_id, notebook_id):
"""Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name of the assignment notebook_id: string The name of the notebook Returns ------- solution_cells:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class E2xAPI:
def get_solution_cell_ids(self, assignment_id, notebook_id):
"""Get information about the solution cells of a notebook given its name. Arguments --------- assignment_id: string The name of the assignment notebook_id: string The name of the notebook Returns ------- solution_cells: dict A dictio... | the_stack_v2_python_sparse | e2xgrader/apps/api.py | divindevaiah/e2xgrader | train | 0 | |
f4d5e52b45ac7ae4e8273441f7d2dba5462441e0 | [
"xblock_settings = self.get_xblock_settings(default={})\nif xblock_settings and self.theme_key in xblock_settings:\n return xblock_settings[self.theme_key]\nreturn self.default_theme_config",
"theme = self.get_theme()\nif not theme or 'package' not in theme:\n return\ntheme_package, theme_files = (theme.get... | <|body_start_0|>
xblock_settings = self.get_xblock_settings(default={})
if xblock_settings and self.theme_key in xblock_settings:
return xblock_settings[self.theme_key]
return self.default_theme_config
<|end_body_0|>
<|body_start_1|>
theme = self.get_theme()
if not t... | This XBlock Mixin provides configurable theme support via Settings Service. This mixin implies XBlockWithSettingsMixin is already mixed in into Descendant XBlock Parameters: default_theme_config: dict - default theme configuration in case no theme configuration is obtained from Settings Service theme_key: string - XBlo... | ThemableXBlockMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThemableXBlockMixin:
"""This XBlock Mixin provides configurable theme support via Settings Service. This mixin implies XBlockWithSettingsMixin is already mixed in into Descendant XBlock Parameters: default_theme_config: dict - default theme configuration in case no theme configuration is obtained... | stack_v2_sparse_classes_75kplus_train_071149 | 3,583 | no_license | [
{
"docstring": "Gets theme settings from settings service. Falls back to default (LMS) theme if settings service is not available, xblock theme settings are not set or does contain mentoring theme settings.",
"name": "get_theme",
"signature": "def get_theme(self)"
},
{
"docstring": "Gets theme c... | 2 | stack_v2_sparse_classes_30k_train_047962 | Implement the Python class `ThemableXBlockMixin` described below.
Class description:
This XBlock Mixin provides configurable theme support via Settings Service. This mixin implies XBlockWithSettingsMixin is already mixed in into Descendant XBlock Parameters: default_theme_config: dict - default theme configuration in ... | Implement the Python class `ThemableXBlockMixin` described below.
Class description:
This XBlock Mixin provides configurable theme support via Settings Service. This mixin implies XBlockWithSettingsMixin is already mixed in into Descendant XBlock Parameters: default_theme_config: dict - default theme configuration in ... | 73fec97eb2850e67e5f57e391641116465424d88 | <|skeleton|>
class ThemableXBlockMixin:
"""This XBlock Mixin provides configurable theme support via Settings Service. This mixin implies XBlockWithSettingsMixin is already mixed in into Descendant XBlock Parameters: default_theme_config: dict - default theme configuration in case no theme configuration is obtained... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ThemableXBlockMixin:
"""This XBlock Mixin provides configurable theme support via Settings Service. This mixin implies XBlockWithSettingsMixin is already mixed in into Descendant XBlock Parameters: default_theme_config: dict - default theme configuration in case no theme configuration is obtained from Setting... | the_stack_v2_python_sparse | edx/app/edxapp/venvs/edxapp/lib/python2.7/site-packages/xblockutils/settings.py | AlaaSwedan/edx | train | 0 |
c7d90052fa955c62f73fa12fb846009a75fcc266 | [
"LSDataset.__init__(self, dpath)\nlogger.debug('Initializing prediction dataset')\nself.ppath = ppath\nself.prob_desc = prob_desc\nif pfiles is not None:\n self.pfiles = pfiles\nelse:\n self.pfiles = []\n pat = re.compile('pipeline_[0-9]*.csv', re.IGNORECASE)\n for fpath, dirs, files in os.walk(ppath):\... | <|body_start_0|>
LSDataset.__init__(self, dpath)
logger.debug('Initializing prediction dataset')
self.ppath = ppath
self.prob_desc = prob_desc
if pfiles is not None:
self.pfiles = pfiles
else:
self.pfiles = []
pat = re.compile('pipeline... | Class representing a remote dataset with prediction results | LSPrediction | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LSPrediction:
"""Class representing a remote dataset with prediction results"""
def __init__(self, dpath, ppath, prob_desc=None, pfiles=None):
"""inputs: dpath - the path to the dataset root ppath - the path the the prediction results file(s) directory root prob_desc - the path to th... | stack_v2_sparse_classes_75kplus_train_071150 | 4,423 | permissive | [
{
"docstring": "inputs: dpath - the path to the dataset root ppath - the path the the prediction results file(s) directory root prob_desc - the path to the problem description schema file that describes the prediction",
"name": "__init__",
"signature": "def __init__(self, dpath, ppath, prob_desc=None, p... | 3 | stack_v2_sparse_classes_30k_train_044970 | Implement the Python class `LSPrediction` described below.
Class description:
Class representing a remote dataset with prediction results
Method signatures and docstrings:
- def __init__(self, dpath, ppath, prob_desc=None, pfiles=None): inputs: dpath - the path to the dataset root ppath - the path the the prediction ... | Implement the Python class `LSPrediction` described below.
Class description:
Class representing a remote dataset with prediction results
Method signatures and docstrings:
- def __init__(self, dpath, ppath, prob_desc=None, pfiles=None): inputs: dpath - the path to the dataset root ppath - the path the the prediction ... | b0490262d3db5307c37f82c92e25cd938dd3a242 | <|skeleton|>
class LSPrediction:
"""Class representing a remote dataset with prediction results"""
def __init__(self, dpath, ppath, prob_desc=None, pfiles=None):
"""inputs: dpath - the path to the dataset root ppath - the path the the prediction results file(s) directory root prob_desc - the path to th... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LSPrediction:
"""Class representing a remote dataset with prediction results"""
def __init__(self, dpath, ppath, prob_desc=None, pfiles=None):
"""inputs: dpath - the path to the dataset root ppath - the path the the prediction results file(s) directory root prob_desc - the path to the problem des... | the_stack_v2_python_sparse | lib/ls_dataset/ls_prediction.py | stevencdang/AutoML-DS-Components | train | 0 |
8b0b9b71a3dc88b781698ae05bf1dad7831910ed | [
"m, n = (len(multipliers), len(nums))\n\n@cache\ndef dp(i, j, pos) -> int:\n if i > j or pos >= m:\n return 0\n cur_mul = multipliers[pos]\n if i == j:\n return cur_mul * nums[i]\n return max(dp(i + 1, j, pos + 1) + nums[i] * cur_mul, dp(i, j - 1, pos + 1) + nums[j] * cur_mul)\nreturn dp(0... | <|body_start_0|>
m, n = (len(multipliers), len(nums))
@cache
def dp(i, j, pos) -> int:
if i > j or pos >= m:
return 0
cur_mul = multipliers[pos]
if i == j:
return cur_mul * nums[i]
return max(dp(i + 1, j, pos + 1) +... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maximumScore3(self, nums: List[int], multipliers: List[int]) -> int:
"""2022-09-16 LTE on Python again! n == nums.length m == multipliers.length 1 <= m <= 10^3 m <= n <= 10^5 -1000 <= nums[i], multipliers[i] <= 1000"""
<|body_0|>
def maximumScore2(self, nums: L... | stack_v2_sparse_classes_75kplus_train_071151 | 3,136 | permissive | [
{
"docstring": "2022-09-16 LTE on Python again! n == nums.length m == multipliers.length 1 <= m <= 10^3 m <= n <= 10^5 -1000 <= nums[i], multipliers[i] <= 1000",
"name": "maximumScore3",
"signature": "def maximumScore3(self, nums: List[int], multipliers: List[int]) -> int"
},
{
"docstring": "CRE... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumScore3(self, nums: List[int], multipliers: List[int]) -> int: 2022-09-16 LTE on Python again! n == nums.length m == multipliers.length 1 <= m <= 10^3 m <= n <= 10^5 -1... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maximumScore3(self, nums: List[int], multipliers: List[int]) -> int: 2022-09-16 LTE on Python again! n == nums.length m == multipliers.length 1 <= m <= 10^3 m <= n <= 10^5 -1... | 4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5 | <|skeleton|>
class Solution:
def maximumScore3(self, nums: List[int], multipliers: List[int]) -> int:
"""2022-09-16 LTE on Python again! n == nums.length m == multipliers.length 1 <= m <= 10^3 m <= n <= 10^5 -1000 <= nums[i], multipliers[i] <= 1000"""
<|body_0|>
def maximumScore2(self, nums: L... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def maximumScore3(self, nums: List[int], multipliers: List[int]) -> int:
"""2022-09-16 LTE on Python again! n == nums.length m == multipliers.length 1 <= m <= 10^3 m <= n <= 10^5 -1000 <= nums[i], multipliers[i] <= 1000"""
m, n = (len(multipliers), len(nums))
@cache
... | the_stack_v2_python_sparse | src/1770-MaximumScoreFromPerformingMultiplicationOperations.py | Jiezhi/myleetcode | train | 1 | |
d7c2199cb0604fb803804f5ca9de01f0d9afcab8 | [
"self._Ms = (Fsum(), Fsum())\nif name:\n self.name = name\nif xs:\n self.fadd(xs)",
"if isinstance(other, Fwelford):\n nb = len(other)\n if nb > 0:\n na = len(self)\n if na > 0:\n M, S = self._Ms\n M_, S_ = other._Ms\n n = na + nb\n n_ = float(... | <|body_start_0|>
self._Ms = (Fsum(), Fsum())
if name:
self.name = name
if xs:
self.fadd(xs)
<|end_body_0|>
<|body_start_1|>
if isinstance(other, Fwelford):
nb = len(other)
if nb > 0:
na = len(self)
if na > 0... | U{Welford<https://WikiPedia.org/wiki/Algorithms_for_calculating_variance>}'s accumulator computing the running mean, (sample) variance and standard deviation. @see: U{Cook<https://www.JohnDCook.com/blog/standard_deviation/>} and L{Fcook}. | Fwelford | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Fwelford:
"""U{Welford<https://WikiPedia.org/wiki/Algorithms_for_calculating_variance>}'s accumulator computing the running mean, (sample) variance and standard deviation. @see: U{Cook<https://www.JohnDCook.com/blog/standard_deviation/>} and L{Fcook}."""
def __init__(self, xs=None, name=NN):... | stack_v2_sparse_classes_75kplus_train_071152 | 25,484 | permissive | [
{
"docstring": "New L{Fwelford} stats accumulator. @kwarg xs: Iterable with initial values (C{Scalar}s). @kwarg name: Optional name (C{str}). @see: Method L{Fwelford.fadd}.",
"name": "__init__",
"signature": "def __init__(self, xs=None, name=NN)"
},
{
"docstring": "Add B{C{other}} to this L{Fwel... | 3 | stack_v2_sparse_classes_30k_train_035311 | Implement the Python class `Fwelford` described below.
Class description:
U{Welford<https://WikiPedia.org/wiki/Algorithms_for_calculating_variance>}'s accumulator computing the running mean, (sample) variance and standard deviation. @see: U{Cook<https://www.JohnDCook.com/blog/standard_deviation/>} and L{Fcook}.
Metho... | Implement the Python class `Fwelford` described below.
Class description:
U{Welford<https://WikiPedia.org/wiki/Algorithms_for_calculating_variance>}'s accumulator computing the running mean, (sample) variance and standard deviation. @see: U{Cook<https://www.JohnDCook.com/blog/standard_deviation/>} and L{Fcook}.
Metho... | eba35704b248a7a0388b30f3cea19793921e99b7 | <|skeleton|>
class Fwelford:
"""U{Welford<https://WikiPedia.org/wiki/Algorithms_for_calculating_variance>}'s accumulator computing the running mean, (sample) variance and standard deviation. @see: U{Cook<https://www.JohnDCook.com/blog/standard_deviation/>} and L{Fcook}."""
def __init__(self, xs=None, name=NN):... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Fwelford:
"""U{Welford<https://WikiPedia.org/wiki/Algorithms_for_calculating_variance>}'s accumulator computing the running mean, (sample) variance and standard deviation. @see: U{Cook<https://www.JohnDCook.com/blog/standard_deviation/>} and L{Fcook}."""
def __init__(self, xs=None, name=NN):
"""N... | the_stack_v2_python_sparse | pygeodesy/fstats.py | mrJean1/PyGeodesy | train | 283 |
a35d3b721d3bda8b25c3dec503597fc393dda2fa | [
"self.Whf = np.random.normal(size=(i + h, h))\nself.Whb = np.random.normal(size=(i + h, h))\nself.Wy = np.random.normal(size=(h + h, o))\nself.bhf = np.zeros((1, h))\nself.bhb = np.zeros((1, h))\nself.by = np.zeros((1, o))",
"concat = np.concatenate((h_prev, x_t), axis=1)\nh_next = np.tanh(concat @ self.Whf + sel... | <|body_start_0|>
self.Whf = np.random.normal(size=(i + h, h))
self.Whb = np.random.normal(size=(i + h, h))
self.Wy = np.random.normal(size=(h + h, o))
self.bhf = np.zeros((1, h))
self.bhb = np.zeros((1, h))
self.by = np.zeros((1, o))
<|end_body_0|>
<|body_start_1|>
... | Represents a bidirectional cell of an RNN | BidirectionalCell | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BidirectionalCell:
"""Represents a bidirectional cell of an RNN"""
def __init__(self, i, h, o):
"""Class constructor"""
<|body_0|>
def forward(self, h_prev, x_t):
"""Calculates the hidden state in the forward direction for one time step. Returns: h_next"""
... | stack_v2_sparse_classes_75kplus_train_071153 | 1,460 | no_license | [
{
"docstring": "Class constructor",
"name": "__init__",
"signature": "def __init__(self, i, h, o)"
},
{
"docstring": "Calculates the hidden state in the forward direction for one time step. Returns: h_next",
"name": "forward",
"signature": "def forward(self, h_prev, x_t)"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_031082 | Implement the Python class `BidirectionalCell` described below.
Class description:
Represents a bidirectional cell of an RNN
Method signatures and docstrings:
- def __init__(self, i, h, o): Class constructor
- def forward(self, h_prev, x_t): Calculates the hidden state in the forward direction for one time step. Retu... | Implement the Python class `BidirectionalCell` described below.
Class description:
Represents a bidirectional cell of an RNN
Method signatures and docstrings:
- def __init__(self, i, h, o): Class constructor
- def forward(self, h_prev, x_t): Calculates the hidden state in the forward direction for one time step. Retu... | 161e33b23d398d7d01ad0d7740b78dda3f27e787 | <|skeleton|>
class BidirectionalCell:
"""Represents a bidirectional cell of an RNN"""
def __init__(self, i, h, o):
"""Class constructor"""
<|body_0|>
def forward(self, h_prev, x_t):
"""Calculates the hidden state in the forward direction for one time step. Returns: h_next"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BidirectionalCell:
"""Represents a bidirectional cell of an RNN"""
def __init__(self, i, h, o):
"""Class constructor"""
self.Whf = np.random.normal(size=(i + h, h))
self.Whb = np.random.normal(size=(i + h, h))
self.Wy = np.random.normal(size=(h + h, o))
self.bhf = ... | the_stack_v2_python_sparse | supervised_learning/0x0D-RNNs/6-bi_backward.py | felipeserna/holbertonschool-machine_learning | train | 0 |
85eabc921a215db7dcf82dc69f0cd928cc1f43f7 | [
"if not asnode:\n self.translate_coding_to_rule(rule)\nelse:\n self.rule = rule\n self.human_read = self.rule.visit_easy_read()\n self.polish_notation = self.rule.visit_with_polish_notation()\n self.coding = self.rule.visit_make_coding()\n self.find_needed_premises()\n self.find_conclusions()",... | <|body_start_0|>
if not asnode:
self.translate_coding_to_rule(rule)
else:
self.rule = rule
self.human_read = self.rule.visit_easy_read()
self.polish_notation = self.rule.visit_with_polish_notation()
self.coding = self.rule.visit_make_coding()
... | This class represents a Rule for the rule approach. It has its Coding which is a string of its binary coding, a node named rule which is the starting node of the rule in its tree representation, a string representation of the polish notation of the Rule and an easily human readable representation of the rule. | Rule | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rule:
"""This class represents a Rule for the rule approach. It has its Coding which is a string of its binary coding, a node named rule which is the starting node of the rule in its tree representation, a string representation of the polish notation of the Rule and an easily human readable repre... | stack_v2_sparse_classes_75kplus_train_071154 | 3,168 | permissive | [
{
"docstring": ":param rule: the rule :param asnode: change it to false if you are only passing a lib which should be transformed to a rule. This constructor takes either a Node which represents the starting node of a rule and fills in all other needed information. Or an coding which represents a rule in its bi... | 5 | stack_v2_sparse_classes_30k_train_034452 | Implement the Python class `Rule` described below.
Class description:
This class represents a Rule for the rule approach. It has its Coding which is a string of its binary coding, a node named rule which is the starting node of the rule in its tree representation, a string representation of the polish notation of the ... | Implement the Python class `Rule` described below.
Class description:
This class represents a Rule for the rule approach. It has its Coding which is a string of its binary coding, a node named rule which is the starting node of the rule in its tree representation, a string representation of the polish notation of the ... | ac73fb60387aad37d3b3fb823f9b2c205c6cb458 | <|skeleton|>
class Rule:
"""This class represents a Rule for the rule approach. It has its Coding which is a string of its binary coding, a node named rule which is the starting node of the rule in its tree representation, a string representation of the polish notation of the Rule and an easily human readable repre... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Rule:
"""This class represents a Rule for the rule approach. It has its Coding which is a string of its binary coding, a node named rule which is the starting node of the rule in its tree representation, a string representation of the polish notation of the Rule and an easily human readable representation of ... | the_stack_v2_python_sparse | relational/student_projects/2019_guth/models/Rule_Genetic/Rule.py | CognitiveComputationLab/cogmods | train | 1 |
42ffa662c5f7dd12746030c45d9256227a477f9f | [
"average = 0.168965\nstd_dev = 0.09219\nbetter_sign = -1\nreturn (average, std_dev, better_sign)",
"total = source_data.B07013_001E\nsame_house = source_data.B07013_004E\npercent_same = same_house / float(total)\nreturn 1.0 - percent_same"
] | <|body_start_0|>
average = 0.168965
std_dev = 0.09219
better_sign = -1
return (average, std_dev, better_sign)
<|end_body_0|>
<|body_start_1|>
total = source_data.B07013_001E
same_house = source_data.B07013_004E
percent_same = same_house / float(total)
ret... | Score based on percent who did not live in the same house 1 year ago | PercentGeographicMobilityAlgorithm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PercentGeographicMobilityAlgorithm:
"""Score based on percent who did not live in the same house 1 year ago"""
def get_default_stats(self, source_data):
"""Stats for census tracts in Oklahoma"""
<|body_0|>
def local_percent(self, source_data):
"""Calcuate the per... | stack_v2_sparse_classes_75kplus_train_071155 | 34,944 | no_license | [
{
"docstring": "Stats for census tracts in Oklahoma",
"name": "get_default_stats",
"signature": "def get_default_stats(self, source_data)"
},
{
"docstring": "Calcuate the percent who moved in the last year",
"name": "local_percent",
"signature": "def local_percent(self, source_data)"
}... | 2 | null | Implement the Python class `PercentGeographicMobilityAlgorithm` described below.
Class description:
Score based on percent who did not live in the same house 1 year ago
Method signatures and docstrings:
- def get_default_stats(self, source_data): Stats for census tracts in Oklahoma
- def local_percent(self, source_da... | Implement the Python class `PercentGeographicMobilityAlgorithm` described below.
Class description:
Score based on percent who did not live in the same house 1 year ago
Method signatures and docstrings:
- def get_default_stats(self, source_data): Stats for census tracts in Oklahoma
- def local_percent(self, source_da... | 0d29c3e1599b187c17ea2a2c68f8a9b78f430442 | <|skeleton|>
class PercentGeographicMobilityAlgorithm:
"""Score based on percent who did not live in the same house 1 year ago"""
def get_default_stats(self, source_data):
"""Stats for census tracts in Oklahoma"""
<|body_0|>
def local_percent(self, source_data):
"""Calcuate the per... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PercentGeographicMobilityAlgorithm:
"""Score based on percent who did not live in the same house 1 year ago"""
def get_default_stats(self, source_data):
"""Stats for census tracts in Oklahoma"""
average = 0.168965
std_dev = 0.09219
better_sign = -1
return (average,... | the_stack_v2_python_sparse | healthdata/algorithms.py | CivicNinjas/HealthAround.me | train | 1 |
a68b9565a97edec62497eafc94f3d89a1e5616cc | [
"Part = self.old_state.apps.get_model('part', 'part')\npart = Part.objects.create(name='PART', description='A purchaseable part', purchaseable=True, level=0, tree_id=0, lft=0, rght=0)\nCompany = self.old_state.apps.get_model('company', 'company')\nsupplier = Company.objects.create(name='Supplier', description='A su... | <|body_start_0|>
Part = self.old_state.apps.get_model('part', 'part')
part = Part.objects.create(name='PART', description='A purchaseable part', purchaseable=True, level=0, tree_id=0, lft=0, rght=0)
Company = self.old_state.apps.get_model('company', 'company')
supplier = Company.objects.... | Tests for upgrade from basic currency support to django-money. | TestCurrencyMigration | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCurrencyMigration:
"""Tests for upgrade from basic currency support to django-money."""
def prepare(self):
"""Prepare some data: - A part to buy - A supplier to buy from - A supplier part - Multiple currency objects - Multiple supplier price breaks"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_071156 | 12,626 | permissive | [
{
"docstring": "Prepare some data: - A part to buy - A supplier to buy from - A supplier part - Multiple currency objects - Multiple supplier price breaks",
"name": "prepare",
"signature": "def prepare(self)"
},
{
"docstring": "Test database state after applying migrations",
"name": "test_cu... | 2 | stack_v2_sparse_classes_30k_train_034039 | Implement the Python class `TestCurrencyMigration` described below.
Class description:
Tests for upgrade from basic currency support to django-money.
Method signatures and docstrings:
- def prepare(self): Prepare some data: - A part to buy - A supplier to buy from - A supplier part - Multiple currency objects - Multi... | Implement the Python class `TestCurrencyMigration` described below.
Class description:
Tests for upgrade from basic currency support to django-money.
Method signatures and docstrings:
- def prepare(self): Prepare some data: - A part to buy - A supplier to buy from - A supplier part - Multiple currency objects - Multi... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class TestCurrencyMigration:
"""Tests for upgrade from basic currency support to django-money."""
def prepare(self):
"""Prepare some data: - A part to buy - A supplier to buy from - A supplier part - Multiple currency objects - Multiple supplier price breaks"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestCurrencyMigration:
"""Tests for upgrade from basic currency support to django-money."""
def prepare(self):
"""Prepare some data: - A part to buy - A supplier to buy from - A supplier part - Multiple currency objects - Multiple supplier price breaks"""
Part = self.old_state.apps.get_mo... | the_stack_v2_python_sparse | InvenTree/company/test_migrations.py | inventree/InvenTree | train | 3,077 |
cdc19af05f58fcb427e17f867790974aecb5254a | [
"if remote.ssh:\n return Connection(remote.ssh)\nelif remote.http:\n hostName = urlparse(remote.http).hostname\n username = None\n password = None\n if hostName in httpCredentials:\n username = httpCredentials[hostName].username\n password = httpCredentials[hostName].password\n retur... | <|body_start_0|>
if remote.ssh:
return Connection(remote.ssh)
elif remote.http:
hostName = urlparse(remote.http).hostname
username = None
password = None
if hostName in httpCredentials:
username = httpCredentials[hostName].usern... | Collection of drepo utility functions | Utils | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Utils:
"""Collection of drepo utility functions"""
def createQueryConnection(remote, httpCredentials):
"""Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCredentials A map of HTTP credentials"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus_train_071157 | 3,013 | permissive | [
{
"docstring": "Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCredentials A map of HTTP credentials",
"name": "createQueryConnection",
"signature": "def createQueryConnection(remote, httpCredentials)"
},
{
"docstring": "Inje... | 2 | stack_v2_sparse_classes_30k_train_047395 | Implement the Python class `Utils` described below.
Class description:
Collection of drepo utility functions
Method signatures and docstrings:
- def createQueryConnection(remote, httpCredentials): Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCre... | Implement the Python class `Utils` described below.
Class description:
Collection of drepo utility functions
Method signatures and docstrings:
- def createQueryConnection(remote, httpCredentials): Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCre... | 58a035a08a7c58035c25f992c1b8aa33cc997cd2 | <|skeleton|>
class Utils:
"""Collection of drepo utility functions"""
def createQueryConnection(remote, httpCredentials):
"""Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCredentials A map of HTTP credentials"""
<|body_0|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Utils:
"""Collection of drepo utility functions"""
def createQueryConnection(remote, httpCredentials):
"""Create a query connection (HTTP or SSH) based on what's available in the given remote @param remote Remote @param httpCredentials A map of HTTP credentials"""
if remote.ssh:
... | the_stack_v2_python_sparse | du/drepo/Utils.py | spiricn/DevUtils | train | 1 |
20d047b4d4b6913165b6ea25d69f7f67488e9409 | [
"data = str(bin(int(value)))[::-1]\nself.read_paired = self.__bitIsSet(data, 0)\nself.read_mapped_in_proper_pair = self.__bitIsSet(data, 1)\nself.read_unmapped = self.__bitIsSet(data, 2)\nself.mate_unmapped = self.__bitIsSet(data, 3)\nself.read_reverse_strand = self.__bitIsSet(data, 4)\nself.mate_reverse_strand = s... | <|body_start_0|>
data = str(bin(int(value)))[::-1]
self.read_paired = self.__bitIsSet(data, 0)
self.read_mapped_in_proper_pair = self.__bitIsSet(data, 1)
self.read_unmapped = self.__bitIsSet(data, 2)
self.mate_unmapped = self.__bitIsSet(data, 3)
self.read_reverse_strand =... | Class to decode bitwise flag from SAM file. Deconvolutes the decimal value of the bitwise flag from a SAM alignment line. The following class properties are set accordingly and can be queried: read_paired read_mapped_in_proper_pair read_unmapped mate_unmapped read_reverse_strand mate_reverse_strand first_in_pair second... | SAMBitwiseFlag | [
"Artistic-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SAMBitwiseFlag:
"""Class to decode bitwise flag from SAM file. Deconvolutes the decimal value of the bitwise flag from a SAM alignment line. The following class properties are set accordingly and can be queried: read_paired read_mapped_in_proper_pair read_unmapped mate_unmapped read_reverse_stran... | stack_v2_sparse_classes_75kplus_train_071158 | 19,074 | permissive | [
{
"docstring": "Create new SAMBitwiseFlag instance Arguments: value: the decimal value of the bitwise flag which will be decoded and used to set the properties",
"name": "__init__",
"signature": "def __init__(self, value)"
},
{
"docstring": "Internal: return True or False based on list element v... | 2 | stack_v2_sparse_classes_30k_train_042655 | Implement the Python class `SAMBitwiseFlag` described below.
Class description:
Class to decode bitwise flag from SAM file. Deconvolutes the decimal value of the bitwise flag from a SAM alignment line. The following class properties are set accordingly and can be queried: read_paired read_mapped_in_proper_pair read_un... | Implement the Python class `SAMBitwiseFlag` described below.
Class description:
Class to decode bitwise flag from SAM file. Deconvolutes the decimal value of the bitwise flag from a SAM alignment line. The following class properties are set accordingly and can be queried: read_paired read_mapped_in_proper_pair read_un... | ca0c7c239b0f04353e2f2fa897db9c24a1211596 | <|skeleton|>
class SAMBitwiseFlag:
"""Class to decode bitwise flag from SAM file. Deconvolutes the decimal value of the bitwise flag from a SAM alignment line. The following class properties are set accordingly and can be queried: read_paired read_mapped_in_proper_pair read_unmapped mate_unmapped read_reverse_stran... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SAMBitwiseFlag:
"""Class to decode bitwise flag from SAM file. Deconvolutes the decimal value of the bitwise flag from a SAM alignment line. The following class properties are set accordingly and can be queried: read_paired read_mapped_in_proper_pair read_unmapped mate_unmapped read_reverse_strand mate_revers... | the_stack_v2_python_sparse | NGS-general/sam2soap.py | golharam/genomics | train | 0 |
dea4f6ae35cc301bf4a0dd28cf94934a513af907 | [
"if not settings.PRODUCTION_ENVIRONMENT and (not settings.TESTING):\n self.get_response = get_response\nelse:\n raise MiddlewareNotUsed()",
"try:\n if RESEARCH_ACTIVE:\n self.process_request(request)\nexcept LoginRequired:\n messages.warning(request, 'You need to be logged in to access this pag... | <|body_start_0|>
if not settings.PRODUCTION_ENVIRONMENT and (not settings.TESTING):
self.get_response = get_response
else:
raise MiddlewareNotUsed()
<|end_body_0|>
<|body_start_1|>
try:
if RESEARCH_ACTIVE:
self.process_request(request)
... | Middleware used with research application. | ResearchMiddleware | [
"MIT",
"AGPL-3.0-only",
"ISC",
"LGPL-2.1-or-later",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResearchMiddleware:
"""Middleware used with research application."""
def __init__(self, get_response):
"""One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing."""
<|body_0|>
def __call__(self, reques... | stack_v2_sparse_classes_75kplus_train_071159 | 4,205 | permissive | [
{
"docstring": "One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing.",
"name": "__init__",
"signature": "def __init__(self, get_response)"
},
{
"docstring": "Logic for middleware.",
"name": "__call__",
"signature": ... | 3 | stack_v2_sparse_classes_30k_train_013205 | Implement the Python class `ResearchMiddleware` described below.
Class description:
Middleware used with research application.
Method signatures and docstrings:
- def __init__(self, get_response): One-time configuration and initialization. Only load research middleware if running in a staging environment and not test... | Implement the Python class `ResearchMiddleware` described below.
Class description:
Middleware used with research application.
Method signatures and docstrings:
- def __init__(self, get_response): One-time configuration and initialization. Only load research middleware if running in a staging environment and not test... | 5b668eb66449e2ebaeb2177237b9a55a14d69efb | <|skeleton|>
class ResearchMiddleware:
"""Middleware used with research application."""
def __init__(self, get_response):
"""One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing."""
<|body_0|>
def __call__(self, reques... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResearchMiddleware:
"""Middleware used with research application."""
def __init__(self, get_response):
"""One-time configuration and initialization. Only load research middleware if running in a staging environment and not testing."""
if not settings.PRODUCTION_ENVIRONMENT and (not settin... | the_stack_v2_python_sparse | codewof/research/middleware/ResearchMiddleware.py | uccser/codewof | train | 7 |
74f4de9a8bdc9375e2e293fe4d22c6c460ceb66b | [
"if x == 1:\n return 1\nl = 0\nr = x // 2\nwhile l <= r:\n m = l + (r - l) // 2\n s = m * m\n if s == x:\n return m\n elif s < x:\n l = m + 1\n else:\n r = m - 1\nreturn r",
"l = 0\nr = x // 2 + 1\nwhile l <= r:\n m = l + (r - l) // 2\n s = m * m\n if s == x:\n ... | <|body_start_0|>
if x == 1:
return 1
l = 0
r = x // 2
while l <= r:
m = l + (r - l) // 2
s = m * m
if s == x:
return m
elif s < x:
l = m + 1
else:
r = m - 1
ret... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mySqrt1(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if x == 1:
return 1
l = 0
r = x // 2
while... | stack_v2_sparse_classes_75kplus_train_071160 | 2,818 | no_license | [
{
"docstring": ":type x: int :rtype: int",
"name": "mySqrt1",
"signature": "def mySqrt1(self, x)"
},
{
"docstring": ":type x: int :rtype: int",
"name": "mySqrt",
"signature": "def mySqrt(self, x)"
}
] | 2 | stack_v2_sparse_classes_30k_train_049732 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mySqrt1(self, x): :type x: int :rtype: int
- def mySqrt(self, x): :type x: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mySqrt1(self, x): :type x: int :rtype: int
- def mySqrt(self, x): :type x: int :rtype: int
<|skeleton|>
class Solution:
def mySqrt1(self, x):
""":type x: int :r... | 65a59ae827a6153b1e101460a5783720e3ed57bd | <|skeleton|>
class Solution:
def mySqrt1(self, x):
""":type x: int :rtype: int"""
<|body_0|>
def mySqrt(self, x):
""":type x: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def mySqrt1(self, x):
""":type x: int :rtype: int"""
if x == 1:
return 1
l = 0
r = x // 2
while l <= r:
m = l + (r - l) // 2
s = m * m
if s == x:
return m
elif s < x:
l... | the_stack_v2_python_sparse | 17-二分查找/0069-x 的平方根(使用二分查找法).py | luqianchid/LeetCode-Solution-Python | train | 0 | |
a581818271ed4eb61e44668eab368f07706a7291 | [
"self.running = True\nself.total = 0\nself.start = time.time()",
"self.running = True\nself.total = 0\nself.start = time.time()\nreturn self",
"if not self.running:\n self.running = True\n self.start = time.time()\nreturn self",
"if self.running:\n self.running = False\n self.total += time.time() ... | <|body_start_0|>
self.running = True
self.total = 0
self.start = time.time()
<|end_body_0|>
<|body_start_1|>
self.running = True
self.total = 0
self.start = time.time()
return self
<|end_body_1|>
<|body_start_2|>
if not self.running:
self.run... | Computes elapsed time. | Timer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Timer:
"""Computes elapsed time."""
def __init__(self):
"""Initialize timer."""
<|body_0|>
def reset(self):
"""Reset timer to zero."""
<|body_1|>
def resume(self):
"""Resume timer."""
<|body_2|>
def stop(self):
"""Pause t... | stack_v2_sparse_classes_75kplus_train_071161 | 23,309 | permissive | [
{
"docstring": "Initialize timer.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Reset timer to zero.",
"name": "reset",
"signature": "def reset(self)"
},
{
"docstring": "Resume timer.",
"name": "resume",
"signature": "def resume(self)"
},
... | 5 | stack_v2_sparse_classes_30k_train_027623 | Implement the Python class `Timer` described below.
Class description:
Computes elapsed time.
Method signatures and docstrings:
- def __init__(self): Initialize timer.
- def reset(self): Reset timer to zero.
- def resume(self): Resume timer.
- def stop(self): Pause timer.
- def time(self): Get current timer time. | Implement the Python class `Timer` described below.
Class description:
Computes elapsed time.
Method signatures and docstrings:
- def __init__(self): Initialize timer.
- def reset(self): Reset timer to zero.
- def resume(self): Resume timer.
- def stop(self): Pause timer.
- def time(self): Get current timer time.
<|... | e1d899edfb92471552bae153f59ad30aa7fca468 | <|skeleton|>
class Timer:
"""Computes elapsed time."""
def __init__(self):
"""Initialize timer."""
<|body_0|>
def reset(self):
"""Reset timer to zero."""
<|body_1|>
def resume(self):
"""Resume timer."""
<|body_2|>
def stop(self):
"""Pause t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Timer:
"""Computes elapsed time."""
def __init__(self):
"""Initialize timer."""
self.running = True
self.total = 0
self.start = time.time()
def reset(self):
"""Reset timer to zero."""
self.running = True
self.total = 0
self.start = time... | the_stack_v2_python_sparse | parlai/utils/misc.py | facebookresearch/ParlAI | train | 10,943 |
3aa04301ce03aef4c7bc8cd1524c478c1119874d | [
"if self.request.user.is_superuser:\n return UserAdminSerializer\nelif self.request.user.check_group('scheduler'):\n return UserSchedulerSerializer\nreturn super().get_serializer_class()",
"if self.request.user.check_group('customer'):\n return get_user_model().objects.filter(id=self.request.user.id)\nre... | <|body_start_0|>
if self.request.user.is_superuser:
return UserAdminSerializer
elif self.request.user.check_group('scheduler'):
return UserSchedulerSerializer
return super().get_serializer_class()
<|end_body_0|>
<|body_start_1|>
if self.request.user.check_group('... | This ViewSet is for User model but with permissions | UserViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserViewSet:
"""This ViewSet is for User model but with permissions"""
def get_serializer_class(self):
"""This method set serializer to: UserAdminSerializer if user is admin UserSchedulerSerializer if user is scheduler else -> default serializer that is UserCustomerSerializer"""
... | stack_v2_sparse_classes_75kplus_train_071162 | 2,067 | no_license | [
{
"docstring": "This method set serializer to: UserAdminSerializer if user is admin UserSchedulerSerializer if user is scheduler else -> default serializer that is UserCustomerSerializer",
"name": "get_serializer_class",
"signature": "def get_serializer_class(self)"
},
{
"docstring": "This metho... | 2 | stack_v2_sparse_classes_30k_train_001549 | Implement the Python class `UserViewSet` described below.
Class description:
This ViewSet is for User model but with permissions
Method signatures and docstrings:
- def get_serializer_class(self): This method set serializer to: UserAdminSerializer if user is admin UserSchedulerSerializer if user is scheduler else -> ... | Implement the Python class `UserViewSet` described below.
Class description:
This ViewSet is for User model but with permissions
Method signatures and docstrings:
- def get_serializer_class(self): This method set serializer to: UserAdminSerializer if user is admin UserSchedulerSerializer if user is scheduler else -> ... | 61643325199472b4d6a1f91586253de33ec28fd3 | <|skeleton|>
class UserViewSet:
"""This ViewSet is for User model but with permissions"""
def get_serializer_class(self):
"""This method set serializer to: UserAdminSerializer if user is admin UserSchedulerSerializer if user is scheduler else -> default serializer that is UserCustomerSerializer"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserViewSet:
"""This ViewSet is for User model but with permissions"""
def get_serializer_class(self):
"""This method set serializer to: UserAdminSerializer if user is admin UserSchedulerSerializer if user is scheduler else -> default serializer that is UserCustomerSerializer"""
if self.r... | the_stack_v2_python_sparse | base/views.py | shahinAbolqasemi/video-manager | train | 1 |
de1faee1b1d9c50da689bcf2ee8effdc79fcca02 | [
"self.polarity = polarity\nself.bits = bits\nself.d29 = bits[28]\nself.d30 = bits[29]\nself.dStarArray = np.array([d29, d30, d29, d30, d30, d29])\nself.bitstring = None\nself.paritypass = None\nself._check_parity()",
"assert self.polarity == self.dStarArray[1]\np = self.dStarArray[1] * PARITY_MAT * self.bits[0:24... | <|body_start_0|>
self.polarity = polarity
self.bits = bits
self.d29 = bits[28]
self.d30 = bits[29]
self.dStarArray = np.array([d29, d30, d29, d30, d30, d29])
self.bitstring = None
self.paritypass = None
self._check_parity()
<|end_body_0|>
<|body_start_1|>... | Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word. | Word | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Word:
"""Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word."""
def __init__(self, polarity, d29, d30, bits):
"""Constructs the libgnss.Word object. @type polarity : int @param polarity : This ... | stack_v2_sparse_classes_75kplus_train_071163 | 13,801 | permissive | [
{
"docstring": "Constructs the libgnss.Word object. @type polarity : int @param polarity : This is the polarity of the incoming navigation data bits. It can be either a 1 or a -1. Flip the bits if -1. Note: Polarity is determined by -d30 of the previous word. Note: Polarity of first word is determined by preamb... | 2 | stack_v2_sparse_classes_30k_train_001103 | Implement the Python class `Word` described below.
Class description:
Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word.
Method signatures and docstrings:
- def __init__(self, polarity, d29, d30, bits): Constructs the libgnss.... | Implement the Python class `Word` described below.
Class description:
Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word.
Method signatures and docstrings:
- def __init__(self, polarity, d29, d30, bits): Constructs the libgnss.... | 2420a859be9dfe68df62f6db3f7bbd6f151f2936 | <|skeleton|>
class Word:
"""Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word."""
def __init__(self, polarity, d29, d30, bits):
"""Constructs the libgnss.Word object. @type polarity : int @param polarity : This ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Word:
"""Instances of the libgnss.Word class are containers for holding thirty bits of navigation data, plus the d29 and d30 bits of the previous word."""
def __init__(self, polarity, d29, d30, bits):
"""Constructs the libgnss.Word object. @type polarity : int @param polarity : This is the polari... | the_stack_v2_python_sparse | pygnss/pythonreceiver/libgnss/ephemeris.py | GnssTao/NavLab-DPE-SDR | train | 0 |
bc81200a2e2b2f7dba09d85ff95f67f5d367c4ec | [
"self.driver.get(url)\nself.driver.max_window()\nself.driver.find_element(locator.HeaderLocator.about_button).click()\nself.driver.pause(3)\nself.driver.switch_to_window()\nabout_is_dispayed = self.driver.is_display(locator.HeaderLocator.about_title)\nself.driver.pause(3)\ntt_check.assertTrue(about_is_dispayed, '关于... | <|body_start_0|>
self.driver.get(url)
self.driver.max_window()
self.driver.find_element(locator.HeaderLocator.about_button).click()
self.driver.pause(3)
self.driver.switch_to_window()
about_is_dispayed = self.driver.is_display(locator.HeaderLocator.about_title)
se... | about | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class about:
def test_about(self):
"""测试首页底部关于淘车-跳转,@author:xulanzhong"""
<|body_0|>
def test_contact(self):
"""测试首页底部联系我们-跳转,@author:xulanzhong"""
<|body_1|>
def test_B_lisence(self):
"""测试首页底部营业执照-跳转,@author:xulanzhong"""
<|body_2|>
def ... | stack_v2_sparse_classes_75kplus_train_071164 | 2,780 | no_license | [
{
"docstring": "测试首页底部关于淘车-跳转,@author:xulanzhong",
"name": "test_about",
"signature": "def test_about(self)"
},
{
"docstring": "测试首页底部联系我们-跳转,@author:xulanzhong",
"name": "test_contact",
"signature": "def test_contact(self)"
},
{
"docstring": "测试首页底部营业执照-跳转,@author:xulanzhong",
... | 5 | stack_v2_sparse_classes_30k_train_041373 | Implement the Python class `about` described below.
Class description:
Implement the about class.
Method signatures and docstrings:
- def test_about(self): 测试首页底部关于淘车-跳转,@author:xulanzhong
- def test_contact(self): 测试首页底部联系我们-跳转,@author:xulanzhong
- def test_B_lisence(self): 测试首页底部营业执照-跳转,@author:xulanzhong
- def tes... | Implement the Python class `about` described below.
Class description:
Implement the about class.
Method signatures and docstrings:
- def test_about(self): 测试首页底部关于淘车-跳转,@author:xulanzhong
- def test_contact(self): 测试首页底部联系我们-跳转,@author:xulanzhong
- def test_B_lisence(self): 测试首页底部营业执照-跳转,@author:xulanzhong
- def tes... | 204856bd33c06d25f2970eba13799db75d4fd4fe | <|skeleton|>
class about:
def test_about(self):
"""测试首页底部关于淘车-跳转,@author:xulanzhong"""
<|body_0|>
def test_contact(self):
"""测试首页底部联系我们-跳转,@author:xulanzhong"""
<|body_1|>
def test_B_lisence(self):
"""测试首页底部营业执照-跳转,@author:xulanzhong"""
<|body_2|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class about:
def test_about(self):
"""测试首页底部关于淘车-跳转,@author:xulanzhong"""
self.driver.get(url)
self.driver.max_window()
self.driver.find_element(locator.HeaderLocator.about_button).click()
self.driver.pause(3)
self.driver.switch_to_window()
about_is_dispayed =... | the_stack_v2_python_sparse | mc/taochePC/test_crawler/test_homepage/test_about.py | boeai/mc | train | 0 | |
b12511c8f25bc8035ebc41c83481b5c99a793149 | [
"self.capacity = capacity\nself.Cache = []\nself.Dict = {}",
"if key in self.Cache:\n key_index = self.Cache.index(key)\n p = self.Cache.pop(key_index)\n self.Cache.insert(0, p)\n return self.Dict[key]\nelse:\n return -1",
"if key in self.Cache:\n key_index = self.Cache.index(key)\n p = sel... | <|body_start_0|>
self.capacity = capacity
self.Cache = []
self.Dict = {}
<|end_body_0|>
<|body_start_1|>
if key in self.Cache:
key_index = self.Cache.index(key)
p = self.Cache.pop(key_index)
self.Cache.insert(0, p)
return self.Dict[key]
... | LRUCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_75kplus_train_071165 | 2,120 | no_license | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 3 | stack_v2_sparse_classes_30k_test_002496 | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
<|sk... | 4105e18050b15fc0409c75353ad31be17187dd34 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.Cache = []
self.Dict = {}
def get(self, key):
""":type key: int :rtype: int"""
if key in self.Cache:
key_index = self.Cache.index(key)
p ... | the_stack_v2_python_sparse | LRUCache.py | NeilWangziyu/Leetcode_py | train | 2 | |
38ac240f13db253aeb25a3a7b48b18dcc3345811 | [
"if not prev_step is None:\n SampleQsubProcess.__init__(self, config, key=key, input_dir=prev_step.output_dir, output_dir=prev_step.output_dir, process_name=process_name, **kwargs)\nelif not input_dir is None and (not output_dir is None):\n SampleQsubProcess.__init__(self, config, key=key, input_dir=input_dir... | <|body_start_0|>
if not prev_step is None:
SampleQsubProcess.__init__(self, config, key=key, input_dir=prev_step.output_dir, output_dir=prev_step.output_dir, process_name=process_name, **kwargs)
elif not input_dir is None and (not output_dir is None):
SampleQsubProcess.__init__(s... | Manage and stores info for the Zcat process. This is the process that decompresses and moves fastq files from storage to the processing directories. | FastQC | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FastQC:
"""Manage and stores info for the Zcat process. This is the process that decompresses and moves fastq files from storage to the processing directories."""
def __init__(self, config, key=int(-1), prev_step=None, process_name='fastqc', input_dir=None, output_dir=None, **kwargs):
... | stack_v2_sparse_classes_75kplus_train_071166 | 2,027 | no_license | [
{
"docstring": "Initializes the zcat process object.",
"name": "__init__",
"signature": "def __init__(self, config, key=int(-1), prev_step=None, process_name='fastqc', input_dir=None, output_dir=None, **kwargs)"
},
{
"docstring": "Check to the complete file of the zcat process and handles notifi... | 2 | null | Implement the Python class `FastQC` described below.
Class description:
Manage and stores info for the Zcat process. This is the process that decompresses and moves fastq files from storage to the processing directories.
Method signatures and docstrings:
- def __init__(self, config, key=int(-1), prev_step=None, proce... | Implement the Python class `FastQC` described below.
Class description:
Manage and stores info for the Zcat process. This is the process that decompresses and moves fastq files from storage to the processing directories.
Method signatures and docstrings:
- def __init__(self, config, key=int(-1), prev_step=None, proce... | d05f7849139d6396a7a2d3905b76cd64dcbc96dc | <|skeleton|>
class FastQC:
"""Manage and stores info for the Zcat process. This is the process that decompresses and moves fastq files from storage to the processing directories."""
def __init__(self, config, key=int(-1), prev_step=None, process_name='fastqc', input_dir=None, output_dir=None, **kwargs):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FastQC:
"""Manage and stores info for the Zcat process. This is the process that decompresses and moves fastq files from storage to the processing directories."""
def __init__(self, config, key=int(-1), prev_step=None, process_name='fastqc', input_dir=None, output_dir=None, **kwargs):
"""Initiali... | the_stack_v2_python_sparse | pipeline/processes/fastqc/models.py | billyziege/pipeline_project | train | 0 |
4c11945770efad48978903132ba77619cc967fe3 | [
"self.kode_type_field = kode_type_field\nself.kode_tekst_field = kode_tekst_field\nself.navn_field = navn_field\nself.gate_adresse_field = gate_adresse_field\nself.gate_postboks_field = gate_postboks_field\nself.gate_postnr_field = gate_postnr_field\nself.gate_poststed_field = gate_poststed_field\nself.post_adresse... | <|body_start_0|>
self.kode_type_field = kode_type_field
self.kode_tekst_field = kode_tekst_field
self.navn_field = navn_field
self.gate_adresse_field = gate_adresse_field
self.gate_postboks_field = gate_postboks_field
self.gate_postnr_field = gate_postnr_field
sel... | Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type description here. gate_adresse_field (string): TODO: type description here. gate_postbo... | NavnAdresse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NavnAdresse:
"""Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type description here. gate_adresse_field (string): T... | stack_v2_sparse_classes_75kplus_train_071167 | 4,971 | permissive | [
{
"docstring": "Constructor for the NavnAdresse class",
"name": "__init__",
"signature": "def __init__(self, kode_type_field=None, kode_tekst_field=None, navn_field=None, gate_adresse_field=None, gate_postboks_field=None, gate_postnr_field=None, gate_poststed_field=None, post_adresse_field=None, post_po... | 2 | stack_v2_sparse_classes_30k_train_015776 | Implement the Python class `NavnAdresse` described below.
Class description:
Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type descripti... | Implement the Python class `NavnAdresse` described below.
Class description:
Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type descripti... | fa3918a6c54ea0eedb9146578645b7eb1755b642 | <|skeleton|>
class NavnAdresse:
"""Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type description here. gate_adresse_field (string): T... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NavnAdresse:
"""Implementation of the 'NavnAdresse' model. TODO: type model description here. Attributes: kode_type_field (string): TODO: type description here. kode_tekst_field (string): TODO: type description here. navn_field (string): TODO: type description here. gate_adresse_field (string): TODO: type des... | the_stack_v2_python_sparse | idfy_rest_client/models/navn_adresse.py | dealflowteam/Idfy | train | 0 |
7e5bbc300ae16bf96def637a26487cc9dfdc5493 | [
"title = definition['title']\ndescription = definition.get('description')\nanalysis, created = self.get_or_create(title=title, description=description)\nversions = definition.get('versions', [])\nversions_created = AnalysisVersion.objects.from_list(analysis, versions)\nreturn (analysis, created, versions_created)",... | <|body_start_0|>
title = definition['title']
description = definition.get('description')
analysis, created = self.get_or_create(title=title, description=description)
versions = definition.get('versions', [])
versions_created = AnalysisVersion.objects.from_list(analysis, versions)... | Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class. | AnalysisManager | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnalysisManager:
"""Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class."""
def from_dict(self, definition: dict) -> Tuple[models.Model, bool, bool]:
"""Gets or creates an :class:`~django_analyses.models.analysis.Analysis` instan... | stack_v2_sparse_classes_75kplus_train_071168 | 2,477 | permissive | [
{
"docstring": "Gets or creates an :class:`~django_analyses.models.analysis.Analysis` instance based on a dictionary definition. Parameters ---------- definition : dict Analysis definition Returns ------- Tuple[models.Model, bool, bool] analysis, created, versions_created See Also -------- * :ref:`user_guide/an... | 2 | stack_v2_sparse_classes_30k_test_002119 | Implement the Python class `AnalysisManager` described below.
Class description:
Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class.
Method signatures and docstrings:
- def from_dict(self, definition: dict) -> Tuple[models.Model, bool, bool]: Gets or creates an ... | Implement the Python class `AnalysisManager` described below.
Class description:
Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class.
Method signatures and docstrings:
- def from_dict(self, definition: dict) -> Tuple[models.Model, bool, bool]: Gets or creates an ... | 5642579660fd09dde4a23bf02ec98a7ec264bceb | <|skeleton|>
class AnalysisManager:
"""Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class."""
def from_dict(self, definition: dict) -> Tuple[models.Model, bool, bool]:
"""Gets or creates an :class:`~django_analyses.models.analysis.Analysis` instan... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AnalysisManager:
"""Custom :class:`~django.db.models.Manager` for the :class:`~django_analyses.models.analysis.Analysis` class."""
def from_dict(self, definition: dict) -> Tuple[models.Model, bool, bool]:
"""Gets or creates an :class:`~django_analyses.models.analysis.Analysis` instance based on a... | the_stack_v2_python_sparse | django_analyses/models/managers/analysis.py | TheLabbingProject/django_analyses | train | 1 |
b998610e6ab9cbfa1ef1766d705ba51903a42a1b | [
"try:\n return self._metadata\nexcept AttributeError:\n self._metadata = {'pages': 1, 'original_resolution': 0, 'original_height': 0, 'original_width': 0, 'original_color_space': 'TBD'}\n return self._metadata",
"print('+- %s.generate_previews called' % self.__class__.__name__)\nprint(' +- Get original... | <|body_start_0|>
try:
return self._metadata
except AttributeError:
self._metadata = {'pages': 1, 'original_resolution': 0, 'original_height': 0, 'original_width': 0, 'original_color_space': 'TBD'}
return self._metadata
<|end_body_0|>
<|body_start_1|>
print('+... | Provides concrete implementation of functionality required by BaseAsset that is common to all assets that are images of some sort (JPG, PNG, etc.) | ImageAsset | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImageAsset:
"""Provides concrete implementation of functionality required by BaseAsset that is common to all assets that are images of some sort (JPG, PNG, etc.)"""
def metadata(self):
"""Gets the metadata associated with the instance"""
<|body_0|>
def generate_previews(... | stack_v2_sparse_classes_75kplus_train_071169 | 13,347 | permissive | [
{
"docstring": "Gets the metadata associated with the instance",
"name": "metadata",
"signature": "def metadata(self)"
},
{
"docstring": "Generates a set of preview-images of the asset.",
"name": "generate_previews",
"signature": "def generate_previews(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_022911 | Implement the Python class `ImageAsset` described below.
Class description:
Provides concrete implementation of functionality required by BaseAsset that is common to all assets that are images of some sort (JPG, PNG, etc.)
Method signatures and docstrings:
- def metadata(self): Gets the metadata associated with the i... | Implement the Python class `ImageAsset` described below.
Class description:
Provides concrete implementation of functionality required by BaseAsset that is common to all assets that are images of some sort (JPG, PNG, etc.)
Method signatures and docstrings:
- def metadata(self): Gets the metadata associated with the i... | 4840b0ee9e155c8ed664886c0aad20d44d48dac2 | <|skeleton|>
class ImageAsset:
"""Provides concrete implementation of functionality required by BaseAsset that is common to all assets that are images of some sort (JPG, PNG, etc.)"""
def metadata(self):
"""Gets the metadata associated with the instance"""
<|body_0|>
def generate_previews(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImageAsset:
"""Provides concrete implementation of functionality required by BaseAsset that is common to all assets that are images of some sort (JPG, PNG, etc.)"""
def metadata(self):
"""Gets the metadata associated with the instance"""
try:
return self._metadata
exce... | the_stack_v2_python_sparse | Chapter04/C04R03_SubclassRegistrationMetaclass.py | PacktPublishing/Python-Object-Oriented-Programming-Cookbook | train | 17 |
57b1e04975007a3ef7f568210e2df10349342df9 | [
"super().__init__(name, 's')\nself.n_points_per_dim = n_points_per_dim\nself.predictions_dict = dict()\nself.hidden_outputs_dict = dict()\nself.x_unique = np.linspace(dataset.test.x.min(axis=1), dataset.test.x.max(axis=1), num=n_points_per_dim, axis=1)\nx_mesh = np.meshgrid(*self.x_unique)\nself.x_pred = np.stack([... | <|body_start_0|>
super().__init__(name, 's')
self.n_points_per_dim = n_points_per_dim
self.predictions_dict = dict()
self.hidden_outputs_dict = dict()
self.x_unique = np.linspace(dataset.test.x.min(axis=1), dataset.test.x.max(axis=1), num=n_points_per_dim, axis=1)
x_mesh ... | This column is for storing predictions of the model during training. Once training is complete, this object can be passed to the plot_predictions_gif object to plot a gif of the predictions evolving during training. See the test_predictions_column function in the Tests/test_columns.py module for a usage example of this... | Predictions | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Predictions:
"""This column is for storing predictions of the model during training. Once training is complete, this object can be passed to the plot_predictions_gif object to plot a gif of the predictions evolving during training. See the test_predictions_column function in the Tests/test_column... | stack_v2_sparse_classes_75kplus_train_071170 | 20,983 | no_license | [
{
"docstring": "Initialise this Predictions column. Inputs: - dataset: dataset that the model is about to be trained on. The training set from this dataset is used to calculate the upper and lower limits of the prediction inputs used by this object - n_points_per_dim: the number of unique prediction inputs to u... | 2 | stack_v2_sparse_classes_30k_train_051605 | Implement the Python class `Predictions` described below.
Class description:
This column is for storing predictions of the model during training. Once training is complete, this object can be passed to the plot_predictions_gif object to plot a gif of the predictions evolving during training. See the test_predictions_c... | Implement the Python class `Predictions` described below.
Class description:
This column is for storing predictions of the model during training. Once training is complete, this object can be passed to the plot_predictions_gif object to plot a gif of the predictions evolving during training. See the test_predictions_c... | 389dbb3c4f84f8498ea879980b82e2cf543e5441 | <|skeleton|>
class Predictions:
"""This column is for storing predictions of the model during training. Once training is complete, this object can be passed to the plot_predictions_gif object to plot a gif of the predictions evolving during training. See the test_predictions_column function in the Tests/test_column... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Predictions:
"""This column is for storing predictions of the model during training. Once training is complete, this object can be passed to the plot_predictions_gif object to plot a gif of the predictions evolving during training. See the test_predictions_column function in the Tests/test_columns.py module f... | the_stack_v2_python_sparse | optimisers/columns.py | jakelevi1996/backprop2 | train | 0 |
0a98861fa43c1a7bd2ebcadb706761d0b98bec02 | [
"self.res = []\ncol, left, right = (defaultdict(int), defaultdict(int), defaultdict(int))\nboard = [['.' for i in range(n)] for j in range(n)]\nself.dfs(n, board, -1, col, left, right)\nreturn self.res",
"if k == n - 1:\n self.res.append([''.join(board[i]) for i in range(n)])\n return\nfor c in range(n):\n ... | <|body_start_0|>
self.res = []
col, left, right = (defaultdict(int), defaultdict(int), defaultdict(int))
board = [['.' for i in range(n)] for j in range(n)]
self.dfs(n, board, -1, col, left, right)
return self.res
<|end_body_0|>
<|body_start_1|>
if k == n - 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def solveNQueens(self, n):
""":type n: int :rtype: List[List[str]]"""
<|body_0|>
def dfs(self, n, board, k, col, left, right):
""":type board: List[str] :type k: int (k queens has been in the board) :type res: List[List[str]] :type col: dict[int] :rtype: bo... | stack_v2_sparse_classes_75kplus_train_071171 | 1,234 | no_license | [
{
"docstring": ":type n: int :rtype: List[List[str]]",
"name": "solveNQueens",
"signature": "def solveNQueens(self, n)"
},
{
"docstring": ":type board: List[str] :type k: int (k queens has been in the board) :type res: List[List[str]] :type col: dict[int] :rtype: boolean",
"name": "dfs",
... | 2 | stack_v2_sparse_classes_30k_train_045519 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solveNQueens(self, n): :type n: int :rtype: List[List[str]]
- def dfs(self, n, board, k, col, left, right): :type board: List[str] :type k: int (k queens has been in the boar... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solveNQueens(self, n): :type n: int :rtype: List[List[str]]
- def dfs(self, n, board, k, col, left, right): :type board: List[str] :type k: int (k queens has been in the boar... | 2f46f85e1e297b0a50fdb66956b1d05622a4063d | <|skeleton|>
class Solution:
def solveNQueens(self, n):
""":type n: int :rtype: List[List[str]]"""
<|body_0|>
def dfs(self, n, board, k, col, left, right):
""":type board: List[str] :type k: int (k queens has been in the board) :type res: List[List[str]] :type col: dict[int] :rtype: bo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def solveNQueens(self, n):
""":type n: int :rtype: List[List[str]]"""
self.res = []
col, left, right = (defaultdict(int), defaultdict(int), defaultdict(int))
board = [['.' for i in range(n)] for j in range(n)]
self.dfs(n, board, -1, col, left, right)
r... | the_stack_v2_python_sparse | dan/Problems/Hard/Backtracking/51. N-Queens/solution.py | xudaaaaan/Leetcode | train | 0 | |
d3b2576df88b4d95f81a09b7fed1d79fcfdc6f67 | [
"locator = (By.CSS_SELECTOR, '.js_has_member>div:nth-child(1)>a:nth-child(2)')\n\ndef wait_for_next(x: WebDriver):\n try:\n x.find_element(*locator).click()\n return x.find_element(By.ID, 'username')\n except:\n return False\nWebDriverWait(self.driver, 10).until(wait_for_next)\nfrom Web.w... | <|body_start_0|>
locator = (By.CSS_SELECTOR, '.js_has_member>div:nth-child(1)>a:nth-child(2)')
def wait_for_next(x: WebDriver):
try:
x.find_element(*locator).click()
return x.find_element(By.ID, 'username')
except:
return False
... | MemberList_Add | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MemberList_Add:
def goto_add_member(self):
"""点击人员添加按钮: 1- 首先设置一个显性等待,检查页面的元素是否加载完成 2- 元素加载完成后,进行点击跳转"""
<|body_0|>
def get_member(self, value):
"""新增用户后需要查询到是否新增成功 由于企业当前的人数过多,在web上会产生分页,所以需要处理分页查询(不通过接口)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_071172 | 3,496 | no_license | [
{
"docstring": "点击人员添加按钮: 1- 首先设置一个显性等待,检查页面的元素是否加载完成 2- 元素加载完成后,进行点击跳转",
"name": "goto_add_member",
"signature": "def goto_add_member(self)"
},
{
"docstring": "新增用户后需要查询到是否新增成功 由于企业当前的人数过多,在web上会产生分页,所以需要处理分页查询(不通过接口)",
"name": "get_member",
"signature": "def get_member(self, value)"
... | 2 | null | Implement the Python class `MemberList_Add` described below.
Class description:
Implement the MemberList_Add class.
Method signatures and docstrings:
- def goto_add_member(self): 点击人员添加按钮: 1- 首先设置一个显性等待,检查页面的元素是否加载完成 2- 元素加载完成后,进行点击跳转
- def get_member(self, value): 新增用户后需要查询到是否新增成功 由于企业当前的人数过多,在web上会产生分页,所以需要处理分页查询(不... | Implement the Python class `MemberList_Add` described below.
Class description:
Implement the MemberList_Add class.
Method signatures and docstrings:
- def goto_add_member(self): 点击人员添加按钮: 1- 首先设置一个显性等待,检查页面的元素是否加载完成 2- 元素加载完成后,进行点击跳转
- def get_member(self, value): 新增用户后需要查询到是否新增成功 由于企业当前的人数过多,在web上会产生分页,所以需要处理分页查询(不... | 37513294349591130bfee94ae43cf406129ee040 | <|skeleton|>
class MemberList_Add:
def goto_add_member(self):
"""点击人员添加按钮: 1- 首先设置一个显性等待,检查页面的元素是否加载完成 2- 元素加载完成后,进行点击跳转"""
<|body_0|>
def get_member(self, value):
"""新增用户后需要查询到是否新增成功 由于企业当前的人数过多,在web上会产生分页,所以需要处理分页查询(不通过接口)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MemberList_Add:
def goto_add_member(self):
"""点击人员添加按钮: 1- 首先设置一个显性等待,检查页面的元素是否加载完成 2- 元素加载完成后,进行点击跳转"""
locator = (By.CSS_SELECTOR, '.js_has_member>div:nth-child(1)>a:nth-child(2)')
def wait_for_next(x: WebDriver):
try:
x.find_element(*locator).click()
... | the_stack_v2_python_sparse | Web/wework_demo/Pages/MemberList_Add_Page.py | Dearin/Hogwarts | train | 0 | |
6efa253af6e9cf2cb89ee7a94d1e75b9634c7ab4 | [
"self.traversal = []\nnew_node = NodeBST(value, level_here)\nif not self.item:\n self.item = new_node\nelif value < self.item:\n self.left = self.left and self.left._addNextNode(value, level_here + 1) or new_node\nelse:\n self.right = self.right and self.right._addNextNode(value, level_here + 1) or new_nod... | <|body_start_0|>
self.traversal = []
new_node = NodeBST(value, level_here)
if not self.item:
self.item = new_node
elif value < self.item:
self.left = self.left and self.left._addNextNode(value, level_here + 1) or new_node
else:
self.right = sel... | NodeBST | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NodeBST:
def _addNextNode(self, value, level_here=1):
"""Aux for self.addNode(value): for BST, best O(1), worst O(log n)"""
<|body_0|>
def _searchForNode(self, value):
"""Traverse the tree looking for the node. For BST it is O(logn) if the tree is balanced, otherwise... | stack_v2_sparse_classes_75kplus_train_071173 | 3,234 | permissive | [
{
"docstring": "Aux for self.addNode(value): for BST, best O(1), worst O(log n)",
"name": "_addNextNode",
"signature": "def _addNextNode(self, value, level_here=1)"
},
{
"docstring": "Traverse the tree looking for the node. For BST it is O(logn) if the tree is balanced, otherwise it can be O(n)"... | 2 | stack_v2_sparse_classes_30k_train_004268 | Implement the Python class `NodeBST` described below.
Class description:
Implement the NodeBST class.
Method signatures and docstrings:
- def _addNextNode(self, value, level_here=1): Aux for self.addNode(value): for BST, best O(1), worst O(log n)
- def _searchForNode(self, value): Traverse the tree looking for the no... | Implement the Python class `NodeBST` described below.
Class description:
Implement the NodeBST class.
Method signatures and docstrings:
- def _addNextNode(self, value, level_here=1): Aux for self.addNode(value): for BST, best O(1), worst O(log n)
- def _searchForNode(self, value): Traverse the tree looking for the no... | 5107f16df0af7ac20a52be772bd3bc46b2d4e8f6 | <|skeleton|>
class NodeBST:
def _addNextNode(self, value, level_here=1):
"""Aux for self.addNode(value): for BST, best O(1), worst O(log n)"""
<|body_0|>
def _searchForNode(self, value):
"""Traverse the tree looking for the node. For BST it is O(logn) if the tree is balanced, otherwise... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NodeBST:
def _addNextNode(self, value, level_here=1):
"""Aux for self.addNode(value): for BST, best O(1), worst O(log n)"""
self.traversal = []
new_node = NodeBST(value, level_here)
if not self.item:
self.item = new_node
elif value < self.item:
s... | the_stack_v2_python_sparse | src/further_examples/trees_graphs/binary_search_tree.py | ricardo64/Over-100-Exercises-Python-and-Algorithms | train | 5 | |
1b2db9617258739a2249674df123a493adcb4909 | [
"args = self.arguments\nopts = self.options\ntyps = self.get_plural_types(method='list', typ=args[0])\nself.context.formatter.format(self.context, self.get_collection(typ=args[0], opts=opts, base=self.resolve_base(opts), context_variants=typs), show_all=True if opts and opts.has_key(ListCommand.SHOW_ALL_KEY) else F... | <|body_start_0|>
args = self.arguments
opts = self.options
typs = self.get_plural_types(method='list', typ=args[0])
self.context.formatter.format(self.context, self.get_collection(typ=args[0], opts=opts, base=self.resolve_base(opts), context_variants=typs), show_all=True if opts and opts... | ListCommand | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListCommand:
def execute(self):
"""Execute "list"."""
<|body_0|>
def show_help(self):
"""Show help for "list"."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
args = self.arguments
opts = self.options
typs = self.get_plural_types(met... | stack_v2_sparse_classes_75kplus_train_071174 | 7,030 | permissive | [
{
"docstring": "Execute \"list\".",
"name": "execute",
"signature": "def execute(self)"
},
{
"docstring": "Show help for \"list\".",
"name": "show_help",
"signature": "def show_help(self)"
}
] | 2 | null | Implement the Python class `ListCommand` described below.
Class description:
Implement the ListCommand class.
Method signatures and docstrings:
- def execute(self): Execute "list".
- def show_help(self): Show help for "list". | Implement the Python class `ListCommand` described below.
Class description:
Implement the ListCommand class.
Method signatures and docstrings:
- def execute(self): Execute "list".
- def show_help(self): Show help for "list".
<|skeleton|>
class ListCommand:
def execute(self):
"""Execute "list"."""
... | 422d70e1dc422f0ca248abea47a472e3605caa4b | <|skeleton|>
class ListCommand:
def execute(self):
"""Execute "list"."""
<|body_0|>
def show_help(self):
"""Show help for "list"."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ListCommand:
def execute(self):
"""Execute "list"."""
args = self.arguments
opts = self.options
typs = self.get_plural_types(method='list', typ=args[0])
self.context.formatter.format(self.context, self.get_collection(typ=args[0], opts=opts, base=self.resolve_base(opts),... | the_stack_v2_python_sparse | src/ovirtcli/command/list.py | minqf/ovirt-engine-cli | train | 0 | |
ce86b77afe60d053f22584dc9064dfcf4657b72d | [
"super(FeatureGroupLayer, self).__init__()\nself.structure_logits = torch.nn.Parameter(torch.empty(input_dim4lookup, bucket_num, 2).uniform_(-0.001, 0.001), requires_grad=True)\nself.hash_wt = torch.nn.Parameter(torch.nn.init.xavier_uniform_(torch.empty(input_dim4lookup, bucket_num)), requires_grad=True)\nif temper... | <|body_start_0|>
super(FeatureGroupLayer, self).__init__()
self.structure_logits = torch.nn.Parameter(torch.empty(input_dim4lookup, bucket_num, 2).uniform_(-0.001, 0.001), requires_grad=True)
self.hash_wt = torch.nn.Parameter(torch.nn.init.xavier_uniform_(torch.empty(input_dim4lookup, bucket_num... | FeatureGroupLayer module. | FeatureGroupLayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeatureGroupLayer:
"""FeatureGroupLayer module."""
def __init__(self, input_dim4lookup, embed_dim, bucket_num, temperature, lambda_c, epsilon=1e-20):
"""Autogroup key component, applies differentiable feature group selection. :param input_dim4lookup: feature number in `feature_id`, u... | stack_v2_sparse_classes_75kplus_train_071175 | 15,812 | permissive | [
{
"docstring": "Autogroup key component, applies differentiable feature group selection. :param input_dim4lookup: feature number in `feature_id`, usually equals to number of non-zero features :type input_dim4lookup: int :param embed_dim: length of each feature's latent vector(embedding vector) :type embed_dim: ... | 3 | null | Implement the Python class `FeatureGroupLayer` described below.
Class description:
FeatureGroupLayer module.
Method signatures and docstrings:
- def __init__(self, input_dim4lookup, embed_dim, bucket_num, temperature, lambda_c, epsilon=1e-20): Autogroup key component, applies differentiable feature group selection. :... | Implement the Python class `FeatureGroupLayer` described below.
Class description:
FeatureGroupLayer module.
Method signatures and docstrings:
- def __init__(self, input_dim4lookup, embed_dim, bucket_num, temperature, lambda_c, epsilon=1e-20): Autogroup key component, applies differentiable feature group selection. :... | e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04 | <|skeleton|>
class FeatureGroupLayer:
"""FeatureGroupLayer module."""
def __init__(self, input_dim4lookup, embed_dim, bucket_num, temperature, lambda_c, epsilon=1e-20):
"""Autogroup key component, applies differentiable feature group selection. :param input_dim4lookup: feature number in `feature_id`, u... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FeatureGroupLayer:
"""FeatureGroupLayer module."""
def __init__(self, input_dim4lookup, embed_dim, bucket_num, temperature, lambda_c, epsilon=1e-20):
"""Autogroup key component, applies differentiable feature group selection. :param input_dim4lookup: feature number in `feature_id`, usually equals... | the_stack_v2_python_sparse | zeus/networks/pytorch/customs/fis/layers.py | huawei-noah/xingtian | train | 308 |
4ee9e21fd765cb3f5386e032853356eb6d935eb8 | [
"super(QNetwork, self).__init__()\nself.state_size = state_size\nself.action_size = action_size\ninput_size = state_size\nself.layers = []\nfor layer_hidden_units in hidden_units:\n layer = nn.Linear(input_size, layer_hidden_units)\n bound = 1 / np.sqrt(input_size)\n with torch.no_grad():\n layer.we... | <|body_start_0|>
super(QNetwork, self).__init__()
self.state_size = state_size
self.action_size = action_size
input_size = state_size
self.layers = []
for layer_hidden_units in hidden_units:
layer = nn.Linear(input_size, layer_hidden_units)
bound =... | QNetwork | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QNetwork:
def __init__(self, state_size, action_size, hidden_units: List[int]):
"""Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed"""
<|body_0|>
def forward(sel... | stack_v2_sparse_classes_75kplus_train_071176 | 9,801 | no_license | [
{
"docstring": "Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed",
"name": "__init__",
"signature": "def __init__(self, state_size, action_size, hidden_units: List[int])"
},
{
"docst... | 2 | stack_v2_sparse_classes_30k_val_000702 | Implement the Python class `QNetwork` described below.
Class description:
Implement the QNetwork class.
Method signatures and docstrings:
- def __init__(self, state_size, action_size, hidden_units: List[int]): Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (... | Implement the Python class `QNetwork` described below.
Class description:
Implement the QNetwork class.
Method signatures and docstrings:
- def __init__(self, state_size, action_size, hidden_units: List[int]): Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (... | 125268908919661a508abc7bddc1015a92116f96 | <|skeleton|>
class QNetwork:
def __init__(self, state_size, action_size, hidden_units: List[int]):
"""Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed"""
<|body_0|>
def forward(sel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QNetwork:
def __init__(self, state_size, action_size, hidden_units: List[int]):
"""Initialize parameters and build model. Params ====== state_size (int): Dimension of each state action_size (int): Dimension of each action seed (int): Random seed"""
super(QNetwork, self).__init__()
self... | the_stack_v2_python_sparse | LeducPoker/NFSP/Dqn.py | mzktbyjc2016/nfsp-pytorch | train | 2 | |
4b67050e5fb141c49bb81764757cfae646fdb1be | [
"sleep(1)\nself.user_info = str(uuid.uuid1()).split('-')[0]\npost_data = {'user_name': self.user_info, 'password1': 'pineapple', 'password2': 'pineapple', 'email': self.user_info + '@gmail.com'}\nresponse_1 = self.client.post('/profile_page/api/register', post_data)\nself.assertEqual(response_1.status_code, 200, ms... | <|body_start_0|>
sleep(1)
self.user_info = str(uuid.uuid1()).split('-')[0]
post_data = {'user_name': self.user_info, 'password1': 'pineapple', 'password2': 'pineapple', 'email': self.user_info + '@gmail.com'}
response_1 = self.client.post('/profile_page/api/register', post_data)
... | Tests the API calls that is related to listing the saved games. | SavedBoards | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SavedBoards:
"""Tests the API calls that is related to listing the saved games."""
def setUp(self):
"""Create an account and 2 active games. Then save the games to the user's profile."""
<|body_0|>
def tearDown(self):
"""Removes the testing user and game board fr... | stack_v2_sparse_classes_75kplus_train_071177 | 42,352 | permissive | [
{
"docstring": "Create an account and 2 active games. Then save the games to the user's profile.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Removes the testing user and game board from the database.",
"name": "tearDown",
"signature": "def tearDown(self)"
},
... | 4 | null | Implement the Python class `SavedBoards` described below.
Class description:
Tests the API calls that is related to listing the saved games.
Method signatures and docstrings:
- def setUp(self): Create an account and 2 active games. Then save the games to the user's profile.
- def tearDown(self): Removes the testing u... | Implement the Python class `SavedBoards` described below.
Class description:
Tests the API calls that is related to listing the saved games.
Method signatures and docstrings:
- def setUp(self): Create an account and 2 active games. Then save the games to the user's profile.
- def tearDown(self): Removes the testing u... | a47c849ea97763eff1005273a58aa3d8ab663ff2 | <|skeleton|>
class SavedBoards:
"""Tests the API calls that is related to listing the saved games."""
def setUp(self):
"""Create an account and 2 active games. Then save the games to the user's profile."""
<|body_0|>
def tearDown(self):
"""Removes the testing user and game board fr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SavedBoards:
"""Tests the API calls that is related to listing the saved games."""
def setUp(self):
"""Create an account and 2 active games. Then save the games to the user's profile."""
sleep(1)
self.user_info = str(uuid.uuid1()).split('-')[0]
post_data = {'user_name': se... | the_stack_v2_python_sparse | profile_page/api/tests_api.py | Plongesam/data-structures-game | train | 2 |
2e8cfb29049079d49079532558b611c01b910c11 | [
"try:\n return config_parser.get(section_name, value_name)\nexcept configparser.NoOptionError:\n return None",
"config_parser = configparser.ConfigParser(interpolation=None)\nconfig_parser.read_file(file_object)\nfor section_name in config_parser.sections():\n preset_definition = PresetDefinition(section... | <|body_start_0|>
try:
return config_parser.get(section_name, value_name)
except configparser.NoOptionError:
return None
<|end_body_0|>
<|body_start_1|>
config_parser = configparser.ConfigParser(interpolation=None)
config_parser.read_file(file_object)
for ... | Preset definition reader. | PresetDefinitionReader | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PresetDefinitionReader:
"""Preset definition reader."""
def _GetConfigValue(self, config_parser, section_name, value_name):
"""Retrieves a value from the config parser. Args: config_parser (ConfigParser): configuration parser. section_name (str): name of the section that contains the... | stack_v2_sparse_classes_75kplus_train_071178 | 2,420 | permissive | [
{
"docstring": "Retrieves a value from the config parser. Args: config_parser (ConfigParser): configuration parser. section_name (str): name of the section that contains the value. value_name (str): name of the value. Returns: object: value or None if the value does not exists.",
"name": "_GetConfigValue",
... | 2 | stack_v2_sparse_classes_30k_train_007097 | Implement the Python class `PresetDefinitionReader` described below.
Class description:
Preset definition reader.
Method signatures and docstrings:
- def _GetConfigValue(self, config_parser, section_name, value_name): Retrieves a value from the config parser. Args: config_parser (ConfigParser): configuration parser. ... | Implement the Python class `PresetDefinitionReader` described below.
Class description:
Preset definition reader.
Method signatures and docstrings:
- def _GetConfigValue(self, config_parser, section_name, value_name): Retrieves a value from the config parser. Args: config_parser (ConfigParser): configuration parser. ... | 34709706cc3bee84db45883043b9dfc1811ba65b | <|skeleton|>
class PresetDefinitionReader:
"""Preset definition reader."""
def _GetConfigValue(self, config_parser, section_name, value_name):
"""Retrieves a value from the config parser. Args: config_parser (ConfigParser): configuration parser. section_name (str): name of the section that contains the... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PresetDefinitionReader:
"""Preset definition reader."""
def _GetConfigValue(self, config_parser, section_name, value_name):
"""Retrieves a value from the config parser. Args: config_parser (ConfigParser): configuration parser. section_name (str): name of the section that contains the value. value... | the_stack_v2_python_sparse | l2tdevtools/presets.py | log2timeline/l2tdevtools | train | 7 |
4795faeae4414f1f3a15d7806b643af2b6ffe6a6 | [
"if node is None:\n return\nself.get_tree_nodes(arr, node.left, node.val, depth + 1)\nself.get_tree_nodes(arr, node.right, node.val, depth + 1)\narr[node.val] = {'parent_val': parent_val, 'depth': depth}",
"if root.left is None or root.right is None:\n return False\narr = {}\nself.get_tree_nodes(arr, root, ... | <|body_start_0|>
if node is None:
return
self.get_tree_nodes(arr, node.left, node.val, depth + 1)
self.get_tree_nodes(arr, node.right, node.val, depth + 1)
arr[node.val] = {'parent_val': parent_val, 'depth': depth}
<|end_body_0|>
<|body_start_1|>
if root.left is None... | solution | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""solution"""
def get_tree_nodes(self, arr: dict, node: dict, parent_val: int, depth: int) -> None:
"""Recursive tree Parameters ---------- arr : dict nodes array node : dict node parent_val : int parent value depth : int depth"""
<|body_0|>
def is_cousins(sel... | stack_v2_sparse_classes_75kplus_train_071179 | 4,230 | no_license | [
{
"docstring": "Recursive tree Parameters ---------- arr : dict nodes array node : dict node parent_val : int parent value depth : int depth",
"name": "get_tree_nodes",
"signature": "def get_tree_nodes(self, arr: dict, node: dict, parent_val: int, depth: int) -> None"
},
{
"docstring": "cousins-... | 2 | stack_v2_sparse_classes_30k_train_016809 | Implement the Python class `Solution` described below.
Class description:
solution
Method signatures and docstrings:
- def get_tree_nodes(self, arr: dict, node: dict, parent_val: int, depth: int) -> None: Recursive tree Parameters ---------- arr : dict nodes array node : dict node parent_val : int parent value depth ... | Implement the Python class `Solution` described below.
Class description:
solution
Method signatures and docstrings:
- def get_tree_nodes(self, arr: dict, node: dict, parent_val: int, depth: int) -> None: Recursive tree Parameters ---------- arr : dict nodes array node : dict node parent_val : int parent value depth ... | 86766a73a617086784ad777906a2782e39fe262e | <|skeleton|>
class Solution:
"""solution"""
def get_tree_nodes(self, arr: dict, node: dict, parent_val: int, depth: int) -> None:
"""Recursive tree Parameters ---------- arr : dict nodes array node : dict node parent_val : int parent value depth : int depth"""
<|body_0|>
def is_cousins(sel... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""solution"""
def get_tree_nodes(self, arr: dict, node: dict, parent_val: int, depth: int) -> None:
"""Recursive tree Parameters ---------- arr : dict nodes array node : dict node parent_val : int parent value depth : int depth"""
if node is None:
return
sel... | the_stack_v2_python_sparse | src/easy/cousins_in_binary_tree.py | albul-k/leetcode | train | 0 |
cfa910cbfe75fddba9f3619dd7ba5fd9b71fa631 | [
"super(ConvTTLSTMCell, self).__init__()\nself.input_channels = input_channels\nself.hidden_channels = hidden_channels\nself.steps = steps\nself.order = order\nself.lags = steps - order + 1\nkernel_size = utils._pair(kernel_size)\npadding = (kernel_size[0] // 2, kernel_size[1] // 2)\nConv2d = lambda in_channels, out... | <|body_start_0|>
super(ConvTTLSTMCell, self).__init__()
self.input_channels = input_channels
self.hidden_channels = hidden_channels
self.steps = steps
self.order = order
self.lags = steps - order + 1
kernel_size = utils._pair(kernel_size)
padding = (kernel... | ConvTTLSTMCell | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConvTTLSTMCell:
def __init__(self, input_channels, hidden_channels, order=3, steps=3, ranks=8, kernel_size=5, bias=True):
"""Initialization of convolutional tensor-train LSTM cell. Arguments: ---------- (Hyper-parameters of the input/output channels) input_channels: int Number of input c... | stack_v2_sparse_classes_75kplus_train_071180 | 9,867 | permissive | [
{
"docstring": "Initialization of convolutional tensor-train LSTM cell. Arguments: ---------- (Hyper-parameters of the input/output channels) input_channels: int Number of input channels of the input tensor. hidden_channels: int Number of hidden/output channels of the output tensor. Note: the number of hidden_c... | 3 | stack_v2_sparse_classes_30k_train_029110 | Implement the Python class `ConvTTLSTMCell` described below.
Class description:
Implement the ConvTTLSTMCell class.
Method signatures and docstrings:
- def __init__(self, input_channels, hidden_channels, order=3, steps=3, ranks=8, kernel_size=5, bias=True): Initialization of convolutional tensor-train LSTM cell. Argu... | Implement the Python class `ConvTTLSTMCell` described below.
Class description:
Implement the ConvTTLSTMCell class.
Method signatures and docstrings:
- def __init__(self, input_channels, hidden_channels, order=3, steps=3, ranks=8, kernel_size=5, bias=True): Initialization of convolutional tensor-train LSTM cell. Argu... | baa19ee4e9f3422a052794e50791495632290b36 | <|skeleton|>
class ConvTTLSTMCell:
def __init__(self, input_channels, hidden_channels, order=3, steps=3, ranks=8, kernel_size=5, bias=True):
"""Initialization of convolutional tensor-train LSTM cell. Arguments: ---------- (Hyper-parameters of the input/output channels) input_channels: int Number of input c... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ConvTTLSTMCell:
def __init__(self, input_channels, hidden_channels, order=3, steps=3, ranks=8, kernel_size=5, bias=True):
"""Initialization of convolutional tensor-train LSTM cell. Arguments: ---------- (Hyper-parameters of the input/output channels) input_channels: int Number of input channels of the... | the_stack_v2_python_sparse | conv-tt-lstm/code/convlstmcell.py | usangbong/Data-Visualization-Lab-RND | train | 7 | |
a010d69c47164225eb4103b9030e9501db02118e | [
"assert nums is not None\nnums.sort()\nn = len(nums)\nres = set()\nadict = {}\nfor i in xrange(n - 1):\n for j in xrange(i + 1, n):\n asum = nums[i] + nums[j]\n if asum not in adict:\n adict[asum] = [(i, j)]\n else:\n adict[asum].append((i, j))\nfor i in xrange(n - 4 + ... | <|body_start_0|>
assert nums is not None
nums.sort()
n = len(nums)
res = set()
adict = {}
for i in xrange(n - 1):
for j in xrange(i + 1, n):
asum = nums[i] + nums[j]
if asum not in adict:
adict[asum] = [(i, j... | Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in a quadruplet (a,b,c,d) must be in non-descending order. (ie, a+b+c+d) The solution set must not contain duplicate quadruplets... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in a quadruplet (a,b,c,d) must be in non-descending order. (ie, a+b+c+d) The solution set mu... | stack_v2_sparse_classes_75kplus_train_071181 | 2,724 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]",
"name": "fourSum_hash",
"signature": "def fourSum_hash(self, nums, target)"
},
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[List[int]]",
"name": "fourSum_Generic",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_train_052150 | Implement the Python class `Solution` described below.
Class description:
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in a quadruplet (a,b,c,d) must be in non-descending o... | Implement the Python class `Solution` described below.
Class description:
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in a quadruplet (a,b,c,d) must be in non-descending o... | cbe6a7e7f05eccb4f9c5fce8651c0d87e5168516 | <|skeleton|>
class Solution:
"""Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in a quadruplet (a,b,c,d) must be in non-descending order. (ie, a+b+c+d) The solution set mu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: Elements in a quadruplet (a,b,c,d) must be in non-descending order. (ie, a+b+c+d) The solution set must not contai... | the_stack_v2_python_sparse | src/array/leetcode18_4Sum.py | apepkuss/Cracking-Leetcode-in-Python | train | 2 |
741d2a1432898de3950445bdb9ed2bd8f26e992d | [
"self.fps = prediction_memories.fps\nself.left_limit, length_video = get_meters_video(prediction_memories.calibration_path)\nself.scale = prediction_memories.scale\nself.added_pad = prediction_memories.added_pad\nself.begin_frame = prediction_memories.begin_frame\nself.nb_images = len(prediction_memories.preds)\nse... | <|body_start_0|>
self.fps = prediction_memories.fps
self.left_limit, length_video = get_meters_video(prediction_memories.calibration_path)
self.scale = prediction_memories.scale
self.added_pad = prediction_memories.added_pad
self.begin_frame = prediction_memories.begin_frame
... | Class to manage the graphic data. | GraphicManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphicManager:
"""Class to manage the graphic data."""
def __init__(self, prediction_memories):
"""Construct the parameters and the data for the figure. Args: prediction_memories (PredictionMemories): THE ATTRIBUTE DATA HAS TO BE FILLED i.e THE VIDEO HAS TO BE MADE BEFORE."""
... | stack_v2_sparse_classes_75kplus_train_071182 | 3,843 | no_license | [
{
"docstring": "Construct the parameters and the data for the figure. Args: prediction_memories (PredictionMemories): THE ATTRIBUTE DATA HAS TO BE FILLED i.e THE VIDEO HAS TO BE MADE BEFORE.",
"name": "__init__",
"signature": "def __init__(self, prediction_memories)"
},
{
"docstring": "Fill the ... | 3 | stack_v2_sparse_classes_30k_train_036735 | Implement the Python class `GraphicManager` described below.
Class description:
Class to manage the graphic data.
Method signatures and docstrings:
- def __init__(self, prediction_memories): Construct the parameters and the data for the figure. Args: prediction_memories (PredictionMemories): THE ATTRIBUTE DATA HAS TO... | Implement the Python class `GraphicManager` described below.
Class description:
Class to manage the graphic data.
Method signatures and docstrings:
- def __init__(self, prediction_memories): Construct the parameters and the data for the figure. Args: prediction_memories (PredictionMemories): THE ATTRIBUTE DATA HAS TO... | 237ca81580db43525d8945017c0565b9722046ad | <|skeleton|>
class GraphicManager:
"""Class to manage the graphic data."""
def __init__(self, prediction_memories):
"""Construct the parameters and the data for the figure. Args: prediction_memories (PredictionMemories): THE ATTRIBUTE DATA HAS TO BE FILLED i.e THE VIDEO HAS TO BE MADE BEFORE."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GraphicManager:
"""Class to manage the graphic data."""
def __init__(self, prediction_memories):
"""Construct the parameters and the data for the figure. Args: prediction_memories (PredictionMemories): THE ATTRIBUTE DATA HAS TO BE FILLED i.e THE VIDEO HAS TO BE MADE BEFORE."""
self.fps = ... | the_stack_v2_python_sparse | src/d7_visualization/graphic_manager.py | remingtonCarmi/TrackingSwimmingENPC | train | 0 |
bcb5c7ad5e6dbb6af2bd0219d09be3bd640fab41 | [
"u = usermanage(self.driver)\nu.open_usermanage()\nself.assertEqual(u.verify(), True)\nu.delete_obj()\nself.assertEqual(u.result(), '您确定要删除这条信息吗')\nu.confirm()\nself.assertEqual(u.result(), '删除成功')\nfunction.screenshot(self.driver, 'delete_user.jpg')",
"u = usermanage(self.driver)\nu.open_usermanage()\nself.asser... | <|body_start_0|>
u = usermanage(self.driver)
u.open_usermanage()
self.assertEqual(u.verify(), True)
u.delete_obj()
self.assertEqual(u.result(), '您确定要删除这条信息吗')
u.confirm()
self.assertEqual(u.result(), '删除成功')
function.screenshot(self.driver, 'delete_user.jp... | Test011_User_Delete_P1 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test011_User_Delete_P1:
def test_delete(self):
"""删除用户"""
<|body_0|>
def test_cancle(self):
"""取消删除用户"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
u = usermanage(self.driver)
u.open_usermanage()
self.assertEqual(u.verify(), True)
... | stack_v2_sparse_classes_75kplus_train_071183 | 1,069 | no_license | [
{
"docstring": "删除用户",
"name": "test_delete",
"signature": "def test_delete(self)"
},
{
"docstring": "取消删除用户",
"name": "test_cancle",
"signature": "def test_cancle(self)"
}
] | 2 | null | Implement the Python class `Test011_User_Delete_P1` described below.
Class description:
Implement the Test011_User_Delete_P1 class.
Method signatures and docstrings:
- def test_delete(self): 删除用户
- def test_cancle(self): 取消删除用户 | Implement the Python class `Test011_User_Delete_P1` described below.
Class description:
Implement the Test011_User_Delete_P1 class.
Method signatures and docstrings:
- def test_delete(self): 删除用户
- def test_cancle(self): 取消删除用户
<|skeleton|>
class Test011_User_Delete_P1:
def test_delete(self):
"""删除用户"""... | 6f42c25249fc642cecc270578a180820988d45b5 | <|skeleton|>
class Test011_User_Delete_P1:
def test_delete(self):
"""删除用户"""
<|body_0|>
def test_cancle(self):
"""取消删除用户"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test011_User_Delete_P1:
def test_delete(self):
"""删除用户"""
u = usermanage(self.driver)
u.open_usermanage()
self.assertEqual(u.verify(), True)
u.delete_obj()
self.assertEqual(u.result(), '您确定要删除这条信息吗')
u.confirm()
self.assertEqual(u.result(), '删除成功... | the_stack_v2_python_sparse | GlxssLive_web/TestCase/Manage_User/Test011_user_delete_P1.py | rrmiracle/GlxssLive | train | 0 | |
f8e02177695968446527bf3e829ad2211a2e3c2c | [
"super().__init__()\nassert reduction in ('none', 'mean', 'sum')\nself.output_beam = output_beam\nself.reduction = reduction\nself.use_double_scores = use_double_scores",
"lattice = intersect_dense(a_fsas=decoding_graph, b_fsas=dense_fsa_vec, output_beam=self.output_beam, frame_idx_name='frame_idx' if delay_penal... | <|body_start_0|>
super().__init__()
assert reduction in ('none', 'mean', 'sum')
self.output_beam = output_beam
self.reduction = reduction
self.use_double_scores = use_double_scores
<|end_body_0|>
<|body_start_1|>
lattice = intersect_dense(a_fsas=decoding_graph, b_fsas=de... | Ctc Loss computation in k2. It produces the same output as `torch.CtcLoss` if given the same input. One difference between `k2.CtcLoss` and `torch.CtcLoss` is that k2 accepts a general FSA while PyTorch requires a linear FSA (represented as a list). That means, `k2.CtcLoss` supports words with multiple pronunciations. ... | CtcLoss | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CtcLoss:
"""Ctc Loss computation in k2. It produces the same output as `torch.CtcLoss` if given the same input. One difference between `k2.CtcLoss` and `torch.CtcLoss` is that k2 accepts a general FSA while PyTorch requires a linear FSA (represented as a list). That means, `k2.CtcLoss` supports w... | stack_v2_sparse_classes_75kplus_train_071184 | 8,486 | permissive | [
{
"docstring": "Args: output_beam: Beam to prune output, similar to lattice-beam in Kaldi. Relative to best path of output. reduction: Specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, 'mean': the output losses will be **divided** by the target length... | 2 | null | Implement the Python class `CtcLoss` described below.
Class description:
Ctc Loss computation in k2. It produces the same output as `torch.CtcLoss` if given the same input. One difference between `k2.CtcLoss` and `torch.CtcLoss` is that k2 accepts a general FSA while PyTorch requires a linear FSA (represented as a lis... | Implement the Python class `CtcLoss` described below.
Class description:
Ctc Loss computation in k2. It produces the same output as `torch.CtcLoss` if given the same input. One difference between `k2.CtcLoss` and `torch.CtcLoss` is that k2 accepts a general FSA while PyTorch requires a linear FSA (represented as a lis... | 2b2ac14b326d61d79d04e53fbd69b1ff6d630411 | <|skeleton|>
class CtcLoss:
"""Ctc Loss computation in k2. It produces the same output as `torch.CtcLoss` if given the same input. One difference between `k2.CtcLoss` and `torch.CtcLoss` is that k2 accepts a general FSA while PyTorch requires a linear FSA (represented as a list). That means, `k2.CtcLoss` supports w... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CtcLoss:
"""Ctc Loss computation in k2. It produces the same output as `torch.CtcLoss` if given the same input. One difference between `k2.CtcLoss` and `torch.CtcLoss` is that k2 accepts a general FSA while PyTorch requires a linear FSA (represented as a list). That means, `k2.CtcLoss` supports words with mul... | the_stack_v2_python_sparse | k2/python/k2/ctc_loss.py | k2-fsa/k2 | train | 851 |
c976d66080f6d21bc0526beca081963ce6f0687d | [
"sequence_code = 'salon.chair.sequence'\nsequence_number = self.env['ir.sequence'].next_by_code(sequence_code)\nself.env['salon.sequence.updater'].browse(1).write({'salon_sequence': sequence_number})\nif 'user_line' in values.keys():\n if values['user_line']:\n date_changer = []\n for elements in v... | <|body_start_0|>
sequence_code = 'salon.chair.sequence'
sequence_number = self.env['ir.sequence'].next_by_code(sequence_code)
self.env['salon.sequence.updater'].browse(1).write({'salon_sequence': sequence_number})
if 'user_line' in values.keys():
if values['user_line']:
... | SalonChair | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SalonChair:
def create(self, values):
"""add sequence for chair, start date and end date on creating record"""
<|body_0|>
def write(self, values):
"""add sequence for chair, start date and end date on editing record"""
<|body_1|>
def collection_today_upd... | stack_v2_sparse_classes_75kplus_train_071185 | 7,635 | no_license | [
{
"docstring": "add sequence for chair, start date and end date on creating record",
"name": "create",
"signature": "def create(self, values)"
},
{
"docstring": "add sequence for chair, start date and end date on editing record",
"name": "write",
"signature": "def write(self, values)"
... | 3 | null | Implement the Python class `SalonChair` described below.
Class description:
Implement the SalonChair class.
Method signatures and docstrings:
- def create(self, values): add sequence for chair, start date and end date on creating record
- def write(self, values): add sequence for chair, start date and end date on edi... | Implement the Python class `SalonChair` described below.
Class description:
Implement the SalonChair class.
Method signatures and docstrings:
- def create(self, values): add sequence for chair, start date and end date on creating record
- def write(self, values): add sequence for chair, start date and end date on edi... | 4b1bcb8f17aad44fe9c80a8180eb0128e6bb2c14 | <|skeleton|>
class SalonChair:
def create(self, values):
"""add sequence for chair, start date and end date on creating record"""
<|body_0|>
def write(self, values):
"""add sequence for chair, start date and end date on editing record"""
<|body_1|>
def collection_today_upd... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SalonChair:
def create(self, values):
"""add sequence for chair, start date and end date on creating record"""
sequence_code = 'salon.chair.sequence'
sequence_number = self.env['ir.sequence'].next_by_code(sequence_code)
self.env['salon.sequence.updater'].browse(1).write({'salon... | the_stack_v2_python_sparse | salon_management/models/salon_management.py | CybroOdoo/CybroAddons | train | 209 | |
7d854d93245a6545905eaff2ef100f220f5e60b9 | [
"default = None\nif 'default' in kwargs:\n default = kwargs['default']\n del kwargs['default']\ntry:\n return ConfigParser.ConfigParser.get(self, section, option, **kwargs)\nexcept (ConfigParser.NoSectionError, ConfigParser.NoOptionError):\n if default is not None:\n return default\n else:\n ... | <|body_start_0|>
default = None
if 'default' in kwargs:
default = kwargs['default']
del kwargs['default']
try:
return ConfigParser.ConfigParser.get(self, section, option, **kwargs)
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
... | DefaultConfigParser | [
"BSD-2-Clause",
"mpich2",
"LicenseRef-scancode-other-permissive"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DefaultConfigParser:
def get(self, section, option, **kwargs):
"""convenience method for getting config items"""
<|body_0|>
def getboolean(self, section, option, **kwargs):
"""convenience method for getting boolean config items"""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_75kplus_train_071186 | 36,164 | permissive | [
{
"docstring": "convenience method for getting config items",
"name": "get",
"signature": "def get(self, section, option, **kwargs)"
},
{
"docstring": "convenience method for getting boolean config items",
"name": "getboolean",
"signature": "def getboolean(self, section, option, **kwargs... | 2 | stack_v2_sparse_classes_30k_train_036009 | Implement the Python class `DefaultConfigParser` described below.
Class description:
Implement the DefaultConfigParser class.
Method signatures and docstrings:
- def get(self, section, option, **kwargs): convenience method for getting config items
- def getboolean(self, section, option, **kwargs): convenience method ... | Implement the Python class `DefaultConfigParser` described below.
Class description:
Implement the DefaultConfigParser class.
Method signatures and docstrings:
- def get(self, section, option, **kwargs): convenience method for getting config items
- def getboolean(self, section, option, **kwargs): convenience method ... | 94dc7a59c0f42fcbb4ae1e8919c1b41eae1e52ad | <|skeleton|>
class DefaultConfigParser:
def get(self, section, option, **kwargs):
"""convenience method for getting config items"""
<|body_0|>
def getboolean(self, section, option, **kwargs):
"""convenience method for getting boolean config items"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DefaultConfigParser:
def get(self, section, option, **kwargs):
"""convenience method for getting config items"""
default = None
if 'default' in kwargs:
default = kwargs['default']
del kwargs['default']
try:
return ConfigParser.ConfigParser.ge... | the_stack_v2_python_sparse | src/lib/Bcfg2/Options.py | ab/bcfg2 | train | 0 | |
2522ca52f0c7155b50d8137b3b4356f857545189 | [
"if not head:\n return True\nif not head.next:\n return True\nslow = head\nfast = head\npre = None\nwhile fast and fast.next:\n pre = slow\n slow = slow.next\n fast = fast.next.next\npre.next = None\nhead1 = self.reverse(slow)\nwhile head and head1:\n if head.val != head1.val:\n return Fals... | <|body_start_0|>
if not head:
return True
if not head.next:
return True
slow = head
fast = head
pre = None
while fast and fast.next:
pre = slow
slow = slow.next
fast = fast.next.next
pre.next = None
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPalindrome(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def reverse(self, head):
""":param head: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head:
return True
if not head.nex... | stack_v2_sparse_classes_75kplus_train_071187 | 1,454 | no_license | [
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "isPalindrome",
"signature": "def isPalindrome(self, head)"
},
{
"docstring": ":param head: :return:",
"name": "reverse",
"signature": "def reverse(self, head)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, head): :type head: ListNode :rtype: bool
- def reverse(self, head): :param head: :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPalindrome(self, head): :type head: ListNode :rtype: bool
- def reverse(self, head): :param head: :return:
<|skeleton|>
class Solution:
def isPalindrome(self, head):
... | a75310a96d2b165b15d5ee10ec409a17cdc880ba | <|skeleton|>
class Solution:
def isPalindrome(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def reverse(self, head):
""":param head: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isPalindrome(self, head):
""":type head: ListNode :rtype: bool"""
if not head:
return True
if not head.next:
return True
slow = head
fast = head
pre = None
while fast and fast.next:
pre = slow
... | the_stack_v2_python_sparse | leetcode/hot_100/code/234.py | skyxyz-lang/CS_Note | train | 0 | |
7ba258f58991cac4ff68f21670e74127361cda2f | [
"self.offset = offset\nself.p = p\nself.down_scale = 1",
"num_examples = len(data[0])\nfor i in range(num_examples):\n if np.random.uniform(0, 1) > self.p:\n continue\n offset = [self.down_scale * np.random.randint(-self.offset, self.offset + 1) for l in range(2)]\n data[0][i] = self.embed_image(d... | <|body_start_0|>
self.offset = offset
self.p = p
self.down_scale = 1
<|end_body_0|>
<|body_start_1|>
num_examples = len(data[0])
for i in range(num_examples):
if np.random.uniform(0, 1) > self.p:
continue
offset = [self.down_scale * np.ran... | Augments the images by translating the content and applying reflection padding. | TranslationAugmentor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TranslationAugmentor:
"""Augments the images by translating the content and applying reflection padding."""
def __init__(self, offset=40, p=1):
"""Initializes a new instance of the TranslationAugmentor class. :param offset: The offset by which the image is randomly translated. :param... | stack_v2_sparse_classes_75kplus_train_071188 | 5,227 | no_license | [
{
"docstring": "Initializes a new instance of the TranslationAugmentor class. :param offset: The offset by which the image is randomly translated. :param p: The probability that this will be applied.",
"name": "__init__",
"signature": "def __init__(self, offset=40, p=1)"
},
{
"docstring": "Augme... | 4 | stack_v2_sparse_classes_30k_train_041342 | Implement the Python class `TranslationAugmentor` described below.
Class description:
Augments the images by translating the content and applying reflection padding.
Method signatures and docstrings:
- def __init__(self, offset=40, p=1): Initializes a new instance of the TranslationAugmentor class. :param offset: The... | Implement the Python class `TranslationAugmentor` described below.
Class description:
Augments the images by translating the content and applying reflection padding.
Method signatures and docstrings:
- def __init__(self, offset=40, p=1): Initializes a new instance of the TranslationAugmentor class. :param offset: The... | d494b3041069d377d6a7a9c296a14334f2fa5acc | <|skeleton|>
class TranslationAugmentor:
"""Augments the images by translating the content and applying reflection padding."""
def __init__(self, offset=40, p=1):
"""Initializes a new instance of the TranslationAugmentor class. :param offset: The offset by which the image is randomly translated. :param... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TranslationAugmentor:
"""Augments the images by translating the content and applying reflection padding."""
def __init__(self, offset=40, p=1):
"""Initializes a new instance of the TranslationAugmentor class. :param offset: The offset by which the image is randomly translated. :param p: The proba... | the_stack_v2_python_sparse | python/TobyPDE_FRRN/FRRN-master/dltools/augmentation.py | LiuFang816/SALSTM_py_data | train | 10 |
9dfc8b8f5a6cf4b3558a8dae60e4612080b949d8 | [
"self.total = 0\nself.books = []\nself.keyword = ''",
"self.total = book_item.total\nself.keyword = keyword\nself.books = [BookViewModel(book) for book in book_item.books]"
] | <|body_start_0|>
self.total = 0
self.books = []
self.keyword = ''
<|end_body_0|>
<|body_start_1|>
self.total = book_item.total
self.keyword = keyword
self.books = [BookViewModel(book) for book in book_item.books]
<|end_body_1|>
| A collection of `BookViewModel` objects based on a specific keywords :param total: the total number of `BookViewModel` objects in the collection :type total: int :param books: list of `BookViewModel` objects :type books: list :param keyword: keyword used for searching for such book collection | BookCollection | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BookCollection:
"""A collection of `BookViewModel` objects based on a specific keywords :param total: the total number of `BookViewModel` objects in the collection :type total: int :param books: list of `BookViewModel` objects :type books: list :param keyword: keyword used for searching for such ... | stack_v2_sparse_classes_75kplus_train_071189 | 4,739 | permissive | [
{
"docstring": "Constructor Method",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Fill the `BookViewModel` objects into `books` attribute :param book_item: `Book` object returned by HTTP response :type book_item: obj :param keyword: Query keywords for searching `book_... | 2 | stack_v2_sparse_classes_30k_train_048653 | Implement the Python class `BookCollection` described below.
Class description:
A collection of `BookViewModel` objects based on a specific keywords :param total: the total number of `BookViewModel` objects in the collection :type total: int :param books: list of `BookViewModel` objects :type books: list :param keywor... | Implement the Python class `BookCollection` described below.
Class description:
A collection of `BookViewModel` objects based on a specific keywords :param total: the total number of `BookViewModel` objects in the collection :type total: int :param books: list of `BookViewModel` objects :type books: list :param keywor... | a5a7b08dcaf7a2b5a23955e9caa9b5b094e4c9c3 | <|skeleton|>
class BookCollection:
"""A collection of `BookViewModel` objects based on a specific keywords :param total: the total number of `BookViewModel` objects in the collection :type total: int :param books: list of `BookViewModel` objects :type books: list :param keyword: keyword used for searching for such ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BookCollection:
"""A collection of `BookViewModel` objects based on a specific keywords :param total: the total number of `BookViewModel` objects in the collection :type total: int :param books: list of `BookViewModel` objects :type books: list :param keyword: keyword used for searching for such book collecti... | the_stack_v2_python_sparse | freefree/app/view_models/book.py | Longweig/FreeFree | train | 0 |
07a6929141184e5c65d6621f6e8d872ef933ce02 | [
"if isinstance(module, (K.GeometricAugmentationBase2D,)):\n input = module.transform_masks(input, params=cls.get_instance_module_param(param), flags=module.flags, transform=module.transform_matrix, **extra_args)\nelif isinstance(module, (K.GeometricAugmentationBase3D,)):\n raise NotImplementedError('The suppo... | <|body_start_0|>
if isinstance(module, (K.GeometricAugmentationBase2D,)):
input = module.transform_masks(input, params=cls.get_instance_module_param(param), flags=module.flags, transform=module.transform_matrix, **extra_args)
elif isinstance(module, (K.GeometricAugmentationBase3D,)):
... | Apply and inverse transformations for mask tensors. | MaskSequentialOps | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaskSequentialOps:
"""Apply and inverse transformations for mask tensors."""
def transform(cls, input: Tensor, module: Module, param: ParamItem, extra_args: Dict[str, Any]={}) -> Tensor:
"""Apply a transformation with respect to the parameters. Args: input: the input tensor. module: ... | stack_v2_sparse_classes_75kplus_train_071190 | 19,475 | permissive | [
{
"docstring": "Apply a transformation with respect to the parameters. Args: input: the input tensor. module: any torch Module but only kornia augmentation modules will count to apply transformations. param: the corresponding parameters to the module.",
"name": "transform",
"signature": "def transform(c... | 2 | null | Implement the Python class `MaskSequentialOps` described below.
Class description:
Apply and inverse transformations for mask tensors.
Method signatures and docstrings:
- def transform(cls, input: Tensor, module: Module, param: ParamItem, extra_args: Dict[str, Any]={}) -> Tensor: Apply a transformation with respect t... | Implement the Python class `MaskSequentialOps` described below.
Class description:
Apply and inverse transformations for mask tensors.
Method signatures and docstrings:
- def transform(cls, input: Tensor, module: Module, param: ParamItem, extra_args: Dict[str, Any]={}) -> Tensor: Apply a transformation with respect t... | 1e0f8baa7318c05b17ea6dbb48605691bca8972f | <|skeleton|>
class MaskSequentialOps:
"""Apply and inverse transformations for mask tensors."""
def transform(cls, input: Tensor, module: Module, param: ParamItem, extra_args: Dict[str, Any]={}) -> Tensor:
"""Apply a transformation with respect to the parameters. Args: input: the input tensor. module: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MaskSequentialOps:
"""Apply and inverse transformations for mask tensors."""
def transform(cls, input: Tensor, module: Module, param: ParamItem, extra_args: Dict[str, Any]={}) -> Tensor:
"""Apply a transformation with respect to the parameters. Args: input: the input tensor. module: any torch Mod... | the_stack_v2_python_sparse | kornia/augmentation/container/ops.py | kornia/kornia | train | 7,351 |
72bf3ca78c47c383c695c4644f4b366813895f9d | [
"if bool(vocab_path) == bool(spm_model_path):\n raise ValueError('Exactly 1 of `vocab_path` or `spm_model_path` must be specified, not both.')\nself.vocab_path = vocab_path\nself.do_lower_case = do_lower_case\nself.spm_model_path = spm_model_path\nself.generate_document_ids = generate_document_ids",
"def file_... | <|body_start_0|>
if bool(vocab_path) == bool(spm_model_path):
raise ValueError('Exactly 1 of `vocab_path` or `spm_model_path` must be specified, not both.')
self.vocab_path = vocab_path
self.do_lower_case = do_lower_case
self.spm_model_path = spm_model_path
self.gener... | PTransform for reading text files into tokenized documents. | ReadFilesToTokenizedDocuments | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReadFilesToTokenizedDocuments:
"""PTransform for reading text files into tokenized documents."""
def __init__(self, vocab_path=None, do_lower_case=True, spm_model_path=None, generate_document_ids=False):
"""Initialization. Args: vocab_path: Path to the BERT vocabulary file to use wit... | stack_v2_sparse_classes_75kplus_train_071191 | 24,441 | permissive | [
{
"docstring": "Initialization. Args: vocab_path: Path to the BERT vocabulary file to use with the BERT tokenizer. Leave as None or set to empty string if using `spm_model_path` instead. do_lower_case: Whether to lowercase all text for BERT tokenization (default True). Must match assumption in `vocab_path`. Ign... | 2 | stack_v2_sparse_classes_30k_train_005539 | Implement the Python class `ReadFilesToTokenizedDocuments` described below.
Class description:
PTransform for reading text files into tokenized documents.
Method signatures and docstrings:
- def __init__(self, vocab_path=None, do_lower_case=True, spm_model_path=None, generate_document_ids=False): Initialization. Args... | Implement the Python class `ReadFilesToTokenizedDocuments` described below.
Class description:
PTransform for reading text files into tokenized documents.
Method signatures and docstrings:
- def __init__(self, vocab_path=None, do_lower_case=True, spm_model_path=None, generate_document_ids=False): Initialization. Args... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class ReadFilesToTokenizedDocuments:
"""PTransform for reading text files into tokenized documents."""
def __init__(self, vocab_path=None, do_lower_case=True, spm_model_path=None, generate_document_ids=False):
"""Initialization. Args: vocab_path: Path to the BERT vocabulary file to use wit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReadFilesToTokenizedDocuments:
"""PTransform for reading text files into tokenized documents."""
def __init__(self, vocab_path=None, do_lower_case=True, spm_model_path=None, generate_document_ids=False):
"""Initialization. Args: vocab_path: Path to the BERT vocabulary file to use with the BERT to... | the_stack_v2_python_sparse | readtwice/data_utils/beam_utils.py | Jimmy-INL/google-research | train | 1 |
b38754fad932850dabc808c41c7b7ad33128ffdf | [
"with cls.state_lock:\n if cls.state != DiagState.CLOSED:\n return False\nenabled = cfg.overall_config.diagnostics_enabled()\nif not enabled:\n return False\ncls.port = cfg.overall_config.diagnostics_port()\nwith cls.state_lock:\n cls.state = DiagState.PENDING\n thread = Thread(target=cls._make_s... | <|body_start_0|>
with cls.state_lock:
if cls.state != DiagState.CLOSED:
return False
enabled = cfg.overall_config.diagnostics_enabled()
if not enabled:
return False
cls.port = cfg.overall_config.diagnostics_port()
with cls.state_lock:
... | Sending diagnostic messages back to a remote controller. | Diagnostics | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Diagnostics:
"""Sending diagnostic messages back to a remote controller."""
def initialise(cls):
"""Begin diagnostics operation. If diagnostics is enabled in settings, wait for a connection from remote. Call only in a DiagState.CLOSED state. If a connection will be attempted, returns... | stack_v2_sparse_classes_75kplus_train_071192 | 5,704 | no_license | [
{
"docstring": "Begin diagnostics operation. If diagnostics is enabled in settings, wait for a connection from remote. Call only in a DiagState.CLOSED state. If a connection will be attempted, returns True, else returns False.",
"name": "initialise",
"signature": "def initialise(cls)"
},
{
"docs... | 5 | null | Implement the Python class `Diagnostics` described below.
Class description:
Sending diagnostic messages back to a remote controller.
Method signatures and docstrings:
- def initialise(cls): Begin diagnostics operation. If diagnostics is enabled in settings, wait for a connection from remote. Call only in a DiagState... | Implement the Python class `Diagnostics` described below.
Class description:
Sending diagnostic messages back to a remote controller.
Method signatures and docstrings:
- def initialise(cls): Begin diagnostics operation. If diagnostics is enabled in settings, wait for a connection from remote. Call only in a DiagState... | 98dce5ce80b5bba60c09407c1ff4b4d5c9007d99 | <|skeleton|>
class Diagnostics:
"""Sending diagnostic messages back to a remote controller."""
def initialise(cls):
"""Begin diagnostics operation. If diagnostics is enabled in settings, wait for a connection from remote. Call only in a DiagState.CLOSED state. If a connection will be attempted, returns... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Diagnostics:
"""Sending diagnostic messages back to a remote controller."""
def initialise(cls):
"""Begin diagnostics operation. If diagnostics is enabled in settings, wait for a connection from remote. Call only in a DiagState.CLOSED state. If a connection will be attempted, returns True, else r... | the_stack_v2_python_sparse | RaspiCode/coreutils/diagnostics.py | ranul-pallemulle/Mars-Rover | train | 0 |
9e851ef5e878531e822063c971e1ab23977008ff | [
"if fullname in _PRECISION_DICT:\n return _hook\nreturn None",
"ret = [(PRI_MED, file.fullname, -1)]\nif file.fullname == 'numpy':\n _override_imports(file, 'numpy._typing._extended_precision', imports=[(v, v) for v in _EXTENDED_PRECISION_LIST])\nelif file.fullname == 'numpy.ctypeslib':\n _override_impor... | <|body_start_0|>
if fullname in _PRECISION_DICT:
return _hook
return None
<|end_body_0|>
<|body_start_1|>
ret = [(PRI_MED, file.fullname, -1)]
if file.fullname == 'numpy':
_override_imports(file, 'numpy._typing._extended_precision', imports=[(v, v) for v in _EXTE... | A mypy plugin for handling versus numpy-specific typing tasks. | _NumpyPlugin | [
"Zlib",
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _NumpyPlugin:
"""A mypy plugin for handling versus numpy-specific typing tasks."""
def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc:
"""Set the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdoubl... | stack_v2_sparse_classes_75kplus_train_071193 | 6,376 | permissive | [
{
"docstring": "Set the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdouble`.",
"name": "get_type_analyze_hook",
"signature": "def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc"
},
{
"docstring": "Handle all... | 2 | stack_v2_sparse_classes_30k_train_000868 | Implement the Python class `_NumpyPlugin` described below.
Class description:
A mypy plugin for handling versus numpy-specific typing tasks.
Method signatures and docstrings:
- def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc: Set the precision of platform-specific `numpy.number` subclasses. For exa... | Implement the Python class `_NumpyPlugin` described below.
Class description:
A mypy plugin for handling versus numpy-specific typing tasks.
Method signatures and docstrings:
- def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc: Set the precision of platform-specific `numpy.number` subclasses. For exa... | dc2ff125493777a1084044e6cd6857a42ee323d4 | <|skeleton|>
class _NumpyPlugin:
"""A mypy plugin for handling versus numpy-specific typing tasks."""
def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc:
"""Set the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdoubl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _NumpyPlugin:
"""A mypy plugin for handling versus numpy-specific typing tasks."""
def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc:
"""Set the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdouble`."""
... | the_stack_v2_python_sparse | numpy/typing/mypy_plugin.py | numpy/numpy | train | 25,725 |
00259784bf0e573bfb11ff3cc92768e8dd6ec020 | [
"assert isinstance(proxyHandler, IProxyHandler), 'Invalid proxy handler %s' % proxyHandler\nassert methodNames, 'At least a method name is required'\nif __debug__:\n for name in methodNames:\n assert isinstance(name, str), 'Invalid method name %s' % name\nself._proxyHandler = proxyHandler\nself._methodNam... | <|body_start_0|>
assert isinstance(proxyHandler, IProxyHandler), 'Invalid proxy handler %s' % proxyHandler
assert methodNames, 'At least a method name is required'
if __debug__:
for name in methodNames:
assert isinstance(name, str), 'Invalid method name %s' % name
... | Provides a @see: IProxyHandler implementation that filters the execution based on the method name and delivers the execution to proxy handlers assigned to that method name. | ProxyFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProxyFilter:
"""Provides a @see: IProxyHandler implementation that filters the execution based on the method name and delivers the execution to proxy handlers assigned to that method name."""
def __init__(self, proxyHandler, *methodNames):
"""Construct the filter proxy. @param proxyH... | stack_v2_sparse_classes_75kplus_train_071194 | 13,156 | no_license | [
{
"docstring": "Construct the filter proxy. @param proxyHandler: IProxyHandler The proxy handler to be called if the method name is in the provided method names. @param methodNames: arguments(string) The methods names to filter the proxy by.",
"name": "__init__",
"signature": "def __init__(self, proxyHa... | 2 | null | Implement the Python class `ProxyFilter` described below.
Class description:
Provides a @see: IProxyHandler implementation that filters the execution based on the method name and delivers the execution to proxy handlers assigned to that method name.
Method signatures and docstrings:
- def __init__(self, proxyHandler,... | Implement the Python class `ProxyFilter` described below.
Class description:
Provides a @see: IProxyHandler implementation that filters the execution based on the method name and delivers the execution to proxy handlers assigned to that method name.
Method signatures and docstrings:
- def __init__(self, proxyHandler,... | a10cb774c8cbc5010950eed9342413846734fea7 | <|skeleton|>
class ProxyFilter:
"""Provides a @see: IProxyHandler implementation that filters the execution based on the method name and delivers the execution to proxy handlers assigned to that method name."""
def __init__(self, proxyHandler, *methodNames):
"""Construct the filter proxy. @param proxyH... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProxyFilter:
"""Provides a @see: IProxyHandler implementation that filters the execution based on the method name and delivers the execution to proxy handlers assigned to that method name."""
def __init__(self, proxyHandler, *methodNames):
"""Construct the filter proxy. @param proxyHandler: IProx... | the_stack_v2_python_sparse | components/ally/ally/container/impl/proxy.py | bonomali/Ally-Py | train | 0 |
345d7d2a603a770fb3a1728a012fc90321502edc | [
"super(Gzip, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner)\nself.file_name = file_name\nself.compressed_file_name = compressed_file_name\nself.options = options\nself.overwrite = overwrite\nself.answered_files = set()\nself.ret_required = False",
"cmd = 'gzip'\ni... | <|body_start_0|>
super(Gzip, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner)
self.file_name = file_name
self.compressed_file_name = compressed_file_name
self.options = options
self.overwrite = overwrite
self.answered_files ... | Gzip | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Gzip:
def __init__(self, connection, file_name, compressed_file_name=None, options=None, overwrite=False, prompt=None, newline_chars=None, runner=None):
""":param connection: Moler connection to device, terminal when command is executed. :param file_name: Name of file to be compressed. :... | stack_v2_sparse_classes_75kplus_train_071195 | 4,737 | permissive | [
{
"docstring": ":param connection: Moler connection to device, terminal when command is executed. :param file_name: Name of file to be compressed. :param compressed_file_name: Name of output compressed file if you want to specify other than default. :param options: Options of command gzip. :param overwrite: If ... | 5 | stack_v2_sparse_classes_30k_train_010287 | Implement the Python class `Gzip` described below.
Class description:
Implement the Gzip class.
Method signatures and docstrings:
- def __init__(self, connection, file_name, compressed_file_name=None, options=None, overwrite=False, prompt=None, newline_chars=None, runner=None): :param connection: Moler connection to ... | Implement the Python class `Gzip` described below.
Class description:
Implement the Gzip class.
Method signatures and docstrings:
- def __init__(self, connection, file_name, compressed_file_name=None, options=None, overwrite=False, prompt=None, newline_chars=None, runner=None): :param connection: Moler connection to ... | 5a7bb06807b6e0124c77040367d0c20f42849a4c | <|skeleton|>
class Gzip:
def __init__(self, connection, file_name, compressed_file_name=None, options=None, overwrite=False, prompt=None, newline_chars=None, runner=None):
""":param connection: Moler connection to device, terminal when command is executed. :param file_name: Name of file to be compressed. :... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Gzip:
def __init__(self, connection, file_name, compressed_file_name=None, options=None, overwrite=False, prompt=None, newline_chars=None, runner=None):
""":param connection: Moler connection to device, terminal when command is executed. :param file_name: Name of file to be compressed. :param compress... | the_stack_v2_python_sparse | moler/cmd/unix/gzip.py | nokia/moler | train | 60 | |
6b16751ca552c52d250410ac9fdb84c5d266b58d | [
"qs, target_qs = self._get_q_values(s_batch, a_batch, r_batch, sp_batch, done_mask)\nloss = nn.functional.smooth_l1_loss(qs, target_qs, reduction='none')\nreturn loss",
"s_batch, a_batch, r_batch, sp_batch, done_mask_batch, weights = sampled_batch\nself.optimizer.zero_grad()\nelement_wise_loss = self._calc_loss(s... | <|body_start_0|>
qs, target_qs = self._get_q_values(s_batch, a_batch, r_batch, sp_batch, done_mask)
loss = nn.functional.smooth_l1_loss(qs, target_qs, reduction='none')
return loss
<|end_body_0|>
<|body_start_1|>
s_batch, a_batch, r_batch, sp_batch, done_mask_batch, weights = sampled_ba... | PerDblDqn | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PerDblDqn:
def _calc_loss(self, s_batch: Tensor, a_batch: Tensor, r_batch: Tensor, sp_batch: Tensor, done_mask: Tensor) -> Tensor:
"""Calculate the Huber loss (SmoothL1Loss) of this step. loss = SmoothL1Loss(Q_sample(s) - Q(s, a)) :param s_batch: state batch (batch_size, n_channel, image... | stack_v2_sparse_classes_75kplus_train_071196 | 2,456 | no_license | [
{
"docstring": "Calculate the Huber loss (SmoothL1Loss) of this step. loss = SmoothL1Loss(Q_sample(s) - Q(s, a)) :param s_batch: state batch (batch_size, n_channel, image_height, image_width) :param sp_batch: next state batch (batch_size, n_channel, image_height, image_width) :param a_batch: The action the agen... | 2 | stack_v2_sparse_classes_30k_train_015712 | Implement the Python class `PerDblDqn` described below.
Class description:
Implement the PerDblDqn class.
Method signatures and docstrings:
- def _calc_loss(self, s_batch: Tensor, a_batch: Tensor, r_batch: Tensor, sp_batch: Tensor, done_mask: Tensor) -> Tensor: Calculate the Huber loss (SmoothL1Loss) of this step. lo... | Implement the Python class `PerDblDqn` described below.
Class description:
Implement the PerDblDqn class.
Method signatures and docstrings:
- def _calc_loss(self, s_batch: Tensor, a_batch: Tensor, r_batch: Tensor, sp_batch: Tensor, done_mask: Tensor) -> Tensor: Calculate the Huber loss (SmoothL1Loss) of this step. lo... | c9421d5058d5144aec855f4be66673830652845b | <|skeleton|>
class PerDblDqn:
def _calc_loss(self, s_batch: Tensor, a_batch: Tensor, r_batch: Tensor, sp_batch: Tensor, done_mask: Tensor) -> Tensor:
"""Calculate the Huber loss (SmoothL1Loss) of this step. loss = SmoothL1Loss(Q_sample(s) - Q(s, a)) :param s_batch: state batch (batch_size, n_channel, image... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PerDblDqn:
def _calc_loss(self, s_batch: Tensor, a_batch: Tensor, r_batch: Tensor, sp_batch: Tensor, done_mask: Tensor) -> Tensor:
"""Calculate the Huber loss (SmoothL1Loss) of this step. loss = SmoothL1Loss(Q_sample(s) - Q(s, a)) :param s_batch: state batch (batch_size, n_channel, image_height, image... | the_stack_v2_python_sparse | core/ml/dqn/model/per_dbl_dqn.py | XiaoMutt/qingting | train | 1 | |
2093a28f0be7675b204dab7f6fa01d38bb512cc3 | [
"self.inletNode = inletNode\nself.idealinletNode = idealinletNode\nself.outletNode = outletNode",
"\"\"\"the cycle based on compressor inlet\"\"\"\n'node outelt = state 1'\n'Exp'\n'State 1, P1,T1 known'\n'pressure loss and heat exchange parameters'\nself.dp = node[self.inletNode].p - node[self.idealinletNode].p\n... | <|body_start_0|>
self.inletNode = inletNode
self.idealinletNode = idealinletNode
self.outletNode = outletNode
<|end_body_0|>
<|body_start_1|>
"""the cycle based on compressor inlet"""
'node outelt = state 1'
'Exp'
'State 1, P1,T1 known'
'pressure loss and... | evaporator component | Evaporator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Evaporator:
"""evaporator component"""
def __init__(self, inletNode, outletNode, idealinletNode):
"""init evaporator node"""
<|body_0|>
def simulate(self, node, mdot_a, cp, Ta_in, Ta_out):
"""ideal"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_071197 | 3,605 | no_license | [
{
"docstring": "init evaporator node",
"name": "__init__",
"signature": "def __init__(self, inletNode, outletNode, idealinletNode)"
},
{
"docstring": "ideal",
"name": "simulate",
"signature": "def simulate(self, node, mdot_a, cp, Ta_in, Ta_out)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013983 | Implement the Python class `Evaporator` described below.
Class description:
evaporator component
Method signatures and docstrings:
- def __init__(self, inletNode, outletNode, idealinletNode): init evaporator node
- def simulate(self, node, mdot_a, cp, Ta_in, Ta_out): ideal | Implement the Python class `Evaporator` described below.
Class description:
evaporator component
Method signatures and docstrings:
- def __init__(self, inletNode, outletNode, idealinletNode): init evaporator node
- def simulate(self, node, mdot_a, cp, Ta_in, Ta_out): ideal
<|skeleton|>
class Evaporator:
"""evapo... | 6843fd139ff2355b98eac0ac9cf09aee6fede7cd | <|skeleton|>
class Evaporator:
"""evaporator component"""
def __init__(self, inletNode, outletNode, idealinletNode):
"""init evaporator node"""
<|body_0|>
def simulate(self, node, mdot_a, cp, Ta_in, Ta_out):
"""ideal"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Evaporator:
"""evaporator component"""
def __init__(self, inletNode, outletNode, idealinletNode):
"""init evaporator node"""
self.inletNode = inletNode
self.idealinletNode = idealinletNode
self.outletNode = outletNode
def simulate(self, node, mdot_a, cp, Ta_in, Ta_out... | the_stack_v2_python_sparse | original/component.py | Nathanzhn/GA4 | train | 0 |
9f20acdf38992d8a639986af8b5202072131f0b1 | [
"tuples = self.fscd_tester.machine.read_sensors(self.fscd_tester.sensors, None)\ncount = len(tuples['slot1'])\nself.assertEqual(count, 41, 'Incorrect sensor tupple count')",
"tuples = self.fscd_tester.machine.read_fans(self.fscd_tester.fans)\ncount = len(tuples)\nself.assertEqual(count, 3, 'Incorrect fan tupple c... | <|body_start_0|>
tuples = self.fscd_tester.machine.read_sensors(self.fscd_tester.sensors, None)
count = len(tuples['slot1'])
self.assertEqual(count, 41, 'Incorrect sensor tupple count')
<|end_body_0|>
<|body_start_1|>
tuples = self.fscd_tester.machine.read_fans(self.fscd_tester.fans)
... | FscdBmcMachineUnitTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FscdBmcMachineUnitTest:
def test_sensor_read(self):
"""Test if sensor tuples are getting built. 'linear_dimm' has a source that reads a file and dumps data like from platform."""
<|body_0|>
def test_fan_read(self):
"""Test if fan tuples are getting built. 'fan 2' has... | stack_v2_sparse_classes_75kplus_train_071198 | 4,109 | no_license | [
{
"docstring": "Test if sensor tuples are getting built. 'linear_dimm' has a source that reads a file and dumps data like from platform.",
"name": "test_sensor_read",
"signature": "def test_sensor_read(self)"
},
{
"docstring": "Test if fan tuples are getting built. 'fan 2' has a source that read... | 2 | stack_v2_sparse_classes_30k_train_020446 | Implement the Python class `FscdBmcMachineUnitTest` described below.
Class description:
Implement the FscdBmcMachineUnitTest class.
Method signatures and docstrings:
- def test_sensor_read(self): Test if sensor tuples are getting built. 'linear_dimm' has a source that reads a file and dumps data like from platform.
-... | Implement the Python class `FscdBmcMachineUnitTest` described below.
Class description:
Implement the FscdBmcMachineUnitTest class.
Method signatures and docstrings:
- def test_sensor_read(self): Test if sensor tuples are getting built. 'linear_dimm' has a source that reads a file and dumps data like from platform.
-... | 32777c66a8410d767eae15baabf71c61a0bef13c | <|skeleton|>
class FscdBmcMachineUnitTest:
def test_sensor_read(self):
"""Test if sensor tuples are getting built. 'linear_dimm' has a source that reads a file and dumps data like from platform."""
<|body_0|>
def test_fan_read(self):
"""Test if fan tuples are getting built. 'fan 2' has... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FscdBmcMachineUnitTest:
def test_sensor_read(self):
"""Test if sensor tuples are getting built. 'linear_dimm' has a source that reads a file and dumps data like from platform."""
tuples = self.fscd_tester.machine.read_sensors(self.fscd_tester.sensors, None)
count = len(tuples['slot1'])... | the_stack_v2_python_sparse | common/recipes-core/fscd3/fscd/fscd_test/fsc_bmc_machine_tester.py | facebook/openbmc | train | 684 | |
038049f3079be001499757f663419da2dfd6faeb | [
"def postorder(node):\n return postorder(node.left) + postorder(node.right) + [node.val] if node else []\nserialize_data = ' '.join(map(str, postorder(root)))\nreturn serialize_data",
"def helper(lower=float('-inf'), upper=float('inf')):\n if not data or data[-1] < lower or data[-1] > upper:\n return... | <|body_start_0|>
def postorder(node):
return postorder(node.left) + postorder(node.right) + [node.val] if node else []
serialize_data = ' '.join(map(str, postorder(root)))
return serialize_data
<|end_body_0|>
<|body_start_1|>
def helper(lower=float('-inf'), upper=float('inf'... | 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_071199 | 1,609 | 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_046665 | 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:... | f93380721b8383817fe2b0d728deca1321c9ef45 | <|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"""
def postorder(node):
return postorder(node.left) + postorder(node.right) + [node.val] if node else []
serialize_data = ' '.join(map(str, postorder(root)))
ret... | the_stack_v2_python_sparse | explore/2020/october/Serialize_and_Deserialize_BST.py | lixiang2017/leetcode | train | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.