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
022513e06de38bc45441ce79e5269fa1cb3ce05e
[ "await data.check(user)\nasync with aiosqlite.connect('data\\\\economy.db') as conn:\n async with conn.execute('SELECT * from ECONOMY') as cursor:\n async for row in cursor:\n if row[0] == user:\n return row[1]", "await data.check(user)\nasync with aiosqlite.connect('data\\\\ec...
<|body_start_0|> await data.check(user) async with aiosqlite.connect('data\\economy.db') as conn: async with conn.execute('SELECT * from ECONOMY') as cursor: async for row in cursor: if row[0] == user: return row[1] <|end_body_0|> ...
Wallet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Wallet: async def get(self, user): """Gets the balance of somebody's wallet.""" <|body_0|> async def add(self, user, add): """Adds money to somebody's wallet.""" <|body_1|> async def remove(self, user, take): """Removes money from somebody's wall...
stack_v2_sparse_classes_75kplus_train_066400
5,807
no_license
[ { "docstring": "Gets the balance of somebody's wallet.", "name": "get", "signature": "async def get(self, user)" }, { "docstring": "Adds money to somebody's wallet.", "name": "add", "signature": "async def add(self, user, add)" }, { "docstring": "Removes money from somebody's wal...
3
stack_v2_sparse_classes_30k_train_051834
Implement the Python class `Wallet` described below. Class description: Implement the Wallet class. Method signatures and docstrings: - async def get(self, user): Gets the balance of somebody's wallet. - async def add(self, user, add): Adds money to somebody's wallet. - async def remove(self, user, take): Removes mon...
Implement the Python class `Wallet` described below. Class description: Implement the Wallet class. Method signatures and docstrings: - async def get(self, user): Gets the balance of somebody's wallet. - async def add(self, user, add): Adds money to somebody's wallet. - async def remove(self, user, take): Removes mon...
3d075c516124d3a25feebd584fdc351c3abc6613
<|skeleton|> class Wallet: async def get(self, user): """Gets the balance of somebody's wallet.""" <|body_0|> async def add(self, user, add): """Adds money to somebody's wallet.""" <|body_1|> async def remove(self, user, take): """Removes money from somebody's wall...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Wallet: async def get(self, user): """Gets the balance of somebody's wallet.""" await data.check(user) async with aiosqlite.connect('data\\economy.db') as conn: async with conn.execute('SELECT * from ECONOMY') as cursor: async for row in cursor: ...
the_stack_v2_python_sparse
core/EcoCore.py
Smudge-Studios/smudge
train
0
c5152ebddb2a898c4aa575a5068547e03fe9e8e1
[ "super(PositionalEncoding1D, self).__init__()\nself.channels = channels\ninv_freq = 1.0 / 10000 ** (torch.arange(0, channels, 2).float() / channels)\nself.register_buffer('inv_freq', inv_freq)", "if len(tensor.shape) != 3:\n raise RuntimeError('The input tensor has to be 3d!')\nbatch_size, x, orig_ch = tensor....
<|body_start_0|> super(PositionalEncoding1D, self).__init__() self.channels = channels inv_freq = 1.0 / 10000 ** (torch.arange(0, channels, 2).float() / channels) self.register_buffer('inv_freq', inv_freq) <|end_body_0|> <|body_start_1|> if len(tensor.shape) != 3: ra...
PositionalEncoding1D
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PositionalEncoding1D: def __init__(self, channels=256): """:param channels: The last dimension of the tensor you want to apply pos emb to.""" <|body_0|> def forward(self, tensor): """:param tensor: A 3d tensor of size (batch_size, x, ch) :return: Positional Encoding ...
stack_v2_sparse_classes_75kplus_train_066401
7,647
no_license
[ { "docstring": ":param channels: The last dimension of the tensor you want to apply pos emb to.", "name": "__init__", "signature": "def __init__(self, channels=256)" }, { "docstring": ":param tensor: A 3d tensor of size (batch_size, x, ch) :return: Positional Encoding Matrix of size (batch_size,...
2
stack_v2_sparse_classes_30k_train_026728
Implement the Python class `PositionalEncoding1D` described below. Class description: Implement the PositionalEncoding1D class. Method signatures and docstrings: - def __init__(self, channels=256): :param channels: The last dimension of the tensor you want to apply pos emb to. - def forward(self, tensor): :param tens...
Implement the Python class `PositionalEncoding1D` described below. Class description: Implement the PositionalEncoding1D class. Method signatures and docstrings: - def __init__(self, channels=256): :param channels: The last dimension of the tensor you want to apply pos emb to. - def forward(self, tensor): :param tens...
6e7ce04c1c630673f43f677a0b5674d367f82d94
<|skeleton|> class PositionalEncoding1D: def __init__(self, channels=256): """:param channels: The last dimension of the tensor you want to apply pos emb to.""" <|body_0|> def forward(self, tensor): """:param tensor: A 3d tensor of size (batch_size, x, ch) :return: Positional Encoding ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PositionalEncoding1D: def __init__(self, channels=256): """:param channels: The last dimension of the tensor you want to apply pos emb to.""" super(PositionalEncoding1D, self).__init__() self.channels = channels inv_freq = 1.0 / 10000 ** (torch.arange(0, channels, 2).float() / ...
the_stack_v2_python_sparse
sqnet/models/seqnet.py
brekkanegg/rsna-str-embolism
train
0
c045c01f855321240ac01a0ec8a6421caf0a0035
[ "super(BasicBlock, self).__init__()\nself.pad = ReflectionPad3d(padding=1)\nself.conv1 = nn.Conv3d(features_in, features_out, kernel_size=3)\nself.relu = nn.ReLU(inplace=True)\nself.bn1 = nn.BatchNorm3d(features_out)\nself.resid = ResidualLayer(features_out)\nself.conv2 = nn.Conv3d(features_out, features_out, kerne...
<|body_start_0|> super(BasicBlock, self).__init__() self.pad = ReflectionPad3d(padding=1) self.conv1 = nn.Conv3d(features_in, features_out, kernel_size=3) self.relu = nn.ReLU(inplace=True) self.bn1 = nn.BatchNorm3d(features_out) self.resid = ResidualLayer(features_out) ...
Definition of basic components of a FusionNet encoder/decoder layer.
BasicBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BasicBlock: """Definition of basic components of a FusionNet encoder/decoder layer.""" def __init__(self, features_in: int, features_out: int): """Initialisation. Args: features_in: Number of input feature channels. features_out: Number of output feature channels.""" <|body_0...
stack_v2_sparse_classes_75kplus_train_066402
8,294
permissive
[ { "docstring": "Initialisation. Args: features_in: Number of input feature channels. features_out: Number of output feature channels.", "name": "__init__", "signature": "def __init__(self, features_in: int, features_out: int)" }, { "docstring": "Forward pass through layer.", "name": "forward...
2
stack_v2_sparse_classes_30k_train_035231
Implement the Python class `BasicBlock` described below. Class description: Definition of basic components of a FusionNet encoder/decoder layer. Method signatures and docstrings: - def __init__(self, features_in: int, features_out: int): Initialisation. Args: features_in: Number of input feature channels. features_ou...
Implement the Python class `BasicBlock` described below. Class description: Definition of basic components of a FusionNet encoder/decoder layer. Method signatures and docstrings: - def __init__(self, features_in: int, features_out: int): Initialisation. Args: features_in: Number of input feature channels. features_ou...
fc0db7ca69d4149c736b8d0923272f14fb5693fe
<|skeleton|> class BasicBlock: """Definition of basic components of a FusionNet encoder/decoder layer.""" def __init__(self, features_in: int, features_out: int): """Initialisation. Args: features_in: Number of input feature channels. features_out: Number of output feature channels.""" <|body_0...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BasicBlock: """Definition of basic components of a FusionNet encoder/decoder layer.""" def __init__(self, features_in: int, features_out: int): """Initialisation. Args: features_in: Number of input feature channels. features_out: Number of output feature channels.""" super(BasicBlock, sel...
the_stack_v2_python_sparse
models/fusionnet.py
charleshouston/unet-pytorch
train
2
2d581072b8629f9a56c20d08d7b4bc6f2ac77cd9
[ "user_pref = user_models.UserPref.get_signed_in_user_pref()\nif not user_pref:\n self.abort(403, msg='User must be signed in')\nnew_notify = self.get_bool_param('notify')\nuser_pref.notify_as_starrer = new_notify\nuser_pref.put()\nreturn {'message': 'Done'}", "user_pref = user_models.UserPref.get_signed_in_use...
<|body_start_0|> user_pref = user_models.UserPref.get_signed_in_user_pref() if not user_pref: self.abort(403, msg='User must be signed in') new_notify = self.get_bool_param('notify') user_pref.notify_as_starrer = new_notify user_pref.put() return {'message': '...
Users can store their settings preferences such as whether to get notification from the features they starred.
SettingsAPI
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SettingsAPI: """Users can store their settings preferences such as whether to get notification from the features they starred.""" def do_post(self, **kwargs): """Set the user settings (currently only the notify_as_starrer)""" <|body_0|> def do_get(self, **kwargs): ...
stack_v2_sparse_classes_75kplus_train_066403
1,588
permissive
[ { "docstring": "Set the user settings (currently only the notify_as_starrer)", "name": "do_post", "signature": "def do_post(self, **kwargs)" }, { "docstring": "Return the user settings (currently only the notify_as_starrer)", "name": "do_get", "signature": "def do_get(self, **kwargs)" ...
2
stack_v2_sparse_classes_30k_train_042501
Implement the Python class `SettingsAPI` described below. Class description: Users can store their settings preferences such as whether to get notification from the features they starred. Method signatures and docstrings: - def do_post(self, **kwargs): Set the user settings (currently only the notify_as_starrer) - de...
Implement the Python class `SettingsAPI` described below. Class description: Users can store their settings preferences such as whether to get notification from the features they starred. Method signatures and docstrings: - def do_post(self, **kwargs): Set the user settings (currently only the notify_as_starrer) - de...
17f9886d064da5bda84006d5866077727646fff2
<|skeleton|> class SettingsAPI: """Users can store their settings preferences such as whether to get notification from the features they starred.""" def do_post(self, **kwargs): """Set the user settings (currently only the notify_as_starrer)""" <|body_0|> def do_get(self, **kwargs): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SettingsAPI: """Users can store their settings preferences such as whether to get notification from the features they starred.""" def do_post(self, **kwargs): """Set the user settings (currently only the notify_as_starrer)""" user_pref = user_models.UserPref.get_signed_in_user_pref() ...
the_stack_v2_python_sparse
api/settings_api.py
GoogleChrome/chromium-dashboard
train
574
573aaa81cccd130d075372df1f6553718d1caee8
[ "self.i = 0\nself.s = compressedString\nself.count = 0", "if self.hasNext() == False:\n return ' '\nself.count -= 1\nx = self.s[self.i]\nif self.count == 0:\n j = self.i + 1\n while j < len(self.s) and self.s[j].isdigit():\n j += 1\n self.i = j\nreturn x", "if self.i >= len(self.s):\n retu...
<|body_start_0|> self.i = 0 self.s = compressedString self.count = 0 <|end_body_0|> <|body_start_1|> if self.hasNext() == False: return ' ' self.count -= 1 x = self.s[self.i] if self.count == 0: j = self.i + 1 while j < len(sel...
StringIterator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_75kplus_train_066404
1,063
no_license
[ { "docstring": ":type compressedString: str", "name": "__init__", "signature": "def __init__(self, compressedString)" }, { "docstring": ":rtype: str", "name": "next", "signature": "def next(self)" }, { "docstring": ":rtype: bool", "name": "hasNext", "signature": "def hasN...
3
stack_v2_sparse_classes_30k_train_028919
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool
Implement the Python class `StringIterator` described below. Class description: Implement the StringIterator class. Method signatures and docstrings: - def __init__(self, compressedString): :type compressedString: str - def next(self): :rtype: str - def hasNext(self): :rtype: bool <|skeleton|> class StringIterator: ...
1ef919edfe806e206705f70a16faccd59ed4c918
<|skeleton|> class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" <|body_0|> def next(self): """:rtype: str""" <|body_1|> def hasNext(self): """:rtype: bool""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StringIterator: def __init__(self, compressedString): """:type compressedString: str""" self.i = 0 self.s = compressedString self.count = 0 def next(self): """:rtype: str""" if self.hasNext() == False: return ' ' self.count -= 1 ...
the_stack_v2_python_sparse
Leetcode/LC604.py
zbgzbg2007/FromOnlineJudge
train
0
5a3594c6ce1d9e8d2b27284ac945c75270e9c50a
[ "super(MLP, self).__init__()\nself.phidden = phidden\nif not issubclass(type(pins), list):\n pins = [pins]\nself.input_params = pins\nself.hidden_module = self.get_hidden_layers(pins, phidden, nn_lin, name)\nif pouts != None:\n self.out_modules = self.get_output_layers(phidden, pouts)\nelse:\n self.out_mod...
<|body_start_0|> super(MLP, self).__init__() self.phidden = phidden if not issubclass(type(pins), list): pins = [pins] self.input_params = pins self.hidden_module = self.get_hidden_layers(pins, phidden, nn_lin, name) if pouts != None: self.out_modu...
Generic layer that is used by generative variational models as encoders, decoders or only hidden layers.
MLP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MLP: """Generic layer that is used by generative variational models as encoders, decoders or only hidden layers.""" def __init__(self, pins, pouts=None, phidden={'dim': 800, 'nlayers': 2}, nn_lin='ReLU', name='', *args, **kwargs): """:param pins: Input properties. :type pins: dict or...
stack_v2_sparse_classes_75kplus_train_066405
10,368
no_license
[ { "docstring": ":param pins: Input properties. :type pins: dict or [dict] :param pouts: Out propoerties. Leave to None if you only want hidden modules. :type pouts: [dict] or None :param phidden: properties of hidden layers. :type phidden: dict :param nn_lin: name of non-linear layer :type nn_lin: string :param...
4
stack_v2_sparse_classes_30k_test_000152
Implement the Python class `MLP` described below. Class description: Generic layer that is used by generative variational models as encoders, decoders or only hidden layers. Method signatures and docstrings: - def __init__(self, pins, pouts=None, phidden={'dim': 800, 'nlayers': 2}, nn_lin='ReLU', name='', *args, **kw...
Implement the Python class `MLP` described below. Class description: Generic layer that is used by generative variational models as encoders, decoders or only hidden layers. Method signatures and docstrings: - def __init__(self, pins, pouts=None, phidden={'dim': 800, 'nlayers': 2}, nn_lin='ReLU', name='', *args, **kw...
b1894f1a3bb9368c266c86666c62d94cf26d9a61
<|skeleton|> class MLP: """Generic layer that is used by generative variational models as encoders, decoders or only hidden layers.""" def __init__(self, pins, pouts=None, phidden={'dim': 800, 'nlayers': 2}, nn_lin='ReLU', name='', *args, **kwargs): """:param pins: Input properties. :type pins: dict or...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MLP: """Generic layer that is used by generative variational models as encoders, decoders or only hidden layers.""" def __init__(self, pins, pouts=None, phidden={'dim': 800, 'nlayers': 2}, nn_lin='ReLU', name='', *args, **kwargs): """:param pins: Input properties. :type pins: dict or [dict] :para...
the_stack_v2_python_sparse
models/modules/modules_bottleneck.py
dhockaday/variational-timbre
train
0
59f7202324a6df2a3be51bb14260505ad51a8151
[ "self.iht = tc.IHT(iht_size)\nself.num_tilings = num_tilings\nself.num_tiles = num_tiles", "position_scaled = 0\nvelocity_scaled = 0\nPOSITION_MAX = 0.5\nPOSITION_MIN = -1.2\nVELOCITY_MAX = 0.07\nVELOCITY_MIN = -0.07\nposition_normalized = (position - POSITION_MIN) / (POSITION_MAX - POSITION_MIN)\nvelocity_normal...
<|body_start_0|> self.iht = tc.IHT(iht_size) self.num_tilings = num_tilings self.num_tiles = num_tiles <|end_body_0|> <|body_start_1|> position_scaled = 0 velocity_scaled = 0 POSITION_MAX = 0.5 POSITION_MIN = -1.2 VELOCITY_MAX = 0.07 VELOCITY_MIN ...
MountainCarTileCoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MountainCarTileCoder: def __init__(self, iht_size=4096, num_tilings=8, num_tiles=8): """Initializes the MountainCar Tile Coder Initializers: iht_size -- int, the size of the index hash table, typically a power of 2 num_tilings -- int, the number of tilings num_tiles -- int, the number of...
stack_v2_sparse_classes_75kplus_train_066406
16,253
no_license
[ { "docstring": "Initializes the MountainCar Tile Coder Initializers: iht_size -- int, the size of the index hash table, typically a power of 2 num_tilings -- int, the number of tilings num_tiles -- int, the number of tiles. Here both the width and height of the tile coder are the same Class Variables: self.iht ...
2
null
Implement the Python class `MountainCarTileCoder` described below. Class description: Implement the MountainCarTileCoder class. Method signatures and docstrings: - def __init__(self, iht_size=4096, num_tilings=8, num_tiles=8): Initializes the MountainCar Tile Coder Initializers: iht_size -- int, the size of the index...
Implement the Python class `MountainCarTileCoder` described below. Class description: Implement the MountainCarTileCoder class. Method signatures and docstrings: - def __init__(self, iht_size=4096, num_tilings=8, num_tiles=8): Initializes the MountainCar Tile Coder Initializers: iht_size -- int, the size of the index...
4ae8c176acbb5b2d78ff08379a856c4afefea8f8
<|skeleton|> class MountainCarTileCoder: def __init__(self, iht_size=4096, num_tilings=8, num_tiles=8): """Initializes the MountainCar Tile Coder Initializers: iht_size -- int, the size of the index hash table, typically a power of 2 num_tilings -- int, the number of tilings num_tiles -- int, the number of...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MountainCarTileCoder: def __init__(self, iht_size=4096, num_tilings=8, num_tiles=8): """Initializes the MountainCar Tile Coder Initializers: iht_size -- int, the size of the index hash table, typically a power of 2 num_tilings -- int, the number of tilings num_tiles -- int, the number of tiles. Here b...
the_stack_v2_python_sparse
Reinforcement_Learning - University of Alberta/003_Prediction_and_Control_with_Function_Approximation/week_3/assignment/assignment.py
bhunkeler/DataScienceCoursera
train
52
57051fc750b20da7b5ba99135a2ae2881bc00d26
[ "filepath = cls._convert_filepath(filepath)\nif filepath.suffix == '.pdb':\n return cls._from_pdb_file(filepath)\nelse:\n raise ValueError(f'The {format} format is not supported or invalid.')", "parser = PDBParser()\nstructure = parser.get_structure('', pdb_file)\nreturn structure" ]
<|body_start_0|> filepath = cls._convert_filepath(filepath) if filepath.suffix == '.pdb': return cls._from_pdb_file(filepath) else: raise ValueError(f'The {format} format is not supported or invalid.') <|end_body_0|> <|body_start_1|> parser = PDBParser() ...
Parse a structure as a biopython structure object.
Biopython
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Biopython: """Parse a structure as a biopython structure object.""" def from_file(cls, filepath): """Load structures as biopython structure object from file. Parameters ---------- filepath : str or pathlib.Path Path to structure file: pdb files only. Returns ------- Bio.PDB.Structure...
stack_v2_sparse_classes_75kplus_train_066407
1,330
permissive
[ { "docstring": "Load structures as biopython structure object from file. Parameters ---------- filepath : str or pathlib.Path Path to structure file: pdb files only. Returns ------- Bio.PDB.Structure.Structure Structure as biopython structure object.", "name": "from_file", "signature": "def from_file(cl...
2
stack_v2_sparse_classes_30k_train_033730
Implement the Python class `Biopython` described below. Class description: Parse a structure as a biopython structure object. Method signatures and docstrings: - def from_file(cls, filepath): Load structures as biopython structure object from file. Parameters ---------- filepath : str or pathlib.Path Path to structur...
Implement the Python class `Biopython` described below. Class description: Parse a structure as a biopython structure object. Method signatures and docstrings: - def from_file(cls, filepath): Load structures as biopython structure object from file. Parameters ---------- filepath : str or pathlib.Path Path to structur...
c76e87c4fdcb822dfc025e6cb87c34c9e17505d2
<|skeleton|> class Biopython: """Parse a structure as a biopython structure object.""" def from_file(cls, filepath): """Load structures as biopython structure object from file. Parameters ---------- filepath : str or pathlib.Path Path to structure file: pdb files only. Returns ------- Bio.PDB.Structure...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Biopython: """Parse a structure as a biopython structure object.""" def from_file(cls, filepath): """Load structures as biopython structure object from file. Parameters ---------- filepath : str or pathlib.Path Path to structure file: pdb files only. Returns ------- Bio.PDB.Structure.Structure St...
the_stack_v2_python_sparse
opencadd/io/biopython.py
volkamerlab/opencadd
train
62
c14732ae49613698146b3888a289ea9193bc5f4d
[ "if not isinstance(clusters_centroids, tf.Variable):\n raise ValueError('clusters_centroids should be a tf.Variable.')\nself.cluster_centroids = clusters_centroids\nself.cluster_gradient_aggregation = cluster_gradient_aggregation\nself.data_format = data_format", "def grad(d_cluster_centroids):\n d_cluster_...
<|body_start_0|> if not isinstance(clusters_centroids, tf.Variable): raise ValueError('clusters_centroids should be a tf.Variable.') self.cluster_centroids = clusters_centroids self.cluster_gradient_aggregation = cluster_gradient_aggregation self.data_format = data_format <|e...
Class to implement highly efficient vectorised look-ups. We do not utilise looping for that purpose, instead we `smartly` reshape and tile arrays. The trade-off is that we are potentially using way more memory than we would have if looping is used. Each class that inherits from this class is supposed to implement a par...
ClusteringAlgorithm
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClusteringAlgorithm: """Class to implement highly efficient vectorised look-ups. We do not utilise looping for that purpose, instead we `smartly` reshape and tile arrays. The trade-off is that we are potentially using way more memory than we would have if looping is used. Each class that inherits...
stack_v2_sparse_classes_75kplus_train_066408
12,421
permissive
[ { "docstring": "Generating clustered tensors. For generating clustered tensors we will need two things: cluster centroids and the final shape tensor must have. Args: clusters_centroids: An array of shape (N,) that contains initial values of clusters centroids. cluster_gradient_aggregation: An enum that specify ...
5
stack_v2_sparse_classes_30k_train_050067
Implement the Python class `ClusteringAlgorithm` described below. Class description: Class to implement highly efficient vectorised look-ups. We do not utilise looping for that purpose, instead we `smartly` reshape and tile arrays. The trade-off is that we are potentially using way more memory than we would have if lo...
Implement the Python class `ClusteringAlgorithm` described below. Class description: Class to implement highly efficient vectorised look-ups. We do not utilise looping for that purpose, instead we `smartly` reshape and tile arrays. The trade-off is that we are potentially using way more memory than we would have if lo...
4733c85f21d1eb570fd575ea201cb211a485bfb0
<|skeleton|> class ClusteringAlgorithm: """Class to implement highly efficient vectorised look-ups. We do not utilise looping for that purpose, instead we `smartly` reshape and tile arrays. The trade-off is that we are potentially using way more memory than we would have if looping is used. Each class that inherits...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClusteringAlgorithm: """Class to implement highly efficient vectorised look-ups. We do not utilise looping for that purpose, instead we `smartly` reshape and tile arrays. The trade-off is that we are potentially using way more memory than we would have if looping is used. Each class that inherits from this cl...
the_stack_v2_python_sparse
tensorflow_model_optimization/python/core/clustering/keras/clustering_algorithm.py
tensorflow/model-optimization
train
1,550
f49d02863cdca5431859a3da1ebb79a26bc14c9c
[ "z = z.copy()\nz[z < 0] = 0.01 * z[z < 0]\nz[z > 6] = 6\nreturn z", "z = z.copy()\nz[np.where(np.logical_and(z >= 0, z <= 6))] = 1\nz[z < 0] = 0.01\nz[z > 6] = 0\nreturn z" ]
<|body_start_0|> z = z.copy() z[z < 0] = 0.01 * z[z < 0] z[z > 6] = 6 return z <|end_body_0|> <|body_start_1|> z = z.copy() z[np.where(np.logical_and(z >= 0, z <= 6))] = 1 z[z < 0] = 0.01 z[z > 6] = 0 return z <|end_body_1|>
LeakyRelu6
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LeakyRelu6: def f(self, z): """f: Real -> [0,inf)""" <|body_0|> def f_prime(self, z): """f: Real -> [0,inf)""" <|body_1|> <|end_skeleton|> <|body_start_0|> z = z.copy() z[z < 0] = 0.01 * z[z < 0] z[z > 6] = 6 return z <|end_b...
stack_v2_sparse_classes_75kplus_train_066409
2,027
no_license
[ { "docstring": "f: Real -> [0,inf)", "name": "f", "signature": "def f(self, z)" }, { "docstring": "f: Real -> [0,inf)", "name": "f_prime", "signature": "def f_prime(self, z)" } ]
2
stack_v2_sparse_classes_30k_train_013951
Implement the Python class `LeakyRelu6` described below. Class description: Implement the LeakyRelu6 class. Method signatures and docstrings: - def f(self, z): f: Real -> [0,inf) - def f_prime(self, z): f: Real -> [0,inf)
Implement the Python class `LeakyRelu6` described below. Class description: Implement the LeakyRelu6 class. Method signatures and docstrings: - def f(self, z): f: Real -> [0,inf) - def f_prime(self, z): f: Real -> [0,inf) <|skeleton|> class LeakyRelu6: def f(self, z): """f: Real -> [0,inf)""" <|...
84e4ad5d1792fcce214d6be81c2175939a3a9a09
<|skeleton|> class LeakyRelu6: def f(self, z): """f: Real -> [0,inf)""" <|body_0|> def f_prime(self, z): """f: Real -> [0,inf)""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LeakyRelu6: def f(self, z): """f: Real -> [0,inf)""" z = z.copy() z[z < 0] = 0.01 * z[z < 0] z[z > 6] = 6 return z def f_prime(self, z): """f: Real -> [0,inf)""" z = z.copy() z[np.where(np.logical_and(z >= 0, z <= 6))] = 1 z[z < 0] =...
the_stack_v2_python_sparse
deep-q-learning/lib/activation_function.py
felixjchen/learning
train
0
5ff97bdb7eaa3beab6321e83670a39942034a76d
[ "url = self.client.get_url('exchange-rates')\nparams = {'format': format}\nresp = requests.get(url, params=params)\nif resp.status_code == 200:\n return resp.json()\nelse:\n return resp.text", "url = self.client.get_url('exchange-rates/history')\nparams = {'currency': currency, 'start': start, 'end': end}\n...
<|body_start_0|> url = self.client.get_url('exchange-rates') params = {'format': format} resp = requests.get(url, params=params) if resp.status_code == 200: return resp.json() else: return resp.text <|end_body_0|> <|body_start_1|> url = self.clien...
ExchangeRates
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExchangeRates: def get_rates(self, format=None): """Returns the current exchange rates used by Nomics to convert prices from markets into USD. This contains Fiat currencies as well as a BTC and ETH quote prices. :param str format: Format of the response. Defaults to JSON when blank.""" ...
stack_v2_sparse_classes_75kplus_train_066410
1,399
permissive
[ { "docstring": "Returns the current exchange rates used by Nomics to convert prices from markets into USD. This contains Fiat currencies as well as a BTC and ETH quote prices. :param str format: Format of the response. Defaults to JSON when blank.", "name": "get_rates", "signature": "def get_rates(self,...
2
stack_v2_sparse_classes_30k_train_002049
Implement the Python class `ExchangeRates` described below. Class description: Implement the ExchangeRates class. Method signatures and docstrings: - def get_rates(self, format=None): Returns the current exchange rates used by Nomics to convert prices from markets into USD. This contains Fiat currencies as well as a ...
Implement the Python class `ExchangeRates` described below. Class description: Implement the ExchangeRates class. Method signatures and docstrings: - def get_rates(self, format=None): Returns the current exchange rates used by Nomics to convert prices from markets into USD. This contains Fiat currencies as well as a ...
70d864b83a0384be2120cbfddc26d55cc1e22065
<|skeleton|> class ExchangeRates: def get_rates(self, format=None): """Returns the current exchange rates used by Nomics to convert prices from markets into USD. This contains Fiat currencies as well as a BTC and ETH quote prices. :param str format: Format of the response. Defaults to JSON when blank.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExchangeRates: def get_rates(self, format=None): """Returns the current exchange rates used by Nomics to convert prices from markets into USD. This contains Fiat currencies as well as a BTC and ETH quote prices. :param str format: Format of the response. Defaults to JSON when blank.""" url = s...
the_stack_v2_python_sparse
nomics/api/exchange_rates.py
luisriverag/nomics-python
train
0
929dd5d67761b0c0e0e09fc561a0d68c87d28a29
[ "dirname = 'classifier'\nif extension is not None:\n dirname += '_{:s}'.format(str(extension))\npath = join(dirpath, dirname)\nif not exists(path):\n mkdir(path)\nif data:\n np.save(join(path, 'values.npy'), self._values)\nio = IO()\nio.write_json(join(path, 'parameters.json'), self.parameters)\nif image:\...
<|body_start_0|> dirname = 'classifier' if extension is not None: dirname += '_{:s}'.format(str(extension)) path = join(dirpath, dirname) if not exists(path): mkdir(path) if data: np.save(join(path, 'values.npy'), self._values) io = IO(...
Methods for saving and loading classifier objects.
ClassifierIO
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClassifierIO: """Methods for saving and loading classifier objects.""" def save(self, dirpath, data=False, image=True, extension=None, **kwargs): """Save classifier to specified path. Args: dirpath (str) - directory in which classifier is to be saved data (bool) - if True, save train...
stack_v2_sparse_classes_75kplus_train_066411
9,044
permissive
[ { "docstring": "Save classifier to specified path. Args: dirpath (str) - directory in which classifier is to be saved data (bool) - if True, save training data image (bool) - if True, save labeled histogram image extension (str) - directory name extension kwargs: keyword arguments for image rendering", "nam...
2
stack_v2_sparse_classes_30k_train_033552
Implement the Python class `ClassifierIO` described below. Class description: Methods for saving and loading classifier objects. Method signatures and docstrings: - def save(self, dirpath, data=False, image=True, extension=None, **kwargs): Save classifier to specified path. Args: dirpath (str) - directory in which cl...
Implement the Python class `ClassifierIO` described below. Class description: Methods for saving and loading classifier objects. Method signatures and docstrings: - def save(self, dirpath, data=False, image=True, extension=None, **kwargs): Save classifier to specified path. Args: dirpath (str) - directory in which cl...
4a622c3f5fed4456c3b9240f5a96428789fde9bd
<|skeleton|> class ClassifierIO: """Methods for saving and loading classifier objects.""" def save(self, dirpath, data=False, image=True, extension=None, **kwargs): """Save classifier to specified path. Args: dirpath (str) - directory in which classifier is to be saved data (bool) - if True, save train...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ClassifierIO: """Methods for saving and loading classifier objects.""" def save(self, dirpath, data=False, image=True, extension=None, **kwargs): """Save classifier to specified path. Args: dirpath (str) - directory in which classifier is to be saved data (bool) - if True, save training data imag...
the_stack_v2_python_sparse
flyqma/annotation/classification/classifiers.py
sbernasek/flyqma
train
1
540f05e1c336b0c8966f839740827901187ae335
[ "self.model = model\nself.sess = sess\nself.lr = base_lr\nself.offset_steps = offset_steps\nself.total_steps = total_steps\nself.time_constant = (total_steps - offset_steps) / np.log(base_lr / final_lr)\nself.final_lr = final_lr\nself.interval = interval\nself.model.assign_lr(self.sess, self.lr)", "if niter > sel...
<|body_start_0|> self.model = model self.sess = sess self.lr = base_lr self.offset_steps = offset_steps self.total_steps = total_steps self.time_constant = (total_steps - offset_steps) / np.log(base_lr / final_lr) self.final_lr = final_lr self.interval = i...
Adjusts learning rate according to an exponential decay schedule.
ExponentialLearnRateScheduler
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExponentialLearnRateScheduler: """Adjusts learning rate according to an exponential decay schedule.""" def __init__(self, sess, model, base_lr, offset_steps, total_steps, final_lr, interval): """Args: sess: TensorFlow session object. model: Model object. base_lr: Base learning rate. ...
stack_v2_sparse_classes_75kplus_train_066412
3,191
permissive
[ { "docstring": "Args: sess: TensorFlow session object. model: Model object. base_lr: Base learning rate. offset_steps: Initial non-decay steps. total_steps: Total number of steps. final_lr: Final learning rate by the end of training. interval: Number of steps in between learning rate updates (staircase).", ...
2
stack_v2_sparse_classes_30k_train_023165
Implement the Python class `ExponentialLearnRateScheduler` described below. Class description: Adjusts learning rate according to an exponential decay schedule. Method signatures and docstrings: - def __init__(self, sess, model, base_lr, offset_steps, total_steps, final_lr, interval): Args: sess: TensorFlow session o...
Implement the Python class `ExponentialLearnRateScheduler` described below. Class description: Adjusts learning rate according to an exponential decay schedule. Method signatures and docstrings: - def __init__(self, sess, model, base_lr, offset_steps, total_steps, final_lr, interval): Args: sess: TensorFlow session o...
355d7c530977a7e0584f88953ba3d025496e03f8
<|skeleton|> class ExponentialLearnRateScheduler: """Adjusts learning rate according to an exponential decay schedule.""" def __init__(self, sess, model, base_lr, offset_steps, total_steps, final_lr, interval): """Args: sess: TensorFlow session object. model: Model object. base_lr: Base learning rate. ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExponentialLearnRateScheduler: """Adjusts learning rate according to an exponential decay schedule.""" def __init__(self, sess, model, base_lr, offset_steps, total_steps, final_lr, interval): """Args: sess: TensorFlow session object. model: Model object. base_lr: Base learning rate. offset_steps:...
the_stack_v2_python_sparse
resnet/utils/lr_schedule.py
LiliMeng/revnet-video
train
1
80d8fe0e18b01f463781f36d75266d188ab9ab2e
[ "if head == None or head.next == None:\n return False\nslow = fast = head\nwhile fast and fast.next:\n slow = slow.next\n fast = fast.next.next\n if slow == fast:\n return slow\nreturn None", "if self.hasCycle(head) == None:\n return None\nmeetingNode = self.hasCycle(head)\nnodesInLoop = 1\n...
<|body_start_0|> if head == None or head.next == None: return False slow = fast = head while fast and fast.next: slow = slow.next fast = fast.next.next if slow == fast: return slow return None <|end_body_0|> <|body_start_1|...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def hasCycle(self, head): """找到环内节点,一快一慢,如有环,则一定在环内重合""" <|body_0|> def entryNode(self, head): """找到环内节点,先获取环的长度,一个节点先走环的长度,另外一个出发,则在入口处重合""" <|body_1|> <|end_skeleton|> <|body_start_0|> if head == None or head.next == None: re...
stack_v2_sparse_classes_75kplus_train_066413
1,098
no_license
[ { "docstring": "找到环内节点,一快一慢,如有环,则一定在环内重合", "name": "hasCycle", "signature": "def hasCycle(self, head)" }, { "docstring": "找到环内节点,先获取环的长度,一个节点先走环的长度,另外一个出发,则在入口处重合", "name": "entryNode", "signature": "def entryNode(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_036659
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): 找到环内节点,一快一慢,如有环,则一定在环内重合 - def entryNode(self, head): 找到环内节点,先获取环的长度,一个节点先走环的长度,另外一个出发,则在入口处重合
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def hasCycle(self, head): 找到环内节点,一快一慢,如有环,则一定在环内重合 - def entryNode(self, head): 找到环内节点,先获取环的长度,一个节点先走环的长度,另外一个出发,则在入口处重合 <|skeleton|> class Solution: def hasCycle(self, hea...
5789545fec82a2edc7f6a94aa55387eb736fca42
<|skeleton|> class Solution: def hasCycle(self, head): """找到环内节点,一快一慢,如有环,则一定在环内重合""" <|body_0|> def entryNode(self, head): """找到环内节点,先获取环的长度,一个节点先走环的长度,另外一个出发,则在入口处重合""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def hasCycle(self, head): """找到环内节点,一快一慢,如有环,则一定在环内重合""" if head == None or head.next == None: return False slow = fast = head while fast and fast.next: slow = slow.next fast = fast.next.next if slow == fast: ...
the_stack_v2_python_sparse
algorithm/56-entryNodeOfLoop.py
xixijiushui/Python_algorithm
train
0
648e6c3a911905ef082b3f76eaa6da01c850b450
[ "global instance\nif instance:\n del instance\ninstance = self\nself.bearers = sortedcontainers.SortedDict()", "string = 'BEARER LIST'\nfor ue in self.bearers:\n string += '\\n\\tUE {0.name} (IMSI {0.imsi})'.format(ue)\n for bearer in self.bearers[ue]:\n string += '\\n\\t\\t{0})'.format(bearer)\nr...
<|body_start_0|> global instance if instance: del instance instance = self self.bearers = sortedcontainers.SortedDict() <|end_body_0|> <|body_start_1|> string = 'BEARER LIST' for ue in self.bearers: string += '\n\tUE {0.name} (IMSI {0.imsi})'.form...
Class that represents the list with all the bearers active in the simulation. Bearers are created in this class, and returned to the requester of the bearer. Methods are provided for adding a default bearer, adding a dedicated bearer, and deactivating an active bearer.
BearerList
[ "NIST-Software" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BearerList: """Class that represents the list with all the bearers active in the simulation. Bearers are created in this class, and returned to the requester of the bearer. Methods are provided for adding a default bearer, adding a dedicated bearer, and deactivating an active bearer.""" def ...
stack_v2_sparse_classes_75kplus_train_066414
5,667
permissive
[ { "docstring": "Constructor. Point the global reference to this object, and initialize the list of bearers as an empty SortedDict.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Return the string representation of this bearer list.", "name": "__str__", "signat...
5
stack_v2_sparse_classes_30k_train_028741
Implement the Python class `BearerList` described below. Class description: Class that represents the list with all the bearers active in the simulation. Bearers are created in this class, and returned to the requester of the bearer. Methods are provided for adding a default bearer, adding a dedicated bearer, and deac...
Implement the Python class `BearerList` described below. Class description: Class that represents the list with all the bearers active in the simulation. Bearers are created in this class, and returned to the requester of the bearer. Methods are provided for adding a default bearer, adding a dedicated bearer, and deac...
8d90d3fa172bb22de67eddbb2a6b5b7a2664e1e3
<|skeleton|> class BearerList: """Class that represents the list with all the bearers active in the simulation. Bearers are created in this class, and returned to the requester of the bearer. Methods are provided for adding a default bearer, adding a dedicated bearer, and deactivating an active bearer.""" def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BearerList: """Class that represents the list with all the bearers active in the simulation. Bearers are created in this class, and returned to the requester of the bearer. Methods are provided for adding a default bearer, adding a dedicated bearer, and deactivating an active bearer.""" def __init__(self...
the_stack_v2_python_sparse
qppsim/BearerList.py
usnistgov/qppsim
train
2
af788f1b33b24a6c2c3e80cb974c69b73c94106a
[ "org = OrgService.find_by_org_id(org_id, allowed_roles=ALL_ALLOWED_ROLES)\nif org is None:\n response, status = ({'message': 'The requested organization could not be found.'}, http_status.HTTP_404_NOT_FOUND)\nelse:\n response, status = (org.as_dict(), http_status.HTTP_200_OK)\nreturn (response, status)", "r...
<|body_start_0|> org = OrgService.find_by_org_id(org_id, allowed_roles=ALL_ALLOWED_ROLES) if org is None: response, status = ({'message': 'The requested organization could not be found.'}, http_status.HTTP_404_NOT_FOUND) else: response, status = (org.as_dict(), http_statu...
Resource for managing a single org.
Org
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Org: """Resource for managing a single org.""" def get(org_id): """Get the org specified by the provided id.""" <|body_0|> def put(org_id): """Update the org specified by the provided id with the request body.""" <|body_1|> def delete(org_id): ...
stack_v2_sparse_classes_75kplus_train_066415
30,185
permissive
[ { "docstring": "Get the org specified by the provided id.", "name": "get", "signature": "def get(org_id)" }, { "docstring": "Update the org specified by the provided id with the request body.", "name": "put", "signature": "def put(org_id)" }, { "docstring": "Inactivates the org i...
4
stack_v2_sparse_classes_30k_train_046593
Implement the Python class `Org` described below. Class description: Resource for managing a single org. Method signatures and docstrings: - def get(org_id): Get the org specified by the provided id. - def put(org_id): Update the org specified by the provided id with the request body. - def delete(org_id): Inactivate...
Implement the Python class `Org` described below. Class description: Resource for managing a single org. Method signatures and docstrings: - def get(org_id): Get the org specified by the provided id. - def put(org_id): Update the org specified by the provided id with the request body. - def delete(org_id): Inactivate...
923cb8a3ee88dcbaf0fe800ca70022b3c13c1d01
<|skeleton|> class Org: """Resource for managing a single org.""" def get(org_id): """Get the org specified by the provided id.""" <|body_0|> def put(org_id): """Update the org specified by the provided id with the request body.""" <|body_1|> def delete(org_id): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Org: """Resource for managing a single org.""" def get(org_id): """Get the org specified by the provided id.""" org = OrgService.find_by_org_id(org_id, allowed_roles=ALL_ALLOWED_ROLES) if org is None: response, status = ({'message': 'The requested organization could no...
the_stack_v2_python_sparse
auth-api/src/auth_api/resources/org.py
bcgov/sbc-auth
train
13
03e32b3b06388e6573acdba07a1cc276163047a5
[ "ParamSpace().update_params(params)\narch_desc = self.get_arch_desc()\nret = self.compute_metrics()\nself.logger.info('Evaluate: {} -> {}'.format(arch_desc, ret))\nreturn ret", "logger = self.logger\nap_cont = tuple((a.detach().softmax(dim=-1).cpu().numpy() for a in ParamSpace().tensor_values()))\nmax_num = min(l...
<|body_start_0|> ParamSpace().update_params(params) arch_desc = self.get_arch_desc() ret = self.compute_metrics() self.logger.info('Evaluate: {} -> {}'.format(arch_desc, ret)) return ret <|end_body_0|> <|body_start_1|> logger = self.logger ap_cont = tuple((a.deta...
Supernet-based Estimator class.
SuperNetEstim
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SuperNetEstim: """Supernet-based Estimator class.""" def step(self, params): """Return evaluation results of a parameter set.""" <|body_0|> def print_tensor_params(self, max_num=3): """Log current tensor parameter values.""" <|body_1|> def run(self, ...
stack_v2_sparse_classes_75kplus_train_066416
3,532
permissive
[ { "docstring": "Return evaluation results of a parameter set.", "name": "step", "signature": "def step(self, params)" }, { "docstring": "Log current tensor parameter values.", "name": "print_tensor_params", "signature": "def print_tensor_params(self, max_num=3)" }, { "docstring":...
4
stack_v2_sparse_classes_30k_train_001364
Implement the Python class `SuperNetEstim` described below. Class description: Supernet-based Estimator class. Method signatures and docstrings: - def step(self, params): Return evaluation results of a parameter set. - def print_tensor_params(self, max_num=3): Log current tensor parameter values. - def run(self, opti...
Implement the Python class `SuperNetEstim` described below. Class description: Supernet-based Estimator class. Method signatures and docstrings: - def step(self, params): Return evaluation results of a parameter set. - def print_tensor_params(self, max_num=3): Log current tensor parameter values. - def run(self, opti...
8e0af84a57eca5745fe2db3d13075393838036bb
<|skeleton|> class SuperNetEstim: """Supernet-based Estimator class.""" def step(self, params): """Return evaluation results of a parameter set.""" <|body_0|> def print_tensor_params(self, max_num=3): """Log current tensor parameter values.""" <|body_1|> def run(self, ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SuperNetEstim: """Supernet-based Estimator class.""" def step(self, params): """Return evaluation results of a parameter set.""" ParamSpace().update_params(params) arch_desc = self.get_arch_desc() ret = self.compute_metrics() self.logger.info('Evaluate: {} -> {}'.f...
the_stack_v2_python_sparse
vega/algorithms/nas/modnas/estim/predefined/supernet.py
fmsnew/vega
train
0
83c1262221c71841a2ff0e00132cf5ddbdce2e70
[ "if not nums:\n return 0\nsize = len(nums)\nif size == 1:\n return nums[0]\nreturn max(self.Myrob(nums[1:]), self.Myrob(nums[:size - 1]))", "if not nums:\n return 0\nsize = len(nums)\nif size == 1:\n return nums[0]\ndp = [0 for _ in range(len(nums))]\ndp[0] = nums[0]\ndp[1] = max(nums[0], nums[1])\nfo...
<|body_start_0|> if not nums: return 0 size = len(nums) if size == 1: return nums[0] return max(self.Myrob(nums[1:]), self.Myrob(nums[:size - 1])) <|end_body_0|> <|body_start_1|> if not nums: return 0 size = len(nums) if size =...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def Myrob(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not nums: return 0 size = len(nums) ...
stack_v2_sparse_classes_75kplus_train_066417
701
permissive
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "rob", "signature": "def rob(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "Myrob", "signature": "def Myrob(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_007505
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def Myrob(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def rob(self, nums): :type nums: List[int] :rtype: int - def Myrob(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def rob(self, nums): ...
d2b8a1dfe986d71d02d2568b55bad6e5b1c81492
<|skeleton|> class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def Myrob(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def rob(self, nums): """:type nums: List[int] :rtype: int""" if not nums: return 0 size = len(nums) if size == 1: return nums[0] return max(self.Myrob(nums[1:]), self.Myrob(nums[:size - 1])) def Myrob(self, nums): """:type ...
the_stack_v2_python_sparse
Middle/Que213打家劫舍II.py
HuangZengPei/LeetCode
train
2
74aba9ca6c5f41bdb71dd4d585e1d49fec4bf5a0
[ "self.background = background\nself.dragonfly = dragonfly\nself.target_list = target_list\nself.width = width\nself.height = height\nself.index = 0\nself.run_id = run_id", "if self.background:\n canvas = self.background.grab(self.height, self.width)\nelse:\n canvas = np.empty((self.height, self.width, 3), n...
<|body_start_0|> self.background = background self.dragonfly = dragonfly self.target_list = target_list self.width = width self.height = height self.index = 0 self.run_id = run_id <|end_body_0|> <|body_start_1|> if self.background: canvas = se...
This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas index (int): index of saved canvas starting from 0
AnimationWindow
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AnimationWindow: """This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas index (int): index of saved canvas starting...
stack_v2_sparse_classes_75kplus_train_066418
3,008
no_license
[ { "docstring": "Constructor Args: target_list (List[Target]): list of targets to draw width (int): width of the drawing canvas height (int): height of the drawing canvas background (Optional[Background]): add a background to the canvas", "name": "__init__", "signature": "def __init__(self, run_id, targe...
2
stack_v2_sparse_classes_30k_train_042550
Implement the Python class `AnimationWindow` described below. Class description: This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas inde...
Implement the Python class `AnimationWindow` described below. Class description: This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas inde...
ce01f6f8638f29abb3d017e0bf367f52e86c1299
<|skeleton|> class AnimationWindow: """This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas index (int): index of saved canvas starting...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AnimationWindow: """This class keeps track of current animation frame Attributes: background (Optinal[Background]): background of canvas target_list (List[Target]): targets that will be drawing width (int): width of canvas height (int): height of canvas index (int): index of saved canvas starting from 0""" ...
the_stack_v2_python_sparse
Environment/AnimationWindow.py
yoryos/dragonfly
train
1
e86cd25b57e28836e7bd46f3abab7769f978457c
[ "logger.info('Init SIM900')\nlogger.info('Setup GPIO and serial...')\nGPIO.setmode(GPIO.BOARD)\nGPIO.setup(11, GPIO.OUT)\nself.ser = serial.Serial('/dev/ttyAMA0', 115200, timeout=0)\nlogger.info('GPIO and serial set up')\nself.power_toggle()\ntime.sleep(10)\nif 'IIII' not in self.ser.read(size=self.ser.in_waiting):...
<|body_start_0|> logger.info('Init SIM900') logger.info('Setup GPIO and serial...') GPIO.setmode(GPIO.BOARD) GPIO.setup(11, GPIO.OUT) self.ser = serial.Serial('/dev/ttyAMA0', 115200, timeout=0) logger.info('GPIO and serial set up') self.power_toggle() time...
SIM900 GSM Module class. This class controls the GSM module (SIM900) interfaces via physical serial and GPIO ports on the single-board computer.
SIM900
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SIM900: """SIM900 GSM Module class. This class controls the GSM module (SIM900) interfaces via physical serial and GPIO ports on the single-board computer.""" def __init__(self): """SIM900 Constructor. Sets up GPIO, serial connection, turns on board and performs initial SIM900 config...
stack_v2_sparse_classes_75kplus_train_066419
4,673
no_license
[ { "docstring": "SIM900 Constructor. Sets up GPIO, serial connection, turns on board and performs initial SIM900 config.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "SIM900 Destructor. Closes the serial connection, turns off SIM900 board, and cleans up GPIO.", "n...
6
null
Implement the Python class `SIM900` described below. Class description: SIM900 GSM Module class. This class controls the GSM module (SIM900) interfaces via physical serial and GPIO ports on the single-board computer. Method signatures and docstrings: - def __init__(self): SIM900 Constructor. Sets up GPIO, serial conn...
Implement the Python class `SIM900` described below. Class description: SIM900 GSM Module class. This class controls the GSM module (SIM900) interfaces via physical serial and GPIO ports on the single-board computer. Method signatures and docstrings: - def __init__(self): SIM900 Constructor. Sets up GPIO, serial conn...
21d18ce93dfb0d3a22c41c3197f108286b1b6516
<|skeleton|> class SIM900: """SIM900 GSM Module class. This class controls the GSM module (SIM900) interfaces via physical serial and GPIO ports on the single-board computer.""" def __init__(self): """SIM900 Constructor. Sets up GPIO, serial connection, turns on board and performs initial SIM900 config...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SIM900: """SIM900 GSM Module class. This class controls the GSM module (SIM900) interfaces via physical serial and GPIO ports on the single-board computer.""" def __init__(self): """SIM900 Constructor. Sets up GPIO, serial connection, turns on board and performs initial SIM900 config.""" ...
the_stack_v2_python_sparse
bin/classes/sim900.py
JamesMarcogliese/SMS-Info-System
train
2
a71ad51d88bfae413fde03cd4c074b7a530efffe
[ "startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('yjunchoi_yzhang71', 'yjunchoi_yzhang71')\nrepo.dropCollection('bostonPopulation')\nrepo.createCollection('bostonPopulation')\nurl = 'http://datamechanics.io/data/yjunchoi_yzhang71/BostonPopulation.csv'\n...
<|body_start_0|> startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('yjunchoi_yzhang71', 'yjunchoi_yzhang71') repo.dropCollection('bostonPopulation') repo.createCollection('bostonPopulation') url = 'http://d...
bostonPopulation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class bostonPopulation: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyth...
stack_v2_sparse_classes_75kplus_train_066420
3,670
no_license
[ { "docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).", "name": "execute", "signature": "def execute(trial=False)" }, { "docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d...
2
stack_v2_sparse_classes_30k_train_053522
Implement the Python class `bostonPopulation` described below. Class description: Implement the bostonPopulation class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=N...
Implement the Python class `bostonPopulation` described below. Class description: Implement the bostonPopulation class. Method signatures and docstrings: - def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity). - def provenance(doc=prov.model.ProvDocument(), startTime=N...
97e72731ffadbeae57d7a332decd58706e7c08de
<|skeleton|> class bostonPopulation: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" <|body_0|> def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): """Create the provenance document describing everyth...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class bostonPopulation: def execute(trial=False): """Retrieve some data sets (not using the API here for the sake of simplicity).""" startTime = datetime.datetime.now() client = dml.pymongo.MongoClient() repo = client.repo repo.authenticate('yjunchoi_yzhang71', 'yjunchoi_yzha...
the_stack_v2_python_sparse
yjunchoi_yzhang71/bostonPopulation.py
ROODAY/course-2017-fal-proj
train
3
83a25ab7da4f5906a969e864b9ab01335a568bf0
[ "self.__config = Config.get_config()\nself.__logger = Logger.get_logger(__name__)\nself.wav_file = self.__config.get('audio.wav_file') or self.__default_wav_file\nself.flac_file = self.__config.get('audio.flac_file') or self.__default_flac_file\nself.record_seconds = self.__config.get('audio.record_seconds') or sel...
<|body_start_0|> self.__config = Config.get_config() self.__logger = Logger.get_logger(__name__) self.wav_file = self.__config.get('audio.wav_file') or self.__default_wav_file self.flac_file = self.__config.get('audio.flac_file') or self.__default_flac_file self.record_seconds = ...
AudioSource class for Armando platform @depend: arecord (ALSA record), in order to record the audio. Yes, I used Pyaudio before, but the other apps using Pyaudio were then systematically breaking their audio stack after I used this code. You can anyway customize your audio recording app through audio.record_cmd config ...
AudioSource
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AudioSource: """AudioSource class for Armando platform @depend: arecord (ALSA record), in order to record the audio. Yes, I used Pyaudio before, but the other apps using Pyaudio were then systematically breaking their audio stack after I used this code. You can anyway customize your audio recordi...
stack_v2_sparse_classes_75kplus_train_066421
3,510
permissive
[ { "docstring": "self.wav_file -- From config [audio.wav_file] or __TMPDIR__/audio.wav self.flac_file -- From config[audio.flac_file] or __TMPDIR__/audio.flac self.record_seconds -- From config[audio.record_seconds] or 3 self.record_cmd -- From config[audio.record_cmd] or `arecord -f cd -t wav -d self.record_sec...
3
stack_v2_sparse_classes_30k_train_017512
Implement the Python class `AudioSource` described below. Class description: AudioSource class for Armando platform @depend: arecord (ALSA record), in order to record the audio. Yes, I used Pyaudio before, but the other apps using Pyaudio were then systematically breaking their audio stack after I used this code. You ...
Implement the Python class `AudioSource` described below. Class description: AudioSource class for Armando platform @depend: arecord (ALSA record), in order to record the audio. Yes, I used Pyaudio before, but the other apps using Pyaudio were then systematically breaking their audio stack after I used this code. You ...
8c9e66d8fe1dc8fa083d5b849e84b63d18394ec0
<|skeleton|> class AudioSource: """AudioSource class for Armando platform @depend: arecord (ALSA record), in order to record the audio. Yes, I used Pyaudio before, but the other apps using Pyaudio were then systematically breaking their audio stack after I used this code. You can anyway customize your audio recordi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AudioSource: """AudioSource class for Armando platform @depend: arecord (ALSA record), in order to record the audio. Yes, I used Pyaudio before, but the other apps using Pyaudio were then systematically breaking their audio stack after I used this code. You can anyway customize your audio recording app throug...
the_stack_v2_python_sparse
lib/audiosource.py
BlackLight/Armando
train
4
6642e5427bc290a1da0112bad4574625708c2b3c
[ "if n == 0:\n return 0\nif n == 1:\n return 1\nreturn self.fib(n - 1) + self.fib(n - 2)", "if n < 2:\n return n\nlookup_table = [-1] * (n + 1)\nlookup_table[0] = 0\nlookup_table[1] = 1\n\ndef helper(n, t):\n if t[n] == -1:\n t[n] = helper(n - 1, t) + helper(n - 2, t)\n return t[n]\nhelper(n,...
<|body_start_0|> if n == 0: return 0 if n == 1: return 1 return self.fib(n - 1) + self.fib(n - 2) <|end_body_0|> <|body_start_1|> if n < 2: return n lookup_table = [-1] * (n + 1) lookup_table[0] = 0 lookup_table[1] = 1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def fib(self, n): """Basic recursion implementation :type N: int :rtype: int""" <|body_0|> def fib2(self, n): """Optimize with a lookup table.""" <|body_1|> <|end_skeleton|> <|body_start_0|> if n == 0: return 0 if n == ...
stack_v2_sparse_classes_75kplus_train_066422
752
no_license
[ { "docstring": "Basic recursion implementation :type N: int :rtype: int", "name": "fib", "signature": "def fib(self, n)" }, { "docstring": "Optimize with a lookup table.", "name": "fib2", "signature": "def fib2(self, n)" } ]
2
stack_v2_sparse_classes_30k_train_034608
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib(self, n): Basic recursion implementation :type N: int :rtype: int - def fib2(self, n): Optimize with a lookup table.
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def fib(self, n): Basic recursion implementation :type N: int :rtype: int - def fib2(self, n): Optimize with a lookup table. <|skeleton|> class Solution: def fib(self, n): ...
c14d8829c95f61ff6691816e8c0de76b9319f389
<|skeleton|> class Solution: def fib(self, n): """Basic recursion implementation :type N: int :rtype: int""" <|body_0|> def fib2(self, n): """Optimize with a lookup table.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def fib(self, n): """Basic recursion implementation :type N: int :rtype: int""" if n == 0: return 0 if n == 1: return 1 return self.fib(n - 1) + self.fib(n - 2) def fib2(self, n): """Optimize with a lookup table.""" if n < ...
the_stack_v2_python_sparse
easy/fibonacci-number/solution.py
hsuanhauliu/leetcode-solutions
train
0
f5af8fe9091827cb53ddc9e62a55466d1c5d2ca3
[ "super().__init__(n_arms, batch_size)\nif not isinstance(alpha, float):\n raise TypeError('alpha must be a float.')\nif not isinstance(beta, float):\n raise TypeError('beta must be a float.')\nassert alpha >= 0, 'alpha must be a non-negative value'\nassert beta >= 0, 'beta must be a non-negative value'\nself....
<|body_start_0|> super().__init__(n_arms, batch_size) if not isinstance(alpha, float): raise TypeError('alpha must be a float.') if not isinstance(beta, float): raise TypeError('beta must be a float.') assert alpha >= 0, 'alpha must be a non-negative value' ...
Bernoulli Thompson Sampling.
ThompsonSampling
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ThompsonSampling: """Bernoulli Thompson Sampling.""" def __init__(self, n_arms: int, alpha: float=1.0, beta: float=1.0, batch_size: int=1) -> None: """Initialize class. Parameters ---------- n_arms: int The number of given bandit arms. alpha: float (default=1.0) Hyperparameter alpha ...
stack_v2_sparse_classes_75kplus_train_066423
10,532
permissive
[ { "docstring": "Initialize class. Parameters ---------- n_arms: int The number of given bandit arms. alpha: float (default=1.0) Hyperparameter alpha for beta distribution. beta: float (default=1.0) Hyperparameter beta for beta distribution. batch_size: int, optional (default=1) The number of data given in each ...
3
null
Implement the Python class `ThompsonSampling` described below. Class description: Bernoulli Thompson Sampling. Method signatures and docstrings: - def __init__(self, n_arms: int, alpha: float=1.0, beta: float=1.0, batch_size: int=1) -> None: Initialize class. Parameters ---------- n_arms: int The number of given band...
Implement the Python class `ThompsonSampling` described below. Class description: Bernoulli Thompson Sampling. Method signatures and docstrings: - def __init__(self, n_arms: int, alpha: float=1.0, beta: float=1.0, batch_size: int=1) -> None: Initialize class. Parameters ---------- n_arms: int The number of given band...
8c5dd1496efa662cc636024cc49e2fd374a3daa5
<|skeleton|> class ThompsonSampling: """Bernoulli Thompson Sampling.""" def __init__(self, n_arms: int, alpha: float=1.0, beta: float=1.0, batch_size: int=1) -> None: """Initialize class. Parameters ---------- n_arms: int The number of given bandit arms. alpha: float (default=1.0) Hyperparameter alpha ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ThompsonSampling: """Bernoulli Thompson Sampling.""" def __init__(self, n_arms: int, alpha: float=1.0, beta: float=1.0, batch_size: int=1) -> None: """Initialize class. Parameters ---------- n_arms: int The number of given bandit arms. alpha: float (default=1.0) Hyperparameter alpha for beta dist...
the_stack_v2_python_sparse
multi_armed_bandit/pymab/policy/stochastic.py
smn-ailab/ysaito-qiita
train
15
1cc0e9e621c42e13d9cdcd29c0e3ee39caeece4d
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ConversationThread()", "from .entity import Entity\nfrom .post import Post\nfrom .recipient import Recipient\nfrom .entity import Entity\nfrom .post import Post\nfrom .recipient import Recipient\nfields: Dict[str, Callable[[Any], None]...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return ConversationThread() <|end_body_0|> <|body_start_1|> from .entity import Entity from .post import Post from .recipient import Recipient from .entity import Entity ...
ConversationThread
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConversationThread: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConversationThread: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje...
stack_v2_sparse_classes_75kplus_train_066424
4,784
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ConversationThread", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_...
3
stack_v2_sparse_classes_30k_train_042540
Implement the Python class `ConversationThread` described below. Class description: Implement the ConversationThread class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConversationThread: Creates a new instance of the appropriate class based on disc...
Implement the Python class `ConversationThread` described below. Class description: Implement the ConversationThread class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConversationThread: Creates a new instance of the appropriate class based on disc...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class ConversationThread: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConversationThread: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConversationThread: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ConversationThread: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Co...
the_stack_v2_python_sparse
msgraph/generated/models/conversation_thread.py
microsoftgraph/msgraph-sdk-python
train
135
03fedf4180726a174da55b039f877d81956c5ef0
[ "if not head:\n return head\nresult = ListNode(head.val)\nwhile head.next:\n result = self.__InsertNode(ListNode(head.next.val), 0, result)\n head = head.next\nreturn result", "headNode.next = None\nif headNode.val > ListNode.val:\n if ListNode.next:\n self.__InsertNode(headNode, ListNode, List...
<|body_start_0|> if not head: return head result = ListNode(head.val) while head.next: result = self.__InsertNode(ListNode(head.next.val), 0, result) head = head.next return result <|end_body_0|> <|body_start_1|> headNode.next = None i...
链表插入排序实现
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """链表插入排序实现""" def sortList(self, head): """插入排序""" <|body_0|> def __InsertNode(self, headNode, FormerNode, ListNode): """节点插入有序链表""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not head: return head result = Li...
stack_v2_sparse_classes_75kplus_train_066425
1,855
no_license
[ { "docstring": "插入排序", "name": "sortList", "signature": "def sortList(self, head)" }, { "docstring": "节点插入有序链表", "name": "__InsertNode", "signature": "def __InsertNode(self, headNode, FormerNode, ListNode)" } ]
2
stack_v2_sparse_classes_30k_train_048380
Implement the Python class `Solution` described below. Class description: 链表插入排序实现 Method signatures and docstrings: - def sortList(self, head): 插入排序 - def __InsertNode(self, headNode, FormerNode, ListNode): 节点插入有序链表
Implement the Python class `Solution` described below. Class description: 链表插入排序实现 Method signatures and docstrings: - def sortList(self, head): 插入排序 - def __InsertNode(self, headNode, FormerNode, ListNode): 节点插入有序链表 <|skeleton|> class Solution: """链表插入排序实现""" def sortList(self, head): """插入排序""" ...
a53abd7ae0c85543d878ac8284142c7b5bade14e
<|skeleton|> class Solution: """链表插入排序实现""" def sortList(self, head): """插入排序""" <|body_0|> def __InsertNode(self, headNode, FormerNode, ListNode): """节点插入有序链表""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: """链表插入排序实现""" def sortList(self, head): """插入排序""" if not head: return head result = ListNode(head.val) while head.next: result = self.__InsertNode(ListNode(head.next.val), 0, result) head = head.next return result ...
the_stack_v2_python_sparse
147_insertionSortList.py
SimmyZhong/leetCode
train
1
0ca5a3845c3a2de45d9941f7d72bd5c137d3732c
[ "login_error = HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail='用户名或者密码错误', headers={'WWW-Authenticate': 'Bearer'})\nuser = UserModel.get_user_by_email(data.username, sc=self.session)\nif not user:\n user = UserModel.get_user_by_username(data.username, sc=self.session)\nif not user:\n user = Us...
<|body_start_0|> login_error = HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail='用户名或者密码错误', headers={'WWW-Authenticate': 'Bearer'}) user = UserModel.get_user_by_email(data.username, sc=self.session) if not user: user = UserModel.get_user_by_username(data.username, sc=s...
UserView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserView: async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db)): """登陆用的接口""" <|body_0|> async def create_user(self, data: schema.UserSchema) -> schema.UserSchema: """创建用户用的接口""" <|body_1|> async def ...
stack_v2_sparse_classes_75kplus_train_066426
8,560
no_license
[ { "docstring": "登陆用的接口", "name": "login", "signature": "async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db))" }, { "docstring": "创建用户用的接口", "name": "create_user", "signature": "async def create_user(self, data: schema.UserSchema) -> ...
3
stack_v2_sparse_classes_30k_train_045542
Implement the Python class `UserView` described below. Class description: Implement the UserView class. Method signatures and docstrings: - async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db)): 登陆用的接口 - async def create_user(self, data: schema.UserSchema) -> sche...
Implement the Python class `UserView` described below. Class description: Implement the UserView class. Method signatures and docstrings: - async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db)): 登陆用的接口 - async def create_user(self, data: schema.UserSchema) -> sche...
a2c4a4d3bc71b767cfa9e99f0c8c2b2a1995a9f6
<|skeleton|> class UserView: async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db)): """登陆用的接口""" <|body_0|> async def create_user(self, data: schema.UserSchema) -> schema.UserSchema: """创建用户用的接口""" <|body_1|> async def ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class UserView: async def login(self, data: OAuth2PasswordRequestForm=Depends(), session: Session=Depends(get_fast_api_db)): """登陆用的接口""" login_error = HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail='用户名或者密码错误', headers={'WWW-Authenticate': 'Bearer'}) user = UserModel.get_use...
the_stack_v2_python_sparse
web/users_api.py
webclinic017/aibitgo
train
2
43575dfc35a1126da1f1dca560d4068e6056eb9f
[ "if not s or int(s[0]) == 0:\n return 0\nif len(s) == 1:\n return 1\nelse:\n v_1 = int(s[1])\n v_2 = int(s[:2])\n if v_1 == 0:\n if v_2 > 20:\n return 0\n else:\n dp = [1, 1]\n elif v_2 <= 26:\n dp = [1, 2]\n else:\n dp = [1, 1]\nfor i in xrange...
<|body_start_0|> if not s or int(s[0]) == 0: return 0 if len(s) == 1: return 1 else: v_1 = int(s[1]) v_2 = int(s[:2]) if v_1 == 0: if v_2 > 20: return 0 else: dp = ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def numDecodings(self, s): """:type s: str :rtype: int""" <|body_0|> def numDecodings2(self, s): """:type s: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not s or int(s[0]) == 0: return 0 if len(s)...
stack_v2_sparse_classes_75kplus_train_066427
2,506
no_license
[ { "docstring": ":type s: str :rtype: int", "name": "numDecodings", "signature": "def numDecodings(self, s)" }, { "docstring": ":type s: str :rtype: int", "name": "numDecodings2", "signature": "def numDecodings2(self, s)" } ]
2
stack_v2_sparse_classes_30k_train_000183
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def numDecodings(self, s): :type s: str :rtype: int - def numDecodings2(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 numDecodings(self, s): :type s: str :rtype: int - def numDecodings2(self, s): :type s: str :rtype: int <|skeleton|> class Solution: def numDecodings(self, s): "...
db2d0b05020a1fcb9f0cfaf9386f79daeaad759e
<|skeleton|> class Solution: def numDecodings(self, s): """:type s: str :rtype: int""" <|body_0|> def numDecodings2(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 numDecodings(self, s): """:type s: str :rtype: int""" if not s or int(s[0]) == 0: return 0 if len(s) == 1: return 1 else: v_1 = int(s[1]) v_2 = int(s[:2]) if v_1 == 0: if v_2 > 20: ...
the_stack_v2_python_sparse
leetcode/dynamic_programming/91_num_decodings.py
longgb246/MLlearn
train
0
f6f23296142a431494ac18419725f223bef9293b
[ "super().__init__(**kwargs)\nself.template_name = 'chat/chat.html'\nself.context = self.get_menu_context('messages', 'Чаты')", "self.context['pagename'] = 'Чаты'\nc_user = request.user\nself.context['c_user'] = c_user\nchats = c_user.profile.chats.all().order_by('-messages__date')\nself.context['chats'] = list(di...
<|body_start_0|> super().__init__(**kwargs) self.template_name = 'chat/chat.html' self.context = self.get_menu_context('messages', 'Чаты') <|end_body_0|> <|body_start_1|> self.context['pagename'] = 'Чаты' c_user = request.user self.context['c_user'] = c_user chat...
Chat list view
ChatList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ChatList: """Chat list view""" def __init__(self, **kwargs) -> None: """ChatList ctor :param kwargs: kwargs""" <|body_0|> def get(self, request) -> render: """Processing get request :param request: request :return: render""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_066428
14,654
no_license
[ { "docstring": "ChatList ctor :param kwargs: kwargs", "name": "__init__", "signature": "def __init__(self, **kwargs) -> None" }, { "docstring": "Processing get request :param request: request :return: render", "name": "get", "signature": "def get(self, request) -> render" } ]
2
stack_v2_sparse_classes_30k_train_015228
Implement the Python class `ChatList` described below. Class description: Chat list view Method signatures and docstrings: - def __init__(self, **kwargs) -> None: ChatList ctor :param kwargs: kwargs - def get(self, request) -> render: Processing get request :param request: request :return: render
Implement the Python class `ChatList` described below. Class description: Chat list view Method signatures and docstrings: - def __init__(self, **kwargs) -> None: ChatList ctor :param kwargs: kwargs - def get(self, request) -> render: Processing get request :param request: request :return: render <|skeleton|> class ...
bd09175509f6d184862fc7695b99cf6c676d9c14
<|skeleton|> class ChatList: """Chat list view""" def __init__(self, **kwargs) -> None: """ChatList ctor :param kwargs: kwargs""" <|body_0|> def get(self, request) -> render: """Processing get request :param request: request :return: render""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ChatList: """Chat list view""" def __init__(self, **kwargs) -> None: """ChatList ctor :param kwargs: kwargs""" super().__init__(**kwargs) self.template_name = 'chat/chat.html' self.context = self.get_menu_context('messages', 'Чаты') def get(self, request) -> render: ...
the_stack_v2_python_sparse
meta_social/apps/chat/views.py
freng35/social_network
train
0
b50bc4c089ecf59773f79a7df170a8b19574028e
[ "if canAppAccessDatabase():\n self.generate_part_thumbnails()\n self.update_trackable_status()", "from .models import Part\nlogger.debug('InvenTree: Checking Part image thumbnails')\ntry:\n for part in Part.objects.exclude(image=None):\n if part.image:\n url = part.image.thumbnail.name\...
<|body_start_0|> if canAppAccessDatabase(): self.generate_part_thumbnails() self.update_trackable_status() <|end_body_0|> <|body_start_1|> from .models import Part logger.debug('InvenTree: Checking Part image thumbnails') try: for part in Part.objects...
PartConfig
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PartConfig: def ready(self): """This function is called whenever the Part app is loaded.""" <|body_0|> def generate_part_thumbnails(self): """Generate thumbnail images for any Part that does not have one. This function exists mainly for legacy support, as any *new* i...
stack_v2_sparse_classes_75kplus_train_066429
2,687
permissive
[ { "docstring": "This function is called whenever the Part app is loaded.", "name": "ready", "signature": "def ready(self)" }, { "docstring": "Generate thumbnail images for any Part that does not have one. This function exists mainly for legacy support, as any *new* image uploaded will have a thu...
3
stack_v2_sparse_classes_30k_train_027521
Implement the Python class `PartConfig` described below. Class description: Implement the PartConfig class. Method signatures and docstrings: - def ready(self): This function is called whenever the Part app is loaded. - def generate_part_thumbnails(self): Generate thumbnail images for any Part that does not have one....
Implement the Python class `PartConfig` described below. Class description: Implement the PartConfig class. Method signatures and docstrings: - def ready(self): This function is called whenever the Part app is loaded. - def generate_part_thumbnails(self): Generate thumbnail images for any Part that does not have one....
2a0ea66f6591756eeb62da28d24daec3ad4209e8
<|skeleton|> class PartConfig: def ready(self): """This function is called whenever the Part app is loaded.""" <|body_0|> def generate_part_thumbnails(self): """Generate thumbnail images for any Part that does not have one. This function exists mainly for legacy support, as any *new* i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PartConfig: def ready(self): """This function is called whenever the Part app is loaded.""" if canAppAccessDatabase(): self.generate_part_thumbnails() self.update_trackable_status() def generate_part_thumbnails(self): """Generate thumbnail images for any Pa...
the_stack_v2_python_sparse
InvenTree/part/apps.py
MedShift/InvenTree
train
0
896b24452e5940d52efd94a4bd14d067d67d32be
[ "if not exactly_one(directory_uri, file_uri):\n raise ETLInputError('One of file_uri or directory_uri needed')\nsuper(ExtractS3Step, self).__init__(**kwargs)\nif directory_uri:\n directory_uri = get_modified_s3_path(directory_uri)\n s3_path = S3Path(uri=directory_uri, is_directory=True)\nelse:\n file_ur...
<|body_start_0|> if not exactly_one(directory_uri, file_uri): raise ETLInputError('One of file_uri or directory_uri needed') super(ExtractS3Step, self).__init__(**kwargs) if directory_uri: directory_uri = get_modified_s3_path(directory_uri) s3_path = S3Path(ur...
ExtractS3 Step class that helps get data from S3
ExtractS3Step
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ExtractS3Step: """ExtractS3 Step class that helps get data from S3""" def __init__(self, directory_uri=None, file_uri=None, **kwargs): """Constructor for the ExtractS3Step class Args: directory_uri(str): s3 path for s3 data directory file_uri(str): s3 path for s3 data file **kwargs(o...
stack_v2_sparse_classes_75kplus_train_066430
1,733
permissive
[ { "docstring": "Constructor for the ExtractS3Step class Args: directory_uri(str): s3 path for s3 data directory file_uri(str): s3 path for s3 data file **kwargs(optional): Keyword arguments directly passed to base class", "name": "__init__", "signature": "def __init__(self, directory_uri=None, file_uri=...
2
stack_v2_sparse_classes_30k_train_032637
Implement the Python class `ExtractS3Step` described below. Class description: ExtractS3 Step class that helps get data from S3 Method signatures and docstrings: - def __init__(self, directory_uri=None, file_uri=None, **kwargs): Constructor for the ExtractS3Step class Args: directory_uri(str): s3 path for s3 data dir...
Implement the Python class `ExtractS3Step` described below. Class description: ExtractS3 Step class that helps get data from S3 Method signatures and docstrings: - def __init__(self, directory_uri=None, file_uri=None, **kwargs): Constructor for the ExtractS3Step class Args: directory_uri(str): s3 path for s3 data dir...
797cb719e6c2abeda0751ada3339c72bfb19c8f2
<|skeleton|> class ExtractS3Step: """ExtractS3 Step class that helps get data from S3""" def __init__(self, directory_uri=None, file_uri=None, **kwargs): """Constructor for the ExtractS3Step class Args: directory_uri(str): s3 path for s3 data directory file_uri(str): s3 path for s3 data file **kwargs(o...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ExtractS3Step: """ExtractS3 Step class that helps get data from S3""" def __init__(self, directory_uri=None, file_uri=None, **kwargs): """Constructor for the ExtractS3Step class Args: directory_uri(str): s3 path for s3 data directory file_uri(str): s3 path for s3 data file **kwargs(optional): Key...
the_stack_v2_python_sparse
dataduct/steps/extract_s3.py
EverFi/dataduct
train
3
6f9ff68b4f80ab7936346f58065c57756ea9ab4d
[ "self.fets_eval = FETS2D58H(mats_eval=self.mats_eval)\nsupport_slices = [[(0, slice(None), slice(None), 0, slice(None), slice(None))], [(slice(None), 0, slice(None), slice(None), 0, slice(None))]]\nsupport_dirs = [[0, 1, 2]]\nloading_slices = [(-1, slice(None), slice(None), -1, slice(None), slice(None)), (slice(Non...
<|body_start_0|> self.fets_eval = FETS2D58H(mats_eval=self.mats_eval) support_slices = [[(0, slice(None), slice(None), 0, slice(None), slice(None))], [(slice(None), 0, slice(None), slice(None), 0, slice(None))]] support_dirs = [[0, 1, 2]] loading_slices = [(-1, slice(None), slice(None), ...
TestMATS2D5
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMATS2D5: def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001): """Assert that the symmetry is given for the applied loadings.""" <|body_0|> def assert_stress_value(self, sig_expected, n_steps=3, load=0.0001): """Assert that the symmetry is given for t...
stack_v2_sparse_classes_75kplus_train_066431
4,336
no_license
[ { "docstring": "Assert that the symmetry is given for the applied loadings.", "name": "assert_2D_symmetry_clamped_cube", "signature": "def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001)" }, { "docstring": "Assert that the symmetry is given for the applied loadings.", "name": "a...
2
stack_v2_sparse_classes_30k_train_006752
Implement the Python class `TestMATS2D5` described below. Class description: Implement the TestMATS2D5 class. Method signatures and docstrings: - def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001): Assert that the symmetry is given for the applied loadings. - def assert_stress_value(self, sig_expected, ...
Implement the Python class `TestMATS2D5` described below. Class description: Implement the TestMATS2D5 class. Method signatures and docstrings: - def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001): Assert that the symmetry is given for the applied loadings. - def assert_stress_value(self, sig_expected, ...
00de9f0eec52835d839a3c6c1407cac11a496339
<|skeleton|> class TestMATS2D5: def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001): """Assert that the symmetry is given for the applied loadings.""" <|body_0|> def assert_stress_value(self, sig_expected, n_steps=3, load=0.0001): """Assert that the symmetry is given for t...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestMATS2D5: def assert_2D_symmetry_clamped_cube(self, load_dirs, load=0.001): """Assert that the symmetry is given for the applied loadings.""" self.fets_eval = FETS2D58H(mats_eval=self.mats_eval) support_slices = [[(0, slice(None), slice(None), 0, slice(None), slice(None))], [(slice(...
the_stack_v2_python_sparse
ibvpy/mats/mats2D5/__test__.py
simvisage/bmcs
train
1
6cc54b408670b3dc76af5fcda160fdbd1a186c17
[ "if not request.user.is_authenticated:\n return JsonResponse({'error': 'unauthorized'}, status=401)\nlogout(request)\nreturn JsonResponse({})", "form = AuthenticationForm(request, data=json.loads(request.body.decode('utf8')))\nif form.is_valid():\n if not form.get_user().is_staff:\n return JsonRespon...
<|body_start_0|> if not request.user.is_authenticated: return JsonResponse({'error': 'unauthorized'}, status=401) logout(request) return JsonResponse({}) <|end_body_0|> <|body_start_1|> form = AuthenticationForm(request, data=json.loads(request.body.decode('utf8'))) ...
This set of views allows users to log in and out using HTTP sessions.
SessionLoginView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SessionLoginView: """This set of views allows users to log in and out using HTTP sessions.""" def delete(self, request, *args, **kwargs): """Log the user out. :param request: request that was made :return: 200 OK or 401 if unauthorized""" <|body_0|> def post(self, reques...
stack_v2_sparse_classes_75kplus_train_066432
2,629
no_license
[ { "docstring": "Log the user out. :param request: request that was made :return: 200 OK or 401 if unauthorized", "name": "delete", "signature": "def delete(self, request, *args, **kwargs)" }, { "docstring": "Log a user in. :param request: request that was made :return: \"\", 200 on success, else...
2
null
Implement the Python class `SessionLoginView` described below. Class description: This set of views allows users to log in and out using HTTP sessions. Method signatures and docstrings: - def delete(self, request, *args, **kwargs): Log the user out. :param request: request that was made :return: 200 OK or 401 if unau...
Implement the Python class `SessionLoginView` described below. Class description: This set of views allows users to log in and out using HTTP sessions. Method signatures and docstrings: - def delete(self, request, *args, **kwargs): Log the user out. :param request: request that was made :return: 200 OK or 401 if unau...
38f0b29e6fc737756ae21a8c193a110876bc221c
<|skeleton|> class SessionLoginView: """This set of views allows users to log in and out using HTTP sessions.""" def delete(self, request, *args, **kwargs): """Log the user out. :param request: request that was made :return: 200 OK or 401 if unauthorized""" <|body_0|> def post(self, reques...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SessionLoginView: """This set of views allows users to log in and out using HTTP sessions.""" def delete(self, request, *args, **kwargs): """Log the user out. :param request: request that was made :return: 200 OK or 401 if unauthorized""" if not request.user.is_authenticated: ...
the_stack_v2_python_sparse
backend/auth/views.py
BenjaminSchubert/HEIG_VD_2016_PDG
train
0
d9759875632d617e5d57a7ed4fbb2a687ae72ba2
[ "self.smartplug = smartplug\nself.state: str | None = None\nself.temperature: str = ''\nself.current_consumption: str = ''\nself.total_consumption: str = ''\nself.available = False\nself._n_tried = 0\nself._last_tried: datetime | None = None", "if self._last_tried is not None:\n last_try_s = (dt_util.now() - s...
<|body_start_0|> self.smartplug = smartplug self.state: str | None = None self.temperature: str = '' self.current_consumption: str = '' self.total_consumption: str = '' self.available = False self._n_tried = 0 self._last_tried: datetime | None = None <|end...
Get the latest data from smart plug.
SmartPlugData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SmartPlugData: """Get the latest data from smart plug.""" def __init__(self, smartplug: SmartPlug) -> None: """Initialize the data object.""" <|body_0|> def update(self) -> None: """Get the latest data from the smart plug.""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_066433
1,841
permissive
[ { "docstring": "Initialize the data object.", "name": "__init__", "signature": "def __init__(self, smartplug: SmartPlug) -> None" }, { "docstring": "Get the latest data from the smart plug.", "name": "update", "signature": "def update(self) -> None" } ]
2
stack_v2_sparse_classes_30k_train_017428
Implement the Python class `SmartPlugData` described below. Class description: Get the latest data from smart plug. Method signatures and docstrings: - def __init__(self, smartplug: SmartPlug) -> None: Initialize the data object. - def update(self) -> None: Get the latest data from the smart plug.
Implement the Python class `SmartPlugData` described below. Class description: Get the latest data from smart plug. Method signatures and docstrings: - def __init__(self, smartplug: SmartPlug) -> None: Initialize the data object. - def update(self) -> None: Get the latest data from the smart plug. <|skeleton|> class...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SmartPlugData: """Get the latest data from smart plug.""" def __init__(self, smartplug: SmartPlug) -> None: """Initialize the data object.""" <|body_0|> def update(self) -> None: """Get the latest data from the smart plug.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SmartPlugData: """Get the latest data from smart plug.""" def __init__(self, smartplug: SmartPlug) -> None: """Initialize the data object.""" self.smartplug = smartplug self.state: str | None = None self.temperature: str = '' self.current_consumption: str = '' ...
the_stack_v2_python_sparse
homeassistant/components/dlink/data.py
home-assistant/core
train
35,501
e53807b369cddd611d3192e2f2e6863fd1a56c77
[ "o.type = self.visit_type(o.type)\nif o.value is not None:\n self.visit_iHdlExr(o.value)", "t, array_dims = collect_array_dims(t)\nwire_params = get_wire_t_params(t)\nif wire_params is None:\n if t == HdlTypeAuto:\n t = BitsT(1)\nelse:\n base_t, width, is_signed, _ = wire_params\n if width is N...
<|body_start_0|> o.type = self.visit_type(o.type) if o.value is not None: self.visit_iHdlExr(o.value) <|end_body_0|> <|body_start_1|> t, array_dims = collect_array_dims(t) wire_params = get_wire_t_params(t) if wire_params is None: if t == HdlTypeAuto: ...
Translate Verilog HDL types to BasicHdlSimModel HDL types
VerilogTypesToBasicHdlSimModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VerilogTypesToBasicHdlSimModel: """Translate Verilog HDL types to BasicHdlSimModel HDL types""" def visit_HdlIdDef(self, o): """:type o: HdlIdDef""" <|body_0|> def visit_type(self, t): """:type t: iHdlExpr""" <|body_1|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_75kplus_train_066434
1,147
permissive
[ { "docstring": ":type o: HdlIdDef", "name": "visit_HdlIdDef", "signature": "def visit_HdlIdDef(self, o)" }, { "docstring": ":type t: iHdlExpr", "name": "visit_type", "signature": "def visit_type(self, t)" } ]
2
stack_v2_sparse_classes_30k_train_036406
Implement the Python class `VerilogTypesToBasicHdlSimModel` described below. Class description: Translate Verilog HDL types to BasicHdlSimModel HDL types Method signatures and docstrings: - def visit_HdlIdDef(self, o): :type o: HdlIdDef - def visit_type(self, t): :type t: iHdlExpr
Implement the Python class `VerilogTypesToBasicHdlSimModel` described below. Class description: Translate Verilog HDL types to BasicHdlSimModel HDL types Method signatures and docstrings: - def visit_HdlIdDef(self, o): :type o: HdlIdDef - def visit_type(self, t): :type t: iHdlExpr <|skeleton|> class VerilogTypesToBa...
64c8c1deee923ffae17e70e0fb1ad763cb69608c
<|skeleton|> class VerilogTypesToBasicHdlSimModel: """Translate Verilog HDL types to BasicHdlSimModel HDL types""" def visit_HdlIdDef(self, o): """:type o: HdlIdDef""" <|body_0|> def visit_type(self, t): """:type t: iHdlExpr""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VerilogTypesToBasicHdlSimModel: """Translate Verilog HDL types to BasicHdlSimModel HDL types""" def visit_HdlIdDef(self, o): """:type o: HdlIdDef""" o.type = self.visit_type(o.type) if o.value is not None: self.visit_iHdlExr(o.value) def visit_type(self, t): ...
the_stack_v2_python_sparse
hdlConvertorAst/translate/_verilog_to_basic_hdl_sim_model/verilog_types_to_basic_hdl_sim_model.py
mewais/hdlConvertorAst
train
0
38d08c3ecb09a54fb28f6e1b5f4512dda44ab6c6
[ "results = []\nurl = f'https://api.github.com/orgs/{owner}/repos?type=all'\nresponse = requests.get(url, auth=auth_tuple)\nprint(response.content)\nif response.status_code == 200:\n for row in response.json():\n results.append(row['name'])\nreturn results", "rows = []\nfor candidate in buffer:\n resu...
<|body_start_0|> results = [] url = f'https://api.github.com/orgs/{owner}/repos?type=all' response = requests.get(url, auth=auth_tuple) print(response.content) if response.status_code == 200: for row in response.json(): results.append(row['name']) ...
extract issues from a github repository
Harvester
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Harvester: """extract issues from a github repository""" def repo(self, owner, auth_tuple): """return a list of repositories :param owner: :param auth_tuple: :return:""" <|body_0|> def comment(self, buffer): """parse github issue comments :param buffer: raw comme...
stack_v2_sparse_classes_75kplus_train_066435
7,209
no_license
[ { "docstring": "return a list of repositories :param owner: :param auth_tuple: :return:", "name": "repo", "signature": "def repo(self, owner, auth_tuple)" }, { "docstring": "parse github issue comments :param buffer: raw comments :return: list of comments, might be empty", "name": "comment",...
6
stack_v2_sparse_classes_30k_train_019416
Implement the Python class `Harvester` described below. Class description: extract issues from a github repository Method signatures and docstrings: - def repo(self, owner, auth_tuple): return a list of repositories :param owner: :param auth_tuple: :return: - def comment(self, buffer): parse github issue comments :pa...
Implement the Python class `Harvester` described below. Class description: extract issues from a github repository Method signatures and docstrings: - def repo(self, owner, auth_tuple): return a list of repositories :param owner: :param auth_tuple: :return: - def comment(self, buffer): parse github issue comments :pa...
f85626112af10f2544be17772ff153cc55cf63a6
<|skeleton|> class Harvester: """extract issues from a github repository""" def repo(self, owner, auth_tuple): """return a list of repositories :param owner: :param auth_tuple: :return:""" <|body_0|> def comment(self, buffer): """parse github issue comments :param buffer: raw comme...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Harvester: """extract issues from a github repository""" def repo(self, owner, auth_tuple): """return a list of repositories :param owner: :param auth_tuple: :return:""" results = [] url = f'https://api.github.com/orgs/{owner}/repos?type=all' response = requests.get(url, a...
the_stack_v2_python_sparse
github1/github1.py
guycole/python3-lab
train
0
143c889ae692e7dae4331b39f7ed5dce16951272
[ "Pattern.__init__(self)\nself.add_argument('--pattern', type=str, default='boxes_masu')\nself.add_argument('--width', type=float, default=10.0)\nself.add_argument('--height', type=float, default=10.0)\nself.add_argument('--width_delta', type=float, default=0.0)\nself.add_argument('--width_delta_bool', type=inkex.Bo...
<|body_start_0|> Pattern.__init__(self) self.add_argument('--pattern', type=str, default='boxes_masu') self.add_argument('--width', type=float, default=10.0) self.add_argument('--height', type=float, default=10.0) self.add_argument('--width_delta', type=float, default=0.0) ...
MasuBox
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MasuBox: def __init__(self): """Constructor""" <|body_0|> def generate_path_tree(self): """Specialized path generation for your origami pattern""" <|body_1|> <|end_skeleton|> <|body_start_0|> Pattern.__init__(self) self.add_argument('--patte...
stack_v2_sparse_classes_75kplus_train_066436
4,057
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Specialized path generation for your origami pattern", "name": "generate_path_tree", "signature": "def generate_path_tree(self)" } ]
2
stack_v2_sparse_classes_30k_train_005123
Implement the Python class `MasuBox` described below. Class description: Implement the MasuBox class. Method signatures and docstrings: - def __init__(self): Constructor - def generate_path_tree(self): Specialized path generation for your origami pattern
Implement the Python class `MasuBox` described below. Class description: Implement the MasuBox class. Method signatures and docstrings: - def __init__(self): Constructor - def generate_path_tree(self): Specialized path generation for your origami pattern <|skeleton|> class MasuBox: def __init__(self): "...
739efb333570ef652ff5fcfd7b5696410e469cee
<|skeleton|> class MasuBox: def __init__(self): """Constructor""" <|body_0|> def generate_path_tree(self): """Specialized path generation for your origami pattern""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MasuBox: def __init__(self): """Constructor""" Pattern.__init__(self) self.add_argument('--pattern', type=str, default='boxes_masu') self.add_argument('--width', type=float, default=10.0) self.add_argument('--height', type=float, default=10.0) self.add_argument(...
the_stack_v2_python_sparse
OrigamiPatterns/boxes_masu.py
evbernardes/Origami_Patterns
train
9
50b07e7c84fc46f0900893e3ea4044fc0dc5cac5
[ "n = len(nums)\ndp = [0] * n\nans = nums[0]\ndp[0] = nums[0]\nfor i in range(1, n):\n dp[i] = max(dp[i - 1] + nums[i], nums[i])\n ans = max(ans, dp[i])\nreturn ans", "n = len(nums)\nprev = nums[0]\nans = nums[0]\nfor i in range(1, n):\n prev = max(prev + nums[i], nums[i])\n ans = max(ans, prev)\nretur...
<|body_start_0|> n = len(nums) dp = [0] * n ans = nums[0] dp[0] = nums[0] for i in range(1, n): dp[i] = max(dp[i - 1] + nums[i], nums[i]) ans = max(ans, dp[i]) return ans <|end_body_0|> <|body_start_1|> n = len(nums) prev = nums[0]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(nums) dp = [0] * n an...
stack_v2_sparse_classes_75kplus_train_066437
1,137
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "maxSubArray", "signature": "def maxSubArray(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_038252
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray(self, nums): :type nums: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSubArray(self, nums): :type nums: List[int] :rtype: int - def maxSubArray(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def maxSubArray...
b5c25f976866eefec33b96c638a4c5e127319e74
<|skeleton|> class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxSubArray(self, nums): """:type nums: List[int] :rtype: int""" n = len(nums) dp = [0] * n ans = nums[0] dp[0] = nums[0] for i in range(1, n): dp[i] = max(dp[i - 1] + nums[i], nums[i]) ans = max(ans, dp[i]) return a...
the_stack_v2_python_sparse
Python/053_Maximum Subarray.py
Eddie02582/Leetcode
train
1
faa69b4d569abd0831d5c39cc203e7352f3ff2eb
[ "super(RequeueJobsBulk, self).__init__('requeue_jobs_bulk')\nself.current_job_id = None\nself.started = None\nself.ended = None\nself.error_categories = None\nself.error_ids = None\nself.job_ids = None\nself.job_type_ids = None\nself.priority = None\nself.status = None\nself.job_type_names = None\nself.batch_ids = ...
<|body_start_0|> super(RequeueJobsBulk, self).__init__('requeue_jobs_bulk') self.current_job_id = None self.started = None self.ended = None self.error_categories = None self.error_ids = None self.job_ids = None self.job_type_ids = None self.priori...
Command message that performs a bulk re-queue operation
RequeueJobsBulk
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RequeueJobsBulk: """Command message that performs a bulk re-queue operation""" def __init__(self): """Constructor""" <|body_0|> def to_json(self): """See :meth:`messaging.messages.message.CommandMessage.to_json`""" <|body_1|> def from_json(json_dict)...
stack_v2_sparse_classes_75kplus_train_066438
8,523
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "See :meth:`messaging.messages.message.CommandMessage.to_json`", "name": "to_json", "signature": "def to_json(self)" }, { "docstring": "See :meth:`messaging.messages.message.Comm...
4
stack_v2_sparse_classes_30k_train_031223
Implement the Python class `RequeueJobsBulk` described below. Class description: Command message that performs a bulk re-queue operation Method signatures and docstrings: - def __init__(self): Constructor - def to_json(self): See :meth:`messaging.messages.message.CommandMessage.to_json` - def from_json(json_dict): Se...
Implement the Python class `RequeueJobsBulk` described below. Class description: Command message that performs a bulk re-queue operation Method signatures and docstrings: - def __init__(self): Constructor - def to_json(self): See :meth:`messaging.messages.message.CommandMessage.to_json` - def from_json(json_dict): Se...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class RequeueJobsBulk: """Command message that performs a bulk re-queue operation""" def __init__(self): """Constructor""" <|body_0|> def to_json(self): """See :meth:`messaging.messages.message.CommandMessage.to_json`""" <|body_1|> def from_json(json_dict)...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RequeueJobsBulk: """Command message that performs a bulk re-queue operation""" def __init__(self): """Constructor""" super(RequeueJobsBulk, self).__init__('requeue_jobs_bulk') self.current_job_id = None self.started = None self.ended = None self.error_categ...
the_stack_v2_python_sparse
scale/queue/messages/requeue_jobs_bulk.py
kfconsultant/scale
train
0
669af0a2c7cd08dc04fe9796f37b7e1c7e54006e
[ "self.min = np.array([-2.903534 for i in range(0, n)])\nself.value = -39.16599 * n\nself.domain = np.array([[-5.0, 5.0] for i in range(0, n)])\nself.n = n\nself.smooth = True\nself.info = [True, False, False]\nself.latex_name = 'Styblinski-Tang Function'\nself.latex_type = 'Other'\nself.latex_cost = '\\\\[ f(\\\\ma...
<|body_start_0|> self.min = np.array([-2.903534 for i in range(0, n)]) self.value = -39.16599 * n self.domain = np.array([[-5.0, 5.0] for i in range(0, n)]) self.n = n self.smooth = True self.info = [True, False, False] self.latex_name = 'Styblinski-Tang Function'...
Styblinski-Tang Function.
StyblinskiTang
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StyblinskiTang: """Styblinski-Tang Function.""" def __init__(self, n): """Constructor.""" <|body_0|> def cost(self, x): """Cost function.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.min = np.array([-2.903534 for i in range(0, n)]) ...
stack_v2_sparse_classes_75kplus_train_066439
1,076
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self, n)" }, { "docstring": "Cost function.", "name": "cost", "signature": "def cost(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_005978
Implement the Python class `StyblinskiTang` described below. Class description: Styblinski-Tang Function. Method signatures and docstrings: - def __init__(self, n): Constructor. - def cost(self, x): Cost function.
Implement the Python class `StyblinskiTang` described below. Class description: Styblinski-Tang Function. Method signatures and docstrings: - def __init__(self, n): Constructor. - def cost(self, x): Cost function. <|skeleton|> class StyblinskiTang: """Styblinski-Tang Function.""" def __init__(self, n): ...
f2a74df3ab01ac35ea8d80569da909ffa1e86af3
<|skeleton|> class StyblinskiTang: """Styblinski-Tang Function.""" def __init__(self, n): """Constructor.""" <|body_0|> def cost(self, x): """Cost function.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StyblinskiTang: """Styblinski-Tang Function.""" def __init__(self, n): """Constructor.""" self.min = np.array([-2.903534 for i in range(0, n)]) self.value = -39.16599 * n self.domain = np.array([[-5.0, 5.0] for i in range(0, n)]) self.n = n self.smooth = Tr...
the_stack_v2_python_sparse
ctf/functionsnd/styblinski_tang.py
cntaylor/ctf
train
1
6f3979926a7fcc962601e2867f7d6c01bc51fe5f
[ "i = 0\nfor user, msg in self._queue:\n if user == nick:\n return i\n i += 1\nreturn -1", "outfile = self.registryValue('dumpFile')\nwith open(outfile, 'w') as h:\n i = 1\n for nick, msg in self._queue:\n if msg is None:\n msg = '[no message]'\n h.write('% 2d\\t%s\\t%s\...
<|body_start_0|> i = 0 for user, msg in self._queue: if user == nick: return i i += 1 return -1 <|end_body_0|> <|body_start_1|> outfile = self.registryValue('dumpFile') with open(outfile, 'w') as h: i = 1 for nick, ...
A simple queue manager for meetings. You can add yourself to the queue by using the queue command, giving an optional notice that the bot can display when it's your turn. If you call the queue command again, you can change the saved notice. Doing so won't make you lose your queue position. In case you changed your mind...
Queue
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Queue: """A simple queue manager for meetings. You can add yourself to the queue by using the queue command, giving an optional notice that the bot can display when it's your turn. If you call the queue command again, you can change the saved notice. Doing so won't make you lose your queue positi...
stack_v2_sparse_classes_75kplus_train_066440
5,983
permissive
[ { "docstring": "Check if a given user is in the queue", "name": "_find_in_queue", "signature": "def _find_in_queue(self, nick)" }, { "docstring": "Dump the queue to a file", "name": "_dump_queue", "signature": "def _dump_queue(self)" }, { "docstring": "[<notice>] Queue up for say...
6
stack_v2_sparse_classes_30k_train_029350
Implement the Python class `Queue` described below. Class description: A simple queue manager for meetings. You can add yourself to the queue by using the queue command, giving an optional notice that the bot can display when it's your turn. If you call the queue command again, you can change the saved notice. Doing s...
Implement the Python class `Queue` described below. Class description: A simple queue manager for meetings. You can add yourself to the queue by using the queue command, giving an optional notice that the bot can display when it's your turn. If you call the queue command again, you can change the saved notice. Doing s...
656f42f8d6b3fe4544a5270e0dab816fd3603118
<|skeleton|> class Queue: """A simple queue manager for meetings. You can add yourself to the queue by using the queue command, giving an optional notice that the bot can display when it's your turn. If you call the queue command again, you can change the saved notice. Doing so won't make you lose your queue positi...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Queue: """A simple queue manager for meetings. You can add yourself to the queue by using the queue command, giving an optional notice that the bot can display when it's your turn. If you call the queue command again, you can change the saved notice. Doing so won't make you lose your queue position. In case y...
the_stack_v2_python_sparse
plugins/Queue/plugin.py
kblin/supybot-gsoc
train
2
2e72d84565769be67343915ad6aa39d8dd8fbd1c
[ "cases = [[1, 1, 1], [3, 3, 3, 3]]\nfor case in cases:\n self.assertEqual(1, fairness(case))", "cases = [[1, 0, 0], [3, 0, 0, 0]]\nfor case in cases:\n self.assertAlmostEqual(1 / float(len(case)), fairness(case))", "cases = [[2, 2, 0], [3, 0, 0, 0], [1, 1, 1, 0]]\nfor case in cases:\n lg.debug('conside...
<|body_start_0|> cases = [[1, 1, 1], [3, 3, 3, 3]] for case in cases: self.assertEqual(1, fairness(case)) <|end_body_0|> <|body_start_1|> cases = [[1, 0, 0], [3, 0, 0, 0]] for case in cases: self.assertAlmostEqual(1 / float(len(case)), fairness(case)) <|end_body_...
FairnessTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FairnessTest: def test_best(self): """Best case: equal items should have fairness of 1.""" <|body_0|> def test_worst(self): """Worst case: one nonzero item and the rest zero.""" <|body_1|> def test_mix(self): """Mixed case: should be k/n when k u...
stack_v2_sparse_classes_75kplus_train_066441
6,258
no_license
[ { "docstring": "Best case: equal items should have fairness of 1.", "name": "test_best", "signature": "def test_best(self)" }, { "docstring": "Worst case: one nonzero item and the rest zero.", "name": "test_worst", "signature": "def test_worst(self)" }, { "docstring": "Mixed case...
3
stack_v2_sparse_classes_30k_train_022427
Implement the Python class `FairnessTest` described below. Class description: Implement the FairnessTest class. Method signatures and docstrings: - def test_best(self): Best case: equal items should have fairness of 1. - def test_worst(self): Worst case: one nonzero item and the rest zero. - def test_mix(self): Mixed...
Implement the Python class `FairnessTest` described below. Class description: Implement the FairnessTest class. Method signatures and docstrings: - def test_best(self): Best case: equal items should have fairness of 1. - def test_worst(self): Worst case: one nonzero item and the rest zero. - def test_mix(self): Mixed...
c2f44c01df4a1ac220218f0a89b433a1ca76058a
<|skeleton|> class FairnessTest: def test_best(self): """Best case: equal items should have fairness of 1.""" <|body_0|> def test_worst(self): """Worst case: one nonzero item and the rest zero.""" <|body_1|> def test_mix(self): """Mixed case: should be k/n when k u...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FairnessTest: def test_best(self): """Best case: equal items should have fairness of 1.""" cases = [[1, 1, 1], [3, 3, 3, 3]] for case in cases: self.assertEqual(1, fairness(case)) def test_worst(self): """Worst case: one nonzero item and the rest zero.""" ...
the_stack_v2_python_sparse
src/test_metrics.py
weichenzhao/cpp
train
0
5a6bf207b50b90313b88e6f2a405fbb342ab257a
[ "self.exception_queue = queue.Queue()\nself.manager = OtnsManager('localhost', self.logger.getChild('OtnsManager'))\nself.grpc_client = MockGrpcClient(self.exception_queue, self.logger.getChild('MockGrpcClient'))\nself.manager.grpc_client = self.grpc_client\nself.udp_server = MockUDPServer(self.exception_queue)", ...
<|body_start_0|> self.exception_queue = queue.Queue() self.manager = OtnsManager('localhost', self.logger.getChild('OtnsManager')) self.grpc_client = MockGrpcClient(self.exception_queue, self.logger.getChild('MockGrpcClient')) self.manager.grpc_client = self.grpc_client self.udp_...
Silk test case with basic mocked OTNS and manager set up.
SilkMockingTestCase
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SilkMockingTestCase: """Silk test case with basic mocked OTNS and manager set up.""" def setUp(self): """Test method set up.""" <|body_0|> def tearDown(self): """Test method tear down. Clean up fixtures.""" <|body_1|> def wait_for_expect(self, expect...
stack_v2_sparse_classes_75kplus_train_066442
3,563
permissive
[ { "docstring": "Test method set up.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test method tear down. Clean up fixtures.", "name": "tearDown", "signature": "def tearDown(self)" }, { "docstring": "Wait for expectation to be fulfilled. Args: expect_thread ...
5
stack_v2_sparse_classes_30k_train_015611
Implement the Python class `SilkMockingTestCase` described below. Class description: Silk test case with basic mocked OTNS and manager set up. Method signatures and docstrings: - def setUp(self): Test method set up. - def tearDown(self): Test method tear down. Clean up fixtures. - def wait_for_expect(self, expect_thr...
Implement the Python class `SilkMockingTestCase` described below. Class description: Silk test case with basic mocked OTNS and manager set up. Method signatures and docstrings: - def setUp(self): Test method set up. - def tearDown(self): Test method tear down. Clean up fixtures. - def wait_for_expect(self, expect_thr...
ab7d3f96f74dd89a1517018f2619cb08190fe2f9
<|skeleton|> class SilkMockingTestCase: """Silk test case with basic mocked OTNS and manager set up.""" def setUp(self): """Test method set up.""" <|body_0|> def tearDown(self): """Test method tear down. Clean up fixtures.""" <|body_1|> def wait_for_expect(self, expect...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SilkMockingTestCase: """Silk test case with basic mocked OTNS and manager set up.""" def setUp(self): """Test method set up.""" self.exception_queue = queue.Queue() self.manager = OtnsManager('localhost', self.logger.getChild('OtnsManager')) self.grpc_client = MockGrpcClie...
the_stack_v2_python_sparse
silk/unit_tests/testcase.py
qilinkang/silk-1
train
1
3f33287eecefe78325409a694de6fc6fd0d505a0
[ "if self.request.version == 'v6':\n return RecipeTypeListSerializerV6\nelif self.request.version == 'v7':\n return RecipeTypeListSerializerV6", "if self.request.version == 'v6':\n return self.list_v6(request)\nelif self.request.version == 'v7':\n return self.list_v6(request)\nraise Http404", "keywor...
<|body_start_0|> if self.request.version == 'v6': return RecipeTypeListSerializerV6 elif self.request.version == 'v7': return RecipeTypeListSerializerV6 <|end_body_0|> <|body_start_1|> if self.request.version == 'v6': return self.list_v6(request) elif...
This view is the endpoint for retrieving the list of all recipe types
RecipeTypesView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RecipeTypesView: """This view is the endpoint for retrieving the list of all recipe types""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" <|body_0|> def list(self, request): """Retrieves ...
stack_v2_sparse_classes_75kplus_train_066443
29,952
permissive
[ { "docstring": "Returns the appropriate serializer based off the requests version of the REST API.", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Retrieves the list of all recipe types and returns it in JSON form :param request: the HTTP GET re...
5
stack_v2_sparse_classes_30k_train_035194
Implement the Python class `RecipeTypesView` described below. Class description: This view is the endpoint for retrieving the list of all recipe types Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API. - def list(self,...
Implement the Python class `RecipeTypesView` described below. Class description: This view is the endpoint for retrieving the list of all recipe types Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API. - def list(self,...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class RecipeTypesView: """This view is the endpoint for retrieving the list of all recipe types""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" <|body_0|> def list(self, request): """Retrieves ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class RecipeTypesView: """This view is the endpoint for retrieving the list of all recipe types""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API.""" if self.request.version == 'v6': return RecipeTypeListSerialize...
the_stack_v2_python_sparse
scale/recipe/views.py
kfconsultant/scale
train
0
7487e60c8f1d33f0b2cdd00aae978dec75a64345
[ "super().__init__(accelerations=accelerations, center_fractions=center_fractions, uniform_range=False)\nself.crop_corner = crop_corner\nself.max_attempts = max_attempts\nself.tol = tol\nif slopes is not None:\n assert slopes[0] >= 0 and slopes[0] < slopes[1] and (len(slopes) == 2), f'`slopes` must be an increasi...
<|body_start_0|> super().__init__(accelerations=accelerations, center_fractions=center_fractions, uniform_range=False) self.crop_corner = crop_corner self.max_attempts = max_attempts self.tol = tol if slopes is not None: assert slopes[0] >= 0 and slopes[0] < slopes[1]...
Variable Density Poisson sampling mask function. Based on [1]_. Notes ----- * Code inspired and modified from [2]_ with BSD-3 licence, Copyright (c) 2016, Frank Ong, Copyright (c) 2016, The Regents of the University of California [3]_. References ---------- .. [1] Bridson, Robert. “Fast Poisson Disk Sampling in Arbitra...
VariableDensityPoissonMaskFunc
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class VariableDensityPoissonMaskFunc: """Variable Density Poisson sampling mask function. Based on [1]_. Notes ----- * Code inspired and modified from [2]_ with BSD-3 licence, Copyright (c) 2016, Frank Ong, Copyright (c) 2016, The Regents of the University of California [3]_. References ---------- .. [...
stack_v2_sparse_classes_75kplus_train_066444
41,946
permissive
[ { "docstring": "Inits :class:`VariableDensityPoissonMaskFunc`. Parameters ---------- accelerations: list or tuple of positive numbers Amount of under-sampling. center_fractions: list or tuple of floats Must have the same length as `accelerations`. Amount of center fully-sampling. For center_scale='r', then a ce...
3
stack_v2_sparse_classes_30k_train_038844
Implement the Python class `VariableDensityPoissonMaskFunc` described below. Class description: Variable Density Poisson sampling mask function. Based on [1]_. Notes ----- * Code inspired and modified from [2]_ with BSD-3 licence, Copyright (c) 2016, Frank Ong, Copyright (c) 2016, The Regents of the University of Cali...
Implement the Python class `VariableDensityPoissonMaskFunc` described below. Class description: Variable Density Poisson sampling mask function. Based on [1]_. Notes ----- * Code inspired and modified from [2]_ with BSD-3 licence, Copyright (c) 2016, Frank Ong, Copyright (c) 2016, The Regents of the University of Cali...
2a4c29342bc52a404aae097bc2654fb4323e1ac8
<|skeleton|> class VariableDensityPoissonMaskFunc: """Variable Density Poisson sampling mask function. Based on [1]_. Notes ----- * Code inspired and modified from [2]_ with BSD-3 licence, Copyright (c) 2016, Frank Ong, Copyright (c) 2016, The Regents of the University of California [3]_. References ---------- .. [...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class VariableDensityPoissonMaskFunc: """Variable Density Poisson sampling mask function. Based on [1]_. Notes ----- * Code inspired and modified from [2]_ with BSD-3 licence, Copyright (c) 2016, Frank Ong, Copyright (c) 2016, The Regents of the University of California [3]_. References ---------- .. [1] Bridson, R...
the_stack_v2_python_sparse
direct/common/subsample.py
NKI-AI/direct
train
151
0af39809a48ef84eb839da2a195294583691886e
[ "if sell_kind == 'yellow':\n if sell_number > self.store_dog[0]['number']:\n print('We dont have enough dogs you want for sell,Sorry.')\n else:\n print('Successfully sell {} dogs, which kind is {}'.format(sell_number, self.store_dog[0]['color']))\n self.store_dog[0]['number'] -= sell_numb...
<|body_start_0|> if sell_kind == 'yellow': if sell_number > self.store_dog[0]['number']: print('We dont have enough dogs you want for sell,Sorry.') else: print('Successfully sell {} dogs, which kind is {}'.format(sell_number, self.store_dog[0]['color'])) ...
这个类用于保存不同品种的狗的库存情况
cpdog
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cpdog: """这个类用于保存不同品种的狗的库存情况""" def sell_dog(self, sell_number, sell_kind): """参数为出售的数量和出售的品种,如果不符合店家的购买要求(数量不够或者没有品种)则输出抱歉语句, 否则提示出售成功并且返回出售的金额""" <|body_0|> def purchase_dog(self, buy_number, buy_kind): """输入参数为购买的数量和购买的品种,不是以上三种的视作购买失败,简化上面的出售语句,显得过于繁琐,可以在最初做条...
stack_v2_sparse_classes_75kplus_train_066445
3,472
no_license
[ { "docstring": "参数为出售的数量和出售的品种,如果不符合店家的购买要求(数量不够或者没有品种)则输出抱歉语句, 否则提示出售成功并且返回出售的金额", "name": "sell_dog", "signature": "def sell_dog(self, sell_number, sell_kind)" }, { "docstring": "输入参数为购买的数量和购买的品种,不是以上三种的视作购买失败,简化上面的出售语句,显得过于繁琐,可以在最初做条件语句 返回值为购买所花的金额", "name": "purchase_dog", "signature...
2
stack_v2_sparse_classes_30k_train_028879
Implement the Python class `cpdog` described below. Class description: 这个类用于保存不同品种的狗的库存情况 Method signatures and docstrings: - def sell_dog(self, sell_number, sell_kind): 参数为出售的数量和出售的品种,如果不符合店家的购买要求(数量不够或者没有品种)则输出抱歉语句, 否则提示出售成功并且返回出售的金额 - def purchase_dog(self, buy_number, buy_kind): 输入参数为购买的数量和购买的品种,不是以上三种的视作购买失败,简化上...
Implement the Python class `cpdog` described below. Class description: 这个类用于保存不同品种的狗的库存情况 Method signatures and docstrings: - def sell_dog(self, sell_number, sell_kind): 参数为出售的数量和出售的品种,如果不符合店家的购买要求(数量不够或者没有品种)则输出抱歉语句, 否则提示出售成功并且返回出售的金额 - def purchase_dog(self, buy_number, buy_kind): 输入参数为购买的数量和购买的品种,不是以上三种的视作购买失败,简化上...
9b1a9bbbbe69e14f5e7183ecd301f14b0e34b4b1
<|skeleton|> class cpdog: """这个类用于保存不同品种的狗的库存情况""" def sell_dog(self, sell_number, sell_kind): """参数为出售的数量和出售的品种,如果不符合店家的购买要求(数量不够或者没有品种)则输出抱歉语句, 否则提示出售成功并且返回出售的金额""" <|body_0|> def purchase_dog(self, buy_number, buy_kind): """输入参数为购买的数量和购买的品种,不是以上三种的视作购买失败,简化上面的出售语句,显得过于繁琐,可以在最初做条...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class cpdog: """这个类用于保存不同品种的狗的库存情况""" def sell_dog(self, sell_number, sell_kind): """参数为出售的数量和出售的品种,如果不符合店家的购买要求(数量不够或者没有品种)则输出抱歉语句, 否则提示出售成功并且返回出售的金额""" if sell_kind == 'yellow': if sell_number > self.store_dog[0]['number']: print('We dont have enough dogs you want ...
the_stack_v2_python_sparse
homework6/01_cpgod.py
WOWspring/pythonhomework
train
2
ab6158bb9d8295e9e040df8aa0ce354f8a050ac7
[ "net = netaddr.IPNetwork(CONF.network.project_network_v6_cidr)\ngateway = str(netaddr.IPAddress(net.first + 2))\nnetwork = self.create_network()\nsubnet = self.create_subnet(network, gateway)\nself.assertEqual(subnet['gateway_ip'], gateway)", "net = netaddr.IPNetwork(CONF.network.project_network_v6_cidr)\ngateway...
<|body_start_0|> net = netaddr.IPNetwork(CONF.network.project_network_v6_cidr) gateway = str(netaddr.IPAddress(net.first + 2)) network = self.create_network() subnet = self.create_subnet(network, gateway) self.assertEqual(subnet['gateway_ip'], gateway) <|end_body_0|> <|body_star...
NetworksIpV6Test
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NetworksIpV6Test: def test_create_delete_subnet_with_gw(self): """Verify creating and deleting subnet with gateway""" <|body_0|> def test_create_delete_subnet_with_default_gw(self): """Verify creating and deleting subnet without specified gateway""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_066446
31,379
permissive
[ { "docstring": "Verify creating and deleting subnet with gateway", "name": "test_create_delete_subnet_with_gw", "signature": "def test_create_delete_subnet_with_gw(self)" }, { "docstring": "Verify creating and deleting subnet without specified gateway", "name": "test_create_delete_subnet_wit...
3
stack_v2_sparse_classes_30k_train_039768
Implement the Python class `NetworksIpV6Test` described below. Class description: Implement the NetworksIpV6Test class. Method signatures and docstrings: - def test_create_delete_subnet_with_gw(self): Verify creating and deleting subnet with gateway - def test_create_delete_subnet_with_default_gw(self): Verify creati...
Implement the Python class `NetworksIpV6Test` described below. Class description: Implement the NetworksIpV6Test class. Method signatures and docstrings: - def test_create_delete_subnet_with_gw(self): Verify creating and deleting subnet with gateway - def test_create_delete_subnet_with_default_gw(self): Verify creati...
3932a799e620a20d7abf7b89e21b520683a1809b
<|skeleton|> class NetworksIpV6Test: def test_create_delete_subnet_with_gw(self): """Verify creating and deleting subnet with gateway""" <|body_0|> def test_create_delete_subnet_with_default_gw(self): """Verify creating and deleting subnet without specified gateway""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class NetworksIpV6Test: def test_create_delete_subnet_with_gw(self): """Verify creating and deleting subnet with gateway""" net = netaddr.IPNetwork(CONF.network.project_network_v6_cidr) gateway = str(netaddr.IPAddress(net.first + 2)) network = self.create_network() subnet = s...
the_stack_v2_python_sparse
tempest/api/network/test_networks.py
openstack/tempest
train
270
dc763979832e41c103c760effef1a40b2f7de8c4
[ "response = requests.get('http://127.0.0.1:5000/', timeout=5)\nresponse_json = response.json()\nself.assertTrue(isinstance(response_json, list))\nself.assertEqual(len(response_json), 1000)", "response = requests.get('http://127.0.0.1:5000/users/5f481bcafcedab42c8652d73', timeout=5)\nresponse_json = response.json(...
<|body_start_0|> response = requests.get('http://127.0.0.1:5000/', timeout=5) response_json = response.json() self.assertTrue(isinstance(response_json, list)) self.assertEqual(len(response_json), 1000) <|end_body_0|> <|body_start_1|> response = requests.get('http://127.0.0.1:500...
TestApi
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestApi: def test01_get_all_records(self): """unit test to verify all records endpoint""" <|body_0|> def test02_get_specific_records(self): """unit test to verify /users endpoint""" <|body_1|> <|end_skeleton|> <|body_start_0|> response = requests.ge...
stack_v2_sparse_classes_75kplus_train_066447
829
no_license
[ { "docstring": "unit test to verify all records endpoint", "name": "test01_get_all_records", "signature": "def test01_get_all_records(self)" }, { "docstring": "unit test to verify /users endpoint", "name": "test02_get_specific_records", "signature": "def test02_get_specific_records(self)...
2
stack_v2_sparse_classes_30k_train_033925
Implement the Python class `TestApi` described below. Class description: Implement the TestApi class. Method signatures and docstrings: - def test01_get_all_records(self): unit test to verify all records endpoint - def test02_get_specific_records(self): unit test to verify /users endpoint
Implement the Python class `TestApi` described below. Class description: Implement the TestApi class. Method signatures and docstrings: - def test01_get_all_records(self): unit test to verify all records endpoint - def test02_get_specific_records(self): unit test to verify /users endpoint <|skeleton|> class TestApi:...
e72f44e147141ebc9bf9ec126b70a5fcdbfbd076
<|skeleton|> class TestApi: def test01_get_all_records(self): """unit test to verify all records endpoint""" <|body_0|> def test02_get_specific_records(self): """unit test to verify /users endpoint""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestApi: def test01_get_all_records(self): """unit test to verify all records endpoint""" response = requests.get('http://127.0.0.1:5000/', timeout=5) response_json = response.json() self.assertTrue(isinstance(response_json, list)) self.assertEqual(len(response_json), 1...
the_stack_v2_python_sparse
python3/Projects/flask_mongo/src/test_api.py
udhayprakash/PythonMaterial
train
8
6eb11c4ffba89763fd4f7630db0605c6f3e6c937
[ "missing_padding = 4 - len(data) % 4\nif missing_padding:\n data += b'=' * missing_padding\ntry:\n res = base64.decodestring(data)\n if res:\n return res\nexcept:\n return ''", "child_rec_list_length = 0\nenv = request.env(user=SUPERUSER_ID)\nif 'REREG' in post and post.get('REREG'):\n data ...
<|body_start_0|> missing_padding = 4 - len(data) % 4 if missing_padding: data += b'=' * missing_padding try: res = base64.decodestring(data) if res: return res except: return '' <|end_body_0|> <|body_start_1|> child...
LinkReRegistration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinkReRegistration: def decode_base64(self, data): """Decode base64, padding being optional. ------------------------------------------------ :param data: Base64 data as an ASCII byte string :returns: The decoded byte string.""" <|body_0|> def render_re_registration_request(...
stack_v2_sparse_classes_75kplus_train_066448
24,324
no_license
[ { "docstring": "Decode base64, padding being optional. ------------------------------------------------ :param data: Base64 data as an ASCII byte string :returns: The decoded byte string.", "name": "decode_base64", "signature": "def decode_base64(self, data)" }, { "docstring": "this method is us...
3
null
Implement the Python class `LinkReRegistration` described below. Class description: Implement the LinkReRegistration class. Method signatures and docstrings: - def decode_base64(self, data): Decode base64, padding being optional. ------------------------------------------------ :param data: Base64 data as an ASCII by...
Implement the Python class `LinkReRegistration` described below. Class description: Implement the LinkReRegistration class. Method signatures and docstrings: - def decode_base64(self, data): Decode base64, padding being optional. ------------------------------------------------ :param data: Base64 data as an ASCII by...
0e65e5d937b029beb69563772197b9b050748407
<|skeleton|> class LinkReRegistration: def decode_base64(self, data): """Decode base64, padding being optional. ------------------------------------------------ :param data: Base64 data as an ASCII byte string :returns: The decoded byte string.""" <|body_0|> def render_re_registration_request(...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LinkReRegistration: def decode_base64(self, data): """Decode base64, padding being optional. ------------------------------------------------ :param data: Base64 data as an ASCII byte string :returns: The decoded byte string.""" missing_padding = 4 - len(data) % 4 if missing_padding: ...
the_stack_v2_python_sparse
edsys_edu_re_registration/controllers/main.py
probytesodoo/edsys_school_erp
train
1
e4ec464afd28a04ab915762028ad8c79bf8c2241
[ "cx, cy = center\nself.left = cx - size / 2\nself.top = cy + size / 2\nself.size = size\nself.dx = size / image_size\nself.dy = size / image_size", "px = self.left + self.dx * x\npy = self.top - self.dy * y\nreturn Complex(px, py)" ]
<|body_start_0|> cx, cy = center self.left = cx - size / 2 self.top = cy + size / 2 self.size = size self.dx = size / image_size self.dy = size / image_size <|end_body_0|> <|body_start_1|> px = self.left + self.dx * x py = self.top - self.dy * y r...
Deze klasse krijg je cadeau. Ze dient om pixelcordinaten om te zetten naar een complex getal.
Projection
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Projection: """Deze klasse krijg je cadeau. Ze dient om pixelcordinaten om te zetten naar een complex getal.""" def __init__(self, image_size, center, size): """Constructor. image_size Een integer die de breedte en hoogte van de bitmap voorstelt center Een (x, y) koppel dat aangeeft ...
stack_v2_sparse_classes_75kplus_train_066449
7,196
no_license
[ { "docstring": "Constructor. image_size Een integer die de breedte en hoogte van de bitmap voorstelt center Een (x, y) koppel dat aangeeft met welk punt het centrum van de afbeelding overeenkomt. size Een positieve double dat aangeeft hoe fel gezoomd werd. Hoe *kleiner* het getal, hoe *meer* ingezoomd het beeld...
2
stack_v2_sparse_classes_30k_test_001889
Implement the Python class `Projection` described below. Class description: Deze klasse krijg je cadeau. Ze dient om pixelcordinaten om te zetten naar een complex getal. Method signatures and docstrings: - def __init__(self, image_size, center, size): Constructor. image_size Een integer die de breedte en hoogte van d...
Implement the Python class `Projection` described below. Class description: Deze klasse krijg je cadeau. Ze dient om pixelcordinaten om te zetten naar een complex getal. Method signatures and docstrings: - def __init__(self, image_size, center, size): Constructor. image_size Een integer die de breedte en hoogte van d...
9e58ee406852f81d4056c5ad8be357b96bf0abea
<|skeleton|> class Projection: """Deze klasse krijg je cadeau. Ze dient om pixelcordinaten om te zetten naar een complex getal.""" def __init__(self, image_size, center, size): """Constructor. image_size Een integer die de breedte en hoogte van de bitmap voorstelt center Een (x, y) koppel dat aangeeft ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Projection: """Deze klasse krijg je cadeau. Ze dient om pixelcordinaten om te zetten naar een complex getal.""" def __init__(self, image_size, center, size): """Constructor. image_size Een integer die de breedte en hoogte van de bitmap voorstelt center Een (x, y) koppel dat aangeeft met welk punt...
the_stack_v2_python_sparse
exercises/modules/03-pillow/05-fractal/student.py
RobinVdBroeck/ucll_scripting
train
0
a50939f5e58f4add642deec498c7422a9bb03603
[ "width = len(grid[0])\nheight = len(grid)\nif row < 0 or row >= height or col < 0 or (col >= width) or (grid[row][col] != '1'):\n return\ngrid[row][col] = '0'\nself.isPartOfIsland(grid, row, col - 1)\nself.isPartOfIsland(grid, row - 1, col)\nself.isPartOfIsland(grid, row + 1, col)\nself.isPartOfIsland(grid, row,...
<|body_start_0|> width = len(grid[0]) height = len(grid) if row < 0 or row >= height or col < 0 or (col >= width) or (grid[row][col] != '1'): return grid[row][col] = '0' self.isPartOfIsland(grid, row, col - 1) self.isPartOfIsland(grid, row - 1, col) se...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isPartOfIsland(self, grid, row, col): """:rtype: tuple (row,col)""" <|body_0|> def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> width = len(grid[0]) height =...
stack_v2_sparse_classes_75kplus_train_066450
820
no_license
[ { "docstring": ":rtype: tuple (row,col)", "name": "isPartOfIsland", "signature": "def isPartOfIsland(self, grid, row, col)" }, { "docstring": ":type grid: List[List[str]] :rtype: int", "name": "numIslands", "signature": "def numIslands(self, grid)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPartOfIsland(self, grid, row, col): :rtype: tuple (row,col) - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isPartOfIsland(self, grid, row, col): :rtype: tuple (row,col) - def numIslands(self, grid): :type grid: List[List[str]] :rtype: int <|skeleton|> class Solution: def isP...
e6e66e396d42662bba5c3042b4cf337a2506fa83
<|skeleton|> class Solution: def isPartOfIsland(self, grid, row, col): """:rtype: tuple (row,col)""" <|body_0|> def numIslands(self, grid): """:type grid: List[List[str]] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def isPartOfIsland(self, grid, row, col): """:rtype: tuple (row,col)""" width = len(grid[0]) height = len(grid) if row < 0 or row >= height or col < 0 or (col >= width) or (grid[row][col] != '1'): return grid[row][col] = '0' self.isPartOfIs...
the_stack_v2_python_sparse
week1/200.py
crystallistic/wallbreakers-hw
train
0
359a09a81e6107cb3c3b18926b87078057712227
[ "self.n_blank_lines = n_blank_lines\nself.stream_outputs = stream_outputs\nself.curr_new_txt = []\nself.curr_output = ['\\n' for _ in range(n_blank_lines)]", "self.curr_new_txt.append(str(new_txt))\nif not self.stream_outputs:\n if len(self.curr_new_txt) > len(self.curr_output):\n for _ in range(len(sel...
<|body_start_0|> self.n_blank_lines = n_blank_lines self.stream_outputs = stream_outputs self.curr_new_txt = [] self.curr_output = ['\n' for _ in range(n_blank_lines)] <|end_body_0|> <|body_start_1|> self.curr_new_txt.append(str(new_txt)) if not self.stream_outputs: ...
Class for displaying and/or refreshing text outputs in a Notebook. Used to keep outputs in a constant position without constant auto- resizing of output box (as is the case when outputs are cleared) normally. Parameters ---------- n_blank_lines : int, optional Expected max lines of output text; blank placeholder lines ...
OutputTracker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OutputTracker: """Class for displaying and/or refreshing text outputs in a Notebook. Used to keep outputs in a constant position without constant auto- resizing of output box (as is the case when outputs are cleared) normally. Parameters ---------- n_blank_lines : int, optional Expected max lines...
stack_v2_sparse_classes_75kplus_train_066451
5,979
permissive
[ { "docstring": "Initialize class instance. Parameters ---------- n_blank_lines : int, optional Expected max lines of output text; blank placeholder lines will be used to keep output box size constant. The default is 10. stream_outputs : Bool, optional If true, all txt inputs to the tracker will be printed norma...
4
stack_v2_sparse_classes_30k_train_028548
Implement the Python class `OutputTracker` described below. Class description: Class for displaying and/or refreshing text outputs in a Notebook. Used to keep outputs in a constant position without constant auto- resizing of output box (as is the case when outputs are cleared) normally. Parameters ---------- n_blank_l...
Implement the Python class `OutputTracker` described below. Class description: Class for displaying and/or refreshing text outputs in a Notebook. Used to keep outputs in a constant position without constant auto- resizing of output box (as is the case when outputs are cleared) normally. Parameters ---------- n_blank_l...
4496d4e99624eee835fbe4c860f91881c4943df2
<|skeleton|> class OutputTracker: """Class for displaying and/or refreshing text outputs in a Notebook. Used to keep outputs in a constant position without constant auto- resizing of output box (as is the case when outputs are cleared) normally. Parameters ---------- n_blank_lines : int, optional Expected max lines...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OutputTracker: """Class for displaying and/or refreshing text outputs in a Notebook. Used to keep outputs in a constant position without constant auto- resizing of output box (as is the case when outputs are cleared) normally. Parameters ---------- n_blank_lines : int, optional Expected max lines of output te...
the_stack_v2_python_sparse
colab_zirc_dims/eta/eta.py
MCSitar/colab_zirc_dims
train
3
497a0b3a4a940f4cc816c6e49e8670020e4990f2
[ "self.sensor = Sensor('http://127.0.0.1', '8000')\nself.pump = Pump('http://127.0.0.1', '8000')\nself.decider = Decider(50, 0.025)\nself.controller = Controller(self.sensor, self.pump, self.decider)\nself.actions = {'PUMP_IN': self.pump.PUMP_IN, 'PUMP_OUT': self.pump.PUMP_OUT, 'PUMP_OFF': self.pump.PUMP_OFF}", "s...
<|body_start_0|> self.sensor = Sensor('http://127.0.0.1', '8000') self.pump = Pump('http://127.0.0.1', '8000') self.decider = Decider(50, 0.025) self.controller = Controller(self.sensor, self.pump, self.decider) self.actions = {'PUMP_IN': self.pump.PUMP_IN, 'PUMP_OUT': self.pump....
Unit tests for the Controller class.
ControllerTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ControllerTests: """Unit tests for the Controller class.""" def setUp(self): """setUp() method is executed before test methods run for Controller.""" <|body_0|> def test_controller_init(self): """Test the constructor for creating a new instance.""" <|body...
stack_v2_sparse_classes_75kplus_train_066452
6,467
no_license
[ { "docstring": "setUp() method is executed before test methods run for Controller.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test the constructor for creating a new instance.", "name": "test_controller_init", "signature": "def test_controller_init(self)" }, ...
4
stack_v2_sparse_classes_30k_train_020971
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class. Method signatures and docstrings: - def setUp(self): setUp() method is executed before test methods run for Controller. - def test_controller_init(self): Test the constructor for creating a new instan...
Implement the Python class `ControllerTests` described below. Class description: Unit tests for the Controller class. Method signatures and docstrings: - def setUp(self): setUp() method is executed before test methods run for Controller. - def test_controller_init(self): Test the constructor for creating a new instan...
263685ca90110609bfd05d621516727f8cd0028f
<|skeleton|> class ControllerTests: """Unit tests for the Controller class.""" def setUp(self): """setUp() method is executed before test methods run for Controller.""" <|body_0|> def test_controller_init(self): """Test the constructor for creating a new instance.""" <|body...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ControllerTests: """Unit tests for the Controller class.""" def setUp(self): """setUp() method is executed before test methods run for Controller.""" self.sensor = Sensor('http://127.0.0.1', '8000') self.pump = Pump('http://127.0.0.1', '8000') self.decider = Decider(50, 0....
the_stack_v2_python_sparse
students/daniel_grubbs/lesson06/water-regulation/waterregulation/test.py
aurel1212/Sp2018-Online
train
0
63190e80e3cc9568264807a67f1f545eaa564353
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
A set of methods for managing Snapshot resources.
SnapshotServiceServicer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SnapshotServiceServicer: """A set of methods for managing Snapshot resources.""" def Get(self, request, context): """Returns the specified Snapshot resource. To get the list of available Snapshot resources, make a [List] request.""" <|body_0|> def List(self, request, con...
stack_v2_sparse_classes_75kplus_train_066453
12,319
permissive
[ { "docstring": "Returns the specified Snapshot resource. To get the list of available Snapshot resources, make a [List] request.", "name": "Get", "signature": "def Get(self, request, context)" }, { "docstring": "Retrieves the list of Snapshot resources in the specified folder.", "name": "Lis...
6
stack_v2_sparse_classes_30k_train_000471
Implement the Python class `SnapshotServiceServicer` described below. Class description: A set of methods for managing Snapshot resources. Method signatures and docstrings: - def Get(self, request, context): Returns the specified Snapshot resource. To get the list of available Snapshot resources, make a [List] reques...
Implement the Python class `SnapshotServiceServicer` described below. Class description: A set of methods for managing Snapshot resources. Method signatures and docstrings: - def Get(self, request, context): Returns the specified Snapshot resource. To get the list of available Snapshot resources, make a [List] reques...
b906a014dd893e2697864e1e48e814a8d9fbc48c
<|skeleton|> class SnapshotServiceServicer: """A set of methods for managing Snapshot resources.""" def Get(self, request, context): """Returns the specified Snapshot resource. To get the list of available Snapshot resources, make a [List] request.""" <|body_0|> def List(self, request, con...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SnapshotServiceServicer: """A set of methods for managing Snapshot resources.""" def Get(self, request, context): """Returns the specified Snapshot resource. To get the list of available Snapshot resources, make a [List] request.""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) ...
the_stack_v2_python_sparse
yandex/cloud/compute/v1/snapshot_service_pb2_grpc.py
yandex-cloud/python-sdk
train
63
6de0c7d148e28bedcd0d216fbaf1aa133d8ffd66
[ "product = get_object_or_404(Product, id=product_id)\nproduct_images = get_object_or_404(ProductImages, product=product)\nform = ProductImagesForm(instance=product_images)\nreturn render(request, 'product_images/add-product_images.html', {'form': form, 'func': 'Update', 'product': product})", "product = get_objec...
<|body_start_0|> product = get_object_or_404(Product, id=product_id) product_images = get_object_or_404(ProductImages, product=product) form = ProductImagesForm(instance=product_images) return render(request, 'product_images/add-product_images.html', {'form': form, 'func': 'Update', 'pro...
Class based view for updating product images.
ProductImagesUpdateView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProductImagesUpdateView: """Class based view for updating product images.""" def get(self, request, product_id): """Return update product images form.""" <|body_0|> def post(self, request, product_id): """Save product and redirect to product list.""" <|bo...
stack_v2_sparse_classes_75kplus_train_066454
2,844
no_license
[ { "docstring": "Return update product images form.", "name": "get", "signature": "def get(self, request, product_id)" }, { "docstring": "Save product and redirect to product list.", "name": "post", "signature": "def post(self, request, product_id)" } ]
2
stack_v2_sparse_classes_30k_train_024125
Implement the Python class `ProductImagesUpdateView` described below. Class description: Class based view for updating product images. Method signatures and docstrings: - def get(self, request, product_id): Return update product images form. - def post(self, request, product_id): Save product and redirect to product ...
Implement the Python class `ProductImagesUpdateView` described below. Class description: Class based view for updating product images. Method signatures and docstrings: - def get(self, request, product_id): Return update product images form. - def post(self, request, product_id): Save product and redirect to product ...
93c3106ab90fb9aed85658f93f51686ba4734091
<|skeleton|> class ProductImagesUpdateView: """Class based view for updating product images.""" def get(self, request, product_id): """Return update product images form.""" <|body_0|> def post(self, request, product_id): """Save product and redirect to product list.""" <|bo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ProductImagesUpdateView: """Class based view for updating product images.""" def get(self, request, product_id): """Return update product images form.""" product = get_object_or_404(Product, id=product_id) product_images = get_object_or_404(ProductImages, product=product) ...
the_stack_v2_python_sparse
product/views/product_images_views.py
saadali5997/tms
train
0
377c54471b3906b2b620013d5b17d09e7549a10b
[ "gazettes_data = requests.get(self.BASE_URL).json()\nnumber_of_documents = gazettes_data['response']['numFound']\nurl = f'{self.BASE_URL}?start=0&rows={number_of_documents}'\nyield scrapy.Request(url=url, callback=self.parse)", "data = json.loads(response.body)['response']\nfor gazette_data in data['docs']:\n ...
<|body_start_0|> gazettes_data = requests.get(self.BASE_URL).json() number_of_documents = gazettes_data['response']['numFound'] url = f'{self.BASE_URL}?start=0&rows={number_of_documents}' yield scrapy.Request(url=url, callback=self.parse) <|end_body_0|> <|body_start_1|> data = j...
PaBelemSpider
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PaBelemSpider: def start_requests(self): """Requests the gazette to get the total of documents and use it as a query param @url https://sistemas.belem.pa.gov.br/diario-consulta-api/diarios @returns requests 1""" <|body_0|> def parse(self, response): """@url https://s...
stack_v2_sparse_classes_75kplus_train_066455
1,742
permissive
[ { "docstring": "Requests the gazette to get the total of documents and use it as a query param @url https://sistemas.belem.pa.gov.br/diario-consulta-api/diarios @returns requests 1", "name": "start_requests", "signature": "def start_requests(self)" }, { "docstring": "@url https://sistemas.belem....
2
stack_v2_sparse_classes_30k_train_027122
Implement the Python class `PaBelemSpider` described below. Class description: Implement the PaBelemSpider class. Method signatures and docstrings: - def start_requests(self): Requests the gazette to get the total of documents and use it as a query param @url https://sistemas.belem.pa.gov.br/diario-consulta-api/diari...
Implement the Python class `PaBelemSpider` described below. Class description: Implement the PaBelemSpider class. Method signatures and docstrings: - def start_requests(self): Requests the gazette to get the total of documents and use it as a query param @url https://sistemas.belem.pa.gov.br/diario-consulta-api/diari...
feef1d36d540b052ec0b178015872a215352ba80
<|skeleton|> class PaBelemSpider: def start_requests(self): """Requests the gazette to get the total of documents and use it as a query param @url https://sistemas.belem.pa.gov.br/diario-consulta-api/diarios @returns requests 1""" <|body_0|> def parse(self, response): """@url https://s...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PaBelemSpider: def start_requests(self): """Requests the gazette to get the total of documents and use it as a query param @url https://sistemas.belem.pa.gov.br/diario-consulta-api/diarios @returns requests 1""" gazettes_data = requests.get(self.BASE_URL).json() number_of_documents = g...
the_stack_v2_python_sparse
data_collection/gazette/spiders/pa_belem.py
tiagofer/querido-diario
train
1
8600db3b038b11c95aefb33c3450645525f50620
[ "self.TARGET_IP = self.get_broadcast_address(targetIP)\nself.UDP_PORT = port\nself.HEADER = bytearray()\nself.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\nself.make_header()", "s = '===================================\\n'\ns += 'Stupid Artnet initialized\\n'\ns += 'Target IP: %s:%i \\n' % (self.TARGET_IP...
<|body_start_0|> self.TARGET_IP = self.get_broadcast_address(targetIP) self.UDP_PORT = port self.HEADER = bytearray() self.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.make_header() <|end_body_0|> <|body_start_1|> s = '===================================\n' ...
(Very) simple implementation of ArtnetSync.
StupidArtSync
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StupidArtSync: """(Very) simple implementation of ArtnetSync.""" def __init__(self, targetIP='127.0.0.1', port=6454): """Class Initialization.""" <|body_0|> def __str__(self): """Printable object state.""" <|body_1|> def make_header(self): ""...
stack_v2_sparse_classes_75kplus_train_066456
2,321
no_license
[ { "docstring": "Class Initialization.", "name": "__init__", "signature": "def __init__(self, targetIP='127.0.0.1', port=6454)" }, { "docstring": "Printable object state.", "name": "__str__", "signature": "def __str__(self)" }, { "docstring": "Make packet header.", "name": "ma...
5
null
Implement the Python class `StupidArtSync` described below. Class description: (Very) simple implementation of ArtnetSync. Method signatures and docstrings: - def __init__(self, targetIP='127.0.0.1', port=6454): Class Initialization. - def __str__(self): Printable object state. - def make_header(self): Make packet he...
Implement the Python class `StupidArtSync` described below. Class description: (Very) simple implementation of ArtnetSync. Method signatures and docstrings: - def __init__(self, targetIP='127.0.0.1', port=6454): Class Initialization. - def __str__(self): Printable object state. - def make_header(self): Make packet he...
de1408317d5071b7e0c6b2fea6f281660115d728
<|skeleton|> class StupidArtSync: """(Very) simple implementation of ArtnetSync.""" def __init__(self, targetIP='127.0.0.1', port=6454): """Class Initialization.""" <|body_0|> def __str__(self): """Printable object state.""" <|body_1|> def make_header(self): ""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StupidArtSync: """(Very) simple implementation of ArtnetSync.""" def __init__(self, targetIP='127.0.0.1', port=6454): """Class Initialization.""" self.TARGET_IP = self.get_broadcast_address(targetIP) self.UDP_PORT = port self.HEADER = bytearray() self.s = socket.so...
the_stack_v2_python_sparse
api/package/artnet/StupidArtSync.py
HE-Arc/Extrusion---web-interface
train
4
cd72ad29e122bd40c1a4269866af89796484d017
[ "if value and value.startswith('@'):\n value = value[1:]\nself.data = value", "self.data = self.data.replace('@', '')\nif not TWITTER_HANDLE_PATTERN.match(self.data):\n raise ValidationError('Not a valid Twitter handle.')", "if self.data:\n return '@' + self.data\nelse:\n return ''" ]
<|body_start_0|> if value and value.startswith('@'): value = value[1:] self.data = value <|end_body_0|> <|body_start_1|> self.data = self.data.replace('@', '') if not TWITTER_HANDLE_PATTERN.match(self.data): raise ValidationError('Not a valid Twitter handle.') <|...
A field for capturing a Twitter handle.
TwitterField
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TwitterField: """A field for capturing a Twitter handle.""" def process_data(self, value): """Strip a leading @ on incoming data.""" <|body_0|> def pre_validate(self, form): """Check that the handle conforms to Twitter restrictions.""" <|body_1|> def...
stack_v2_sparse_classes_75kplus_train_066457
985
permissive
[ { "docstring": "Strip a leading @ on incoming data.", "name": "process_data", "signature": "def process_data(self, value)" }, { "docstring": "Check that the handle conforms to Twitter restrictions.", "name": "pre_validate", "signature": "def pre_validate(self, form)" }, { "docstr...
3
stack_v2_sparse_classes_30k_train_052540
Implement the Python class `TwitterField` described below. Class description: A field for capturing a Twitter handle. Method signatures and docstrings: - def process_data(self, value): Strip a leading @ on incoming data. - def pre_validate(self, form): Check that the handle conforms to Twitter restrictions. - def _va...
Implement the Python class `TwitterField` described below. Class description: A field for capturing a Twitter handle. Method signatures and docstrings: - def process_data(self, value): Strip a leading @ on incoming data. - def pre_validate(self, form): Check that the handle conforms to Twitter restrictions. - def _va...
310508c16dabf2ce9aaf0c2624132d725f71143b
<|skeleton|> class TwitterField: """A field for capturing a Twitter handle.""" def process_data(self, value): """Strip a leading @ on incoming data.""" <|body_0|> def pre_validate(self, form): """Check that the handle conforms to Twitter restrictions.""" <|body_1|> def...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TwitterField: """A field for capturing a Twitter handle.""" def process_data(self, value): """Strip a leading @ on incoming data.""" if value and value.startswith('@'): value = value[1:] self.data = value def pre_validate(self, form): """Check that the han...
the_stack_v2_python_sparse
pygotham/fields.py
PyGotham/pygotham
train
19
e40dfe8842447f0b300d65d0d3bba224bc86ff73
[ "from collections import defaultdict\nd = defaultdict(list)\n\ndef f(r, i):\n if r:\n d[i].append(r.val)\n f(r.left, i + 1)\n f(r.right, i + 1)\nf(root, 0)\nreturn [i for i in d.values()]", "if not root:\n return []\nfrom collections import deque\nres = []\nq = deque()\nq.append(root)\n...
<|body_start_0|> from collections import defaultdict d = defaultdict(list) def f(r, i): if r: d[i].append(r.val) f(r.left, i + 1) f(r.right, i + 1) f(root, 0) return [i for i in d.values()] <|end_body_0|> <|body_start_...
Solution1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution1: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历""" <|body_0|> def levelOrder1(self, root): """:param root: :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> from collectio...
stack_v2_sparse_classes_75kplus_train_066458
1,556
no_license
[ { "docstring": ":type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历", "name": "levelOrder", "signature": "def levelOrder(self, root)" }, { "docstring": ":param root: :return:", "name": "levelOrder1", "signature": "def levelOrder1(self, root)" } ]
2
stack_v2_sparse_classes_30k_train_051150
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历 - def levelOrder1(self, root): :param root: :return:
Implement the Python class `Solution1` described below. Class description: Implement the Solution1 class. Method signatures and docstrings: - def levelOrder(self, root): :type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历 - def levelOrder1(self, root): :param root: :return: <|skeleton|> clas...
a3a1556abc5adb9325de54d64f9814e64b96db0f
<|skeleton|> class Solution1: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历""" <|body_0|> def levelOrder1(self, root): """:param root: :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution1: def levelOrder(self, root): """:type root: TreeNode :rtype: List[List[int]] 1, 先把树转换成list(前序遍历) 2,再根据切片层序遍历""" from collections import defaultdict d = defaultdict(list) def f(r, i): if r: d[i].append(r.val) f(r.left, i + 1...
the_stack_v2_python_sparse
leetcode/tree/*levelOrder.py
BigerWANG/geek_algorithm
train
0
2b7ffd1ae50d9dd03a4af6e9e5fd5bfbee06e81c
[ "super(Predictor, self).__init__()\nif property_identifier != 'bbb':\n self.labels = reading_csv(config, property_identifier)\nself.tokens = ['H', 'Cl', 'Br', 'B', 'C', 'N', 'O', 'P', 'S', 'F', 'I', '(', ')', '[', ']', '=', '#', '@', '*', '%', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '/', '\\\\', '...
<|body_start_0|> super(Predictor, self).__init__() if property_identifier != 'bbb': self.labels = reading_csv(config, property_identifier) self.tokens = ['H', 'Cl', 'Br', 'B', 'C', 'N', 'O', 'P', 'S', 'F', 'I', '(', ')', '[', ']', '=', '#', '@', '*', '%', '0', '1', '2', '3', '4', '5'...
Predictor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Predictor: def __init__(self, config, property_identifier): """Constructor for the Predictor object. Parameters ---------- config: Configuration parameters tokens: Table with all possible tokens in SMILES labels: True values of Predictor training dataset to perform the denormalization st...
stack_v2_sparse_classes_75kplus_train_066459
4,527
no_license
[ { "docstring": "Constructor for the Predictor object. Parameters ---------- config: Configuration parameters tokens: Table with all possible tokens in SMILES labels: True values of Predictor training dataset to perform the denormalization step property_identifier: String identifying the property to optimize Ret...
2
null
Implement the Python class `Predictor` described below. Class description: Implement the Predictor class. Method signatures and docstrings: - def __init__(self, config, property_identifier): Constructor for the Predictor object. Parameters ---------- config: Configuration parameters tokens: Table with all possible to...
Implement the Python class `Predictor` described below. Class description: Implement the Predictor class. Method signatures and docstrings: - def __init__(self, config, property_identifier): Constructor for the Predictor object. Parameters ---------- config: Configuration parameters tokens: Table with all possible to...
acd4305c5dfc91a918ff00239c4fd6b1392d1828
<|skeleton|> class Predictor: def __init__(self, config, property_identifier): """Constructor for the Predictor object. Parameters ---------- config: Configuration parameters tokens: Table with all possible tokens in SMILES labels: True values of Predictor training dataset to perform the denormalization st...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Predictor: def __init__(self, config, property_identifier): """Constructor for the Predictor object. Parameters ---------- config: Configuration parameters tokens: Table with all possible tokens in SMILES labels: True values of Predictor training dataset to perform the denormalization step property_id...
the_stack_v2_python_sparse
prediction.py
rnaimehaom/De-Novo-Drug-Design
train
0
1cdbb6a1e7b80f095f239f659ceb2f9cdaa1be3b
[ "super(CoAttention, self).__init__()\nself.map_dim = map_dim\nself.hidden_dim = hidden_dim\nself.attention_dim = attention_dim\nself.map_linear = nn.Linear(in_features=self.map_dim, out_features=self.attention_dim)\nself.hidden_linear = nn.Linear(in_features=self.hidden_dim, out_features=self.attention_dim)\nself.c...
<|body_start_0|> super(CoAttention, self).__init__() self.map_dim = map_dim self.hidden_dim = hidden_dim self.attention_dim = attention_dim self.map_linear = nn.Linear(in_features=self.map_dim, out_features=self.attention_dim) self.hidden_linear = nn.Linear(in_features=se...
CoAttention
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoAttention: def __init__(self, map_dim, hidden_dim, attention_dim=512): """:param map_dim: Number of maps (i.e. channels) in the used CNN. Usually map_dim = maps.shape[-1] :param hidden_dim: Size of hidden layer of the language model. Usually hidden_size = hiddens.shape[-1] :param atten...
stack_v2_sparse_classes_75kplus_train_066460
8,511
permissive
[ { "docstring": ":param map_dim: Number of maps (i.e. channels) in the used CNN. Usually map_dim = maps.shape[-1] :param hidden_dim: Size of hidden layer of the language model. Usually hidden_size = hiddens.shape[-1] :param attention_dim: Dimension of the attention layers", "name": "__init__", "signature...
2
stack_v2_sparse_classes_30k_val_002612
Implement the Python class `CoAttention` described below. Class description: Implement the CoAttention class. Method signatures and docstrings: - def __init__(self, map_dim, hidden_dim, attention_dim=512): :param map_dim: Number of maps (i.e. channels) in the used CNN. Usually map_dim = maps.shape[-1] :param hidden_d...
Implement the Python class `CoAttention` described below. Class description: Implement the CoAttention class. Method signatures and docstrings: - def __init__(self, map_dim, hidden_dim, attention_dim=512): :param map_dim: Number of maps (i.e. channels) in the used CNN. Usually map_dim = maps.shape[-1] :param hidden_d...
46c50fb2748b9d372044d00b901f0cde91946684
<|skeleton|> class CoAttention: def __init__(self, map_dim, hidden_dim, attention_dim=512): """:param map_dim: Number of maps (i.e. channels) in the used CNN. Usually map_dim = maps.shape[-1] :param hidden_dim: Size of hidden layer of the language model. Usually hidden_size = hiddens.shape[-1] :param atten...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CoAttention: def __init__(self, map_dim, hidden_dim, attention_dim=512): """:param map_dim: Number of maps (i.e. channels) in the used CNN. Usually map_dim = maps.shape[-1] :param hidden_dim: Size of hidden layer of the language model. Usually hidden_size = hiddens.shape[-1] :param attention_dim: Dime...
the_stack_v2_python_sparse
src/modules/attention.py
ab3llini/Transformer-VQA
train
2
5c180291fddef18872e42e91a83cfaa8ef861f37
[ "self.path_connectomist = path_connectomist\nself.environment = os.environ\nself._connectomist_version_check(self.path_connectomist)\ncmd = '%s --help' % self.path_connectomist\nprocess = subprocess.Popen(cmd, shell=True, env=self.environment, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\nself.stdout, self.stder...
<|body_start_0|> self.path_connectomist = path_connectomist self.environment = os.environ self._connectomist_version_check(self.path_connectomist) cmd = '%s --help' % self.path_connectomist process = subprocess.Popen(cmd, shell=True, env=self.environment, stdout=subprocess.PIPE, ...
Parent class for the wrapping of Connectomist functions.
ConnectomistWrapper
[ "LicenseRef-scancode-cecill-b-en" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ConnectomistWrapper: """Parent class for the wrapping of Connectomist functions.""" def __init__(self, path_connectomist=DEFAULT_CONNECTOMIST_PATH): """Initialize the ConnectomistWrapper class by setting properly the environment and checking that the Connectomist software is installe...
stack_v2_sparse_classes_75kplus_train_066461
7,584
permissive
[ { "docstring": "Initialize the ConnectomistWrapper class by setting properly the environment and checking that the Connectomist software is installed. Parameters ---------- path_connectomist: str (optional) path to the Connectomist executable. Raises ------ ConnectomistConfigurationError: If Connectomist is not...
4
stack_v2_sparse_classes_30k_train_021694
Implement the Python class `ConnectomistWrapper` described below. Class description: Parent class for the wrapping of Connectomist functions. Method signatures and docstrings: - def __init__(self, path_connectomist=DEFAULT_CONNECTOMIST_PATH): Initialize the ConnectomistWrapper class by setting properly the environmen...
Implement the Python class `ConnectomistWrapper` described below. Class description: Parent class for the wrapping of Connectomist functions. Method signatures and docstrings: - def __init__(self, path_connectomist=DEFAULT_CONNECTOMIST_PATH): Initialize the ConnectomistWrapper class by setting properly the environmen...
81881fd88d94b3c2bd401602783261a64e818a05
<|skeleton|> class ConnectomistWrapper: """Parent class for the wrapping of Connectomist functions.""" def __init__(self, path_connectomist=DEFAULT_CONNECTOMIST_PATH): """Initialize the ConnectomistWrapper class by setting properly the environment and checking that the Connectomist software is installe...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ConnectomistWrapper: """Parent class for the wrapping of Connectomist functions.""" def __init__(self, path_connectomist=DEFAULT_CONNECTOMIST_PATH): """Initialize the ConnectomistWrapper class by setting properly the environment and checking that the Connectomist software is installed. Parameters...
the_stack_v2_python_sparse
pyconnectomist/wrappers.py
IvanBrossollet/pyconnectomist
train
0
95f2cc1403bc786b1e6238ac2ad7acc716338648
[ "form = super().get_form(form_class)\nfor rating in self.item.category.ratings.all():\n choices = []\n for choice in range(1, rating.max_rating + 1):\n choices.append((choice, choice))\n try:\n vote = Vote.objects.get(review=self.get_object(), rating=rating)\n except Vote.DoesNotExist:\n ...
<|body_start_0|> form = super().get_form(form_class) for rating in self.item.category.ratings.all(): choices = [] for choice in range(1, rating.max_rating + 1): choices.append((choice, choice)) try: vote = Vote.objects.get(review=self.g...
ReviewUpdateView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReviewUpdateView: def get_form(self, form_class=None): """- Add ratings to the form - Set initial Context QuerySet - Add attachments FileField to the form - TODO: Add tags field to the form""" <|body_0|> def get_context_data(self, **kwargs): """Add Item to the contex...
stack_v2_sparse_classes_75kplus_train_066462
10,374
permissive
[ { "docstring": "- Add ratings to the form - Set initial Context QuerySet - Add attachments FileField to the form - TODO: Add tags field to the form", "name": "get_form", "signature": "def get_form(self, form_class=None)" }, { "docstring": "Add Item to the context", "name": "get_context_data"...
3
null
Implement the Python class `ReviewUpdateView` described below. Class description: Implement the ReviewUpdateView class. Method signatures and docstrings: - def get_form(self, form_class=None): - Add ratings to the form - Set initial Context QuerySet - Add attachments FileField to the form - TODO: Add tags field to th...
Implement the Python class `ReviewUpdateView` described below. Class description: Implement the ReviewUpdateView class. Method signatures and docstrings: - def get_form(self, form_class=None): - Add ratings to the form - Set initial Context QuerySet - Add attachments FileField to the form - TODO: Add tags field to th...
e59869da4cba632f66d9ff536b11e72eba624ff7
<|skeleton|> class ReviewUpdateView: def get_form(self, form_class=None): """- Add ratings to the form - Set initial Context QuerySet - Add attachments FileField to the form - TODO: Add tags field to the form""" <|body_0|> def get_context_data(self, **kwargs): """Add Item to the contex...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ReviewUpdateView: def get_form(self, form_class=None): """- Add ratings to the form - Set initial Context QuerySet - Add attachments FileField to the form - TODO: Add tags field to the form""" form = super().get_form(form_class) for rating in self.item.category.ratings.all(): ...
the_stack_v2_python_sparse
src/review/views.py
Denner-der/socialrating
train
0
1d337eef1896480aab324c74f638904c846b45cb
[ "if noun_tags == None:\n tool_factory = core.KBBenchmark.singleton().run_tools[run_name]\n pos_tagger = tool_factory.posTagger(document.language)\n noun_tags = pos_tagger.tagset()[nlp_tool_interface.KBPOSTaggerI.POSTagKey.NOUN]\nif adjective_tags == None:\n tool_factory = core.KBBenchmark.singleton().ru...
<|body_start_0|> if noun_tags == None: tool_factory = core.KBBenchmark.singleton().run_tools[run_name] pos_tagger = tool_factory.posTagger(document.language) noun_tags = pos_tagger.tagset()[nlp_tool_interface.KBPOSTaggerI.POSTagKey.NOUN] if adjective_tags == None: ...
English pattern matching candidate extractor that filters useless adjectives. Candidate extractor providing only textual units that match the POS tag pattern C{A?N+}. When the adjective is not derived from a noun, only the modified noun is extracted.
EnglishRefinedNounPhraseExtractor
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnglishRefinedNounPhraseExtractor: """English pattern matching candidate extractor that filters useless adjectives. Candidate extractor providing only textual units that match the POS tag pattern C{A?N+}. When the adjective is not derived from a noun, only the modified noun is extracted.""" ...
stack_v2_sparse_classes_75kplus_train_066463
6,727
no_license
[ { "docstring": "Constructor. Args: name: The C{string} name of the component. run_name: The C{string} name of the run for which the component is affected to. shared: True if the component shares informations with equivalent components (same name). lazy_mode: True if the component load precomputed data. False, o...
3
null
Implement the Python class `EnglishRefinedNounPhraseExtractor` described below. Class description: English pattern matching candidate extractor that filters useless adjectives. Candidate extractor providing only textual units that match the POS tag pattern C{A?N+}. When the adjective is not derived from a noun, only t...
Implement the Python class `EnglishRefinedNounPhraseExtractor` described below. Class description: English pattern matching candidate extractor that filters useless adjectives. Candidate extractor providing only textual units that match the POS tag pattern C{A?N+}. When the adjective is not derived from a noun, only t...
a66cf98b11260d2b74cd990f36f5dcde192b0346
<|skeleton|> class EnglishRefinedNounPhraseExtractor: """English pattern matching candidate extractor that filters useless adjectives. Candidate extractor providing only textual units that match the POS tag pattern C{A?N+}. When the adjective is not derived from a noun, only the modified noun is extracted.""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class EnglishRefinedNounPhraseExtractor: """English pattern matching candidate extractor that filters useless adjectives. Candidate extractor providing only textual units that match the POS tag pattern C{A?N+}. When the adjective is not derived from a noun, only the modified noun is extracted.""" def __init__(...
the_stack_v2_python_sparse
src/keybench/main/component/implementation/candidate_extractor/english_refined_noun_phrase_extractor.py
Archer-W/KeyBench
train
0
c120acd5af964ec3df331bad4fdbd6ba6a8889a2
[ "super(BertSelfOutput, self).__init__()\nself.dense = nn.Dense(config.hidden_size, config.hidden_size).to_float(mindspore.float16)\nself.LayerNorm = nn.LayerNorm((config.hidden_size,), epsilon=config.layer_norm_eps).to_float(mindspore.float16)\nself.dropout = nn.Dropout(p=config.hidden_dropout_prob)\nself.cast = op...
<|body_start_0|> super(BertSelfOutput, self).__init__() self.dense = nn.Dense(config.hidden_size, config.hidden_size).to_float(mindspore.float16) self.LayerNorm = nn.LayerNorm((config.hidden_size,), epsilon=config.layer_norm_eps).to_float(mindspore.float16) self.dropout = nn.Dropout(p=co...
bert self output
BertSelfOutput
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BertSelfOutput: """bert self output""" def __init__(self, config): """init fun""" <|body_0|> def construct(self, hidden_states, input_tensor): """construct fun""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(BertSelfOutput, self).__init__(...
stack_v2_sparse_classes_75kplus_train_066464
16,172
permissive
[ { "docstring": "init fun", "name": "__init__", "signature": "def __init__(self, config)" }, { "docstring": "construct fun", "name": "construct", "signature": "def construct(self, hidden_states, input_tensor)" } ]
2
stack_v2_sparse_classes_30k_train_052100
Implement the Python class `BertSelfOutput` described below. Class description: bert self output Method signatures and docstrings: - def __init__(self, config): init fun - def construct(self, hidden_states, input_tensor): construct fun
Implement the Python class `BertSelfOutput` described below. Class description: bert self output Method signatures and docstrings: - def __init__(self, config): init fun - def construct(self, hidden_states, input_tensor): construct fun <|skeleton|> class BertSelfOutput: """bert self output""" def __init__(s...
eab643f51336dbf7d711f02d27e6516e5affee59
<|skeleton|> class BertSelfOutput: """bert self output""" def __init__(self, config): """init fun""" <|body_0|> def construct(self, hidden_states, input_tensor): """construct fun""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BertSelfOutput: """bert self output""" def __init__(self, config): """init fun""" super(BertSelfOutput, self).__init__() self.dense = nn.Dense(config.hidden_size, config.hidden_size).to_float(mindspore.float16) self.LayerNorm = nn.LayerNorm((config.hidden_size,), epsilon=c...
the_stack_v2_python_sparse
research/nlp/luke/src/luke/robert.py
mindspore-ai/models
train
301
025a2da059013785fecfcaf19bfbd8e042158938
[ "ret = None\nl = []\nmapper = StudentJSONMapper()\nfor student in students:\n l.append(mapper.map_to_json(student))\nreturn json.dumps(l, indent=4, sort_keys=True)", "l = []\nmapper = StudentJSONMapper()\nfor student in students:\n l.append(mapper.map_to_json(student))\nwith open(filename, 'w') as fh:\n ...
<|body_start_0|> ret = None l = [] mapper = StudentJSONMapper() for student in students: l.append(mapper.map_to_json(student)) return json.dumps(l, indent=4, sort_keys=True) <|end_body_0|> <|body_start_1|> l = [] mapper = StudentJSONMapper() f...
This class is used for exporting students to JSON files, and importing students from JSON files.
StudentJSONSerializer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StudentJSONSerializer: """This class is used for exporting students to JSON files, and importing students from JSON files.""" def exportAsJSON(self, students): """Generates JSON data from students :param students: list of model.Student.Student-s :return: JSON data""" <|body_0...
stack_v2_sparse_classes_75kplus_train_066465
1,650
no_license
[ { "docstring": "Generates JSON data from students :param students: list of model.Student.Student-s :return: JSON data", "name": "exportAsJSON", "signature": "def exportAsJSON(self, students)" }, { "docstring": "Exports students to the JSON file with the given filename. :param students: list of m...
3
stack_v2_sparse_classes_30k_train_024928
Implement the Python class `StudentJSONSerializer` described below. Class description: This class is used for exporting students to JSON files, and importing students from JSON files. Method signatures and docstrings: - def exportAsJSON(self, students): Generates JSON data from students :param students: list of model...
Implement the Python class `StudentJSONSerializer` described below. Class description: This class is used for exporting students to JSON files, and importing students from JSON files. Method signatures and docstrings: - def exportAsJSON(self, students): Generates JSON data from students :param students: list of model...
a30389aa4542a23011a955ac61bf5b853c3e7854
<|skeleton|> class StudentJSONSerializer: """This class is used for exporting students to JSON files, and importing students from JSON files.""" def exportAsJSON(self, students): """Generates JSON data from students :param students: list of model.Student.Student-s :return: JSON data""" <|body_0...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class StudentJSONSerializer: """This class is used for exporting students to JSON files, and importing students from JSON files.""" def exportAsJSON(self, students): """Generates JSON data from students :param students: list of model.Student.Student-s :return: JSON data""" ret = None l ...
the_stack_v2_python_sparse
serializer/StudentJSONSerializer.py
edutilos6666/PythonSciStudentProject
train
0
e87a8683d4300f34018575e8d42abaf0fb780b5c
[ "self._model = model\nself.path = path\nself.external_data_path = external_data_path\nself.size_threshold = size_threshold\nself.all_tensors_to_one_file = all_tensors_to_one_file", "model, _ = util.invoke_if_callable(self._model)\nG_LOGGER.info(f'Saving ONNX model to: {self.path}')\nif self.external_data_path is ...
<|body_start_0|> self._model = model self.path = path self.external_data_path = external_data_path self.size_threshold = size_threshold self.all_tensors_to_one_file = all_tensors_to_one_file <|end_body_0|> <|body_start_1|> model, _ = util.invoke_if_callable(self._model) ...
Functor that saves an ONNX model to the specified path.
SaveOnnx
[ "Apache-2.0", "BSD-3-Clause", "MIT", "ISC", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SaveOnnx: """Functor that saves an ONNX model to the specified path.""" def __init__(self, model, path, external_data_path=None, size_threshold=None, all_tensors_to_one_file=None): """Saves an ONNX model to the specified path. Args: model (Union[onnx.ModelProto, Callable() -> onnx.Mo...
stack_v2_sparse_classes_75kplus_train_066466
37,448
permissive
[ { "docstring": "Saves an ONNX model to the specified path. Args: model (Union[onnx.ModelProto, Callable() -> onnx.ModelProto]): An ONNX model or a callable that returns one. path (str): Path at which to write the ONNX model. external_data_path (str): Path to save external data. This is always a relative path; e...
2
stack_v2_sparse_classes_30k_train_007968
Implement the Python class `SaveOnnx` described below. Class description: Functor that saves an ONNX model to the specified path. Method signatures and docstrings: - def __init__(self, model, path, external_data_path=None, size_threshold=None, all_tensors_to_one_file=None): Saves an ONNX model to the specified path. ...
Implement the Python class `SaveOnnx` described below. Class description: Functor that saves an ONNX model to the specified path. Method signatures and docstrings: - def __init__(self, model, path, external_data_path=None, size_threshold=None, all_tensors_to_one_file=None): Saves an ONNX model to the specified path. ...
a167852705d74bcc619d8fad0af4b9e4d84472fc
<|skeleton|> class SaveOnnx: """Functor that saves an ONNX model to the specified path.""" def __init__(self, model, path, external_data_path=None, size_threshold=None, all_tensors_to_one_file=None): """Saves an ONNX model to the specified path. Args: model (Union[onnx.ModelProto, Callable() -> onnx.Mo...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SaveOnnx: """Functor that saves an ONNX model to the specified path.""" def __init__(self, model, path, external_data_path=None, size_threshold=None, all_tensors_to_one_file=None): """Saves an ONNX model to the specified path. Args: model (Union[onnx.ModelProto, Callable() -> onnx.ModelProto]): A...
the_stack_v2_python_sparse
tools/Polygraphy/polygraphy/backend/onnx/loader.py
NVIDIA/TensorRT
train
8,026
1db467157ad239b3c9beb55c344c33985510ecc6
[ "dp = np.ones((m, n))\nfor i in xrange(1, m):\n for j in xrange(1, n):\n dp[i][j] = dp[i - 1][j] + dp[i][j - 1]\nreturn int(dp[m - 1][n - 1])", "dp = [[1 for i in xrange(n)] for j in xrange(m)]\nfor i in xrange(1, m):\n for j in xrange(1, n):\n dp[i][j] = dp[i - 1][j] + dp[i][j - 1]\nreturn in...
<|body_start_0|> dp = np.ones((m, n)) for i in xrange(1, m): for j in xrange(1, n): dp[i][j] = dp[i - 1][j] + dp[i][j - 1] return int(dp[m - 1][n - 1]) <|end_body_0|> <|body_start_1|> dp = [[1 for i in xrange(n)] for j in xrange(m)] for i in xrange(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 uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = np.ones((m, n)) for i in...
stack_v2_sparse_classes_75kplus_train_066467
684
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": "uniquePaths", "signature": "def uniquePaths(self, m, n)" } ]
2
stack_v2_sparse_classes_30k_train_005956
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 uniquePaths(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 uniquePaths(self, m, n): :type m: int :type n: int :rtype: int <|skeleton|> class Solution: def uni...
131fe3d622aa765a044fede9d38c9b3fbcd26966
<|skeleton|> class Solution: def uniquePaths(self, m, n): """:type m: int :type n: int :rtype: int""" <|body_0|> def uniquePaths(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 = np.ones((m, n)) for i in xrange(1, m): for j in xrange(1, n): dp[i][j] = dp[i - 1][j] + dp[i][j - 1] return int(dp[m - 1][n - 1]) def uniquePaths(self, m, n)...
the_stack_v2_python_sparse
leetcode/unique-paths.py
Vspick/python_interview
train
0
6b723ca5b76215f0ff4561982dea69962aef9f0a
[ "if not string:\n return Strings.EMPTY\nif not isinstance(string, str):\n string = str(string)\nstring = string.strip().lower()\nif string.startswith(('a ', 'an ')):\n return Strings.EMPTY\nif Strings.is_vowel(string[0]):\n return 'an'\nreturn 'a'", "intensifiers = ['', 'rather', 'slightly', 'very', '...
<|body_start_0|> if not string: return Strings.EMPTY if not isinstance(string, str): string = str(string) string = string.strip().lower() if string.startswith(('a ', 'an ')): return Strings.EMPTY if Strings.is_vowel(string[0]): retu...
Class docstring.
Utils
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Utils: """Class docstring.""" def article_for(cls, string): """Method docstring.""" <|body_0|> def random_intensifier(cls, uniform=False): """Method docstring.""" <|body_1|> def scan_for_values_with_key(cls, obj, key): """Method docstring."""...
stack_v2_sparse_classes_75kplus_train_066468
1,557
no_license
[ { "docstring": "Method docstring.", "name": "article_for", "signature": "def article_for(cls, string)" }, { "docstring": "Method docstring.", "name": "random_intensifier", "signature": "def random_intensifier(cls, uniform=False)" }, { "docstring": "Method docstring.", "name":...
3
stack_v2_sparse_classes_30k_train_037965
Implement the Python class `Utils` described below. Class description: Class docstring. Method signatures and docstrings: - def article_for(cls, string): Method docstring. - def random_intensifier(cls, uniform=False): Method docstring. - def scan_for_values_with_key(cls, obj, key): Method docstring.
Implement the Python class `Utils` described below. Class description: Class docstring. Method signatures and docstrings: - def article_for(cls, string): Method docstring. - def random_intensifier(cls, uniform=False): Method docstring. - def scan_for_values_with_key(cls, obj, key): Method docstring. <|skeleton|> cla...
f4c2533cd4543717b57743b8dabd783fa7cfcd60
<|skeleton|> class Utils: """Class docstring.""" def article_for(cls, string): """Method docstring.""" <|body_0|> def random_intensifier(cls, uniform=False): """Method docstring.""" <|body_1|> def scan_for_values_with_key(cls, obj, key): """Method docstring."""...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Utils: """Class docstring.""" def article_for(cls, string): """Method docstring.""" if not string: return Strings.EMPTY if not isinstance(string, str): string = str(string) string = string.strip().lower() if string.startswith(('a ', 'an ')):...
the_stack_v2_python_sparse
rng/helpers/utils.py
janvanoverwalle/random-npc-generator
train
0
a7bf5925817b5e4c247b6a52c152704abf609e66
[ "view = OrganizationViewSet(kwargs={})\nview.request = Mock()\nview.request.method = 'GET'\nself.assertEqual(view.get_serializer_class(), CondensedOrganizationSerializer)\nview.request.method = 'POST'\nself.assertEqual(view.get_serializer_class(), CreateOrganizationSerializer)\norg = Organization.objects.create()\n...
<|body_start_0|> view = OrganizationViewSet(kwargs={}) view.request = Mock() view.request.method = 'GET' self.assertEqual(view.get_serializer_class(), CondensedOrganizationSerializer) view.request.method = 'POST' self.assertEqual(view.get_serializer_class(), CreateOrganiz...
OrganizationViewSetTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OrganizationViewSetTest: def test_get_serializer_class(self): """Test correct serializer is used.""" <|body_0|> def test_get_queryset(self): """Test only organizations where user is a member are returned.""" <|body_1|> def test_post_save(self): "...
stack_v2_sparse_classes_75kplus_train_066469
26,005
no_license
[ { "docstring": "Test correct serializer is used.", "name": "test_get_serializer_class", "signature": "def test_get_serializer_class(self)" }, { "docstring": "Test only organizations where user is a member are returned.", "name": "test_get_queryset", "signature": "def test_get_queryset(se...
3
null
Implement the Python class `OrganizationViewSetTest` described below. Class description: Implement the OrganizationViewSetTest class. Method signatures and docstrings: - def test_get_serializer_class(self): Test correct serializer is used. - def test_get_queryset(self): Test only organizations where user is a member ...
Implement the Python class `OrganizationViewSetTest` described below. Class description: Implement the OrganizationViewSetTest class. Method signatures and docstrings: - def test_get_serializer_class(self): Test correct serializer is used. - def test_get_queryset(self): Test only organizations where user is a member ...
91c485edbe817893eb680d92d048182facd20279
<|skeleton|> class OrganizationViewSetTest: def test_get_serializer_class(self): """Test correct serializer is used.""" <|body_0|> def test_get_queryset(self): """Test only organizations where user is a member are returned.""" <|body_1|> def test_post_save(self): "...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class OrganizationViewSetTest: def test_get_serializer_class(self): """Test correct serializer is used.""" view = OrganizationViewSet(kwargs={}) view.request = Mock() view.request.method = 'GET' self.assertEqual(view.get_serializer_class(), CondensedOrganizationSerializer) ...
the_stack_v2_python_sparse
apps/accounts/tests.py
mccloyjason/VisualOrg-develop
train
0
e8d632942b51977f54ed57e3b3dbe11fa8b4f67c
[ "def input_fn():\n return ({'age': tf.constant([1]), 'language': tf.SparseTensor(values=['english'], indices=[[0, 0]], shape=[1, 1])}, tf.constant([[1]]))\nlanguage = tf.contrib.layers.sparse_column_with_hash_bucket('language', 100)\nage = tf.contrib.layers.real_valued_column('age')\ntarget_column = layers.multi...
<|body_start_0|> def input_fn(): return ({'age': tf.constant([1]), 'language': tf.SparseTensor(values=['english'], indices=[[0, 0]], shape=[1, 1])}, tf.constant([[1]])) language = tf.contrib.layers.sparse_column_with_hash_bucket('language', 100) age = tf.contrib.layers.real_valued_co...
ComposableModelTest
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ComposableModelTest: def testLinearModel(self): """Tests that loss goes down with training.""" <|body_0|> def testDNNModel(self): """Tests multi-class classification using matrix data as input.""" <|body_1|> <|end_skeleton|> <|body_start_0|> def inp...
stack_v2_sparse_classes_75kplus_train_066470
4,936
permissive
[ { "docstring": "Tests that loss goes down with training.", "name": "testLinearModel", "signature": "def testLinearModel(self)" }, { "docstring": "Tests multi-class classification using matrix data as input.", "name": "testDNNModel", "signature": "def testDNNModel(self)" } ]
2
stack_v2_sparse_classes_30k_train_035933
Implement the Python class `ComposableModelTest` described below. Class description: Implement the ComposableModelTest class. Method signatures and docstrings: - def testLinearModel(self): Tests that loss goes down with training. - def testDNNModel(self): Tests multi-class classification using matrix data as input.
Implement the Python class `ComposableModelTest` described below. Class description: Implement the ComposableModelTest class. Method signatures and docstrings: - def testLinearModel(self): Tests that loss goes down with training. - def testDNNModel(self): Tests multi-class classification using matrix data as input. ...
6d39eeb66c63a6f0f7895befc588c9eb1dd105f9
<|skeleton|> class ComposableModelTest: def testLinearModel(self): """Tests that loss goes down with training.""" <|body_0|> def testDNNModel(self): """Tests multi-class classification using matrix data as input.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class ComposableModelTest: def testLinearModel(self): """Tests that loss goes down with training.""" def input_fn(): return ({'age': tf.constant([1]), 'language': tf.SparseTensor(values=['english'], indices=[[0, 0]], shape=[1, 1])}, tf.constant([[1]])) language = tf.contrib.layer...
the_stack_v2_python_sparse
jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/composable_model_test.py
Lab603/PicEncyclopedias
train
6
adb19d7e105462a4841a136cb62fd3fe105c6b5f
[ "super().__init__(*args, **kwargs)\nsource_projects = DataRequestProject.objects.filter(approved=True).exclude(returned_data_description='')\nself.fields['requested_sources'].choices = [(p.id, p.name) for p in source_projects]\nself.fields['requested_sources'].widget = forms.CheckboxSelectMultiple()\nself.fields['r...
<|body_start_0|> super().__init__(*args, **kwargs) source_projects = DataRequestProject.objects.filter(approved=True).exclude(returned_data_description='') self.fields['requested_sources'].choices = [(p.id, p.name) for p in source_projects] self.fields['requested_sources'].widget = forms...
The base for all DataRequestProject forms
DataRequestProjectForm
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataRequestProjectForm: """The base for all DataRequestProject forms""" def __init__(self, *args, **kwargs): """Add custom handling for requested_sources and override some widgets.""" <|body_0|> def clean(self): """Logic to for conditional required elements in ou...
stack_v2_sparse_classes_75kplus_train_066471
16,550
permissive
[ { "docstring": "Add custom handling for requested_sources and override some widgets.", "name": "__init__", "signature": "def __init__(self, *args, **kwargs)" }, { "docstring": "Logic to for conditional required elements in our form.", "name": "clean", "signature": "def clean(self)" } ]
2
stack_v2_sparse_classes_30k_train_021880
Implement the Python class `DataRequestProjectForm` described below. Class description: The base for all DataRequestProject forms Method signatures and docstrings: - def __init__(self, *args, **kwargs): Add custom handling for requested_sources and override some widgets. - def clean(self): Logic to for conditional re...
Implement the Python class `DataRequestProjectForm` described below. Class description: The base for all DataRequestProject forms Method signatures and docstrings: - def __init__(self, *args, **kwargs): Add custom handling for requested_sources and override some widgets. - def clean(self): Logic to for conditional re...
a2e3bf3b95d7fcfb2cdffe3a42f86cb6e09674e4
<|skeleton|> class DataRequestProjectForm: """The base for all DataRequestProject forms""" def __init__(self, *args, **kwargs): """Add custom handling for requested_sources and override some widgets.""" <|body_0|> def clean(self): """Logic to for conditional required elements in ou...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class DataRequestProjectForm: """The base for all DataRequestProject forms""" def __init__(self, *args, **kwargs): """Add custom handling for requested_sources and override some widgets.""" super().__init__(*args, **kwargs) source_projects = DataRequestProject.objects.filter(approved=Tr...
the_stack_v2_python_sparse
private_sharing/forms.py
madprime/open-humans
train
2
44aeb635127e158c8f7626e8a91a5badd0892409
[ "self.type = 'cch' if 'c1' in dict else 'hch'\nself.c1 = float(dict['c1']) if self.type == 'cch' else 0.0\nself.h1 = float(dict['h1']) if self.type == 'hch' else 0.0\nself.c2 = float(dict['c2'])\nself.h2 = float(dict['h2'])\nself.intensity = float(dict['intensity'])", "assert self.type == other.type\nif self.type...
<|body_start_0|> self.type = 'cch' if 'c1' in dict else 'hch' self.c1 = float(dict['c1']) if self.type == 'cch' else 0.0 self.h1 = float(dict['h1']) if self.type == 'hch' else 0.0 self.c2 = float(dict['c2']) self.h2 = float(dict['h2']) self.intensity = float(dict['intensi...
Class for storing peaks so that we can eliminate duplicates using a connected component algorithm
Peak
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Peak: """Class for storing peaks so that we can eliminate duplicates using a connected component algorithm""" def __init__(self, dict): """Construct from dictionary""" <|body_0|> def connected(self, other, ctol, htol): """Determine if these are close enough in sp...
stack_v2_sparse_classes_75kplus_train_066472
4,828
no_license
[ { "docstring": "Construct from dictionary", "name": "__init__", "signature": "def __init__(self, dict)" }, { "docstring": "Determine if these are close enough in space to be connected", "name": "connected", "signature": "def connected(self, other, ctol, htol)" } ]
2
stack_v2_sparse_classes_30k_train_002867
Implement the Python class `Peak` described below. Class description: Class for storing peaks so that we can eliminate duplicates using a connected component algorithm Method signatures and docstrings: - def __init__(self, dict): Construct from dictionary - def connected(self, other, ctol, htol): Determine if these a...
Implement the Python class `Peak` described below. Class description: Class for storing peaks so that we can eliminate duplicates using a connected component algorithm Method signatures and docstrings: - def __init__(self, dict): Construct from dictionary - def connected(self, other, ctol, htol): Determine if these a...
a34db94ca47e1a3afe9c73889b73ca37f8f97b3d
<|skeleton|> class Peak: """Class for storing peaks so that we can eliminate duplicates using a connected component algorithm""" def __init__(self, dict): """Construct from dictionary""" <|body_0|> def connected(self, other, ctol, htol): """Determine if these are close enough in sp...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Peak: """Class for storing peaks so that we can eliminate duplicates using a connected component algorithm""" def __init__(self, dict): """Construct from dictionary""" self.type = 'cch' if 'c1' in dict else 'hch' self.c1 = float(dict['c1']) if self.type == 'cch' else 0.0 s...
the_stack_v2_python_sparse
scripts/pipe2meth.py
bcsherma/camera
train
0
09c463b527e98a07e274a6bddaf499d1e10bf7e0
[ "command = ' '.join([*repobee_plug.cli.CoreCommand.repos.clone.as_name_tuple(), *BASE_ARGS, *MASTER_REPOS_ARG, *STUDENTS_ARG])\nrun_repobee(command, workdir=tmpdir, plugins=[_repobee.ext.gitlab])\nassert_cloned_repos(STUDENT_TEAMS, assignment_names, tmpdir)", "command = ' '.join([*repobee_plug.cli.CoreCommand.rep...
<|body_start_0|> command = ' '.join([*repobee_plug.cli.CoreCommand.repos.clone.as_name_tuple(), *BASE_ARGS, *MASTER_REPOS_ARG, *STUDENTS_ARG]) run_repobee(command, workdir=tmpdir, plugins=[_repobee.ext.gitlab]) assert_cloned_repos(STUDENT_TEAMS, assignment_names, tmpdir) <|end_body_0|> <|body_s...
Integration tests for the clone command.
TestClone
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestClone: """Integration tests for the clone command.""" def test_clean_clone(self, with_student_repos, tmpdir): """Test cloning student repos when there are no repos in the current working directory.""" <|body_0|> def test_clone_twice(self, with_student_repos, tmpdir):...
stack_v2_sparse_classes_75kplus_train_066473
27,380
permissive
[ { "docstring": "Test cloning student repos when there are no repos in the current working directory.", "name": "test_clean_clone", "signature": "def test_clean_clone(self, with_student_repos, tmpdir)" }, { "docstring": "Cloning twice in a row should have the same effect as cloning once.", "n...
5
null
Implement the Python class `TestClone` described below. Class description: Integration tests for the clone command. Method signatures and docstrings: - def test_clean_clone(self, with_student_repos, tmpdir): Test cloning student repos when there are no repos in the current working directory. - def test_clone_twice(se...
Implement the Python class `TestClone` described below. Class description: Integration tests for the clone command. Method signatures and docstrings: - def test_clean_clone(self, with_student_repos, tmpdir): Test cloning student repos when there are no repos in the current working directory. - def test_clone_twice(se...
5db5e78a9eba685a85211a31e3b2033338e03ab5
<|skeleton|> class TestClone: """Integration tests for the clone command.""" def test_clean_clone(self, with_student_repos, tmpdir): """Test cloning student repos when there are no repos in the current working directory.""" <|body_0|> def test_clone_twice(self, with_student_repos, tmpdir):...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TestClone: """Integration tests for the clone command.""" def test_clean_clone(self, with_student_repos, tmpdir): """Test cloning student repos when there are no repos in the current working directory.""" command = ' '.join([*repobee_plug.cli.CoreCommand.repos.clone.as_name_tuple(), *BASE...
the_stack_v2_python_sparse
system_tests/gitlab/test_gitlab_system.py
repobee/repobee
train
62
757964161dd89c5d39077a62a765398605121c04
[ "self.filename = os.path.join(write_dir, 'hdf5/data%08d.h5' % i)\nself.iteration = i\nself.zmin_lab = zmin_lab\nself.zmax_lab = zmax_lab\nself.t_lab = t_lab\nself.current_z_lab = 0\nself.current_z_boost = 0\nself.buffered_slices = []\nself.buffer_z_indices = []\ndata_shape = (10, 2 * fld.Nm - 1, Nr_output)\nif fld....
<|body_start_0|> self.filename = os.path.join(write_dir, 'hdf5/data%08d.h5' % i) self.iteration = i self.zmin_lab = zmin_lab self.zmax_lab = zmax_lab self.t_lab = t_lab self.current_z_lab = 0 self.current_z_boost = 0 self.buffered_slices = [] self....
Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame)
LabSnapshot
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabSnapshot: """Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame)""" def __init__(self, t_lab, zmin_lab, zmax_lab, write_dir, i, fld, Nr_output): """Initialize a LabSnapshot Parameters ---------- t_lab: float (seconds) Tim...
stack_v2_sparse_classes_75kplus_train_066474
33,919
permissive
[ { "docstring": "Initialize a LabSnapshot Parameters ---------- t_lab: float (seconds) Time of this snapshot *in the lab frame* zmin_lab, zmax_lab: floats Longitudinal limits of this snapshot write_dir: string Absolute path to the directory where the data for this snapshot is to be written i: int Number of the f...
4
stack_v2_sparse_classes_30k_val_000155
Implement the Python class `LabSnapshot` described below. Class description: Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame) Method signatures and docstrings: - def __init__(self, t_lab, zmin_lab, zmax_lab, write_dir, i, fld, Nr_output): Initialize a Lab...
Implement the Python class `LabSnapshot` described below. Class description: Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame) Method signatures and docstrings: - def __init__(self, t_lab, zmin_lab, zmax_lab, write_dir, i, fld, Nr_output): Initialize a Lab...
5744598571eab40c4fb45cc3db21f346b69b1f37
<|skeleton|> class LabSnapshot: """Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame)""" def __init__(self, t_lab, zmin_lab, zmax_lab, write_dir, i, fld, Nr_output): """Initialize a LabSnapshot Parameters ---------- t_lab: float (seconds) Tim...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class LabSnapshot: """Class that stores data relative to one given snapshot in the lab frame (i.e. one given *time* in the lab frame)""" def __init__(self, t_lab, zmin_lab, zmax_lab, write_dir, i, fld, Nr_output): """Initialize a LabSnapshot Parameters ---------- t_lab: float (seconds) Time of this sna...
the_stack_v2_python_sparse
fbpic/openpmd_diag/boosted_field_diag.py
fbpic/fbpic
train
163
0d44d84179e604c5d704f2b6e09779363c663ce1
[ "team = self.get_object()\ndata = {}\nstatus_code = status.HTTP_200_OK\nif request.method in ['DELETE', 'POST']:\n username = request.data.get('username') or request.query_params.get('username')\n if username:\n try:\n user = User.objects.get(username__iexact=username)\n except User.D...
<|body_start_0|> team = self.get_object() data = {} status_code = status.HTTP_200_OK if request.method in ['DELETE', 'POST']: username = request.data.get('username') or request.query_params.get('username') if username: try: user...
This endpoint allows you to create, update and view team information.
TeamViewSet
[ "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TeamViewSet: """This endpoint allows you to create, update and view team information.""" def members(self, request, *args, **kwargs): """Returns members of an organization.""" <|body_0|> def share(self, request, *args, **kwargs): """Performs sharing a team projec...
stack_v2_sparse_classes_75kplus_train_066475
4,028
permissive
[ { "docstring": "Returns members of an organization.", "name": "members", "signature": "def members(self, request, *args, **kwargs)" }, { "docstring": "Performs sharing a team project operations.", "name": "share", "signature": "def share(self, request, *args, **kwargs)" } ]
2
null
Implement the Python class `TeamViewSet` described below. Class description: This endpoint allows you to create, update and view team information. Method signatures and docstrings: - def members(self, request, *args, **kwargs): Returns members of an organization. - def share(self, request, *args, **kwargs): Performs ...
Implement the Python class `TeamViewSet` described below. Class description: This endpoint allows you to create, update and view team information. Method signatures and docstrings: - def members(self, request, *args, **kwargs): Returns members of an organization. - def share(self, request, *args, **kwargs): Performs ...
e5bdec91cb47179172b515bbcb91701262ff3377
<|skeleton|> class TeamViewSet: """This endpoint allows you to create, update and view team information.""" def members(self, request, *args, **kwargs): """Returns members of an organization.""" <|body_0|> def share(self, request, *args, **kwargs): """Performs sharing a team projec...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TeamViewSet: """This endpoint allows you to create, update and view team information.""" def members(self, request, *args, **kwargs): """Returns members of an organization.""" team = self.get_object() data = {} status_code = status.HTTP_200_OK if request.method in ...
the_stack_v2_python_sparse
onadata/apps/api/viewsets/team_viewset.py
onaio/onadata
train
177
46780f22b185fa8b881a63bb12a4c78e9e993e7b
[ "if not t1 and (not t2):\n return True\nif not t1 or not t2:\n return False\nif t1.val != t2.val:\n return False\nreturn self.is_same_tree_(t1.left, t2.left) and self.is_same_tree_(t1.right, t2.right)", "def check(tree_1: 'TreeNode', tree_2: 'TreeNode') -> bool:\n if not tree_1 and (not tree_2):\n ...
<|body_start_0|> if not t1 and (not t2): return True if not t1 or not t2: return False if t1.val != t2.val: return False return self.is_same_tree_(t1.left, t2.left) and self.is_same_tree_(t1.right, t2.right) <|end_body_0|> <|body_start_1|> def...
BinaryTree
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinaryTree: def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return:""" <|body_0|> def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach:...
stack_v2_sparse_classes_75kplus_train_066476
1,537
no_license
[ { "docstring": "Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return:", "name": "is_same_tree_", "signature": "def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool" }, { "docstring": "Approach: Iteration Time Complexity: O(N) Space Complexity:...
2
stack_v2_sparse_classes_30k_train_008874
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return: - def is_same...
Implement the Python class `BinaryTree` described below. Class description: Implement the BinaryTree class. Method signatures and docstrings: - def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return: - def is_same...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class BinaryTree: def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return:""" <|body_0|> def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach:...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BinaryTree: def is_same_tree_(self, t1: 'TreeNode', t2: 'TreeNode') -> bool: """Approach: Recursion Time Complexity: O(N) Space Complexity: O(N) :param t1: :param t2: :return:""" if not t1 and (not t2): return True if not t1 or not t2: return False if t1...
the_stack_v2_python_sparse
revisited/trees/same_tree.py
Shiv2157k/leet_code
train
1
2cf12eb5754304f54469ac06f70b327bfd0d91be
[ "if len(columns_names_lst) != len(encoders_lst):\n raise ValueError(\"Number of items in 'columns_names_lst' doesn't match number of items in 'encoders_lst'!\")\nself.columns_names_lst = columns_names_lst\nself.encoders_lst = encoders_lst\nself.missing_value_replacement = missing_value_replacement\nself.drop_ini...
<|body_start_0|> if len(columns_names_lst) != len(encoders_lst): raise ValueError("Number of items in 'columns_names_lst' doesn't match number of items in 'encoders_lst'!") self.columns_names_lst = columns_names_lst self.encoders_lst = encoders_lst self.missing_value_replacem...
The purpose of this class is to provide a transformer that encodes categorical features into numerical ones.
CategoricalFeaturesEncoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CategoricalFeaturesEncoder: """The purpose of this class is to provide a transformer that encodes categorical features into numerical ones.""" def __init__(self, columns_names_lst, encoders_lst, missing_value_replacement='NA', drop_initial_features=True): """Class' constructor Parame...
stack_v2_sparse_classes_75kplus_train_066477
20,975
no_license
[ { "docstring": "Class' constructor Parameters ---------- columns_names_lst : list Names of the columns we want to transform. encoders_lst : list Encoders chosen for each column of the columns_names_lst list. missing_value_replacement : string Value used to replace missing values. drop_initial_features : bool Fl...
4
null
Implement the Python class `CategoricalFeaturesEncoder` described below. Class description: The purpose of this class is to provide a transformer that encodes categorical features into numerical ones. Method signatures and docstrings: - def __init__(self, columns_names_lst, encoders_lst, missing_value_replacement='NA...
Implement the Python class `CategoricalFeaturesEncoder` described below. Class description: The purpose of this class is to provide a transformer that encodes categorical features into numerical ones. Method signatures and docstrings: - def __init__(self, columns_names_lst, encoders_lst, missing_value_replacement='NA...
ba9a7a15a3ae8b65cb09044489ee1d907a702909
<|skeleton|> class CategoricalFeaturesEncoder: """The purpose of this class is to provide a transformer that encodes categorical features into numerical ones.""" def __init__(self, columns_names_lst, encoders_lst, missing_value_replacement='NA', drop_initial_features=True): """Class' constructor Parame...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CategoricalFeaturesEncoder: """The purpose of this class is to provide a transformer that encodes categorical features into numerical ones.""" def __init__(self, columns_names_lst, encoders_lst, missing_value_replacement='NA', drop_initial_features=True): """Class' constructor Parameters --------...
the_stack_v2_python_sparse
python_code/M5_Forecasting_Accuracy/m5_forecasting_accuracy/preprocessing/categorical_encoders.py
ThomasSELECK/src
train
0
41a8740556569c404d258ad7acd7b39d974073d6
[ "new_l = ListNode(0)\ndummy = new_l\nwhile True:\n if l1 is None and l2 is None:\n break\n if l1 is None:\n new_l.next = ListNode(l2.val)\n l2 = l2.next\n new_l = new_l.next\n continue\n if l2 is None:\n new_l.next = ListNode(l1.val)\n new_l = new_l.next\n ...
<|body_start_0|> new_l = ListNode(0) dummy = new_l while True: if l1 is None and l2 is None: break if l1 is None: new_l.next = ListNode(l2.val) l2 = l2.next new_l = new_l.next continue ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def iter_node(self, head): """遍历链表 :param head: :return:""" <|body_1|> def add_nodes(self, value, n, pri_node): """批量增加新的节点 :param ...
stack_v2_sparse_classes_75kplus_train_066478
2,533
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": "遍历链表 :param head: :return:", "name": "iter_node", "signature": "def iter_node(self, head)" }, { "docstring": "批量增加新的...
3
stack_v2_sparse_classes_30k_train_015391
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def iter_node(self, head): 遍历链表 :param head: :return: - def add_nodes(self, value, n, pr...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def iter_node(self, head): 遍历链表 :param head: :return: - def add_nodes(self, value, n, pr...
25c132cbc8dd710a07e64227b803d194cfe7fd9d
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def iter_node(self, head): """遍历链表 :param head: :return:""" <|body_1|> def add_nodes(self, value, n, pri_node): """批量增加新的节点 :param ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" new_l = ListNode(0) dummy = new_l while True: if l1 is None and l2 is None: break if l1 is None: new_l.next = ListNode...
the_stack_v2_python_sparse
HOT100/mergeTwoLists.py
shakesun/leetcode
train
0
cc778a06470981cf308c1f2cbe45fcdc7a171279
[ "enc = ''\nfor string in strs:\n n = len(string)\n enc += str(n) + '#' + string\nreturn enc", "res = []\ni = 0\nwhile i < len(s):\n j = i\n while s[j] != '#':\n j += 1\n n = int(s[i:j])\n j += 1\n res.append(s[j:j + n])\n i = j + n\nreturn res" ]
<|body_start_0|> enc = '' for string in strs: n = len(string) enc += str(n) + '#' + string return enc <|end_body_0|> <|body_start_1|> res = [] i = 0 while i < len(s): j = i while s[j] != '#': j += 1 ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, strs: List[str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> List[str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|> <|body_start_0|> e...
stack_v2_sparse_classes_75kplus_train_066479
861
no_license
[ { "docstring": "Encodes a list of strings to a single string.", "name": "encode", "signature": "def encode(self, strs: List[str]) -> str" }, { "docstring": "Decodes a single string to a list of strings.", "name": "decode", "signature": "def decode(self, s: str) -> List[str]" } ]
2
stack_v2_sparse_classes_30k_test_000977
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: List[str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> List[str]: Decodes a single string to a list of strings.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, strs: List[str]) -> str: Encodes a list of strings to a single string. - def decode(self, s: str) -> List[str]: Decodes a single string to a list of strings. <|skelet...
3241a71669809ba3c6e513a21b099e8a7a69b15e
<|skeleton|> class Codec: def encode(self, strs: List[str]) -> str: """Encodes a list of strings to a single string.""" <|body_0|> def decode(self, s: str) -> List[str]: """Decodes a single string to a list of strings.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Codec: def encode(self, strs: List[str]) -> str: """Encodes a list of strings to a single string.""" enc = '' for string in strs: n = len(string) enc += str(n) + '#' + string return enc def decode(self, s: str) -> List[str]: """Decodes a sin...
the_stack_v2_python_sparse
271-encode-and-decode-strings/271-encode-and-decode-strings.py
alsomilo/leetcode
train
0
27c2f9fc4ac95cfff01f43dbba33f38d9b8b577c
[ "if any((param is None for param in (environ.get('CUSTOMER_URL'), environ.get('KAFKA_CONNECTION')))):\n sys.exit('Failed find env of: CUSTOMER_URL, KAFKA_CONNECTION')\nself.kafka = KafkaProducerHelper(topic='orders', server=[environ.get('KAFKA_CONNECTION')])\nself.customer_url = environ.get('CUSTOMER_URL')", "...
<|body_start_0|> if any((param is None for param in (environ.get('CUSTOMER_URL'), environ.get('KAFKA_CONNECTION')))): sys.exit('Failed find env of: CUSTOMER_URL, KAFKA_CONNECTION') self.kafka = KafkaProducerHelper(topic='orders', server=[environ.get('KAFKA_CONNECTION')]) self.custome...
CustomerFacing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomerFacing: def __init__(self): """Constructor for the class for customer facing. Will initialize the KafkaProducerHelper with kafka connection from env and the customer management service url""" <|body_0|> def buy(self, message): """buy method for add new order,...
stack_v2_sparse_classes_75kplus_train_066480
1,607
no_license
[ { "docstring": "Constructor for the class for customer facing. Will initialize the KafkaProducerHelper with kafka connection from env and the customer management service url", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "buy method for add new order, get json body and...
3
stack_v2_sparse_classes_30k_train_047973
Implement the Python class `CustomerFacing` described below. Class description: Implement the CustomerFacing class. Method signatures and docstrings: - def __init__(self): Constructor for the class for customer facing. Will initialize the KafkaProducerHelper with kafka connection from env and the customer management ...
Implement the Python class `CustomerFacing` described below. Class description: Implement the CustomerFacing class. Method signatures and docstrings: - def __init__(self): Constructor for the class for customer facing. Will initialize the KafkaProducerHelper with kafka connection from env and the customer management ...
c6a9028d0e98d07139ba9c65282e28d8f9399d5d
<|skeleton|> class CustomerFacing: def __init__(self): """Constructor for the class for customer facing. Will initialize the KafkaProducerHelper with kafka connection from env and the customer management service url""" <|body_0|> def buy(self, message): """buy method for add new order,...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CustomerFacing: def __init__(self): """Constructor for the class for customer facing. Will initialize the KafkaProducerHelper with kafka connection from env and the customer management service url""" if any((param is None for param in (environ.get('CUSTOMER_URL'), environ.get('KAFKA_CONNECTION...
the_stack_v2_python_sparse
customer-facing/app/models/customer_facing.py
danielleinov/home-test
train
0
fd5a8a708e08f24c0cd55d6a0136c3fe4bf4e622
[ "parser.add_argument('--instance', '-i', required=True, help='Cloud SQL instance ID.')\nparser.add_argument('common_name', help='User supplied name. Constrained to [a-zA-Z.-_ ]+.')\nparser.add_argument('--cert-file', default=None, help='Location of file which the private key of the created ssl-cert will be written ...
<|body_start_0|> parser.add_argument('--instance', '-i', required=True, help='Cloud SQL instance ID.') parser.add_argument('common_name', help='User supplied name. Constrained to [a-zA-Z.-_ ]+.') parser.add_argument('--cert-file', default=None, help='Location of file which the private key of the...
Creates an SSL certificate for a Cloud SQL instance.
AddCert
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddCert: """Creates an SSL certificate for a Cloud SQL instance.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional a...
stack_v2_sparse_classes_75kplus_train_066481
3,972
permissive
[ { "docstring": "Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are allowed.", "name": "Args", "signature": "def Args(parser)" }, { "docstri...
3
stack_v2_sparse_classes_30k_train_045526
Implement the Python class `AddCert` described below. Class description: Creates an SSL certificate for a Cloud SQL instance. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments tha...
Implement the Python class `AddCert` described below. Class description: Creates an SSL certificate for a Cloud SQL instance. Method signatures and docstrings: - def Args(parser): Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments tha...
90d87b2adb1eab7f218b075886aa620d8d6eeedb
<|skeleton|> class AddCert: """Creates an SSL certificate for a Cloud SQL instance.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional a...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class AddCert: """Creates an SSL certificate for a Cloud SQL instance.""" def Args(parser): """Args is called by calliope to gather arguments for this command. Args: parser: An argparse parser that you can use it to add arguments that go on the command line after this command. Positional arguments are ...
the_stack_v2_python_sparse
old/google-cloud-sdk/lib/googlecloudsdk/sql/tools/ssl_certs/create.py
altock/dev
train
0
2740d84036bfd6135852408dd98769908d737f9d
[ "print(self.token)\nheaders = {'Authorization': 'Bearer ' + self.token}\nr = self.send('GET', 'https://open.feishu.cn/open-apis/okr/v1/periods', headers=headers)\nreturn r.json()", "url = 'https://open.feishu.cn/open-apis/okr/v1/users/:%s/okrs' % user_id\nprint(url)\nparams = {'user_id_type': user_id, 'offset': '...
<|body_start_0|> print(self.token) headers = {'Authorization': 'Bearer ' + self.token} r = self.send('GET', 'https://open.feishu.cn/open-apis/okr/v1/periods', headers=headers) return r.json() <|end_body_0|> <|body_start_1|> url = 'https://open.feishu.cn/open-apis/okr/v1/users/:%...
FeishuOkr
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeishuOkr: def get_information(self): """获取OKR周期列表信息 :param :return:""" <|body_0|> def get_user_information(self, user_id: str): """获取某个用户的OKR周期列表信息 :param :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> print(self.token) headers = ...
stack_v2_sparse_classes_75kplus_train_066482
1,053
no_license
[ { "docstring": "获取OKR周期列表信息 :param :return:", "name": "get_information", "signature": "def get_information(self)" }, { "docstring": "获取某个用户的OKR周期列表信息 :param :return:", "name": "get_user_information", "signature": "def get_user_information(self, user_id: str)" } ]
2
stack_v2_sparse_classes_30k_train_033099
Implement the Python class `FeishuOkr` described below. Class description: Implement the FeishuOkr class. Method signatures and docstrings: - def get_information(self): 获取OKR周期列表信息 :param :return: - def get_user_information(self, user_id: str): 获取某个用户的OKR周期列表信息 :param :return:
Implement the Python class `FeishuOkr` described below. Class description: Implement the FeishuOkr class. Method signatures and docstrings: - def get_information(self): 获取OKR周期列表信息 :param :return: - def get_user_information(self, user_id: str): 获取某个用户的OKR周期列表信息 :param :return: <|skeleton|> class FeishuOkr: def ...
6648dbfb640b065ff2c76cb6889a8f9e4f124b91
<|skeleton|> class FeishuOkr: def get_information(self): """获取OKR周期列表信息 :param :return:""" <|body_0|> def get_user_information(self, user_id: str): """获取某个用户的OKR周期列表信息 :param :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class FeishuOkr: def get_information(self): """获取OKR周期列表信息 :param :return:""" print(self.token) headers = {'Authorization': 'Bearer ' + self.token} r = self.send('GET', 'https://open.feishu.cn/open-apis/okr/v1/periods', headers=headers) return r.json() def get_user_infor...
the_stack_v2_python_sparse
test_feishu/feishu/feishu_okr.py
Veraun/HogwartsSDET17-1
train
0
d8563700a3a3f692b6d2de0ba6bebd2735787b42
[ "max_heap = []\nitem_dict = {}\nresult = []\nfor i in range(len(nums)):\n item = [-nums[i], False]\n heapq.heappush(max_heap, item)\n if nums[i] not in item_dict:\n item_dict[nums[i]] = [item]\n else:\n item_dict[nums[i]].append(item)\n if i - k >= 0:\n item_to_remove = nums[i - ...
<|body_start_0|> max_heap = [] item_dict = {} result = [] for i in range(len(nums)): item = [-nums[i], False] heapq.heappush(max_heap, item) if nums[i] not in item_dict: item_dict[nums[i]] = [item] else: item...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """O(NlogN) solution, using tombstone marker without poping from heap please note that heapq support pushing list of item, first item in list will be used for comparison :param nums: :param k: :return:""" ...
stack_v2_sparse_classes_75kplus_train_066483
2,264
no_license
[ { "docstring": "O(NlogN) solution, using tombstone marker without poping from heap please note that heapq support pushing list of item, first item in list will be used for comparison :param nums: :param k: :return:", "name": "maxSlidingWindow", "signature": "def maxSlidingWindow(self, nums: List[int], k...
2
stack_v2_sparse_classes_30k_val_000051
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: O(NlogN) solution, using tombstone marker without poping from heap please note that heapq support pushing list o...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: O(NlogN) solution, using tombstone marker without poping from heap please note that heapq support pushing list o...
46bd8d1b44cb19aa773cc072cc9be97e9a0e348d
<|skeleton|> class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """O(NlogN) solution, using tombstone marker without poping from heap please note that heapq support pushing list of item, first item in list will be used for comparison :param nums: :param k: :return:""" ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]: """O(NlogN) solution, using tombstone marker without poping from heap please note that heapq support pushing list of item, first item in list will be used for comparison :param nums: :param k: :return:""" max_heap = []...
the_stack_v2_python_sparse
src/python/data_structure/heap/239_sliding_window_maximum.py
alannesta/algo4
train
0
e0f8727fb455a2ac44b6b2d6bd9231b3b2db6d48
[ "topicdf = pd.read_csv(topicfile, encoding='utf-8')\ntaglemdf = pd.read_csv(taglemfile, encoding='utf-8')\nreturn (topicdf, taglemdf)", "taglemdf = taglemdf[taglemcols]\nmerged = topicdf.merge(taglemdf, how=howmerge, on=mergeon)\nreturn merged", "errors = []\ntemp_lemtext = merged.lemma_text\ntemp_lemtext.dropn...
<|body_start_0|> topicdf = pd.read_csv(topicfile, encoding='utf-8') taglemdf = pd.read_csv(taglemfile, encoding='utf-8') return (topicdf, taglemdf) <|end_body_0|> <|body_start_1|> taglemdf = taglemdf[taglemcols] merged = topicdf.merge(taglemdf, how=howmerge, on=mergeon) ...
topiclem
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class topiclem: def loadtopiclem(topicfile, taglemfile): """Load topic and docid merged tag_lemma files.""" <|body_0|> def mergetoplem(topicdf, taglemdf, taglemcols, howmerge, mergeon): """Merge the topic and docid merged tag_lemma dataframes.""" <|body_1|> de...
stack_v2_sparse_classes_75kplus_train_066484
14,349
no_license
[ { "docstring": "Load topic and docid merged tag_lemma files.", "name": "loadtopiclem", "signature": "def loadtopiclem(topicfile, taglemfile)" }, { "docstring": "Merge the topic and docid merged tag_lemma dataframes.", "name": "mergetoplem", "signature": "def mergetoplem(topicdf, taglemdf...
3
stack_v2_sparse_classes_30k_train_025127
Implement the Python class `topiclem` described below. Class description: Implement the topiclem class. Method signatures and docstrings: - def loadtopiclem(topicfile, taglemfile): Load topic and docid merged tag_lemma files. - def mergetoplem(topicdf, taglemdf, taglemcols, howmerge, mergeon): Merge the topic and doc...
Implement the Python class `topiclem` described below. Class description: Implement the topiclem class. Method signatures and docstrings: - def loadtopiclem(topicfile, taglemfile): Load topic and docid merged tag_lemma files. - def mergetoplem(topicdf, taglemdf, taglemcols, howmerge, mergeon): Merge the topic and doc...
1cfddc59d596ac72c920d02903af2a7f8d48d20c
<|skeleton|> class topiclem: def loadtopiclem(topicfile, taglemfile): """Load topic and docid merged tag_lemma files.""" <|body_0|> def mergetoplem(topicdf, taglemdf, taglemcols, howmerge, mergeon): """Merge the topic and docid merged tag_lemma dataframes.""" <|body_1|> de...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class topiclem: def loadtopiclem(topicfile, taglemfile): """Load topic and docid merged tag_lemma files.""" topicdf = pd.read_csv(topicfile, encoding='utf-8') taglemdf = pd.read_csv(taglemfile, encoding='utf-8') return (topicdf, taglemdf) def mergetoplem(topicdf, taglemdf, tagle...
the_stack_v2_python_sparse
04-data_formatting/utils.py
rymc9384/PartyOfSpeech
train
0
f8a63997dcdb6c3e20c089ff5ff2ab99692e9ead
[ "self.host = host\nself.user = user\nself.password = password\nself.port = 22", "try:\n t = paramiko.Transport((self.host, self.port))\n t.connect(username=self.user, password=self.password)\n sftp = paramiko.SFTPClient.from_transport(t)\nexcept:\n return (None, None)\nreturn (sftp, t)", "myprint('r...
<|body_start_0|> self.host = host self.user = user self.password = password self.port = 22 <|end_body_0|> <|body_start_1|> try: t = paramiko.Transport((self.host, self.port)) t.connect(username=self.user, password=self.password) sftp = paramik...
upload file to remote host , or download file from remote host
SFTP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SFTP: """upload file to remote host , or download file from remote host""" def __init__(self, host, user, password): """init host, user, password, and port default 22""" <|body_0|> def connect(self): """Connect remote host ,return sftp object""" <|body_1|...
stack_v2_sparse_classes_75kplus_train_066485
8,680
no_license
[ { "docstring": "init host, user, password, and port default 22", "name": "__init__", "signature": "def __init__(self, host, user, password)" }, { "docstring": "Connect remote host ,return sftp object", "name": "connect", "signature": "def connect(self)" }, { "docstring": "upload ...
4
stack_v2_sparse_classes_30k_train_016755
Implement the Python class `SFTP` described below. Class description: upload file to remote host , or download file from remote host Method signatures and docstrings: - def __init__(self, host, user, password): init host, user, password, and port default 22 - def connect(self): Connect remote host ,return sftp object...
Implement the Python class `SFTP` described below. Class description: upload file to remote host , or download file from remote host Method signatures and docstrings: - def __init__(self, host, user, password): init host, user, password, and port default 22 - def connect(self): Connect remote host ,return sftp object...
c77c8c4795f2b9359106836a4d2af38aafbf025c
<|skeleton|> class SFTP: """upload file to remote host , or download file from remote host""" def __init__(self, host, user, password): """init host, user, password, and port default 22""" <|body_0|> def connect(self): """Connect remote host ,return sftp object""" <|body_1|...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SFTP: """upload file to remote host , or download file from remote host""" def __init__(self, host, user, password): """init host, user, password, and port default 22""" self.host = host self.user = user self.password = password self.port = 22 def connect(self...
the_stack_v2_python_sparse
Day10/src/myFabric.py
wenchong2008/learning
train
0
ac9b4941cc6afc65b5a7d63dc005f83082d588d8
[ "pygame.sprite.Sprite.__init__(self)\nself.image = spritesheet.Apply_Graphic(SPT_token.DIC_color[color][1])\nself.rect = self.image.get_rect()\nself.IMAGE, self.RECT = (self.image, self.rect)\nself.IDEN = SPT_token.DIC_color[color][0]\nself.SCORE = SPT_token.DIC_color[color][2]\nself.CLEAR = False\nself.ALPHA = 255...
<|body_start_0|> pygame.sprite.Sprite.__init__(self) self.image = spritesheet.Apply_Graphic(SPT_token.DIC_color[color][1]) self.rect = self.image.get_rect() self.IMAGE, self.RECT = (self.image, self.rect) self.IDEN = SPT_token.DIC_color[color][0] self.SCORE = SPT_token.DI...
The Token Object.
SPT_token
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SPT_token: """The Token Object.""" def __init__(self, spritesheet, color): """Initialize.""" <|body_0|> def update(self): """Update.""" <|body_1|> <|end_skeleton|> <|body_start_0|> pygame.sprite.Sprite.__init__(self) self.image = sprites...
stack_v2_sparse_classes_75kplus_train_066486
1,814
permissive
[ { "docstring": "Initialize.", "name": "__init__", "signature": "def __init__(self, spritesheet, color)" }, { "docstring": "Update.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_005742
Implement the Python class `SPT_token` described below. Class description: The Token Object. Method signatures and docstrings: - def __init__(self, spritesheet, color): Initialize. - def update(self): Update.
Implement the Python class `SPT_token` described below. Class description: The Token Object. Method signatures and docstrings: - def __init__(self, spritesheet, color): Initialize. - def update(self): Update. <|skeleton|> class SPT_token: """The Token Object.""" def __init__(self, spritesheet, color): ...
aa598c80202f34283c9154974872be030aa74f23
<|skeleton|> class SPT_token: """The Token Object.""" def __init__(self, spritesheet, color): """Initialize.""" <|body_0|> def update(self): """Update.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class SPT_token: """The Token Object.""" def __init__(self, spritesheet, color): """Initialize.""" pygame.sprite.Sprite.__init__(self) self.image = spritesheet.Apply_Graphic(SPT_token.DIC_color[color][1]) self.rect = self.image.get_rect() self.IMAGE, self.RECT = (self.im...
the_stack_v2_python_sparse
DIR_data/DIR_sprite/DAT_token.py
scskwirl/Stax
train
0
c6e1b2e3f9b1b14f4881ee9baa0e1999835e5ac2
[ "cube = set_up_variable_cube(np.zeros((2, 2), dtype=np.float32), name='lwe_thickness_of_precipitation_amount', units='m', time=dt(2017, 1, 10, 4, 0), frt=dt(2017, 1, 10, 3, 0))\nself.cube = add_coordinate(cube, [dt(2017, 1, 10, 3, 0), dt(2017, 1, 10, 4, 0)], 'time', is_datetime=True)\ndata = np.array([[[1.0, 1.0], ...
<|body_start_0|> cube = set_up_variable_cube(np.zeros((2, 2), dtype=np.float32), name='lwe_thickness_of_precipitation_amount', units='m', time=dt(2017, 1, 10, 4, 0), frt=dt(2017, 1, 10, 3, 0)) self.cube = add_coordinate(cube, [dt(2017, 1, 10, 3, 0), dt(2017, 1, 10, 4, 0)], 'time', is_datetime=True) ...
Tests for the process method in ChooseDefaultWeightsTriangular.
Test_process
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_process: """Tests for the process method in ChooseDefaultWeightsTriangular.""" def setUp(self): """Set up cubes used in unit tests""" <|body_0|> def test_same_units(self): """Test plugin produces the correct weights when the parameters for the triangle are i...
stack_v2_sparse_classes_75kplus_train_066487
13,166
permissive
[ { "docstring": "Set up cubes used in unit tests", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Test plugin produces the correct weights when the parameters for the triangle are in the same units as the input cube's coordinate", "name": "test_same_units", "signature"...
4
stack_v2_sparse_classes_30k_train_020142
Implement the Python class `Test_process` described below. Class description: Tests for the process method in ChooseDefaultWeightsTriangular. Method signatures and docstrings: - def setUp(self): Set up cubes used in unit tests - def test_same_units(self): Test plugin produces the correct weights when the parameters f...
Implement the Python class `Test_process` described below. Class description: Tests for the process method in ChooseDefaultWeightsTriangular. Method signatures and docstrings: - def setUp(self): Set up cubes used in unit tests - def test_same_units(self): Test plugin produces the correct weights when the parameters f...
cd2c9019944345df1e703bf8f625db537ad9f559
<|skeleton|> class Test_process: """Tests for the process method in ChooseDefaultWeightsTriangular.""" def setUp(self): """Set up cubes used in unit tests""" <|body_0|> def test_same_units(self): """Test plugin produces the correct weights when the parameters for the triangle are i...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Test_process: """Tests for the process method in ChooseDefaultWeightsTriangular.""" def setUp(self): """Set up cubes used in unit tests""" cube = set_up_variable_cube(np.zeros((2, 2), dtype=np.float32), name='lwe_thickness_of_precipitation_amount', units='m', time=dt(2017, 1, 10, 4, 0), f...
the_stack_v2_python_sparse
improver_tests/blending/weights/test_ChooseDefaultWeightsTriangular.py
metoppv/improver
train
101
de6849597c5d723fe2cc65243a26ebd859d292d6
[ "file = './FilteredData/filteredData.csv'\nmapData = MapDataSelector(file)\nt = mapData.getYearData(2000, ['Hail'])\nself.assertEqual(len(t), 2)\nself.assertEqual(len(t[0]), len(t[1]))\nself.assertTrue(len(t[0]) > 0)", "file = './FilteredData/filteredData.csv'\nmapData = MapDataSelector(file)\nt = mapData.getYear...
<|body_start_0|> file = './FilteredData/filteredData.csv' mapData = MapDataSelector(file) t = mapData.getYearData(2000, ['Hail']) self.assertEqual(len(t), 2) self.assertEqual(len(t[0]), len(t[1])) self.assertTrue(len(t[0]) > 0) <|end_body_0|> <|body_start_1|> fil...
MapDataTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MapDataTests: def test_lengthHail(self): """Tests lengths match""" <|body_0|> def test_lengthMulti(self): """Tests lengths match with multiselect""" <|body_1|> def test_lonMulti(self): """Tests lons valid""" <|body_2|> <|end_skeleton|> ...
stack_v2_sparse_classes_75kplus_train_066488
1,114
no_license
[ { "docstring": "Tests lengths match", "name": "test_lengthHail", "signature": "def test_lengthHail(self)" }, { "docstring": "Tests lengths match with multiselect", "name": "test_lengthMulti", "signature": "def test_lengthMulti(self)" }, { "docstring": "Tests lons valid", "nam...
3
stack_v2_sparse_classes_30k_train_026476
Implement the Python class `MapDataTests` described below. Class description: Implement the MapDataTests class. Method signatures and docstrings: - def test_lengthHail(self): Tests lengths match - def test_lengthMulti(self): Tests lengths match with multiselect - def test_lonMulti(self): Tests lons valid
Implement the Python class `MapDataTests` described below. Class description: Implement the MapDataTests class. Method signatures and docstrings: - def test_lengthHail(self): Tests lengths match - def test_lengthMulti(self): Tests lengths match with multiselect - def test_lonMulti(self): Tests lons valid <|skeleton|...
dc9185cbc5e65650d985ebecf877a157c8c19a13
<|skeleton|> class MapDataTests: def test_lengthHail(self): """Tests lengths match""" <|body_0|> def test_lengthMulti(self): """Tests lengths match with multiselect""" <|body_1|> def test_lonMulti(self): """Tests lons valid""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class MapDataTests: def test_lengthHail(self): """Tests lengths match""" file = './FilteredData/filteredData.csv' mapData = MapDataSelector(file) t = mapData.getYearData(2000, ['Hail']) self.assertEqual(len(t), 2) self.assertEqual(len(t[0]), len(t[1])) self.as...
the_stack_v2_python_sparse
rb2540/MapDataTests.py
ds-ga-1007/final_project
train
0
a2b77b9334175e596d10fe8f857b9a014b21bfb6
[ "build = self.context['build']\nif build.part != build_line.bom_item.part:\n if build_line.bom_item.inherited and build.part in build_line.bom_item.part.get_descendants(include_self=False):\n pass\n else:\n raise ValidationError(_('bom_item.part must point to the same part as the build order'))\...
<|body_start_0|> build = self.context['build'] if build.part != build_line.bom_item.part: if build_line.bom_item.inherited and build.part in build_line.bom_item.part.get_descendants(include_self=False): pass else: raise ValidationError(_('bom_item....
A serializer for allocating a single stock item against a build order.
BuildAllocationItemSerializer
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildAllocationItemSerializer: """A serializer for allocating a single stock item against a build order.""" def validate_build_line(self, build_line): """Check if the parts match""" <|body_0|> def validate_stock_item(self, stock_item): """Perform validation of th...
stack_v2_sparse_classes_75kplus_train_066489
38,426
permissive
[ { "docstring": "Check if the parts match", "name": "validate_build_line", "signature": "def validate_build_line(self, build_line)" }, { "docstring": "Perform validation of the stock_item field", "name": "validate_stock_item", "signature": "def validate_stock_item(self, stock_item)" }, ...
4
null
Implement the Python class `BuildAllocationItemSerializer` described below. Class description: A serializer for allocating a single stock item against a build order. Method signatures and docstrings: - def validate_build_line(self, build_line): Check if the parts match - def validate_stock_item(self, stock_item): Per...
Implement the Python class `BuildAllocationItemSerializer` described below. Class description: A serializer for allocating a single stock item against a build order. Method signatures and docstrings: - def validate_build_line(self, build_line): Check if the parts match - def validate_stock_item(self, stock_item): Per...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class BuildAllocationItemSerializer: """A serializer for allocating a single stock item against a build order.""" def validate_build_line(self, build_line): """Check if the parts match""" <|body_0|> def validate_stock_item(self, stock_item): """Perform validation of th...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class BuildAllocationItemSerializer: """A serializer for allocating a single stock item against a build order.""" def validate_build_line(self, build_line): """Check if the parts match""" build = self.context['build'] if build.part != build_line.bom_item.part: if build_line....
the_stack_v2_python_sparse
InvenTree/build/serializers.py
inventree/InvenTree
train
3,077
b7f1b538f16823b5b1a43390521e9b1794d94ca7
[ "super().__init__()\nself.cost_class = cost_class\nself.cost_line = cost_line\nassert cost_class != 0 or cost_line != 0, 'all costs cant be 0'", "bs, num_queries = outputs['pred_logits'].shape[:2]\nout_prob = outputs['pred_logits'].flatten(0, 1).softmax(-1)\nout_line = outputs['pred_lines'].flatten(0, 1)\ntgt_lin...
<|body_start_0|> super().__init__() self.cost_class = cost_class self.cost_line = cost_line assert cost_class != 0 or cost_line != 0, 'all costs cant be 0' <|end_body_0|> <|body_start_1|> bs, num_queries = outputs['pred_logits'].shape[:2] out_prob = outputs['pred_logits'...
This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best predictions, while the others are un-matched (...
HungarianMatcher_Line
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HungarianMatcher_Line: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the be...
stack_v2_sparse_classes_75kplus_train_066490
3,763
permissive
[ { "docstring": "Creates the matcher Params: cost_class: This is the relative weight of the classification error in the matching cost cost_line: This is the relative weight of the L1 error of the bounding box coordinates in the matching cost", "name": "__init__", "signature": "def __init__(self, cost_cla...
2
stack_v2_sparse_classes_30k_train_039515
Implement the Python class `HungarianMatcher_Line` described below. Class description: This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this ...
Implement the Python class `HungarianMatcher_Line` described below. Class description: This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this ...
6022fbd9df65569f4a82b1ac065bee8f26fc4ca6
<|skeleton|> class HungarianMatcher_Line: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the be...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class HungarianMatcher_Line: """This class computes an assignment between the targets and the predictions of the network For efficiency reasons, the targets don't include the no_object. Because of this, in general, there are more predictions than targets. In this case, we do a 1-to-1 matching of the best prediction...
the_stack_v2_python_sparse
src/models/matcher.py
WangShuaixian/LETR
train
0
99abcb659a3724732b8e45b8c141e55d6adc1831
[ "self.use_cuda = model_settings.USE_CUDA and torch.cuda.is_available()\nself.batch_size = model_settings.MAX_IMAGES_ON_DEVICE\nself.ram_size = model_settings.MAX_IMAGES_ON_RAM\nself.run_device = 'cuda' if self.use_cuda else 'cpu'\nself.cpu_device = 'cpu'\nself.output_layer_idx = output_layer_idx\nself.image_channel...
<|body_start_0|> self.use_cuda = model_settings.USE_CUDA and torch.cuda.is_available() self.batch_size = model_settings.MAX_IMAGES_ON_DEVICE self.ram_size = model_settings.MAX_IMAGES_ON_RAM self.run_device = 'cuda' if self.use_cuda else 'cpu' self.cpu_device = 'cpu' self....
Defines the perceptual model class.
PerceptualModel
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PerceptualModel: """Defines the perceptual model class.""" def __init__(self, output_layer_idx=23, min_val=-1.0, max_val=1.0): """Initializes.""" <|body_0|> def convert_tf_weights(self): """Converts pre-trained weights from tensorflow version.""" <|body_1...
stack_v2_sparse_classes_75kplus_train_066491
9,761
no_license
[ { "docstring": "Initializes.", "name": "__init__", "signature": "def __init__(self, output_layer_idx=23, min_val=-1.0, max_val=1.0)" }, { "docstring": "Converts pre-trained weights from tensorflow version.", "name": "convert_tf_weights", "signature": "def convert_tf_weights(self)" }, ...
5
null
Implement the Python class `PerceptualModel` described below. Class description: Defines the perceptual model class. Method signatures and docstrings: - def __init__(self, output_layer_idx=23, min_val=-1.0, max_val=1.0): Initializes. - def convert_tf_weights(self): Converts pre-trained weights from tensorflow version...
Implement the Python class `PerceptualModel` described below. Class description: Defines the perceptual model class. Method signatures and docstrings: - def __init__(self, output_layer_idx=23, min_val=-1.0, max_val=1.0): Initializes. - def convert_tf_weights(self): Converts pre-trained weights from tensorflow version...
0741978a7a4c79a95f113d1e5efb1f7d12d5f2fc
<|skeleton|> class PerceptualModel: """Defines the perceptual model class.""" def __init__(self, output_layer_idx=23, min_val=-1.0, max_val=1.0): """Initializes.""" <|body_0|> def convert_tf_weights(self): """Converts pre-trained weights from tensorflow version.""" <|body_1...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class PerceptualModel: """Defines the perceptual model class.""" def __init__(self, output_layer_idx=23, min_val=-1.0, max_val=1.0): """Initializes.""" self.use_cuda = model_settings.USE_CUDA and torch.cuda.is_available() self.batch_size = model_settings.MAX_IMAGES_ON_DEVICE sel...
the_stack_v2_python_sparse
models/perceptual_model.py
CastellanLiu/LinearGAN
train
0
b2b9bcb273a1e692687203047be7771bd7ea3e77
[ "nfilter = int(nelx * nely * (2 * (numpy.ceil(rmin) - 1) + 1) ** 2)\niH = numpy.zeros(nfilter)\njH = numpy.zeros(nfilter)\nsH = numpy.zeros(nfilter)\ncc = 0\nfor i in range(nelx):\n for j in range(nely):\n row = i * nely + j\n kk1 = int(numpy.maximum(i - (numpy.ceil(rmin) - 1), 0))\n kk2 = i...
<|body_start_0|> nfilter = int(nelx * nely * (2 * (numpy.ceil(rmin) - 1) + 1) ** 2) iH = numpy.zeros(nfilter) jH = numpy.zeros(nfilter) sH = numpy.zeros(nfilter) cc = 0 for i in range(nelx): for j in range(nely): row = i * nely + j ...
Filter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Filter: def prepare_filter(self, nelx, nely, rmin): """Build (and assemble) the index+data vectors for the coo matrix format.""" <|body_0|> def __init__(self, nelx, nely, params, problem_type): """Create a new filter engine.""" <|body_1|> def filter_vari...
stack_v2_sparse_classes_75kplus_train_066492
3,406
permissive
[ { "docstring": "Build (and assemble) the index+data vectors for the coo matrix format.", "name": "prepare_filter", "signature": "def prepare_filter(self, nelx, nely, rmin)" }, { "docstring": "Create a new filter engine.", "name": "__init__", "signature": "def __init__(self, nelx, nely, p...
6
stack_v2_sparse_classes_30k_train_009814
Implement the Python class `Filter` described below. Class description: Implement the Filter class. Method signatures and docstrings: - def prepare_filter(self, nelx, nely, rmin): Build (and assemble) the index+data vectors for the coo matrix format. - def __init__(self, nelx, nely, params, problem_type): Create a ne...
Implement the Python class `Filter` described below. Class description: Implement the Filter class. Method signatures and docstrings: - def prepare_filter(self, nelx, nely, rmin): Build (and assemble) the index+data vectors for the coo matrix format. - def __init__(self, nelx, nely, params, problem_type): Create a ne...
120209e695f4f25ecdc6797f683e2b23894689f4
<|skeleton|> class Filter: def prepare_filter(self, nelx, nely, rmin): """Build (and assemble) the index+data vectors for the coo matrix format.""" <|body_0|> def __init__(self, nelx, nely, params, problem_type): """Create a new filter engine.""" <|body_1|> def filter_vari...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Filter: def prepare_filter(self, nelx, nely, rmin): """Build (and assemble) the index+data vectors for the coo matrix format.""" nfilter = int(nelx * nely * (2 * (numpy.ceil(rmin) - 1) + 1) ** 2) iH = numpy.zeros(nfilter) jH = numpy.zeros(nfilter) sH = numpy.zeros(nfilt...
the_stack_v2_python_sparse
src/filter.py
Antoinehoff/Project_II
train
0
2bdac70951ec2b2e903828edf40984aacfecd03f
[ "with open('image_upload_times.csv', 'w', newline='') as file1:\n ui_writer = csv.writer(file1)\n ui_writer.writerow(['Camera Upload Times'])\n for i in ui_times:\n print(i)\n ui_writer.writerow(i)\nfile1.close()", "with open('image_upload_times.csv', 'w', newline='') as file1:\n ui_writ...
<|body_start_0|> with open('image_upload_times.csv', 'w', newline='') as file1: ui_writer = csv.writer(file1) ui_writer.writerow(['Camera Upload Times']) for i in ui_times: print(i) ui_writer.writerow(i) file1.close() <|end_body_0|> <|...
def __init__(self): ''' Initialize files ''' # uif = upload image file with open('image_upload_times.csv', 'w', newline='') as file1: ui_writer = csv.writer(file1) ui_writer.writerow(['Camera Upload Times']) self.uif = file1 # vq = video query file with open('video_query_times.csv', 'w', newline='') as file2: vq_writer...
TimeMeasurements
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimeMeasurements: """def __init__(self): ''' Initialize files ''' # uif = upload image file with open('image_upload_times.csv', 'w', newline='') as file1: ui_writer = csv.writer(file1) ui_writer.writerow(['Camera Upload Times']) self.uif = file1 # vq = video query file with open('video_query_time...
stack_v2_sparse_classes_75kplus_train_066493
1,381
no_license
[ { "docstring": "Write list of times to output file 'image_upload_times.csv'", "name": "WriteUploadTimes", "signature": "def WriteUploadTimes(self, ui_times)" }, { "docstring": "Write list of times to output file 'video_query_times.csv'", "name": "WriteVideoQueryTimes", "signature": "def ...
2
stack_v2_sparse_classes_30k_train_012928
Implement the Python class `TimeMeasurements` described below. Class description: def __init__(self): ''' Initialize files ''' # uif = upload image file with open('image_upload_times.csv', 'w', newline='') as file1: ui_writer = csv.writer(file1) ui_writer.writerow(['Camera Upload Times']) self.uif = file1 # vq = video...
Implement the Python class `TimeMeasurements` described below. Class description: def __init__(self): ''' Initialize files ''' # uif = upload image file with open('image_upload_times.csv', 'w', newline='') as file1: ui_writer = csv.writer(file1) ui_writer.writerow(['Camera Upload Times']) self.uif = file1 # vq = video...
fa417416b15551b901bab3f8b336dbb1471d2a21
<|skeleton|> class TimeMeasurements: """def __init__(self): ''' Initialize files ''' # uif = upload image file with open('image_upload_times.csv', 'w', newline='') as file1: ui_writer = csv.writer(file1) ui_writer.writerow(['Camera Upload Times']) self.uif = file1 # vq = video query file with open('video_query_time...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class TimeMeasurements: """def __init__(self): ''' Initialize files ''' # uif = upload image file with open('image_upload_times.csv', 'w', newline='') as file1: ui_writer = csv.writer(file1) ui_writer.writerow(['Camera Upload Times']) self.uif = file1 # vq = video query file with open('video_query_times.csv', 'w', ...
the_stack_v2_python_sparse
src/imageDB/time_measurements.py
PurdueCAM2Project/CAM2ImageDatabase
train
6
c790d3bcefcce4a21faf5f23e0d4b40d67086b85
[ "m = Mesh.Mesh(self.mesh_length, self.mesh_area, self.num_zones)\nfzd = Field.FieldZoneDouble(m)\nfzn = Field.FieldNodeDouble(m)\nfzm = Field.FieldZoneMat(m)\nself.assertEqual(m.numZones(), self.num_zones)\nself.assertEqual(m.length(), self.mesh_length)\nself.assertEqual(m.area(), self.mesh_area)\nm2 = Mesh.Mesh(se...
<|body_start_0|> m = Mesh.Mesh(self.mesh_length, self.mesh_area, self.num_zones) fzd = Field.FieldZoneDouble(m) fzn = Field.FieldNodeDouble(m) fzm = Field.FieldZoneMat(m) self.assertEqual(m.numZones(), self.num_zones) self.assertEqual(m.length(), self.mesh_length) ...
KnownValues
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KnownValues: def testInstantiation(self): """A Mesh and a Field should instantiate in python""" <|body_0|> def testFieldIteration(self): """We should be able to iterate over a Field to retrieve our values.""" <|body_1|> def testMeshIteration(self): ...
stack_v2_sparse_classes_75kplus_train_066494
2,961
permissive
[ { "docstring": "A Mesh and a Field should instantiate in python", "name": "testInstantiation", "signature": "def testInstantiation(self)" }, { "docstring": "We should be able to iterate over a Field to retrieve our values.", "name": "testFieldIteration", "signature": "def testFieldIterat...
4
stack_v2_sparse_classes_30k_test_000621
Implement the Python class `KnownValues` described below. Class description: Implement the KnownValues class. Method signatures and docstrings: - def testInstantiation(self): A Mesh and a Field should instantiate in python - def testFieldIteration(self): We should be able to iterate over a Field to retrieve our value...
Implement the Python class `KnownValues` described below. Class description: Implement the KnownValues class. Method signatures and docstrings: - def testInstantiation(self): A Mesh and a Field should instantiate in python - def testFieldIteration(self): We should be able to iterate over a Field to retrieve our value...
8e704613721a800ce1c59576e94f40fa6f7cd986
<|skeleton|> class KnownValues: def testInstantiation(self): """A Mesh and a Field should instantiate in python""" <|body_0|> def testFieldIteration(self): """We should be able to iterate over a Field to retrieve our values.""" <|body_1|> def testMeshIteration(self): ...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class KnownValues: def testInstantiation(self): """A Mesh and a Field should instantiate in python""" m = Mesh.Mesh(self.mesh_length, self.mesh_area, self.num_zones) fzd = Field.FieldZoneDouble(m) fzn = Field.FieldNodeDouble(m) fzm = Field.FieldZoneMat(m) self.assertE...
the_stack_v2_python_sparse
Code/branches/Pre-Prospectus/cpp/Geometry/TestGeometry.py
yaoayao87/PhDThesis
train
0
414c7e9dbe1a590259815fb994394a87e1fb9a7b
[ "cls.NETWORK_ATTACHMENT_ARG = flags.NetworkAttachmentArgument()\ncls.NETWORK_ATTACHMENT_ARG.AddArgument(parser, operation_type='create')\ncls.SUBNETWORK_ARG = subnetwork_flags.SubnetworkArgumentForNetworkAttachment()\ncls.SUBNETWORK_ARG.AddArgument(parser)\nparser.display_info.AddFormat(flags.DEFAULT_LIST_FORMAT)\n...
<|body_start_0|> cls.NETWORK_ATTACHMENT_ARG = flags.NetworkAttachmentArgument() cls.NETWORK_ATTACHMENT_ARG.AddArgument(parser, operation_type='create') cls.SUBNETWORK_ARG = subnetwork_flags.SubnetworkArgumentForNetworkAttachment() cls.SUBNETWORK_ARG.AddArgument(parser) parser.dis...
Create a Google Compute Engine network attachment.
Create
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Create: """Create a Google Compute Engine network attachment.""" def Args(cls, parser): """Create a Google Compute Engine network attachment. Args: parser: the parser that parses the input from the user.""" <|body_0|> def Run(self, args): """Issue a network attac...
stack_v2_sparse_classes_75kplus_train_066495
5,014
permissive
[ { "docstring": "Create a Google Compute Engine network attachment. Args: parser: the parser that parses the input from the user.", "name": "Args", "signature": "def Args(cls, parser)" }, { "docstring": "Issue a network attachment INSERT request.", "name": "Run", "signature": "def Run(sel...
2
stack_v2_sparse_classes_30k_train_025287
Implement the Python class `Create` described below. Class description: Create a Google Compute Engine network attachment. Method signatures and docstrings: - def Args(cls, parser): Create a Google Compute Engine network attachment. Args: parser: the parser that parses the input from the user. - def Run(self, args): ...
Implement the Python class `Create` described below. Class description: Create a Google Compute Engine network attachment. Method signatures and docstrings: - def Args(cls, parser): Create a Google Compute Engine network attachment. Args: parser: the parser that parses the input from the user. - def Run(self, args): ...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class Create: """Create a Google Compute Engine network attachment.""" def Args(cls, parser): """Create a Google Compute Engine network attachment. Args: parser: the parser that parses the input from the user.""" <|body_0|> def Run(self, args): """Issue a network attac...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Create: """Create a Google Compute Engine network attachment.""" def Args(cls, parser): """Create a Google Compute Engine network attachment. Args: parser: the parser that parses the input from the user.""" cls.NETWORK_ATTACHMENT_ARG = flags.NetworkAttachmentArgument() cls.NETWORK...
the_stack_v2_python_sparse
lib/surface/compute/network_attachments/create.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
31706784ec74c41b6b3a8cc04181959cdfb72400
[ "q = Path.all()\nq.filter('parent_c_key =', self.get_namekey())\nq.filter('name =', name)\npobjs = list(q.fetch(1))\nif not pobjs:\n return None\nreturn pobjs[0].get_content()", "q = Path.all()\nq.filter('parent_c_key =', self.get_namekey())\nif type:\n if isinstance(type, basestring):\n q.filter('ct...
<|body_start_0|> q = Path.all() q.filter('parent_c_key =', self.get_namekey()) q.filter('name =', name) pobjs = list(q.fetch(1)) if not pobjs: return None return pobjs[0].get_content() <|end_body_0|> <|body_start_1|> q = Path.all() q.filter('p...
A model class to perform as folder, storeing other object in one.
Folder
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Folder: """A model class to perform as folder, storeing other object in one.""" def get_child(self, name): """A method to obtain child object that has given name as its name.""" <|body_0|> def get_childs(self, start=0, end=-1, order='-created_at', type=None): """...
stack_v2_sparse_classes_75kplus_train_066496
10,914
permissive
[ { "docstring": "A method to obtain child object that has given name as its name.", "name": "get_child", "signature": "def get_child(self, name)" }, { "docstring": "A method to obtain multiple child object based on given parameters start, end and order. If end is not given, it returns count of BA...
5
stack_v2_sparse_classes_30k_train_024960
Implement the Python class `Folder` described below. Class description: A model class to perform as folder, storeing other object in one. Method signatures and docstrings: - def get_child(self, name): A method to obtain child object that has given name as its name. - def get_childs(self, start=0, end=-1, order='-crea...
Implement the Python class `Folder` described below. Class description: A model class to perform as folder, storeing other object in one. Method signatures and docstrings: - def get_child(self, name): A method to obtain child object that has given name as its name. - def get_childs(self, start=0, end=-1, order='-crea...
e1209f7d44d1c59ff9d373b7d89d414f31a9c28b
<|skeleton|> class Folder: """A model class to perform as folder, storeing other object in one.""" def get_child(self, name): """A method to obtain child object that has given name as its name.""" <|body_0|> def get_childs(self, start=0, end=-1, order='-created_at', type=None): """...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Folder: """A model class to perform as folder, storeing other object in one.""" def get_child(self, name): """A method to obtain child object that has given name as its name.""" q = Path.all() q.filter('parent_c_key =', self.get_namekey()) q.filter('name =', name) ...
the_stack_v2_python_sparse
applications/aha.application.coreblog3/application/model/basictype.py
Letractively/aha-gae
train
0
220ac5baf4695af8cbd2f56e8c06b5b16c812ded
[ "remote_folder = self._properties['remote_directory']\ncancelfile = os.path.join(remote_folder, self._cancelfile)\nif os.path.isfile(cancelfile):\n os.remove(cancelfile)\nnfiles = 0\nif not os.path.isdir(remote_folder):\n os.makedirs(remote_folder)\nif self._local_directory:\n local_folder = self._local_di...
<|body_start_0|> remote_folder = self._properties['remote_directory'] cancelfile = os.path.join(remote_folder, self._cancelfile) if os.path.isfile(cancelfile): os.remove(cancelfile) nfiles = 0 if not os.path.isdir(remote_folder): os.makedirs(remote_folder)...
Class for sending and deleting files and directories via system copy and delete. CopySender creates a remote directory if one does not already exist, and copies files and directories to that remote directory. Files are simply copied to the remote_directory. Files in the local directory are copied to the remote director...
CopySender
[ "LicenseRef-scancode-warranty-disclaimer", "CC0-1.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CopySender: """Class for sending and deleting files and directories via system copy and delete. CopySender creates a remote directory if one does not already exist, and copies files and directories to that remote directory. Files are simply copied to the remote_directory. Files in the local direc...
stack_v2_sparse_classes_75kplus_train_066497
5,731
permissive
[ { "docstring": "Send any files or folders that have been passed to constructor. This method deletes any previous cancel files that may exist in the remote_directory. Returns: Tuple containing number of files sent to local directory, and a message describing success.", "name": "send", "signature": "def s...
3
stack_v2_sparse_classes_30k_train_005379
Implement the Python class `CopySender` described below. Class description: Class for sending and deleting files and directories via system copy and delete. CopySender creates a remote directory if one does not already exist, and copies files and directories to that remote directory. Files are simply copied to the rem...
Implement the Python class `CopySender` described below. Class description: Class for sending and deleting files and directories via system copy and delete. CopySender creates a remote directory if one does not already exist, and copies files and directories to that remote directory. Files are simply copied to the rem...
302762b1441eab244b75c6fa977d1d3865834432
<|skeleton|> class CopySender: """Class for sending and deleting files and directories via system copy and delete. CopySender creates a remote directory if one does not already exist, and copies files and directories to that remote directory. Files are simply copied to the remote_directory. Files in the local direc...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class CopySender: """Class for sending and deleting files and directories via system copy and delete. CopySender creates a remote directory if one does not already exist, and copies files and directories to that remote directory. Files are simply copied to the remote_directory. Files in the local directory are copi...
the_stack_v2_python_sparse
impactutils/transfer/copysender.py
mhearne-usgs/earthquake-impact-utils
train
0
4954c7bf8e6fffe492d59be11f6e9c4b4547250f
[ "dp = [0] * (amount + 1)\ndp[0] = 1\nfor c in coins:\n for x in range(c, amount + 1):\n dp[x] += dp[x - c]\nreturn dp[amount]", "dp = [0] * (amount + 1)\ndp[0] = 1\nfor x in range(amount + 1):\n for c in coins:\n if c > x:\n break\n dp[x] += dp[x - c]\nreturn dp[amount]" ]
<|body_start_0|> dp = [0] * (amount + 1) dp[0] = 1 for c in coins: for x in range(c, amount + 1): dp[x] += dp[x - c] return dp[amount] <|end_body_0|> <|body_start_1|> dp = [0] * (amount + 1) dp[0] = 1 for x in range(amount + 1): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_0|> def change2(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_75kplus_train_066498
1,388
no_license
[ { "docstring": ":type amount: int :type coins: List[int] :rtype: int", "name": "change", "signature": "def change(self, amount, coins)" }, { "docstring": ":type amount: int :type coins: List[int] :rtype: int", "name": "change2", "signature": "def change2(self, amount, coins)" } ]
2
stack_v2_sparse_classes_30k_train_015775
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int - def change2(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def change(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int - def change2(self, amount, coins): :type amount: int :type coins: List[int] :rtype: int <|...
6fc30ba7f87c10bc9e4e7521ba577e2b4514950a
<|skeleton|> class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_0|> def change2(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Solution: def change(self, amount, coins): """:type amount: int :type coins: List[int] :rtype: int""" dp = [0] * (amount + 1) dp[0] = 1 for c in coins: for x in range(c, amount + 1): dp[x] += dp[x - c] return dp[amount] def change2(self,...
the_stack_v2_python_sparse
python/change.py
jkmiao/leetcodex
train
0
00ddd8a8d1d729f57df38d3c969c2201728c2657
[ "self._url = f'amqp://{host}:{port}'\nself._debug = debug\nself._conn = kombu.Connection(hostname=host, port=port, userid='guest', password='guest', virtual_host='/')", "self._conn.connect()\nqueue = kombu.Queue(routing_key, kombu.Exchange(exchange, type='topic'), routing_key=routing_key)\nqueue.maybe_bind(self._...
<|body_start_0|> self._url = f'amqp://{host}:{port}' self._debug = debug self._conn = kombu.Connection(hostname=host, port=port, userid='guest', password='guest', virtual_host='/') <|end_body_0|> <|body_start_1|> self._conn.connect() queue = kombu.Queue(routing_key, kombu.Exchan...
The Producer class writes messages to the message queue to be consumed.
Producer
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Producer: """The Producer class writes messages to the message queue to be consumed.""" def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False): """Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue serve...
stack_v2_sparse_classes_75kplus_train_066499
6,869
permissive
[ { "docstring": "Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue server :param debug: print debugging messages", "name": "__init__", "signature": "def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False)" }, { "docs...
2
stack_v2_sparse_classes_30k_train_017102
Implement the Python class `Producer` described below. Class description: The Producer class writes messages to the message queue to be consumed. Method signatures and docstrings: - def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False): Sets up connection to broker to write to. :param host: hostname f...
Implement the Python class `Producer` described below. Class description: The Producer class writes messages to the message queue to be consumed. Method signatures and docstrings: - def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False): Sets up connection to broker to write to. :param host: hostname f...
85102bb41aa0d558a3fa088e4fd6f51613599ad0
<|skeleton|> class Producer: """The Producer class writes messages to the message queue to be consumed.""" def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False): """Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue serve...
stack_v2_sparse_classes_75kplus
data/stack_v2_sparse_classes_30k
75,829
class Producer: """The Producer class writes messages to the message queue to be consumed.""" def __init__(self, host: str=HOST, port: int=PORT, debug: bool=False): """Sets up connection to broker to write to. :param host: hostname for the queue server :param port: port for the queue server :param debu...
the_stack_v2_python_sparse
base/modules/utils/root/sb_utils/amqp_tools.py
g2-inc/openc2-oif-orchestrator
train
1