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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dca317ce53ffc6c0c2c7104e0ff4915f75bb74a3 | [
"super(NeuralFingerprint, self).__init__()\nself.num_layers = len(conv_layer_sizes)\nself.output_size = output_size\nself.degree_list = degree_list\nself.conv_layers = nn.ModuleList()\nself.out_layers = nn.ModuleList()\nself.device = device\nlayers_sizes = [node_size] + conv_layer_sizes\nfor input_size in layers_si... | <|body_start_0|>
super(NeuralFingerprint, self).__init__()
self.num_layers = len(conv_layer_sizes)
self.output_size = output_size
self.degree_list = degree_list
self.conv_layers = nn.ModuleList()
self.out_layers = nn.ModuleList()
self.device = device
layer... | NeuralFingerprint | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NeuralFingerprint:
def __init__(self, node_size, edge_size, conv_layer_sizes, output_size, degree_list, device, batch_normalize=True):
"""Args: node_size (int): dimension of node representations edge_size (int): dimension of edge representations conv_layer_sizes (list of int): the length... | stack_v2_sparse_classes_75kplus_train_067300 | 3,468 | permissive | [
{
"docstring": "Args: node_size (int): dimension of node representations edge_size (int): dimension of edge representations conv_layer_sizes (list of int): the lengths of the output vectors of convolutional layers output_size (int): length of the finger print vector type_map (dict string:string): type of the ba... | 2 | stack_v2_sparse_classes_30k_train_004968 | Implement the Python class `NeuralFingerprint` described below.
Class description:
Implement the NeuralFingerprint class.
Method signatures and docstrings:
- def __init__(self, node_size, edge_size, conv_layer_sizes, output_size, degree_list, device, batch_normalize=True): Args: node_size (int): dimension of node rep... | Implement the Python class `NeuralFingerprint` described below.
Class description:
Implement the NeuralFingerprint class.
Method signatures and docstrings:
- def __init__(self, node_size, edge_size, conv_layer_sizes, output_size, degree_list, device, batch_normalize=True): Args: node_size (int): dimension of node rep... | 4d56d5174c7ce4b15157d112083eb92e57288b04 | <|skeleton|>
class NeuralFingerprint:
def __init__(self, node_size, edge_size, conv_layer_sizes, output_size, degree_list, device, batch_normalize=True):
"""Args: node_size (int): dimension of node representations edge_size (int): dimension of edge representations conv_layer_sizes (list of int): the length... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NeuralFingerprint:
def __init__(self, node_size, edge_size, conv_layer_sizes, output_size, degree_list, device, batch_normalize=True):
"""Args: node_size (int): dimension of node representations edge_size (int): dimension of edge representations conv_layer_sizes (list of int): the lengths of the outpu... | the_stack_v2_python_sparse | MultiDCP/models/neural_fingerprint.py | qiaoliuhub/MultiDCP | train | 3 | |
576174ec80c2e0505b514bdf0e0667466b665a0f | [
"if kwargs_lens_eqn_solver is None:\n kwargs_lens_eqn_solver = {}\nra_source, dec_source = self.source_position(kwargs_ps)\nra_image, dec_image = self._solver.image_position_from_source(ra_source, dec_source, kwargs_lens, magnification_limit=magnification_limit, **kwargs_lens_eqn_solver)\nreturn (ra_image, dec_i... | <|body_start_0|>
if kwargs_lens_eqn_solver is None:
kwargs_lens_eqn_solver = {}
ra_source, dec_source = self.source_position(kwargs_ps)
ra_image, dec_image = self._solver.image_position_from_source(ra_source, dec_source, kwargs_lens, magnification_limit=magnification_limit, **kwargs_... | class of a single point source defined in the original source coordinate position that is lensed. The lens equation is solved to compute the image positions for the specified source position. Name within the PointSource module: 'SOURCE_POSITION' parameters: ra_source, dec_source, source_amp, mag_pert (optional) If fixe... | SourcePositions | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SourcePositions:
"""class of a single point source defined in the original source coordinate position that is lensed. The lens equation is solved to compute the image positions for the specified source position. Name within the PointSource module: 'SOURCE_POSITION' parameters: ra_source, dec_sour... | stack_v2_sparse_classes_75kplus_train_067301 | 5,483 | permissive | [
{
"docstring": "on-sky image positions :param kwargs_ps: keyword arguments of the point source model :param kwargs_lens: keyword argument list of the lens model(s), only used when requiring the lens equation solver :param magnification_limit: float >0 or None, if float is set and additional images are computed,... | 4 | stack_v2_sparse_classes_30k_train_026789 | Implement the Python class `SourcePositions` described below.
Class description:
class of a single point source defined in the original source coordinate position that is lensed. The lens equation is solved to compute the image positions for the specified source position. Name within the PointSource module: 'SOURCE_PO... | Implement the Python class `SourcePositions` described below.
Class description:
class of a single point source defined in the original source coordinate position that is lensed. The lens equation is solved to compute the image positions for the specified source position. Name within the PointSource module: 'SOURCE_PO... | 73c9645f26f6983fe7961104075ebe8bf7a4b54c | <|skeleton|>
class SourcePositions:
"""class of a single point source defined in the original source coordinate position that is lensed. The lens equation is solved to compute the image positions for the specified source position. Name within the PointSource module: 'SOURCE_POSITION' parameters: ra_source, dec_sour... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SourcePositions:
"""class of a single point source defined in the original source coordinate position that is lensed. The lens equation is solved to compute the image positions for the specified source position. Name within the PointSource module: 'SOURCE_POSITION' parameters: ra_source, dec_source, source_am... | the_stack_v2_python_sparse | lenstronomy/PointSource/Types/source_position.py | lenstronomy/lenstronomy | train | 41 |
b5972ef8dd652525f3c5872fdeda865bac35af64 | [
"for i in range(len(nums)):\n for j in range(i + 1, len(nums)):\n if nums[i] == nums[j]:\n return nums[i]",
"res = []\nfor i in range(len(nums)):\n if nums[i] not in res:\n res.append(nums[i])\n else:\n return nums[i]",
"i = 0\nwhile i < len(nums):\n if nums[i] == i:\... | <|body_start_0|>
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] == nums[j]:
return nums[i]
<|end_body_0|>
<|body_start_1|>
res = []
for i in range(len(nums)):
if nums[i] not in res:
res.append(n... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findRepeatNumber(self, nums: List[int]) -> int:
"""找到任意个重复的数组即可,首先可以暴力遍历 但是暴力遍历肯定会存在内存溢出的问题,即超时"""
<|body_0|>
def findRepeatNumber1(self, nums: List[int]) -> int:
"""暴力遍历肯定不可取, 下面想新的办法 由于只需要找到数组中任意一个重复的数字,因此遍历数组,遇到重复的数字即返回 为了判断一个数字是否重复遇到,使用列表存储已经遇到的数字,如... | stack_v2_sparse_classes_75kplus_train_067302 | 4,455 | no_license | [
{
"docstring": "找到任意个重复的数组即可,首先可以暴力遍历 但是暴力遍历肯定会存在内存溢出的问题,即超时",
"name": "findRepeatNumber",
"signature": "def findRepeatNumber(self, nums: List[int]) -> int"
},
{
"docstring": "暴力遍历肯定不可取, 下面想新的办法 由于只需要找到数组中任意一个重复的数字,因此遍历数组,遇到重复的数字即返回 为了判断一个数字是否重复遇到,使用列表存储已经遇到的数字,如果遇到数字已经在 列表里面,则当前数字是重复数字 初始化列表为空列... | 4 | stack_v2_sparse_classes_30k_train_049250 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findRepeatNumber(self, nums: List[int]) -> int: 找到任意个重复的数组即可,首先可以暴力遍历 但是暴力遍历肯定会存在内存溢出的问题,即超时
- def findRepeatNumber1(self, nums: List[int]) -> int: 暴力遍历肯定不可取, 下面想新的办法 由于只需要找到... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findRepeatNumber(self, nums: List[int]) -> int: 找到任意个重复的数组即可,首先可以暴力遍历 但是暴力遍历肯定会存在内存溢出的问题,即超时
- def findRepeatNumber1(self, nums: List[int]) -> int: 暴力遍历肯定不可取, 下面想新的办法 由于只需要找到... | 51943e2c2c4ec70c7c1d5b53c9fdf0a719428d7a | <|skeleton|>
class Solution:
def findRepeatNumber(self, nums: List[int]) -> int:
"""找到任意个重复的数组即可,首先可以暴力遍历 但是暴力遍历肯定会存在内存溢出的问题,即超时"""
<|body_0|>
def findRepeatNumber1(self, nums: List[int]) -> int:
"""暴力遍历肯定不可取, 下面想新的办法 由于只需要找到数组中任意一个重复的数字,因此遍历数组,遇到重复的数字即返回 为了判断一个数字是否重复遇到,使用列表存储已经遇到的数字,如... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def findRepeatNumber(self, nums: List[int]) -> int:
"""找到任意个重复的数组即可,首先可以暴力遍历 但是暴力遍历肯定会存在内存溢出的问题,即超时"""
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] == nums[j]:
return nums[i]
def findRepeatNumber1(self, n... | the_stack_v2_python_sparse | 剑指offer/PythonVersion/03_数组中重复的数字.py | LeBron-Jian/BasicAlgorithmPractice | train | 13 | |
24cc5a34d1144648a5b8e8e203ecc2e9a7737025 | [
"self.comment('Step 1. Test current state')\ncurrentState = self.state()\nself.comment('Current state is ' + currentState)\nif not currentState:\n self.fail('Failed to get current state from the phone')\nif currentState != 'com.nokia.homescreen':\n self.fail('Current state not com.nokia.homescreen')\nself.com... | <|body_start_0|>
self.comment('Step 1. Test current state')
currentState = self.state()
self.comment('Current state is ' + currentState)
if not currentState:
self.fail('Failed to get current state from the phone')
if currentState != 'com.nokia.homescreen':
... | testBed | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class testBed:
def testState(self):
"""@tcId State"""
<|body_0|>
def testStateInMainMenu(self):
"""@tcId State inMainMenu"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.comment('Step 1. Test current state')
currentState = self.state()
... | stack_v2_sparse_classes_75kplus_train_067303 | 1,414 | no_license | [
{
"docstring": "@tcId State",
"name": "testState",
"signature": "def testState(self)"
},
{
"docstring": "@tcId State inMainMenu",
"name": "testStateInMainMenu",
"signature": "def testStateInMainMenu(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019879 | Implement the Python class `testBed` described below.
Class description:
Implement the testBed class.
Method signatures and docstrings:
- def testState(self): @tcId State
- def testStateInMainMenu(self): @tcId State inMainMenu | Implement the Python class `testBed` described below.
Class description:
Implement the testBed class.
Method signatures and docstrings:
- def testState(self): @tcId State
- def testStateInMainMenu(self): @tcId State inMainMenu
<|skeleton|>
class testBed:
def testState(self):
"""@tcId State"""
<|... | 0bc1f24ac8e8fb7d4c53f91ae2d1322d385e296a | <|skeleton|>
class testBed:
def testState(self):
"""@tcId State"""
<|body_0|>
def testStateInMainMenu(self):
"""@tcId State inMainMenu"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class testBed:
def testState(self):
"""@tcId State"""
self.comment('Step 1. Test current state')
currentState = self.state()
self.comment('Current state is ' + currentState)
if not currentState:
self.fail('Failed to get current state from the phone')
if cu... | the_stack_v2_python_sparse | test_scripts/self_tests/state.py | slimsymphony/astt | train | 4 | |
b31aba98df457d00dc052d52d2165d7210986b71 | [
"n = words_list.Length()\nint_chunk = BytesUtils.ToInteger(bytes_chunk, endianness=endianness)\nword1_idx = int_chunk % n\nword2_idx = (int_chunk // n + word1_idx) % n\nword3_idx = (int_chunk // n // n + word2_idx) % n\nreturn [words_list.GetWordAtIdx(w) for w in (word1_idx, word2_idx, word3_idx)]",
"n = words_li... | <|body_start_0|>
n = words_list.Length()
int_chunk = BytesUtils.ToInteger(bytes_chunk, endianness=endianness)
word1_idx = int_chunk % n
word2_idx = (int_chunk // n + word1_idx) % n
word3_idx = (int_chunk // n // n + word2_idx) % n
return [words_list.GetWordAtIdx(w) for w ... | Class container for mnemonic utility functions. | MnemonicUtils | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MnemonicUtils:
"""Class container for mnemonic utility functions."""
def BytesChunkToWords(bytes_chunk: bytes, words_list: MnemonicWordsList, endianness: Literal['little', 'big']) -> List[str]:
"""Get words from a bytes chunk. Args: bytes_chunk (bytes) : Bytes chunk words_list (Mnemo... | stack_v2_sparse_classes_75kplus_train_067304 | 10,670 | permissive | [
{
"docstring": "Get words from a bytes chunk. Args: bytes_chunk (bytes) : Bytes chunk words_list (MnemonicWordsList object): Mnemonic list endianness (\"big\" or \"little\") : Bytes endianness Returns: list[str]: 3 word indexes",
"name": "BytesChunkToWords",
"signature": "def BytesChunkToWords(bytes_chu... | 2 | stack_v2_sparse_classes_30k_train_026478 | Implement the Python class `MnemonicUtils` described below.
Class description:
Class container for mnemonic utility functions.
Method signatures and docstrings:
- def BytesChunkToWords(bytes_chunk: bytes, words_list: MnemonicWordsList, endianness: Literal['little', 'big']) -> List[str]: Get words from a bytes chunk. ... | Implement the Python class `MnemonicUtils` described below.
Class description:
Class container for mnemonic utility functions.
Method signatures and docstrings:
- def BytesChunkToWords(bytes_chunk: bytes, words_list: MnemonicWordsList, endianness: Literal['little', 'big']) -> List[str]: Get words from a bytes chunk. ... | d15c75ddd74e4838c396a0d036ef6faf11b06a4b | <|skeleton|>
class MnemonicUtils:
"""Class container for mnemonic utility functions."""
def BytesChunkToWords(bytes_chunk: bytes, words_list: MnemonicWordsList, endianness: Literal['little', 'big']) -> List[str]:
"""Get words from a bytes chunk. Args: bytes_chunk (bytes) : Bytes chunk words_list (Mnemo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MnemonicUtils:
"""Class container for mnemonic utility functions."""
def BytesChunkToWords(bytes_chunk: bytes, words_list: MnemonicWordsList, endianness: Literal['little', 'big']) -> List[str]:
"""Get words from a bytes chunk. Args: bytes_chunk (bytes) : Bytes chunk words_list (MnemonicWordsList ... | the_stack_v2_python_sparse | bip_utils/utils/mnemonic/mnemonic_utils.py | ebellocchia/bip_utils | train | 244 |
a54a5916a46a898e5d6d80341137857198466822 | [
"\"\"\"\n Make sure you do not delete the following line. If you would like to\n use Manhattan distances instead of maze distances in order to save\n on initialization time, please take a look at\n CaptureAgent.registerInitialState in captureAgents.py.\n \"\"\"\nCaptureAgent.registerInitialState(self... | <|body_start_0|>
"""
Make sure you do not delete the following line. If you would like to
use Manhattan distances instead of maze distances in order to save
on initialization time, please take a look at
CaptureAgent.registerInitialState in captureAgents.py.
... | A Dummy agent to serve as an example of the necessary agent structure. You should look at baselineTeam.py for more details about how to create an agent as this is the bare minimum. | DummyAgent | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DummyAgent:
"""A Dummy agent to serve as an example of the necessary agent structure. You should look at baselineTeam.py for more details about how to create an agent as this is the bare minimum."""
def registerInitialState(self, gameState):
"""This method handles the initial setup o... | stack_v2_sparse_classes_75kplus_train_067305 | 16,102 | no_license | [
{
"docstring": "This method handles the initial setup of the agent to populate useful fields (such as what team we're on). A distanceCalculator instance caches the maze distances between each pair of positions, so your agents can use: self.distancer.getDistance(p1, p2) IMPORTANT: This method may run for at most... | 2 | stack_v2_sparse_classes_30k_train_038877 | Implement the Python class `DummyAgent` described below.
Class description:
A Dummy agent to serve as an example of the necessary agent structure. You should look at baselineTeam.py for more details about how to create an agent as this is the bare minimum.
Method signatures and docstrings:
- def registerInitialState(... | Implement the Python class `DummyAgent` described below.
Class description:
A Dummy agent to serve as an example of the necessary agent structure. You should look at baselineTeam.py for more details about how to create an agent as this is the bare minimum.
Method signatures and docstrings:
- def registerInitialState(... | ab9498434599568bdb8263122fb95f390f155b85 | <|skeleton|>
class DummyAgent:
"""A Dummy agent to serve as an example of the necessary agent structure. You should look at baselineTeam.py for more details about how to create an agent as this is the bare minimum."""
def registerInitialState(self, gameState):
"""This method handles the initial setup o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DummyAgent:
"""A Dummy agent to serve as an example of the necessary agent structure. You should look at baselineTeam.py for more details about how to create an agent as this is the bare minimum."""
def registerInitialState(self, gameState):
"""This method handles the initial setup of the agent t... | the_stack_v2_python_sparse | pacman-contest/dogeTeam.py | mylzsd/comp90054-pacman | train | 0 |
cfe863f9df7c7150f540b9993d97552d74bca041 | [
"super(RNNDecoder, self).__init__()\nself.batch = batch\nself.units = units\nself.embedding = tf.keras.layers.Embedding(vocab, embedding)\nself.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)\nself.F = tf.keras.layers.Dense(vocab)",
"self_attentio... | <|body_start_0|>
super(RNNDecoder, self).__init__()
self.batch = batch
self.units = units
self.embedding = tf.keras.layers.Embedding(vocab, embedding)
self.gru = tf.keras.layers.GRU(units, recurrent_initializer='glorot_uniform', return_sequences=True, return_state=True)
s... | class that instantiates a RNN Decoder | RNNDecoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RNNDecoder:
"""class that instantiates a RNN Decoder"""
def __init__(self, vocab, embedding, units, batch):
"""constructor"""
<|body_0|>
def call(self, x, s_prev, hidden_states):
"""function that builds the decoder"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_75kplus_train_067306 | 2,756 | no_license | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, vocab, embedding, units, batch)"
},
{
"docstring": "function that builds the decoder",
"name": "call",
"signature": "def call(self, x, s_prev, hidden_states)"
}
] | 2 | null | Implement the Python class `RNNDecoder` described below.
Class description:
class that instantiates a RNN Decoder
Method signatures and docstrings:
- def __init__(self, vocab, embedding, units, batch): constructor
- def call(self, x, s_prev, hidden_states): function that builds the decoder | Implement the Python class `RNNDecoder` described below.
Class description:
class that instantiates a RNN Decoder
Method signatures and docstrings:
- def __init__(self, vocab, embedding, units, batch): constructor
- def call(self, x, s_prev, hidden_states): function that builds the decoder
<|skeleton|>
class RNNDeco... | 7d3b348aec3b20da25b162b71f150c87c7c28d71 | <|skeleton|>
class RNNDecoder:
"""class that instantiates a RNN Decoder"""
def __init__(self, vocab, embedding, units, batch):
"""constructor"""
<|body_0|>
def call(self, x, s_prev, hidden_states):
"""function that builds the decoder"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RNNDecoder:
"""class that instantiates a RNN Decoder"""
def __init__(self, vocab, embedding, units, batch):
"""constructor"""
super(RNNDecoder, self).__init__()
self.batch = batch
self.units = units
self.embedding = tf.keras.layers.Embedding(vocab, embedding)
... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/2-rnn_decoder.py | dacastanogo/holbertonschool-machine_learning | train | 0 |
ae44af1ebfa1c9d12a6332a4bcfb71246165c8f0 | [
"f = cStringIO.StringIO()\npickler = self.pickler(f, protocol=-1)\nsession_data, callbacks, tasklets = self._dumps(pickler, data, clean_callbacks)\nset_persistent_id(pickler, lambda o: None)\npickler.dump(callbacks)\nfor t in tasklets:\n t.kill()\nreturn (session_data, f.getvalue())",
"p = self.unpickler(cStri... | <|body_start_0|>
f = cStringIO.StringIO()
pickler = self.pickler(f, protocol=-1)
session_data, callbacks, tasklets = self._dumps(pickler, data, clean_callbacks)
set_persistent_id(pickler, lambda o: None)
pickler.dump(callbacks)
for t in tasklets:
t.kill()
... | Pickle | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Pickle:
def dumps(self, data, clean_callbacks):
"""Serialize an objects graph In: - ``data`` -- the objects graph - ``clean_callbacks`` -- do we have to forget the old callbacks? Out: - data kept into the session - data kept into the state"""
<|body_0|>
def loads(self, sessi... | stack_v2_sparse_classes_75kplus_train_067307 | 4,755 | permissive | [
{
"docstring": "Serialize an objects graph In: - ``data`` -- the objects graph - ``clean_callbacks`` -- do we have to forget the old callbacks? Out: - data kept into the session - data kept into the state",
"name": "dumps",
"signature": "def dumps(self, data, clean_callbacks)"
},
{
"docstring": ... | 2 | stack_v2_sparse_classes_30k_train_049089 | Implement the Python class `Pickle` described below.
Class description:
Implement the Pickle class.
Method signatures and docstrings:
- def dumps(self, data, clean_callbacks): Serialize an objects graph In: - ``data`` -- the objects graph - ``clean_callbacks`` -- do we have to forget the old callbacks? Out: - data ke... | Implement the Python class `Pickle` described below.
Class description:
Implement the Pickle class.
Method signatures and docstrings:
- def dumps(self, data, clean_callbacks): Serialize an objects graph In: - ``data`` -- the objects graph - ``clean_callbacks`` -- do we have to forget the old callbacks? Out: - data ke... | 9e251f053c4edeb46b59b46d22049b29d1498727 | <|skeleton|>
class Pickle:
def dumps(self, data, clean_callbacks):
"""Serialize an objects graph In: - ``data`` -- the objects graph - ``clean_callbacks`` -- do we have to forget the old callbacks? Out: - data kept into the session - data kept into the state"""
<|body_0|>
def loads(self, sessi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Pickle:
def dumps(self, data, clean_callbacks):
"""Serialize an objects graph In: - ``data`` -- the objects graph - ``clean_callbacks`` -- do we have to forget the old callbacks? Out: - data kept into the session - data kept into the state"""
f = cStringIO.StringIO()
pickler = self.pic... | the_stack_v2_python_sparse | cifrado/web/codigo/Python/virtualenv-15.1.0/NAGARE_HOME/Lib/site-packages/nagare-0.5.1-py2.7.egg/nagare/sessions/serializer.py | SanchezRuizCarlosEduardo/disor | train | 0 | |
deef330d6975a7ef77189a3b834ceeb97a8d0946 | [
"length = len(s)\nsize = [0 for i in range(length)]\nstack = [0 for i in range(length)]\nstackPtr = 0\nsumming = 0\nres = 0\nfor i, char in enumerate(s):\n if char == '(':\n stack[stackPtr] = i\n stackPtr += 1\n elif char == ')':\n if stackPtr > 0:\n prev = stack[stackPtr - 1]\... | <|body_start_0|>
length = len(s)
size = [0 for i in range(length)]
stack = [0 for i in range(length)]
stackPtr = 0
summing = 0
res = 0
for i, char in enumerate(s):
if char == '(':
stack[stackPtr] = i
stackPtr += 1
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def longestValidParentheses(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def longestValidParentheses2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
length = len(s)
size = [0 for i in r... | stack_v2_sparse_classes_75kplus_train_067308 | 1,528 | permissive | [
{
"docstring": ":type s: str :rtype: int",
"name": "longestValidParentheses",
"signature": "def longestValidParentheses(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "longestValidParentheses2",
"signature": "def longestValidParentheses2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018029 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestValidParentheses(self, s): :type s: str :rtype: int
- def longestValidParentheses2(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def longestValidParentheses(self, s): :type s: str :rtype: int
- def longestValidParentheses2(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def longestVal... | c8bf33af30569177c5276ffcd72a8d93ba4c402a | <|skeleton|>
class Solution:
def longestValidParentheses(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def longestValidParentheses2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def longestValidParentheses(self, s):
""":type s: str :rtype: int"""
length = len(s)
size = [0 for i in range(length)]
stack = [0 for i in range(length)]
stackPtr = 0
summing = 0
res = 0
for i, char in enumerate(s):
if char ... | the_stack_v2_python_sparse | 1-100/31-40/32-longestValidParenthesis/longestValidParenthesis.py | xuychen/Leetcode | train | 0 | |
fa7729eddfc4687c218b7d79731aa9dcbd0e12d6 | [
"super(Decoder, self).__init__()\nself.attn1 = MHA(D_embed, Q, V, H, local_attn_size=local_attn_size, fwd_attn=fwd_attn, device=device)\nself.attn2 = MHA(D_embed, Q, V, H, local_attn_size=local_attn_size, fwd_attn=fwd_attn, device=device)\nself.ffwd = PFF(D_embed)\nself.dropout = nn.Dropout(p=dropout)\nself.lnorm1 ... | <|body_start_0|>
super(Decoder, self).__init__()
self.attn1 = MHA(D_embed, Q, V, H, local_attn_size=local_attn_size, fwd_attn=fwd_attn, device=device)
self.attn2 = MHA(D_embed, Q, V, H, local_attn_size=local_attn_size, fwd_attn=fwd_attn, device=device)
self.ffwd = PFF(D_embed)
se... | Multi-head attention decoder based on 'Attention is All You Need' paper. [1] Masked multi-head attention of outputs [2] Multi-head attention of encoder and [1] [3] Position-wise FFN | Decoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Decoder:
"""Multi-head attention decoder based on 'Attention is All You Need' paper. [1] Masked multi-head attention of outputs [2] Multi-head attention of encoder and [1] [3] Position-wise FFN"""
def __init__(self, D_embed, Q, V, H, local_attn_size=None, fwd_attn=True, dropout=0.5, device=N... | stack_v2_sparse_classes_75kplus_train_067309 | 2,151 | no_license | [
{
"docstring": "params D_embed (scalar): embedded output feature dimensions Q (int): query matrix dimension V (int): value matrix dimension H (int): number of attention heads local_attn_size (int): local attention mask size fwd_attn (bool): forward attention mask indicator device (torch.device): tensor device",... | 2 | stack_v2_sparse_classes_30k_train_007854 | Implement the Python class `Decoder` described below.
Class description:
Multi-head attention decoder based on 'Attention is All You Need' paper. [1] Masked multi-head attention of outputs [2] Multi-head attention of encoder and [1] [3] Position-wise FFN
Method signatures and docstrings:
- def __init__(self, D_embed,... | Implement the Python class `Decoder` described below.
Class description:
Multi-head attention decoder based on 'Attention is All You Need' paper. [1] Masked multi-head attention of outputs [2] Multi-head attention of encoder and [1] [3] Position-wise FFN
Method signatures and docstrings:
- def __init__(self, D_embed,... | 274ff8db17271106155e34725ae69b1a35c962b2 | <|skeleton|>
class Decoder:
"""Multi-head attention decoder based on 'Attention is All You Need' paper. [1] Masked multi-head attention of outputs [2] Multi-head attention of encoder and [1] [3] Position-wise FFN"""
def __init__(self, D_embed, Q, V, H, local_attn_size=None, fwd_attn=True, dropout=0.5, device=N... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Decoder:
"""Multi-head attention decoder based on 'Attention is All You Need' paper. [1] Masked multi-head attention of outputs [2] Multi-head attention of encoder and [1] [3] Position-wise FFN"""
def __init__(self, D_embed, Q, V, H, local_attn_size=None, fwd_attn=True, dropout=0.5, device=None):
... | the_stack_v2_python_sparse | ml/models/Decoder.py | gravaman/fleishco | train | 0 |
b2b22c2d6528cffb115d2b73a52986801d0fb54d | [
"Frame.__init__(self, fenetre, width=300, height=700, bg='red')\nself.grid(sticky=E + W)\nself.robots_us()\nself.robots_enemy()",
"Frobots_us = LabelFrame(self, text='Donnees sur nos robots', bg='blue')\nself.robots('big', 0, Frobots_us)\nself.robots('mini', 1, Frobots_us)\nFrobots_us.grid(column=0, row=0, sticky... | <|body_start_0|>
Frame.__init__(self, fenetre, width=300, height=700, bg='red')
self.grid(sticky=E + W)
self.robots_us()
self.robots_enemy()
<|end_body_0|>
<|body_start_1|>
Frobots_us = LabelFrame(self, text='Donnees sur nos robots', bg='blue')
self.robots('big', 0, Frob... | Frame qui regroupe les widgets du frame robots. Hérite de Frame. | robots | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class robots:
"""Frame qui regroupe les widgets du frame robots. Hérite de Frame."""
def __init__(self, fenetre, **kwargs):
"""@param fenetre : frame de la fenêtre principale"""
<|body_0|>
def robots_us(self):
"""Permet d'afficher le frame général regroupant nos 2 robo... | stack_v2_sparse_classes_75kplus_train_067310 | 2,830 | no_license | [
{
"docstring": "@param fenetre : frame de la fenêtre principale",
"name": "__init__",
"signature": "def __init__(self, fenetre, **kwargs)"
},
{
"docstring": "Permet d'afficher le frame général regroupant nos 2 robots.",
"name": "robots_us",
"signature": "def robots_us(self)"
},
{
... | 5 | stack_v2_sparse_classes_30k_train_010405 | Implement the Python class `robots` described below.
Class description:
Frame qui regroupe les widgets du frame robots. Hérite de Frame.
Method signatures and docstrings:
- def __init__(self, fenetre, **kwargs): @param fenetre : frame de la fenêtre principale
- def robots_us(self): Permet d'afficher le frame général ... | Implement the Python class `robots` described below.
Class description:
Frame qui regroupe les widgets du frame robots. Hérite de Frame.
Method signatures and docstrings:
- def __init__(self, fenetre, **kwargs): @param fenetre : frame de la fenêtre principale
- def robots_us(self): Permet d'afficher le frame général ... | e1ffa98f3d16dc3348461d63c5a101cdb29abb3f | <|skeleton|>
class robots:
"""Frame qui regroupe les widgets du frame robots. Hérite de Frame."""
def __init__(self, fenetre, **kwargs):
"""@param fenetre : frame de la fenêtre principale"""
<|body_0|>
def robots_us(self):
"""Permet d'afficher le frame général regroupant nos 2 robo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class robots:
"""Frame qui regroupe les widgets du frame robots. Hérite de Frame."""
def __init__(self, fenetre, **kwargs):
"""@param fenetre : frame de la fenêtre principale"""
Frame.__init__(self, fenetre, width=300, height=700, bg='red')
self.grid(sticky=E + W)
self.robots_us... | the_stack_v2_python_sparse | gui/gui_robots.py | furmi/simu2014 | train | 0 |
8dcb13c4188770ec1f8a0cfb4ca8f75fba1a67cb | [
"next_index = next_object_key(self)\nnew_section = Section()\nnew_section.load_section_from_library(path, material_id)\nsetattr(self, str(next_index), new_section)\nreturn next_index",
"next_index = next_object_key(self)\nnew_section = Section()\nnew_section.load_custom_from_library(name, material_id)\nsetattr(se... | <|body_start_0|>
next_index = next_object_key(self)
new_section = Section()
new_section.load_section_from_library(path, material_id)
setattr(self, str(next_index), new_section)
return next_index
<|end_body_0|>
<|body_start_1|>
next_index = next_object_key(self)
n... | Creates an instance of the SkyCiv Sections class. | Sections | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sections:
"""Creates an instance of the SkyCiv Sections class."""
def add_library_section(self, path: list[str], material_id: int) -> int:
"""Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path o... | stack_v2_sparse_classes_75kplus_train_067311 | 2,588 | permissive | [
{
"docstring": "Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path of the section in the section library, obtained by inspection from within SkyCiv Section Builder or by attaining the library tree via S3D.SB.getLibraryTree... | 3 | stack_v2_sparse_classes_30k_train_031922 | Implement the Python class `Sections` described below.
Class description:
Creates an instance of the SkyCiv Sections class.
Method signatures and docstrings:
- def add_library_section(self, path: list[str], material_id: int) -> int: Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an... | Implement the Python class `Sections` described below.
Class description:
Creates an instance of the SkyCiv Sections class.
Method signatures and docstrings:
- def add_library_section(self, path: list[str], material_id: int) -> int: Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an... | 1cf3dad7f8d451760df02886df41684add72a4eb | <|skeleton|>
class Sections:
"""Creates an instance of the SkyCiv Sections class."""
def add_library_section(self, path: list[str], material_id: int) -> int:
"""Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Sections:
"""Creates an instance of the SkyCiv Sections class."""
def add_library_section(self, path: list[str], material_id: int) -> int:
"""Add a section from the SkyCiv section library. Args: path (list[str]): Provided as an array of 4 strings (see example below). It is the path of the section... | the_stack_v2_python_sparse | src/skyciv/classes/model/components/sections/sections.py | osasanchezme/skyciv-pip | train | 0 |
effca7666794932319d8a5b545f5d3e0f7b9ee3e | [
"matrix = None\nif not load_sparse:\n arff_frame = arff.load(open(filename, 'rb'), encode_nominal=encode_nominal, return_type=arff.DENSE)\n matrix = sparse.csr_matrix(arff_frame['data'], dtype=input_feature_type)\nelse:\n arff_frame = arff.load(open(filename, 'rb'), encode_nominal=encode_nominal, return_ty... | <|body_start_0|>
matrix = None
if not load_sparse:
arff_frame = arff.load(open(filename, 'rb'), encode_nominal=encode_nominal, return_type=arff.DENSE)
matrix = sparse.csr_matrix(arff_frame['data'], dtype=input_feature_type)
else:
arff_frame = arff.load(open(fi... | Dataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dataset:
def load_arff_to_numpy(cls, filename, labelcount, endian='big', input_feature_type='float', encode_nominal=True, load_sparse=False):
"""Method for loading ARFF files as numpy array Parameters ---------- filename : string Path to ARFF file labelcount: integer Number of labels in ... | stack_v2_sparse_classes_75kplus_train_067312 | 4,553 | no_license | [
{
"docstring": "Method for loading ARFF files as numpy array Parameters ---------- filename : string Path to ARFF file labelcount: integer Number of labels in the ARFF file endian: string{\"big\", \"little\"} Whether the ARFF file contains labels at the beginning of the attributes list (\"big\" endianness, MEKA... | 3 | stack_v2_sparse_classes_30k_val_001400 | Implement the Python class `Dataset` described below.
Class description:
Implement the Dataset class.
Method signatures and docstrings:
- def load_arff_to_numpy(cls, filename, labelcount, endian='big', input_feature_type='float', encode_nominal=True, load_sparse=False): Method for loading ARFF files as numpy array Pa... | Implement the Python class `Dataset` described below.
Class description:
Implement the Dataset class.
Method signatures and docstrings:
- def load_arff_to_numpy(cls, filename, labelcount, endian='big', input_feature_type='float', encode_nominal=True, load_sparse=False): Method for loading ARFF files as numpy array Pa... | 9ba23d0ad8988e8fc21b595050b8ea9f4e4e2673 | <|skeleton|>
class Dataset:
def load_arff_to_numpy(cls, filename, labelcount, endian='big', input_feature_type='float', encode_nominal=True, load_sparse=False):
"""Method for loading ARFF files as numpy array Parameters ---------- filename : string Path to ARFF file labelcount: integer Number of labels in ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Dataset:
def load_arff_to_numpy(cls, filename, labelcount, endian='big', input_feature_type='float', encode_nominal=True, load_sparse=False):
"""Method for loading ARFF files as numpy array Parameters ---------- filename : string Path to ARFF file labelcount: integer Number of labels in the ARFF file ... | the_stack_v2_python_sparse | skmultilearn/dataset.py | fbkarsdorp/scikit-multilearn | train | 1 | |
dc010f0d87160c32426ae2d18396b6402f4a4ff6 | [
"self.name = name\nself.language = language\nself.code_type = code_type\nself.code = code\nself.tags = tags",
"if self.code:\n return True\nreturn False"
] | <|body_start_0|>
self.name = name
self.language = language
self.code_type = code_type
self.code = code
self.tags = tags
<|end_body_0|>
<|body_start_1|>
if self.code:
return True
return False
<|end_body_1|>
| A code snippet. | CodeSnippet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CodeSnippet:
"""A code snippet."""
def __init__(self, name: str='', language: str='', code_type: str='', code: str='', tags=()):
"""Define code snippet properties."""
<|body_0|>
def not_empty(self):
"""Return whether snippet is empty or not."""
<|body_1|>... | stack_v2_sparse_classes_75kplus_train_067313 | 21,536 | permissive | [
{
"docstring": "Define code snippet properties.",
"name": "__init__",
"signature": "def __init__(self, name: str='', language: str='', code_type: str='', code: str='', tags=())"
},
{
"docstring": "Return whether snippet is empty or not.",
"name": "not_empty",
"signature": "def not_empty(... | 2 | stack_v2_sparse_classes_30k_train_030984 | Implement the Python class `CodeSnippet` described below.
Class description:
A code snippet.
Method signatures and docstrings:
- def __init__(self, name: str='', language: str='', code_type: str='', code: str='', tags=()): Define code snippet properties.
- def not_empty(self): Return whether snippet is empty or not. | Implement the Python class `CodeSnippet` described below.
Class description:
A code snippet.
Method signatures and docstrings:
- def __init__(self, name: str='', language: str='', code_type: str='', code: str='', tags=()): Define code snippet properties.
- def not_empty(self): Return whether snippet is empty or not.
... | 73b554d9796510fc86e5fc55016732aa866266c6 | <|skeleton|>
class CodeSnippet:
"""A code snippet."""
def __init__(self, name: str='', language: str='', code_type: str='', code: str='', tags=()):
"""Define code snippet properties."""
<|body_0|>
def not_empty(self):
"""Return whether snippet is empty or not."""
<|body_1|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CodeSnippet:
"""A code snippet."""
def __init__(self, name: str='', language: str='', code_type: str='', code: str='', tags=()):
"""Define code snippet properties."""
self.name = name
self.language = language
self.code_type = code_type
self.code = code
self... | the_stack_v2_python_sparse | Files/Code Snippet Manager/code_snippet_manager.pyw | fossabot/IdeaBag2-Solutions | train | 0 |
1381cc0b1a281e7fd56435d9e76db08f79ea8fa4 | [
"self.id = id\nself.name = name\nself.email = email\nself.delinquent = delinquent\nself.created_at = APIHelper.RFC3339DateTime(created_at) if created_at else None\nself.updated_at = APIHelper.RFC3339DateTime(updated_at) if updated_at else None\nself.document = document\nself.mtype = mtype\nself.fb_access_token = fb... | <|body_start_0|>
self.id = id
self.name = name
self.email = email
self.delinquent = delinquent
self.created_at = APIHelper.RFC3339DateTime(created_at) if created_at else None
self.updated_at = APIHelper.RFC3339DateTime(updated_at) if updated_at else None
self.docu... | Implementation of the 'GetCustomerResponse' model. Response object for getting a customer Attributes: id (string): TODO: type description here. name (string): TODO: type description here. email (string): TODO: type description here. delinquent (bool): TODO: type description here. created_at (datetime): TODO: type descr... | GetCustomerResponse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetCustomerResponse:
"""Implementation of the 'GetCustomerResponse' model. Response object for getting a customer Attributes: id (string): TODO: type description here. name (string): TODO: type description here. email (string): TODO: type description here. delinquent (bool): TODO: type descriptio... | stack_v2_sparse_classes_75kplus_train_067314 | 5,296 | permissive | [
{
"docstring": "Constructor for the GetCustomerResponse class",
"name": "__init__",
"signature": "def __init__(self, id=None, name=None, email=None, delinquent=None, created_at=None, updated_at=None, document=None, mtype=None, fb_access_token=None, address=None, metadata=None, phones=None, code=None, do... | 2 | null | Implement the Python class `GetCustomerResponse` described below.
Class description:
Implementation of the 'GetCustomerResponse' model. Response object for getting a customer Attributes: id (string): TODO: type description here. name (string): TODO: type description here. email (string): TODO: type description here. d... | Implement the Python class `GetCustomerResponse` described below.
Class description:
Implementation of the 'GetCustomerResponse' model. Response object for getting a customer Attributes: id (string): TODO: type description here. name (string): TODO: type description here. email (string): TODO: type description here. d... | 95c80c35dd57bb2a238faeaf30d1e3b4544d2298 | <|skeleton|>
class GetCustomerResponse:
"""Implementation of the 'GetCustomerResponse' model. Response object for getting a customer Attributes: id (string): TODO: type description here. name (string): TODO: type description here. email (string): TODO: type description here. delinquent (bool): TODO: type descriptio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GetCustomerResponse:
"""Implementation of the 'GetCustomerResponse' model. Response object for getting a customer Attributes: id (string): TODO: type description here. name (string): TODO: type description here. email (string): TODO: type description here. delinquent (bool): TODO: type description here. creat... | the_stack_v2_python_sparse | mundiapi/models/get_customer_response.py | mundipagg/MundiAPI-PYTHON | train | 10 |
ef5b7cf85a12f231ba18e16859e72ff226528d31 | [
"self.avg = trial_stats()\nself.min = trial_stats()\nself.max = trial_stats()\nself.ts = list()\nfor x in range(t):\n self.ts.append(trial_stats())",
"a = trial_stats()\nmin = trial_stats()\nmax = trial_stats()\nmin.ts_copy(self.ts[0])\nmax.ts_copy(self.ts[0])\nfor x in self.ts:\n if x.cpuhrs_charged < min.... | <|body_start_0|>
self.avg = trial_stats()
self.min = trial_stats()
self.max = trial_stats()
self.ts = list()
for x in range(t):
self.ts.append(trial_stats())
<|end_body_0|>
<|body_start_1|>
a = trial_stats()
min = trial_stats()
max = trial_sta... | keeps track of all the trials for a particular experiment variation (distinct combination of config files, resource files and command line options) | trial_tracker | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class trial_tracker:
"""keeps track of all the trials for a particular experiment variation (distinct combination of config files, resource files and command line options)"""
def __init__(self, t):
"""create a new trial_tracker object with ``t`` trials"""
<|body_0|>
def minmax... | stack_v2_sparse_classes_75kplus_train_067315 | 19,091 | permissive | [
{
"docstring": "create a new trial_tracker object with ``t`` trials",
"name": "__init__",
"signature": "def __init__(self, t)"
},
{
"docstring": "calculates the min, max and avg over the trials",
"name": "minmaxavg",
"signature": "def minmaxavg(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016260 | Implement the Python class `trial_tracker` described below.
Class description:
keeps track of all the trials for a particular experiment variation (distinct combination of config files, resource files and command line options)
Method signatures and docstrings:
- def __init__(self, t): create a new trial_tracker objec... | Implement the Python class `trial_tracker` described below.
Class description:
keeps track of all the trials for a particular experiment variation (distinct combination of config files, resource files and command line options)
Method signatures and docstrings:
- def __init__(self, t): create a new trial_tracker objec... | 6f02737d4754731a25dd33759594402ea7f4cfba | <|skeleton|>
class trial_tracker:
"""keeps track of all the trials for a particular experiment variation (distinct combination of config files, resource files and command line options)"""
def __init__(self, t):
"""create a new trial_tracker object with ``t`` trials"""
<|body_0|>
def minmax... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class trial_tracker:
"""keeps track of all the trials for a particular experiment variation (distinct combination of config files, resource files and command line options)"""
def __init__(self, t):
"""create a new trial_tracker object with ``t`` trials"""
self.avg = trial_stats()
self.m... | the_stack_v2_python_sparse | ipsframework/utils/RUS/run_exps.py | HPC-SimTools/IPS-framework | train | 11 |
b73d1390053fc9cd35d32200043b46f180e1b913 | [
"super().__init__(None, SHARE_TITLE, INIT_CLOUD_GUI_SIZE, client)\nself.file_to_share = None\nself.static_txt = wx.StaticText(self.pnl, label=CHOOSE_FILE_TO_SHARE)\nself.next_btn = wx.Button(self.pnl, label=NEXT_BTN)\nself.next_btn.Bind(wx.EVT_BUTTON, self.on_next)\nself.browser = wx.FilePickerCtrl()\nself.browser.... | <|body_start_0|>
super().__init__(None, SHARE_TITLE, INIT_CLOUD_GUI_SIZE, client)
self.file_to_share = None
self.static_txt = wx.StaticText(self.pnl, label=CHOOSE_FILE_TO_SHARE)
self.next_btn = wx.Button(self.pnl, label=NEXT_BTN)
self.next_btn.Bind(wx.EVT_BUTTON, self.on_next)
... | opens a window with directory dialog and a Next button | ShareGUI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShareGUI:
"""opens a window with directory dialog and a Next button"""
def __init__(self, client):
""":param e: event handler"""
<|body_0|>
def position(self):
""":return: positions everything nicely"""
<|body_1|>
def on_next(self, e):
""":pa... | stack_v2_sparse_classes_75kplus_train_067316 | 2,085 | no_license | [
{
"docstring": ":param e: event handler",
"name": "__init__",
"signature": "def __init__(self, client)"
},
{
"docstring": ":return: positions everything nicely",
"name": "position",
"signature": "def position(self)"
},
{
"docstring": ":param e: event handler :return: opening new ... | 3 | stack_v2_sparse_classes_30k_train_002780 | Implement the Python class `ShareGUI` described below.
Class description:
opens a window with directory dialog and a Next button
Method signatures and docstrings:
- def __init__(self, client): :param e: event handler
- def position(self): :return: positions everything nicely
- def on_next(self, e): :param e: event ha... | Implement the Python class `ShareGUI` described below.
Class description:
opens a window with directory dialog and a Next button
Method signatures and docstrings:
- def __init__(self, client): :param e: event handler
- def position(self): :return: positions everything nicely
- def on_next(self, e): :param e: event ha... | b8e9ae3300a7fd79d72109bb3d7db5020fca55d8 | <|skeleton|>
class ShareGUI:
"""opens a window with directory dialog and a Next button"""
def __init__(self, client):
""":param e: event handler"""
<|body_0|>
def position(self):
""":return: positions everything nicely"""
<|body_1|>
def on_next(self, e):
""":pa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ShareGUI:
"""opens a window with directory dialog and a Next button"""
def __init__(self, client):
""":param e: event handler"""
super().__init__(None, SHARE_TITLE, INIT_CLOUD_GUI_SIZE, client)
self.file_to_share = None
self.static_txt = wx.StaticText(self.pnl, label=CHOOS... | the_stack_v2_python_sparse | Classes/ShareGUI.py | tomerbar2903/CloudProject | train | 0 |
de4c27e6dd386378912efd8a8db95cc3d1ac9025 | [
"fields = super(RoomInviteKeySerializer, self).get_fields()\nif self.context['request'].user.is_staff:\n fields['room'].queryset = Room.objects.all()\nelse:\n fields['room'].queryset = Room.objects.filter(admins__in=[self.context['request'].user])\nreturn fields",
"request_user = self.context['request'].use... | <|body_start_0|>
fields = super(RoomInviteKeySerializer, self).get_fields()
if self.context['request'].user.is_staff:
fields['room'].queryset = Room.objects.all()
else:
fields['room'].queryset = Room.objects.filter(admins__in=[self.context['request'].user])
return... | Serializer associated with RoomInviteKey model. | RoomInviteKeySerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoomInviteKeySerializer:
"""Serializer associated with RoomInviteKey model."""
def get_fields(self):
"""Overrides queryset for 'room' field."""
<|body_0|>
def create(self, validated_data):
"""Overrides creation of new object. Sets creator field."""
<|body... | stack_v2_sparse_classes_75kplus_train_067317 | 7,167 | no_license | [
{
"docstring": "Overrides queryset for 'room' field.",
"name": "get_fields",
"signature": "def get_fields(self)"
},
{
"docstring": "Overrides creation of new object. Sets creator field.",
"name": "create",
"signature": "def create(self, validated_data)"
}
] | 2 | stack_v2_sparse_classes_30k_train_030488 | Implement the Python class `RoomInviteKeySerializer` described below.
Class description:
Serializer associated with RoomInviteKey model.
Method signatures and docstrings:
- def get_fields(self): Overrides queryset for 'room' field.
- def create(self, validated_data): Overrides creation of new object. Sets creator fie... | Implement the Python class `RoomInviteKeySerializer` described below.
Class description:
Serializer associated with RoomInviteKey model.
Method signatures and docstrings:
- def get_fields(self): Overrides queryset for 'room' field.
- def create(self, validated_data): Overrides creation of new object. Sets creator fie... | 1545b7bf8c01c439a2f8385358a0b3d09dddf4b3 | <|skeleton|>
class RoomInviteKeySerializer:
"""Serializer associated with RoomInviteKey model."""
def get_fields(self):
"""Overrides queryset for 'room' field."""
<|body_0|>
def create(self, validated_data):
"""Overrides creation of new object. Sets creator field."""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RoomInviteKeySerializer:
"""Serializer associated with RoomInviteKey model."""
def get_fields(self):
"""Overrides queryset for 'room' field."""
fields = super(RoomInviteKeySerializer, self).get_fields()
if self.context['request'].user.is_staff:
fields['room'].queryset ... | the_stack_v2_python_sparse | api/serializers.py | mszan/chat-backend | train | 0 |
95e1460df1f9aff8745396fcb7e722c1fc505805 | [
"userid = int(userid)\nif userid in self:\n return super(_DictionaryOfPlayers, self).__getitem__(userid)\nuniqueid = getPlayer(userid).uniqueid(True)\nfor player in list(self):\n if self[player].gg_player.steamid != uniqueid:\n continue\n value = self[userid] = Player(userid)\n value.reconnect = ... | <|body_start_0|>
userid = int(userid)
if userid in self:
return super(_DictionaryOfPlayers, self).__getitem__(userid)
uniqueid = getPlayer(userid).uniqueid(True)
for player in list(self):
if self[player].gg_player.steamid != uniqueid:
continue
... | Class that stores Player instances | _DictionaryOfPlayers | [
"Artistic-1.0",
"LicenseRef-scancode-public-domain"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _DictionaryOfPlayers:
"""Class that stores Player instances"""
def __getitem__(self, userid):
"""Returns the Player instance for the given userid"""
<|body_0|>
def clear(self):
"""Method used to clear the dictionary and cancel all player delays"""
<|body_... | stack_v2_sparse_classes_75kplus_train_067318 | 2,523 | permissive | [
{
"docstring": "Returns the Player instance for the given userid",
"name": "__getitem__",
"signature": "def __getitem__(self, userid)"
},
{
"docstring": "Method used to clear the dictionary and cancel all player delays",
"name": "clear",
"signature": "def clear(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001742 | Implement the Python class `_DictionaryOfPlayers` described below.
Class description:
Class that stores Player instances
Method signatures and docstrings:
- def __getitem__(self, userid): Returns the Player instance for the given userid
- def clear(self): Method used to clear the dictionary and cancel all player dela... | Implement the Python class `_DictionaryOfPlayers` described below.
Class description:
Class that stores Player instances
Method signatures and docstrings:
- def __getitem__(self, userid): Returns the Player instance for the given userid
- def clear(self): Method used to clear the dictionary and cancel all player dela... | ebf4624626266f552189a32612b8d09cd5b4c5a3 | <|skeleton|>
class _DictionaryOfPlayers:
"""Class that stores Player instances"""
def __getitem__(self, userid):
"""Returns the Player instance for the given userid"""
<|body_0|>
def clear(self):
"""Method used to clear the dictionary and cancel all player delays"""
<|body_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _DictionaryOfPlayers:
"""Class that stores Player instances"""
def __getitem__(self, userid):
"""Returns the Player instance for the given userid"""
userid = int(userid)
if userid in self:
return super(_DictionaryOfPlayers, self).__getitem__(userid)
uniqueid = ... | the_stack_v2_python_sparse | cstrike/addons/eventscripts/gungame51/scripts/included/gg_elimination/modules/dictionary.py | GunGame-Dev-Team/GunGame51 | train | 0 |
01cde13a9b15402d2b52134e2fcc9dcc5ca7cee4 | [
"while num % 2 == 0:\n num = num >> 1\nwhile num % 3 == 0:\n num = num / 3\nwhile num % 5 == 0:\n num = num / 5\nreturn num == 1",
"ugly = [1]\nu2, u3, u5 = (0, 0, 0)\nwhile n > 1:\n n2, n3, n5 = (2 * ugly[u2], 3 * ugly[u3], 5 * ugly[u5])\n print(n2, n3, n5)\n minn = min((n2, n3, n5))\n if mi... | <|body_start_0|>
while num % 2 == 0:
num = num >> 1
while num % 3 == 0:
num = num / 3
while num % 5 == 0:
num = num / 5
return num == 1
<|end_body_0|>
<|body_start_1|>
ugly = [1]
u2, u3, u5 = (0, 0, 0)
while n > 1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isUgly(self, num):
""":type num: int :rtype: bool"""
<|body_0|>
def nthUglyNumber(self, n):
""":type n: int :rtype: int"""
<|body_1|>
def nthSuperUglyNumber(self, n, primes):
""":type n: int :type primes: List[int] :rtype: int"""
... | stack_v2_sparse_classes_75kplus_train_067319 | 1,426 | no_license | [
{
"docstring": ":type num: int :rtype: bool",
"name": "isUgly",
"signature": "def isUgly(self, num)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "nthUglyNumber",
"signature": "def nthUglyNumber(self, n)"
},
{
"docstring": ":type n: int :type primes: List[int] :rtype: in... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isUgly(self, num): :type num: int :rtype: bool
- def nthUglyNumber(self, n): :type n: int :rtype: int
- def nthSuperUglyNumber(self, n, primes): :type n: int :type primes: Li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isUgly(self, num): :type num: int :rtype: bool
- def nthUglyNumber(self, n): :type n: int :rtype: int
- def nthSuperUglyNumber(self, n, primes): :type n: int :type primes: Li... | ccd9440ef4bf3f2c3d8e46ece6ab64613cad1707 | <|skeleton|>
class Solution:
def isUgly(self, num):
""":type num: int :rtype: bool"""
<|body_0|>
def nthUglyNumber(self, n):
""":type n: int :rtype: int"""
<|body_1|>
def nthSuperUglyNumber(self, n, primes):
""":type n: int :type primes: List[int] :rtype: int"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isUgly(self, num):
""":type num: int :rtype: bool"""
while num % 2 == 0:
num = num >> 1
while num % 3 == 0:
num = num / 3
while num % 5 == 0:
num = num / 5
return num == 1
def nthUglyNumber(self, n):
""":typ... | the_stack_v2_python_sparse | note/jy/leetcode/264.py | hanghang2333/weweb | train | 0 | |
4397f7965cdb08030730406eb8f71aebd4559de9 | [
"timestamp = self._GetRowValue(query_hash, row, value_name)\nif timestamp is None:\n return None\nreturn dfdatetime_posix_time.PosixTime(timestamp=timestamp)",
"query_hash = hash(query)\nevent_data = MacOSTCCEntry()\nevent_data.allowed = self._GetRowValue(query_hash, row, 'allowed')\nevent_data.client = self._... | <|body_start_0|>
timestamp = self._GetRowValue(query_hash, row, value_name)
if timestamp is None:
return None
return dfdatetime_posix_time.PosixTime(timestamp=timestamp)
<|end_body_0|>
<|body_start_1|>
query_hash = hash(query)
event_data = MacOSTCCEntry()
eve... | SQLite parser plugin for MacOS TCC database files. The MacOS Transparency, Consent, Control (TCC) database file is typically stored in: /Library/Application Support/com.apple.TCC/TCC.db /Users/<username>/Library/Application Support/com.apple.TCC/TCC.db | MacOSTCCPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MacOSTCCPlugin:
"""SQLite parser plugin for MacOS TCC database files. The MacOS Transparency, Consent, Control (TCC) database file is typically stored in: /Library/Application Support/com.apple.TCC/TCC.db /Users/<username>/Library/Application Support/com.apple.TCC/TCC.db"""
def _GetDateTimeR... | stack_v2_sparse_classes_75kplus_train_067320 | 5,334 | permissive | [
{
"docstring": "Retrieves a date and time value from the row. Args: query_hash (int): hash of the query, that uniquely identifies the query that produced the row. row (sqlite3.Row): row. value_name (str): name of the value. Returns: dfdatetime.PosixTime: date and time value or None if not available.",
"name... | 2 | stack_v2_sparse_classes_30k_train_030464 | Implement the Python class `MacOSTCCPlugin` described below.
Class description:
SQLite parser plugin for MacOS TCC database files. The MacOS Transparency, Consent, Control (TCC) database file is typically stored in: /Library/Application Support/com.apple.TCC/TCC.db /Users/<username>/Library/Application Support/com.app... | Implement the Python class `MacOSTCCPlugin` described below.
Class description:
SQLite parser plugin for MacOS TCC database files. The MacOS Transparency, Consent, Control (TCC) database file is typically stored in: /Library/Application Support/com.apple.TCC/TCC.db /Users/<username>/Library/Application Support/com.app... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class MacOSTCCPlugin:
"""SQLite parser plugin for MacOS TCC database files. The MacOS Transparency, Consent, Control (TCC) database file is typically stored in: /Library/Application Support/com.apple.TCC/TCC.db /Users/<username>/Library/Application Support/com.apple.TCC/TCC.db"""
def _GetDateTimeR... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MacOSTCCPlugin:
"""SQLite parser plugin for MacOS TCC database files. The MacOS Transparency, Consent, Control (TCC) database file is typically stored in: /Library/Application Support/com.apple.TCC/TCC.db /Users/<username>/Library/Application Support/com.apple.TCC/TCC.db"""
def _GetDateTimeRowValue(self,... | the_stack_v2_python_sparse | plaso/parsers/sqlite_plugins/macos_tcc.py | log2timeline/plaso | train | 1,506 |
2598b84fe30053fc9cb569eba4eadd8ab316b9d5 | [
"QDialog.__init__(self, parent)\nself.setupUi(self)\nself.imgPath = None\nself.resultPath = None\nself.algorithm = face_align()",
"print(u'打开图片')\nself.imgPath = QtGui.QFileDialog.getOpenFileName(self, u'选择图片', '/', u'Images (*.png *.xpm *.jpg)')\nself.imgPath = unicode(self.imgPath)\nprint(self.imgPath)\nfather_... | <|body_start_0|>
QDialog.__init__(self, parent)
self.setupUi(self)
self.imgPath = None
self.resultPath = None
self.algorithm = face_align()
<|end_body_0|>
<|body_start_1|>
print(u'打开图片')
self.imgPath = QtGui.QFileDialog.getOpenFileName(self, u'选择图片', '/', u'Image... | Class documentation goes here. | FaceAlignDialog | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FaceAlignDialog:
"""Class documentation goes here."""
def __init__(self, parent=None):
"""Constructor"""
<|body_0|>
def on_pushButton_clicked(self):
"""打开图片"""
<|body_1|>
def on_pushButton_2_clicked(self):
"""人脸特征点对齐"""
<|body_2|>
<|... | stack_v2_sparse_classes_75kplus_train_067321 | 2,337 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "打开图片",
"name": "on_pushButton_clicked",
"signature": "def on_pushButton_clicked(self)"
},
{
"docstring": "人脸特征点对齐",
"name": "on_pushButton_2_clicked",
"sign... | 3 | null | Implement the Python class `FaceAlignDialog` described below.
Class description:
Class documentation goes here.
Method signatures and docstrings:
- def __init__(self, parent=None): Constructor
- def on_pushButton_clicked(self): 打开图片
- def on_pushButton_2_clicked(self): 人脸特征点对齐 | Implement the Python class `FaceAlignDialog` described below.
Class description:
Class documentation goes here.
Method signatures and docstrings:
- def __init__(self, parent=None): Constructor
- def on_pushButton_clicked(self): 打开图片
- def on_pushButton_2_clicked(self): 人脸特征点对齐
<|skeleton|>
class FaceAlignDialog:
... | c3cb07f83642873a3460ffe489c82505923c3c1a | <|skeleton|>
class FaceAlignDialog:
"""Class documentation goes here."""
def __init__(self, parent=None):
"""Constructor"""
<|body_0|>
def on_pushButton_clicked(self):
"""打开图片"""
<|body_1|>
def on_pushButton_2_clicked(self):
"""人脸特征点对齐"""
<|body_2|>
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FaceAlignDialog:
"""Class documentation goes here."""
def __init__(self, parent=None):
"""Constructor"""
QDialog.__init__(self, parent)
self.setupUi(self)
self.imgPath = None
self.resultPath = None
self.algorithm = face_align()
def on_pushButton_clicke... | the_stack_v2_python_sparse | dlib_face_detection/gui/FaceAlignGui.py | rickding/HelloPython | train | 2 |
71036ddddae4ca4bf0488c93267ce80232114a4e | [
"uid = self.current_user['id']\nmenu_list = AdminMenuService.menu_list(uid)\nreturn self.success(data=menu_list)",
"if not self.super_role():\n raise JsonError('未授权', 401)\n\ndef filter_menu(i2):\n \"\"\" 根据name过滤menu里面已经存在的API \"\"\"\n if not i2:\n return []\n try:\n name = i2.get('name... | <|body_start_0|>
uid = self.current_user['id']
menu_list = AdminMenuService.menu_list(uid)
return self.success(data=menu_list)
<|end_body_0|>
<|body_start_1|>
if not self.super_role():
raise JsonError('未授权', 401)
def filter_menu(i2):
""" 根据name过滤menu里面已经... | docstring for AdminMenu | MenuHandler | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MenuHandler:
"""docstring for AdminMenu"""
def menu_get(self):
"""菜单列表 只需要登录就可以获取,不要参与授权检查(自动过滤非超级管理员未授权节点)"""
<|body_0|>
def menu_init_get(self):
"""获取特定版本所有菜单 | 超级管理员才有的权限,编辑菜单之前调用"""
<|body_1|>
def menu_post(self):
"""保存修改的菜单 | 超级管理员才有的权限"... | stack_v2_sparse_classes_75kplus_train_067322 | 3,374 | permissive | [
{
"docstring": "菜单列表 只需要登录就可以获取,不要参与授权检查(自动过滤非超级管理员未授权节点)",
"name": "menu_get",
"signature": "def menu_get(self)"
},
{
"docstring": "获取特定版本所有菜单 | 超级管理员才有的权限,编辑菜单之前调用",
"name": "menu_init_get",
"signature": "def menu_init_get(self)"
},
{
"docstring": "保存修改的菜单 | 超级管理员才有的权限",
"n... | 3 | null | Implement the Python class `MenuHandler` described below.
Class description:
docstring for AdminMenu
Method signatures and docstrings:
- def menu_get(self): 菜单列表 只需要登录就可以获取,不要参与授权检查(自动过滤非超级管理员未授权节点)
- def menu_init_get(self): 获取特定版本所有菜单 | 超级管理员才有的权限,编辑菜单之前调用
- def menu_post(self): 保存修改的菜单 | 超级管理员才有的权限 | Implement the Python class `MenuHandler` described below.
Class description:
docstring for AdminMenu
Method signatures and docstrings:
- def menu_get(self): 菜单列表 只需要登录就可以获取,不要参与授权检查(自动过滤非超级管理员未授权节点)
- def menu_init_get(self): 获取特定版本所有菜单 | 超级管理员才有的权限,编辑菜单之前调用
- def menu_post(self): 保存修改的菜单 | 超级管理员才有的权限
<|skeleton|>
c... | 3300561c5686b674197ffc097cf781a931fd4787 | <|skeleton|>
class MenuHandler:
"""docstring for AdminMenu"""
def menu_get(self):
"""菜单列表 只需要登录就可以获取,不要参与授权检查(自动过滤非超级管理员未授权节点)"""
<|body_0|>
def menu_init_get(self):
"""获取特定版本所有菜单 | 超级管理员才有的权限,编辑菜单之前调用"""
<|body_1|>
def menu_post(self):
"""保存修改的菜单 | 超级管理员才有的权限"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MenuHandler:
"""docstring for AdminMenu"""
def menu_get(self):
"""菜单列表 只需要登录就可以获取,不要参与授权检查(自动过滤非超级管理员未授权节点)"""
uid = self.current_user['id']
menu_list = AdminMenuService.menu_list(uid)
return self.success(data=menu_list)
def menu_init_get(self):
"""获取特定版本所有菜单 ... | the_stack_v2_python_sparse | applications/admin/handlers/admin_menu.py | leeyisoft/py_admin | train | 17 |
418fa38d5d7d1f6b5ec8061bd7c89b61054443ea | [
"self.secret_key = user_info['key']\nif ssh_con is not None:\n stdin, stdout, stderr = ssh_con.exec_command('hostname')\n self.hostname = stdout.readline().strip()\n self.port = utils.get_radosgw_port_no(ssh_con)\nelse:\n self.hostname = socket.gethostname()\n self.port = utils.get_radosgw_port_no()\... | <|body_start_0|>
self.secret_key = user_info['key']
if ssh_con is not None:
stdin, stdout, stderr = ssh_con.exec_command('hostname')
self.hostname = stdout.readline().strip()
self.port = utils.get_radosgw_port_no(ssh_con)
else:
self.hostname = sock... | This class is used to authenticate using swift The functions in this class are 1. do_auth() | Auth | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Auth:
"""This class is used to authenticate using swift The functions in this class are 1. do_auth()"""
def __init__(self, user_info, ssh_con=None, is_secure=False):
"""Initializes the user_info variables"""
<|body_0|>
def do_auth(self):
"""This function is to pe... | stack_v2_sparse_classes_75kplus_train_067323 | 2,137 | permissive | [
{
"docstring": "Initializes the user_info variables",
"name": "__init__",
"signature": "def __init__(self, user_info, ssh_con=None, is_secure=False)"
},
{
"docstring": "This function is to perform authentication using swift Parameters: Returns: rgw: returns the connection details",
"name": "... | 3 | stack_v2_sparse_classes_30k_test_001033 | Implement the Python class `Auth` described below.
Class description:
This class is used to authenticate using swift The functions in this class are 1. do_auth()
Method signatures and docstrings:
- def __init__(self, user_info, ssh_con=None, is_secure=False): Initializes the user_info variables
- def do_auth(self): T... | Implement the Python class `Auth` described below.
Class description:
This class is used to authenticate using swift The functions in this class are 1. do_auth()
Method signatures and docstrings:
- def __init__(self, user_info, ssh_con=None, is_secure=False): Initializes the user_info variables
- def do_auth(self): T... | 4c3b9b3e8e7f42d43270a9b79299a8b404a76046 | <|skeleton|>
class Auth:
"""This class is used to authenticate using swift The functions in this class are 1. do_auth()"""
def __init__(self, user_info, ssh_con=None, is_secure=False):
"""Initializes the user_info variables"""
<|body_0|>
def do_auth(self):
"""This function is to pe... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Auth:
"""This class is used to authenticate using swift The functions in this class are 1. do_auth()"""
def __init__(self, user_info, ssh_con=None, is_secure=False):
"""Initializes the user_info variables"""
self.secret_key = user_info['key']
if ssh_con is not None:
st... | the_stack_v2_python_sparse | rgw/v2/lib/swift/auth.py | red-hat-storage/ceph-qe-scripts | train | 9 |
67cdc92ac05c95cedd67843d91b2d1f083f13e21 | [
"self.d = dict(os.environ.copy())\nself.d['LANG'] = 'C'\nself.extension = str(random.randint(0, 10000000))\nself.hyp_filename = '/tmp/' + self.extension + '.hyp'\nself.ref_filename = '/tmp/' + self.extension + '.ref'\nself.ter_cmd = 'bash ' + TER_JAR + ' -r ' + self.ref_filename + ' -h ' + self.hyp_filename + addit... | <|body_start_0|>
self.d = dict(os.environ.copy())
self.d['LANG'] = 'C'
self.extension = str(random.randint(0, 10000000))
self.hyp_filename = '/tmp/' + self.extension + '.hyp'
self.ref_filename = '/tmp/' + self.extension + '.ref'
self.ter_cmd = 'bash ' + TER_JAR + ' -r ' +... | Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014). | SentenceTerReference | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SentenceTerReference:
"""Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014)."""
def __init__(self, reference_tokens, additional_flags=''):
"""Computes the TER of a sentence. :param reference_tokens: the reference tra... | stack_v2_sparse_classes_75kplus_train_067324 | 3,404 | permissive | [
{
"docstring": "Computes the TER of a sentence. :param reference_tokens: the reference translation that hypotheses shall be scored against. Must be an iterable of tokens (any /tmp/3420971.ref type). :param additional_flags: additional TERCOM flags.",
"name": "__init__",
"signature": "def __init__(self, ... | 2 | stack_v2_sparse_classes_30k_train_002313 | Implement the Python class `SentenceTerReference` described below.
Class description:
Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014).
Method signatures and docstrings:
- def __init__(self, reference_tokens, additional_flags=''): Computes the TER ... | Implement the Python class `SentenceTerReference` described below.
Class description:
Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014).
Method signatures and docstrings:
- def __init__(self, reference_tokens, additional_flags=''): Computes the TER ... | 75a8d00009b4c5c63c7554a07c5340c15d67ae1c | <|skeleton|>
class SentenceTerReference:
"""Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014)."""
def __init__(self, reference_tokens, additional_flags=''):
"""Computes the TER of a sentence. :param reference_tokens: the reference tra... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SentenceTerReference:
"""Smoothed sentence-level BLEU as as proposed by Lin and Och (2004). Implemented as described in (Chen and Cherry, 2014)."""
def __init__(self, reference_tokens, additional_flags=''):
"""Computes the TER of a sentence. :param reference_tokens: the reference translation that... | the_stack_v2_python_sparse | quest/pycocoevalcap/sentence_ter/sentence_ter.py | sheffieldnlp/deepQuest | train | 40 |
31244b9a94674da0a9adb370d85d19452aade290 | [
"self.phoneDictSts = {}\nself.availableNums = []\nfor i in range(maxNumbers):\n self.phoneDictSts[i] = True\n heapq.heappush(self.availableNums, i)",
"if len(self.availableNums) > 0:\n num = heapq.heappop(self.availableNums)\n self.phoneDictSts[num] = False\n return num\nelse:\n return -1",
"i... | <|body_start_0|>
self.phoneDictSts = {}
self.availableNums = []
for i in range(maxNumbers):
self.phoneDictSts[i] = True
heapq.heappush(self.availableNums, i)
<|end_body_0|>
<|body_start_1|>
if len(self.availableNums) > 0:
num = heapq.heappop(self.avai... | PhoneDirectory | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhoneDirectory:
def __init__(self, maxNumbers):
"""Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumbers: int"""
<|body_0|>
def get(self):
"""Provide a number which is not assigned to a... | stack_v2_sparse_classes_75kplus_train_067325 | 1,577 | permissive | [
{
"docstring": "Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumbers: int",
"name": "__init__",
"signature": "def __init__(self, maxNumbers)"
},
{
"docstring": "Provide a number which is not assigned to anyone. @r... | 4 | stack_v2_sparse_classes_30k_train_043922 | Implement the Python class `PhoneDirectory` described below.
Class description:
Implement the PhoneDirectory class.
Method signatures and docstrings:
- def __init__(self, maxNumbers): Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumber... | Implement the Python class `PhoneDirectory` described below.
Class description:
Implement the PhoneDirectory class.
Method signatures and docstrings:
- def __init__(self, maxNumbers): Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumber... | 20ae1a048eddbc9a32c819cf61258e2b57572f05 | <|skeleton|>
class PhoneDirectory:
def __init__(self, maxNumbers):
"""Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumbers: int"""
<|body_0|>
def get(self):
"""Provide a number which is not assigned to a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PhoneDirectory:
def __init__(self, maxNumbers):
"""Initialize your data structure here @param maxNumbers - The maximum numbers that can be stored in the phone directory. :type maxNumbers: int"""
self.phoneDictSts = {}
self.availableNums = []
for i in range(maxNumbers):
... | the_stack_v2_python_sparse | leetcode.com/python/379_Design_Phone_Directory.py | partho-maple/coding-interview-gym | train | 862 | |
c1ed4699b07ef12be9d0ea2203d9b65e23324a3a | [
"for member in self.community_members:\n for coopr_exchrxn in member.coopr_exchrxns:\n member.biomass_reaction.objective_coefficient = 0\n coopr_exchrxn.objective_coefficient = 1\n member.fba(build_new_optModel=False, reset_fluxes=False, store_opt_fluxes=False, flux_key=None, stdout_msgs=Fal... | <|body_start_0|>
for member in self.community_members:
for coopr_exchrxn in member.coopr_exchrxns:
member.biomass_reaction.objective_coefficient = 0
coopr_exchrxn.objective_coefficient = 1
member.fba(build_new_optModel=False, reset_fluxes=False, store_... | Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015 | DMMM_coopr_level | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DMMM_coopr_level:
"""Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015"""
def update_coopr_exchrxn_bounds(self):
"""Udates the bounds on the flux of cooperative reactions"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_067326 | 2,306 | no_license | [
{
"docstring": "Udates the bounds on the flux of cooperative reactions",
"name": "update_coopr_exchrxn_bounds",
"signature": "def update_coopr_exchrxn_bounds(self)"
},
{
"docstring": "Compute the upper bound on the uptake rates of the shared compounds (LB on exchange fluxes) using kinetic expres... | 2 | stack_v2_sparse_classes_30k_train_008849 | Implement the Python class `DMMM_coopr_level` described below.
Class description:
Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015
Method signatures and docstrings:
- def update_coopr_exchrxn_bounds(self): Udates the bounds on the flux... | Implement the Python class `DMMM_coopr_level` described below.
Class description:
Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015
Method signatures and docstrings:
- def update_coopr_exchrxn_bounds(self): Udates the bounds on the flux... | 7c6137bf7b7379cc98bf4ce319610448592bc075 | <|skeleton|>
class DMMM_coopr_level:
"""Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015"""
def update_coopr_exchrxn_bounds(self):
"""Udates the bounds on the flux of cooperative reactions"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DMMM_coopr_level:
"""Performs DMMM for the cooperation level simulation Ali R. Zomorrodi - Daniel Segre Lab @ Boston University Last updated: 01-14-2015"""
def update_coopr_exchrxn_bounds(self):
"""Udates the bounds on the flux of cooperative reactions"""
for member in self.community_memb... | the_stack_v2_python_sparse | EcoliPairs/DMMM_coopr_level.py | aarthi31/DS_lab | train | 0 |
149643f4af4bbfe7ac3275f3c5c0bf1626862d3c | [
"if num >= 0:\n return num // size\nelse:\n return num // size - 1",
"bucket = {}\nsize = t + 1\nfor i, num in enumerate(nums):\n bucket_id = self._get_bucket_id(num, size)\n if bucket_id in bucket:\n return True\n if bucket_id + 1 in bucket and bucket[bucket_id + 1] - num <= t:\n ret... | <|body_start_0|>
if num >= 0:
return num // size
else:
return num // size - 1
<|end_body_0|>
<|body_start_1|>
bucket = {}
size = t + 1
for i, num in enumerate(nums):
bucket_id = self._get_bucket_id(num, size)
if bucket_id in bucket... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _get_bucket_id(self, num, size):
"""Assume buckets are k: [k*size, ..., (k+1)*size-1] for k >= 0 and k: [-(k+2)size+1, ..., -(k+1)*size] for k < 0. By convention we place num = 0 to the k=0 bucket. This makes sure that the range of each bucket is <= size-1."""
<|bod... | stack_v2_sparse_classes_75kplus_train_067327 | 2,101 | no_license | [
{
"docstring": "Assume buckets are k: [k*size, ..., (k+1)*size-1] for k >= 0 and k: [-(k+2)size+1, ..., -(k+1)*size] for k < 0. By convention we place num = 0 to the k=0 bucket. This makes sure that the range of each bucket is <= size-1.",
"name": "_get_bucket_id",
"signature": "def _get_bucket_id(self,... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _get_bucket_id(self, num, size): Assume buckets are k: [k*size, ..., (k+1)*size-1] for k >= 0 and k: [-(k+2)size+1, ..., -(k+1)*size] for k < 0. By convention we place num = ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _get_bucket_id(self, num, size): Assume buckets are k: [k*size, ..., (k+1)*size-1] for k >= 0 and k: [-(k+2)size+1, ..., -(k+1)*size] for k < 0. By convention we place num = ... | f79886ed3022664c3291e4e78129bd8d855cf929 | <|skeleton|>
class Solution:
def _get_bucket_id(self, num, size):
"""Assume buckets are k: [k*size, ..., (k+1)*size-1] for k >= 0 and k: [-(k+2)size+1, ..., -(k+1)*size] for k < 0. By convention we place num = 0 to the k=0 bucket. This makes sure that the range of each bucket is <= size-1."""
<|bod... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def _get_bucket_id(self, num, size):
"""Assume buckets are k: [k*size, ..., (k+1)*size-1] for k >= 0 and k: [-(k+2)size+1, ..., -(k+1)*size] for k < 0. By convention we place num = 0 to the k=0 bucket. This makes sure that the range of each bucket is <= size-1."""
if num >= 0:
... | the_stack_v2_python_sparse | 220. Contains Duplicate III.py | Peiyu-Rang/LeetCode | train | 0 | |
8440dfdb3278d8fb8054d2ea4619d9731378481a | [
"nums.sort()\nprint(nums)\nres = []\nfor i, n in enumerate(nums):\n if n != nums[i - 1] or i == 0:\n newlist = nums[i + 1:]\n left, right = (0, len(newlist) - 1)\n while right > left:\n if newlist[left] + newlist[right] + n > 0:\n right -= 1\n elif newlis... | <|body_start_0|>
nums.sort()
print(nums)
res = []
for i, n in enumerate(nums):
if n != nums[i - 1] or i == 0:
newlist = nums[i + 1:]
left, right = (0, len(newlist) - 1)
while right > left:
if newlist[left] + ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def threeSum2(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nums.sort()
print(... | stack_v2_sparse_classes_75kplus_train_067328 | 1,618 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum",
"signature": "def threeSum(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "threeSum2",
"signature": "def threeSum2(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_train_041676 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum2(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def threeSum(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def threeSum2(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class Solution:
... | 3dec0f75cb9c04c3eed05eb87eb59254ec0b379a | <|skeleton|>
class Solution:
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def threeSum2(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def threeSum(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
nums.sort()
print(nums)
res = []
for i, n in enumerate(nums):
if n != nums[i - 1] or i == 0:
newlist = nums[i + 1:]
left, right = (0, len(... | the_stack_v2_python_sparse | 15. ==超时了3Sum.py | cosJin/top100liked | train | 0 | |
f02f997b82ae619a6edbefdf26afa4ea95d0d2f6 | [
"super().__init__(env)\nself.env = env\nself.env_category = env_config.env_name.split(':')[0]\nself.max_videos = env_config.video.max_videos\nself.capture_interval = env_config.video.record_every\nself.frame_interval = frame_interval\nself.fps = fps\nself.ext = '.gif' if use_gif else '.mp4'\nself.save_folder = env_... | <|body_start_0|>
super().__init__(env)
self.env = env
self.env_category = env_config.env_name.split(':')[0]
self.max_videos = env_config.video.max_videos
self.capture_interval = env_config.video.record_every
self.frame_interval = frame_interval
self.fps = fps
... | Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number of frames between each recorded frame default to 10 fps (int): frame rate defau... | VideoWrapper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VideoWrapper:
"""Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number of frames between each recorded frame d... | stack_v2_sparse_classes_75kplus_train_067329 | 6,239 | permissive | [
{
"docstring": "Constructor for VideoWrapper. also creates the save directory if not present Args: env (Env): environment to be wrapped capture_interval (int): number of episodes between captures frame_interval (int): number of frames between each recorded frame fps (int): frame rate save_folder (str): director... | 4 | stack_v2_sparse_classes_30k_train_022980 | Implement the Python class `VideoWrapper` described below.
Class description:
Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number ... | Implement the Python class `VideoWrapper` described below.
Class description:
Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number ... | 2556bd9c362a53e0a94da914ba59b5d4621c4081 | <|skeleton|>
class VideoWrapper:
"""Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number of frames between each recorded frame d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VideoWrapper:
"""Environment Wrappers for automatically rendering and saving test runs. Attributes: public attributes env (Env): environment to be wrapped capture_interval (int): number of episodes between captures default to 10 frame_interval (int): number of frames between each recorded frame default to 10 ... | the_stack_v2_python_sparse | surreal/env/video_env.py | PeihongYu/surreal | train | 0 |
f4e8ec8ea158871ba3ea0349f1ee0cbb741e2272 | [
"self.validator_client = validator_client\nself.buffer = []\nself.packet_size = 0\nself.max_size = max_size\nself.max_packet_size = max_packet_size",
"self.buffer.append(asset)\nasset_size = sys.getsizeof(asset)\nif self.packet_size + asset_size > self.max_packet_size:\n self.flush()\nself.packet_size += asset... | <|body_start_0|>
self.validator_client = validator_client
self.buffer = []
self.packet_size = 0
self.max_size = max_size
self.max_packet_size = max_packet_size
<|end_body_0|>
<|body_start_1|>
self.buffer.append(asset)
asset_size = sys.getsizeof(asset)
if ... | Buffered Config Validator data sender. | BufferedCVDataSender | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BufferedCVDataSender:
"""Buffered Config Validator data sender."""
def __init__(self, validator_client, max_size=1024, max_packet_size=MAX_ALLOWED_PACKET):
"""Initialize. Args: validator_client (ValidatorClient): The validator client. max_size (int): max size of buffer. max_packet_si... | stack_v2_sparse_classes_75kplus_train_067330 | 6,646 | permissive | [
{
"docstring": "Initialize. Args: validator_client (ValidatorClient): The validator client. max_size (int): max size of buffer. max_packet_size (int): max size of a packet to send to Config Validator.",
"name": "__init__",
"signature": "def __init__(self, validator_client, max_size=1024, max_packet_size... | 3 | stack_v2_sparse_classes_30k_train_043522 | Implement the Python class `BufferedCVDataSender` described below.
Class description:
Buffered Config Validator data sender.
Method signatures and docstrings:
- def __init__(self, validator_client, max_size=1024, max_packet_size=MAX_ALLOWED_PACKET): Initialize. Args: validator_client (ValidatorClient): The validator ... | Implement the Python class `BufferedCVDataSender` described below.
Class description:
Buffered Config Validator data sender.
Method signatures and docstrings:
- def __init__(self, validator_client, max_size=1024, max_packet_size=MAX_ALLOWED_PACKET): Initialize. Args: validator_client (ValidatorClient): The validator ... | d4421afa50a17ed47cbebe942044ebab3720e0f5 | <|skeleton|>
class BufferedCVDataSender:
"""Buffered Config Validator data sender."""
def __init__(self, validator_client, max_size=1024, max_packet_size=MAX_ALLOWED_PACKET):
"""Initialize. Args: validator_client (ValidatorClient): The validator client. max_size (int): max size of buffer. max_packet_si... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BufferedCVDataSender:
"""Buffered Config Validator data sender."""
def __init__(self, validator_client, max_size=1024, max_packet_size=MAX_ALLOWED_PACKET):
"""Initialize. Args: validator_client (ValidatorClient): The validator client. max_size (int): max size of buffer. max_packet_size (int): max... | the_stack_v2_python_sparse | google/cloud/forseti/scanner/scanners/config_validator_util/validator_client.py | kevensen/forseti-security | train | 1 |
fb03652a4ac48127d705619db5ccefde52b63d40 | [
"super(TransformerDecoderLayer, self).__init__()\nself.self_attn = NonLocalSelfAttention(channels)\nself.dropout1 = nn.Dropout(dropout)\nout_c = int(channels / 2)\nself.mutate = nn.Sequential(ConvolutionalTransposeBlock(in_c=channels, out_c=out_c, padded=True, kernel_size=kernel_size), ConvolutionalTransposeBlock(i... | <|body_start_0|>
super(TransformerDecoderLayer, self).__init__()
self.self_attn = NonLocalSelfAttention(channels)
self.dropout1 = nn.Dropout(dropout)
out_c = int(channels / 2)
self.mutate = nn.Sequential(ConvolutionalTransposeBlock(in_c=channels, out_c=out_c, padded=True, kernel_... | TransformerEncoderLayer is made up of self-attn and feedforward network. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advance... | TransformerDecoderLayer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransformerDecoderLayer:
"""TransformerEncoderLayer is made up of self-attn and feedforward network. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polo... | stack_v2_sparse_classes_75kplus_train_067331 | 9,975 | no_license | [
{
"docstring": ":param channels: :param dropout: :param kernel_size:",
"name": "__init__",
"signature": "def __init__(self, channels, dropout=0.1, kernel_size=1)"
},
{
"docstring": "Pass the input through the encoder layer. Args: src: the sequence to the encoder layer (required). Shape: see the ... | 2 | stack_v2_sparse_classes_30k_train_017423 | Implement the Python class `TransformerDecoderLayer` described below.
Class description:
TransformerEncoderLayer is made up of self-attn and feedforward network. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan... | Implement the Python class `TransformerDecoderLayer` described below.
Class description:
TransformerEncoderLayer is made up of self-attn and feedforward network. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan... | be76715676dc1652e80ff5f95003220d8002c4d9 | <|skeleton|>
class TransformerDecoderLayer:
"""TransformerEncoderLayer is made up of self-attn and feedforward network. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polo... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TransformerDecoderLayer:
"""TransformerEncoderLayer is made up of self-attn and feedforward network. This standard encoder layer is based on the paper "Attention Is All You Need". Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017.... | the_stack_v2_python_sparse | models/transformer_convolutional_vae.py | flawnson/AA_VAE | train | 0 |
57d8102ec89df977c2c3423a5b1a2b793d329dff | [
"if not isinstance(thresholding_type, str):\n raise TypeError('Bad type for arg thresholding_type - expected string. Received type \"%s\".' % type(thresholding_type).__name__)\nif thresholding_type == 'adaptive':\n self.thresholding_type = thresholding_type\nelif thresholding_type == 'otsu':\n self.thresho... | <|body_start_0|>
if not isinstance(thresholding_type, str):
raise TypeError('Bad type for arg thresholding_type - expected string. Received type "%s".' % type(thresholding_type).__name__)
if thresholding_type == 'adaptive':
self.thresholding_type = thresholding_type
elif ... | The Thresholding manager is responsible for applying the different types of thresholding techniques. | ThresholdingManager | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThresholdingManager:
"""The Thresholding manager is responsible for applying the different types of thresholding techniques."""
def __init__(self, thresholding_type):
"""Initialise Thresholding manager. :param thresholding_type (str): Indicates the type of thresholding that should be... | stack_v2_sparse_classes_75kplus_train_067332 | 3,679 | permissive | [
{
"docstring": "Initialise Thresholding manager. :param thresholding_type (str): Indicates the type of thresholding that should be applied. Raises: - TypeError: If a parameter is passed that is not of type String. - NameError: If the thresholding type is not Adaptive or Otsu.",
"name": "__init__",
"sign... | 4 | stack_v2_sparse_classes_30k_train_050930 | Implement the Python class `ThresholdingManager` described below.
Class description:
The Thresholding manager is responsible for applying the different types of thresholding techniques.
Method signatures and docstrings:
- def __init__(self, thresholding_type): Initialise Thresholding manager. :param thresholding_type... | Implement the Python class `ThresholdingManager` described below.
Class description:
The Thresholding manager is responsible for applying the different types of thresholding techniques.
Method signatures and docstrings:
- def __init__(self, thresholding_type): Initialise Thresholding manager. :param thresholding_type... | d62917262080f09d7c9e7262f507e2c1482d7c56 | <|skeleton|>
class ThresholdingManager:
"""The Thresholding manager is responsible for applying the different types of thresholding techniques."""
def __init__(self, thresholding_type):
"""Initialise Thresholding manager. :param thresholding_type (str): Indicates the type of thresholding that should be... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ThresholdingManager:
"""The Thresholding manager is responsible for applying the different types of thresholding techniques."""
def __init__(self, thresholding_type):
"""Initialise Thresholding manager. :param thresholding_type (str): Indicates the type of thresholding that should be applied. Rai... | the_stack_v2_python_sparse | src/main/python/hutts_verification/image_preprocessing/thresholding_manager.py | javaTheHutts/Java-the-Hutts | train | 2 |
7fc8618bcd316b1997dc88ff8adf3f143db89b1e | [
"dummy = ListNode(None)\nptr = dummy\ncarry = 0\nwhile l1 or l2:\n if l1:\n carry += l1.val\n l1 = l1.next\n if l2:\n carry += l2.val\n l2 = l2.next\n ptr.next = ListNode(carry % 10)\n ptr = ptr.next\n carry /= 10\nif carry != 0:\n ptr.next = ListNode(1)\nreturn dummy.n... | <|body_start_0|>
dummy = ListNode(None)
ptr = dummy
carry = 0
while l1 or l2:
if l1:
carry += l1.val
l1 = l1.next
if l2:
carry += l2.val
l2 = l2.next
ptr.next = ListNode(carry % 10)
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def addTwoNumbers2(self, l1, l2):
""":type l1: ListNode :typ2 l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_067333 | 1,686 | no_license | [
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "addTwoNumbers",
"signature": "def addTwoNumbers(self, l1, l2)"
},
{
"docstring": ":type l1: ListNode :typ2 l2: ListNode :rtype: ListNode",
"name": "addTwoNumbers2",
"signature": "def addTwoNumbers2(self, l1... | 2 | stack_v2_sparse_classes_30k_train_042513 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def addTwoNumbers2(self, l1, l2): :type l1: ListNode :typ2 l2: ListNode :rtype: ListNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def addTwoNumbers2(self, l1, l2): :type l1: ListNode :typ2 l2: ListNode :rtype: ListNode... | 31b2b4dc1e5c3b1c53b333fe30b98ed04b0bdacc | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def addTwoNumbers2(self, l1, l2):
""":type l1: ListNode :typ2 l2: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
dummy = ListNode(None)
ptr = dummy
carry = 0
while l1 or l2:
if l1:
carry += l1.val
l1 = l1.next
if l2:
... | the_stack_v2_python_sparse | prob002_addtwonumbers.py | Hu-Wenchao/leetcode | train | 0 | |
863777be6a8136dd8144abda04eea8a9265533b8 | [
"if not data:\n return b'\\x00'\nreturn data.replace('\\x00', '').encode('utf-8') + b'\\x00'",
"tmp = payload.split(b'\\x00', 1)\nif len(tmp) < 2:\n return (payload, None)\nreturn (tmp[1], tmp[0].decode('utf-8'))"
] | <|body_start_0|>
if not data:
return b'\x00'
return data.replace('\x00', '').encode('utf-8') + b'\x00'
<|end_body_0|>
<|body_start_1|>
tmp = payload.split(b'\x00', 1)
if len(tmp) < 2:
return (payload, None)
return (tmp[1], tmp[0].decode('utf-8'))
<|end_bo... | Null terminated string. | SMPayloadTypeNT | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SMPayloadTypeNT:
"""Null terminated string."""
def encode(data, _opt=None):
"""Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode("unicode_string") b'unicode_string\\x00'"""
<|body_0... | stack_v2_sparse_classes_75kplus_train_067334 | 14,049 | permissive | [
{
"docstring": "Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode(\"unicode_string\") b'unicode_string\\\\x00'",
"name": "encode",
"signature": "def encode(data, _opt=None)"
},
{
"docstring": "Decode n... | 2 | stack_v2_sparse_classes_30k_train_012418 | Implement the Python class `SMPayloadTypeNT` described below.
Class description:
Null terminated string.
Method signatures and docstrings:
- def encode(data, _opt=None): Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode("un... | Implement the Python class `SMPayloadTypeNT` described below.
Class description:
Null terminated string.
Method signatures and docstrings:
- def encode(data, _opt=None): Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode("un... | cf20b363ed3d7bcb75101b17870e876a857ecd66 | <|skeleton|>
class SMPayloadTypeNT:
"""Null terminated string."""
def encode(data, _opt=None):
"""Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode("unicode_string") b'unicode_string\\x00'"""
<|body_0... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SMPayloadTypeNT:
"""Null terminated string."""
def encode(data, _opt=None):
"""Encode unicode string into null terminated string. :param data: the string to encode :param opt: Do nothing :Example: >>> SMPayloadTypeNT.encode("unicode_string") b'unicode_string\\x00'"""
if not data:
... | the_stack_v2_python_sparse | smserver/smutils/smpacket/smencoder.py | Moutix/stepmania-server | train | 4 |
79c613270671d83bc8586a16b460a8548c69ce63 | [
"super().__init__()\nself.api_key = api_key\nself.engine_id = engine_id\nself.top_k = top_k\nself.allowed_domains = allowed_domains\nself.kwargs = search_engine_kwargs if search_engine_kwargs else {}",
"if not self.api_key:\n raise ValueError('You need to provide an API key for the Google API. See https://deve... | <|body_start_0|>
super().__init__()
self.api_key = api_key
self.engine_id = engine_id
self.top_k = top_k
self.allowed_domains = allowed_domains
self.kwargs = search_engine_kwargs if search_engine_kwargs else {}
<|end_body_0|>
<|body_start_1|>
if not self.api_key:... | Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details. | GoogleAPI | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GoogleAPI:
"""Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details."""
def __init__(self, top_k: Optional[int]=10, allowed_domains: Optional[List[str]]=None, api_key: Optional[str]=None, engine_id: Optional[str]... | stack_v2_sparse_classes_75kplus_train_067335 | 17,323 | permissive | [
{
"docstring": ":param top_k: Number of documents to return. :param allowed_domains: List of domains to limit the search to. :param api_key: API key for the Google API. :param engine_id: Engine ID for the Google API. :param search_engine_kwargs: Additional parameters passed to the Google API. As an example, you... | 3 | stack_v2_sparse_classes_30k_train_033022 | Implement the Python class `GoogleAPI` described below.
Class description:
Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details.
Method signatures and docstrings:
- def __init__(self, top_k: Optional[int]=10, allowed_domains: Optional[Li... | Implement the Python class `GoogleAPI` described below.
Class description:
Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details.
Method signatures and docstrings:
- def __init__(self, top_k: Optional[int]=10, allowed_domains: Optional[Li... | 5f1256ac7e5734c2ea481e72cb7e02c34baf8c43 | <|skeleton|>
class GoogleAPI:
"""Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details."""
def __init__(self, top_k: Optional[int]=10, allowed_domains: Optional[List[str]]=None, api_key: Optional[str]=None, engine_id: Optional[str]... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GoogleAPI:
"""Search engine using the Google API. See [Google Search API](https://developers.google.com/custom-search/v1/overview) for more details."""
def __init__(self, top_k: Optional[int]=10, allowed_domains: Optional[List[str]]=None, api_key: Optional[str]=None, engine_id: Optional[str]=None, search... | the_stack_v2_python_sparse | haystack/nodes/search_engine/providers.py | deepset-ai/haystack | train | 10,599 |
9a101b6a41c22e72e3be769e8469c59da94d045c | [
"self.num_layers = num_layers\nself.magnitude = float(magnitude)\nself.translate_const = float(translate_const)\nself.available_ops = ['AutoContrast', 'Equalize', 'Rotate', 'Posterize', 'Solarize', 'Color', 'ShearX', 'ShearY', 'TranslateX', 'TranslateY']\nself.randomly_negate_level = randomly_negate_level",
"if s... | <|body_start_0|>
self.num_layers = num_layers
self.magnitude = float(magnitude)
self.translate_const = float(translate_const)
self.available_ops = ['AutoContrast', 'Equalize', 'Rotate', 'Posterize', 'Solarize', 'Color', 'ShearX', 'ShearY', 'TranslateX', 'TranslateY']
self.randoml... | Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719, | RandAugment | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandAugment:
"""Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719,"""
def __init__(self, num_layers=1, magnitude=10, translate_const=100, randomly_negate_level=True):
"""Applies the RandAugment policy to images. Args: num_layers:... | stack_v2_sparse_classes_75kplus_train_067336 | 21,877 | permissive | [
{
"docstring": "Applies the RandAugment policy to images. Args: num_layers: Integer, the number of augmentation transformations to apply sequentially to an image. Represented as (N) in the paper. Usually best values will be in the range [1, 3]. magnitude: Integer, shared magnitude across all augmentation operat... | 2 | stack_v2_sparse_classes_30k_train_022473 | Implement the Python class `RandAugment` described below.
Class description:
Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719,
Method signatures and docstrings:
- def __init__(self, num_layers=1, magnitude=10, translate_const=100, randomly_negate_level=True): Ap... | Implement the Python class `RandAugment` described below.
Class description:
Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719,
Method signatures and docstrings:
- def __init__(self, num_layers=1, magnitude=10, translate_const=100, randomly_negate_level=True): Ap... | f5f6f50f82bd441339c9d9efbef3f09e72c5fef6 | <|skeleton|>
class RandAugment:
"""Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719,"""
def __init__(self, num_layers=1, magnitude=10, translate_const=100, randomly_negate_level=True):
"""Applies the RandAugment policy to images. Args: num_layers:... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RandAugment:
"""Applies the RandAugment policy to images. RandAugment is from the paper https://arxiv.org/abs/1909.13719,"""
def __init__(self, num_layers=1, magnitude=10, translate_const=100, randomly_negate_level=True):
"""Applies the RandAugment policy to images. Args: num_layers: Integer, the... | the_stack_v2_python_sparse | uncertainty_baselines/datasets/augment_utils.py | google/uncertainty-baselines | train | 1,235 |
8acaf3038a3384ea2ef6a0f77ffb9fa3b1a4d84c | [
"print('加密数据=', text)\ntext = base64.b64decode(text)\nkeys = keys.encode('utf-8')\nmode = AES.MODE_ECB\ncryptor = AES.new(keys, mode)\nplain_text = cryptor.decrypt(text)\nreturn bytes.decode(plain_text).rstrip('\\r')",
"text = text.encode('utf-8')\nkeys = keys.encode('utf-8')\nmode = AES.MODE_ECB\ncryptor = AES.n... | <|body_start_0|>
print('加密数据=', text)
text = base64.b64decode(text)
keys = keys.encode('utf-8')
mode = AES.MODE_ECB
cryptor = AES.new(keys, mode)
plain_text = cryptor.decrypt(text)
return bytes.decode(plain_text).rstrip('\r')
<|end_body_0|>
<|body_start_1|>
... | base64和HEX解密方法 | ECB_AES_JIEMI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ECB_AES_JIEMI:
"""base64和HEX解密方法"""
def jiemi_base64(self, keys, text):
"""解密:编码为base64输出"""
<|body_0|>
def jiemi_hex(self, keys, text):
"""解密:编码为hex输出"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
print('加密数据=', text)
text = base64.b6... | stack_v2_sparse_classes_75kplus_train_067337 | 12,324 | no_license | [
{
"docstring": "解密:编码为base64输出",
"name": "jiemi_base64",
"signature": "def jiemi_base64(self, keys, text)"
},
{
"docstring": "解密:编码为hex输出",
"name": "jiemi_hex",
"signature": "def jiemi_hex(self, keys, text)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013344 | Implement the Python class `ECB_AES_JIEMI` described below.
Class description:
base64和HEX解密方法
Method signatures and docstrings:
- def jiemi_base64(self, keys, text): 解密:编码为base64输出
- def jiemi_hex(self, keys, text): 解密:编码为hex输出 | Implement the Python class `ECB_AES_JIEMI` described below.
Class description:
base64和HEX解密方法
Method signatures and docstrings:
- def jiemi_base64(self, keys, text): 解密:编码为base64输出
- def jiemi_hex(self, keys, text): 解密:编码为hex输出
<|skeleton|>
class ECB_AES_JIEMI:
"""base64和HEX解密方法"""
def jiemi_base64(self, ke... | 1c6d447d62ed007117fa93bb7c69d53886db9dbf | <|skeleton|>
class ECB_AES_JIEMI:
"""base64和HEX解密方法"""
def jiemi_base64(self, keys, text):
"""解密:编码为base64输出"""
<|body_0|>
def jiemi_hex(self, keys, text):
"""解密:编码为hex输出"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ECB_AES_JIEMI:
"""base64和HEX解密方法"""
def jiemi_base64(self, keys, text):
"""解密:编码为base64输出"""
print('加密数据=', text)
text = base64.b64decode(text)
keys = keys.encode('utf-8')
mode = AES.MODE_ECB
cryptor = AES.new(keys, mode)
plain_text = cryptor.decryp... | the_stack_v2_python_sparse | 3_script/python/AES_jiemi.py | Ziv-Android/Note | train | 4 |
4bad81161b0a8c601f109e4d9ba817a90c8ad748 | [
"if type(style_image) is not np.ndarray or len(style_image.shape) != 3 or int(style_image.shape[2]) != 3:\n raise TypeError('style_image must be a numpy.ndarray with shape (h, w, 3)')\nif type(content_image) is not np.ndarray or len(content_image.shape) != 3 or int(content_image.shape[2]) != 3:\n raise TypeEr... | <|body_start_0|>
if type(style_image) is not np.ndarray or len(style_image.shape) != 3 or int(style_image.shape[2]) != 3:
raise TypeError('style_image must be a numpy.ndarray with shape (h, w, 3)')
if type(content_image) is not np.ndarray or len(content_image.shape) != 3 or int(content_image... | Class to perform tasks for neural style transfer | NST | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NST:
"""Class to perform tasks for neural style transfer"""
def __init__(self, style_image, content_image, alpha=10000.0, beta=1):
"""style_image - the image used as a style reference, stored as a numpy.ndarray content_image - the image used as a content reference, stored as a numpy.... | stack_v2_sparse_classes_75kplus_train_067338 | 2,684 | no_license | [
{
"docstring": "style_image - the image used as a style reference, stored as a numpy.ndarray content_image - the image used as a content reference, stored as a numpy.ndarray alpha - the weight for content cost beta - the weight for style cost",
"name": "__init__",
"signature": "def __init__(self, style_... | 2 | null | Implement the Python class `NST` described below.
Class description:
Class to perform tasks for neural style transfer
Method signatures and docstrings:
- def __init__(self, style_image, content_image, alpha=10000.0, beta=1): style_image - the image used as a style reference, stored as a numpy.ndarray content_image - ... | Implement the Python class `NST` described below.
Class description:
Class to perform tasks for neural style transfer
Method signatures and docstrings:
- def __init__(self, style_image, content_image, alpha=10000.0, beta=1): style_image - the image used as a style reference, stored as a numpy.ndarray content_image - ... | 2757c8526290197d45a4de33cda71e686ddcbf1c | <|skeleton|>
class NST:
"""Class to perform tasks for neural style transfer"""
def __init__(self, style_image, content_image, alpha=10000.0, beta=1):
"""style_image - the image used as a style reference, stored as a numpy.ndarray content_image - the image used as a content reference, stored as a numpy.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NST:
"""Class to perform tasks for neural style transfer"""
def __init__(self, style_image, content_image, alpha=10000.0, beta=1):
"""style_image - the image used as a style reference, stored as a numpy.ndarray content_image - the image used as a content reference, stored as a numpy.ndarray alpha... | the_stack_v2_python_sparse | supervised_learning/0x0C-neural_style_transfer/0-neural_style.py | 95ktsmith/holbertonschool-machine_learning | train | 0 |
14660005f0bd0171da03b1060b2681e0a17af3a4 | [
"super(S2S, self).__init__()\nself.encoder = encoder\nself.decoder = decoder",
"encoder_output, encoder_hidden_state = self.encoder(input_batch)\nencoder_hidden_state = combine_bidir_hidden_state(self, encoder_hidden_state)\ndecoder_output = self.decoder(input_batch, target_batch, encoder_hidden_state, encoder_ou... | <|body_start_0|>
super(S2S, self).__init__()
self.encoder = encoder
self.decoder = decoder
<|end_body_0|>
<|body_start_1|>
encoder_output, encoder_hidden_state = self.encoder(input_batch)
encoder_hidden_state = combine_bidir_hidden_state(self, encoder_hidden_state)
decod... | S2S | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class S2S:
def __init__(self, encoder, decoder):
""":param encoder: Encoder :param decoder: Decoder"""
<|body_0|>
def forward(self, input_batch, target_batch):
""":param input_batch: the shape of input_batch is (input_length, batch_size). type: Tensor :param target_batch: ... | stack_v2_sparse_classes_75kplus_train_067339 | 12,036 | permissive | [
{
"docstring": ":param encoder: Encoder :param decoder: Decoder",
"name": "__init__",
"signature": "def __init__(self, encoder, decoder)"
},
{
"docstring": ":param input_batch: the shape of input_batch is (input_length, batch_size). type: Tensor :param target_batch: the shape of target_batch is ... | 3 | null | Implement the Python class `S2S` described below.
Class description:
Implement the S2S class.
Method signatures and docstrings:
- def __init__(self, encoder, decoder): :param encoder: Encoder :param decoder: Decoder
- def forward(self, input_batch, target_batch): :param input_batch: the shape of input_batch is (input... | Implement the Python class `S2S` described below.
Class description:
Implement the S2S class.
Method signatures and docstrings:
- def __init__(self, encoder, decoder): :param encoder: Encoder :param decoder: Decoder
- def forward(self, input_batch, target_batch): :param input_batch: the shape of input_batch is (input... | cbc5ad010ce04da7a82f05ad1a3b6c16f8467266 | <|skeleton|>
class S2S:
def __init__(self, encoder, decoder):
""":param encoder: Encoder :param decoder: Decoder"""
<|body_0|>
def forward(self, input_batch, target_batch):
""":param input_batch: the shape of input_batch is (input_length, batch_size). type: Tensor :param target_batch: ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class S2S:
def __init__(self, encoder, decoder):
""":param encoder: Encoder :param decoder: Decoder"""
super(S2S, self).__init__()
self.encoder = encoder
self.decoder = decoder
def forward(self, input_batch, target_batch):
""":param input_batch: the shape of input_batch ... | the_stack_v2_python_sparse | models/S2S_attention.py | FYYFU/NMT | train | 0 | |
a128be39729249daef44e09459c353a56adfb303 | [
"xr_data = xr.open_mfdataset(self.path_to_files, chunks=self.chunks, parallel=True)\nif not all((x in list(xr_data.coords) for x in self.DIMS)):\n xr_data = xr_data.rename({'latitude': 'lat', 'longitude': 'lon'})\nif isinstance(xr_data.time.values[0], cftime._cftime.datetime):\n datetime_index = xr_data.index... | <|body_start_0|>
xr_data = xr.open_mfdataset(self.path_to_files, chunks=self.chunks, parallel=True)
if not all((x in list(xr_data.coords) for x in self.DIMS)):
xr_data = xr_data.rename({'latitude': 'lat', 'longitude': 'lon'})
if isinstance(xr_data.time.values[0], cftime._cftime.datet... | Methods template for GCM | Model | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
"""Methods template for GCM"""
def data_array(self):
"""Lazy load model/analysis data into memory."""
<|body_0|>
def cut(self, array_obj):
"""Wrapper function to slice GCM using a dictionary Slice GCM with a user-defined dictionary and take only the first ... | stack_v2_sparse_classes_75kplus_train_067340 | 2,555 | permissive | [
{
"docstring": "Lazy load model/analysis data into memory.",
"name": "data_array",
"signature": "def data_array(self)"
},
{
"docstring": "Wrapper function to slice GCM using a dictionary Slice GCM with a user-defined dictionary and take only the first elements of member_id or nband, if exists Ar... | 2 | null | Implement the Python class `Model` described below.
Class description:
Methods template for GCM
Method signatures and docstrings:
- def data_array(self): Lazy load model/analysis data into memory.
- def cut(self, array_obj): Wrapper function to slice GCM using a dictionary Slice GCM with a user-defined dictionary and... | Implement the Python class `Model` described below.
Class description:
Methods template for GCM
Method signatures and docstrings:
- def data_array(self): Lazy load model/analysis data into memory.
- def cut(self, array_obj): Wrapper function to slice GCM using a dictionary Slice GCM with a user-defined dictionary and... | 7ede8fbe1cb38bf6239a3c492e6d0ac634b843c1 | <|skeleton|>
class Model:
"""Methods template for GCM"""
def data_array(self):
"""Lazy load model/analysis data into memory."""
<|body_0|>
def cut(self, array_obj):
"""Wrapper function to slice GCM using a dictionary Slice GCM with a user-defined dictionary and take only the first ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Model:
"""Methods template for GCM"""
def data_array(self):
"""Lazy load model/analysis data into memory."""
xr_data = xr.open_mfdataset(self.path_to_files, chunks=self.chunks, parallel=True)
if not all((x in list(xr_data.coords) for x in self.DIMS)):
xr_data = xr_data... | the_stack_v2_python_sparse | jetstream/model/model.py | geosciences-data-practicum/reanalysis_getter | train | 1 |
17a406f9b7ce1b745ed9008774687434ebb2a1eb | [
"self.buff = buff\nself.elements = {}\nself.parse_config()",
"\"\"\"\n ; final return from function executing next plugin\n ; followed by config\n ;\n seg000:00004198 58 pop eax\n seg000:00004199 61 popa\n seg000:0000419A C9 leave\n seg000:0000419B C3 retn\... | <|body_start_0|>
self.buff = buff
self.elements = {}
self.parse_config()
<|end_body_0|>
<|body_start_1|>
"""
; final return from function executing next plugin
; followed by config
;
seg000:00004198 58 pop eax
... | Gets specific configuration IoCs from the malware. :ivar dict elements: Dictionary representing various configuration elements that were recovered. | GetConfig | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetConfig:
"""Gets specific configuration IoCs from the malware. :ivar dict elements: Dictionary representing various configuration elements that were recovered."""
def __init__(self, buff):
"""Initialize decoder instance. :param bytes buff: The stream of bytes representing the first... | stack_v2_sparse_classes_75kplus_train_067341 | 11,801 | permissive | [
{
"docstring": "Initialize decoder instance. :param bytes buff: The stream of bytes representing the first stage.",
"name": "__init__",
"signature": "def __init__(self, buff)"
},
{
"docstring": "Parse out Poison Ivy config elements.",
"name": "parse_config",
"signature": "def parse_confi... | 2 | null | Implement the Python class `GetConfig` described below.
Class description:
Gets specific configuration IoCs from the malware. :ivar dict elements: Dictionary representing various configuration elements that were recovered.
Method signatures and docstrings:
- def __init__(self, buff): Initialize decoder instance. :par... | Implement the Python class `GetConfig` described below.
Class description:
Gets specific configuration IoCs from the malware. :ivar dict elements: Dictionary representing various configuration elements that were recovered.
Method signatures and docstrings:
- def __init__(self, buff): Initialize decoder instance. :par... | 29de19095d9a8eb9b2fd3fb41148dfd69187199b | <|skeleton|>
class GetConfig:
"""Gets specific configuration IoCs from the malware. :ivar dict elements: Dictionary representing various configuration elements that were recovered."""
def __init__(self, buff):
"""Initialize decoder instance. :param bytes buff: The stream of bytes representing the first... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GetConfig:
"""Gets specific configuration IoCs from the malware. :ivar dict elements: Dictionary representing various configuration elements that were recovered."""
def __init__(self, buff):
"""Initialize decoder instance. :param bytes buff: The stream of bytes representing the first stage."""
... | the_stack_v2_python_sparse | malchive/decoders/pivy.py | 34-4e-36/malchive | train | 0 |
3486466935017cad555fe6e6ec7924eb5a4e0909 | [
"if request.method == 'GET':\n return WPS10DescribeProcessKVPDecoder(request.GET)\nelse:\n return WPS10DescribeProcessXMLDecoder(request.body)",
"decoder = self.get_decoder(request)\nidentifiers = set(decoder.identifiers)\nused_processes = []\nfor process in get_processes():\n process_identifier = getatt... | <|body_start_0|>
if request.method == 'GET':
return WPS10DescribeProcessKVPDecoder(request.GET)
else:
return WPS10DescribeProcessXMLDecoder(request.body)
<|end_body_0|>
<|body_start_1|>
decoder = self.get_decoder(request)
identifiers = set(decoder.identifiers)
... | WPS 1.0 DescribeProcess service handler. | WPS10DescribeProcessHandler | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WPS10DescribeProcessHandler:
"""WPS 1.0 DescribeProcess service handler."""
def get_decoder(request):
"""Get the WPS request decoder."""
<|body_0|>
def handle(self, request):
"""Handle HTTP request."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_067342 | 3,517 | permissive | [
{
"docstring": "Get the WPS request decoder.",
"name": "get_decoder",
"signature": "def get_decoder(request)"
},
{
"docstring": "Handle HTTP request.",
"name": "handle",
"signature": "def handle(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_008825 | Implement the Python class `WPS10DescribeProcessHandler` described below.
Class description:
WPS 1.0 DescribeProcess service handler.
Method signatures and docstrings:
- def get_decoder(request): Get the WPS request decoder.
- def handle(self, request): Handle HTTP request. | Implement the Python class `WPS10DescribeProcessHandler` described below.
Class description:
WPS 1.0 DescribeProcess service handler.
Method signatures and docstrings:
- def get_decoder(request): Get the WPS request decoder.
- def handle(self, request): Handle HTTP request.
<|skeleton|>
class WPS10DescribeProcessHan... | c7f709cbbcf9172b99fa327221b59b5119305c82 | <|skeleton|>
class WPS10DescribeProcessHandler:
"""WPS 1.0 DescribeProcess service handler."""
def get_decoder(request):
"""Get the WPS request decoder."""
<|body_0|>
def handle(self, request):
"""Handle HTTP request."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WPS10DescribeProcessHandler:
"""WPS 1.0 DescribeProcess service handler."""
def get_decoder(request):
"""Get the WPS request decoder."""
if request.method == 'GET':
return WPS10DescribeProcessKVPDecoder(request.GET)
else:
return WPS10DescribeProcessXMLDecod... | the_stack_v2_python_sparse | eoxserver/services/ows/wps/v10/describeprocess.py | EOxServer/eoxserver | train | 30 |
11074466a0cacec728ede6a25b20e64e5b6cdc70 | [
"self.X = x\nself.y = y\nif kernel != 0:\n self.kernel = kernel",
"print('Starting Run...')\nprint(self.X)\nprint(self.y)\nstart = time()\nself.fit = GaussianProcessClassifier(kernel=self.kernel).fit(self.X, self.y)\nprint('Run time: %.4f' % (time() - start))\nprint('Theta-Estimates: ')\nprint(self.fit.kernel_... | <|body_start_0|>
self.X = x
self.y = y
if kernel != 0:
self.kernel = kernel
<|end_body_0|>
<|body_start_1|>
print('Starting Run...')
print(self.X)
print(self.y)
start = time()
self.fit = GaussianProcessClassifier(kernel=self.kernel).fit(self.X... | Class that is used for fitting Gaussian Kernels. This uses an implementation from Scikit that uses the Laplace approximation to expand around the posterior | GPR_kernelfit | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GPR_kernelfit:
"""Class that is used for fitting Gaussian Kernels. This uses an implementation from Scikit that uses the Laplace approximation to expand around the posterior"""
def __init__(self, x, y, kernel=0):
"""Constructor"""
<|body_0|>
def run_fit(self):
""... | stack_v2_sparse_classes_75kplus_train_067343 | 3,875 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, x, y, kernel=0)"
},
{
"docstring": "Runs a fit for the Gaussian Process Classifier",
"name": "run_fit",
"signature": "def run_fit(self)"
},
{
"docstring": "Visualizes the fit",
"name": "show_fi... | 4 | stack_v2_sparse_classes_30k_train_005759 | Implement the Python class `GPR_kernelfit` described below.
Class description:
Class that is used for fitting Gaussian Kernels. This uses an implementation from Scikit that uses the Laplace approximation to expand around the posterior
Method signatures and docstrings:
- def __init__(self, x, y, kernel=0): Constructor... | Implement the Python class `GPR_kernelfit` described below.
Class description:
Class that is used for fitting Gaussian Kernels. This uses an implementation from Scikit that uses the Laplace approximation to expand around the posterior
Method signatures and docstrings:
- def __init__(self, x, y, kernel=0): Constructor... | 025e401e4092fde9c503867e242a440c94d9d1d1 | <|skeleton|>
class GPR_kernelfit:
"""Class that is used for fitting Gaussian Kernels. This uses an implementation from Scikit that uses the Laplace approximation to expand around the posterior"""
def __init__(self, x, y, kernel=0):
"""Constructor"""
<|body_0|>
def run_fit(self):
""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GPR_kernelfit:
"""Class that is used for fitting Gaussian Kernels. This uses an implementation from Scikit that uses the Laplace approximation to expand around the posterior"""
def __init__(self, x, y, kernel=0):
"""Constructor"""
self.X = x
self.y = y
if kernel != 0:
... | the_stack_v2_python_sparse | GPR_kernelfit.py | hringbauer/BarrierInferPublic | train | 2 |
6fa0fc6410621ba32ffccb997693cd2b1dc6d9ff | [
"memo = {}\nfor item1 in A:\n for item2 in A:\n item = item1 & item2\n memo[item] = memo.get(item, 0) + 1\nres = 0\nfor item1 in A:\n for item2 in memo.keys():\n if item1 & item2 == 0:\n res += memo[item2]\nreturn res",
"tmp = []\nmaxlen = 0\nfor a in A:\n tmp.append(bin(a... | <|body_start_0|>
memo = {}
for item1 in A:
for item2 in A:
item = item1 & item2
memo[item] = memo.get(item, 0) + 1
res = 0
for item1 in A:
for item2 in memo.keys():
if item1 & item2 == 0:
res += m... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def countTriplets(self, A):
""":type A: List[int] :rtype: int"""
<|body_0|>
def solve2(self, A):
""":type A: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
memo = {}
for item1 in A:
for item2 in A... | stack_v2_sparse_classes_75kplus_train_067344 | 2,444 | no_license | [
{
"docstring": ":type A: List[int] :rtype: int",
"name": "countTriplets",
"signature": "def countTriplets(self, A)"
},
{
"docstring": ":type A: List[int] :rtype: int",
"name": "solve2",
"signature": "def solve2(self, A)"
}
] | 2 | stack_v2_sparse_classes_30k_train_048362 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countTriplets(self, A): :type A: List[int] :rtype: int
- def solve2(self, A): :type A: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def countTriplets(self, A): :type A: List[int] :rtype: int
- def solve2(self, A): :type A: List[int] :rtype: int
<|skeleton|>
class Solution:
def countTriplets(self, A):
... | a5cb862f0c5a3cfd21468141800568c2dedded0a | <|skeleton|>
class Solution:
def countTriplets(self, A):
""":type A: List[int] :rtype: int"""
<|body_0|>
def solve2(self, A):
""":type A: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def countTriplets(self, A):
""":type A: List[int] :rtype: int"""
memo = {}
for item1 in A:
for item2 in A:
item = item1 & item2
memo[item] = memo.get(item, 0) + 1
res = 0
for item1 in A:
for item2 in memo... | the_stack_v2_python_sparse | python/leetcode/982_tripes_bitwise_and.py | Levintsky/topcoder | train | 0 | |
c1ed00fafa2c363aa0060f9504fa7a8614950c15 | [
"super(ExperimentalBase, self).__init__(**kwargs)\nself.id = identifier\nself.label = obj.get('label')\nif self.label is None:\n self.label = ''\nself.filename = filename\nself.data = None\nself.schema = None",
"self.data = read_tabular(self.filename, dtype_conversion)\nwith open_text(memote.experimental.schem... | <|body_start_0|>
super(ExperimentalBase, self).__init__(**kwargs)
self.id = identifier
self.label = obj.get('label')
if self.label is None:
self.label = ''
self.filename = filename
self.data = None
self.schema = None
<|end_body_0|>
<|body_start_1|>
... | Represent a specific medium condition. | ExperimentalBase | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExperimentalBase:
"""Represent a specific medium condition."""
def __init__(self, identifier, obj, filename, **kwargs):
"""Initialize a medium. Parameters ---------- identifier : str obj : dict filename : str or pathlib.Path The full file path. May be a compressed file. kwargs"""
... | stack_v2_sparse_classes_75kplus_train_067345 | 3,478 | permissive | [
{
"docstring": "Initialize a medium. Parameters ---------- identifier : str obj : dict filename : str or pathlib.Path The full file path. May be a compressed file. kwargs",
"name": "__init__",
"signature": "def __init__(self, identifier, obj, filename, **kwargs)"
},
{
"docstring": "Load the data... | 4 | stack_v2_sparse_classes_30k_train_036497 | Implement the Python class `ExperimentalBase` described below.
Class description:
Represent a specific medium condition.
Method signatures and docstrings:
- def __init__(self, identifier, obj, filename, **kwargs): Initialize a medium. Parameters ---------- identifier : str obj : dict filename : str or pathlib.Path Th... | Implement the Python class `ExperimentalBase` described below.
Class description:
Represent a specific medium condition.
Method signatures and docstrings:
- def __init__(self, identifier, obj, filename, **kwargs): Initialize a medium. Parameters ---------- identifier : str obj : dict filename : str or pathlib.Path Th... | 81a55a163262a0e06bfcb036d98e8e551edc3873 | <|skeleton|>
class ExperimentalBase:
"""Represent a specific medium condition."""
def __init__(self, identifier, obj, filename, **kwargs):
"""Initialize a medium. Parameters ---------- identifier : str obj : dict filename : str or pathlib.Path The full file path. May be a compressed file. kwargs"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ExperimentalBase:
"""Represent a specific medium condition."""
def __init__(self, identifier, obj, filename, **kwargs):
"""Initialize a medium. Parameters ---------- identifier : str obj : dict filename : str or pathlib.Path The full file path. May be a compressed file. kwargs"""
super(Ex... | the_stack_v2_python_sparse | src/memote/experimental/experimental_base.py | opencobra/memote | train | 109 |
88d56abedd753ce7ab4e59945984c82c83fa48e3 | [
"ProjectorUtils.__init__(self, vfov, batch_size, feature_map_height, feature_map_width, output_height, output_width, gridcellsize, world_shift_origin, z_clip_threshold, device)\nself.vfov = vfov\nself.batch_size = batch_size\nself.fmh = feature_map_height\nself.fmw = feature_map_width\nself.output_height = output_h... | <|body_start_0|>
ProjectorUtils.__init__(self, vfov, batch_size, feature_map_height, feature_map_width, output_height, output_width, gridcellsize, world_shift_origin, z_clip_threshold, device)
self.vfov = vfov
self.batch_size = batch_size
self.fmh = feature_map_height
self.fmw = ... | Projects values stored in an array. Can be 2D or 3D array. It can project for instance RGB values, Grayscale values, semantic classes etc.. It projects them onto a ground plane map. | Projector | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Projector:
"""Projects values stored in an array. Can be 2D or 3D array. It can project for instance RGB values, Grayscale values, semantic classes etc.. It projects them onto a ground plane map."""
def __init__(self, vfov, batch_size, feature_map_height, feature_map_width, output_height, ou... | stack_v2_sparse_classes_75kplus_train_067346 | 4,027 | permissive | [
{
"docstring": "Init function Args: vfov (float): Vertical Field of View batch_size (float) feature_map_height (int): height of image feature_map_width (int): width of image output_height (int): Height of the spatial map to be produced output_width (int): Width of the spatial map to be produced gridcellsize (fl... | 2 | stack_v2_sparse_classes_30k_train_008652 | Implement the Python class `Projector` described below.
Class description:
Projects values stored in an array. Can be 2D or 3D array. It can project for instance RGB values, Grayscale values, semantic classes etc.. It projects them onto a ground plane map.
Method signatures and docstrings:
- def __init__(self, vfov, ... | Implement the Python class `Projector` described below.
Class description:
Projects values stored in an array. Can be 2D or 3D array. It can project for instance RGB values, Grayscale values, semantic classes etc.. It projects them onto a ground plane map.
Method signatures and docstrings:
- def __init__(self, vfov, ... | 34689213fd3e341d4b04965a36e10ee62a21a6a5 | <|skeleton|>
class Projector:
"""Projects values stored in an array. Can be 2D or 3D array. It can project for instance RGB values, Grayscale values, semantic classes etc.. It projects them onto a ground plane map."""
def __init__(self, vfov, batch_size, feature_map_height, feature_map_width, output_height, ou... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Projector:
"""Projects values stored in an array. Can be 2D or 3D array. It can project for instance RGB values, Grayscale values, semantic classes etc.. It projects them onto a ground plane map."""
def __init__(self, vfov, batch_size, feature_map_height, feature_map_width, output_height, output_width, g... | the_stack_v2_python_sparse | projector/projector.py | whn09/Semantic-MapNet | train | 1 |
9a05326fb5a75b779c5f7c6233ef819756c70fc6 | [
"Module.__init__(self, **kwargs)\nself._warn_sound = warn_sound\nself._warn_interval = warn_interval\nself._start_sound = start_sound\nself._started_sound = started_sound\nself._stop_sound = stop_sound\nself._stopped_sound = stopped_sound\nself._trigger_file = trigger_file\nself._player = player\nself._autonomous =... | <|body_start_0|>
Module.__init__(self, **kwargs)
self._warn_sound = warn_sound
self._warn_interval = warn_interval
self._start_sound = start_sound
self._started_sound = started_sound
self._stop_sound = stop_sound
self._stopped_sound = stopped_sound
self._t... | A module that can plays a warning sound while an IAutonomous module is running. | AutonomousWarning | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutonomousWarning:
"""A module that can plays a warning sound while an IAutonomous module is running."""
def __init__(self, warn_sound: str, warn_interval: float=1, start_sound: Optional[str]=None, started_sound: Optional[str]=None, stop_sound: Optional[str]=None, stopped_sound: Optional[str... | stack_v2_sparse_classes_75kplus_train_067347 | 4,945 | permissive | [
{
"docstring": "Initialize a new warning. Args: warn_sound: Name of file to play. warn_interval: Interval in seconds between sounds. start_sound: Sound to play when starting systems. started_sound: Sound to play when systems started. stop_sound: Sound to play when stopping systems. stopped_sound: Sound to play ... | 5 | stack_v2_sparse_classes_30k_train_028848 | Implement the Python class `AutonomousWarning` described below.
Class description:
A module that can plays a warning sound while an IAutonomous module is running.
Method signatures and docstrings:
- def __init__(self, warn_sound: str, warn_interval: float=1, start_sound: Optional[str]=None, started_sound: Optional[st... | Implement the Python class `AutonomousWarning` described below.
Class description:
A module that can plays a warning sound while an IAutonomous module is running.
Method signatures and docstrings:
- def __init__(self, warn_sound: str, warn_interval: float=1, start_sound: Optional[str]=None, started_sound: Optional[st... | 2d7a06e5485b61b6ca7e51d99b08651ea6021086 | <|skeleton|>
class AutonomousWarning:
"""A module that can plays a warning sound while an IAutonomous module is running."""
def __init__(self, warn_sound: str, warn_interval: float=1, start_sound: Optional[str]=None, started_sound: Optional[str]=None, stop_sound: Optional[str]=None, stopped_sound: Optional[str... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AutonomousWarning:
"""A module that can plays a warning sound while an IAutonomous module is running."""
def __init__(self, warn_sound: str, warn_interval: float=1, start_sound: Optional[str]=None, started_sound: Optional[str]=None, stop_sound: Optional[str]=None, stopped_sound: Optional[str]=None, playe... | the_stack_v2_python_sparse | pyobs/modules/utils/autonomouswarning.py | pyobs/pyobs-core | train | 9 |
3274aac783d977908178fef541195ebd107c4c4e | [
"self.name = str(name)\nself.percentChance = float(percentChance)\nself.dynamicFunc = dynamicFunc\nself.description = str(description)\nself.nodes = nodes\nself.edges = edges\nassert duration != 0\nself.duration = int(duration)\nself._startDay = None",
"if self._startDay:\n if day < self._startDay + self.durat... | <|body_start_0|>
self.name = str(name)
self.percentChance = float(percentChance)
self.dynamicFunc = dynamicFunc
self.description = str(description)
self.nodes = nodes
self.edges = edges
assert duration != 0
self.duration = int(duration)
self._start... | Class that defines under what circumstances something happens. | EventProfile | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventProfile:
"""Class that defines under what circumstances something happens."""
def __init__(self, name, percentChance, dynamicFunc=None, description=None, nodes=(), edges=(), duration=1):
"""name - name of the event. percentChance - constant percentage chance of this event existi... | stack_v2_sparse_classes_75kplus_train_067348 | 5,987 | permissive | [
{
"docstring": "name - name of the event. percentChance - constant percentage chance of this event existing on any given turn. dynamicFunc - A function object with args (day, (otherEvents)) that returns percentage chance of this event existing. description - A text description of what this event is. nodes - A t... | 2 | stack_v2_sparse_classes_30k_test_002326 | Implement the Python class `EventProfile` described below.
Class description:
Class that defines under what circumstances something happens.
Method signatures and docstrings:
- def __init__(self, name, percentChance, dynamicFunc=None, description=None, nodes=(), edges=(), duration=1): name - name of the event. percen... | Implement the Python class `EventProfile` described below.
Class description:
Class that defines under what circumstances something happens.
Method signatures and docstrings:
- def __init__(self, name, percentChance, dynamicFunc=None, description=None, nodes=(), edges=(), duration=1): name - name of the event. percen... | ec3c617ad8b60cb07d526edfbbd8d3483e30fdc0 | <|skeleton|>
class EventProfile:
"""Class that defines under what circumstances something happens."""
def __init__(self, name, percentChance, dynamicFunc=None, description=None, nodes=(), edges=(), duration=1):
"""name - name of the event. percentChance - constant percentage chance of this event existi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EventProfile:
"""Class that defines under what circumstances something happens."""
def __init__(self, name, percentChance, dynamicFunc=None, description=None, nodes=(), edges=(), duration=1):
"""name - name of the event. percentChance - constant percentage chance of this event existing on any giv... | the_stack_v2_python_sparse | trader/profiles.py | rossh-42/trader | train | 0 |
fd638627f40b8529819621985418841132e7cb64 | [
"ReplayBuffer.__init__(self, capacity, storage_unit)\nself._num_add_calls = 0\nself._num_evicted = 0",
"self._num_timesteps_added += item.count\nself._num_timesteps_added_wrap += item.count\nself._num_add_calls += 1\nif self._num_timesteps_added < self.capacity:\n self._storage.append(item)\n self._est_size... | <|body_start_0|>
ReplayBuffer.__init__(self, capacity, storage_unit)
self._num_add_calls = 0
self._num_evicted = 0
<|end_body_0|>
<|body_start_1|>
self._num_timesteps_added += item.count
self._num_timesteps_added_wrap += item.count
self._num_add_calls += 1
if sel... | This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir". | ReservoirReplayBuffer | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReservoirReplayBuffer:
"""This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir"."""
def __init__(self, capacity: int=10000, storage_unit: str='timesteps', **kwargs):
"""Initializes a ReservoirBuffer inst... | stack_v2_sparse_classes_75kplus_train_067349 | 4,533 | permissive | [
{
"docstring": "Initializes a ReservoirBuffer instance. Args: capacity: Max number of timesteps to store in the FIFO buffer. After reaching this number, older samples will be dropped to make space for new ones. storage_unit: Either 'timesteps', 'sequences' or 'episodes'. Specifies how experiences are stored.",
... | 5 | stack_v2_sparse_classes_30k_train_027887 | Implement the Python class `ReservoirReplayBuffer` described below.
Class description:
This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir".
Method signatures and docstrings:
- def __init__(self, capacity: int=10000, storage_unit: str='... | Implement the Python class `ReservoirReplayBuffer` described below.
Class description:
This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir".
Method signatures and docstrings:
- def __init__(self, capacity: int=10000, storage_unit: str='... | edba68c3e7cf255d1d6479329f305adb7fa4c3ed | <|skeleton|>
class ReservoirReplayBuffer:
"""This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir"."""
def __init__(self, capacity: int=10000, storage_unit: str='timesteps', **kwargs):
"""Initializes a ReservoirBuffer inst... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReservoirReplayBuffer:
"""This buffer implements reservoir sampling. The algorithm has been described by Jeffrey S. Vitter in "Random sampling with a reservoir"."""
def __init__(self, capacity: int=10000, storage_unit: str='timesteps', **kwargs):
"""Initializes a ReservoirBuffer instance. Args: c... | the_stack_v2_python_sparse | rllib/utils/replay_buffers/reservoir_replay_buffer.py | ray-project/ray | train | 29,482 |
4b81bd9f9dc2e747950e2663fade96025672eb8c | [
"send_key(KEY_MENU)\nlog_test_case(self.name, 'sometime cant find the ui,so wait for 1 s.')\nsleep(1)\nstr_menu_import_export = contact.get_value('menu_import_export')\nlog_test_case(self.name, str_menu_import_export)\nclick_in_list_by_index(2)\nstr_import_from_sdcard = contact.get_value('import_from_sdcard')\nlog_... | <|body_start_0|>
send_key(KEY_MENU)
log_test_case(self.name, 'sometime cant find the ui,so wait for 1 s.')
sleep(1)
str_menu_import_export = contact.get_value('menu_import_export')
log_test_case(self.name, str_menu_import_export)
click_in_list_by_index(2)
str_impo... | test_suit_contacts_case3 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_suit_contacts_case3:
def import_from_storage(self):
"""This function import from storage. @return: none"""
<|body_0|>
def import_from_simcard(self):
"""This function import from simcard. @return: none"""
<|body_1|>
def export_to_storage(self):
... | stack_v2_sparse_classes_75kplus_train_067350 | 5,639 | no_license | [
{
"docstring": "This function import from storage. @return: none",
"name": "import_from_storage",
"signature": "def import_from_storage(self)"
},
{
"docstring": "This function import from simcard. @return: none",
"name": "import_from_simcard",
"signature": "def import_from_simcard(self)"... | 5 | stack_v2_sparse_classes_30k_train_051011 | Implement the Python class `test_suit_contacts_case3` described below.
Class description:
Implement the test_suit_contacts_case3 class.
Method signatures and docstrings:
- def import_from_storage(self): This function import from storage. @return: none
- def import_from_simcard(self): This function import from simcard... | Implement the Python class `test_suit_contacts_case3` described below.
Class description:
Implement the test_suit_contacts_case3 class.
Method signatures and docstrings:
- def import_from_storage(self): This function import from storage. @return: none
- def import_from_simcard(self): This function import from simcard... | a04b717ae437511abae1e7e9e399373c161a7b65 | <|skeleton|>
class test_suit_contacts_case3:
def import_from_storage(self):
"""This function import from storage. @return: none"""
<|body_0|>
def import_from_simcard(self):
"""This function import from simcard. @return: none"""
<|body_1|>
def export_to_storage(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class test_suit_contacts_case3:
def import_from_storage(self):
"""This function import from storage. @return: none"""
send_key(KEY_MENU)
log_test_case(self.name, 'sometime cant find the ui,so wait for 1 s.')
sleep(1)
str_menu_import_export = contact.get_value('menu_import_exp... | the_stack_v2_python_sparse | test_env/test_suit_contacts/test_suit_contacts_case3.py | wwlwwlqaz/Qualcomm | train | 1 | |
48c919946ce879045c6ff2cda93ebb08923bb76c | [
"try:\n release = Release.objects.get(project=project, version=version)\nexcept Release.DoesNotExist:\n raise ResourceDoesNotExist\nfile_list = ReleaseFile.objects.filter(release=release).select_related('file').order_by('name')\nreturn self.paginate(request=request, queryset=file_list, order_by='name', pagina... | <|body_start_0|>
try:
release = Release.objects.get(project=project, version=version)
except Release.DoesNotExist:
raise ResourceDoesNotExist
file_list = ReleaseFile.objects.filter(release=release).select_related('file').order_by('name')
return self.paginate(reque... | ReleaseFilesEndpoint | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReleaseFilesEndpoint:
def get(self, request, project, version):
"""List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug of t... | stack_v2_sparse_classes_75kplus_train_067351 | 6,460 | permissive | [
{
"docstring": "List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug of the project to list the release files of. :pparam string version: the versio... | 2 | stack_v2_sparse_classes_30k_train_001570 | Implement the Python class `ReleaseFilesEndpoint` described below.
Class description:
Implement the ReleaseFilesEndpoint class.
Method signatures and docstrings:
- def get(self, request, project, version): List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organ... | Implement the Python class `ReleaseFilesEndpoint` described below.
Class description:
Implement the ReleaseFilesEndpoint class.
Method signatures and docstrings:
- def get(self, request, project, version): List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organ... | cddc3b643a13b52ac6d07ff22e4bd5d69ecbad90 | <|skeleton|>
class ReleaseFilesEndpoint:
def get(self, request, project, version):
"""List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug of t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ReleaseFilesEndpoint:
def get(self, request, project, version):
"""List a Release's Files `````````````````````` Retrieve a list of files for a given release. :pparam string organization_slug: the slug of the organization the release belongs to. :pparam string project_slug: the slug of the project to ... | the_stack_v2_python_sparse | src/sentry/api/endpoints/release_files.py | mitsuhiko/sentry | train | 4 | |
87e3bea1706a5f7bf724444bb55a0e1148a80ad7 | [
"super(MultiGateMixtureofExperts, self).__init__()\nself.gating_networks = nn.ModuleList(gating_networks)\nself.shared_layers = nn.ModuleList(shared_layers)\nself.gating_net_running_means = {tower: torch.zeros(size=(1, len(shared_layers))).to(device) for tower in towers.values()}\nself.towers = nn.ModuleList(towers... | <|body_start_0|>
super(MultiGateMixtureofExperts, self).__init__()
self.gating_networks = nn.ModuleList(gating_networks)
self.shared_layers = nn.ModuleList(shared_layers)
self.gating_net_running_means = {tower: torch.zeros(size=(1, len(shared_layers))).to(device) for tower in towers.valu... | MultiGateMixtureofExperts | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiGateMixtureofExperts:
def __init__(self, shared_layers: List[Any], gating_networks: List[Any], towers: Dict[Any, Any], device, include_lens: bool, batch_size: int, return_weights: bool=True, gating_drop=0.1, mean_diff=0.1, weight_adjust_mode='reassign_mean_stateful'):
""":param shar... | stack_v2_sparse_classes_75kplus_train_067352 | 6,044 | no_license | [
{
"docstring": ":param shared_layers: a list of nn.Modules through which the input is fed :param gating_networks: a list of nn.Modules specifying the gating functions for each task, the length of this list should be equal to the number of tasks :param towers: a list of nn.modules specifying the task specific la... | 2 | null | Implement the Python class `MultiGateMixtureofExperts` described below.
Class description:
Implement the MultiGateMixtureofExperts class.
Method signatures and docstrings:
- def __init__(self, shared_layers: List[Any], gating_networks: List[Any], towers: Dict[Any, Any], device, include_lens: bool, batch_size: int, re... | Implement the Python class `MultiGateMixtureofExperts` described below.
Class description:
Implement the MultiGateMixtureofExperts class.
Method signatures and docstrings:
- def __init__(self, shared_layers: List[Any], gating_networks: List[Any], towers: Dict[Any, Any], device, include_lens: bool, batch_size: int, re... | 52b379ef4019a2aaad3f637d5c1af54b498b45f1 | <|skeleton|>
class MultiGateMixtureofExperts:
def __init__(self, shared_layers: List[Any], gating_networks: List[Any], towers: Dict[Any, Any], device, include_lens: bool, batch_size: int, return_weights: bool=True, gating_drop=0.1, mean_diff=0.1, weight_adjust_mode='reassign_mean_stateful'):
""":param shar... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MultiGateMixtureofExperts:
def __init__(self, shared_layers: List[Any], gating_networks: List[Any], towers: Dict[Any, Any], device, include_lens: bool, batch_size: int, return_weights: bool=True, gating_drop=0.1, mean_diff=0.1, weight_adjust_mode='reassign_mean_stateful'):
""":param shared_layers: a l... | the_stack_v2_python_sparse | codebase/models/multigatemixtureofexperts.py | RubenvanHeusden/MasterThesis | train | 2 | |
1ae74b7040b53eac06642d2bfb15618f68ba8725 | [
"if isinstance(value, Integral):\n return value\nraise TypeError",
"if value is None:\n return None\nelse:\n try:\n return int(value)\n except:\n try:\n return long(value)\n except:\n raise TypeError"
] | <|body_start_0|>
if isinstance(value, Integral):
return value
raise TypeError
<|end_body_0|>
<|body_start_1|>
if value is None:
return None
else:
try:
return int(value)
except:
try:
retur... | 处理 int(long) 类型值的转换。 | IntTypeCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IntTypeCase:
"""处理 int(long) 类型值的转换。"""
def to_redis(value):
"""接受 int 类型值,否则抛出 TypeError 。"""
<|body_0|>
def to_python(value):
"""尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if isinstance(value, Integral)... | stack_v2_sparse_classes_75kplus_train_067353 | 753 | no_license | [
{
"docstring": "接受 int 类型值,否则抛出 TypeError 。",
"name": "to_redis",
"signature": "def to_redis(value)"
},
{
"docstring": "尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。",
"name": "to_python",
"signature": "def to_python(value)"
}
] | 2 | stack_v2_sparse_classes_30k_train_052709 | Implement the Python class `IntTypeCase` described below.
Class description:
处理 int(long) 类型值的转换。
Method signatures and docstrings:
- def to_redis(value): 接受 int 类型值,否则抛出 TypeError 。
- def to_python(value): 尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。 | Implement the Python class `IntTypeCase` described below.
Class description:
处理 int(long) 类型值的转换。
Method signatures and docstrings:
- def to_redis(value): 接受 int 类型值,否则抛出 TypeError 。
- def to_python(value): 尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。
<|skeleton|>
class IntTypeCase:
"""处理 int(long) 类型值的转换。"""
def to... | f9fb551afbf47aaca7cdeba8b64a32d2fe3e30d6 | <|skeleton|>
class IntTypeCase:
"""处理 int(long) 类型值的转换。"""
def to_redis(value):
"""接受 int 类型值,否则抛出 TypeError 。"""
<|body_0|>
def to_python(value):
"""尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class IntTypeCase:
"""处理 int(long) 类型值的转换。"""
def to_redis(value):
"""接受 int 类型值,否则抛出 TypeError 。"""
if isinstance(value, Integral):
return value
raise TypeError
def to_python(value):
"""尝试将值转回 int 类型, 如果转换失败,抛出 TypeError。"""
if value is None:
... | the_stack_v2_python_sparse | mysite/base/ooredis/type_case/int_type_case.py | RockyLiys/erp | train | 1 |
fd939494f43c3b2c314406995afddb4c021ad8dd | [
"self.conclusion = conclusion\nself.guard = guard\nself.rhsList = rhsList\nself.quality = quality\nself.confTemplate = confTemplate",
"self.ran = False\nif self.guard is None:\n return True\nelse:\n env = self.conclusion.buildEnv(conclusion)\n return self.guard.guardPassed(env)",
"if not self.canRun(fi... | <|body_start_0|>
self.conclusion = conclusion
self.guard = guard
self.rhsList = rhsList
self.quality = quality
self.confTemplate = confTemplate
<|end_body_0|>
<|body_start_1|>
self.ran = False
if self.guard is None:
return True
else:
... | Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information. | Rule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rule:
"""Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information."""
def __init__(self, conclusion, guard, rhsList, quality, confTemplate):
"""Makes a new rule."""
<|body_0... | stack_v2_sparse_classes_75kplus_train_067354 | 14,326 | no_license | [
{
"docstring": "Makes a new rule.",
"name": "__init__",
"signature": "def __init__(self, conclusion, guard, rhsList, quality, confTemplate)"
},
{
"docstring": "evaluates the prerequisites. Returns true if all prereqs are met.",
"name": "canRun",
"signature": "def canRun(self, conclusion)... | 3 | stack_v2_sparse_classes_30k_train_001965 | Implement the Python class `Rule` described below.
Class description:
Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information.
Method signatures and docstrings:
- def __init__(self, conclusion, guard, rhsList, qual... | Implement the Python class `Rule` described below.
Class description:
Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information.
Method signatures and docstrings:
- def __init__(self, conclusion, guard, rhsList, qual... | f2236ccbc46609c01432f20063cc2fd71a638edb | <|skeleton|>
class Rule:
"""Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information."""
def __init__(self, conclusion, guard, rhsList, quality, confTemplate):
"""Makes a new rule."""
<|body_0... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Rule:
"""Object that defines a complete rule (Horn clause/implication). contains the conclusion, any prerequisites, the rhses and the confidence combination information."""
def __init__(self, conclusion, guard, rhsList, quality, confTemplate):
"""Makes a new rule."""
self.conclusion = con... | the_stack_v2_python_sparse | src/calvin/reasoning/rules.py | john-klingner/Calvin | train | 0 |
8289a28dd3a1d29f4d2f50494ac249b3e4294f19 | [
"super(RegionPrediction, self).__init__()\nself.thresh = thresh\nself.class_axis = class_axis",
"conf_obj = class_prob * obj.unsqueeze_(self.class_axis)\nconf_obj[conf_obj <= self.thresh] = 0\nmax_conf_obj, _ = torch.max(conf_obj, self.class_axis)\nreturn torch.cat([conf_obj, max_conf_obj.unsqueeze_(self.class_ax... | <|body_start_0|>
super(RegionPrediction, self).__init__()
self.thresh = thresh
self.class_axis = class_axis
<|end_body_0|>
<|body_start_1|>
conf_obj = class_prob * obj.unsqueeze_(self.class_axis)
conf_obj[conf_obj <= self.thresh] = 0
max_conf_obj, _ = torch.max(conf_obj,... | Caffe RegionPrediction fully compatible class Parameters: thresh - filtering threshold of confidence = class_conf * obj class_axis - axis that corresponds to classes in the torch tensor class_prob - class probability (typically output of softmax) obj - objectness score (typically after Sigmoid) | RegionPrediction | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RegionPrediction:
"""Caffe RegionPrediction fully compatible class Parameters: thresh - filtering threshold of confidence = class_conf * obj class_axis - axis that corresponds to classes in the torch tensor class_prob - class probability (typically output of softmax) obj - objectness score (typic... | stack_v2_sparse_classes_75kplus_train_067355 | 1,263 | no_license | [
{
"docstring": "Constructs the RegionPrediction object :param thresh: float, threshold for confidence score (default=0.005) :param class_axis: int",
"name": "__init__",
"signature": "def __init__(self, thresh=0.005, class_axis=1)"
},
{
"docstring": ":param class_prob: class probability (typicall... | 2 | stack_v2_sparse_classes_30k_train_022756 | Implement the Python class `RegionPrediction` described below.
Class description:
Caffe RegionPrediction fully compatible class Parameters: thresh - filtering threshold of confidence = class_conf * obj class_axis - axis that corresponds to classes in the torch tensor class_prob - class probability (typically output of... | Implement the Python class `RegionPrediction` described below.
Class description:
Caffe RegionPrediction fully compatible class Parameters: thresh - filtering threshold of confidence = class_conf * obj class_axis - axis that corresponds to classes in the torch tensor class_prob - class probability (typically output of... | 7d2a3dd2beff1dbaff1633f04a1dfc96b87545b4 | <|skeleton|>
class RegionPrediction:
"""Caffe RegionPrediction fully compatible class Parameters: thresh - filtering threshold of confidence = class_conf * obj class_axis - axis that corresponds to classes in the torch tensor class_prob - class probability (typically output of softmax) obj - objectness score (typic... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RegionPrediction:
"""Caffe RegionPrediction fully compatible class Parameters: thresh - filtering threshold of confidence = class_conf * obj class_axis - axis that corresponds to classes in the torch tensor class_prob - class probability (typically output of softmax) obj - objectness score (typically after Si... | the_stack_v2_python_sparse | mtorch/region_prediction.py | liangcht/yolo_objectdetection | train | 0 |
12dff6e98c672ea7b7e8c1e5b1410b6d0ec5ed1a | [
"self.x = np.array(x)\ntry:\n self.n, self.xdim = self.x.shape\nexcept ValueError:\n self.x = np.reshape(self.x, (len(self.x), 1))\n self.n, self.xdim = self.x.shape\nself.y = np.array(y)\ntry:\n _, self.ydim = y.shape\nexcept ValueError:\n self.ydim = 1\nself.xmin = np.min(self.x, axis=0)\nself.xmax... | <|body_start_0|>
self.x = np.array(x)
try:
self.n, self.xdim = self.x.shape
except ValueError:
self.x = np.reshape(self.x, (len(self.x), 1))
self.n, self.xdim = self.x.shape
self.y = np.array(y)
try:
_, self.ydim = y.shape
e... | Wrap functions. | Wrap | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Wrap:
"""Wrap functions."""
def __init__(self, x, y, p):
"""Initialises class to wrap the function with values y at x so that it is p-periodic. Parameters ---------- x : array-like Array of points at which the original function has been evaluated. y : array-like Values of the functio... | stack_v2_sparse_classes_75kplus_train_067356 | 35,613 | permissive | [
{
"docstring": "Initialises class to wrap the function with values y at x so that it is p-periodic. Parameters ---------- x : array-like Array of points at which the original function has been evaluated. y : array-like Values of the function at points x. p : array-like Period of the function in each direction."... | 3 | stack_v2_sparse_classes_30k_train_042384 | Implement the Python class `Wrap` described below.
Class description:
Wrap functions.
Method signatures and docstrings:
- def __init__(self, x, y, p): Initialises class to wrap the function with values y at x so that it is p-periodic. Parameters ---------- x : array-like Array of points at which the original function... | Implement the Python class `Wrap` described below.
Class description:
Wrap functions.
Method signatures and docstrings:
- def __init__(self, x, y, p): Initialises class to wrap the function with values y at x so that it is p-periodic. Parameters ---------- x : array-like Array of points at which the original function... | b065544639a483dda48cda89bcbb11c1772232aa | <|skeleton|>
class Wrap:
"""Wrap functions."""
def __init__(self, x, y, p):
"""Initialises class to wrap the function with values y at x so that it is p-periodic. Parameters ---------- x : array-like Array of points at which the original function has been evaluated. y : array-like Values of the functio... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Wrap:
"""Wrap functions."""
def __init__(self, x, y, p):
"""Initialises class to wrap the function with values y at x so that it is p-periodic. Parameters ---------- x : array-like Array of points at which the original function has been evaluated. y : array-like Values of the function at points x... | the_stack_v2_python_sparse | maths.py | interesting-codes/active_particles | train | 0 |
e4715605ab6de7acba601bddfbb0111395d30023 | [
"self._annot_table.itemSelectionChanged.connect(self._fcn_annot_goto)\nself._annot_table.cellChanged.connect(self._fcn_text_edited)\nself._annot_txtsz.valueChanged.connect(self._fcn_annot_appear)\nself._annot_marksz.valueChanged.connect(self._fcn_annot_appear)\nself._annot_color.editingFinished.connect(self._fcn_an... | <|body_start_0|>
self._annot_table.itemSelectionChanged.connect(self._fcn_annot_goto)
self._annot_table.cellChanged.connect(self._fcn_text_edited)
self._annot_txtsz.valueChanged.connect(self._fcn_annot_appear)
self._annot_marksz.valueChanged.connect(self._fcn_annot_appear)
self._... | Annotations interactions. | UiAnnotations | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UiAnnotations:
"""Annotations interactions."""
def __init__(self):
"""Init."""
<|body_0|>
def _annotate_event(self, signal, coord, text='Enter annotation'):
"""Annotate event."""
<|body_1|>
def _fcn_annot_goto(self):
"""Select the annotation.... | stack_v2_sparse_classes_75kplus_train_067357 | 4,395 | permissive | [
{
"docstring": "Init.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Annotate event.",
"name": "_annotate_event",
"signature": "def _annotate_event(self, signal, coord, text='Enter annotation')"
},
{
"docstring": "Select the annotation.",
"name": "... | 6 | stack_v2_sparse_classes_30k_train_046737 | Implement the Python class `UiAnnotations` described below.
Class description:
Annotations interactions.
Method signatures and docstrings:
- def __init__(self): Init.
- def _annotate_event(self, signal, coord, text='Enter annotation'): Annotate event.
- def _fcn_annot_goto(self): Select the annotation.
- def _fcn_tex... | Implement the Python class `UiAnnotations` described below.
Class description:
Annotations interactions.
Method signatures and docstrings:
- def __init__(self): Init.
- def _annotate_event(self, signal, coord, text='Enter annotation'): Annotate event.
- def _fcn_annot_goto(self): Select the annotation.
- def _fcn_tex... | be096aa8a7058c329e7120d0bdb45d3c9eb8be42 | <|skeleton|>
class UiAnnotations:
"""Annotations interactions."""
def __init__(self):
"""Init."""
<|body_0|>
def _annotate_event(self, signal, coord, text='Enter annotation'):
"""Annotate event."""
<|body_1|>
def _fcn_annot_goto(self):
"""Select the annotation.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UiAnnotations:
"""Annotations interactions."""
def __init__(self):
"""Init."""
self._annot_table.itemSelectionChanged.connect(self._fcn_annot_goto)
self._annot_table.cellChanged.connect(self._fcn_text_edited)
self._annot_txtsz.valueChanged.connect(self._fcn_annot_appear)
... | the_stack_v2_python_sparse | visbrain/gui/signal/ui_elements/ui_annotations.py | lassemadsen/visbrain | train | 0 |
6885ac941ce9abbcd8b80a2e78a7107c1a11e52b | [
"self.routerGraph = routerGraph\nself.routerNum = len(routerGraph)\nself.routerTables = [RouterTable() for i in range(self.routerNum)]\nfor i in initTable:\n self.routerTables[int(i[0])].addInitTable(i[1])",
"for i in range(self.routerNum):\n for j in range(self.routerNum):\n if int(self.routerGraph[... | <|body_start_0|>
self.routerGraph = routerGraph
self.routerNum = len(routerGraph)
self.routerTables = [RouterTable() for i in range(self.routerNum)]
for i in initTable:
self.routerTables[int(i[0])].addInitTable(i[1])
<|end_body_0|>
<|body_start_1|>
for i in range(sel... | RIP类 | RIP | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RIP:
"""RIP类"""
def __init__(self, routerGraph, initTable):
"""RIP初始化"""
<|body_0|>
def update(self):
"""运行一次RIP,更新所有路由表"""
<|body_1|>
def printTables(self):
"""打印所有路由表"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
self.ro... | stack_v2_sparse_classes_75kplus_train_067358 | 4,188 | permissive | [
{
"docstring": "RIP初始化",
"name": "__init__",
"signature": "def __init__(self, routerGraph, initTable)"
},
{
"docstring": "运行一次RIP,更新所有路由表",
"name": "update",
"signature": "def update(self)"
},
{
"docstring": "打印所有路由表",
"name": "printTables",
"signature": "def printTables(... | 3 | stack_v2_sparse_classes_30k_train_013878 | Implement the Python class `RIP` described below.
Class description:
RIP类
Method signatures and docstrings:
- def __init__(self, routerGraph, initTable): RIP初始化
- def update(self): 运行一次RIP,更新所有路由表
- def printTables(self): 打印所有路由表 | Implement the Python class `RIP` described below.
Class description:
RIP类
Method signatures and docstrings:
- def __init__(self, routerGraph, initTable): RIP初始化
- def update(self): 运行一次RIP,更新所有路由表
- def printTables(self): 打印所有路由表
<|skeleton|>
class RIP:
"""RIP类"""
def __init__(self, routerGraph, initTable):... | 8eba20b6b8c43d4eee0af4b0ebca68d708f27aa9 | <|skeleton|>
class RIP:
"""RIP类"""
def __init__(self, routerGraph, initTable):
"""RIP初始化"""
<|body_0|>
def update(self):
"""运行一次RIP,更新所有路由表"""
<|body_1|>
def printTables(self):
"""打印所有路由表"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RIP:
"""RIP类"""
def __init__(self, routerGraph, initTable):
"""RIP初始化"""
self.routerGraph = routerGraph
self.routerNum = len(routerGraph)
self.routerTables = [RouterTable() for i in range(self.routerNum)]
for i in initTable:
self.routerTables[int(i[0])]... | the_stack_v2_python_sparse | 3ComputerNetwork/RIP.py | intLyc/Undergraduate-Courses | train | 0 |
e29c800a6d75abe9a10d8fe442937273279105e8 | [
"if root == None:\n return '$'\nreturn str(root.val) + ',' + self.serialize(root.left) + ',' + self.serialize(root.right)",
"nodes = data.split(',')\nself.i = 0\n\ndef dfs():\n if self.i == len(nodes) or nodes[self.i] == '$':\n self.i += 1\n return None\n root = TreeNode(int(nodes[self.i]))... | <|body_start_0|>
if root == None:
return '$'
return str(root.val) + ',' + self.serialize(root.left) + ',' + self.serialize(root.right)
<|end_body_0|>
<|body_start_1|>
nodes = data.split(',')
self.i = 0
def dfs():
if self.i == len(nodes) or nodes[self.i] ... | 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_067359 | 2,839 | 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_028020 | 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:... | d2037e521a3ee6fdcc14fd5228ea1fd32d57d637 | <|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"""
if root == None:
return '$'
return str(root.val) + ',' + self.serialize(root.left) + ',' + self.serialize(root.right)
def deserialize(self, data):
"""Dec... | the_stack_v2_python_sparse | monthlyChallenge/2020-10(octoberchallenge)/10_09_SerializeAndDeserializeBST.py | phu-n-tran/LeetCode | train | 2 | |
c982941bc595011a7459503a0421ae66287b6c6f | [
"self.id: Union[str, None] = id\nself.parent: Union['Tag', None] = parent\nself.parameter: Union[str, None] = parameter\nif children is None:\n self.children: List[Union[str, 'Tag']] = []",
"if self.children:\n if isinstance(self.children[-1], Tag):\n self.children.append(text)\n else:\n se... | <|body_start_0|>
self.id: Union[str, None] = id
self.parent: Union['Tag', None] = parent
self.parameter: Union[str, None] = parameter
if children is None:
self.children: List[Union[str, 'Tag']] = []
<|end_body_0|>
<|body_start_1|>
if self.children:
if isi... | Represents a tag in PoE texts. For example: <size:45>{I have <item>{My item} for sale} tag.id = 'size' tag.parent = None tag.children = ['I have ', <Tag object>, ' for sale'] tag.parameter = '45' Parameters ---------- id identifier string of the tag parent parent Tag instance if any children list of child strings or ta... | Tag | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Tag:
"""Represents a tag in PoE texts. For example: <size:45>{I have <item>{My item} for sale} tag.id = 'size' tag.parent = None tag.children = ['I have ', <Tag object>, ' for sale'] tag.parameter = '45' Parameters ---------- id identifier string of the tag parent parent Tag instance if any child... | stack_v2_sparse_classes_75kplus_train_067360 | 7,546 | permissive | [
{
"docstring": "Parameters ---------- id identifier string of the tag parent parent Tag instance if any children list of child strings or tag instances parameter parameter specified in the text to this tag if any",
"name": "__init__",
"signature": "def __init__(self, id: Union[str, None]=None, parent: U... | 4 | stack_v2_sparse_classes_30k_train_030462 | Implement the Python class `Tag` described below.
Class description:
Represents a tag in PoE texts. For example: <size:45>{I have <item>{My item} for sale} tag.id = 'size' tag.parent = None tag.children = ['I have ', <Tag object>, ' for sale'] tag.parameter = '45' Parameters ---------- id identifier string of the tag ... | Implement the Python class `Tag` described below.
Class description:
Represents a tag in PoE texts. For example: <size:45>{I have <item>{My item} for sale} tag.id = 'size' tag.parent = None tag.children = ['I have ', <Tag object>, ' for sale'] tag.parameter = '45' Parameters ---------- id identifier string of the tag ... | 7b3ddc8dc310c580c3e75c4835389c1204936206 | <|skeleton|>
class Tag:
"""Represents a tag in PoE texts. For example: <size:45>{I have <item>{My item} for sale} tag.id = 'size' tag.parent = None tag.children = ['I have ', <Tag object>, ' for sale'] tag.parameter = '45' Parameters ---------- id identifier string of the tag parent parent Tag instance if any child... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Tag:
"""Represents a tag in PoE texts. For example: <size:45>{I have <item>{My item} for sale} tag.id = 'size' tag.parent = None tag.children = ['I have ', <Tag object>, ' for sale'] tag.parameter = '45' Parameters ---------- id identifier string of the tag parent parent Tag instance if any children list of c... | the_stack_v2_python_sparse | third-party/PyPoE/PyPoE/poe/text.py | erosson/pypoe-json | train | 1 |
bd584b25c81d8646bb09cd59b265b0f4bf5d1c30 | [
"url = f'{HOST}/api/loginS'\nin_data['password'] = self.get_md5(in_data['password'])\npayload = in_data\nresponse = requests.post(url, json=payload)\nif mode:\n return ''.join(jsonpath(response.json(), '$..token'))\nelse:\n return response.json()",
"md5 = hashlib.md5()\nmd5.update(psw.encode('utf-8'))\nretu... | <|body_start_0|>
url = f'{HOST}/api/loginS'
in_data['password'] = self.get_md5(in_data['password'])
payload = in_data
response = requests.post(url, json=payload)
if mode:
return ''.join(jsonpath(response.json(), '$..token'))
else:
return response.j... | Login | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Login:
def login(self, in_data, mode=True):
"""登陆方法 :return:返回响应体字典"""
<|body_0|>
def get_md5(self, psw):
"""md5加密 :param psw: :return: 返回MD5加密值"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
url = f'{HOST}/api/loginS'
in_data['password'] =... | stack_v2_sparse_classes_75kplus_train_067361 | 1,515 | no_license | [
{
"docstring": "登陆方法 :return:返回响应体字典",
"name": "login",
"signature": "def login(self, in_data, mode=True)"
},
{
"docstring": "md5加密 :param psw: :return: 返回MD5加密值",
"name": "get_md5",
"signature": "def get_md5(self, psw)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015834 | Implement the Python class `Login` described below.
Class description:
Implement the Login class.
Method signatures and docstrings:
- def login(self, in_data, mode=True): 登陆方法 :return:返回响应体字典
- def get_md5(self, psw): md5加密 :param psw: :return: 返回MD5加密值 | Implement the Python class `Login` described below.
Class description:
Implement the Login class.
Method signatures and docstrings:
- def login(self, in_data, mode=True): 登陆方法 :return:返回响应体字典
- def get_md5(self, psw): md5加密 :param psw: :return: 返回MD5加密值
<|skeleton|>
class Login:
def login(self, in_data, mode=Tr... | 0346bb952823f3cd4c8c383115f2a617f39f7cce | <|skeleton|>
class Login:
def login(self, in_data, mode=True):
"""登陆方法 :return:返回响应体字典"""
<|body_0|>
def get_md5(self, psw):
"""md5加密 :param psw: :return: 返回MD5加密值"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Login:
def login(self, in_data, mode=True):
"""登陆方法 :return:返回响应体字典"""
url = f'{HOST}/api/loginS'
in_data['password'] = self.get_md5(in_data['password'])
payload = in_data
response = requests.post(url, json=payload)
if mode:
return ''.join(jsonpath(r... | the_stack_v2_python_sparse | 在线考试系统测试/libs/login.py | 01xu10/myproject | train | 0 | |
36563b6a4a858523b669b6425d950011f0cf7f99 | [
"self.n_total_spc = n_total_spc\nself.hdr_note = hdr_note\nself.uncrt = uncrt\nself.spc_idx = spc_idx\nself.t = t\nself.hr = hr\nself.x = x\nself.y = y\nself.z = z\nself.obs = obs",
"f = open(inputdat_fname, 'r')\nn_obs, n_total_spc = [int(i) for i in f.readline().strip().split()]\nhdr_note = f.readline().strip()... | <|body_start_0|>
self.n_total_spc = n_total_spc
self.hdr_note = hdr_note
self.uncrt = uncrt
self.spc_idx = spc_idx
self.t = t
self.hr = hr
self.x = x
self.y = y
self.z = z
self.obs = obs
<|end_body_0|>
<|body_start_1|>
f = open(inp... | Container class to hold the information needed to write a STEM input.dat file: species concentration observations and accompanying hour and x, y, and z indices. Currently only supports one species. | STEMInputDat | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class STEMInputDat:
"""Container class to hold the information needed to write a STEM input.dat file: species concentration observations and accompanying hour and x, y, and z indices. Currently only supports one species."""
def __init__(self, hr=None, t=None, x=None, y=None, z=None, obs=None, n_to... | stack_v2_sparse_classes_75kplus_train_067362 | 8,976 | permissive | [
{
"docstring": "Class constructor. PARAMETERS ---------- x, y, z: N-element np.ndarray: x, y, z indices of the observations t: N-element np.ndarray; STEM timestep of the observations hr: N-element np.ndarray; hour of model run corresponding to observations obs: N by n_total_spc np.ndarray; columns species conce... | 4 | stack_v2_sparse_classes_30k_val_001319 | Implement the Python class `STEMInputDat` described below.
Class description:
Container class to hold the information needed to write a STEM input.dat file: species concentration observations and accompanying hour and x, y, and z indices. Currently only supports one species.
Method signatures and docstrings:
- def __... | Implement the Python class `STEMInputDat` described below.
Class description:
Container class to hold the information needed to write a STEM input.dat file: species concentration observations and accompanying hour and x, y, and z indices. Currently only supports one species.
Method signatures and docstrings:
- def __... | 17fbabb7206e0a80d9e2d01c6535ac718fcddbb2 | <|skeleton|>
class STEMInputDat:
"""Container class to hold the information needed to write a STEM input.dat file: species concentration observations and accompanying hour and x, y, and z indices. Currently only supports one species."""
def __init__(self, hr=None, t=None, x=None, y=None, z=None, obs=None, n_to... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class STEMInputDat:
"""Container class to hold the information needed to write a STEM input.dat file: species concentration observations and accompanying hour and x, y, and z indices. Currently only supports one species."""
def __init__(self, hr=None, t=None, x=None, y=None, z=None, obs=None, n_total_spc=1, hd... | the_stack_v2_python_sparse | stem_pytools/inputdattools.py | Timothy-W-Hilton/STEMPyTools | train | 1 |
860c6fa3102d6a5afca1f901ee9ed69c36cad7a7 | [
"if method == 'deeplearning':\n nltkInitialize(dataSettings['datasets']['nltk_sources'])\n ' \\n\\t\\t\\tLoads model runners according to the selected DL model (defined in settings.ini)\\n\\t\\t\\t'\n if dataSettings['DLmodel']['model'] == 'biowordvec_bilstm':\n from models.Embedding_BiLstmCRF.model... | <|body_start_0|>
if method == 'deeplearning':
nltkInitialize(dataSettings['datasets']['nltk_sources'])
' \n\t\t\tLoads model runners according to the selected DL model (defined in settings.ini)\n\t\t\t'
if dataSettings['DLmodel']['model'] == 'biowordvec_bilstm':
... | Orchestrator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Orchestrator:
def processTask1(files, XMLAnnotations, dictionaries, dataSettings, method=None, show=False):
"""Method to handle with task 1 . :param files: dictionary containing the clinical reports (key: filename) :.... returns tuple(dictionary containing family members (key: filename, ... | stack_v2_sparse_classes_75kplus_train_067363 | 4,860 | permissive | [
{
"docstring": "Method to handle with task 1 . :param files: dictionary containing the clinical reports (key: filename) :.... returns tuple(dictionary containing family members (key: filename, value: list of tuples ((fm, fs), sentence), dictionary containing observations (key: filename, value: list of tuples (o... | 3 | stack_v2_sparse_classes_30k_train_051781 | Implement the Python class `Orchestrator` described below.
Class description:
Implement the Orchestrator class.
Method signatures and docstrings:
- def processTask1(files, XMLAnnotations, dictionaries, dataSettings, method=None, show=False): Method to handle with task 1 . :param files: dictionary containing the clini... | Implement the Python class `Orchestrator` described below.
Class description:
Implement the Orchestrator class.
Method signatures and docstrings:
- def processTask1(files, XMLAnnotations, dictionaries, dataSettings, method=None, show=False): Method to handle with task 1 . :param files: dictionary containing the clini... | 0c03d587eb2cf2d26e7834ff879f9c0131f2d5ac | <|skeleton|>
class Orchestrator:
def processTask1(files, XMLAnnotations, dictionaries, dataSettings, method=None, show=False):
"""Method to handle with task 1 . :param files: dictionary containing the clinical reports (key: filename) :.... returns tuple(dictionary containing family members (key: filename, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Orchestrator:
def processTask1(files, XMLAnnotations, dictionaries, dataSettings, method=None, show=False):
"""Method to handle with task 1 . :param files: dictionary containing the clinical reports (key: filename) :.... returns tuple(dictionary containing family members (key: filename, value: list of... | the_stack_v2_python_sparse | src/Orchestrator.py | odnodn/PatientFM | train | 0 | |
1100d6812a3eff07fe5fc24d554804c8f02dc2fc | [
"if not x:\n return 0\nif x < 0:\n s = -1\nelse:\n s = 1\nx *= s\np = 0\nwhile x:\n x, r = divmod(x, 10)\n if p > self.max_limit(r, s):\n return 0\n else:\n p = p * 10 + r\nreturn s * p",
"if s > 0:\n return (2 ** 31 - 1 - r) // 10\nelse:\n return (2 ** 31 - r) // 10"
] | <|body_start_0|>
if not x:
return 0
if x < 0:
s = -1
else:
s = 1
x *= s
p = 0
while x:
x, r = divmod(x, 10)
if p > self.max_limit(r, s):
return 0
else:
p = p * 10 + r
... | Iterative evaluation of all digits in input integer. Time complexity: O(n) - Iterate over all digits in input integer Space complexity: O(1) - Update constant pointers | Solution | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Iterative evaluation of all digits in input integer. Time complexity: O(n) - Iterate over all digits in input integer Space complexity: O(1) - Update constant pointers"""
def reverse_int(self, x):
"""Reverses integer digits if output integer below system integer limits. ... | stack_v2_sparse_classes_75kplus_train_067364 | 2,231 | permissive | [
{
"docstring": "Reverses integer digits if output integer below system integer limits. :param int x: input signed integer to be reversed :return: signed integer with reversed digits :rtype: int",
"name": "reverse_int",
"signature": "def reverse_int(self, x)"
},
{
"docstring": "Determines maximum... | 2 | stack_v2_sparse_classes_30k_train_027147 | Implement the Python class `Solution` described below.
Class description:
Iterative evaluation of all digits in input integer. Time complexity: O(n) - Iterate over all digits in input integer Space complexity: O(1) - Update constant pointers
Method signatures and docstrings:
- def reverse_int(self, x): Reverses integ... | Implement the Python class `Solution` described below.
Class description:
Iterative evaluation of all digits in input integer. Time complexity: O(n) - Iterate over all digits in input integer Space complexity: O(1) - Update constant pointers
Method signatures and docstrings:
- def reverse_int(self, x): Reverses integ... | 69f90877c5466927e8b081c4268cbcda074813ec | <|skeleton|>
class Solution:
"""Iterative evaluation of all digits in input integer. Time complexity: O(n) - Iterate over all digits in input integer Space complexity: O(1) - Update constant pointers"""
def reverse_int(self, x):
"""Reverses integer digits if output integer below system integer limits. ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
"""Iterative evaluation of all digits in input integer. Time complexity: O(n) - Iterate over all digits in input integer Space complexity: O(1) - Update constant pointers"""
def reverse_int(self, x):
"""Reverses integer digits if output integer below system integer limits. :param int x:... | the_stack_v2_python_sparse | 0007_reverse_integer/python_source.py | arthurdysart/LeetCode | train | 0 |
0983b5ad2a06663f2ec3763ea09f3581fe003e2b | [
"if n == 2 or n == 3:\n return True\nif n % 6 != 1 and n % 6 != 5:\n return False\nsqrt_n = int(math.sqrt(n)) + 1\nindex = 5\nwhile index < sqrt_n:\n if n % index == 0 or n % (index + 2) == 0:\n return False\n index += 6\nreturn True",
"sqrt_n = int(math.sqrt(n)) + 1\nfor i in range(2, sqrt_n):... | <|body_start_0|>
if n == 2 or n == 3:
return True
if n % 6 != 1 and n % 6 != 5:
return False
sqrt_n = int(math.sqrt(n)) + 1
index = 5
while index < sqrt_n:
if n % index == 0 or n % (index + 2) == 0:
return False
inde... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _is_prime_bad2(self, n):
"""# Better than _is_prime_bad1 but still bad. # Reference: [判断一个数是否为质数/素数——从普通判断算法到高效判断算法思路](blog.csdn.net/huang_miao_xin/article/details/51331710) 令x≥1,将大于等于5的自然数表示如下: 6x-1, 6x, 6x+1, 6x+2, 6x+3, 6x+4, 6x+5, 6(x+1), 6(x+1)+1 ··· 可以看到,不在6的倍数两侧,即6x两... | stack_v2_sparse_classes_75kplus_train_067365 | 2,539 | no_license | [
{
"docstring": "# Better than _is_prime_bad1 but still bad. # Reference: [判断一个数是否为质数/素数——从普通判断算法到高效判断算法思路](blog.csdn.net/huang_miao_xin/article/details/51331710) 令x≥1,将大于等于5的自然数表示如下: 6x-1, 6x, 6x+1, 6x+2, 6x+3, 6x+4, 6x+5, 6(x+1), 6(x+1)+1 ··· 可以看到,不在6的倍数两侧,即6x两侧的数为6x+2,6x+3,6x+4,由于2(3x+1),3(2x+1),2(3x+2),所以它们一... | 4 | stack_v2_sparse_classes_30k_train_024844 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _is_prime_bad2(self, n): # Better than _is_prime_bad1 but still bad. # Reference: [判断一个数是否为质数/素数——从普通判断算法到高效判断算法思路](blog.csdn.net/huang_miao_xin/article/details/51331710) 令x≥... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _is_prime_bad2(self, n): # Better than _is_prime_bad1 but still bad. # Reference: [判断一个数是否为质数/素数——从普通判断算法到高效判断算法思路](blog.csdn.net/huang_miao_xin/article/details/51331710) 令x≥... | 3c9e54680cefd51c8f56fa12eb27276787de3a2a | <|skeleton|>
class Solution:
def _is_prime_bad2(self, n):
"""# Better than _is_prime_bad1 but still bad. # Reference: [判断一个数是否为质数/素数——从普通判断算法到高效判断算法思路](blog.csdn.net/huang_miao_xin/article/details/51331710) 令x≥1,将大于等于5的自然数表示如下: 6x-1, 6x, 6x+1, 6x+2, 6x+3, 6x+4, 6x+5, 6(x+1), 6(x+1)+1 ··· 可以看到,不在6的倍数两侧,即6x两... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def _is_prime_bad2(self, n):
"""# Better than _is_prime_bad1 but still bad. # Reference: [判断一个数是否为质数/素数——从普通判断算法到高效判断算法思路](blog.csdn.net/huang_miao_xin/article/details/51331710) 令x≥1,将大于等于5的自然数表示如下: 6x-1, 6x, 6x+1, 6x+2, 6x+3, 6x+4, 6x+5, 6(x+1), 6(x+1)+1 ··· 可以看到,不在6的倍数两侧,即6x两侧的数为6x+2,6x+3,... | the_stack_v2_python_sparse | lxw/num204/num204.py | We-Hack/LeetCode | train | 3 | |
420bb3c8513877f7873150572d27f129f341ab39 | [
"super(GamePlayer, self).__init__('Canvas Player', image, x, y, **kwargs)\nself.vx = 0\nself.vy = 0\nself.speed = 5",
"self.x += self.vx\nself.y += self.vy\nresult, _ = self.gparent.can_move_to(self)\nif not result:\n self.x -= self.vx\n self.y -= self.vy",
"key_pressed = pygame.key.get_pressed()\nif key_... | <|body_start_0|>
super(GamePlayer, self).__init__('Canvas Player', image, x, y, **kwargs)
self.vx = 0
self.vy = 0
self.speed = 5
<|end_body_0|>
<|body_start_1|>
self.x += self.vx
self.y += self.vy
result, _ = self.gparent.can_move_to(self)
if not result:
... | GamePlayer class implements the game player image for the game. | GamePlayer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GamePlayer:
"""GamePlayer class implements the game player image for the game."""
def __init__(self, image, x, y, **kwargs):
"""__init__ initializes GamePlayer instance. Args: image (Image): GamePlayer instance image to be used. x (int): GamePlayer instance initial X-axis position. y... | stack_v2_sparse_classes_75kplus_train_067366 | 2,298 | no_license | [
{
"docstring": "__init__ initializes GamePlayer instance. Args: image (Image): GamePlayer instance image to be used. x (int): GamePlayer instance initial X-axis position. y (int): GamePlayer instance initial Y-axis position. **kwargs (dict): GamePlayer dictionary with custom arguments.",
"name": "__init__",... | 3 | stack_v2_sparse_classes_30k_train_042294 | Implement the Python class `GamePlayer` described below.
Class description:
GamePlayer class implements the game player image for the game.
Method signatures and docstrings:
- def __init__(self, image, x, y, **kwargs): __init__ initializes GamePlayer instance. Args: image (Image): GamePlayer instance image to be used... | Implement the Python class `GamePlayer` described below.
Class description:
GamePlayer class implements the game player image for the game.
Method signatures and docstrings:
- def __init__(self, image, x, y, **kwargs): __init__ initializes GamePlayer instance. Args: image (Image): GamePlayer instance image to be used... | e5de88a0053b2690230c04d7c9183d619ece32cf | <|skeleton|>
class GamePlayer:
"""GamePlayer class implements the game player image for the game."""
def __init__(self, image, x, y, **kwargs):
"""__init__ initializes GamePlayer instance. Args: image (Image): GamePlayer instance image to be used. x (int): GamePlayer instance initial X-axis position. y... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GamePlayer:
"""GamePlayer class implements the game player image for the game."""
def __init__(self, image, x, y, **kwargs):
"""__init__ initializes GamePlayer instance. Args: image (Image): GamePlayer instance image to be used. x (int): GamePlayer instance initial X-axis position. y (int): GameP... | the_stack_v2_python_sparse | apps/canvas/_game_player.py | jrecuero/pyengine | train | 1 |
74979e1e8793f43899afbb5ae6a5d64aeed8dd09 | [
"url = 'os-services'\nif params:\n url += '?%s' % urllib.urlencode(params)\nresp, body = self.get(url)\nbody = json.loads(body)\nschema = self.get_schema(self.schema_versions_info)\nself.validate_response(schema.list_services, resp, body)\nreturn rest_client.ResponseBody(resp, body)",
"put_body = json.dumps(kw... | <|body_start_0|>
url = 'os-services'
if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
body = json.loads(body)
schema = self.get_schema(self.schema_versions_info)
self.validate_response(schema.list_services, resp, body)
retu... | Client class to send CRUD Volume Services API requests | ServicesClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServicesClient:
"""Client class to send CRUD Volume Services API requests"""
def list_services(self, **params):
"""List all Cinder services. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-... | stack_v2_sparse_classes_75kplus_train_067367 | 4,477 | permissive | [
{
"docstring": "List all Cinder services. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-cinder-services",
"name": "list_services",
"signature": "def list_services(self, **params)"
},
{
"docstring... | 6 | stack_v2_sparse_classes_30k_train_042879 | Implement the Python class `ServicesClient` described below.
Class description:
Client class to send CRUD Volume Services API requests
Method signatures and docstrings:
- def list_services(self, **params): List all Cinder services. For a full list of available parameters, please refer to the official API reference: h... | Implement the Python class `ServicesClient` described below.
Class description:
Client class to send CRUD Volume Services API requests
Method signatures and docstrings:
- def list_services(self, **params): List all Cinder services. For a full list of available parameters, please refer to the official API reference: h... | 3932a799e620a20d7abf7b89e21b520683a1809b | <|skeleton|>
class ServicesClient:
"""Client class to send CRUD Volume Services API requests"""
def list_services(self, **params):
"""List all Cinder services. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ServicesClient:
"""Client class to send CRUD Volume Services API requests"""
def list_services(self, **params):
"""List all Cinder services. For a full list of available parameters, please refer to the official API reference: https://docs.openstack.org/api-ref/block-storage/v3/#list-all-cinder-se... | the_stack_v2_python_sparse | tempest/lib/services/volume/v3/services_client.py | openstack/tempest | train | 270 |
9540a6cd433e360e38b03efcf032b07d58e678f9 | [
"processed_dict = {}\nfor key, value in request.GET.items():\n processed_dict[key] = value\nsign = processed_dict.pop('sign', None)\nalipay = AliPay(appid='2016092600599306', app_notify_url='http://47.98.34.221:8888/api/alipay/return', app_private_key_path=PRIVATE_KEY_PATH, alipay_public_key_path=ALIPAY_KEY_PATH... | <|body_start_0|>
processed_dict = {}
for key, value in request.GET.items():
processed_dict[key] = value
sign = processed_dict.pop('sign', None)
alipay = AliPay(appid='2016092600599306', app_notify_url='http://47.98.34.221:8888/api/alipay/return', app_private_key_path=PRIVATE_... | 支付宝请求回调视图 return_url: 同步通知 url 支付完成之后,支付宝将传入的return_url 通过get请求 app_notify_url: 异步通知 url 通过post方式请求 | AliPayView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AliPayView:
"""支付宝请求回调视图 return_url: 同步通知 url 支付完成之后,支付宝将传入的return_url 通过get请求 app_notify_url: 异步通知 url 通过post方式请求"""
def get(self, request):
"""处理支付宝的url返回"""
<|body_0|>
def post(selfs, request):
"""处理notify_url"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_75kplus_train_067368 | 6,458 | no_license | [
{
"docstring": "处理支付宝的url返回",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "处理notify_url",
"name": "post",
"signature": "def post(selfs, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014114 | Implement the Python class `AliPayView` described below.
Class description:
支付宝请求回调视图 return_url: 同步通知 url 支付完成之后,支付宝将传入的return_url 通过get请求 app_notify_url: 异步通知 url 通过post方式请求
Method signatures and docstrings:
- def get(self, request): 处理支付宝的url返回
- def post(selfs, request): 处理notify_url | Implement the Python class `AliPayView` described below.
Class description:
支付宝请求回调视图 return_url: 同步通知 url 支付完成之后,支付宝将传入的return_url 通过get请求 app_notify_url: 异步通知 url 通过post方式请求
Method signatures and docstrings:
- def get(self, request): 处理支付宝的url返回
- def post(selfs, request): 处理notify_url
<|skeleton|>
class AliPayVie... | 8414da97036aef52c96ae42e6e760bbbc6f64c05 | <|skeleton|>
class AliPayView:
"""支付宝请求回调视图 return_url: 同步通知 url 支付完成之后,支付宝将传入的return_url 通过get请求 app_notify_url: 异步通知 url 通过post方式请求"""
def get(self, request):
"""处理支付宝的url返回"""
<|body_0|>
def post(selfs, request):
"""处理notify_url"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AliPayView:
"""支付宝请求回调视图 return_url: 同步通知 url 支付完成之后,支付宝将传入的return_url 通过get请求 app_notify_url: 异步通知 url 通过post方式请求"""
def get(self, request):
"""处理支付宝的url返回"""
processed_dict = {}
for key, value in request.GET.items():
processed_dict[key] = value
sign = process... | the_stack_v2_python_sparse | apps/trade/views.py | lize240810/Shop | train | 0 |
390944960f14040ac00140fac6410bc9e089d0df | [
"nenv = 2\nenv = make_env(nenv)\ns = env.observation_space.shape\nenv = VecFrameStack(env, 4)\nob = env.reset()\nassert ob.shape == (nenv, 4 * s[0], s[1], s[2])\nob, _, _, _ = env.step(np.array([env.action_space.sample() for _ in range(nenv)]))\nassert ob.shape == (nenv, 4 * s[0], s[1], s[2])\nwhile True:\n ob, ... | <|body_start_0|>
nenv = 2
env = make_env(nenv)
s = env.observation_space.shape
env = VecFrameStack(env, 4)
ob = env.reset()
assert ob.shape == (nenv, 4 * s[0], s[1], s[2])
ob, _, _, _ = env.step(np.array([env.action_space.sample() for _ in range(nenv)]))
a... | Test. | Test | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test:
"""Test."""
def test_vec_frame_stack(self):
"""Test vec frame stack wrapper."""
<|body_0|>
def test_nested_vec_frame_stack(self):
"""Test vec frame stack wrapper."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nenv = 2
env = make_... | stack_v2_sparse_classes_75kplus_train_067369 | 6,508 | no_license | [
{
"docstring": "Test vec frame stack wrapper.",
"name": "test_vec_frame_stack",
"signature": "def test_vec_frame_stack(self)"
},
{
"docstring": "Test vec frame stack wrapper.",
"name": "test_nested_vec_frame_stack",
"signature": "def test_nested_vec_frame_stack(self)"
}
] | 2 | null | Implement the Python class `Test` described below.
Class description:
Test.
Method signatures and docstrings:
- def test_vec_frame_stack(self): Test vec frame stack wrapper.
- def test_nested_vec_frame_stack(self): Test vec frame stack wrapper. | Implement the Python class `Test` described below.
Class description:
Test.
Method signatures and docstrings:
- def test_vec_frame_stack(self): Test vec frame stack wrapper.
- def test_nested_vec_frame_stack(self): Test vec frame stack wrapper.
<|skeleton|>
class Test:
"""Test."""
def test_vec_frame_stack(s... | e71c4b12955b01bfb907aa31c91ded6bcd8aaec8 | <|skeleton|>
class Test:
"""Test."""
def test_vec_frame_stack(self):
"""Test vec frame stack wrapper."""
<|body_0|>
def test_nested_vec_frame_stack(self):
"""Test vec frame stack wrapper."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Test:
"""Test."""
def test_vec_frame_stack(self):
"""Test vec frame stack wrapper."""
nenv = 2
env = make_env(nenv)
s = env.observation_space.shape
env = VecFrameStack(env, 4)
ob = env.reset()
assert ob.shape == (nenv, 4 * s[0], s[1], s[2])
... | the_stack_v2_python_sparse | dl/rl/envs/frame_stack_wrappers.py | cbschaff/dl | train | 1 |
b39da0e56a40efc8e9c46f4f5a3ee64a66af14ac | [
"super(Transformer, self).__init__()\nself.model = model\nself.max_sequence_length = max_sequence_length\nself.embedder = embedder\nself.max_generated_question_length = tf.constant(max_generated_question_length, dtype=tf.int32)\nself.beam_search_size = beam_search_size\nself.pretrained_weights_name = self.embedder.... | <|body_start_0|>
super(Transformer, self).__init__()
self.model = model
self.max_sequence_length = max_sequence_length
self.embedder = embedder
self.max_generated_question_length = tf.constant(max_generated_question_length, dtype=tf.int32)
self.beam_search_size = beam_sea... | Transformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transformer:
def __init__(self, embedder, model, max_sequence_length, max_generated_question_length=40, beam_search_size=3, hidden_state_size=768, **kwargs):
""":param max_generated_question_length: Limits the length of the generated questions to avoid infinite loops or lengthy questions... | stack_v2_sparse_classes_75kplus_train_067370 | 7,849 | no_license | [
{
"docstring": ":param max_generated_question_length: Limits the length of the generated questions to avoid infinite loops or lengthy questions. :param max_sequence_length: Maximum length of any generated question. :param beam_search_size: Number of beams to keep in memory during beach search. :param hidden_sta... | 4 | null | Implement the Python class `Transformer` described below.
Class description:
Implement the Transformer class.
Method signatures and docstrings:
- def __init__(self, embedder, model, max_sequence_length, max_generated_question_length=40, beam_search_size=3, hidden_state_size=768, **kwargs): :param max_generated_questi... | Implement the Python class `Transformer` described below.
Class description:
Implement the Transformer class.
Method signatures and docstrings:
- def __init__(self, embedder, model, max_sequence_length, max_generated_question_length=40, beam_search_size=3, hidden_state_size=768, **kwargs): :param max_generated_questi... | d67cacb158b2538aa702a1302196883681f0677e | <|skeleton|>
class Transformer:
def __init__(self, embedder, model, max_sequence_length, max_generated_question_length=40, beam_search_size=3, hidden_state_size=768, **kwargs):
""":param max_generated_question_length: Limits the length of the generated questions to avoid infinite loops or lengthy questions... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Transformer:
def __init__(self, embedder, model, max_sequence_length, max_generated_question_length=40, beam_search_size=3, hidden_state_size=768, **kwargs):
""":param max_generated_question_length: Limits the length of the generated questions to avoid infinite loops or lengthy questions. :param max_s... | the_stack_v2_python_sparse | models/transformer.py | arthurdeschamps/question-generation-nus-ids | train | 5 | |
1aa222737757444b8fa8b24b45371f2d528b162b | [
"self.parent_model = parent_model\nself.nms_thresh = nms_thresh\nself.n_train_pre_nms = n_train_pre_nms\nself.n_train_post_nms = n_train_post_nms\nself.n_test_pre_nms = n_test_pre_nms\nself.n_test_post_nms = n_test_post_nms\nself.min_size = min_size",
"if self.parent_model.training:\n n_pre_nms = self.n_train_... | <|body_start_0|>
self.parent_model = parent_model
self.nms_thresh = nms_thresh
self.n_train_pre_nms = n_train_pre_nms
self.n_train_post_nms = n_train_post_nms
self.n_test_pre_nms = n_test_pre_nms
self.n_test_post_nms = n_test_post_nms
self.min_size = min_size
<|en... | ProposalCreator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProposalCreator:
def __init__(self, parent_model, nms_thresh=0.7, n_train_pre_nms=12000, n_train_post_nms=2000, n_test_pre_nms=6000, n_test_post_nms=300, min_size=16):
""":param parent_model: 区分是training_model还是testing_model :param nms_thresh: 非极大值抑制的阈值 :param n_train_pre_nms: 训练时NMS之前的b... | stack_v2_sparse_classes_75kplus_train_067371 | 3,449 | no_license | [
{
"docstring": ":param parent_model: 区分是training_model还是testing_model :param nms_thresh: 非极大值抑制的阈值 :param n_train_pre_nms: 训练时NMS之前的boxes的数量 :param n_train_post_nms: 训练时NMS之后的boxes的数量 :param n_test_pre_nms: 测试时NMS之前的数量 :param n_test_post_nms: 测试时NMS之后的数量 :param min_size: 生成一个roi所需的目标的最小高度, 防止Roi pooling层切割后维度降为... | 2 | stack_v2_sparse_classes_30k_train_005768 | Implement the Python class `ProposalCreator` described below.
Class description:
Implement the ProposalCreator class.
Method signatures and docstrings:
- def __init__(self, parent_model, nms_thresh=0.7, n_train_pre_nms=12000, n_train_post_nms=2000, n_test_pre_nms=6000, n_test_post_nms=300, min_size=16): :param parent... | Implement the Python class `ProposalCreator` described below.
Class description:
Implement the ProposalCreator class.
Method signatures and docstrings:
- def __init__(self, parent_model, nms_thresh=0.7, n_train_pre_nms=12000, n_train_post_nms=2000, n_test_pre_nms=6000, n_test_post_nms=300, min_size=16): :param parent... | b4fb6ff7af6c9f906eabd836c6727ab7d9f18576 | <|skeleton|>
class ProposalCreator:
def __init__(self, parent_model, nms_thresh=0.7, n_train_pre_nms=12000, n_train_post_nms=2000, n_test_pre_nms=6000, n_test_post_nms=300, min_size=16):
""":param parent_model: 区分是training_model还是testing_model :param nms_thresh: 非极大值抑制的阈值 :param n_train_pre_nms: 训练时NMS之前的b... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ProposalCreator:
def __init__(self, parent_model, nms_thresh=0.7, n_train_pre_nms=12000, n_train_post_nms=2000, n_test_pre_nms=6000, n_test_post_nms=300, min_size=16):
""":param parent_model: 区分是training_model还是testing_model :param nms_thresh: 非极大值抑制的阈值 :param n_train_pre_nms: 训练时NMS之前的boxes的数量 :param... | the_stack_v2_python_sparse | nets/proposal_creator.py | xiguanlezz/Faster-RCNN | train | 13 | |
1e141c9febe40db1244800901f0630a4373b5aec | [
"def dfs(candidates, target, s, cur, ans):\n \"\"\"\n s (int) - starting index(of candidates) of this time of recursion\n target \n \n \"\"\"\n if target == 0:\n ans.append(cur[:])\n return\n for i in range(s, len(candidates)):\n if candidat... | <|body_start_0|>
def dfs(candidates, target, s, cur, ans):
"""
s (int) - starting index(of candidates) of this time of recursion
target
"""
if target == 0:
ans.append(cur[:])
return
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def combinationSum2Set(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]] Time O(2^n) because for n numbers, we have a take or not take option for it reference: https://www.youtube.com/watch?v=RSatA4uVBDQ also refer to below"""
... | stack_v2_sparse_classes_75kplus_train_067372 | 3,036 | no_license | [
{
"docstring": ":type candidates: List[int] :type target: int :rtype: List[List[int]] Time O(2^n) because for n numbers, we have a take or not take option for it reference: https://www.youtube.com/watch?v=RSatA4uVBDQ also refer to below",
"name": "combinationSum2Set",
"signature": "def combinationSum2Se... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum2Set(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]] Time O(2^n) because for n numbers, we have a take or not t... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combinationSum2Set(self, candidates, target): :type candidates: List[int] :type target: int :rtype: List[List[int]] Time O(2^n) because for n numbers, we have a take or not t... | 9746205998338fb4d7fd51300a21149c4181fc8f | <|skeleton|>
class Solution:
def combinationSum2Set(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]] Time O(2^n) because for n numbers, we have a take or not take option for it reference: https://www.youtube.com/watch?v=RSatA4uVBDQ also refer to below"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def combinationSum2Set(self, candidates, target):
""":type candidates: List[int] :type target: int :rtype: List[List[int]] Time O(2^n) because for n numbers, we have a take or not take option for it reference: https://www.youtube.com/watch?v=RSatA4uVBDQ also refer to below"""
def dfs... | the_stack_v2_python_sparse | leetcode/search/3_combination_sumII.py | RuizhenMai/academic-blog | train | 0 | |
f1a00f1d2ff7bddcc62e58ab02728615524cb5e5 | [
"super(DecoderLayer, self).__init__()\nself.multi_head_attention_dec = MultiHeadAttention(hidden_size, total_key_depth, total_value_depth, hidden_size, num_heads, bias_mask, attention_dropout)\nself.multi_head_attention_enc_dec = MultiHeadAttention(hidden_size, total_key_depth, total_value_depth, hidden_size, num_h... | <|body_start_0|>
super(DecoderLayer, self).__init__()
self.multi_head_attention_dec = MultiHeadAttention(hidden_size, total_key_depth, total_value_depth, hidden_size, num_heads, bias_mask, attention_dropout)
self.multi_head_attention_enc_dec = MultiHeadAttention(hidden_size, total_key_depth, tot... | Represents one Decoder layer of the Transformer Decoder Refer Fig. 1 in https://arxiv.org/pdf/1706.03762.pdf NOTE: The layer normalization step has been moved to the input as per latest version of T2T | DecoderLayer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DecoderLayer:
"""Represents one Decoder layer of the Transformer Decoder Refer Fig. 1 in https://arxiv.org/pdf/1706.03762.pdf NOTE: The layer normalization step has been moved to the input as per latest version of T2T"""
def __init__(self, hidden_size, total_key_depth, total_value_depth, fil... | stack_v2_sparse_classes_75kplus_train_067373 | 6,006 | permissive | [
{
"docstring": "Parameters: hidden_size: Hidden size total_key_depth: Size of last dimension of keys. Must be divisible by num_head total_value_depth: Size of last dimension of values. Must be divisible by num_head output_depth: Size last dimension of the final output filter_size: Hidden size of the middle laye... | 2 | stack_v2_sparse_classes_30k_train_022004 | Implement the Python class `DecoderLayer` described below.
Class description:
Represents one Decoder layer of the Transformer Decoder Refer Fig. 1 in https://arxiv.org/pdf/1706.03762.pdf NOTE: The layer normalization step has been moved to the input as per latest version of T2T
Method signatures and docstrings:
- def... | Implement the Python class `DecoderLayer` described below.
Class description:
Represents one Decoder layer of the Transformer Decoder Refer Fig. 1 in https://arxiv.org/pdf/1706.03762.pdf NOTE: The layer normalization step has been moved to the input as per latest version of T2T
Method signatures and docstrings:
- def... | 99cba1030ed8c012a453bc7715830fc99fb980dc | <|skeleton|>
class DecoderLayer:
"""Represents one Decoder layer of the Transformer Decoder Refer Fig. 1 in https://arxiv.org/pdf/1706.03762.pdf NOTE: The layer normalization step has been moved to the input as per latest version of T2T"""
def __init__(self, hidden_size, total_key_depth, total_value_depth, fil... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DecoderLayer:
"""Represents one Decoder layer of the Transformer Decoder Refer Fig. 1 in https://arxiv.org/pdf/1706.03762.pdf NOTE: The layer normalization step has been moved to the input as per latest version of T2T"""
def __init__(self, hidden_size, total_key_depth, total_value_depth, filter_size, num... | the_stack_v2_python_sparse | models/networks/transformer/layers.py | jamesoneill12/LayerFusion | train | 2 |
5159b0301198e69b3831e1e7d9e740a5defbcf32 | [
"data = base_importData()\ndata.read_csv(filename)\ndata.format_data()\nself.add_calibratorConcentrations(data.data)\ndata.clear_data()",
"data_O = []\nif met_ids_I:\n met_ids = met_ids_I\nelse:\n met_ids = []\n met_ids = self.get_metIDs_calibratorConcentrations()\nfor met_id in met_ids:\n rows = []\n... | <|body_start_0|>
data = base_importData()
data.read_csv(filename)
data.format_data()
self.add_calibratorConcentrations(data.data)
data.clear_data()
<|end_body_0|>
<|body_start_1|>
data_O = []
if met_ids_I:
met_ids = met_ids_I
else:
... | lims_calibratorsAndMixes_io | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class lims_calibratorsAndMixes_io:
def import_calibratorConcentrations_add(self, filename):
"""table adds"""
<|body_0|>
def export_calibratorConcentrations_csv(self, filename, met_ids_I=[]):
"""export calibrator concentrations"""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_75kplus_train_067374 | 1,217 | permissive | [
{
"docstring": "table adds",
"name": "import_calibratorConcentrations_add",
"signature": "def import_calibratorConcentrations_add(self, filename)"
},
{
"docstring": "export calibrator concentrations",
"name": "export_calibratorConcentrations_csv",
"signature": "def export_calibratorConce... | 2 | stack_v2_sparse_classes_30k_train_012661 | Implement the Python class `lims_calibratorsAndMixes_io` described below.
Class description:
Implement the lims_calibratorsAndMixes_io class.
Method signatures and docstrings:
- def import_calibratorConcentrations_add(self, filename): table adds
- def export_calibratorConcentrations_csv(self, filename, met_ids_I=[]):... | Implement the Python class `lims_calibratorsAndMixes_io` described below.
Class description:
Implement the lims_calibratorsAndMixes_io class.
Method signatures and docstrings:
- def import_calibratorConcentrations_add(self, filename): table adds
- def export_calibratorConcentrations_csv(self, filename, met_ids_I=[]):... | 5dfd73689674953345d523178a67b8dda10e6d47 | <|skeleton|>
class lims_calibratorsAndMixes_io:
def import_calibratorConcentrations_add(self, filename):
"""table adds"""
<|body_0|>
def export_calibratorConcentrations_csv(self, filename, met_ids_I=[]):
"""export calibrator concentrations"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class lims_calibratorsAndMixes_io:
def import_calibratorConcentrations_add(self, filename):
"""table adds"""
data = base_importData()
data.read_csv(filename)
data.format_data()
self.add_calibratorConcentrations(data.data)
data.clear_data()
def export_calibratorCo... | the_stack_v2_python_sparse | SBaaS_LIMS/lims_calibratorsAndMixes_io.py | dmccloskey/SBaaS_LIMS | train | 0 | |
d2c4ebe9a1557c9a4095737c711bf068aa5c58b2 | [
"self.min = np.array([1.0, 3.0])\nself.value = 0.0\nself.domain = np.array([[-10.0, 10.0], [-10.0, 10.0]])\nself.n = 2\nself.smooth = True\nself.info = [True, True, True]\nself.latex_name = 'Booth Function'\nself.latex_type = 'Plate-Shaped'\nself.latex_cost = '\\\\[ f(\\\\mathbf{x}) = (x_0 + 2 x_1 - 7)^2 + (2x_0 + ... | <|body_start_0|>
self.min = np.array([1.0, 3.0])
self.value = 0.0
self.domain = np.array([[-10.0, 10.0], [-10.0, 10.0]])
self.n = 2
self.smooth = True
self.info = [True, True, True]
self.latex_name = 'Booth Function'
self.latex_type = 'Plate-Shaped'
... | Booth's Function. | Booth | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Booth:
"""Booth's Function."""
def __init__(self):
"""Constructor."""
<|body_0|>
def cost(self, x):
"""Cost function."""
<|body_1|>
def grad(self, x):
"""Grad function."""
<|body_2|>
def hess(self, x):
"""Hess function.""... | stack_v2_sparse_classes_75kplus_train_067375 | 1,507 | no_license | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Cost function.",
"name": "cost",
"signature": "def cost(self, x)"
},
{
"docstring": "Grad function.",
"name": "grad",
"signature": "def grad(self, x)"
},
{
"doc... | 4 | null | Implement the Python class `Booth` described below.
Class description:
Booth's Function.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def cost(self, x): Cost function.
- def grad(self, x): Grad function.
- def hess(self, x): Hess function. | Implement the Python class `Booth` described below.
Class description:
Booth's Function.
Method signatures and docstrings:
- def __init__(self): Constructor.
- def cost(self, x): Cost function.
- def grad(self, x): Grad function.
- def hess(self, x): Hess function.
<|skeleton|>
class Booth:
"""Booth's Function."... | f2a74df3ab01ac35ea8d80569da909ffa1e86af3 | <|skeleton|>
class Booth:
"""Booth's Function."""
def __init__(self):
"""Constructor."""
<|body_0|>
def cost(self, x):
"""Cost function."""
<|body_1|>
def grad(self, x):
"""Grad function."""
<|body_2|>
def hess(self, x):
"""Hess function.""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Booth:
"""Booth's Function."""
def __init__(self):
"""Constructor."""
self.min = np.array([1.0, 3.0])
self.value = 0.0
self.domain = np.array([[-10.0, 10.0], [-10.0, 10.0]])
self.n = 2
self.smooth = True
self.info = [True, True, True]
self.l... | the_stack_v2_python_sparse | ctf/functions2d/booth.py | cntaylor/ctf | train | 1 |
546a0bbe47034f3443306888432d8e84a792c4e7 | [
"low, high = (0, len(nums) - 1)\nwhile low <= high:\n mid = low + (high - low) // 2\n if nums[mid] == target:\n return mid\n if nums[mid] < target:\n low = mid + 1\n else:\n high = mid - 1\nif high >= 0 and nums[high] > target:\n return high\nreturn low",
"start = 0\nend = len(... | <|body_start_0|>
low, high = (0, len(nums) - 1)
while low <= high:
mid = low + (high - low) // 2
if nums[mid] == target:
return mid
if nums[mid] < target:
low = mid + 1
else:
high = mid - 1
if high >=... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchInsert2(self, nums: List[int], target: int) -> int:
"""20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param target: :return:"""
<|body_0|>
def searchInsert(self, nums, target):
""":type ... | stack_v2_sparse_classes_75kplus_train_067376 | 2,922 | permissive | [
{
"docstring": "20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param target: :return:",
"name": "searchInsert2",
"signature": "def searchInsert2(self, nums: List[int], target: int) -> int"
},
{
"docstring": ":type nums: List[int] :type... | 2 | stack_v2_sparse_classes_30k_train_008280 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchInsert2(self, nums: List[int], target: int) -> int: 20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param ta... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchInsert2(self, nums: List[int], target: int) -> int: 20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param ta... | 4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5 | <|skeleton|>
class Solution:
def searchInsert2(self, nums: List[int], target: int) -> int:
"""20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param target: :return:"""
<|body_0|>
def searchInsert(self, nums, target):
""":type ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def searchInsert2(self, nums: List[int], target: int) -> int:
"""20210824 do it again Runtime: 63 ms, faster than 22.19% Memory Usage: 15 MB, less than 56.94% :param nums: :param target: :return:"""
low, high = (0, len(nums) - 1)
while low <= high:
mid = low + (hi... | the_stack_v2_python_sparse | src/35-SearchInsertPosition.py | Jiezhi/myleetcode | train | 1 | |
db27e91a31aa202373aea10ca485ebbcc510c6f2 | [
"for value in my_results:\n try:\n with patch('builtins.input', return_value=str(value)):\n game = SubtractSquareGame(True)\n ite_result = minimax_iterative_strategy(game)\n rec_result = minimax_recursive_strategy(game)\n self.assertEqual(ite_result, rec_result)\n except... | <|body_start_0|>
for value in my_results:
try:
with patch('builtins.input', return_value=str(value)):
game = SubtractSquareGame(True)
ite_result = minimax_iterative_strategy(game)
rec_result = minimax_recursive_strategy(game)
... | MinimaxUnitTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MinimaxUnitTests:
def test_result_consistency(self):
"""Too lazy to write one."""
<|body_0|>
def test_iterative_subtract_square(self):
"""Too lazy to write one."""
<|body_1|>
def test_recursive_subtract_square(self):
"""Too lazy to write one."""
... | stack_v2_sparse_classes_75kplus_train_067377 | 6,359 | no_license | [
{
"docstring": "Too lazy to write one.",
"name": "test_result_consistency",
"signature": "def test_result_consistency(self)"
},
{
"docstring": "Too lazy to write one.",
"name": "test_iterative_subtract_square",
"signature": "def test_iterative_subtract_square(self)"
},
{
"docstri... | 5 | stack_v2_sparse_classes_30k_train_025185 | Implement the Python class `MinimaxUnitTests` described below.
Class description:
Implement the MinimaxUnitTests class.
Method signatures and docstrings:
- def test_result_consistency(self): Too lazy to write one.
- def test_iterative_subtract_square(self): Too lazy to write one.
- def test_recursive_subtract_square(... | Implement the Python class `MinimaxUnitTests` described below.
Class description:
Implement the MinimaxUnitTests class.
Method signatures and docstrings:
- def test_result_consistency(self): Too lazy to write one.
- def test_iterative_subtract_square(self): Too lazy to write one.
- def test_recursive_subtract_square(... | e57707b91f5c67a5a9621019134eba99e4daf001 | <|skeleton|>
class MinimaxUnitTests:
def test_result_consistency(self):
"""Too lazy to write one."""
<|body_0|>
def test_iterative_subtract_square(self):
"""Too lazy to write one."""
<|body_1|>
def test_recursive_subtract_square(self):
"""Too lazy to write one."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MinimaxUnitTests:
def test_result_consistency(self):
"""Too lazy to write one."""
for value in my_results:
try:
with patch('builtins.input', return_value=str(value)):
game = SubtractSquareGame(True)
ite_result = minimax_iterative_... | the_stack_v2_python_sparse | assignment/a2/Penguin Test/minimax_penguin_tests_enhanced(not failing).py | TianyuDu/csc148 | train | 1 | |
12dfd81185ad5202bb50bd8cc303b1e1ce06536b | [
"if len(self.max_heap) + len(self.min_heap) & 1 == 0:\n if len(self.min_heap) and self.min_heap[0] < num:\n num = heapq.heappushpop(self.min_heap, num)\n heapq.heappush(self.max_heap, -num)\nelse:\n if len(self.max_heap) and num < -self.max_heap[0]:\n num = -heapq.heappushpop(self.max_heap, -... | <|body_start_0|>
if len(self.max_heap) + len(self.min_heap) & 1 == 0:
if len(self.min_heap) and self.min_heap[0] < num:
num = heapq.heappushpop(self.min_heap, num)
heapq.heappush(self.max_heap, -num)
else:
if len(self.max_heap) and num < -self.max_heap... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def insert(self, num):
"""获取数据流"""
<|body_0|>
def getMedian(self):
"""获取数据流中的中位数"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(self.max_heap) + len(self.min_heap) & 1 == 0:
if len(self.min_heap) and self.min_heap[0] < ... | stack_v2_sparse_classes_75kplus_train_067378 | 1,466 | no_license | [
{
"docstring": "获取数据流",
"name": "insert",
"signature": "def insert(self, num)"
},
{
"docstring": "获取数据流中的中位数",
"name": "getMedian",
"signature": "def getMedian(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_044186 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insert(self, num): 获取数据流
- def getMedian(self): 获取数据流中的中位数 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def insert(self, num): 获取数据流
- def getMedian(self): 获取数据流中的中位数
<|skeleton|>
class Solution:
def insert(self, num):
"""获取数据流"""
<|body_0|>
def getMedian... | ef6aee94c7990d734271c204034ec273b665226d | <|skeleton|>
class Solution:
def insert(self, num):
"""获取数据流"""
<|body_0|>
def getMedian(self):
"""获取数据流中的中位数"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def insert(self, num):
"""获取数据流"""
if len(self.max_heap) + len(self.min_heap) & 1 == 0:
if len(self.min_heap) and self.min_heap[0] < num:
num = heapq.heappushpop(self.min_heap, num)
heapq.heappush(self.max_heap, -num)
else:
... | the_stack_v2_python_sparse | 剑指offer/数据流中的中位数.py | godzzbboss/leetcode | train | 0 | |
86affc0fe827747d92941c9b2b0184ca9547afe1 | [
"self.lr = lr\nself.w = w.T\nself.b = b.T\nself.in_d = w.shape[0]\nself.out_d = w.shape[1]",
"assert input.shape[1] == self.in_d\nself.n = input.shape[0]\nself.a = input.T\nself.z = np.dot(self.w, self.a) + self.b\nreturn self.z.T",
"delta_in = gradients.T\nassert delta_in.shape[0] == self.out_d\ndelta_out = se... | <|body_start_0|>
self.lr = lr
self.w = w.T
self.b = b.T
self.in_d = w.shape[0]
self.out_d = w.shape[1]
<|end_body_0|>
<|body_start_1|>
assert input.shape[1] == self.in_d
self.n = input.shape[0]
self.a = input.T
self.z = np.dot(self.w, self.a) + se... | Class for fully connected NN layer | FCLayer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FCLayer:
"""Class for fully connected NN layer"""
def __init__(self, w, b, lr=0.001):
"""Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying the weight matrix transform to column vectors, which then a... | stack_v2_sparse_classes_75kplus_train_067379 | 5,097 | no_license | [
{
"docstring": "Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying the weight matrix transform to column vectors, which then also makes the partial derivatives more intuitive. However it is at the expense of having to transpose... | 3 | stack_v2_sparse_classes_30k_train_001908 | Implement the Python class `FCLayer` described below.
Class description:
Class for fully connected NN layer
Method signatures and docstrings:
- def __init__(self, w, b, lr=0.001): Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying th... | Implement the Python class `FCLayer` described below.
Class description:
Class for fully connected NN layer
Method signatures and docstrings:
- def __init__(self, w, b, lr=0.001): Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying th... | 61439222dd6df007bb9b5f631ca74eb332380249 | <|skeleton|>
class FCLayer:
"""Class for fully connected NN layer"""
def __init__(self, w, b, lr=0.001):
"""Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying the weight matrix transform to column vectors, which then a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FCLayer:
"""Class for fully connected NN layer"""
def __init__(self, w, b, lr=0.001):
"""Save tunable parameters n.b.: I am transposing w and b because it makes more sense to me mathematically to treat the layers as applying the weight matrix transform to column vectors, which then also makes the... | the_stack_v2_python_sparse | supervised/MLP.py | sarahkpardo/ml-demos | train | 0 |
d32a53226c78780c9f92935845c4b1db2dc02d64 | [
"_request_param = request_param['fields']\nversion = config.get_value('version')\nif 'version' not in _request_param:\n _request_param['version'] = version\nget_method_url_template = get_dict_value_by_path('request/url', source_config)\nget_method_url = bind_variable(get_method_url_template, _request_param)\nhos... | <|body_start_0|>
_request_param = request_param['fields']
version = config.get_value('version')
if 'version' not in _request_param:
_request_param['version'] = version
get_method_url_template = get_dict_value_by_path('request/url', source_config)
get_method_url = bind... | HTTP数据源 | HttpDataSource | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HttpDataSource:
"""HTTP数据源"""
def pull(self, source_config, request_param):
"""从数据源拉取数据 :param source_config: :param _request_param: :return:"""
<|body_0|>
def call_http_method(self, host, url, method_name, app_params, timeout=60):
"""调用HTTP方法 :param host: :param... | stack_v2_sparse_classes_75kplus_train_067380 | 11,428 | permissive | [
{
"docstring": "从数据源拉取数据 :param source_config: :param _request_param: :return:",
"name": "pull",
"signature": "def pull(self, source_config, request_param)"
},
{
"docstring": "调用HTTP方法 :param host: :param url: :param method_name: :param version: :param app_params: :return:",
"name": "call_ht... | 2 | stack_v2_sparse_classes_30k_train_003662 | Implement the Python class `HttpDataSource` described below.
Class description:
HTTP数据源
Method signatures and docstrings:
- def pull(self, source_config, request_param): 从数据源拉取数据 :param source_config: :param _request_param: :return:
- def call_http_method(self, host, url, method_name, app_params, timeout=60): 调用HTTP方... | Implement the Python class `HttpDataSource` described below.
Class description:
HTTP数据源
Method signatures and docstrings:
- def pull(self, source_config, request_param): 从数据源拉取数据 :param source_config: :param _request_param: :return:
- def call_http_method(self, host, url, method_name, app_params, timeout=60): 调用HTTP方... | a72b4e4d78b4375f69887e75abcc1e6a6782c551 | <|skeleton|>
class HttpDataSource:
"""HTTP数据源"""
def pull(self, source_config, request_param):
"""从数据源拉取数据 :param source_config: :param _request_param: :return:"""
<|body_0|>
def call_http_method(self, host, url, method_name, app_params, timeout=60):
"""调用HTTP方法 :param host: :param... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HttpDataSource:
"""HTTP数据源"""
def pull(self, source_config, request_param):
"""从数据源拉取数据 :param source_config: :param _request_param: :return:"""
_request_param = request_param['fields']
version = config.get_value('version')
if 'version' not in _request_param:
_... | the_stack_v2_python_sparse | river/source.py | RitterHou/search_platform | train | 0 |
6ac6ecf63a2518185d3d0a4b2c1df27940907779 | [
"self.env = env\nself.agent = agent\nself.use_gpu = use_gpu\nif not isinstance(agent, A2CAgent) and (not isinstance(agent, DQNAgent)) and (not isinstance(agent, PPOAgent)):\n raise ValueError('Behavioral cloning is only compatible with A2C, DQN, and PPO agents.')\nif use_gpu:\n self.agent.to_gpu()\nif load_pa... | <|body_start_0|>
self.env = env
self.agent = agent
self.use_gpu = use_gpu
if not isinstance(agent, A2CAgent) and (not isinstance(agent, DQNAgent)) and (not isinstance(agent, PPOAgent)):
raise ValueError('Behavioral cloning is only compatible with A2C, DQN, and PPO agents.')
... | RL | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RL:
def initialize(self, env: VecEnv, agent: BaseAgent, save_path: str='logs', load_path: str='', use_gpu: bool=True):
"""Initialization function for an RL algorithm. Parameters ---------- env: VecEnv vectorized OpenAI Gym environment agent: BaseAgent agent for train and/or test save_pat... | stack_v2_sparse_classes_75kplus_train_067381 | 3,728 | permissive | [
{
"docstring": "Initialization function for an RL algorithm. Parameters ---------- env: VecEnv vectorized OpenAI Gym environment agent: BaseAgent agent for train and/or test save_path: str, default='logs' path to directory to save network weights load_path: str, default='' path to directory to load network weig... | 2 | stack_v2_sparse_classes_30k_val_000506 | Implement the Python class `RL` described below.
Class description:
Implement the RL class.
Method signatures and docstrings:
- def initialize(self, env: VecEnv, agent: BaseAgent, save_path: str='logs', load_path: str='', use_gpu: bool=True): Initialization function for an RL algorithm. Parameters ---------- env: Vec... | Implement the Python class `RL` described below.
Class description:
Implement the RL class.
Method signatures and docstrings:
- def initialize(self, env: VecEnv, agent: BaseAgent, save_path: str='logs', load_path: str='', use_gpu: bool=True): Initialization function for an RL algorithm. Parameters ---------- env: Vec... | 6aecbe414f0032514ffb4206200596b8c3860b58 | <|skeleton|>
class RL:
def initialize(self, env: VecEnv, agent: BaseAgent, save_path: str='logs', load_path: str='', use_gpu: bool=True):
"""Initialization function for an RL algorithm. Parameters ---------- env: VecEnv vectorized OpenAI Gym environment agent: BaseAgent agent for train and/or test save_pat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RL:
def initialize(self, env: VecEnv, agent: BaseAgent, save_path: str='logs', load_path: str='', use_gpu: bool=True):
"""Initialization function for an RL algorithm. Parameters ---------- env: VecEnv vectorized OpenAI Gym environment agent: BaseAgent agent for train and/or test save_path: str, defaul... | the_stack_v2_python_sparse | ilpyt/algos/rl.py | mitre/ilpyt | train | 11 | |
873570f47c53dd46e7146554863e49d89deee314 | [
"super().__init__()\nself.checkpoint_file = checkpoint_dir / 'checkpoint.tf_model'\nself.best_metrics_so_far: Dict[Text, Any] = {}",
"if self._does_model_improve(logs):\n logger.debug(f'Creating model checkpoint at epoch={epoch + 1} ...')\n self.model.save_weights(self.checkpoint_file, overwrite=True, save_... | <|body_start_0|>
super().__init__()
self.checkpoint_file = checkpoint_dir / 'checkpoint.tf_model'
self.best_metrics_so_far: Dict[Text, Any] = {}
<|end_body_0|>
<|body_start_1|>
if self._does_model_improve(logs):
logger.debug(f'Creating model checkpoint at epoch={epoch + 1} .... | Callback for saving intermediate model checkpoints. | RasaModelCheckpoint | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RasaModelCheckpoint:
"""Callback for saving intermediate model checkpoints."""
def __init__(self, checkpoint_dir: Path) -> None:
"""Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to."""
<|body_0|>
def on_epoch_end(self, epoch: int, logs: O... | stack_v2_sparse_classes_75kplus_train_067382 | 4,036 | permissive | [
{
"docstring": "Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to.",
"name": "__init__",
"signature": "def __init__(self, checkpoint_dir: Path) -> None"
},
{
"docstring": "Save the model on epoch end if the model has improved. Args: epoch: The current epoch. logs:... | 3 | stack_v2_sparse_classes_30k_train_002102 | Implement the Python class `RasaModelCheckpoint` described below.
Class description:
Callback for saving intermediate model checkpoints.
Method signatures and docstrings:
- def __init__(self, checkpoint_dir: Path) -> None: Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to.
- def on_epo... | Implement the Python class `RasaModelCheckpoint` described below.
Class description:
Callback for saving intermediate model checkpoints.
Method signatures and docstrings:
- def __init__(self, checkpoint_dir: Path) -> None: Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to.
- def on_epo... | 50857610bdf0c26dc61f3203a6cbb4bcf193768c | <|skeleton|>
class RasaModelCheckpoint:
"""Callback for saving intermediate model checkpoints."""
def __init__(self, checkpoint_dir: Path) -> None:
"""Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to."""
<|body_0|>
def on_epoch_end(self, epoch: int, logs: O... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RasaModelCheckpoint:
"""Callback for saving intermediate model checkpoints."""
def __init__(self, checkpoint_dir: Path) -> None:
"""Initializes the callback. Args: checkpoint_dir: Directory to store checkpoints to."""
super().__init__()
self.checkpoint_file = checkpoint_dir / 'che... | the_stack_v2_python_sparse | rasa/utils/tensorflow/callback.py | RasaHQ/rasa | train | 13,167 |
e7921796297175c154cdabe5b5b2595aed7fc8ca | [
"if dtype is None:\n dtype = {}\nself._sample_ext = sample_ext\nself._sample_fn = sample_fn\nself._dtype = dtype\nself._normalize = normalize\nself._norm_fn = norm_fn\nself._kwargs = kwargs",
"sample_dict = {}\nfor key, item in self._sample_ext.items():\n data_list = []\n for f in item:\n data = s... | <|body_start_0|>
if dtype is None:
dtype = {}
self._sample_ext = sample_ext
self._sample_fn = sample_fn
self._dtype = dtype
self._normalize = normalize
self._norm_fn = norm_fn
self._kwargs = kwargs
<|end_body_0|>
<|body_start_1|>
sample_dict =... | Provides a callable to load a single sample from multiple files in a folder | LoadSample | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoadSample:
"""Provides a callable to load a single sample from multiple files in a folder"""
def __init__(self, sample_ext: dict, sample_fn: collections.abc.Callable, dtype: dict=None, normalize: tuple=(), norm_fn=norm_range('-1,1'), **kwargs):
"""Parameters ---------- sample_ext : ... | stack_v2_sparse_classes_75kplus_train_067383 | 9,192 | permissive | [
{
"docstring": "Parameters ---------- sample_ext : dict of iterable Defines the data _sample_ext. The dict key defines the position of the sample inside the returned data dict, while the list defines the the files which should be loaded inside the data dict. sample_fn : function function to load a single sample... | 2 | stack_v2_sparse_classes_30k_train_011978 | Implement the Python class `LoadSample` described below.
Class description:
Provides a callable to load a single sample from multiple files in a folder
Method signatures and docstrings:
- def __init__(self, sample_ext: dict, sample_fn: collections.abc.Callable, dtype: dict=None, normalize: tuple=(), norm_fn=norm_rang... | Implement the Python class `LoadSample` described below.
Class description:
Provides a callable to load a single sample from multiple files in a folder
Method signatures and docstrings:
- def __init__(self, sample_ext: dict, sample_fn: collections.abc.Callable, dtype: dict=None, normalize: tuple=(), norm_fn=norm_rang... | 024a4028856661ac8328443ef3cf3d456a30991c | <|skeleton|>
class LoadSample:
"""Provides a callable to load a single sample from multiple files in a folder"""
def __init__(self, sample_ext: dict, sample_fn: collections.abc.Callable, dtype: dict=None, normalize: tuple=(), norm_fn=norm_range('-1,1'), **kwargs):
"""Parameters ---------- sample_ext : ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LoadSample:
"""Provides a callable to load a single sample from multiple files in a folder"""
def __init__(self, sample_ext: dict, sample_fn: collections.abc.Callable, dtype: dict=None, normalize: tuple=(), norm_fn=norm_range('-1,1'), **kwargs):
"""Parameters ---------- sample_ext : dict of itera... | the_stack_v2_python_sparse | delira/data_loading/load_utils.py | LTHODAVDOPL/delira | train | 1 |
1b2199fd0d3a5bc6f5710caa912cc2a7b9cfaec2 | [
"filenames = []\ntodo = {}\nif path.filename is not None:\n filenames.append(path.filename)\ntl = RendererCommitTransactionListener(renderer)\nprj = path.project_obj(transaction_listener=[tl])\npkg = None\nif prj is not None and path.package is not None:\n pkg = prj.package(path.package)\n todo[path.packag... | <|body_start_0|>
filenames = []
todo = {}
if path.filename is not None:
filenames.append(path.filename)
tl = RendererCommitTransactionListener(renderer)
prj = path.project_obj(transaction_listener=[tl])
pkg = None
if prj is not None and path.package is... | Can be used to commit a project or package or wc file. | WCCommitController | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WCCommitController:
"""Can be used to commit a project or package or wc file."""
def commit(self, renderer, path, message, info):
"""Commits path."""
<|body_0|>
def _message(self, pkg, filenames):
"""Returns a message. pkg is a Package instance or None."""
... | stack_v2_sparse_classes_75kplus_train_067384 | 3,178 | no_license | [
{
"docstring": "Commits path.",
"name": "commit",
"signature": "def commit(self, renderer, path, message, info)"
},
{
"docstring": "Returns a message. pkg is a Package instance or None.",
"name": "_message",
"signature": "def _message(self, pkg, filenames)"
}
] | 2 | stack_v2_sparse_classes_30k_train_026212 | Implement the Python class `WCCommitController` described below.
Class description:
Can be used to commit a project or package or wc file.
Method signatures and docstrings:
- def commit(self, renderer, path, message, info): Commits path.
- def _message(self, pkg, filenames): Returns a message. pkg is a Package instan... | Implement the Python class `WCCommitController` described below.
Class description:
Can be used to commit a project or package or wc file.
Method signatures and docstrings:
- def commit(self, renderer, path, message, info): Commits path.
- def _message(self, pkg, filenames): Returns a message. pkg is a Package instan... | fd75a75371ae33740a68913ca8ab64a9e8e6654a | <|skeleton|>
class WCCommitController:
"""Can be used to commit a project or package or wc file."""
def commit(self, renderer, path, message, info):
"""Commits path."""
<|body_0|>
def _message(self, pkg, filenames):
"""Returns a message. pkg is a Package instance or None."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WCCommitController:
"""Can be used to commit a project or package or wc file."""
def commit(self, renderer, path, message, info):
"""Commits path."""
filenames = []
todo = {}
if path.filename is not None:
filenames.append(path.filename)
tl = RendererCom... | the_stack_v2_python_sparse | osc2/cli/commit/commit.py | openSUSE/osc2 | train | 16 |
5e45f898473d8664befd3d2f16c416a7138cd3f2 | [
"concept_parsers.ConceptParser([flags.GetReplicationPresentationSpec('The Replication to create.')]).AddToParser(parser)\nreplications_flags.AddReplicationVolumeArg(parser)\nreplications_flags.AddReplicationReplicationScheduleArg(parser)\nreplications_flags.AddReplicationDestinationVolumeParametersArg(parser)\nflag... | <|body_start_0|>
concept_parsers.ConceptParser([flags.GetReplicationPresentationSpec('The Replication to create.')]).AddToParser(parser)
replications_flags.AddReplicationVolumeArg(parser)
replications_flags.AddReplicationReplicationScheduleArg(parser)
replications_flags.AddReplicationDes... | Create a Cloud NetApp Volume Replication. | Create | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Create:
"""Create a Cloud NetApp Volume Replication."""
def Args(parser):
"""Add args for creating a Replication."""
<|body_0|>
def Run(self, args):
"""Create a Cloud NetApp Volume Replication in the current project."""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_75kplus_train_067385 | 4,060 | permissive | [
{
"docstring": "Add args for creating a Replication.",
"name": "Args",
"signature": "def Args(parser)"
},
{
"docstring": "Create a Cloud NetApp Volume Replication in the current project.",
"name": "Run",
"signature": "def Run(self, args)"
}
] | 2 | stack_v2_sparse_classes_30k_train_031265 | Implement the Python class `Create` described below.
Class description:
Create a Cloud NetApp Volume Replication.
Method signatures and docstrings:
- def Args(parser): Add args for creating a Replication.
- def Run(self, args): Create a Cloud NetApp Volume Replication in the current project. | Implement the Python class `Create` described below.
Class description:
Create a Cloud NetApp Volume Replication.
Method signatures and docstrings:
- def Args(parser): Add args for creating a Replication.
- def Run(self, args): Create a Cloud NetApp Volume Replication in the current project.
<|skeleton|>
class Creat... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class Create:
"""Create a Cloud NetApp Volume Replication."""
def Args(parser):
"""Add args for creating a Replication."""
<|body_0|>
def Run(self, args):
"""Create a Cloud NetApp Volume Replication in the current project."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Create:
"""Create a Cloud NetApp Volume Replication."""
def Args(parser):
"""Add args for creating a Replication."""
concept_parsers.ConceptParser([flags.GetReplicationPresentationSpec('The Replication to create.')]).AddToParser(parser)
replications_flags.AddReplicationVolumeArg(p... | the_stack_v2_python_sparse | lib/surface/netapp/volumes/replications/create.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
91201728441ca58c4e83f156ddb088b37387d498 | [
"self.SetStartDate(2013, 10, 7)\nself.SetEndDate(2013, 10, 11)\nself.SetCash(100000)\nself.symbols = [['SPY', SecurityType.Equity], ['EURUSD', SecurityType.Forex]]\nself.targets = []\nfor item in self.symbols:\n symbol = self.AddSecurity(item[1], item[0]).Symbol\n self.targets.append(PortfolioTarget(symbol, 0... | <|body_start_0|>
self.SetStartDate(2013, 10, 7)
self.SetEndDate(2013, 10, 11)
self.SetCash(100000)
self.symbols = [['SPY', SecurityType.Equity], ['EURUSD', SecurityType.Forex]]
self.targets = []
for item in self.symbols:
symbol = self.AddSecurity(item[1], item... | Collective2SignalExportDemonstrationAlgorithm | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Collective2SignalExportDemonstrationAlgorithm:
def Initialize(self):
"""Initialize the date and add all equity symbols present in list _symbols"""
<|body_0|>
def OnData(self, data):
"""Reduce the quantity of holdings for one security and increase the holdings to the ... | stack_v2_sparse_classes_75kplus_train_067386 | 4,637 | permissive | [
{
"docstring": "Initialize the date and add all equity symbols present in list _symbols",
"name": "Initialize",
"signature": "def Initialize(self)"
},
{
"docstring": "Reduce the quantity of holdings for one security and increase the holdings to the another one when the EMA's indicators crosses b... | 2 | stack_v2_sparse_classes_30k_train_049105 | Implement the Python class `Collective2SignalExportDemonstrationAlgorithm` described below.
Class description:
Implement the Collective2SignalExportDemonstrationAlgorithm class.
Method signatures and docstrings:
- def Initialize(self): Initialize the date and add all equity symbols present in list _symbols
- def OnDa... | Implement the Python class `Collective2SignalExportDemonstrationAlgorithm` described below.
Class description:
Implement the Collective2SignalExportDemonstrationAlgorithm class.
Method signatures and docstrings:
- def Initialize(self): Initialize the date and add all equity symbols present in list _symbols
- def OnDa... | b33dd3bc140e14b883f39ecf848a793cf7292277 | <|skeleton|>
class Collective2SignalExportDemonstrationAlgorithm:
def Initialize(self):
"""Initialize the date and add all equity symbols present in list _symbols"""
<|body_0|>
def OnData(self, data):
"""Reduce the quantity of holdings for one security and increase the holdings to the ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Collective2SignalExportDemonstrationAlgorithm:
def Initialize(self):
"""Initialize the date and add all equity symbols present in list _symbols"""
self.SetStartDate(2013, 10, 7)
self.SetEndDate(2013, 10, 11)
self.SetCash(100000)
self.symbols = [['SPY', SecurityType.Equi... | the_stack_v2_python_sparse | Algorithm.Python/Collective2SignalExportDemonstrationAlgorithm.py | Capnode/Algoloop | train | 87 | |
f7945e7f9db2930df6e1dbd5da653266d507732b | [
"self.logger.info('Retrieving weather for: {}...'.format(location))\ntry:\n async_result = _run_task(retrieve_weather, location.to_serializable())\n self.logger.info('Sent task {} for weather retrieval!'.format(async_result.task_id))\n weather_forecast_serialized = _wait_for_task_and_get_result(async_resul... | <|body_start_0|>
self.logger.info('Retrieving weather for: {}...'.format(location))
try:
async_result = _run_task(retrieve_weather, location.to_serializable())
self.logger.info('Sent task {} for weather retrieval!'.format(async_result.task_id))
weather_forecast_serial... | CeleryService | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CeleryService:
def get_weather_forecast(self, location):
""":type location: commons.model.Location :rtype: list[commons.weather.Weather5DayForecast]"""
<|body_0|>
def retrieve_instagram_media(self, city):
""":type city: commons.model.City :rtype: list[commons.instagr... | stack_v2_sparse_classes_75kplus_train_067387 | 4,863 | permissive | [
{
"docstring": ":type location: commons.model.Location :rtype: list[commons.weather.Weather5DayForecast]",
"name": "get_weather_forecast",
"signature": "def get_weather_forecast(self, location)"
},
{
"docstring": ":type city: commons.model.City :rtype: list[commons.instagram.InstagramMedia]",
... | 4 | null | Implement the Python class `CeleryService` described below.
Class description:
Implement the CeleryService class.
Method signatures and docstrings:
- def get_weather_forecast(self, location): :type location: commons.model.Location :rtype: list[commons.weather.Weather5DayForecast]
- def retrieve_instagram_media(self, ... | Implement the Python class `CeleryService` described below.
Class description:
Implement the CeleryService class.
Method signatures and docstrings:
- def get_weather_forecast(self, location): :type location: commons.model.Location :rtype: list[commons.weather.Weather5DayForecast]
- def retrieve_instagram_media(self, ... | 1a2ee7c6f6f52ce61754510cd7b59e180565306c | <|skeleton|>
class CeleryService:
def get_weather_forecast(self, location):
""":type location: commons.model.Location :rtype: list[commons.weather.Weather5DayForecast]"""
<|body_0|>
def retrieve_instagram_media(self, city):
""":type city: commons.model.City :rtype: list[commons.instagr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CeleryService:
def get_weather_forecast(self, location):
""":type location: commons.model.Location :rtype: list[commons.weather.Weather5DayForecast]"""
self.logger.info('Retrieving weather for: {}...'.format(location))
try:
async_result = _run_task(retrieve_weather, locatio... | the_stack_v2_python_sparse | api/api/celery_service.py | emkor/serverless-pwr-inz | train | 2 | |
74b3b6556ee0d40b22ca4e5a654b55b8f4106531 | [
"self.user = user\nself.testId = testId\nself.videoList = videoList.copy()\nshuffle(self.videoList)\nif len(trainingVideoList) > 0:\n trainingVideoListCopy = trainingVideoList.copy()\n shuffle(trainingVideoListCopy)\n print(trainingVideoListCopy)\n self.videoList.insert(0, trainingVideoListCopy[0])\nsel... | <|body_start_0|>
self.user = user
self.testId = testId
self.videoList = videoList.copy()
shuffle(self.videoList)
if len(trainingVideoList) > 0:
trainingVideoListCopy = trainingVideoList.copy()
shuffle(trainingVideoListCopy)
print(trainingVideoL... | This class manage the configuration and run of one test session. | TestManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestManager:
"""This class manage the configuration and run of one test session."""
def __init__(self, user, testId, trainingVideoList, videoList):
"""init function. :type user: Helpers.User :type testId: int :type videoList: list of Helpers.Video"""
<|body_0|>
def Store... | stack_v2_sparse_classes_75kplus_train_067388 | 7,118 | no_license | [
{
"docstring": "init function. :type user: Helpers.User :type testId: int :type videoList: list of Helpers.Video",
"name": "__init__",
"signature": "def __init__(self, user, testId, trainingVideoList, videoList)"
},
{
"docstring": "Store in the file the test information (selected video order).",... | 3 | stack_v2_sparse_classes_30k_train_026442 | Implement the Python class `TestManager` described below.
Class description:
This class manage the configuration and run of one test session.
Method signatures and docstrings:
- def __init__(self, user, testId, trainingVideoList, videoList): init function. :type user: Helpers.User :type testId: int :type videoList: l... | Implement the Python class `TestManager` described below.
Class description:
This class manage the configuration and run of one test session.
Method signatures and docstrings:
- def __init__(self, user, testId, trainingVideoList, videoList): init function. :type user: Helpers.User :type testId: int :type videoList: l... | 40bd6748570273a07751124e4b5a268e335b37d6 | <|skeleton|>
class TestManager:
"""This class manage the configuration and run of one test session."""
def __init__(self, user, testId, trainingVideoList, videoList):
"""init function. :type user: Helpers.User :type testId: int :type videoList: list of Helpers.Video"""
<|body_0|>
def Store... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestManager:
"""This class manage the configuration and run of one test session."""
def __init__(self, user, testId, trainingVideoList, videoList):
"""init function. :type user: Helpers.User :type testId: int :type videoList: list of Helpers.Video"""
self.user = user
self.testId =... | the_stack_v2_python_sparse | PythonInterface/Helpers/TestManager.py | shunhuaiyao/360Degree_Head_Movement_Dataset | train | 2 |
8fbafaa5b4c0a2592951132ecfc7a0c664818c9e | [
"logger.info(input_file + ' - ' + str(os.path.isfile(input_file)))\nif os.path.isfile(input_file) is True and os.path.getsize(input_file) > 0:\n with open(output_file, 'wb') as f_out:\n with open(input_file, 'rb') as f_in:\n f_out.write(f_in.read())\n return True\nif empty:\n logger.warn(... | <|body_start_0|>
logger.info(input_file + ' - ' + str(os.path.isfile(input_file)))
if os.path.isfile(input_file) is True and os.path.getsize(input_file) > 0:
with open(output_file, 'wb') as f_out:
with open(input_file, 'rb') as f_in:
f_out.write(f_in.read(... | Common functions that can be used generically across tools and pipelines | common | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class common:
"""Common functions that can be used generically across tools and pipelines"""
def to_output_file(input_file, output_file, empty=True):
"""When handling the output of files within the @task function copying the results into the correct output files should be done by reading f... | stack_v2_sparse_classes_75kplus_train_067389 | 7,205 | permissive | [
{
"docstring": "When handling the output of files within the @task function copying the results into the correct output files should be done by reading from and writing to rather than renaming. In cases where there are a known set of output files, if the input file is missing then a blank file should be created... | 3 | null | Implement the Python class `common` described below.
Class description:
Common functions that can be used generically across tools and pipelines
Method signatures and docstrings:
- def to_output_file(input_file, output_file, empty=True): When handling the output of files within the @task function copying the results ... | Implement the Python class `common` described below.
Class description:
Common functions that can be used generically across tools and pipelines
Method signatures and docstrings:
- def to_output_file(input_file, output_file, empty=True): When handling the output of files within the @task function copying the results ... | 50c7115c0c1a6af48dc34f275e469d1b9eb02999 | <|skeleton|>
class common:
"""Common functions that can be used generically across tools and pipelines"""
def to_output_file(input_file, output_file, empty=True):
"""When handling the output of files within the @task function copying the results into the correct output files should be done by reading f... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class common:
"""Common functions that can be used generically across tools and pipelines"""
def to_output_file(input_file, output_file, empty=True):
"""When handling the output of files within the @task function copying the results into the correct output files should be done by reading from and writi... | the_stack_v2_python_sparse | tool/common.py | Multiscale-Genomics/mg-process-fastq | train | 2 |
b92b440643b2946ea8476f322d9b5e566e474a64 | [
"dp = [[1 for __ in range(n)] for __ in range(m)]\nfor i in range(1, m):\n for j in range(1, n):\n dp[i][j] = dp[i - 1][j] + dp[i][j - 1]\nreturn dp[m - 1][n - 1]",
"dp = [[0 for _ in range(n + 1)] for _ in range(m + 1)]\ndp[0][1] = 1\nfor i in range(1, m + 1):\n for j in range(1, n + 1):\n dp... | <|body_start_0|>
dp = [[1 for __ in range(n)] for __ in range(m)]
for i in range(1, m):
for j in range(1, n):
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
return dp[m - 1][n - 1]
<|end_body_0|>
<|body_start_1|>
dp = [[0 for _ in range(n + 1)] for _ in range(m + 1)]... | 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 uniquePaths2(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = [[1 for __ in range(n)] for __ ... | stack_v2_sparse_classes_75kplus_train_067390 | 1,257 | no_license | [
{
"docstring": ":type m: int :type n: int :rtype: int",
"name": "uniquePaths",
"signature": "def uniquePaths(self, m, n)"
},
{
"docstring": ":type m: int :type n: int :rtype: int",
"name": "uniquePaths2",
"signature": "def uniquePaths2(self, m, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006378 | 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 uniquePaths2(self, m, n): :type m: int :type n: int :rtype: int | 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 uniquePaths2(self, m, n): :type m: int :type n: int :rtype: int
<|skeleton|>
class Solution:
def un... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def uniquePaths(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|body_0|>
def uniquePaths2(self, m, n):
""":type m: int :type n: int :rtype: int"""
<|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"""
dp = [[1 for __ in range(n)] for __ in range(m)]
for i in range(1, m):
for j in range(1, n):
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
return dp[m - 1][n - 1]
def un... | the_stack_v2_python_sparse | U/UniquePaths.py | bssrdf/pyleet | train | 2 | |
5fa8f61470663e4f235b61c2d6483930fa2c5c88 | [
"if self.action == 'create':\n return []\nreturn super(UserViewSet, self).get_permissions()",
"if self.request.user.is_superuser:\n return queryset\nreturn queryset.filter(pk=self.request.user.pk)",
"if request.user.is_authenticated and pk == 'current':\n return http.HttpResponseRedirect(redirect_to=ur... | <|body_start_0|>
if self.action == 'create':
return []
return super(UserViewSet, self).get_permissions()
<|end_body_0|>
<|body_start_1|>
if self.request.user.is_superuser:
return queryset
return queryset.filter(pk=self.request.user.pk)
<|end_body_1|>
<|body_star... | UserViewSet | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserViewSet:
def get_permissions(self):
"""Override permissions so that unauthenticated users can create accounts."""
<|body_0|>
def filter_queryset(self, queryset):
"""Ensure that users can not view details for other users."""
<|body_1|>
def retrieve(se... | stack_v2_sparse_classes_75kplus_train_067391 | 3,652 | permissive | [
{
"docstring": "Override permissions so that unauthenticated users can create accounts.",
"name": "get_permissions",
"signature": "def get_permissions(self)"
},
{
"docstring": "Ensure that users can not view details for other users.",
"name": "filter_queryset",
"signature": "def filter_q... | 3 | null | Implement the Python class `UserViewSet` described below.
Class description:
Implement the UserViewSet class.
Method signatures and docstrings:
- def get_permissions(self): Override permissions so that unauthenticated users can create accounts.
- def filter_queryset(self, queryset): Ensure that users can not view det... | Implement the Python class `UserViewSet` described below.
Class description:
Implement the UserViewSet class.
Method signatures and docstrings:
- def get_permissions(self): Override permissions so that unauthenticated users can create accounts.
- def filter_queryset(self, queryset): Ensure that users can not view det... | a00b99f9b697864a078e2cb886be4d75c10458a9 | <|skeleton|>
class UserViewSet:
def get_permissions(self):
"""Override permissions so that unauthenticated users can create accounts."""
<|body_0|>
def filter_queryset(self, queryset):
"""Ensure that users can not view details for other users."""
<|body_1|>
def retrieve(se... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UserViewSet:
def get_permissions(self):
"""Override permissions so that unauthenticated users can create accounts."""
if self.action == 'create':
return []
return super(UserViewSet, self).get_permissions()
def filter_queryset(self, queryset):
"""Ensure that use... | the_stack_v2_python_sparse | metanic/accounts/api/viewsets.py | metanic/services | train | 0 | |
189c763023eca6be54ac3d713a99b6a0b0e2142c | [
"from yahoo_finance import Share\nself._name = name\nself._symbol = symbol\nself.state = None\nself.price_change = None\nself.price_open = None\nself.prev_close = None\nself.stock = Share(symbol)",
"self.stock.refresh()\nself.state = self.stock.get_price()\nself.price_change = self.stock.get_change()\nself.price_... | <|body_start_0|>
from yahoo_finance import Share
self._name = name
self._symbol = symbol
self.state = None
self.price_change = None
self.price_open = None
self.prev_close = None
self.stock = Share(symbol)
<|end_body_0|>
<|body_start_1|>
self.stock... | Get data from Yahoo Finance. | YahooFinanceData | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class YahooFinanceData:
"""Get data from Yahoo Finance."""
def __init__(self, name, symbol):
"""Initialize the data object."""
<|body_0|>
def update(self):
"""Get the latest data and updates the states."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_067392 | 3,588 | permissive | [
{
"docstring": "Initialize the data object.",
"name": "__init__",
"signature": "def __init__(self, name, symbol)"
},
{
"docstring": "Get the latest data and updates the states.",
"name": "update",
"signature": "def update(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006870 | Implement the Python class `YahooFinanceData` described below.
Class description:
Get data from Yahoo Finance.
Method signatures and docstrings:
- def __init__(self, name, symbol): Initialize the data object.
- def update(self): Get the latest data and updates the states. | Implement the Python class `YahooFinanceData` described below.
Class description:
Get data from Yahoo Finance.
Method signatures and docstrings:
- def __init__(self, name, symbol): Initialize the data object.
- def update(self): Get the latest data and updates the states.
<|skeleton|>
class YahooFinanceData:
"""... | ca0e92aba83de2fd6cb1cc4d14f3b4471f17cf3d | <|skeleton|>
class YahooFinanceData:
"""Get data from Yahoo Finance."""
def __init__(self, name, symbol):
"""Initialize the data object."""
<|body_0|>
def update(self):
"""Get the latest data and updates the states."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class YahooFinanceData:
"""Get data from Yahoo Finance."""
def __init__(self, name, symbol):
"""Initialize the data object."""
from yahoo_finance import Share
self._name = name
self._symbol = symbol
self.state = None
self.price_change = None
self.price_op... | the_stack_v2_python_sparse | homeassistant/components/sensor/yahoo_finance.py | Smart-Torvy/torvy-home-assistant | train | 2 |
ac99f7ddc71d1653cc619d952bd43096d6dce9e7 | [
"super(CommonStageImage, self).update_pre_build_configuration()\npre_push_stage_image_uri = self.build_args['PRE_PUSH_IMAGE']\nprocessed_image_uri = pre_push_stage_image_uri.replace('.', '-').replace('/', '-').replace(':', '-')\nimage_name = self.name\ntarfile_name_for_context = f'{processed_image_uri}-{image_name}... | <|body_start_0|>
super(CommonStageImage, self).update_pre_build_configuration()
pre_push_stage_image_uri = self.build_args['PRE_PUSH_IMAGE']
processed_image_uri = pre_push_stage_image_uri.replace('.', '-').replace('/', '-').replace(':', '-')
image_name = self.name
tarfile_name_fo... | This class is especially designed to handle the build process for CommonStageImages. All the functionality - either safety scan report, ecr scan report, etc. - that is especially required to run the miscellaneous_dockerfiles/Dockerfile.common should go into this file. As of now, this class takes care of generating a sa... | CommonStageImage | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommonStageImage:
"""This class is especially designed to handle the build process for CommonStageImages. All the functionality - either safety scan report, ecr scan report, etc. - that is especially required to run the miscellaneous_dockerfiles/Dockerfile.common should go into this file. As of n... | stack_v2_sparse_classes_75kplus_train_067393 | 3,344 | permissive | [
{
"docstring": "Conducts all the pre-build configurations from the parent class and then conducts Safety Scan on the images generated in previous stage builds. The safety scan generates the safety_report which is then copied into the image.",
"name": "update_pre_build_configuration",
"signature": "def u... | 2 | stack_v2_sparse_classes_30k_test_000388 | Implement the Python class `CommonStageImage` described below.
Class description:
This class is especially designed to handle the build process for CommonStageImages. All the functionality - either safety scan report, ecr scan report, etc. - that is especially required to run the miscellaneous_dockerfiles/Dockerfile.c... | Implement the Python class `CommonStageImage` described below.
Class description:
This class is especially designed to handle the build process for CommonStageImages. All the functionality - either safety scan report, ecr scan report, etc. - that is especially required to run the miscellaneous_dockerfiles/Dockerfile.c... | 1510b917ebfb24a3bfb744e4590d46ba78657392 | <|skeleton|>
class CommonStageImage:
"""This class is especially designed to handle the build process for CommonStageImages. All the functionality - either safety scan report, ecr scan report, etc. - that is especially required to run the miscellaneous_dockerfiles/Dockerfile.common should go into this file. As of n... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CommonStageImage:
"""This class is especially designed to handle the build process for CommonStageImages. All the functionality - either safety scan report, ecr scan report, etc. - that is especially required to run the miscellaneous_dockerfiles/Dockerfile.common should go into this file. As of now, this clas... | the_stack_v2_python_sparse | src/common_stage_image.py | Huahan98/deep-learning-containers | train | 1 |
7e63ed6129f327f6928d5f55518d141c88f7aa77 | [
"self.test_image_placeholder = xs\nself.test_label_placeholder = tf.argmax(ys, axis=1)\nlogits = inference_VGG(self.test_image_placeholder, reuse=False)\nself.pre_softmax = logits\npredictions = tf.nn.softmax(logits)\nself.softmax_prob = predictions\nloss, mean_loss = self.loss(logits, self.test_label_placeholder)\... | <|body_start_0|>
self.test_image_placeholder = xs
self.test_label_placeholder = tf.argmax(ys, axis=1)
logits = inference_VGG(self.test_image_placeholder, reuse=False)
self.pre_softmax = logits
predictions = tf.nn.softmax(logits)
self.softmax_prob = predictions
los... | wrap_as_vgg_model | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class wrap_as_vgg_model:
def __init__(self, xs, ys):
""":param: xs: placeholder for input data, should be of shape (None,img_size,img_size,nchannel) :param: ys: placeholder for input lable, should be of shape (None,class_num)"""
<|body_0|>
def loss(self, logits, labels):
"... | stack_v2_sparse_classes_75kplus_train_067394 | 29,798 | permissive | [
{
"docstring": ":param: xs: placeholder for input data, should be of shape (None,img_size,img_size,nchannel) :param: ys: placeholder for input lable, should be of shape (None,class_num)",
"name": "__init__",
"signature": "def __init__(self, xs, ys)"
},
{
"docstring": "Calculate the cross entropy... | 2 | stack_v2_sparse_classes_30k_train_040412 | Implement the Python class `wrap_as_vgg_model` described below.
Class description:
Implement the wrap_as_vgg_model class.
Method signatures and docstrings:
- def __init__(self, xs, ys): :param: xs: placeholder for input data, should be of shape (None,img_size,img_size,nchannel) :param: ys: placeholder for input lable... | Implement the Python class `wrap_as_vgg_model` described below.
Class description:
Implement the wrap_as_vgg_model class.
Method signatures and docstrings:
- def __init__(self, xs, ys): :param: xs: placeholder for input data, should be of shape (None,img_size,img_size,nchannel) :param: ys: placeholder for input lable... | e0d30e2aef585dddf8a0858d51d653aba321d482 | <|skeleton|>
class wrap_as_vgg_model:
def __init__(self, xs, ys):
""":param: xs: placeholder for input data, should be of shape (None,img_size,img_size,nchannel) :param: ys: placeholder for input lable, should be of shape (None,class_num)"""
<|body_0|>
def loss(self, logits, labels):
"... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class wrap_as_vgg_model:
def __init__(self, xs, ys):
""":param: xs: placeholder for input data, should be of shape (None,img_size,img_size,nchannel) :param: ys: placeholder for input lable, should be of shape (None,class_num)"""
self.test_image_placeholder = xs
self.test_label_placeholder = ... | the_stack_v2_python_sparse | cifar10/robust_model_utils/cifar10_vgg_train.py | suyeecav/Hybrid-Attack | train | 24 | |
721ed00127a9711d6cd33034db065485f8c744a2 | [
"construct_type = self.type\nif proxy is not None:\n construct_type = proxy.objects.get(pk=construct_type.pk)\nreturn construct_type",
"if construct_type is None:\n raise ModelConstraintException(self, 'The type may not be None')\nif self.topic_map != construct_type.topic_map:\n raise ModelConstraintExce... | <|body_start_0|>
construct_type = self.type
if proxy is not None:
construct_type = proxy.objects.get(pk=construct_type.pk)
return construct_type
<|end_body_0|>
<|body_start_1|>
if construct_type is None:
raise ModelConstraintException(self, 'The type may not be N... | Indicates that a Topic Maps construct is typed. `Association`s, `Role`s, `Occurrence`s, and `Name`s are typed. | Typed | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Typed:
"""Indicates that a Topic Maps construct is typed. `Association`s, `Role`s, `Occurrence`s, and `Name`s are typed."""
def get_type(self, proxy=None):
"""Returns the type of this construct. :param proxy: Django proxy model :type proxy: class :rtype: the `Topic` that represents t... | stack_v2_sparse_classes_75kplus_train_067395 | 2,022 | permissive | [
{
"docstring": "Returns the type of this construct. :param proxy: Django proxy model :type proxy: class :rtype: the `Topic` that represents the type",
"name": "get_type",
"signature": "def get_type(self, proxy=None)"
},
{
"docstring": "Sets the type of this construct. Any previous type is overri... | 2 | stack_v2_sparse_classes_30k_train_051199 | Implement the Python class `Typed` described below.
Class description:
Indicates that a Topic Maps construct is typed. `Association`s, `Role`s, `Occurrence`s, and `Name`s are typed.
Method signatures and docstrings:
- def get_type(self, proxy=None): Returns the type of this construct. :param proxy: Django proxy model... | Implement the Python class `Typed` described below.
Class description:
Indicates that a Topic Maps construct is typed. `Association`s, `Role`s, `Occurrence`s, and `Name`s are typed.
Method signatures and docstrings:
- def get_type(self, proxy=None): Returns the type of this construct. :param proxy: Django proxy model... | 02f009e1b508218cf330ca7748c3a1dd110f3e8d | <|skeleton|>
class Typed:
"""Indicates that a Topic Maps construct is typed. `Association`s, `Role`s, `Occurrence`s, and `Name`s are typed."""
def get_type(self, proxy=None):
"""Returns the type of this construct. :param proxy: Django proxy model :type proxy: class :rtype: the `Topic` that represents t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Typed:
"""Indicates that a Topic Maps construct is typed. `Association`s, `Role`s, `Occurrence`s, and `Name`s are typed."""
def get_type(self, proxy=None):
"""Returns the type of this construct. :param proxy: Django proxy model :type proxy: class :rtype: the `Topic` that represents the type"""
... | the_stack_v2_python_sparse | tmapi/models/typed.py | ajenhl/django-tmapi | train | 2 |
6cf8b7e2c892b3df66f7086ddf22f006e14ed825 | [
"fx, fy = self.filter_shape\nx_pool = max_pool_2d(x, fx, fy)\nif train_mode:\n orig_x, orig_y = x.shape[1:3]\n expanded = expand_pooled(x_pool, orig_x, orig_y, fx, fy)\n self._cache['mask'] = expanded == x\nreturn x_pool",
"orig_x, orig_y = self._cache['mask'].shape[1:3]\nexpanded = expand_pooled(da, ori... | <|body_start_0|>
fx, fy = self.filter_shape
x_pool = max_pool_2d(x, fx, fy)
if train_mode:
orig_x, orig_y = x.shape[1:3]
expanded = expand_pooled(x_pool, orig_x, orig_y, fx, fy)
self._cache['mask'] = expanded == x
return x_pool
<|end_body_0|>
<|body_s... | 2D Max pooling for convnets. | MaxPool | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaxPool:
"""2D Max pooling for convnets."""
def forward_prop(self, x: np.ndarray, train_mode: bool=False) -> np.ndarray:
"""Forward prop through max pooling layer. :param x: :param train_mode: :return:"""
<|body_0|>
def back_prop(self, da: np.ndarray):
"""Backpro... | stack_v2_sparse_classes_75kplus_train_067396 | 3,624 | no_license | [
{
"docstring": "Forward prop through max pooling layer. :param x: :param train_mode: :return:",
"name": "forward_prop",
"signature": "def forward_prop(self, x: np.ndarray, train_mode: bool=False) -> np.ndarray"
},
{
"docstring": "Backprop through max pool layer. :param da: :return:",
"name":... | 2 | null | Implement the Python class `MaxPool` described below.
Class description:
2D Max pooling for convnets.
Method signatures and docstrings:
- def forward_prop(self, x: np.ndarray, train_mode: bool=False) -> np.ndarray: Forward prop through max pooling layer. :param x: :param train_mode: :return:
- def back_prop(self, da:... | Implement the Python class `MaxPool` described below.
Class description:
2D Max pooling for convnets.
Method signatures and docstrings:
- def forward_prop(self, x: np.ndarray, train_mode: bool=False) -> np.ndarray: Forward prop through max pooling layer. :param x: :param train_mode: :return:
- def back_prop(self, da:... | 43880f8626fbfe4229932dca9a3dc8feab3f3256 | <|skeleton|>
class MaxPool:
"""2D Max pooling for convnets."""
def forward_prop(self, x: np.ndarray, train_mode: bool=False) -> np.ndarray:
"""Forward prop through max pooling layer. :param x: :param train_mode: :return:"""
<|body_0|>
def back_prop(self, da: np.ndarray):
"""Backpro... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MaxPool:
"""2D Max pooling for convnets."""
def forward_prop(self, x: np.ndarray, train_mode: bool=False) -> np.ndarray:
"""Forward prop through max pooling layer. :param x: :param train_mode: :return:"""
fx, fy = self.filter_shape
x_pool = max_pool_2d(x, fx, fy)
if train_... | the_stack_v2_python_sparse | neural_nets_dsr/layers/pooling.py | dstilesr/neural-nets-dsr | train | 3 |
8408216e543fc05b4318910210dd6c3edfb12359 | [
"base_url = 'https://www.mylearningplan.com/DistrictAdmin/'\ndata = {'cbo_SelectDate1': 0, 'cbo_SelectDate2': 0, 'rad_FileFormat': 'Excel', 'DownloadKey': 'Download'}\nfor table in table_list:\n data['chk_' + table] = 'on'\nif date1 != None and date2 != None:\n data['cbo_DateLogic1'] = 'After'\n data['cbo_... | <|body_start_0|>
base_url = 'https://www.mylearningplan.com/DistrictAdmin/'
data = {'cbo_SelectDate1': 0, 'cbo_SelectDate2': 0, 'rad_FileFormat': 'Excel', 'DownloadKey': 'Download'}
for table in table_list:
data['chk_' + table] = 'on'
if date1 != None and date2 != None:
... | This mixin provides routines for downloading table data from PG | DownloadMixin | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DownloadMixin:
"""This mixin provides routines for downloading table data from PG"""
async def _get_tables(self, table_list, date1=None, date2=None):
"""Submits a POST request to download tables as an excel sheet, parses the result to follow the link, downloads the link and returns a... | stack_v2_sparse_classes_75kplus_train_067397 | 3,559 | no_license | [
{
"docstring": "Submits a POST request to download tables as an excel sheet, parses the result to follow the link, downloads the link and returns an xlrd book",
"name": "_get_tables",
"signature": "async def _get_tables(self, table_list, date1=None, date2=None)"
},
{
"docstring": "Creates orm ob... | 3 | stack_v2_sparse_classes_30k_train_006259 | Implement the Python class `DownloadMixin` described below.
Class description:
This mixin provides routines for downloading table data from PG
Method signatures and docstrings:
- async def _get_tables(self, table_list, date1=None, date2=None): Submits a POST request to download tables as an excel sheet, parses the re... | Implement the Python class `DownloadMixin` described below.
Class description:
This mixin provides routines for downloading table data from PG
Method signatures and docstrings:
- async def _get_tables(self, table_list, date1=None, date2=None): Submits a POST request to download tables as an excel sheet, parses the re... | 8645aa06581a83c7bfd307cf6600c4b9b86e9da5 | <|skeleton|>
class DownloadMixin:
"""This mixin provides routines for downloading table data from PG"""
async def _get_tables(self, table_list, date1=None, date2=None):
"""Submits a POST request to download tables as an excel sheet, parses the result to follow the link, downloads the link and returns a... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DownloadMixin:
"""This mixin provides routines for downloading table data from PG"""
async def _get_tables(self, table_list, date1=None, date2=None):
"""Submits a POST request to download tables as an excel sheet, parses the result to follow the link, downloads the link and returns an xlrd book""... | the_stack_v2_python_sparse | AR/PG/download_mixin.py | FalconPD/alwaysRostering | train | 1 |
32935e46fa89ab1347e268a6468ca21faa4cc9ba | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('raykatz_nedg_gaudiosi', 'raykatz_nedg_gaudiosi')\nrepo.dropCollection('demographic_percentages')\nrepo.createCollection('demographic_percentages')\nrepo.raykatz_nedg_gaudiosi.demographics.aggregate([{'$p... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('raykatz_nedg_gaudiosi', 'raykatz_nedg_gaudiosi')
repo.dropCollection('demographic_percentages')
repo.createCollection('demographic_percentages')
... | demographic_percentages | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class demographic_percentages:
def execute(trial=False):
"""Get demographic percentages"""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening in this script. Each run of ... | stack_v2_sparse_classes_75kplus_train_067398 | 4,267 | no_license | [
{
"docstring": "Get demographic percentages",
"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 document describing that invocation event.",
"... | 2 | stack_v2_sparse_classes_30k_test_000135 | Implement the Python class `demographic_percentages` described below.
Class description:
Implement the demographic_percentages class.
Method signatures and docstrings:
- def execute(trial=False): Get demographic percentages
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Create the prov... | Implement the Python class `demographic_percentages` described below.
Class description:
Implement the demographic_percentages class.
Method signatures and docstrings:
- def execute(trial=False): Get demographic percentages
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Create the prov... | 97e72731ffadbeae57d7a332decd58706e7c08de | <|skeleton|>
class demographic_percentages:
def execute(trial=False):
"""Get demographic percentages"""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening in this script. Each run of ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class demographic_percentages:
def execute(trial=False):
"""Get demographic percentages"""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('raykatz_nedg_gaudiosi', 'raykatz_nedg_gaudiosi')
repo.dropCollection... | the_stack_v2_python_sparse | raykatz_nedg_gaudiosi/demographic_percentages.py | ROODAY/course-2017-fal-proj | train | 3 | |
87bb4b351d07c14f251df6c431c2af35d97d6c5c | [
"r = _parse_decimal_or_percent_channel(match['rgba_R'])\ng = _parse_decimal_or_percent_channel(match['rgba_G'])\nb = _parse_decimal_or_percent_channel(match['rgba_B'])\na = _parse_float_channel(match['rgba_A'])\nif r is None or g is None or b is None or (a is None):\n return None\nreturn '#%02X%02X%02X%02X' % (r... | <|body_start_0|>
r = _parse_decimal_or_percent_channel(match['rgba_R'])
g = _parse_decimal_or_percent_channel(match['rgba_G'])
b = _parse_decimal_or_percent_channel(match['rgba_B'])
a = _parse_float_channel(match['rgba_A'])
if r is None or g is None or b is None or (a is None):
... | A class for converting colors in rgba representation to a canonical one. | _RgbaColorConverter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _RgbaColorConverter:
"""A class for converting colors in rgba representation to a canonical one."""
def to_color(self, match):
"""Get a color match into a canonical color representation. Arguments: - match - a dict with matched color formats. Returns a canonical color representation ... | stack_v2_sparse_classes_75kplus_train_067399 | 17,300 | no_license | [
{
"docstring": "Get a color match into a canonical color representation. Arguments: - match - a dict with matched color formats. Returns a canonical color representation for the match.",
"name": "to_color",
"signature": "def to_color(self, match)"
},
{
"docstring": "Convert a canonical color rep... | 2 | null | Implement the Python class `_RgbaColorConverter` described below.
Class description:
A class for converting colors in rgba representation to a canonical one.
Method signatures and docstrings:
- def to_color(self, match): Get a color match into a canonical color representation. Arguments: - match - a dict with matched... | Implement the Python class `_RgbaColorConverter` described below.
Class description:
A class for converting colors in rgba representation to a canonical one.
Method signatures and docstrings:
- def to_color(self, match): Get a color match into a canonical color representation. Arguments: - match - a dict with matched... | 83d469af3fc11d1aedb5193976ef84c59b595d6c | <|skeleton|>
class _RgbaColorConverter:
"""A class for converting colors in rgba representation to a canonical one."""
def to_color(self, match):
"""Get a color match into a canonical color representation. Arguments: - match - a dict with matched color formats. Returns a canonical color representation ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _RgbaColorConverter:
"""A class for converting colors in rgba representation to a canonical one."""
def to_color(self, match):
"""Get a color match into a canonical color representation. Arguments: - match - a dict with matched color formats. Returns a canonical color representation for the match... | the_stack_v2_python_sparse | .config/sublime-text-2/Packages/Color Highlighter/color_converter.py | Wallkerock/X-setup | train | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.